]> git.mdlowis.com Git - proto/labwc.git/commitdiff
magnifier: minor refactor
authortokyo4j <hrak1529@gmail.com>
Thu, 16 May 2024 00:35:47 +0000 (09:35 +0900)
committerConsolatis <35009135+Consolatis@users.noreply.github.com>
Thu, 16 May 2024 09:33:53 +0000 (11:33 +0200)
include/magnifier.h
src/magnifier.c

index 407fb04d161f06506805767ac0ff8b7c8cd0de83..60005458d54d7a6acfd124ed3d1cd2f1103b99bf 100644 (file)
@@ -3,10 +3,11 @@
 #define LABWC_MAGNIFIER_H
 
 #include <stdbool.h>
-#include <wayland-server-core.h>
 
 struct server;
 struct output;
+struct wlr_buffer;
+struct wlr_box;
 
 enum magnify_dir {
        MAGNIFY_INCREASE,
index 4c2097b795d4ae687d9e2ec7da0b53ca426c0399..327fd3e4f807602080b1aac9efc2dd09d402baaa 100644 (file)
@@ -2,15 +2,15 @@
 
 #include <assert.h>
 #include <wlr/types/wlr_output.h>
-#include "magnifier.h"
+#include "common/macros.h"
 #include "labwc.h"
+#include "magnifier.h"
 #include "theme.h"
-#include "common/macros.h"
 
-bool magnify_on;
-double mag_scale = 0.0;
+static bool magnify_on;
+static double mag_scale = 0.0;
 
-#define CLAMP(in, lower, upper) MAX(MIN(in, upper), lower)
+#define CLAMP(in, lower, upper) MAX(MIN((in), (upper)), (lower))
 
 void
 magnify(struct output *output, struct wlr_buffer *output_buffer, struct wlr_box *damage)
@@ -241,10 +241,7 @@ output_wants_magnification(struct output *output)
        return output_nearest_to_cursor(output->server) == output;
 }
 
-/*
- * Toggles magnification on and off
- */
-
+/* Toggles magnification on and off */
 void
 magnify_toggle(struct server *server)
 {
@@ -261,10 +258,7 @@ magnify_toggle(struct server *server)
        }
 }
 
-/*
- * Increases and decreases magnification scale
- */
-
+/* Increases and decreases magnification scale */
 void
 magnify_set_scale(struct server *server, enum magnify_dir dir)
 {
@@ -290,13 +284,9 @@ magnify_set_scale(struct server *server, enum magnify_dir dir)
        }
 }
 
-/*
- * Report whether magnification is enabled
- */
-
+/* Report whether magnification is enabled */
 bool
 is_magnify_on(void)
 {
        return magnify_on;
 }
-