mirror of
https://github.com/labwc/labwc.git
synced 2026-04-12 08:21:13 -04:00
Magnifier on/off just a global flag; not in XML
This commit is contained in:
parent
165b955cd9
commit
bb89d5b171
3 changed files with 13 additions and 13 deletions
|
|
@ -139,7 +139,6 @@ struct rcxml {
|
||||||
struct wl_list window_rules; /* struct window_rule.link */
|
struct wl_list window_rules; /* struct window_rule.link */
|
||||||
|
|
||||||
/* magnifier */
|
/* magnifier */
|
||||||
bool magnify;
|
|
||||||
int mag_scale;
|
int mag_scale;
|
||||||
int mag_size;
|
int mag_size;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,8 @@
|
||||||
#include <wlr/render/drm_format_set.h>
|
#include <wlr/render/drm_format_set.h>
|
||||||
#include "common/macros.h"
|
#include "common/macros.h"
|
||||||
|
|
||||||
|
static bool magnify_on;
|
||||||
|
|
||||||
struct wlr_surface *
|
struct wlr_surface *
|
||||||
lab_wlr_surface_from_node(struct wlr_scene_node *node)
|
lab_wlr_surface_from_node(struct wlr_scene_node *node)
|
||||||
{
|
{
|
||||||
|
|
@ -208,7 +210,7 @@ output_wants_magnification(struct output *output)
|
||||||
static double x = -1;
|
static double x = -1;
|
||||||
static double y = -1;
|
static double y = -1;
|
||||||
struct wlr_cursor *cursor = output->server->seat.cursor;
|
struct wlr_cursor *cursor = output->server->seat.cursor;
|
||||||
if (!rc.magnify) {
|
if (!magnify_on) {
|
||||||
x = -1;
|
x = -1;
|
||||||
y = -1;
|
y = -1;
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -227,10 +229,10 @@ output_wants_magnification(struct output *output)
|
||||||
|
|
||||||
void magnify_toggle (void)
|
void magnify_toggle (void)
|
||||||
{
|
{
|
||||||
if (rc.magnify) {
|
if (magnify_on) {
|
||||||
rc.magnify = false;
|
magnify_on = false;
|
||||||
} else {
|
} else {
|
||||||
rc.magnify = true;
|
magnify_on = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -241,17 +243,17 @@ void magnify_toggle (void)
|
||||||
void magnify_set_scale (enum magnify_dir dir)
|
void magnify_set_scale (enum magnify_dir dir)
|
||||||
{
|
{
|
||||||
if (dir == MAGNIFY_INCREASE) {
|
if (dir == MAGNIFY_INCREASE) {
|
||||||
if (rc.magnify) {
|
if (magnify_on) {
|
||||||
rc.mag_scale++;
|
rc.mag_scale++;
|
||||||
} else {
|
} else {
|
||||||
rc.magnify = true;
|
magnify_on = true;
|
||||||
rc.mag_scale = 2;
|
rc.mag_scale = 2;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (rc.magnify && rc.mag_scale > 2) {
|
if (magnify_on && rc.mag_scale > 2) {
|
||||||
rc.mag_scale--;
|
rc.mag_scale--;
|
||||||
} else {
|
} else {
|
||||||
rc.magnify = false;
|
magnify_on = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -273,11 +275,11 @@ lab_wlr_scene_output_commit(struct wlr_scene_output *scene_output)
|
||||||
|
|
||||||
if (!wlr_output->needs_frame && !pixman_region32_not_empty(
|
if (!wlr_output->needs_frame && !pixman_region32_not_empty(
|
||||||
&scene_output->damage_ring.current) && !wants_magnification
|
&scene_output->damage_ring.current) && !wants_magnification
|
||||||
&& last_mag != rc.magnify && last_scale != rc.mag_scale) {
|
&& last_mag != magnify_on && last_scale != rc.mag_scale) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
last_mag = rc.magnify;
|
last_mag = magnify_on;
|
||||||
last_scale = rc.mag_scale;
|
last_scale = rc.mag_scale;
|
||||||
|
|
||||||
if (!wlr_scene_output_build_state(scene_output, state, NULL)) {
|
if (!wlr_scene_output_build_state(scene_output, state, NULL)) {
|
||||||
|
|
@ -287,7 +289,7 @@ lab_wlr_scene_output_commit(struct wlr_scene_output *scene_output)
|
||||||
}
|
}
|
||||||
|
|
||||||
struct wlr_box additional_damage = {0};
|
struct wlr_box additional_damage = {0};
|
||||||
if (state->buffer && rc.magnify) {
|
if (state->buffer && magnify_on) {
|
||||||
magnify(output, state->buffer, &additional_damage);
|
magnify(output, state->buffer, &additional_damage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1239,7 +1239,6 @@ rcxml_init(void)
|
||||||
rc.workspace_config.popuptime = INT_MIN;
|
rc.workspace_config.popuptime = INT_MIN;
|
||||||
rc.workspace_config.min_nr_workspaces = 1;
|
rc.workspace_config.min_nr_workspaces = 1;
|
||||||
|
|
||||||
rc.magnify = false;
|
|
||||||
rc.mag_scale = 2;
|
rc.mag_scale = 2;
|
||||||
rc.mag_size = 400;
|
rc.mag_size = 400;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue