mirror of
https://github.com/labwc/labwc.git
synced 2025-11-02 09:01:47 -05:00
Implement foreign toplevel close
This commit is contained in:
parent
7e57b7fcf5
commit
80f012602f
4 changed files with 26 additions and 2 deletions
|
|
@ -268,6 +268,7 @@ struct view {
|
||||||
struct wl_listener toplevel_handle_request_minimize;
|
struct wl_listener toplevel_handle_request_minimize;
|
||||||
struct wl_listener toplevel_handle_request_fullscreen;
|
struct wl_listener toplevel_handle_request_fullscreen;
|
||||||
struct wl_listener toplevel_handle_request_activate;
|
struct wl_listener toplevel_handle_request_activate;
|
||||||
|
struct wl_listener toplevel_handle_request_close;
|
||||||
|
|
||||||
struct wl_listener map;
|
struct wl_listener map;
|
||||||
struct wl_listener unmap;
|
struct wl_listener unmap;
|
||||||
|
|
@ -353,6 +354,7 @@ void view_child_finish(struct view_child *child);
|
||||||
void view_subsurface_create(struct view *view, struct wlr_subsurface *wlr_subsurface);
|
void view_subsurface_create(struct view *view, struct wlr_subsurface *wlr_subsurface);
|
||||||
|
|
||||||
void view_set_activated(struct view *view, bool activated);
|
void view_set_activated(struct view *view, bool activated);
|
||||||
|
void view_close(struct view *view);
|
||||||
struct border view_border(struct view *view);
|
struct border view_border(struct view *view);
|
||||||
void view_move_resize(struct view *view, struct wlr_box geo);
|
void view_move_resize(struct view *view, struct wlr_box geo);
|
||||||
void view_move(struct view *view, double x, double y);
|
void view_move(struct view *view, double x, double y);
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ action(struct view *activator, struct server *server, const char *action, const
|
||||||
if (!strcasecmp(action, "Close")) {
|
if (!strcasecmp(action, "Close")) {
|
||||||
struct view *view = activator_or_focused_view(activator, server);
|
struct view *view = activator_or_focused_view(activator, server);
|
||||||
if (view) {
|
if (view) {
|
||||||
view->impl->close(view);
|
view_close(view);
|
||||||
}
|
}
|
||||||
} else if (!strcasecmp(action, "Debug")) {
|
} else if (!strcasecmp(action, "Debug")) {
|
||||||
/* nothing */
|
/* nothing */
|
||||||
|
|
|
||||||
|
|
@ -39,6 +39,14 @@ handle_toplevel_handle_request_activate(struct wl_listener *listener, void *data
|
||||||
desktop_move_to_front(view);
|
desktop_move_to_front(view);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
handle_toplevel_handle_request_close(struct wl_listener *listener, void *data)
|
||||||
|
{
|
||||||
|
struct view *view = wl_container_of(listener, view,
|
||||||
|
toplevel_handle_request_close);
|
||||||
|
view_close(view);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
foreign_toplevel_handle_create(struct view *view)
|
foreign_toplevel_handle_create(struct view *view)
|
||||||
{
|
{
|
||||||
|
|
@ -78,5 +86,11 @@ foreign_toplevel_handle_create(struct view *view)
|
||||||
handle_toplevel_handle_request_activate;
|
handle_toplevel_handle_request_activate;
|
||||||
wl_signal_add(&view->toplevel_handle->events.request_activate,
|
wl_signal_add(&view->toplevel_handle->events.request_activate,
|
||||||
&view->toplevel_handle_request_activate);
|
&view->toplevel_handle_request_activate);
|
||||||
/* TODO: hook up remaining signals (close, destroy) */
|
|
||||||
|
view->toplevel_handle_request_close.notify =
|
||||||
|
handle_toplevel_handle_request_close;
|
||||||
|
wl_signal_add(&view->toplevel_handle->events.request_close,
|
||||||
|
&view->toplevel_handle_request_close);
|
||||||
|
|
||||||
|
/* TODO: hook up remaining signals (destroy) */
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,14 @@ view_set_activated(struct view *view, bool activated)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
view_close(struct view *view)
|
||||||
|
{
|
||||||
|
if (view->impl->close) {
|
||||||
|
view->impl->close(view);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
view_move_resize(struct view *view, struct wlr_box geo)
|
view_move_resize(struct view *view, struct wlr_box geo)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue