mirror of
https://github.com/labwc/labwc.git
synced 2025-10-29 05:40:24 -04:00
parent
7756d5b975
commit
88a67d586c
3 changed files with 15 additions and 11 deletions
|
|
@ -255,6 +255,7 @@ struct server {
|
||||||
struct seat seat;
|
struct seat seat;
|
||||||
struct wlr_scene *scene;
|
struct wlr_scene *scene;
|
||||||
struct wlr_scene_output_layout *scene_layout;
|
struct wlr_scene_output_layout *scene_layout;
|
||||||
|
bool direct_scanout_enabled;
|
||||||
|
|
||||||
/* cursor interactive */
|
/* cursor interactive */
|
||||||
enum input_mode input_mode;
|
enum input_mode input_mode;
|
||||||
|
|
|
||||||
|
|
@ -112,7 +112,6 @@ magnify(struct output *output, struct wlr_buffer *output_buffer, struct wlr_box
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Paste the magnified result back into the output buffer */
|
|
||||||
if (!tmp_texture) {
|
if (!tmp_texture) {
|
||||||
tmp_texture = wlr_texture_from_buffer(server->renderer, tmp_buffer);
|
tmp_texture = wlr_texture_from_buffer(server->renderer, tmp_buffer);
|
||||||
}
|
}
|
||||||
|
|
@ -124,7 +123,6 @@ magnify(struct output *output, struct wlr_buffer *output_buffer, struct wlr_box
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Extract source region into temporary buffer */
|
/* Extract source region into temporary buffer */
|
||||||
|
|
||||||
struct wlr_render_pass *tmp_render_pass = wlr_renderer_begin_buffer_pass(
|
struct wlr_render_pass *tmp_render_pass = wlr_renderer_begin_buffer_pass(
|
||||||
server->renderer, tmp_buffer, NULL);
|
server->renderer, tmp_buffer, NULL);
|
||||||
|
|
||||||
|
|
@ -198,6 +196,7 @@ magnify(struct output *output, struct wlr_buffer *output_buffer, struct wlr_box
|
||||||
dst_box.y = oy - (height / 2);
|
dst_box.y = oy - (height / 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Paste the magnified result back into the output buffer */
|
||||||
opts = (struct wlr_render_texture_options) {
|
opts = (struct wlr_render_texture_options) {
|
||||||
.texture = tmp_texture,
|
.texture = tmp_texture,
|
||||||
.src_box = src_box,
|
.src_box = src_box,
|
||||||
|
|
@ -241,18 +240,21 @@ output_wants_magnification(struct output *output)
|
||||||
return output_nearest_to_cursor(output->server) == output;
|
return output_nearest_to_cursor(output->server) == output;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
enable_magnifier(struct server *server, bool enable)
|
||||||
|
{
|
||||||
|
magnify_on = enable;
|
||||||
|
server->scene->direct_scanout = enable ? false
|
||||||
|
: server->direct_scanout_enabled;
|
||||||
|
}
|
||||||
|
|
||||||
/* Toggles magnification on and off */
|
/* Toggles magnification on and off */
|
||||||
void
|
void
|
||||||
magnify_toggle(struct server *server)
|
magnify_toggle(struct server *server)
|
||||||
{
|
{
|
||||||
|
enable_magnifier(server, !magnify_on);
|
||||||
|
|
||||||
struct output *output = output_nearest_to_cursor(server);
|
struct output *output = output_nearest_to_cursor(server);
|
||||||
|
|
||||||
if (magnify_on) {
|
|
||||||
magnify_on = false;
|
|
||||||
} else {
|
|
||||||
magnify_on = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (output) {
|
if (output) {
|
||||||
wlr_output_schedule_frame(output->wlr_output);
|
wlr_output_schedule_frame(output->wlr_output);
|
||||||
}
|
}
|
||||||
|
|
@ -268,14 +270,14 @@ magnify_set_scale(struct server *server, enum magnify_dir dir)
|
||||||
if (magnify_on) {
|
if (magnify_on) {
|
||||||
mag_scale += rc.mag_increment;
|
mag_scale += rc.mag_increment;
|
||||||
} else {
|
} else {
|
||||||
magnify_on = true;
|
enable_magnifier(server, true);
|
||||||
mag_scale = 1.0 + rc.mag_increment;
|
mag_scale = 1.0 + rc.mag_increment;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (magnify_on && mag_scale > 1.0 + rc.mag_increment) {
|
if (magnify_on && mag_scale > 1.0 + rc.mag_increment) {
|
||||||
mag_scale -= rc.mag_increment;
|
mag_scale -= rc.mag_increment;
|
||||||
} else {
|
} else {
|
||||||
magnify_on = false;
|
enable_magnifier(server, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -414,6 +414,7 @@ server_init(struct server *server)
|
||||||
wlr_log(WLR_ERROR, "unable to create scene");
|
wlr_log(WLR_ERROR, "unable to create scene");
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
server->direct_scanout_enabled = server->scene->direct_scanout;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The order in which the scene-trees below are created determines the
|
* The order in which the scene-trees below are created determines the
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue