mirror of
https://github.com/labwc/labwc.git
synced 2025-10-29 05:40:24 -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>*
|
||||
Show menu. Valid menu name is "root-menu".
|
||||
|
||||
*<action name="ToggleMaximize"><menu>*
|
||||
Toggle maximize state of top-most window.
|
||||
|
||||
# SEE ALSO
|
||||
|
||||
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;
|
||||
if (!strcasecmp(action, "Close")) {
|
||||
struct view *view = topmost_mapped_view(server);
|
||||
view->impl->close(view);
|
||||
if (view) {
|
||||
view->impl->close(view);
|
||||
}
|
||||
} else if (!strcasecmp(action, "Debug")) {
|
||||
/* nothing */
|
||||
} 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");
|
||||
} else if (!strcasecmp(action, "ShowMenu")) {
|
||||
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 {
|
||||
warn("action (%s) not supported", action);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue