diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-07-18 09:01:28 +0100 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2018-07-18 21:06:08 +0200 |
commit | 8923164778ecfbfd98a398d4525d7b88a06366ea (patch) | |
tree | 8bbe00aaf6184acad73f73563fddf79340189ccf /vcl/unx/gtk3 | |
parent | 805ea77cf21ff96f8ffd091f94726840771ee658 (diff) |
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@redhat.com>
Diffstat (limited to 'vcl/unx/gtk3')
-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 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))); |