Commit 73a9ac96 authored by Michael Natterer's avatar Michael Natterer 😴
Browse files

app: add gimp_display_shell_scrollbars_update_steppers()

for the code from gimp_display_shell_scroll_clamp_and_update() that
sets the scrollbar stepper sensitivity.
parent 5521ce08
......@@ -35,7 +35,6 @@
#include "gimpdisplay-foreach.h"
#include "gimpdisplayshell.h"
#include "gimpdisplayshell-expose.h"
#include "gimpdisplayshell-rotate.h"
#include "gimpdisplayshell-rulers.h"
#include "gimpdisplayshell-scale.h"
#include "gimpdisplayshell-scroll.h"
......@@ -198,34 +197,18 @@ gimp_display_shell_scroll_clamp_and_update (GimpDisplayShell *shell)
max_offset_y = sh + overpan_amount - shell->disp_height;
}
/* Handle scrollbar stepper sensitiity */
gtk_range_set_lower_stepper_sensitivity (GTK_RANGE (shell->hsb),
min_offset_x < shell->offset_x ?
GTK_SENSITIVITY_ON :
GTK_SENSITIVITY_OFF);
gtk_range_set_upper_stepper_sensitivity (GTK_RANGE (shell->hsb),
max_offset_x > shell->offset_x ?
GTK_SENSITIVITY_ON :
GTK_SENSITIVITY_OFF);
gtk_range_set_lower_stepper_sensitivity (GTK_RANGE (shell->vsb),
min_offset_y < shell->offset_y ?
GTK_SENSITIVITY_ON :
GTK_SENSITIVITY_OFF);
gtk_range_set_upper_stepper_sensitivity (GTK_RANGE (shell->vsb),
max_offset_y > shell->offset_y ?
GTK_SENSITIVITY_ON :
GTK_SENSITIVITY_OFF);
/* Clamp */
shell->offset_x = CLAMP (shell->offset_x, min_offset_x, max_offset_x);
shell->offset_y = CLAMP (shell->offset_y, min_offset_y, max_offset_y);
/* Set scrollbar stepper sensitiity */
gimp_display_shell_scrollbars_update_steppers (shell,
min_offset_x,
max_offset_x,
min_offset_y,
max_offset_y);
}
else
{
......
......@@ -161,3 +161,44 @@ gimp_display_shell_scrollbars_setup_vertical (GimpDisplayShell *shell,
MINIMUM_STEP_AMOUNT),
NULL);
}
/**
* gimp_display_shell_scrollbars_update_steppers:
* @shell:
* @min_offset_x:
* @max_offset_x:
* @min_offset_y:
* @max_offset_y:
*
* Sets the scrollbars' stepper sensitivity which is set differently
* from its adjustment limits because we support overscrolling.
**/
void
gimp_display_shell_scrollbars_update_steppers (GimpDisplayShell *shell,
gint min_offset_x,
gint max_offset_x,
gint min_offset_y,
gint max_offset_y)
{
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
gtk_range_set_lower_stepper_sensitivity (GTK_RANGE (shell->hsb),
min_offset_x < shell->offset_x ?
GTK_SENSITIVITY_ON :
GTK_SENSITIVITY_OFF);
gtk_range_set_upper_stepper_sensitivity (GTK_RANGE (shell->hsb),
max_offset_x > shell->offset_x ?
GTK_SENSITIVITY_ON :
GTK_SENSITIVITY_OFF);
gtk_range_set_lower_stepper_sensitivity (GTK_RANGE (shell->vsb),
min_offset_y < shell->offset_y ?
GTK_SENSITIVITY_ON :
GTK_SENSITIVITY_OFF);
gtk_range_set_upper_stepper_sensitivity (GTK_RANGE (shell->vsb),
max_offset_y > shell->offset_y ?
GTK_SENSITIVITY_ON :
GTK_SENSITIVITY_OFF);
}
......@@ -26,5 +26,11 @@ void gimp_display_shell_scrollbars_setup_horizontal (GimpDisplayShell *shell,
void gimp_display_shell_scrollbars_setup_vertical (GimpDisplayShell *shell,
gdouble value);
void gimp_display_shell_scrollbars_update_steppers (GimpDisplayShell *shell,
gint min_offset_x,
gint max_offset_x,
gint min_offset_y,
gint max_offset_y);
#endif /* __GIMP_DISPLAY_SHELL_SCROLLBARS_H__ */
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment