diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-04-17 14:07:23 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2018-04-17 21:41:00 +0200 |
commit | 42f5a0fbbfe91827fdc0a27525e8cd8938871db2 (patch) | |
tree | 36968638b8ecc9525cf92ff1cbdadea92b11fdd3 /vcl | |
parent | effa599086c38b3391d03dc5b6770b523e886b60 (diff) |
tdf#117034 check for runtime version check gtk_menu_popup_at_rect
Change-Id: I2386c2d8f7c6754b197df9216eed82e0152a35c8
Reviewed-on: https://gerrit.libreoffice.org/53045
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/unx/gtk3/gtk3gtkinst.cxx | 45 |
1 files changed, 24 insertions, 21 deletions
diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx index 2e5bb0083199..640f14a3c8ef 100644 --- a/vcl/unx/gtk3/gtk3gtkinst.cxx +++ b/vcl/unx/gtk3/gtk3gtkinst.cxx @@ -1550,32 +1550,35 @@ public: gulong nSignalId = g_signal_connect_swapped(G_OBJECT(m_pMenu), "deactivate", G_CALLBACK(g_main_loop_quit), pLoop); #if GTK_CHECK_VERSION(3,22,0) - GdkRectangle aRect{static_cast<int>(rRect.Left()), static_cast<int>(rRect.Top()), - static_cast<int>(rRect.GetWidth()), static_cast<int>(rRect.GetHeight())}; - gtk_menu_popup_at_rect(m_pMenu, gtk_widget_get_window(pWidget), &aRect, GDK_GRAVITY_NORTH_WEST, GDK_GRAVITY_NORTH_WEST, nullptr); -#else - (void)rRect; - - guint nButton; - guint32 nTime; - - //typically there is an event, and we can then distinguish if this was - //launched from the keyboard (gets auto-mnemoniced) or the mouse (which - //doesn't) - GdkEvent *pEvent = gtk_get_current_event(); - if (pEvent) + if (gtk_check_version(3, 22, 0) == nullptr) { - gdk_event_get_button(pEvent, &nButton); - nTime = gdk_event_get_time(pEvent); + GdkRectangle aRect{static_cast<int>(rRect.Left()), static_cast<int>(rRect.Top()), + static_cast<int>(rRect.GetWidth()), static_cast<int>(rRect.GetHeight())}; + gtk_menu_popup_at_rect(m_pMenu, gtk_widget_get_window(pWidget), &aRect, GDK_GRAVITY_NORTH_WEST, GDK_GRAVITY_NORTH_WEST, nullptr); } else +#endif { - nButton = 0; - nTime = GtkSalFrame::GetLastInputEventTime(); - } + guint nButton; + guint32 nTime; + + //typically there is an event, and we can then distinguish if this was + //launched from the keyboard (gets auto-mnemoniced) or the mouse (which + //doesn't) + GdkEvent *pEvent = gtk_get_current_event(); + if (pEvent) + { + gdk_event_get_button(pEvent, &nButton); + nTime = gdk_event_get_time(pEvent); + } + else + { + nButton = 0; + nTime = GtkSalFrame::GetLastInputEventTime(); + } - gtk_menu_popup(m_pMenu, nullptr, nullptr, nullptr, nullptr, nButton, nTime); -#endif + gtk_menu_popup(m_pMenu, nullptr, nullptr, nullptr, nullptr, nButton, nTime); + } if (g_main_loop_is_running(pLoop)) { |