Bug 773334 - GimpColorScale's scrolling behaviour is inverted...
...(scroll up decreases the value) Implement GtkWidget::scroll_event() and turn GDK_SCROLL_UP into RIGHT and DOWN into LEFT. The default behaviour or good for scrollbars but not for widgets where "right" == "higher value" == "up" like GimpColorScale.
This commit is contained in:
parent
5ce223b552
commit
8e65aca452
1 changed files with 39 additions and 0 deletions
|
|
@ -87,6 +87,8 @@ static gboolean gimp_color_scale_button_press (GtkWidget *widget,
|
|||
GdkEventButton *event);
|
||||
static gboolean gimp_color_scale_button_release (GtkWidget *widget,
|
||||
GdkEventButton *event);
|
||||
static gboolean gimp_color_scale_scroll (GtkWidget *widget,
|
||||
GdkEventScroll *event);
|
||||
static gboolean gimp_color_scale_expose (GtkWidget *widget,
|
||||
GdkEventExpose *event);
|
||||
|
||||
|
|
@ -118,6 +120,7 @@ gimp_color_scale_class_init (GimpColorScaleClass *klass)
|
|||
widget_class->state_changed = gimp_color_scale_state_changed;
|
||||
widget_class->button_press_event = gimp_color_scale_button_press;
|
||||
widget_class->button_release_event = gimp_color_scale_button_release;
|
||||
widget_class->scroll_event = gimp_color_scale_scroll;
|
||||
widget_class->expose_event = gimp_color_scale_expose;
|
||||
|
||||
/**
|
||||
|
|
@ -354,6 +357,42 @@ gimp_color_scale_button_release (GtkWidget *widget,
|
|||
return GTK_WIDGET_CLASS (parent_class)->button_release_event (widget, event);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gimp_color_scale_scroll (GtkWidget *widget,
|
||||
GdkEventScroll *event)
|
||||
{
|
||||
if (gtk_orientable_get_orientation (GTK_ORIENTABLE (widget)) ==
|
||||
GTK_ORIENTATION_HORIZONTAL)
|
||||
{
|
||||
GdkEventScroll *my_event;
|
||||
gboolean retval;
|
||||
|
||||
my_event = (GdkEventScroll *) gdk_event_copy ((GdkEvent *) event);
|
||||
|
||||
switch (my_event->direction)
|
||||
{
|
||||
case GDK_SCROLL_UP:
|
||||
my_event->direction = GDK_SCROLL_RIGHT;
|
||||
break;
|
||||
|
||||
case GDK_SCROLL_DOWN:
|
||||
my_event->direction = GDK_SCROLL_LEFT;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
retval = GTK_WIDGET_CLASS (parent_class)->scroll_event (widget, my_event);
|
||||
|
||||
gdk_event_free ((GdkEvent *) my_event);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
return GTK_WIDGET_CLASS (parent_class)->scroll_event (widget, event);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gimp_color_scale_expose (GtkWidget *widget,
|
||||
GdkEventExpose *event)
|
||||
|
|
|
|||
Loading…
Reference in a new issue