[Libreoffice-commits] core.git: vcl/inc vcl/unx

Caolán McNamara caolanm at redhat.com
Fri Nov 10 20:24:50 UTC 2017


 vcl/inc/unx/gtk/gtkframe.hxx   |    4 +++-
 vcl/inc/unx/gtk/gtksalmenu.hxx |    2 ++
 vcl/unx/gtk/gtksalframe.cxx    |    7 ++-----
 vcl/unx/gtk3/gtk3gtkframe.cxx  |   13 ++++++++-----
 4 files changed, 15 insertions(+), 11 deletions(-)

New commits:
commit 97d09553425b59d030fd4d8f039a4a9994b674cf
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Nov 10 13:48:54 2017 +0000

    Related: tdf#112549 gtk3 hide/show menubar on enter/exit fullscreen
    
    Change-Id: I0436d0f3404a88abd81c4eedea09b16c81536b61
    Reviewed-on: https://gerrit.libreoffice.org/44599
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/vcl/inc/unx/gtk/gtkframe.hxx b/vcl/inc/unx/gtk/gtkframe.hxx
index 8a3046ca1497..236cf29c29de 100644
--- a/vcl/inc/unx/gtk/gtkframe.hxx
+++ b/vcl/inc/unx/gtk/gtkframe.hxx
@@ -68,6 +68,8 @@ class GtkDnDTransferable;
     typedef void GDBusConnection;
 #endif
 
+class GtkSalMenu;
+
 class GtkSalFrame : public SalFrame
                   , public NativeWindowHandleProvider
 {
@@ -220,7 +222,7 @@ class GtkSalFrame : public SalFrame
     bool                            m_bSetFocusOnMap;
 #endif
 
-    SalMenu*                        m_pSalMenu;
+    GtkSalMenu*                     m_pSalMenu;
 
 #if ENABLE_DBUS && ENABLE_GIO
     private:
diff --git a/vcl/inc/unx/gtk/gtksalmenu.hxx b/vcl/inc/unx/gtk/gtksalmenu.hxx
index 3446c774c1df..b9ac55570f0d 100644
--- a/vcl/inc/unx/gtk/gtksalmenu.hxx
+++ b/vcl/inc/unx/gtk/gtksalmenu.hxx
@@ -125,6 +125,8 @@ public:
     GtkSalMenu*                 GetTopLevel();
     void                        SetNeedsUpdate();
 
+    GtkWidget*                  GetMenuBarContainerWidget() const { return mpMenuBarContainerWidget; }
+
     void CreateMenuBarWidget();
     void DestroyMenuBarWidget();
     gboolean SignalKey(GdkEventKey const * pEvent);
diff --git a/vcl/unx/gtk/gtksalframe.cxx b/vcl/unx/gtk/gtksalframe.cxx
index e48b3bb336a6..e4a2e3c17d1f 100644
--- a/vcl/unx/gtk/gtksalframe.cxx
+++ b/vcl/unx/gtk/gtksalframe.cxx
@@ -21,6 +21,7 @@
 #include <unx/gtk/gtkdata.hxx>
 #include <unx/gtk/gtkinst.hxx>
 #include <unx/gtk/gtkgdi.hxx>
+#include <unx/gtk/gtksalmenu.hxx>
 #include <vcl/help.hxx>
 #include <vcl/keycodes.hxx>
 #include <vcl/layout.hxx>
@@ -1415,11 +1416,7 @@ void GtkSalFrame::SetIcon( sal_uInt16 nIcon )
 
 void GtkSalFrame::SetMenu( SalMenu* pSalMenu )
 {
-//    if(m_pSalMenu)
-//    {
-//        static_cast<GtkSalMenu*>(m_pSalMenu)->DisconnectFrame();
-//    }
-    m_pSalMenu = pSalMenu;
+    m_pSalMenu = static_cast<GtkSalMenu*>(pSalMenu);
 }
 
 SalMenu* GtkSalFrame::GetMenu()
diff --git a/vcl/unx/gtk3/gtk3gtkframe.cxx b/vcl/unx/gtk3/gtk3gtkframe.cxx
index d0a42ef9fe5c..3169ef152e2e 100644
--- a/vcl/unx/gtk3/gtk3gtkframe.cxx
+++ b/vcl/unx/gtk3/gtk3gtkframe.cxx
@@ -1362,11 +1362,7 @@ void GtkSalFrame::SetIcon( sal_uInt16 nIcon )
 
 void GtkSalFrame::SetMenu( SalMenu* pSalMenu )
 {
-//    if(m_pSalMenu)
-//    {
-//        static_cast<GtkSalMenu*>(m_pSalMenu)->DisconnectFrame();
-//    }
-    m_pSalMenu = pSalMenu;
+    m_pSalMenu = static_cast<GtkSalMenu*>(pSalMenu);
 }
 
 SalMenu* GtkSalFrame::GetMenu()
@@ -1902,8 +1898,11 @@ void GtkSalFrame::SetScreen( unsigned int nNewScreen, SetType eType, tools::Rect
     gdk_window_set_fullscreen_mode( widget_get_window(m_pWindow), m_bSpanMonitorsWhenFullscreen
         ? GDK_FULLSCREEN_ON_ALL_MONITORS : GDK_FULLSCREEN_ON_CURRENT_MONITOR );
 #endif
+    GtkWidget* pMenuBarContainerWidget = m_pSalMenu ? m_pSalMenu->GetMenuBarContainerWidget() : nullptr;
     if( eType == SetType::Fullscreen )
     {
+        if (pMenuBarContainerWidget)
+            gtk_widget_hide(pMenuBarContainerWidget);
         if (m_bSpanMonitorsWhenFullscreen)
             gtk_window_fullscreen(GTK_WINDOW(m_pWindow));
         else
@@ -1917,7 +1916,11 @@ void GtkSalFrame::SetScreen( unsigned int nNewScreen, SetType eType, tools::Rect
 
     }
     else if( eType == SetType::UnFullscreen )
+    {
+        if (pMenuBarContainerWidget)
+            gtk_widget_show(pMenuBarContainerWidget);
         gtk_window_unfullscreen( GTK_WINDOW( m_pWindow ) );
+    }
 
     if( eType == SetType::UnFullscreen &&
         !(m_nStyle & SalFrameStyleFlags::SIZEABLE) )


More information about the Libreoffice-commits mailing list