[Libreoffice-commits] core.git: vcl/unx
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Thu Jan 9 09:17:37 UTC 2020
vcl/unx/gtk3/gtk3gtkinst.cxx | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
New commits:
commit 21ed644b13bb612e3196eee0e014d80e0d3dbef6
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Wed Jan 8 20:06:41 2020 +0000
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Thu Jan 9 10:17:01 2020 +0100
in gtk < 3.20.0 grab the keyboard like we are doing in >= 3.20.0
when showing a fallback GtkWindow window in place of a popover
under X from GtkMenuButton
so the keyboard focus is in that popup under X like it is by
default under wayland
Change-Id: Ifb89063a0352ad561076b2c3251229861712a566
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86455
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index a291dafc7d44..bc7802987366 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -6459,12 +6459,13 @@ private:
}
#endif
//else older gtk3
- const int nMask = (GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK);
-
GdkDeviceManager* pDeviceManager = gdk_display_get_device_manager(pDisplay);
GdkDevice* pPointer = gdk_device_manager_get_client_pointer(pDeviceManager);
- gdk_device_grab(pPointer, gtk_widget_get_window(GTK_WIDGET(m_pMenuHack)), GDK_OWNERSHIP_NONE,
- true, GdkEventMask(nMask), nullptr, gtk_get_current_event_time());
+ GdkWindow* pWindow = gtk_widget_get_window(GTK_WIDGET(m_pMenuHack));
+ guint32 nCurrentTime = gtk_get_current_event_time();
+ gdk_device_grab(pPointer, pWindow, GDK_OWNERSHIP_NONE, true, GDK_ALL_EVENTS_MASK, nullptr, nCurrentTime);
+ if (GdkDevice* pKeyboard = gdk_device_get_associated_device(pPointer))
+ gdk_device_grab(pKeyboard, pWindow, GDK_OWNERSHIP_NONE, true, GDK_ALL_EVENTS_MASK, nullptr, nCurrentTime);
}
void do_ungrab()
@@ -6481,7 +6482,10 @@ private:
//else older gtk3
GdkDeviceManager* pDeviceManager = gdk_display_get_device_manager(pDisplay);
GdkDevice* pPointer = gdk_device_manager_get_client_pointer(pDeviceManager);
- gdk_device_ungrab(pPointer, gtk_get_current_event_time());
+ guint32 nCurrentTime = gtk_get_current_event_time();
+ gdk_device_ungrab(pPointer, nCurrentTime);
+ if (GdkDevice* pKeyboard = gdk_device_get_associated_device(pPointer))
+ gdk_device_ungrab(pKeyboard, nCurrentTime);
}
void toggle_menu()
More information about the Libreoffice-commits
mailing list