diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-07-18 09:01:28 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2018-07-18 12:02:42 +0200 |
commit | 753314b102979b628d7ba77fb856a6e20771db33 (patch) | |
tree | d4a7eed9552267297c5b3d0617f819161d14331f /vcl/unx | |
parent | 6db5e1bdd67531fab14b375d6c624237d38de297 (diff) |
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@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl/unx')
-rw-r--r-- | vcl/unx/gtk3/gtk3gtkinst.cxx | 35 |
1 files changed, 18 insertions, 17 deletions
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))); |