mirror of
https://github.com/labwc/labwc.git
synced 2026-03-01 01:40:24 -05:00
magnifier: minor refactor
This commit is contained in:
parent
8ba066a1a5
commit
b9b870cfa7
2 changed files with 11 additions and 20 deletions
|
|
@ -3,10 +3,11 @@
|
||||||
#define LABWC_MAGNIFIER_H
|
#define LABWC_MAGNIFIER_H
|
||||||
|
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <wayland-server-core.h>
|
|
||||||
|
|
||||||
struct server;
|
struct server;
|
||||||
struct output;
|
struct output;
|
||||||
|
struct wlr_buffer;
|
||||||
|
struct wlr_box;
|
||||||
|
|
||||||
enum magnify_dir {
|
enum magnify_dir {
|
||||||
MAGNIFY_INCREASE,
|
MAGNIFY_INCREASE,
|
||||||
|
|
|
||||||
|
|
@ -2,15 +2,15 @@
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <wlr/types/wlr_output.h>
|
#include <wlr/types/wlr_output.h>
|
||||||
#include "magnifier.h"
|
|
||||||
#include "labwc.h"
|
|
||||||
#include "theme.h"
|
|
||||||
#include "common/macros.h"
|
#include "common/macros.h"
|
||||||
|
#include "labwc.h"
|
||||||
|
#include "magnifier.h"
|
||||||
|
#include "theme.h"
|
||||||
|
|
||||||
bool magnify_on;
|
static bool magnify_on;
|
||||||
double mag_scale = 0.0;
|
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
|
void
|
||||||
magnify(struct output *output, struct wlr_buffer *output_buffer, struct wlr_box *damage)
|
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;
|
return output_nearest_to_cursor(output->server) == output;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/* Toggles magnification on and off */
|
||||||
* Toggles magnification on and off
|
|
||||||
*/
|
|
||||||
|
|
||||||
void
|
void
|
||||||
magnify_toggle(struct server *server)
|
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
|
void
|
||||||
magnify_set_scale(struct server *server, enum magnify_dir dir)
|
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
|
bool
|
||||||
is_magnify_on(void)
|
is_magnify_on(void)
|
||||||
{
|
{
|
||||||
return magnify_on;
|
return magnify_on;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue