mirror of
https://github.com/labwc/labwc.git
synced 2026-03-26 07:58:08 -04:00
action: add "ToggleMaximize"
This commit is contained in:
parent
69f0f68cc2
commit
c668fd9b07
2 changed files with 16 additions and 1 deletions
|
|
@ -26,6 +26,9 @@ Actions are used in keyboard bindings.
|
||||||
*<action name="ShowMenu"><menu>*
|
*<action name="ShowMenu"><menu>*
|
||||||
Show menu. Valid menu name is "root-menu".
|
Show menu. Valid menu name is "root-menu".
|
||||||
|
|
||||||
|
*<action name="ToggleMaximize"><menu>*
|
||||||
|
Toggle maximize state of top-most window.
|
||||||
|
|
||||||
# SEE ALSO
|
# SEE ALSO
|
||||||
|
|
||||||
labwc(1), labwc-config(5), labwc-theme(5)
|
labwc(1), labwc-config(5), labwc-theme(5)
|
||||||
|
|
|
||||||
14
src/action.c
14
src/action.c
|
|
@ -25,7 +25,9 @@ action(struct server *server, const char *action, const char *command)
|
||||||
return;
|
return;
|
||||||
if (!strcasecmp(action, "Close")) {
|
if (!strcasecmp(action, "Close")) {
|
||||||
struct view *view = topmost_mapped_view(server);
|
struct view *view = topmost_mapped_view(server);
|
||||||
view->impl->close(view);
|
if (view) {
|
||||||
|
view->impl->close(view);
|
||||||
|
}
|
||||||
} else if (!strcasecmp(action, "Debug")) {
|
} else if (!strcasecmp(action, "Debug")) {
|
||||||
/* nothing */
|
/* nothing */
|
||||||
} else if (!strcasecmp(action, "Execute")) {
|
} else if (!strcasecmp(action, "Execute")) {
|
||||||
|
|
@ -44,6 +46,16 @@ action(struct server *server, const char *action, const char *command)
|
||||||
spawn_async_no_shell("killall -SIGHUP labwc");
|
spawn_async_no_shell("killall -SIGHUP labwc");
|
||||||
} else if (!strcasecmp(action, "ShowMenu")) {
|
} else if (!strcasecmp(action, "ShowMenu")) {
|
||||||
show_menu(server, command);
|
show_menu(server, command);
|
||||||
|
} else if (!strcasecmp(action, "ToggleMaximize")) {
|
||||||
|
struct view *view = topmost_mapped_view(server);
|
||||||
|
if (!view) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (view->maximized) {
|
||||||
|
view_maximize(view, false);
|
||||||
|
} else {
|
||||||
|
view_maximize(view, true);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
warn("action (%s) not supported", action);
|
warn("action (%s) not supported", action);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue