Remove explicit fullscreen flag

This commit is contained in:
Simon Long 2024-05-08 08:54:20 +01:00
parent 94afd1f7b0
commit 4dc9255fe3
4 changed files with 14 additions and 11 deletions

View file

@ -279,9 +279,11 @@ elements are not listed here, but are supported.
*magnifier.width* *magnifier.width*
Width of magnifier window in pixels. Default is 400. Width of magnifier window in pixels. Default is 400.
Set to -1 to use fullscreen magnifier.
*magnifier.height* *magnifier.height*
Height of magnifier window in pixels. Default is 400. Height of magnifier window in pixels. Default is 400.
Set to -1 to use fullscreen magnifier.
*magnifier.border.width* *magnifier.border.width*
Width of magnifier window border in pixels. Default is 1. Width of magnifier window border in pixels. Default is 1.

View file

@ -147,7 +147,6 @@ struct theme {
float mag_border_color[4]; float mag_border_color[4];
int mag_border_width; int mag_border_width;
int mag_filter; int mag_filter;
int mag_fullscreen;
}; };
struct server; struct server;

View file

@ -44,7 +44,7 @@ lab_wlr_scene_get_prev_node(struct wlr_scene_node *node)
return prev; return prev;
} }
static double constrain (double lower, double in, double upper) static double constrain(double lower, double in, double upper)
{ {
if (in < lower) { if (in < lower) {
return lower; return lower;
@ -62,6 +62,7 @@ magnify(struct output *output, struct wlr_buffer *output_buffer, struct wlr_box
double x, y; double x, y;
struct wlr_box border_box, dst_box; struct wlr_box border_box, dst_box;
struct wlr_fbox src_box; struct wlr_fbox src_box;
bool fullscreen = false;
/* Reuse a single scratch buffer */ /* Reuse a single scratch buffer */
static struct wlr_buffer *tmp_buffer = NULL; static struct wlr_buffer *tmp_buffer = NULL;
@ -91,7 +92,11 @@ magnify(struct output *output, struct wlr_buffer *output_buffer, struct wlr_box
wlr_output_layout_output_coords(server->output_layout, output->wlr_output, &ox, &oy); wlr_output_layout_output_coords(server->output_layout, output->wlr_output, &ox, &oy);
ox *= output->wlr_output->scale; ox *= output->wlr_output->scale;
oy *= output->wlr_output->scale; oy *= output->wlr_output->scale;
if (ox < 0 || oy < 0 || ox > output_buffer->width || oy > output_buffer->height) { if (theme->mag_width == -1 || theme->mag_height == -1) {
fullscreen = true;
}
if ((ox < 0 || oy < 0 || ox >= output_buffer->width || oy >= output_buffer->height)
&& fullscreen) {
return; return;
} }
@ -99,7 +104,7 @@ magnify(struct output *output, struct wlr_buffer *output_buffer, struct wlr_box
mag_scale = theme->mag_scale; mag_scale = theme->mag_scale;
} }
if (theme->mag_fullscreen) { if (fullscreen) {
// The lines below were the first attempt at enabling fullscreen (with no // The lines below were the first attempt at enabling fullscreen (with no
// other changes required). They appeared to work with a 4K monitor set to // other changes required). They appeared to work with a 4K monitor set to
// 1080p, but when the monitor was set to native 4K, they resulted in a // 1080p, but when the monitor was set to native 4K, they resulted in a
@ -187,7 +192,7 @@ magnify(struct output *output, struct wlr_buffer *output_buffer, struct wlr_box
server->renderer, output_buffer, NULL); server->renderer, output_buffer, NULL);
/* Borders */ /* Borders */
if (theme->mag_fullscreen) { if (fullscreen) {
border_box.x = 0; border_box.x = 0;
border_box.y = 0; border_box.y = 0;
border_box.width = width; border_box.width = width;
@ -221,10 +226,10 @@ magnify(struct output *output, struct wlr_buffer *output_buffer, struct wlr_box
dst_box.width = width; dst_box.width = width;
dst_box.height = height; dst_box.height = height;
if (theme->mag_fullscreen) { if (fullscreen) {
src_box.x = constrain (0.0, ox - (ox / mag_scale), src_box.x = constrain(0.0, ox - (ox / mag_scale),
width * (mag_scale - 1.0) / mag_scale); width * (mag_scale - 1.0) / mag_scale);
src_box.y = constrain (0.0, oy - (oy / mag_scale), src_box.y = constrain(0.0, oy - (oy / mag_scale),
height * (mag_scale - 1.0) / mag_scale); height * (mag_scale - 1.0) / mag_scale);
dst_box.x = 0; dst_box.x = 0;
dst_box.y = 0; dst_box.y = 0;

View file

@ -853,9 +853,6 @@ entry(struct theme *theme, const char *key, const char *value)
if (match_glob(key, "magnifier.filter")) { if (match_glob(key, "magnifier.filter")) {
theme->mag_filter = atoi(value); theme->mag_filter = atoi(value);
} }
if (match_glob(key, "magnifier.fullscreen")) {
theme->mag_fullscreen = atoi(value);
}
} }
static void static void