follow the geometry of unmanaged clients and fix formatting

This commit is contained in:
save196
2026-09-17 17:35:49 +00:00
parent b3223b15e9
commit e451862544
+22 -11
View File
@@ -153,6 +153,7 @@ typedef struct {
struct wl_listener associate;
struct wl_listener dissociate;
struct wl_listener configure;
struct wl_listener set_geometry;
struct wl_listener set_hints;
#endif
unsigned int bw;
@@ -466,6 +467,7 @@ static void associatex11(struct wl_listener *listener, void *data);
static void configurex11(struct wl_listener *listener, void *data);
static void createnotifyx11(struct wl_listener *listener, void *data);
static void dissociatex11(struct wl_listener *listener, void *data);
static void setgeometryx11(struct wl_listener *listener, void *data);
static void sethints(struct wl_listener *listener, void *data);
static void xwaylandready(struct wl_listener *listener, void *data);
static struct wl_listener new_xwayland_surface = {.notify = createnotifyx11};
@@ -549,9 +551,9 @@ arrange(Monitor *m)
wl_list_for_each(c, &clients, link) {
if (c->mon == m) {
wlr_scene_node_set_enabled(&c->scene->node, VISIBLEON(c, m));
client_set_suspended(c, !VISIBLEON(c, m) &&
(!c->image_capture_source ||
wl_list_empty(&c->image_capture_source->resources)));
client_set_suspended(c, !VISIBLEON(c, m)
&& (!c->image_capture_source
|| wl_list_empty(&c->image_capture_source->resources)));
}
}
@@ -1430,6 +1432,7 @@ destroynotify(struct wl_listener *listener, void *data)
wl_list_remove(&c->associate.link);
wl_list_remove(&c->configure.link);
wl_list_remove(&c->dissociate.link);
wl_list_remove(&c->set_geometry.link);
wl_list_remove(&c->set_hints.link);
} else
#endif
@@ -1876,7 +1879,6 @@ mapnotify(struct wl_listener *listener, void *data)
/* Unmanaged clients always are floating */
wlr_scene_node_reparent(&c->scene->node, layers[LyrUnmanaged]);
wlr_scene_node_set_position(&c->scene->node, c->geom.x, c->geom.y);
client_set_size(c, c->geom.width, c->geom.height);
if (client_wants_focus(c)) {
focusclient(c, 1);
exclusive_focus = c;
@@ -3280,13 +3282,8 @@ configurex11(struct wl_listener *listener, void *data)
{
Client *c = wl_container_of(listener, c, configure);
struct wlr_xwayland_surface_configure_event *event = data;
if (!client_surface(c) || !client_surface(c)->mapped) {
wlr_xwayland_surface_configure(c->surface.xwayland,
event->x, event->y, event->width, event->height);
return;
}
if (client_is_unmanaged(c)) {
wlr_scene_node_set_position(&c->scene->node, event->x, event->y);
if (!client_surface(c) || !client_surface(c)->mapped
|| client_is_unmanaged(c)) {
wlr_xwayland_surface_configure(c->surface.xwayland,
event->x, event->y, event->width, event->height);
return;
@@ -3319,6 +3316,7 @@ createnotifyx11(struct wl_listener *listener, void *data)
LISTEN(&xsurface->events.request_activate, &c->activate, activatex11);
LISTEN(&xsurface->events.request_configure, &c->configure, configurex11);
LISTEN(&xsurface->events.request_fullscreen, &c->fullscreen, fullscreennotify);
LISTEN(&xsurface->events.set_geometry, &c->set_geometry, setgeometryx11);
LISTEN(&xsurface->events.set_hints, &c->set_hints, sethints);
LISTEN(&xsurface->events.set_title, &c->set_title, updatetitle);
}
@@ -3331,6 +3329,19 @@ dissociatex11(struct wl_listener *listener, void *data)
wl_list_remove(&c->unmap.link);
}
void
setgeometryx11(struct wl_listener *listener, void *data)
{
Client *c = wl_container_of(listener, c, set_geometry);
if (!client_is_unmanaged(c) || !client_surface(c)
|| !client_surface(c)->mapped)
return;
client_get_geometry(c, &c->geom);
wlr_scene_node_set_position(&c->scene->node, c->geom.x, c->geom.y);
}
void
sethints(struct wl_listener *listener, void *data)
{