First attempt at integration with nmouse and keyboard bindings

This commit is contained in:
Simon Long 2024-05-01 13:39:40 +01:00
parent 4b6efb7307
commit dfd9aa4aba
6 changed files with 294 additions and 1 deletions

View file

@ -13,6 +13,7 @@
#include "common/parse-bool.h"
#include "common/spawn.h"
#include "common/string-helpers.h"
#include "common/scene-helpers.h"
#include "debug.h"
#include "labwc.h"
#include "menu/menu.h"
@ -110,6 +111,8 @@ enum action_type {
ACTION_TYPE_SHADE,
ACTION_TYPE_UNSHADE,
ACTION_TYPE_TOGGLE_SHADE,
ACTION_TYPE_TOGGLE_MAGNIFY,
ACTION_TYPE_SET_MAGNIFICATION
};
const char *action_names[] = {
@ -163,6 +166,8 @@ const char *action_names[] = {
"Shade",
"Unshade",
"ToggleShade",
"ToggleMagnify",
"SetMagnification",
NULL
};
@ -415,6 +420,12 @@ 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'",
@ -1046,6 +1057,17 @@ actions_run(struct view *activator, struct server *server,
view_set_shade(view, false);
}
break;
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);
}
break;
case ACTION_TYPE_INVALID:
wlr_log(WLR_ERROR, "Not executing unknown action");
break;