1. mst
  2. ooo340

Commits

Philipp Lohmann [pl]  committed d8dfa7f

ooo33gsl07: #i110881# fix fullscreen mode with compiz and metacity ... again

  • Participants
  • Parent commits 9a6e816
  • Branches default

Comments (0)

Files changed (2)

File vcl/unx/gtk/window/gtkframe.cxx

View file
                 aHints |= GDK_HINT_MAX_SIZE;
             }
         }
-        if( m_bFullscreen )
-        {
-            aGeo.max_width = m_aMaxSize.Width();
-            aGeo.max_height = m_aMaxSize.Height();
-            aHints |= GDK_HINT_MAX_SIZE;
-        }
         if( aHints )
             gtk_window_set_geometry_hints( GTK_WINDOW(m_pWindow),
                                            NULL,
                 // workaround different legacy version window managers have different opinions about
                 // _NET_WM_STATE_FULLSCREEN (Metacity <-> KWin)
                 if( ! getDisplay()->getWMAdaptor()->isLegacyPartialFullscreen() )
+                {
+                    if( !(m_nStyle & SAL_FRAME_STYLE_SIZEABLE) )
+                        gtk_window_set_resizable( GTK_WINDOW(m_pWindow), TRUE );
                     gtk_window_fullscreen( GTK_WINDOW( m_pWindow ) );
+                }
                 if( bVisible )
                     Show( TRUE );
             }
         {
             if( bFullScreen )
             {
-                if( getDisplay()->getWMAdaptor()->isLegacyPartialFullscreen() )
-                {
-                    if( !(m_nStyle & SAL_FRAME_STYLE_SIZEABLE) )
-                        gtk_window_set_resizable( GTK_WINDOW(m_pWindow), TRUE );
-                }
+                if( !(m_nStyle & SAL_FRAME_STYLE_SIZEABLE) )
+                    gtk_window_set_resizable( GTK_WINDOW(m_pWindow), TRUE );
                 gtk_window_fullscreen( GTK_WINDOW(m_pWindow) );
                 moveToScreen( nScreen );
                 Size aScreenSize = pDisp->GetScreenSize( m_nScreen ); 
             else
             {
                 gtk_window_unfullscreen( GTK_WINDOW(m_pWindow) );
-                if( getDisplay()->getWMAdaptor()->isLegacyPartialFullscreen() )
-                {
-                    if( !(m_nStyle & SAL_FRAME_STYLE_SIZEABLE) )
-                        gtk_window_set_resizable( GTK_WINDOW(m_pWindow), FALSE );
-                }
+                if( !(m_nStyle & SAL_FRAME_STYLE_SIZEABLE) )
+                    gtk_window_set_resizable( GTK_WINDOW(m_pWindow), FALSE );
                 moveToScreen( nScreen );
             }
         }
     return FALSE;
 }
 
+IMPL_LINK( GtkSalFrame, ImplDelayedFullScreenHdl, void*, EMPTYARG )
+{
+    Atom nStateAtom = getDisplay()->getWMAdaptor()->getAtom(vcl_sal::WMAdaptor::NET_WM_STATE);
+    Atom nFSAtom = getDisplay()->getWMAdaptor()->getAtom(vcl_sal::WMAdaptor::NET_WM_STATE_FULLSCREEN );
+    if( nStateAtom && nFSAtom )
+    {
+        /* #i110881# workaround a gtk issue (see https://bugzilla.redhat.com/show_bug.cgi?id=623191#c8)
+           gtk_window_fullscreen can fail due to a race condition, request an additional status change
+           to fullscreen to be safe
+        */
+        XEvent aEvent;
+        aEvent.type					= ClientMessage;
+        aEvent.xclient.display		= getDisplay()->GetDisplay();
+        aEvent.xclient.window		= GDK_WINDOW_XWINDOW(m_pWindow->window);
+        aEvent.xclient.message_type	= nStateAtom;
+        aEvent.xclient.format		= 32;
+        aEvent.xclient.data.l[0]	= 1;
+        aEvent.xclient.data.l[1]	= nFSAtom;
+        aEvent.xclient.data.l[2]	= 0;
+        aEvent.xclient.data.l[3]	= 0;
+        aEvent.xclient.data.l[4]	= 0;
+        XSendEvent( getDisplay()->GetDisplay(),
+                    getDisplay()->GetRootWindow( m_nScreen ),
+                    False,
+                    SubstructureNotifyMask | SubstructureRedirectMask,
+                    &aEvent
+                    );
+    }
+
+    return 0;
+}
+
 gboolean GtkSalFrame::signalMap( GtkWidget*, GdkEvent*, gpointer frame )
 {
     GtkSalFrame* pThis = (GtkSalFrame*)frame;
 
     GTK_YIELD_GRAB();
     
+    if( pThis->m_bFullscreen )
+    {
+        /* #i110881# workaorund a gtk issue (see https://bugzilla.redhat.com/show_bug.cgi?id=623191#c8)
+           gtk_window_fullscreen can run into a race condition with the window's showstate
+        */
+        Application::PostUserEvent( LINK( pThis, GtkSalFrame, ImplDelayedFullScreenHdl ) );
+    }
+    
     bool bSetFocus = pThis->m_bSetFocusOnMap;
     pThis->m_bSetFocusOnMap = false;
     if( ImplGetSVData()->mbIsTestTool )

File vcl/unx/inc/plugins/gtk/gtkframe.hxx

View file
 #include <vcl/salframe.hxx>
 #include <vcl/sysdata.hxx>
 
+#include "tools/link.hxx"
+
 #include <list>
 #include <vector>
 
     void setMinMaxSize();
     void createNewWindow( XLIB_Window aParent, bool bXEmbed, int nScreen );
     void askForXEmbedFocus( sal_Int32 nTimecode );
+    
+    DECL_LINK( ImplDelayedFullScreenHdl, void* );
 public:
     GtkSalFrame( SalFrame* pParent, ULONG nStyle );
     GtkSalFrame( SystemParentData* pSysData );