[gtk+/gtk-3-22] gtkbutton: Avoid keyboard grabs
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/gtk-3-22] gtkbutton: Avoid keyboard grabs
- Date: Fri, 18 Aug 2017 18:45:26 +0000 (UTC)
commit 2218b5a116123f74a063e4cf1a98c5721ada2c8b
Author: Carlos Garnacho <carlosg gnome org>
Date: Fri Aug 18 19:16:19 2017 +0200
gtkbutton: Avoid keyboard grabs
Seems to be there for the sole purpose of ensuring the button
shall receive the key release on keyboard-triggered activation.
For the cases where this makes sense (eg. comboboxes, menubuttons,
...) gtk+ already does ensure the menu is popup after key release.
This makes the grab pretty useless, and there's many other cases
where it doesn't make sense (eg. button being activated
programmatically from an event handler in another widget).
Fixes button activation unintendedly triggering shortcut inhibition
on wayland.
https://bugzilla.gnome.org/show_bug.cgi?id=786480
gtk/gtkbutton.c | 14 ++------------
gtk/gtkbuttonprivate.h | 1 -
2 files changed, 2 insertions(+), 13 deletions(-)
---
diff --git a/gtk/gtkbutton.c b/gtk/gtkbutton.c
index 57d04ef..b39d55b 100644
--- a/gtk/gtkbutton.c
+++ b/gtk/gtkbutton.c
@@ -1990,7 +1990,6 @@ gtk_real_button_activate (GtkButton *button)
GtkWidget *widget = GTK_WIDGET (button);
GtkButtonPrivate *priv = button->priv;
GdkDevice *device;
- guint32 time;
device = gtk_get_current_event_device ();
@@ -1999,21 +1998,13 @@ gtk_real_button_activate (GtkButton *button)
if (gtk_widget_get_realized (widget) && !priv->activate_timeout)
{
- time = gtk_get_current_event_time ();
-
/* bgo#626336 - Only grab if we have a device (from an event), not if we
* were activated programmatically when no event is available.
*/
if (device && gdk_device_get_source (device) == GDK_SOURCE_KEYBOARD)
{
- if (gdk_seat_grab (gdk_device_get_seat (device), priv->event_window,
- GDK_SEAT_CAPABILITY_KEYBOARD, TRUE,
- NULL, NULL, NULL, NULL) == GDK_GRAB_SUCCESS)
- {
- gtk_device_grab_add (widget, device, TRUE);
- priv->grab_keyboard = device;
- priv->grab_time = time;
- }
+ gtk_device_grab_add (widget, device, TRUE);
+ priv->grab_keyboard = device;
}
priv->activate_timeout = gdk_threads_add_timeout (ACTIVATE_TIMEOUT,
@@ -2037,7 +2028,6 @@ gtk_button_finish_activate (GtkButton *button,
if (priv->grab_keyboard)
{
- gdk_seat_ungrab (gdk_device_get_seat (priv->grab_keyboard));
gtk_device_grab_remove (widget, priv->grab_keyboard);
priv->grab_keyboard = NULL;
}
diff --git a/gtk/gtkbuttonprivate.h b/gtk/gtkbuttonprivate.h
index 5114a99..b9bb219 100644
--- a/gtk/gtkbuttonprivate.h
+++ b/gtk/gtkbuttonprivate.h
@@ -48,7 +48,6 @@ struct _GtkButtonPrivate
gfloat baseline_align;
guint activate_timeout;
- guint32 grab_time;
GtkPositionType image_position;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]