[gtk+] GtkCellRendererAccel: Use gdk_seat_grab()
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] GtkCellRendererAccel: Use gdk_seat_grab()
- Date: Mon, 14 Dec 2015 23:46:34 +0000 (UTC)
commit 5cbbb90e311d95192d1b68ba89c3190cdb652868
Author: Carlos Garnacho <carlosg gnome org>
Date: Thu Nov 26 19:54:31 2015 +0100
GtkCellRendererAccel: Use gdk_seat_grab()
https://bugzilla.gnome.org/show_bug.cgi?id=759309
gtk/gtkcellrendereraccel.c | 39 ++++++++-------------------------------
1 files changed, 8 insertions(+), 31 deletions(-)
---
diff --git a/gtk/gtkcellrendereraccel.c b/gtk/gtkcellrendereraccel.c
index 7ab8ff4..d3476dd 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;
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]