[gimp/gtk3-port: 409/444] app: use gimp_scroll_adjustment_values() for scrolling the canvas
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/gtk3-port: 409/444] app: use gimp_scroll_adjustment_values() for scrolling the canvas
- Date: Sun, 13 May 2018 22:12:16 +0000 (UTC)
commit ceb96d3793e35b879b70f83b4e7d8ffc5823c8eb
Author: Michael Natterer <mitch gimp org>
Date: Thu May 10 23:33:35 2018 +0200
app: use gimp_scroll_adjustment_values() for scrolling the canvas
app/display/gimpdisplayshell-tool-events.c | 46 +++++----------------------
1 files changed, 9 insertions(+), 37 deletions(-)
---
diff --git a/app/display/gimpdisplayshell-tool-events.c b/app/display/gimpdisplayshell-tool-events.c
index c676f1c..de27ca5 100644
--- a/app/display/gimpdisplayshell-tool-events.c
+++ b/app/display/gimpdisplayshell-tool-events.c
@@ -729,11 +729,9 @@ gimp_display_shell_canvas_tool_events (GtkWidget *canvas,
! gimp_controller_wheel_scroll (GIMP_CONTROLLER_WHEEL (wheel),
sevent))
{
- GdkScrollDirection direction = sevent->direction;
-
if (state & gimp_get_toggle_behavior_mask ())
{
- switch (direction)
+ switch (sevent->direction)
{
case GDK_SCROLL_UP:
gimp_display_shell_scale (shell,
@@ -755,42 +753,16 @@ gimp_display_shell_canvas_tool_events (GtkWidget *canvas,
}
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;
- }
+ gdouble value_x;
+ gdouble value_y;
- 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;
- }
+ gimp_scroll_adjustment_values (sevent,
+ shell->hsbdata,
+ shell->vsbdata,
+ &value_x, &value_y);
- 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);
+ gtk_adjustment_set_value (shell->hsbdata, value_x);
+ gtk_adjustment_set_value (shell->vsbdata, value_y);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]