[gnome-builder/wip/slaf/colorpicker] gstyle-eyedropper: add keys to change zoom factor
- From: Sébastien Lafargue <slafargue src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/slaf/colorpicker] gstyle-eyedropper: add keys to change zoom factor
- Date: Sun, 17 Jul 2016 14:18:08 +0000 (UTC)
commit 3f40e0ab52c4a64ce49dfcfa4132be6f390599a6
Author: Sebastien Lafargue <slafargue gnome org>
Date: Sun Jul 17 16:16:11 2016 +0200
gstyle-eyedropper: add keys to change zoom factor
PgUp and keypad PgUp to increase the zoom factor
PgDown and keypad PgDown to decrease the zoom factor
contrib/gstyle/gstyle-eyedropper.c | 30 ++++++++++++++++++++++++++++--
1 files changed, 28 insertions(+), 2 deletions(-)
---
diff --git a/contrib/gstyle/gstyle-eyedropper.c b/contrib/gstyle/gstyle-eyedropper.c
index f2d0983..6a03353 100644
--- a/contrib/gstyle/gstyle-eyedropper.c
+++ b/contrib/gstyle/gstyle-eyedropper.c
@@ -368,6 +368,22 @@ gstyle_eyedropper_pointer_pressed_cb (GstyleEyedropper *self,
return GDK_EVENT_PROPAGATE;
}
+static void
+decrease_zoom_factor (GstyleEyedropper *self)
+{
+ g_assert (GSTYLE_IS_EYEDROPPER (self));
+
+ self->zoom_factor = CLAMP (self->zoom_factor - 0.5, MIN_ZOOM_FACTOR, MAX_ZOOM_FACTOR);
+}
+
+static void
+increase_zoom_factor (GstyleEyedropper *self)
+{
+ g_assert (GSTYLE_IS_EYEDROPPER (self));
+
+ self->zoom_factor = CLAMP (self->zoom_factor + 0.5, MIN_ZOOM_FACTOR, MAX_ZOOM_FACTOR);
+}
+
static gboolean
gstyle_eyedropper_pointer_wheel_cb (GstyleEyedropper *self,
GdkEventScroll *event,
@@ -381,9 +397,9 @@ gstyle_eyedropper_pointer_wheel_cb (GstyleEyedropper *self,
if (event->type == GDK_SCROLL)
{
if (event->direction == GDK_SCROLL_UP)
- self->zoom_factor = CLAMP (self->zoom_factor + 0.5, MIN_ZOOM_FACTOR, MAX_ZOOM_FACTOR);
+ increase_zoom_factor (self);
else if (event->direction == GDK_SCROLL_DOWN)
- self->zoom_factor = CLAMP (self->zoom_factor - 0.5, MIN_ZOOM_FACTOR, MAX_ZOOM_FACTOR);
+ decrease_zoom_factor (self);
else
return GDK_EVENT_PROPAGATE;
}
@@ -439,6 +455,16 @@ gstyle_eyedropper_key_pressed_cb (GstyleEyedropper *self,
dx = (state == GDK_MOD1_MASK) ? CURSOR_ALT_STEP : 1;
break;
+ case GDK_KEY_Page_Up:
+ case GDK_KEY_KP_Page_Up:
+ increase_zoom_factor (self);
+ break;
+
+ case GDK_KEY_Page_Down:
+ case GDK_KEY_KP_Page_Down:
+ decrease_zoom_factor (self);
+ break;
+
default:
return GDK_EVENT_PROPAGATE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]