aboutsummaryrefslogtreecommitdiffstats
path: root/vncviewer/DesktopWindow.cxx
diff options
context:
space:
mode:
authorPierre Ossman <ossman@cendio.se>2012-09-03 09:43:23 +0000
committerPierre Ossman <ossman@cendio.se>2012-09-03 09:43:23 +0000
commit0e5934631d13510df145a037bee222aae44a139c (patch)
tree1050bb2476b4034e6b2885eef035ea8c70ef9a57 /vncviewer/DesktopWindow.cxx
parent1d867b66fd0439bebcba1fd957242a517e1b8d29 (diff)
downloadtigervnc-0e5934631d13510df145a037bee222aae44a139c.tar.gz
tigervnc-0e5934631d13510df145a037bee222aae44a139c.zip
Avoid triggering a full screen request by accident on X11.
git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@4992 3789f03b-4d11-0410-bbf8-ca57d06f2519
Diffstat (limited to 'vncviewer/DesktopWindow.cxx')
-rw-r--r--vncviewer/DesktopWindow.cxx36
1 files changed, 28 insertions, 8 deletions
diff --git a/vncviewer/DesktopWindow.cxx b/vncviewer/DesktopWindow.cxx
index ef5ec005..04addba2 100644
--- a/vncviewer/DesktopWindow.cxx
+++ b/vncviewer/DesktopWindow.cxx
@@ -106,14 +106,6 @@ DesktopWindow::DesktopWindow(int w, int h, const char *name,
}
}
- // 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 {
@@ -275,6 +267,34 @@ void DesktopWindow::resize(int x, int y, int w, int h)
{
bool resizing;
+#if ! (defined(WIN32) || defined(__APPLE__))
+ // X11 window managers will treat a resize to cover the entire
+ // monitor as a request to go full screen. Make sure we avoid this.
+ //
+ // FIXME: If this is an external event then this code will get
+ // FLTK into a confused state about the window's position/size.
+ // Unfortunately FLTK doesn't offer an easy way to tell
+ // what kind of resize it is. Let's hope this corner case
+ // isn't too common...
+#ifdef HAVE_FLTK_FULLSCREEN
+ if (!fullscreen_active())
+#endif
+ {
+ for (int i = 0;i < Fl::screen_count();i++) {
+ int sx, sy, sw, sh;
+
+ Fl::screen_xywh(sx, sy, sw, sh, i);
+
+ if ((sx == x) && (sy == y) && (sw == w) && (sh == h)) {
+ vlog.info("Adjusting window size to avoid accidental full screen request");
+ // Assume a panel of some form and adjust the height
+ y += 20;
+ h -= 40;
+ }
+ }
+ }
+#endif
+
if ((this->w() != w) || (this->h() != h))
resizing = true;
else