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. Send active window to workspace.
Supported values are the same as for GoToDesktop. 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 # SEE ALSO
labwc(1), labwc-config(5), labwc-theme(5) labwc(1), labwc-config(5), labwc-theme(5)

View file

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