From: Peter Åstrand Date: Wed, 29 Aug 2012 07:14:31 +0000 (+0000) Subject: Move the -geometry parsing up, so that it affects fullscreen mode as X-Git-Tag: v1.2.90~104 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=c6cdc1fb302955c610399bfe24e10e783ae64ce6;p=tigervnc.git Move the -geometry parsing up, so that it affects fullscreen mode as well. This to allow specifying which monitor to use for fullscreen mode. git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@4981 3789f03b-4d11-0410-bbf8-ca57d06f2519 --- diff --git a/vncviewer/DesktopWindow.cxx b/vncviewer/DesktopWindow.cxx index ca33ebeb..d6c31e1b 100644 --- a/vncviewer/DesktopWindow.cxx +++ b/vncviewer/DesktopWindow.cxx @@ -75,6 +75,48 @@ DesktopWindow::DesktopWindow(int w, int h, const char *name, // Hack. See below... Fl::event_dispatch(&fltkHandle); + // Support for -geometry option. Note that although we do support + // negative coordinates, we do not support -XOFF-YOFF (ie + // coordinates relative to the right edge / bottom edge) at this + // time. + int geom_x = 0, geom_y = 0; + if (geometry.hasBeenSet()) { + int matched; + matched = sscanf(geometry.getValueStr(), "+%d+%d", &geom_x, &geom_y); + if (matched == 2) { + force_position(1); + } else { + int geom_w, geom_h; + matched = sscanf(geometry.getValueStr(), "%dx%d+%d+%d", &geom_w, &geom_h, &geom_x, &geom_y); + switch (matched) { + case 4: + force_position(1); + /* fall through */ + case 2: + w = geom_w; + h = geom_h; + break; + default: + geom_x = geom_y = 0; + vlog.error("Invalid geometry specified!"); + } + } + } + + // If we are creating a window which is equal to the size on the + // screen on X11, many WMs will treat this as a legacy fullscreen + // request. This is not what we want. Besides, it doesn't really + // make sense to try to create a window which is larger than the + // available work space. + w = __rfbmin(w, Fl::w()); + h = __rfbmin(h, Fl::h()); + + if (force_position()) { + resize(geom_x, geom_y, w, h); + } else { + size(w, h); + } + #ifdef HAVE_FLTK_FULLSCREEN if (fullScreen) { // Hack: Window managers seem to be rather crappy at respecting @@ -85,52 +127,8 @@ DesktopWindow::DesktopWindow(int w, int h, const char *name, #else delayedFullscreen = true; #endif - } else -#endif - { - - // Support for -geometry option. Note that although we do support - // negative coordinates, we do not support -XOFF-YOFF (ie - // coordinates relative to the right edge / bottom edge) at this - // time. - int geom_x = 0, geom_y = 0; - if (geometry.hasBeenSet()) { - int matched; - matched = sscanf(geometry.getValueStr(), "+%d+%d", &geom_x, &geom_y); - if (matched == 2) { - force_position(1); - } else { - int geom_w, geom_h; - matched = sscanf(geometry.getValueStr(), "%dx%d+%d+%d", &geom_w, &geom_h, &geom_x, &geom_y); - switch (matched) { - case 4: - force_position(1); - /* fall through */ - case 2: - w = geom_w; - h = geom_h; - break; - default: - geom_x = geom_y = 0; - vlog.error("Invalid geometry specified!"); - } - } - } - - // If we are creating a window which is equal to the size on the - // screen on X11, many WMs will treat this as a legacy fullscreen - // request. This is not what we want. Besides, it doesn't really - // make sense to try to create a window which is larger than the - // available work space. - w = __rfbmin(w, Fl::w()); - h = __rfbmin(h, Fl::h()); - - if (force_position()) { - resize(geom_x, geom_y, w, h); - } else { - size(w, h); - } } +#endif show();