From: Pierre Ossman Date: Tue, 30 Oct 2012 10:26:23 +0000 (+0000) Subject: We need to be careful to not call X11 operations if the window isn't X-Git-Tag: v1.2.90~74 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=1f884e0600aaad1c6b40d63478255ab28a5dce29;p=tigervnc.git 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 --- 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;