Use separate ZoomIn and ZoomOut commands

This commit is contained in:
Simon Long 2024-05-03 14:08:32 +01:00
parent ee412811ce
commit 89bd1b77de
2 changed files with 10 additions and 19 deletions

View file

@ -931,8 +931,7 @@ situation.
*<magnifier><initScale>*
The number of times by which the magnified image is scaled. This
is the default value at boot time; this can be modified at run-time
in a keyboard or mouse binding by calling 'SetMagnification scale up'
or 'SetMagnification scale down'.
in a keyboard or mouse binding by calling 'ZoomIn' or 'ZoomOut'.
*<magnifier><borderColour>* [#RRGGBB]
The colour of the magnfier border as an RGB value.

View file

@ -112,7 +112,8 @@ enum action_type {
ACTION_TYPE_UNSHADE,
ACTION_TYPE_TOGGLE_SHADE,
ACTION_TYPE_TOGGLE_MAGNIFY,
ACTION_TYPE_SET_MAGNIFICATION
ACTION_TYPE_ZOOM_IN,
ACTION_TYPE_ZOOM_OUT
};
const char *action_names[] = {
@ -167,7 +168,8 @@ const char *action_names[] = {
"Unshade",
"ToggleShade",
"ToggleMagnify",
"SetMagnification",
"ZoomIn",
"ZoomOut"
NULL
};
@ -420,12 +422,6 @@ action_arg_from_xml_node(struct action *action, const char *nodename, const char
goto cleanup;
}
break;
case ACTION_TYPE_SET_MAGNIFICATION:
if (!strcmp(argument, "scale")) {
action_arg_add_str(action, argument, content);
goto cleanup;
}
break;
}
wlr_log(WLR_ERROR, "Invalid argument for action %s: '%s'",
@ -1060,15 +1056,11 @@ actions_run(struct view *activator, struct server *server,
case ACTION_TYPE_TOGGLE_MAGNIFY:
magnify_toggle();
break;
case ACTION_TYPE_SET_MAGNIFICATION:
{
const char *dir = action_get_str(action, "scale", NULL);
if (!strcmp(dir, "up")) {
magnify_set_scale(MAGNIFY_INCREASE);
} else if (!strcmp(dir, "down")) {
magnify_set_scale(MAGNIFY_DECREASE);
}
}
case ACTION_TYPE_ZOOM_IN:
magnify_set_scale(MAGNIFY_INCREASE);
break;
case ACTION_TYPE_ZOOM_OUT:
magnify_set_scale(MAGNIFY_DECREASE);
break;
case ACTION_TYPE_INVALID:
wlr_log(WLR_ERROR, "Not executing unknown action");