[gimp] app: avoid spin scale pointer wrap when value is at upper/loewr limit
- From: N/A <ell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: avoid spin scale pointer wrap when value is at upper/loewr limit
- Date: Thu, 2 Nov 2017 06:36:55 +0000 (UTC)
commit ae851c34b42a9eddde34beb44acefce5c805eb41
Author: Ell <ell_se yahoo com>
Date: Thu Nov 2 02:25:11 2017 -0400
app: avoid spin scale pointer wrap when value is at upper/loewr limit
When applying a relative adjustment to a spin scale, don't wrap the
pointer around the corresponding screen edge if the spin scale's
value is already minimal/maximal.
app/widgets/gimpspinscale.c | 28 ++++++++++++++++++++++++++--
1 files changed, 26 insertions(+), 2 deletions(-)
---
diff --git a/app/widgets/gimpspinscale.c b/app/widgets/gimpspinscale.c
index b554d8f..f912cd4 100644
--- a/app/widgets/gimpspinscale.c
+++ b/app/widgets/gimpspinscale.c
@@ -887,13 +887,37 @@ gimp_spin_scale_motion_notify (GtkWidget *widget,
if (private->relative_change)
{
- if (pointer_x <= monitor_geometry.x)
+ GtkAdjustment *adjustment;
+ gdouble value;
+ gdouble lower;
+ gdouble upper;
+
+ adjustment = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (widget));
+
+ value = gtk_adjustment_get_value (adjustment);
+ lower = gtk_adjustment_get_lower (adjustment);
+ upper = gtk_adjustment_get_upper (adjustment);
+
+ if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
+ {
+ gdouble temp;
+
+ value = -value;
+
+ temp = lower;
+ lower = -upper;
+ upper = -temp;
+ }
+
+ if (pointer_x <= monitor_geometry.x &&
+ value > lower)
{
private->pointer_warp = TRUE;
private->pointer_warp_x = (monitor_geometry.width - 1) + pointer_x - 1;
private->pointer_warp_start_x = private->start_x + (monitor_geometry.width - 2);
}
- else if (pointer_x >= monitor_geometry.x + (monitor_geometry.width - 1))
+ else if (pointer_x >= monitor_geometry.x + (monitor_geometry.width - 1) &&
+ value < upper)
{
private->pointer_warp = TRUE;
private->pointer_warp_x = pointer_x - (monitor_geometry.width - 1) + 1;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]