Commit b3e489c7 authored by Kristian Rietveld's avatar Kristian Rietveld Committed by Kristian Rietveld

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
parent 130541af
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:
......
......@@ -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)
{
......
......@@ -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);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment