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

Commit

Permalink
allow xwayland clients to change the override_redirect flag
Browse files Browse the repository at this point in the history
Closes: #432
  • Loading branch information
sevz17 committed Jun 28, 2023
1 parent 733114f commit a5ca475
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions dwl.c
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,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 @@ -404,6 +405,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 sigchld(int unused);
static void xwaylandready(struct wl_listener *listener, void *data);
static struct wl_listener new_xwayland_surface = {.notify = createnotifyx11};
Expand Down Expand Up @@ -1167,6 +1169,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 @@ -2787,6 +2790,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 @@ -2828,6 +2833,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
sigchld(int unused)
{
Expand Down

0 comments on commit a5ca475

Please sign in to comment.