mirror of
https://github.com/labwc/labwc.git
synced 2025-11-04 13:30:07 -05:00
action: refactor action()
This commit is contained in:
parent
d15e48269d
commit
745915c0ba
3 changed files with 10 additions and 10 deletions
|
|
@ -240,7 +240,7 @@ struct wlr_box deco_max_extents(struct view *view);
|
||||||
struct wlr_box deco_box(struct view *view, enum deco_part deco_part);
|
struct wlr_box deco_box(struct view *view, enum deco_part deco_part);
|
||||||
enum deco_part deco_at(struct view *view, double lx, double ly);
|
enum deco_part deco_at(struct view *view, double lx, double ly);
|
||||||
|
|
||||||
void action(struct server *server, struct keybind *keybind);
|
void action(struct server *server, const char *action, const char *command);
|
||||||
|
|
||||||
void dbg_show_one_view(struct view *view);
|
void dbg_show_one_view(struct view *view);
|
||||||
void dbg_show_views(struct server *server);
|
void dbg_show_views(struct server *server);
|
||||||
|
|
|
||||||
16
src/action.c
16
src/action.c
|
|
@ -4,20 +4,20 @@
|
||||||
|
|
||||||
#include <strings.h>
|
#include <strings.h>
|
||||||
|
|
||||||
void action(struct server *server, struct keybind *keybind)
|
void action(struct server *server, const char *action, const char *command)
|
||||||
{
|
{
|
||||||
if (!keybind || !keybind->action)
|
if (!action)
|
||||||
return;
|
return;
|
||||||
if (!strcasecmp(keybind->action, "Exit")) {
|
if (!strcasecmp(action, "Exit")) {
|
||||||
wl_display_terminate(server->wl_display);
|
wl_display_terminate(server->wl_display);
|
||||||
} else if (!strcasecmp(keybind->action, "NextWindow")) {
|
} else if (!strcasecmp(action, "NextWindow")) {
|
||||||
server->cycle_view =
|
server->cycle_view =
|
||||||
desktop_next_view(server, server->cycle_view);
|
desktop_next_view(server, server->cycle_view);
|
||||||
} else if (!strcasecmp(keybind->action, "Execute")) {
|
} else if (!strcasecmp(action, "Execute")) {
|
||||||
spawn_async_no_shell(keybind->command);
|
spawn_async_no_shell(command);
|
||||||
} else if (!strcasecmp(keybind->action, "debug-views")) {
|
} else if (!strcasecmp(action, "debug-views")) {
|
||||||
dbg_show_views(server);
|
dbg_show_views(server);
|
||||||
} else {
|
} else {
|
||||||
warn("action (%s) not supported", keybind->action);
|
warn("action (%s) not supported", action);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ static bool handle_keybinding(struct server *server, uint32_t modifiers,
|
||||||
continue;
|
continue;
|
||||||
for (size_t i = 0; i < keybind->keysyms_len; i++) {
|
for (size_t i = 0; i < keybind->keysyms_len; i++) {
|
||||||
if (sym == keybind->keysyms[i]) {
|
if (sym == keybind->keysyms[i]) {
|
||||||
action(server, keybind);
|
action(server, keybind->action, keybind->command);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue