+2006-03-11 Matthias Clasen <mclasen@redhat.com>
+
+ * gtk/gtkrange.c (gtk_range_key_press): Allow to cancel
+ a drag with ESC. (#58389, Søren Sandmann)
+
2006-03-10 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkrange.c: Add a style property ::activate_slider that
+2006-03-11 Matthias Clasen <mclasen@redhat.com>
+
+ * gtk/gtkrange.c (gtk_range_key_press): Allow to cancel
+ a drag with ESC. (#58389, Søren Sandmann)
+
2006-03-10 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkrange.c: Add a style property ::activate_slider that
#include <config.h>
#include <stdio.h>
#include <math.h>
+#include <gdk/gdkkeysyms.h>
#include "gtkintl.h"
#include "gtkmain.h"
#include "gtkmarshalers.h"
GtkScrollType scroll,
gdouble value);
static void gtk_range_update_value (GtkRange *range);
+static gboolean gtk_range_key_press (GtkWidget *range,
+ GdkEventKey *event);
static GtkWidgetClass *parent_class = NULL;
widget_class->grab_notify = gtk_range_grab_notify;
widget_class->state_changed = gtk_range_state_changed;
widget_class->style_set = gtk_range_style_set;
+ widget_class->key_press_event = gtk_range_key_press;
class->move_slider = gtk_range_move_slider;
class->change_value = gtk_range_real_change_value;
return value;
}
+static gboolean
+gtk_range_key_press (GtkWidget *widget,
+ GdkEventKey *event)
+{
+ GtkRange *range = (GtkRange *)widget;
+
+ if (event->keyval == GDK_Escape)
+ {
+ stop_scrolling (range);
+
+ update_slider_position (range,
+ range->slide_initial_coordinate,
+ range->slide_initial_coordinate);
+
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
static gint
gtk_range_button_press (GtkWidget *widget,
GdkEventButton *event)