[Libreoffice-commits] core.git: svx/source vcl/unx
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Wed Oct 10 16:33:15 UTC 2018
svx/source/tbxctrls/tbcontrl.cxx | 1 +
vcl/unx/gtk3/gtk3gtkinst.cxx | 30 ++++++++++++++++--------------
2 files changed, 17 insertions(+), 14 deletions(-)
New commits:
commit 3177bcaa10cf2c61427f03f05f1c442bcf744ecb
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Wed Oct 10 16:16:17 2018 +0100
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Wed Oct 10 18:32:53 2018 +0200
Resolves: tdf#120407 support popover getting replaced
Change-Id: I56f51a5effccd8854361790c68fa11a2cc067aa9
Reviewed-on: https://gerrit.libreoffice.org/61623
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx
index 98f491711a95..8eeda9aa556e 100644
--- a/svx/source/tbxctrls/tbcontrl.cxx
+++ b/svx/source/tbxctrls/tbcontrl.cxx
@@ -3613,6 +3613,7 @@ void ColorListBox::SetSlotId(sal_uInt16 nSlotId, bool bShowNoneButton)
{
m_nSlotId = nSlotId;
m_bShowNoneButton = bShowNoneButton;
+ m_xButton->set_popover(nullptr);
m_xColorWindow.reset();
m_aSelectedColor = bShowNoneButton ? GetNoneColor() : GetAutoColor(m_nSlotId);
ShowPreview(m_aSelectedColor);
diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index 5930e6a42441..e480fdccbf8d 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -3353,23 +3353,25 @@ public:
virtual void set_popover(weld::Widget* pPopover) override
{
GtkInstanceWidget* pPopoverWidget = dynamic_cast<GtkInstanceWidget*>(pPopover);
- assert(pPopoverWidget);
- m_pPopover = pPopoverWidget->getWidget();
+ m_pPopover = pPopoverWidget ? pPopoverWidget->getWidget() : nullptr;
#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))
+ if (!m_pMenuHack)
{
- 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);
+ //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
More information about the Libreoffice-commits
mailing list