action: Allow explicit None action without warning

This commit is contained in:
John Lindgren 2022-09-06 13:22:43 -04:00 committed by Johan Malm
parent e30fce6c34
commit b89f7bfc0d
2 changed files with 10 additions and 3 deletions

View file

@ -75,6 +75,9 @@ Actions are used in menus and keyboard/mouse bindings.
Send active window to workspace.
Supported values are the same as for GoToDesktop.
*<action name="None">*
If used as the only action for a binding: clear an earlier defined binding.
# SEE ALSO
labwc(1), labwc-config(5), labwc-theme(5)

View file

@ -16,7 +16,8 @@
#include "workspaces.h"
enum action_type {
ACTION_TYPE_NONE = 0,
ACTION_TYPE_INVALID = 0,
ACTION_TYPE_NONE,
ACTION_TYPE_CLOSE,
ACTION_TYPE_DEBUG,
ACTION_TYPE_EXECUTE,
@ -41,7 +42,8 @@ enum action_type {
};
const char *action_names[] = {
"NoOp",
"INVALID",
"None",
"Close",
"Debug",
"Execute",
@ -93,7 +95,7 @@ action_type_from_str(const char *action_name)
}
}
wlr_log(WLR_ERROR, "Invalid action: %s", action_name);
return ACTION_TYPE_NONE;
return ACTION_TYPE_INVALID;
}
struct action *
@ -349,6 +351,8 @@ actions_run(struct view *activator, struct server *server,
}
break;
case ACTION_TYPE_NONE:
break;
case ACTION_TYPE_INVALID:
wlr_log(WLR_ERROR, "Not executing unknown action");
break;
default: