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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Wed Jul 18 10:03:12 UTC 2018


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

New commits:
commit 9e9138c09bd3d05ff45a6aabf574af897ef93a1e
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Wed Jul 18 09:10:30 2018 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Wed Jul 18 12:02:56 2018 +0200

    only ellipize menubutton label when requesting narrower size
    
    Change-Id: I32f4856756910ec1db8d37854b6e57dbec5aae76
    Reviewed-on: https://gerrit.libreoffice.org/57617
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index bde669c26d0c..2a524619e480 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -3067,7 +3067,6 @@ public:
         m_pBox = GTK_BOX(gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0));
 
         m_pLabel = GTK_LABEL(gtk_label_new_with_mnemonic(sLabel.getStr()));
-        gtk_label_set_ellipsize(m_pLabel, PANGO_ELLIPSIZE_MIDDLE);
         gtk_label_set_mnemonic_widget(m_pLabel, GTK_WIDGET(m_pMenuButton));
         gtk_box_pack_start(m_pBox, GTK_WIDGET(m_pLabel), false, false, 0);
 
@@ -3076,6 +3075,13 @@ public:
         gtk_widget_show_all(GTK_WIDGET(m_pBox));
     }
 
+    virtual void set_size_request(int nWidth, int nHeight) override
+    {
+        // tweak the label to get a narrower size to stick
+        gtk_label_set_ellipsize(m_pLabel, PANGO_ELLIPSIZE_MIDDLE);
+        gtk_widget_set_size_request(m_pWidget, nWidth, nHeight);
+    }
+
     virtual void set_label(const OUString& rText) override
     {
         ::set_label(m_pLabel, rText);
commit 753314b102979b628d7ba77fb856a6e20771db33
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Wed Jul 18 09:01:28 2018 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Wed Jul 18 12:02:42 2018 +0200

    Resolves: tdf#118604 only use popover workaround for popovers, not menus
    
    Change-Id: I7982a3836fbf699979beaa70e34bfa38aea80462
    Reviewed-on: https://gerrit.libreoffice.org/57615
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index 0f2c6568dd75..bde669c26d0c 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -3074,23 +3074,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
@@ -3145,6 +3128,24 @@ public:
         GtkInstanceWidget* pPopoverWidget = dynamic_cast<GtkInstanceWidget*>(pPopover);
         assert(pPopoverWidget);
         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