summaryrefslogtreecommitdiff
path: root/gtk/gtkiconview.c
diff options
context:
space:
mode:
authorKristian Rietveld <kris@imendio.com>2007-05-09 14:06:02 +0000
committerKristian Rietveld <kristian@src.gnome.org>2007-05-09 14:06:02 +0000
commitb3e489c7f33dd9cb4c3d5874665213569a45db1c (patch)
tree8e89742c15eeb0a2383e2cb83251f57e04e30d2d /gtk/gtkiconview.c
parent130541af8d40479b23c0f55677d576c595ea562d (diff)
downloadgtk+-b3e489c7f33dd9cb4c3d5874665213569a45db1c.tar.gz
Disable key bindings during rubber banding, make pressing Esc stop rubber
2007-05-09 Kristian Rietveld <kris@imendio.com> * gtk/gtktreeview.c (gtk_tree_view_key_press), (gtk_tree_view_key_release): * gtk/gtkiconview.c (gtk_icon_view_class_init), (gtk_icon_view_key_press), (gtk_icon_view_key_release): Disable key bindings during rubber banding, make pressing Esc stop rubber banding. (#405027). svn path=/trunk/; revision=17807
Diffstat (limited to 'gtk/gtkiconview.c')
-rw-r--r--gtk/gtkiconview.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/gtk/gtkiconview.c b/gtk/gtkiconview.c
index 728447dbb4..993d670c2c 100644
--- a/gtk/gtkiconview.c
+++ b/gtk/gtkiconview.c
@@ -255,6 +255,10 @@ static gboolean gtk_icon_view_button_press (GtkWidget
GdkEventButton *event);
static gboolean gtk_icon_view_button_release (GtkWidget *widget,
GdkEventButton *event);
+static gboolean gtk_icon_view_key_press (GtkWidget *widget,
+ GdkEventKey *event);
+static gboolean gtk_icon_view_key_release (GtkWidget *widget,
+ GdkEventKey *event);
static AtkObject *gtk_icon_view_get_accessible (GtkWidget *widget);
@@ -484,6 +488,8 @@ gtk_icon_view_class_init (GtkIconViewClass *klass)
widget_class->motion_notify_event = gtk_icon_view_motion;
widget_class->button_press_event = gtk_icon_view_button_press;
widget_class->button_release_event = gtk_icon_view_button_release;
+ widget_class->key_press_event = gtk_icon_view_key_press;
+ widget_class->key_release_event = gtk_icon_view_key_release;
widget_class->drag_begin = gtk_icon_view_drag_begin;
widget_class->drag_end = gtk_icon_view_drag_end;
widget_class->drag_data_get = gtk_icon_view_drag_data_get;
@@ -2048,6 +2054,35 @@ gtk_icon_view_button_release (GtkWidget *widget,
return TRUE;
}
+static gboolean
+gtk_icon_view_key_press (GtkWidget *widget,
+ GdkEventKey *event)
+{
+ GtkIconView *icon_view = GTK_ICON_VIEW (widget);
+
+ if (icon_view->priv->doing_rubberband)
+ {
+ if (event->keyval == GDK_Escape)
+ gtk_icon_view_stop_rubberbanding (icon_view);
+
+ return TRUE;
+ }
+
+ return (* GTK_WIDGET_CLASS (gtk_icon_view_parent_class)->key_press_event) (widget, event);
+}
+
+static gboolean
+gtk_icon_view_key_release (GtkWidget *widget,
+ GdkEventKey *event)
+{
+ GtkIconView *icon_view = GTK_ICON_VIEW (widget);
+
+ if (icon_view->priv->doing_rubberband)
+ return TRUE;
+
+ return (* GTK_WIDGET_CLASS (gtk_icon_view_parent_class)->key_press_event) (widget, event);
+}
+
static void
gtk_icon_view_update_rubberband (gpointer data)
{