]> source.dussan.org Git - tigervnc.git/commitdiff
Make fullscreen mode work better with some X11 WMs such as Fedora 14
authorPeter Åstrand <astrand@cendio.se>
Mon, 18 Jul 2011 07:45:14 +0000 (07:45 +0000)
committerPeter Åstrand <astrand@cendio.se>
Mon, 18 Jul 2011 07:45:14 +0000 (07:45 +0000)
Metacity by removing the size limits before attempting fullscreen.

git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@4599 3789f03b-4d11-0410-bbf8-ca57d06f2519

vncviewer/DesktopWindow.cxx
vncviewer/Viewport.cxx

index b4b2ae9d307fb1712081742ca14d76cf3d73db16..91019516e70578cc5f144f9df1056d3537201656 100644 (file)
@@ -72,8 +72,11 @@ DesktopWindow::DesktopWindow(int w, int h, const char *name,
   Fl::event_dispatch(&fltkHandle);
 
 #ifdef HAVE_FLTK_FULLSCREEN
-  if (fullScreen)
+  if (fullScreen) {
+    // See comment in DesktopWindow::handleOptions
+    size_range(100, 100, 0, 0);
     fullscreen();
+  }
 #endif
 
   show();
@@ -200,8 +203,19 @@ int DesktopWindow::handle(int event)
   switch (event) {
 #ifdef HAVE_FLTK_FULLSCREEN
   case FL_FULLSCREEN:
-    if (event == FL_FULLSCREEN)
+    if (event == FL_FULLSCREEN) {
       fullScreen.setParam(fullscreen_active());
+      if (!fullscreen_active()) {      
+       size_range(100, 100, viewport->w(), viewport->h());
+      } else {
+       // We need to turn off the size limitations for proper
+       // fullscreen support, but in case fullscreen is activated via
+       // the WM, this is a bit of a problem. In practice, it seems to
+       // work to change the size limits after we have recieved the
+       // FL_FULLSCREEN event, at least with my Metacity. 
+       size_range(100, 100, 0, 0);
+      }
+    }
 
     if (!fullscreenSystemKeys)
       break;
@@ -400,9 +414,12 @@ void DesktopWindow::handleOptions(void *data)
   else
     self->ungrabKeyboard();
 
-  if (fullScreen && !self->fullscreen_active())
+  if (fullScreen && !self->fullscreen_active()) {
+    // Some WMs (Metacity) apparently requires that the size limits
+    // are removed before fullscreen
+    self->size_range(100, 100, 0, 0);
     self->fullscreen();
-  else if (!fullScreen && self->fullscreen_active())
+  else if (!fullScreen && self->fullscreen_active())
     self->fullscreen_off();
 #endif
 }
index 08ca272884153f367134e045948c732dd06262b0..0936a632e9133c128250e349fb4a1c291b54dd0d 100644 (file)
@@ -884,8 +884,11 @@ void Viewport::popupContextMenu()
   case ID_FULLSCREEN:
     if (window()->fullscreen_active())
       window()->fullscreen_off();
-    else
+    else {
+      // See comment in DesktopWindow::handleOptions
+      window()->size_range(100, 100, 0, 0);
       window()->fullscreen();
+    }
     break;
 #endif
   case ID_CTRL: