diff options
author | Matthias Clasen <mclasen@redhat.com> | 2014-09-06 16:04:41 -0400 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2014-09-06 19:02:41 -0400 |
commit | fe11f8f875dc2e689070a903af49bb340bb2acb2 (patch) | |
tree | d94ec5aa339f029afdd65746048fed5b70ae5b60 /gtk/gtkcellrendereraccel.c | |
parent | 4cec291ab084984a9c544f897e2eac91225cb85c (diff) | |
download | gtk+-fe11f8f875dc2e689070a903af49bb340bb2acb2.tar.gz |
Revert "gtkcellrendereraccel: Use a GtkInvisible to grab on"
This reverts commit fe5402d32ebf7f332a2c5f71b9ae50dcf68892fd.
Diffstat (limited to 'gtk/gtkcellrendereraccel.c')
-rw-r--r-- | gtk/gtkcellrendereraccel.c | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/gtk/gtkcellrendereraccel.c b/gtk/gtkcellrendereraccel.c index 55dd8128e6..73aea9d847 100644 --- a/gtk/gtkcellrendereraccel.c +++ b/gtk/gtkcellrendereraccel.c @@ -27,9 +27,9 @@ #include "gtkmain.h" #include "gtksizerequest.h" #include "gtktypebuiltins.h" -#include "gtkinvisible.h" #include "gtkprivate.h" + /** * SECTION:gtkcellrendereraccel * @Short_description: Renders a keyboard accelerator in a cell @@ -88,9 +88,9 @@ enum { struct _GtkCellRendererAccelPrivate { GtkWidget *edit_widget; + GtkWidget *grab_widget; GtkWidget *sizing_label; - GtkWidget *grab_invisible; GdkDevice *grab_keyboard; GdkDevice *grab_pointer; @@ -526,6 +526,7 @@ grab_key_callback (GtkWidget *widget, gtk_cell_editable_editing_done (GTK_CELL_EDITABLE (priv->edit_widget)); gtk_cell_editable_remove_widget (GTK_CELL_EDITABLE (priv->edit_widget)); priv->edit_widget = NULL; + priv->grab_widget = NULL; priv->grab_keyboard = NULL; priv->grab_pointer = NULL; @@ -552,8 +553,9 @@ ungrab_stuff (GtkWidget *widget, priv->grab_keyboard = NULL; priv->grab_pointer = NULL; - gtk_widget_destroy (priv->grab_invisible); - priv->grab_invisible = NULL; + g_signal_handlers_disconnect_by_func (priv->grab_widget, + G_CALLBACK (grab_key_callback), + accel); } static void @@ -662,6 +664,7 @@ gtk_cell_renderer_accel_start_editing (GtkCellRenderer *cell, GtkWidget *label; GtkWidget *eventbox; GdkDevice *device, *keyb, *pointer; + GdkWindow *window; gboolean editable; guint32 time; @@ -674,8 +677,11 @@ gtk_cell_renderer_accel_start_editing (GtkCellRenderer *cell, if (editable == FALSE) return NULL; + window = gtk_widget_get_window (widget); context = gtk_widget_get_style_context (widget); + g_return_val_if_fail (window != NULL, NULL); + if (event) device = gdk_event_get_device (event); else @@ -697,16 +703,13 @@ gtk_cell_renderer_accel_start_editing (GtkCellRenderer *cell, time = gdk_event_get_time (event); - priv->grab_invisible = gtk_invisible_new (); - gtk_widget_show (priv->grab_invisible); - - if (gdk_device_grab (keyb, gtk_widget_get_window (priv->grab_invisible), + if (gdk_device_grab (keyb, window, GDK_OWNERSHIP_WINDOW, FALSE, GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK, NULL, time) != GDK_GRAB_SUCCESS) return NULL; - if (gdk_device_grab (pointer, gtk_widget_get_window (priv->grab_invisible), + if (gdk_device_grab (pointer, window, GDK_OWNERSHIP_WINDOW, FALSE, GDK_BUTTON_PRESS_MASK, NULL, time) != GDK_GRAB_SUCCESS) @@ -717,8 +720,9 @@ gtk_cell_renderer_accel_start_editing (GtkCellRenderer *cell, priv->grab_keyboard = keyb; priv->grab_pointer = pointer; + priv->grab_widget = widget; - g_signal_connect (G_OBJECT (priv->grab_invisible), "key-press-event", + g_signal_connect (G_OBJECT (widget), "key-press-event", G_CALLBACK (grab_key_callback), accel); |