[Libreoffice-commits] core.git: Branch 'libreoffice-6-1' - vcl/unx

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Wed Jul 18 19:06:31 UTC 2018


 vcl/unx/gtk3/gtk3gtkinst.cxx |   35 ++++++++++++++++++-----------------
 1 file changed, 18 insertions(+), 17 deletions(-)

New commits:
commit 8923164778ecfbfd98a398d4525d7b88a06366ea
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Wed Jul 18 09:01:28 2018 +0100
Commit:     Eike Rathke <erack at redhat.com>
CommitDate: Wed Jul 18 21:06:08 2018 +0200

    Resolves: tdf#118604 only use popover workaround for popovers, not menus
    
    Change-Id: I7982a3836fbf699979beaa70e34bfa38aea80462
    Reviewed-on: https://gerrit.libreoffice.org/57616
    Tested-by: Jenkins
    Reviewed-by: Eike Rathke <erack at redhat.com>

diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index 70b0625dd0e8..5c6fc9901d3e 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -3061,23 +3061,6 @@ public:
         gtk_box_pack_end(m_pBox, gtk_image_new_from_icon_name ("pan-down-symbolic", GTK_ICON_SIZE_BUTTON), false, false, 0);
         gtk_container_add(GTK_CONTAINER(m_pMenuButton), GTK_WIDGET(m_pBox));
         gtk_widget_show_all(GTK_WIDGET(m_pBox));
-
-#if defined(GDK_WINDOWING_X11)
-        //under wayland a Popover will work to "escape" the parent dialog, not
-        //so under X, so come up with this hack to use a raw GtkWindow
-        GdkDisplay *pDisplay = gtk_widget_get_display(m_pWidget);
-        if (GDK_IS_X11_DISPLAY(pDisplay))
-        {
-            m_pMenuHack = GTK_WINDOW(gtk_window_new(GTK_WINDOW_POPUP));
-            gtk_window_set_type_hint(m_pMenuHack, GDK_WINDOW_TYPE_HINT_COMBO);
-            gtk_window_set_modal(m_pMenuHack, true);
-            gtk_window_set_resizable(m_pMenuHack, false);
-            m_nSignalId = g_signal_connect(GTK_TOGGLE_BUTTON(pMenuButton), "toggled", G_CALLBACK(signalToggled), this);
-            g_signal_connect(m_pMenuHack, "grab-broken-event", G_CALLBACK(signalGrabBroken), this);
-            g_signal_connect(m_pMenuHack, "button-release-event", G_CALLBACK(signalButtonRelease), this);
-            g_signal_connect(m_pMenuHack, "key-press-event", G_CALLBACK(keyPress), this);
-        }
-#endif
     }
 
     virtual void set_label(const OUString& rText) override
@@ -3131,6 +3114,24 @@ public:
     {
         GtkInstanceWidget* pPopoverWidget = dynamic_cast<GtkInstanceWidget*>(pPopover);
         m_pPopover = pPopoverWidget->getWidget();
+
+#if defined(GDK_WINDOWING_X11)
+        //under wayland a Popover will work to "escape" the parent dialog, not
+        //so under X, so come up with this hack to use a raw GtkWindow
+        GdkDisplay *pDisplay = gtk_widget_get_display(m_pWidget);
+        if (GDK_IS_X11_DISPLAY(pDisplay))
+        {
+            m_pMenuHack = GTK_WINDOW(gtk_window_new(GTK_WINDOW_POPUP));
+            gtk_window_set_type_hint(m_pMenuHack, GDK_WINDOW_TYPE_HINT_COMBO);
+            gtk_window_set_modal(m_pMenuHack, true);
+            gtk_window_set_resizable(m_pMenuHack, false);
+            m_nSignalId = g_signal_connect(GTK_TOGGLE_BUTTON(m_pMenuButton), "toggled", G_CALLBACK(signalToggled), this);
+            g_signal_connect(m_pMenuHack, "grab-broken-event", G_CALLBACK(signalGrabBroken), this);
+            g_signal_connect(m_pMenuHack, "button-release-event", G_CALLBACK(signalButtonRelease), this);
+            g_signal_connect(m_pMenuHack, "key-press-event", G_CALLBACK(keyPress), this);
+        }
+#endif
+
         if (m_pMenuHack)
         {
             gtk_menu_button_set_popover(m_pMenuButton, gtk_popover_new(GTK_WIDGET(m_pMenuButton)));


More information about the Libreoffice-commits mailing list