summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeandro Ribeiro <leandro.ribeiro@collabora.com>2024-04-10 23:37:20 -0300
committerPekka Paalanen <pq@iki.fi>2024-04-26 14:15:28 +0000
commitca01b1ff8daf005e93d6c7ef3a7b6854ea140f54 (patch)
tree3e012e7320fbc33174da8d7b97a035f7b1ec32f1
parentcfc886fcb373c907f67c7b0dc50567a293a81c20 (diff)
clients/image: move a few functions on the file
Cosmetic changes. Move the image_widget handlers closer to each other. Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
-rw-r--r--clients/image.c58
1 files changed, 29 insertions, 29 deletions
diff --git a/clients/image.c b/clients/image.c
index f1c28099..dd54ff1d 100644
--- a/clients/image.c
+++ b/clients/image.c
@@ -193,15 +193,6 @@ image_resize_handler(struct widget *widget,
allocation.width, allocation.height);
}
-static void
-keyboard_focus_handler(struct window *window,
- struct input *device, void *data)
-{
- struct image *image = data;
-
- window_schedule_redraw(image->window);
-}
-
static int
image_enter_handler(struct widget *widget,
struct input *input,
@@ -300,6 +291,35 @@ zoom(struct image *image, double scale)
}
static void
+image_axis_handler(struct widget *widget, struct input *input, uint32_t time,
+ uint32_t axis, wl_fixed_t value, void *data)
+{
+ struct image *image = data;
+
+ if (axis == WL_POINTER_AXIS_VERTICAL_SCROLL &&
+ input_get_modifiers(input) == MOD_CONTROL_MASK) {
+ /* set zoom level to 2% per 10 axis units */
+ zoom(image, (1.0 - wl_fixed_to_double(value) / 500.0));
+
+ window_schedule_redraw(image->window);
+ } else if (input_get_modifiers(input) == 0) {
+ if (axis == WL_POINTER_AXIS_VERTICAL_SCROLL)
+ move_viewport(image, 0, wl_fixed_to_double(value));
+ else if (axis == WL_POINTER_AXIS_HORIZONTAL_SCROLL)
+ move_viewport(image, wl_fixed_to_double(value), 0);
+ }
+}
+
+static void
+keyboard_focus_handler(struct window *window,
+ struct input *device, void *data)
+{
+ struct image *image = data;
+
+ window_schedule_redraw(image->window);
+}
+
+static void
key_handler(struct window *window, struct input *input, uint32_t time,
uint32_t key, uint32_t sym, enum wl_keyboard_key_state state,
void *data)
@@ -331,26 +351,6 @@ key_handler(struct window *window, struct input *input, uint32_t time,
}
static void
-image_axis_handler(struct widget *widget, struct input *input, uint32_t time,
- uint32_t axis, wl_fixed_t value, void *data)
-{
- struct image *image = data;
-
- if (axis == WL_POINTER_AXIS_VERTICAL_SCROLL &&
- input_get_modifiers(input) == MOD_CONTROL_MASK) {
- /* set zoom level to 2% per 10 axis units */
- zoom(image, (1.0 - wl_fixed_to_double(value) / 500.0));
-
- window_schedule_redraw(image->window);
- } else if (input_get_modifiers(input) == 0) {
- if (axis == WL_POINTER_AXIS_VERTICAL_SCROLL)
- move_viewport(image, 0, wl_fixed_to_double(value));
- else if (axis == WL_POINTER_AXIS_HORIZONTAL_SCROLL)
- move_viewport(image, wl_fixed_to_double(value), 0);
- }
-}
-
-static void
fullscreen_handler(struct window *window, void *data)
{
struct image *image = data;