mirror of
https://github.com/labwc/labwc.git
synced 2025-10-29 05:40:24 -04:00
action: add "Close" to close top-most view
This commit is contained in:
parent
9fa783e7b4
commit
eaed1a3cab
4 changed files with 9 additions and 2 deletions
|
|
@ -8,6 +8,9 @@ labwc - actions
|
|||
|
||||
Actions are used in keyboard bindings.
|
||||
|
||||
*<action name="Close"><command>*
|
||||
Close top-most view.
|
||||
|
||||
*<action name="Execute"><command>*
|
||||
Execute command.
|
||||
|
||||
|
|
|
|||
|
|
@ -308,6 +308,7 @@ void desktop_focus_view(struct seat *seat, struct view *view);
|
|||
* Note: If !current, the server->views second focusable view is returned
|
||||
*/
|
||||
struct view *desktop_cycle_view(struct server *server, struct view *current);
|
||||
struct view *topmost_mapped_view(struct server *server);
|
||||
void desktop_focus_topmost_mapped_view(struct server *server);
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -23,7 +23,10 @@ action(struct server *server, const char *action, const char *command)
|
|||
{
|
||||
if (!action)
|
||||
return;
|
||||
if (!strcasecmp(action, "Debug")) {
|
||||
if (!strcasecmp(action, "Close")) {
|
||||
struct view *view = topmost_mapped_view(server);
|
||||
view->impl->close(view);
|
||||
} else if (!strcasecmp(action, "Debug")) {
|
||||
/* nothing */
|
||||
} else if (!strcasecmp(action, "Execute")) {
|
||||
struct buf cmd;
|
||||
|
|
|
|||
|
|
@ -189,7 +189,7 @@ has_mapped_view(struct wl_list *wl_list)
|
|||
return false;
|
||||
}
|
||||
|
||||
static struct view *
|
||||
struct view *
|
||||
topmost_mapped_view(struct server *server)
|
||||
{
|
||||
if (!has_mapped_view(&server->views)) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue