mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-18 09:00:34 +00:00
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
This commit is contained in:
parent
bbf9b95354
commit
794230e708
@ -519,7 +519,7 @@ gtk_cell_renderer_accel_start_editing (GtkCellRenderer *cell,
|
|||||||
gtk_container_add (GTK_CONTAINER (eventbox), label);
|
gtk_container_add (GTK_CONTAINER (eventbox), label);
|
||||||
|
|
||||||
gtk_widget_show_all (eventbox);
|
gtk_widget_show_all (eventbox);
|
||||||
gtk_widget_grab_focus (eventbox);
|
gtk_grab_add (eventbox);
|
||||||
|
|
||||||
return GTK_CELL_EDITABLE (eventbox);
|
return GTK_CELL_EDITABLE (eventbox);
|
||||||
}
|
}
|
||||||
@ -659,6 +659,7 @@ gtk_cell_editable_event_box_key_press_event (GtkWidget *widget,
|
|||||||
edited = TRUE;
|
edited = TRUE;
|
||||||
|
|
||||||
out:
|
out:
|
||||||
|
gtk_grab_remove (box);
|
||||||
gtk_cell_renderer_accel_ungrab (GTK_CELL_RENDERER_ACCEL (box->cell));
|
gtk_cell_renderer_accel_ungrab (GTK_CELL_RENDERER_ACCEL (box->cell));
|
||||||
gtk_cell_editable_editing_done (GTK_CELL_EDITABLE (widget));
|
gtk_cell_editable_editing_done (GTK_CELL_EDITABLE (widget));
|
||||||
gtk_cell_editable_remove_widget (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;
|
GtkCellEditableEventBox *box = (GtkCellEditableEventBox*)widget;
|
||||||
|
|
||||||
|
gtk_grab_remove (box);
|
||||||
gtk_cell_renderer_accel_ungrab (GTK_CELL_RENDERER_ACCEL (box->cell));
|
gtk_cell_renderer_accel_ungrab (GTK_CELL_RENDERER_ACCEL (box->cell));
|
||||||
|
|
||||||
GTK_WIDGET_CLASS (gtk_cell_editable_event_box_parent_class)->unrealize (widget);
|
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
|
static void
|
||||||
gtk_cell_editable_event_box_set_property (GObject *object,
|
gtk_cell_editable_event_box_set_property (GObject *object,
|
||||||
guint prop_id,
|
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->key_press_event = gtk_cell_editable_event_box_key_press_event;
|
||||||
widget_class->unrealize = gtk_cell_editable_event_box_unrealize;
|
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,
|
g_object_class_override_property (object_class,
|
||||||
PROP_EDITING_CANCELED,
|
PROP_EDITING_CANCELED,
|
||||||
|
Loading…
Reference in New Issue
Block a user