diff options
author | Peter Åstrand <astrand@cendio.se> | 2012-08-29 07:14:31 +0000 |
---|---|---|
committer | Peter Åstrand <astrand@cendio.se> | 2012-08-29 07:14:31 +0000 |
commit | c6cdc1fb302955c610399bfe24e10e783ae64ce6 (patch) | |
tree | 22bcbe394ac95e4d02d8f9a5a94fc85a409262b4 /vncviewer | |
parent | 92ddde29b0bfaa4224bdd35675cb523efe134d8f (diff) | |
download | tigervnc-c6cdc1fb302955c610399bfe24e10e783ae64ce6.tar.gz tigervnc-c6cdc1fb302955c610399bfe24e10e783ae64ce6.zip |
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
Diffstat (limited to 'vncviewer')
-rw-r--r-- | vncviewer/DesktopWindow.cxx | 88 |
1 files changed, 43 insertions, 45 deletions
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(); |