From 789e7f9331fbd2e52be8479986b3aac0bca604e0 Mon Sep 17 00:00:00 2001 From: Simon Long Date: Thu, 2 May 2024 18:12:28 +0100 Subject: [PATCH] Magnifier on/off just a global flag; not in XML --- include/config/rcxml.h | 1 - src/common/scene-helpers.c | 24 +++++++++++++----------- src/config/rcxml.c | 1 - 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/include/config/rcxml.h b/include/config/rcxml.h index 4fe8df37..0a25fc87 100644 --- a/include/config/rcxml.h +++ b/include/config/rcxml.h @@ -142,7 +142,6 @@ struct rcxml { unsigned int menu_ignore_button_release_period; /* magnifier */ - bool magnify; int mag_scale; int mag_size; }; diff --git a/src/common/scene-helpers.c b/src/common/scene-helpers.c index 82c41574..17a0c505 100644 --- a/src/common/scene-helpers.c +++ b/src/common/scene-helpers.c @@ -12,6 +12,8 @@ #include #include "common/macros.h" +static bool magnify_on; + struct wlr_surface * lab_wlr_surface_from_node(struct wlr_scene_node *node) { @@ -208,7 +210,7 @@ output_wants_magnification(struct output *output) static double x = -1; static double y = -1; struct wlr_cursor *cursor = output->server->seat.cursor; - if (!rc.magnify) { + if (!magnify_on) { x = -1; y = -1; return false; @@ -227,10 +229,10 @@ output_wants_magnification(struct output *output) void magnify_toggle (void) { - if (rc.magnify) { - rc.magnify = false; + if (magnify_on) { + magnify_on = false; } else { - rc.magnify = true; + magnify_on = true; } } @@ -241,17 +243,17 @@ void magnify_toggle (void) void magnify_set_scale (enum magnify_dir dir) { if (dir == MAGNIFY_INCREASE) { - if (rc.magnify) { + if (magnify_on) { rc.mag_scale++; } else { - rc.magnify = true; + magnify_on = true; rc.mag_scale = 2; } } else { - if (rc.magnify && rc.mag_scale > 2) { + if (magnify_on && rc.mag_scale > 2) { rc.mag_scale--; } else { - rc.magnify = false; + magnify_on = false; } } } @@ -273,11 +275,11 @@ lab_wlr_scene_output_commit(struct wlr_scene_output *scene_output) if (!wlr_output->needs_frame && !pixman_region32_not_empty( &scene_output->damage_ring.current) && !wants_magnification - && last_mag != rc.magnify && last_scale != rc.mag_scale) { + && last_mag != magnify_on && last_scale != rc.mag_scale) { return false; } - last_mag = rc.magnify; + last_mag = magnify_on; last_scale = rc.mag_scale; if (!wlr_scene_output_build_state(scene_output, state, NULL)) { @@ -287,7 +289,7 @@ lab_wlr_scene_output_commit(struct wlr_scene_output *scene_output) } struct wlr_box additional_damage = {0}; - if (state->buffer && rc.magnify) { + if (state->buffer && magnify_on) { magnify(output, state->buffer, &additional_damage); } diff --git a/src/config/rcxml.c b/src/config/rcxml.c index aff60bb2..8400e21f 100644 --- a/src/config/rcxml.c +++ b/src/config/rcxml.c @@ -1243,7 +1243,6 @@ rcxml_init(void) rc.menu_ignore_button_release_period = 250; - rc.magnify = false; rc.mag_scale = 2; rc.mag_size = 400; }