Parameterise magnification step for now

This commit is contained in:
Simon Long 2024-05-08 15:15:53 +01:00
parent 4dc9255fe3
commit d2d301f98e

View file

@ -14,7 +14,8 @@
#include "common/macros.h" #include "common/macros.h"
static bool magnify_on; static bool magnify_on;
static int mag_scale = 0; static double mag_scale = 0.0;
#define MAG_INCREMENT 0.2
struct wlr_surface * struct wlr_surface *
lab_wlr_surface_from_node(struct wlr_scene_node *node) lab_wlr_surface_from_node(struct wlr_scene_node *node)
@ -100,7 +101,7 @@ magnify(struct output *output, struct wlr_buffer *output_buffer, struct wlr_box
return; return;
} }
if (!mag_scale) { if (mag_scale == 0.0) {
mag_scale = theme->mag_scale; mag_scale = theme->mag_scale;
} }
@ -306,14 +307,14 @@ magnify_set_scale(enum magnify_dir dir)
{ {
if (dir == MAGNIFY_INCREASE) { if (dir == MAGNIFY_INCREASE) {
if (magnify_on) { if (magnify_on) {
mag_scale++; mag_scale += MAG_INCREMENT;
} else { } else {
magnify_on = true; magnify_on = true;
mag_scale = 2; mag_scale = 1.0 + MAG_INCREMENT;
} }
} else { } else {
if (magnify_on && mag_scale > 2) { if (magnify_on && mag_scale > 1.0 + MAG_INCREMENT) {
mag_scale--; mag_scale -= MAG_INCREMENT;
} else { } else {
magnify_on = false; magnify_on = false;
} }