[gimp/gtk3-port: 409/457] 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/457] app: use gimp_scroll_adjustment_values() for scrolling the canvas
- Date: Sat, 19 May 2018 18:38:02 +0000 (UTC)
commit 2f3028fddb142a177d0ff5b1ef804b8869c60915
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 894e6a7..7a9fd53 100644
--- a/app/display/gimpdisplayshell-tool-events.c
+++ b/app/display/gimpdisplayshell-tool-events.c
@@ -730,11 +730,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,
@@ -756,42 +754,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]