diff options
author | Pierre Ossman <ossman@cendio.se> | 2012-10-30 10:26:23 +0000 |
---|---|---|
committer | Pierre Ossman <ossman@cendio.se> | 2012-10-30 10:26:23 +0000 |
commit | 1f884e0600aaad1c6b40d63478255ab28a5dce29 (patch) | |
tree | 7f8625524d6e719660639064a011536c68b43569 | |
parent | 2f3a04ef23d120598b6f32ea6f793aff0651e159 (diff) | |
download | tigervnc-1f884e0600aaad1c6b40d63478255ab28a5dce29.tar.gz tigervnc-1f884e0600aaad1c6b40d63478255ab28a5dce29.zip |
We need to be careful to not call X11 operations if the window isn't
shown yet.
git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@5011 3789f03b-4d11-0410-bbf8-ca57d06f2519
-rw-r--r-- | vncviewer/DesktopWindow.cxx | 40 |
1 files changed, 26 insertions, 14 deletions
diff --git a/vncviewer/DesktopWindow.cxx b/vncviewer/DesktopWindow.cxx index 378e43cf..40d08ae2 100644 --- a/vncviewer/DesktopWindow.cxx +++ b/vncviewer/DesktopWindow.cxx @@ -297,20 +297,32 @@ void DesktopWindow::resize(int x, int y, int w, int h) if (!fullscreen_active()) #endif { - // Get the real window coordinates, so we can determine if - // this is a request to resize, or a notification of a resize - // from the X server. - XWindowAttributes actual; - Window cr; - int wx, wy; - - XGetWindowAttributes(fl_display, fl_xid(this), &actual); - XTranslateCoordinates(fl_display, fl_xid(this), actual.root, - 0, 0, &wx, &wy, &cr); - - // Actual resize request? - if ((wx != x) || (wy != y) || - (actual.width != w) || (actual.height != h)) { + bool resize_req; + + // If there is no X11 window, then this must be a resize request, + // not a notification from the X server. + if (!shown()) + resize_req = true; + else { + // Otherwise we need to get the real window coordinates to tell + // the difference + XWindowAttributes actual; + Window cr; + int wx, wy; + + XGetWindowAttributes(fl_display, fl_xid(this), &actual); + XTranslateCoordinates(fl_display, fl_xid(this), actual.root, + 0, 0, &wx, &wy, &cr); + + // Actual resize request? + if ((wx != x) || (wy != y) || + (actual.width != w) || (actual.height != h)) + resize_req = true; + else + resize_req = false; + } + + if (resize_req) { for (int i = 0;i < Fl::screen_count();i++) { int sx, sy, sw, sh; |