mirror of
https://github.com/DreamMaoMao/maomaowm.git
synced 2026-03-21 05:34:05 -04:00
feat: support frame skip for x11 app resize
This commit is contained in:
parent
0696fe964d
commit
49cb5a9d7e
2 changed files with 33 additions and 1 deletions
|
|
@ -319,9 +319,23 @@ static inline uint32_t client_set_size(Client *c, uint32_t width,
|
||||||
uint32_t height) {
|
uint32_t height) {
|
||||||
#ifdef XWAYLAND
|
#ifdef XWAYLAND
|
||||||
if (client_is_x11(c)) {
|
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,
|
wlr_xwayland_surface_configure(c->surface.xwayland, c->geom.x + c->bw,
|
||||||
c->geom.y + c->bw, width, height);
|
c->geom.y + c->bw, width, height);
|
||||||
return 0;
|
return 1;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if ((int32_t)width == c->surface.xdg->toplevel->current.width &&
|
if ((int32_t)width == c->surface.xdg->toplevel->current.width &&
|
||||||
|
|
|
||||||
18
src/mango.c
18
src/mango.c
|
|
@ -338,6 +338,7 @@ struct Client {
|
||||||
struct wl_listener configure;
|
struct wl_listener configure;
|
||||||
struct wl_listener set_hints;
|
struct wl_listener set_hints;
|
||||||
struct wl_listener set_geometry;
|
struct wl_listener set_geometry;
|
||||||
|
struct wl_listener commmitx11;
|
||||||
#endif
|
#endif
|
||||||
uint32_t bw;
|
uint32_t bw;
|
||||||
uint32_t tags, oldtags, mini_restore_tag;
|
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 configurex11(struct wl_listener *listener, void *data);
|
||||||
static void createnotifyx11(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 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 associatex11(struct wl_listener *listener, void *data);
|
||||||
static void sethints(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 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);
|
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) {
|
void associatex11(struct wl_listener *listener, void *data) {
|
||||||
Client *c = wl_container_of(listener, c, associate);
|
Client *c = wl_container_of(listener, c, associate);
|
||||||
|
|
||||||
LISTEN(&client_surface(c)->events.map, &c->map, mapnotify);
|
LISTEN(&client_surface(c)->events.map, &c->map, mapnotify);
|
||||||
LISTEN(&client_surface(c)->events.unmap, &c->unmap, unmapnotify);
|
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) {
|
void dissociatex11(struct wl_listener *listener, void *data) {
|
||||||
Client *c = wl_container_of(listener, c, dissociate);
|
Client *c = wl_container_of(listener, c, dissociate);
|
||||||
wl_list_remove(&c->map.link);
|
wl_list_remove(&c->map.link);
|
||||||
wl_list_remove(&c->unmap.link);
|
wl_list_remove(&c->unmap.link);
|
||||||
|
wl_list_remove(&c->commmitx11.link);
|
||||||
}
|
}
|
||||||
|
|
||||||
void sethints(struct wl_listener *listener, void *data) {
|
void sethints(struct wl_listener *listener, void *data) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue