[gtk+] GtkCellRendererAccel: Stop editing on focus out
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] GtkCellRendererAccel: Stop editing on focus out
- Date: Sat, 6 Sep 2014 23:03:48 +0000 (UTC)
commit fa0e43471c14cc02843af4438fde39b7fdabdec4
Author: Matthias Clasen <mclasen redhat com>
Date: Sat Sep 6 19:01:14 2014 -0400
GtkCellRendererAccel: Stop editing on focus out
This is not automatic, and with grabs in place, it is awkward
to have focus moved elsewhere, so stop editing whenever the
cell editable loses focus.
gtk/gtkcellrendereraccel.c | 15 ++++++++++++++-
1 files changed, 14 insertions(+), 1 deletions(-)
---
diff --git a/gtk/gtkcellrendereraccel.c b/gtk/gtkcellrendereraccel.c
index fbbd78c..eb660f5 100644
--- a/gtk/gtkcellrendereraccel.c
+++ b/gtk/gtkcellrendereraccel.c
@@ -660,7 +660,6 @@ gtk_cell_editable_event_box_key_press_event (GtkWidget *widget,
out:
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));
@@ -683,6 +682,19 @@ gtk_cell_editable_event_box_unrealize (GtkWidget *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
gtk_cell_editable_event_box_set_property (GObject *object,
guint prop_id,
@@ -755,6 +767,7 @@ 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,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]