[gimp] app: update the tool's state after the wheel controller has handled the event
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: update the tool's state after the wheel controller has handled the event
- Date: Wed, 6 Apr 2011 20:51:16 +0000 (UTC)
commit 7fae1b3c50fb18303bb5b4b612f1ff1263425d65
Author: Michael Natterer <mitch gimp org>
Date: Wed Apr 6 22:50:20 2011 +0200
app: update the tool's state after the wheel controller has handled the event
app/display/gimpdisplayshell-tool-events.c | 123 ++++++++++++++--------------
1 files changed, 61 insertions(+), 62 deletions(-)
---
diff --git a/app/display/gimpdisplayshell-tool-events.c b/app/display/gimpdisplayshell-tool-events.c
index 13d743d..4f2db98 100644
--- a/app/display/gimpdisplayshell-tool-events.c
+++ b/app/display/gimpdisplayshell-tool-events.c
@@ -709,78 +709,77 @@ gimp_display_shell_canvas_tool_events (GtkWidget *canvas,
case GDK_SCROLL:
{
GdkEventScroll *sevent = (GdkEventScroll *) event;
- GdkScrollDirection direction;
GimpController *wheel;
wheel = gimp_controllers_get_wheel (gimp);
- if (wheel &&
- gimp_controller_wheel_scroll (GIMP_CONTROLLER_WHEEL (wheel),
- sevent))
- return TRUE;
-
- direction = sevent->direction;
-
- if (state & GDK_CONTROL_MASK)
+ if (! wheel ||
+ ! gimp_controller_wheel_scroll (GIMP_CONTROLLER_WHEEL (wheel),
+ sevent))
{
- switch (direction)
- {
- case GDK_SCROLL_UP:
- gimp_display_shell_scale (shell,
- GIMP_ZOOM_IN,
- 0.0,
- GIMP_ZOOM_FOCUS_BEST_GUESS);
- break;
-
- case GDK_SCROLL_DOWN:
- gimp_display_shell_scale (shell,
- GIMP_ZOOM_OUT,
- 0.0,
- GIMP_ZOOM_FOCUS_BEST_GUESS);
- break;
+ GdkScrollDirection direction = sevent->direction;
- default:
- break;
+ if (state & GDK_CONTROL_MASK)
+ {
+ switch (direction)
+ {
+ case GDK_SCROLL_UP:
+ gimp_display_shell_scale (shell,
+ GIMP_ZOOM_IN,
+ 0.0,
+ GIMP_ZOOM_FOCUS_BEST_GUESS);
+ break;
+
+ case GDK_SCROLL_DOWN:
+ gimp_display_shell_scale (shell,
+ GIMP_ZOOM_OUT,
+ 0.0,
+ GIMP_ZOOM_FOCUS_BEST_GUESS);
+ break;
+
+ default:
+ break;
+ }
}
- }
- else
- {
- GtkAdjustment *adj = NULL;
- gdouble value;
+ else
+ {
+ GtkAdjustment *adj = NULL;
+ gdouble value;
- if (state & GDK_SHIFT_MASK)
- switch (direction)
- {
- case GDK_SCROLL_UP: direction = GDK_SCROLL_LEFT; break;
- case GDK_SCROLL_DOWN: direction = GDK_SCROLL_RIGHT; break;
- case GDK_SCROLL_LEFT: direction = GDK_SCROLL_UP; break;
- case GDK_SCROLL_RIGHT: direction = GDK_SCROLL_DOWN; break;
- }
+ if (state & GDK_SHIFT_MASK)
+ switch (direction)
+ {
+ case GDK_SCROLL_UP: direction = GDK_SCROLL_LEFT; break;
+ case GDK_SCROLL_DOWN: direction = GDK_SCROLL_RIGHT; break;
+ case GDK_SCROLL_LEFT: direction = GDK_SCROLL_UP; break;
+ case GDK_SCROLL_RIGHT: direction = GDK_SCROLL_DOWN; break;
+ }
- switch (direction)
- {
- case GDK_SCROLL_LEFT:
- case GDK_SCROLL_RIGHT:
- adj = shell->hsbdata;
- break;
+ switch (direction)
+ {
+ case GDK_SCROLL_LEFT:
+ case GDK_SCROLL_RIGHT:
+ adj = shell->hsbdata;
+ break;
+
+ case GDK_SCROLL_UP:
+ case GDK_SCROLL_DOWN:
+ adj = shell->vsbdata;
+ break;
+ }
- case GDK_SCROLL_UP:
- case GDK_SCROLL_DOWN:
- adj = shell->vsbdata;
- break;
+ value = (gtk_adjustment_get_value (adj) +
+ ((direction == GDK_SCROLL_UP ||
+ direction == GDK_SCROLL_LEFT) ?
+ -gtk_adjustment_get_page_increment (adj) / 2 :
+ gtk_adjustment_get_page_increment (adj) / 2));
+ value = CLAMP (value,
+ gtk_adjustment_get_lower (adj),
+ gtk_adjustment_get_upper (adj) -
+ gtk_adjustment_get_page_size (adj));
+
+ gtk_adjustment_set_value (adj, value);
}
-
- value = (gtk_adjustment_get_value (adj) +
- ((direction == GDK_SCROLL_UP ||
- direction == GDK_SCROLL_LEFT) ?
- -gtk_adjustment_get_page_increment (adj) / 2 :
- gtk_adjustment_get_page_increment (adj) / 2));
- value = CLAMP (value,
- gtk_adjustment_get_lower (adj),
- gtk_adjustment_get_upper (adj) -
- gtk_adjustment_get_page_size (adj));
-
- gtk_adjustment_set_value (adj, value);
}
gimp_display_shell_untransform_event_coords (shell,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]