diff --git a/src/maomao.c b/src/maomao.c index 5e4b15d..f51e926 100644 --- a/src/maomao.c +++ b/src/maomao.c @@ -1,6 +1,7 @@ /* * See LICENSE file for copyright and license details. */ +#include "wlr/util/box.h" #include #include #include @@ -233,6 +234,7 @@ struct Client { struct wl_listener dissociate; struct wl_listener configure; struct wl_listener set_hints; + struct wl_listener set_geometry; #endif unsigned int bw; unsigned int tags, oldtags, mini_restore_tag; @@ -795,10 +797,9 @@ static void dissociatex11(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); +static void setgeometrynotify(struct wl_listener *listener, void *data); static struct wl_listener new_xwayland_surface = {.notify = createnotifyx11}; static struct wl_listener xwayland_ready = {.notify = xwaylandready}; -// static struct wl_listener new_xwayland_surface = {.notify = createnotifyx11}; -// static struct wl_listener xwayland_ready = {.notify = xwaylandready}; static struct wlr_xwayland *xwayland; #endif @@ -4470,6 +4471,12 @@ mapnotify(struct wl_listener *listener, void *data) { focusclient(c, 1); exclusive_focus = c; } +#ifdef XWAYLAND + if (client_is_x11(c)) { + LISTEN(&c->surface.xwayland->events.set_geometry, &c->set_geometry, + setgeometrynotify); + } +#endif return; } @@ -6764,6 +6771,11 @@ void unmapnotify(struct wl_listener *listener, void *data) { } if (client_is_unmanaged(c)) { +#ifdef XWAYLAND + if(client_is_x11(c)) { + wl_list_remove(&c->set_geometry.link); + } +#endif if (c == exclusive_focus) exclusive_focus = NULL; if (client_surface(c) == seat->keyboard_state.focused_surface) @@ -7665,6 +7677,15 @@ void xwaylandready(struct wl_listener *listener, void *data) { xcursor->images[0]->width, xcursor->images[0]->height, xcursor->images[0]->hotspot_x, xcursor->images[0]->hotspot_y); } + +static void setgeometrynotify(struct wl_listener *listener, void *data) { + + Client *c = wl_container_of(listener, c, set_geometry); + + struct wlr_xwayland_surface *xsurface = c->surface.xwayland; + wlr_scene_node_set_position(&c->scene->node, xsurface->x, xsurface->y); + motionnotify(0, NULL, 0, 0, 0, 0); +} #endif int main(int argc, char *argv[]) {