mirror of
https://github.com/labwc/labwc.git
synced 2026-03-03 01:40:37 -05:00
view: add client_request flag to view->impl->unmap()
This makes explicit the subtle behavioral difference between xwayland_view_unmap() and handle_unmap(). With this change, the XDG and XWayland versions of handle_map/unmap() are now identical, which will make further refactoring possible.
This commit is contained in:
parent
b200dd2e7b
commit
370cdc80e0
4 changed files with 22 additions and 18 deletions
|
|
@ -34,7 +34,13 @@ struct view_impl {
|
||||||
void (*map)(struct view *view);
|
void (*map)(struct view *view);
|
||||||
void (*set_activated)(struct view *view, bool activated);
|
void (*set_activated)(struct view *view, bool activated);
|
||||||
void (*set_fullscreen)(struct view *view, bool fullscreen);
|
void (*set_fullscreen)(struct view *view, bool fullscreen);
|
||||||
void (*unmap)(struct view *view);
|
/*
|
||||||
|
* client_request is true if the client unmapped its own
|
||||||
|
* surface; false if we are just minimizing the view. The two
|
||||||
|
* cases are similar but have subtle differences (e.g., when
|
||||||
|
* minimizing we don't destroy the foreign toplevel handle).
|
||||||
|
*/
|
||||||
|
void (*unmap)(struct view *view, bool client_request);
|
||||||
void (*maximize)(struct view *view, bool maximize);
|
void (*maximize)(struct view *view, bool maximize);
|
||||||
void (*minimize)(struct view *view, bool minimize);
|
void (*minimize)(struct view *view, bool minimize);
|
||||||
void (*move_to_front)(struct view *view);
|
void (*move_to_front)(struct view *view);
|
||||||
|
|
|
||||||
|
|
@ -246,7 +246,7 @@ view_minimize(struct view *view, bool minimized)
|
||||||
}
|
}
|
||||||
view->minimized = minimized;
|
view->minimized = minimized;
|
||||||
if (minimized) {
|
if (minimized) {
|
||||||
view->impl->unmap(view);
|
view->impl->unmap(view, /* client_request */ false);
|
||||||
_view_set_activated(view, false);
|
_view_set_activated(view, false);
|
||||||
if (view == view->server->focused_view) {
|
if (view == view->server->focused_view) {
|
||||||
/*
|
/*
|
||||||
|
|
|
||||||
|
|
@ -151,7 +151,7 @@ static void
|
||||||
handle_unmap(struct wl_listener *listener, void *data)
|
handle_unmap(struct wl_listener *listener, void *data)
|
||||||
{
|
{
|
||||||
struct view *view = wl_container_of(listener, view, unmap);
|
struct view *view = wl_container_of(listener, view, unmap);
|
||||||
view->impl->unmap(view);
|
view->impl->unmap(view, /* client_request */ true);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
@ -452,7 +452,7 @@ xdg_toplevel_view_map(struct view *view)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
xdg_toplevel_view_unmap(struct view *view)
|
xdg_toplevel_view_unmap(struct view *view, bool client_request)
|
||||||
{
|
{
|
||||||
if (view->mapped) {
|
if (view->mapped) {
|
||||||
view->mapped = false;
|
view->mapped = false;
|
||||||
|
|
|
||||||
|
|
@ -183,19 +183,7 @@ static void
|
||||||
handle_unmap(struct wl_listener *listener, void *data)
|
handle_unmap(struct wl_listener *listener, void *data)
|
||||||
{
|
{
|
||||||
struct view *view = wl_container_of(listener, view, unmap);
|
struct view *view = wl_container_of(listener, view, unmap);
|
||||||
view->impl->unmap(view);
|
view->impl->unmap(view, /* client_request */ true);
|
||||||
|
|
||||||
/*
|
|
||||||
* Some xwayland clients leave unmapped child views around, typically
|
|
||||||
* when a dialog window is closed. Although handle_destroy() is not
|
|
||||||
* called for these, we have to deal with them as such in terms of the
|
|
||||||
* foreign-toplevel protocol to avoid panels and the like still showing
|
|
||||||
* them.
|
|
||||||
*/
|
|
||||||
if (view->toplevel.handle) {
|
|
||||||
wlr_foreign_toplevel_handle_v1_destroy(view->toplevel.handle);
|
|
||||||
view->toplevel.handle = NULL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
@ -492,7 +480,7 @@ xwayland_view_map(struct view *view)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
xwayland_view_unmap(struct view *view)
|
xwayland_view_unmap(struct view *view, bool client_request)
|
||||||
{
|
{
|
||||||
if (!view->mapped) {
|
if (!view->mapped) {
|
||||||
return;
|
return;
|
||||||
|
|
@ -501,6 +489,16 @@ xwayland_view_unmap(struct view *view)
|
||||||
wl_list_remove(&view->commit.link);
|
wl_list_remove(&view->commit.link);
|
||||||
wlr_scene_node_set_enabled(&view->scene_tree->node, false);
|
wlr_scene_node_set_enabled(&view->scene_tree->node, false);
|
||||||
desktop_focus_topmost_mapped_view(view->server);
|
desktop_focus_topmost_mapped_view(view->server);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If the view was explicitly unmapped by the client (rather
|
||||||
|
* than just minimized), destroy the foreign toplevel handle so
|
||||||
|
* the unmapped view doesn't show up in panels and the like.
|
||||||
|
*/
|
||||||
|
if (client_request && view->toplevel.handle) {
|
||||||
|
wlr_foreign_toplevel_handle_v1_destroy(view->toplevel.handle);
|
||||||
|
view->toplevel.handle = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue