mirror of
https://github.com/labwc/labwc.git
synced 2025-11-01 22:58:47 -04:00
xwayland: handle set_override_redirect events
This is needed to allow X11 applications to create surfaces as
non-override_redirect and then change them to override_redirect later
Without this gitk-menus and rofi are treated as xwayland-views with
associated server-side-decoration and forced positioning.
Backport of 81f216b6a2
This commit is contained in:
parent
9b593e4715
commit
03c6f23d6d
3 changed files with 39 additions and 4 deletions
|
|
@ -310,6 +310,7 @@ struct view {
|
||||||
struct wl_listener set_title;
|
struct wl_listener set_title;
|
||||||
struct wl_listener set_app_id; /* class on xwayland */
|
struct wl_listener set_app_id; /* class on xwayland */
|
||||||
struct wl_listener set_decorations; /* xwayland only */
|
struct wl_listener set_decorations; /* xwayland only */
|
||||||
|
struct wl_listener override_redirect; /* xwayland only */
|
||||||
struct wl_listener new_popup; /* xdg-shell only */
|
struct wl_listener new_popup; /* xdg-shell only */
|
||||||
struct wl_listener new_subsurface; /* xdg-shell only */
|
struct wl_listener new_subsurface; /* xdg-shell only */
|
||||||
};
|
};
|
||||||
|
|
@ -372,8 +373,9 @@ void xdg_surface_new(struct wl_listener *listener, void *data);
|
||||||
|
|
||||||
#if HAVE_XWAYLAND
|
#if HAVE_XWAYLAND
|
||||||
void xwayland_surface_new(struct wl_listener *listener, void *data);
|
void xwayland_surface_new(struct wl_listener *listener, void *data);
|
||||||
void xwayland_unmanaged_create(struct server *server,
|
struct xwayland_unmanaged *xwayland_unmanaged_create(struct server *server,
|
||||||
struct wlr_xwayland_surface *xsurface);
|
struct wlr_xwayland_surface *xsurface);
|
||||||
|
void unmanaged_handle_map(struct wl_listener *listener, void *data);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void view_child_init(struct view_child *child, struct view *view,
|
void view_child_init(struct view_child *child, struct view *view,
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ unmanaged_handle_commit(struct wl_listener *listener, void *data)
|
||||||
damage_all_outputs(unmanaged->server);
|
damage_all_outputs(unmanaged->server);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
void
|
||||||
unmanaged_handle_map(struct wl_listener *listener, void *data)
|
unmanaged_handle_map(struct wl_listener *listener, void *data)
|
||||||
{
|
{
|
||||||
struct xwayland_unmanaged *unmanaged =
|
struct xwayland_unmanaged *unmanaged =
|
||||||
|
|
@ -91,7 +91,7 @@ unmanaged_handle_destroy(struct wl_listener *listener, void *data)
|
||||||
free(unmanaged);
|
free(unmanaged);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
struct xwayland_unmanaged *
|
||||||
xwayland_unmanaged_create(struct server *server,
|
xwayland_unmanaged_create(struct server *server,
|
||||||
struct wlr_xwayland_surface *xsurface)
|
struct wlr_xwayland_surface *xsurface)
|
||||||
{
|
{
|
||||||
|
|
@ -109,4 +109,5 @@ xwayland_unmanaged_create(struct server *server,
|
||||||
unmanaged->unmap.notify = unmanaged_handle_unmap;
|
unmanaged->unmap.notify = unmanaged_handle_unmap;
|
||||||
wl_signal_add(&xsurface->events.destroy, &unmanaged->destroy);
|
wl_signal_add(&xsurface->events.destroy, &unmanaged->destroy);
|
||||||
unmanaged->destroy.notify = unmanaged_handle_destroy;
|
unmanaged->destroy.notify = unmanaged_handle_destroy;
|
||||||
|
return unmanaged;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -96,10 +96,19 @@ handle_destroy(struct wl_listener *listener, void *data)
|
||||||
wl_list_remove(&view->link);
|
wl_list_remove(&view->link);
|
||||||
wl_list_remove(&view->map.link);
|
wl_list_remove(&view->map.link);
|
||||||
wl_list_remove(&view->unmap.link);
|
wl_list_remove(&view->unmap.link);
|
||||||
wl_list_remove(&view->destroy.link);
|
wl_list_remove(&view->request_move.link);
|
||||||
|
wl_list_remove(&view->request_resize.link);
|
||||||
wl_list_remove(&view->request_configure.link);
|
wl_list_remove(&view->request_configure.link);
|
||||||
|
wl_list_remove(&view->request_activate.link);
|
||||||
|
wl_list_remove(&view->request_minimize.link);
|
||||||
wl_list_remove(&view->request_maximize.link);
|
wl_list_remove(&view->request_maximize.link);
|
||||||
wl_list_remove(&view->request_fullscreen.link);
|
wl_list_remove(&view->request_fullscreen.link);
|
||||||
|
wl_list_remove(&view->set_title.link);
|
||||||
|
wl_list_remove(&view->set_app_id.link);
|
||||||
|
wl_list_remove(&view->set_decorations.link);
|
||||||
|
wl_list_remove(&view->override_redirect.link);
|
||||||
|
wl_list_remove(&view->destroy.link);
|
||||||
|
|
||||||
ssd_destroy(view);
|
ssd_destroy(view);
|
||||||
free(view);
|
free(view);
|
||||||
}
|
}
|
||||||
|
|
@ -243,6 +252,25 @@ handle_set_decorations(struct wl_listener *listener, void *data)
|
||||||
view_set_decorations(view, want_deco(view));
|
view_set_decorations(view, want_deco(view));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
handle_override_redirect(struct wl_listener *listener, void *data)
|
||||||
|
{
|
||||||
|
struct view *view = wl_container_of(listener, view, override_redirect);
|
||||||
|
struct wlr_xwayland_surface *xsurface = data;
|
||||||
|
struct server *server = view->server;
|
||||||
|
bool mapped = xsurface->mapped;
|
||||||
|
if (mapped) {
|
||||||
|
handle_unmap(&view->unmap, NULL);
|
||||||
|
}
|
||||||
|
handle_destroy(&view->destroy, view);
|
||||||
|
xsurface->data = NULL;
|
||||||
|
struct xwayland_unmanaged *unmanaged =
|
||||||
|
xwayland_unmanaged_create(server, xsurface);
|
||||||
|
if (mapped) {
|
||||||
|
unmanaged_handle_map(&unmanaged->map, xsurface);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
top_left_edge_boundary_check(struct view *view)
|
top_left_edge_boundary_check(struct view *view)
|
||||||
{
|
{
|
||||||
|
|
@ -415,5 +443,9 @@ xwayland_surface_new(struct wl_listener *listener, void *data)
|
||||||
wl_signal_add(&xsurface->events.set_decorations,
|
wl_signal_add(&xsurface->events.set_decorations,
|
||||||
&view->set_decorations);
|
&view->set_decorations);
|
||||||
|
|
||||||
|
view->override_redirect.notify = handle_override_redirect;
|
||||||
|
wl_signal_add(&xsurface->events.set_override_redirect,
|
||||||
|
&view->override_redirect);
|
||||||
|
|
||||||
wl_list_insert(&view->server->views, &view->link);
|
wl_list_insert(&view->server->views, &view->link);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue