summaryrefslogtreecommitdiff
path: root/gtk/gtkcellrendereraccel.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2014-09-06 20:56:03 -0400
committerMatthias Clasen <mclasen@redhat.com>2014-09-06 20:56:03 -0400
commit794230e7086e1b829e5806fbf70159ac6c541ecd (patch)
treeaa0863a3d721edf2396621e20b88fed8e5f502ae /gtk/gtkcellrendereraccel.c
parentbbf9b95354e98081e023b2bfaa9711422efba5bf (diff)
downloadgtk+-794230e7086e1b829e5806fbf70159ac6c541ecd.tar.gz
GtkCellRendererAccel: Try harder to capture bound keys
Add a grab on the editable widget, so that we can capture also shortcuts which are bound in the application itself. https://bugzilla.gnome.org/736203
Diffstat (limited to 'gtk/gtkcellrendereraccel.c')
-rw-r--r--gtk/gtkcellrendereraccel.c18
1 files changed, 3 insertions, 15 deletions
diff --git a/gtk/gtkcellrendereraccel.c b/gtk/gtkcellrendereraccel.c
index eb660f5664..60f52c8b81 100644
--- a/gtk/gtkcellrendereraccel.c
+++ b/gtk/gtkcellrendereraccel.c
@@ -519,7 +519,7 @@ gtk_cell_renderer_accel_start_editing (GtkCellRenderer *cell,
gtk_container_add (GTK_CONTAINER (eventbox), label);
gtk_widget_show_all (eventbox);
- gtk_widget_grab_focus (eventbox);
+ gtk_grab_add (eventbox);
return GTK_CELL_EDITABLE (eventbox);
}
@@ -659,6 +659,7 @@ gtk_cell_editable_event_box_key_press_event (GtkWidget *widget,
edited = TRUE;
out:
+ gtk_grab_remove (box);
gtk_cell_renderer_accel_ungrab (GTK_CELL_RENDERER_ACCEL (box->cell));
gtk_cell_editable_editing_done (GTK_CELL_EDITABLE (widget));
gtk_cell_editable_remove_widget (GTK_CELL_EDITABLE (widget));
@@ -677,24 +678,12 @@ gtk_cell_editable_event_box_unrealize (GtkWidget *widget)
{
GtkCellEditableEventBox *box = (GtkCellEditableEventBox*)widget;
+ gtk_grab_remove (box);
gtk_cell_renderer_accel_ungrab (GTK_CELL_RENDERER_ACCEL (box->cell));
GTK_WIDGET_CLASS (gtk_cell_editable_event_box_parent_class)->unrealize (widget);
}
-static gboolean
-gtk_cell_editable_event_box_focus_out (GtkWidget *widget,
- GdkEventFocus *event)
-{
- GtkCellEditableEventBox *box = (GtkCellEditableEventBox*)widget;
-
- gtk_cell_renderer_accel_ungrab (GTK_CELL_RENDERER_ACCEL (box->cell));
- gtk_cell_editable_editing_done (GTK_CELL_EDITABLE (widget));
- gtk_cell_editable_remove_widget (GTK_CELL_EDITABLE (widget));
-
- return FALSE;
-}
-
static void
gtk_cell_editable_event_box_set_property (GObject *object,
guint prop_id,
@@ -767,7 +756,6 @@ gtk_cell_editable_event_box_class_init (GtkCellEditableEventBoxClass *class)
widget_class->key_press_event = gtk_cell_editable_event_box_key_press_event;
widget_class->unrealize = gtk_cell_editable_event_box_unrealize;
- widget_class->focus_out_event = gtk_cell_editable_event_box_focus_out;
g_object_class_override_property (object_class,
PROP_EDITING_CANCELED,