Skip to content
This repository was archived by the owner on Jan 26, 2024. It is now read-only.

WIP: allow xwayland clients to change the override_redirect flag #445

Draft
wants to merge 1 commit into
base: wlroots-next
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions dwl.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ typedef struct {
struct wl_listener associate;
struct wl_listener dissociate;
struct wl_listener configure;
struct wl_listener override_redirect;
struct wl_listener set_hints;
#endif
unsigned int bw;
Expand Down Expand Up @@ -384,6 +385,7 @@ static void createnotifyx11(struct wl_listener *listener, void *data);
static void dissociatex11(struct wl_listener *listener, void *data);
static Atom getatom(xcb_connection_t *xc, const char *name);
static void sethints(struct wl_listener *listener, void *data);
static void setoverrideredirect(struct wl_listener *listener, void *data);
static void xwaylandready(struct wl_listener *listener, void *data);
static struct wlr_xwayland *xwayland;
static Atom netatom[NetLast];
Expand Down Expand Up @@ -1147,6 +1149,7 @@ destroynotify(struct wl_listener *listener, void *data)
wl_list_remove(&c->configure.link);
wl_list_remove(&c->dissociate.link);
wl_list_remove(&c->set_hints.link);
wl_list_remove(&c->override_redirect.link);
} else
#endif
{
Expand Down Expand Up @@ -2771,6 +2774,8 @@ createnotifyx11(struct wl_listener *listener, void *data)

/* Listen to the various events it can emit */
LISTEN(&xsurface->events.associate, &c->associate, associatex11);
LISTEN(&xsurface->events.set_override_redirect, &c->override_redirect,
setoverrideredirect);
LISTEN(&xsurface->events.dissociate, &c->dissociate, dissociatex11);
LISTEN(&xsurface->events.request_activate, &c->activate, activatex11);
LISTEN(&xsurface->events.request_configure, &c->configure, configurex11);
Expand Down Expand Up @@ -2812,6 +2817,23 @@ sethints(struct wl_listener *listener, void *data)
}
}

void
setoverrideredirect(struct wl_listener *listener, void *data)
{
Client *c = wl_container_of(listener, c, override_redirect);
int type = c->surface.xwayland->override_redirect ? X11Unmanaged : X11Managed;
if (!client_surface(c) || !client_surface(c)->mapped) {
c->type = type;
return;
}
/* We already check that this client is mapped */
if (type != c->type) {
wl_signal_emit_mutable(&client_surface(c)->events.unmap, NULL);
c->type = type;
wl_signal_emit_mutable(&client_surface(c)->events.map, NULL);
}
}

void
xwaylandready(struct wl_listener *listener, void *data)
{
Expand Down