Add screen magnifier

This adds a screen magnifier which can be controlled with the
`ZoomIn` / `ZoomOut` and `ToggleMagnify` actions.

It scales up part of the rendered framebuffer so the magnification
may end up looking blurry depending on the magnification scale.

PR #1774
This commit is contained in:
Simon Long 2024-05-15 23:07:23 +01:00 committed by GitHub
parent ad15c0474d
commit 8ba066a1a5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 473 additions and 1 deletions

View file

@ -15,6 +15,7 @@
#include "common/string-helpers.h"
#include "debug.h"
#include "labwc.h"
#include "magnifier.h"
#include "menu/menu.h"
#include "osd.h"
#include "output-virtual.h"
@ -110,6 +111,9 @@ enum action_type {
ACTION_TYPE_SHADE,
ACTION_TYPE_UNSHADE,
ACTION_TYPE_TOGGLE_SHADE,
ACTION_TYPE_TOGGLE_MAGNIFY,
ACTION_TYPE_ZOOM_IN,
ACTION_TYPE_ZOOM_OUT
};
const char *action_names[] = {
@ -163,6 +167,9 @@ const char *action_names[] = {
"Shade",
"Unshade",
"ToggleShade",
"ToggleMagnify",
"ZoomIn",
"ZoomOut",
NULL
};
@ -1046,6 +1053,15 @@ actions_run(struct view *activator, struct server *server,
view_set_shade(view, false);
}
break;
case ACTION_TYPE_TOGGLE_MAGNIFY:
magnify_toggle(server);
break;
case ACTION_TYPE_ZOOM_IN:
magnify_set_scale(server, MAGNIFY_INCREASE);
break;
case ACTION_TYPE_ZOOM_OUT:
magnify_set_scale(server, MAGNIFY_DECREASE);
break;
case ACTION_TYPE_INVALID:
wlr_log(WLR_ERROR, "Not executing unknown action");
break;