summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog9
-rw-r--r--gtk/gtkiconview.c35
-rw-r--r--gtk/gtktreeview.c13
3 files changed, 57 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 016f71bb9d..e9f0b12ec0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+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).
+
2007-05-09 Emmanuele Bassi <ebassi@gnome.org>
* gtk/gtkrecentmanager.c:
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)
{
diff --git a/gtk/gtktreeview.c b/gtk/gtktreeview.c
index 60ce57d3f4..347314d917 100644
--- a/gtk/gtktreeview.c
+++ b/gtk/gtktreeview.c
@@ -5075,6 +5075,14 @@ gtk_tree_view_key_press (GtkWidget *widget,
{
GtkTreeView *tree_view = (GtkTreeView *) widget;
+ if (tree_view->priv->rubber_band_status)
+ {
+ if (event->keyval == GDK_Escape)
+ gtk_tree_view_stop_rubber_band (tree_view);
+
+ return TRUE;
+ }
+
if (GTK_TREE_VIEW_FLAG_SET (tree_view, GTK_TREE_VIEW_IN_COLUMN_DRAG))
{
if (event->keyval == GDK_Escape)
@@ -5295,6 +5303,11 @@ static gboolean
gtk_tree_view_key_release (GtkWidget *widget,
GdkEventKey *event)
{
+ GtkTreeView *tree_view = GTK_TREE_VIEW (widget);
+
+ if (tree_view->priv->rubber_band_status)
+ return TRUE;
+
return (* GTK_WIDGET_CLASS (gtk_tree_view_parent_class)->key_release_event) (widget, event);
}