feat: support frame skip for x11 app resize

This commit is contained in:
DreamMaoMao 2026-02-15 12:29:12 +08:00
parent 0696fe964d
commit 49cb5a9d7e
2 changed files with 33 additions and 1 deletions

View file

@ -319,9 +319,23 @@ static inline uint32_t client_set_size(Client *c, uint32_t width,
uint32_t height) {
#ifdef XWAYLAND
if (client_is_x11(c)) {
struct wlr_surface_state *state =
&c->surface.xwayland->surface->current;
struct wlr_box new_geo = {0};
new_geo.width = state->width;
new_geo.height = state->height;
if (c->geom.width - 2 * c->bw == new_geo.width &&
c->geom.height - 2 * c->bw == new_geo.height &&
c->surface.xwayland->x == c->geom.x + c->bw &&
c->surface.xwayland->y == c->geom.y + c->bw) {
c->configure_serial = 0;
return 0;
}
wlr_xwayland_surface_configure(c->surface.xwayland, c->geom.x + c->bw,
c->geom.y + c->bw, width, height);
return 0;
return 1;
}
#endif
if ((int32_t)width == c->surface.xdg->toplevel->current.width &&

View file

@ -338,6 +338,7 @@ struct Client {
struct wl_listener configure;
struct wl_listener set_hints;
struct wl_listener set_geometry;
struct wl_listener commmitx11;
#endif
uint32_t bw;
uint32_t tags, oldtags, mini_restore_tag;
@ -956,6 +957,7 @@ static void activatex11(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 commitx11(struct wl_listener *listener, void *data);
static void associatex11(struct wl_listener *listener, void *data);
static void sethints(struct wl_listener *listener, void *data);
static void xwaylandready(struct wl_listener *listener, void *data);
@ -6280,17 +6282,33 @@ void createnotifyx11(struct wl_listener *listener, void *data) {
LISTEN(&xsurface->events.request_minimize, &c->minimize, minimizenotify);
}
void commitx11(struct wl_listener *listener, void *data) {
Client *c = wl_container_of(listener, c, commmitx11);
struct wlr_surface_state *state = &c->surface.xwayland->surface->current;
struct wlr_box new_geo = {0};
new_geo.width = state->width;
new_geo.height = state->height;
if (c->geom.width - 2 * c->bw == new_geo.width &&
c->geom.height - 2 * c->bw == new_geo.height &&
c->surface.xwayland->x == c->geom.x + c->bw &&
c->surface.xwayland->y == c->geom.y + c->bw) {
c->configure_serial = 0;
}
}
void associatex11(struct wl_listener *listener, void *data) {
Client *c = wl_container_of(listener, c, associate);
LISTEN(&client_surface(c)->events.map, &c->map, mapnotify);
LISTEN(&client_surface(c)->events.unmap, &c->unmap, unmapnotify);
LISTEN(&client_surface(c)->events.commit, &c->commmitx11, commitx11);
}
void dissociatex11(struct wl_listener *listener, void *data) {
Client *c = wl_container_of(listener, c, dissociate);
wl_list_remove(&c->map.link);
wl_list_remove(&c->unmap.link);
wl_list_remove(&c->commmitx11.link);
}
void sethints(struct wl_listener *listener, void *data) {