summaryrefslogtreecommitdiff
path: root/gtk/gtkcellrendereraccel.c
diff options
context:
space:
mode:
authorCarlos Garnacho <carlosg@gnome.org>2015-11-26 19:54:31 +0100
committerCarlos Garnacho <carlosg@gnome.org>2015-12-15 00:32:55 +0100
commit5cbbb90e311d95192d1b68ba89c3190cdb652868 (patch)
tree19ab7e6fd024a4d4e425be51a36aef85a97de618 /gtk/gtkcellrendereraccel.c
parente4eeec2163b64c8484d4abc0dc16a2e59d3b4388 (diff)
downloadgtk+-5cbbb90e311d95192d1b68ba89c3190cdb652868.tar.gz
GtkCellRendererAccel: Use gdk_seat_grab()
https://bugzilla.gnome.org/show_bug.cgi?id=759309
Diffstat (limited to 'gtk/gtkcellrendereraccel.c')
-rw-r--r--gtk/gtkcellrendereraccel.c39
1 files changed, 8 insertions, 31 deletions
diff --git a/gtk/gtkcellrendereraccel.c b/gtk/gtkcellrendereraccel.c
index 7ab8ff4b63..d3476dd11a 100644
--- a/gtk/gtkcellrendereraccel.c
+++ b/gtk/gtkcellrendereraccel.c
@@ -96,7 +96,6 @@ struct _GtkCellRendererAccelPrivate
guint accel_key;
guint keycode;
- GdkDevice *grab_keyboard;
GdkDevice *grab_pointer;
};
@@ -441,8 +440,7 @@ gtk_cell_renderer_accel_start_editing (GtkCellRenderer *cell,
GtkWidget *label;
GtkWidget *eventbox;
gboolean editable;
- GdkDevice *device, *keyboard, *pointer;
- guint32 timestamp;
+ GdkDevice *device, *pointer;
GdkWindow *window;
celltext = GTK_CELL_RENDERER_TEXT (cell);
@@ -465,34 +463,15 @@ gtk_cell_renderer_accel_start_editing (GtkCellRenderer *cell,
return NULL;
if (gdk_device_get_source (device) == GDK_SOURCE_KEYBOARD)
- {
- keyboard = device;
- pointer = gdk_device_get_associated_device (device);
- }
+ pointer = gdk_device_get_associated_device (device);
else
- {
- pointer = device;
- keyboard = gdk_device_get_associated_device (device);
- }
+ pointer = device;
- timestamp = gdk_event_get_time (event);
-
- if (gdk_device_grab (keyboard, window,
- GDK_OWNERSHIP_WINDOW, FALSE,
- GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK,
- NULL, timestamp) != GDK_GRAB_SUCCESS)
+ if (gdk_seat_grab (gdk_device_get_seat (pointer), window,
+ GDK_SEAT_CAPABILITY_ALL, FALSE,
+ NULL, event, NULL, NULL) != GDK_GRAB_SUCCESS)
return NULL;
- if (gdk_device_grab (pointer, window,
- GDK_OWNERSHIP_WINDOW, FALSE,
- GDK_BUTTON_PRESS_MASK,
- NULL, timestamp) != GDK_GRAB_SUCCESS)
- {
- gdk_device_ungrab (keyboard, timestamp);
- return NULL;
- }
-
- priv->grab_keyboard = keyboard;
priv->grab_pointer = pointer;
eventbox = gtk_cell_editable_event_box_new (cell, priv->accel_mode, path);
@@ -521,11 +500,9 @@ gtk_cell_renderer_accel_ungrab (GtkCellRendererAccel *accel)
{
GtkCellRendererAccelPrivate *priv = accel->priv;
- if (priv->grab_keyboard)
+ if (priv->grab_pointer)
{
- gdk_device_ungrab (priv->grab_keyboard, GDK_CURRENT_TIME);
- gdk_device_ungrab (priv->grab_pointer, GDK_CURRENT_TIME);
- priv->grab_keyboard = NULL;
+ gdk_seat_ungrab (gdk_device_get_seat (priv->grab_pointer));
priv->grab_pointer = NULL;
}
}