Merge 992a8321436dd17a0ea62bf235cd4341f275b01b into 2751a6195d5b659c8538b2b16fa157e7b920c8c3

This commit is contained in:
Leonardo Hernández 2023-11-20 21:15:40 -07:00 committed by GitHub
commit 9683958a61
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

22
dwl.c
View File

@ -123,6 +123,7 @@ typedef struct {
struct wl_listener associate; struct wl_listener associate;
struct wl_listener dissociate; struct wl_listener dissociate;
struct wl_listener configure; struct wl_listener configure;
struct wl_listener override_redirect;
struct wl_listener set_hints; struct wl_listener set_hints;
#endif #endif
unsigned int bw; unsigned int bw;
@ -384,6 +385,7 @@ static void createnotifyx11(struct wl_listener *listener, void *data);
static void dissociatex11(struct wl_listener *listener, void *data); static void dissociatex11(struct wl_listener *listener, void *data);
static xcb_atom_t getatom(xcb_connection_t *xc, const char *name); static xcb_atom_t getatom(xcb_connection_t *xc, const char *name);
static void sethints(struct wl_listener *listener, void *data); 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 void xwaylandready(struct wl_listener *listener, void *data);
static struct wlr_xwayland *xwayland; static struct wlr_xwayland *xwayland;
static xcb_atom_t netatom[NetLast]; static xcb_atom_t netatom[NetLast];
@ -1124,6 +1126,7 @@ destroynotify(struct wl_listener *listener, void *data)
wl_list_remove(&c->configure.link); wl_list_remove(&c->configure.link);
wl_list_remove(&c->dissociate.link); wl_list_remove(&c->dissociate.link);
wl_list_remove(&c->set_hints.link); wl_list_remove(&c->set_hints.link);
wl_list_remove(&c->override_redirect.link);
} else } else
#endif #endif
{ {
@ -2789,6 +2792,8 @@ createnotifyx11(struct wl_listener *listener, void *data)
/* Listen to the various events it can emit */ /* Listen to the various events it can emit */
LISTEN(&xsurface->events.associate, &c->associate, associatex11); 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.dissociate, &c->dissociate, dissociatex11);
LISTEN(&xsurface->events.request_activate, &c->activate, activatex11); LISTEN(&xsurface->events.request_activate, &c->activate, activatex11);
LISTEN(&xsurface->events.request_configure, &c->configure, configurex11); LISTEN(&xsurface->events.request_configure, &c->configure, configurex11);
@ -2836,6 +2841,23 @@ sethints(struct wl_listener *listener, void *data)
printstatus(); printstatus();
} }
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 void
xwaylandready(struct wl_listener *listener, void *data) xwaylandready(struct wl_listener *listener, void *data)
{ {