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PNTTCUAAPVPJ3PVQC LRGGX34PR2PQEBW6U465VYOGIYOPD365PB444JGR6R3H7E524CCQC RWCXH2L4WZ4U5DZRUGRN6POD7C4WXXLCCSLINRXNBCNYGA7VJD7QC 6XZIQSMIVP2GZ5S3UCKEVNDSLTHSQEVSXLV4UIFF3G3SRCGJPXYAC HW2YJWC6AUWHZBS7KHF3PAWN44XGWSJ5WU47MCHTDCH32L5JN7EQC 24NXTKJNNOM6P3OPCN7OZE6LGGMFKRWFR6NUZ5JKETRABZA4YAGQC ZDQINUTDXQUS7OBW53UEYR6IN7DJLTPBOMRURGYQBGJ2FBROIQVAC 4WVZ2LAGAIQ2EROHNA4T5PWQEEIPJRTA3CBHGAO55NACCUGLKEZQC 6V3JKJZJ7KBS5I3Q266ZCRJYVO56ZQKLJL4EOHN6XC222CZFXCDQC 2QL2H4REDZT46FI3LQ4RYEMQYZBNBK3IC3KH3XERAJU3NCZWMNYQC ZPSXARCBIT2LZ4PLNMKXHIEEWG3XLVXXISIZDYNGFACDI5I256NQC UCSTVE5NIAIQ3NJL5YLDFDKDPOCJS6NMAGABSWG67RGCPH47JQEQC #ifdef XWAYLANDstatic void activatex11(struct wl_listener *listener, void *data);static void createnotifyx11(struct wl_listener *listener, void *data);static Atom getatom(xcb_connection_t *xc, const char *name);static void renderindependents(struct wlr_output *output, struct timespec *now);static void updatewindowtype(Client *c);static void xwaylandready(struct wl_listener *listener, void *data);static struct wl_listener new_xwayland_surface = {.notify = createnotifyx11};
voidactivatex11(struct wl_listener *listener, void *data){Client *c = wl_container_of(listener, c, activate);/* Only "managed" windows can be activated */if (c->type == X11Managed)wlr_xwayland_surface_activate(c->surface.xwayland, 1);}
appid = c->type != XDGShell ? c->surface.xwayland->class :c->surface.xdg->toplevel->app_id;title = c->type != XDGShell ? c->surface.xwayland->title :c->surface.xdg->toplevel->title;
#ifdef XWAYLANDupdatewindowtype(c);if (c->type != XDGShell) {appid = c->surface.xwayland->class;title = c->surface.xwayland->title;} else#endif{appid = c->surface.xdg->toplevel->app_id;title = c->surface.xdg->toplevel->title;}
}voidcreatenotifyx11(struct wl_listener *listener, void *data){struct wlr_xwayland_surface *xwayland_surface = data;Client *c;/* Allocate a Client for this surface */c = xwayland_surface->data = calloc(1, sizeof(*c));c->surface.xwayland = xwayland_surface;c->type = xwayland_surface->override_redirect ? X11Unmanaged : X11Managed;c->bw = borderpx;/* Listen to the various events it can emit */c->map.notify = maprequest;wl_signal_add(&xwayland_surface->events.map, &c->map);c->unmap.notify = unmapnotify;wl_signal_add(&xwayland_surface->events.unmap, &c->unmap);c->activate.notify = activatex11;wl_signal_add(&xwayland_surface->events.request_activate, &c->activate);c->destroy.notify = destroynotify;wl_signal_add(&xwayland_surface->events.destroy, &c->destroy);
renderindependents(struct wlr_output *output, struct timespec *now){Client *c;struct render_data rdata;struct wlr_box geom;wl_list_for_each_reverse(c, &independents, link) {geom.x = c->surface.xwayland->x;geom.y = c->surface.xwayland->y;geom.width = c->surface.xwayland->width;geom.height = c->surface.xwayland->height;/* Only render visible clients which show on this output */if (!wlr_output_layout_intersects(output_layout, output, &geom))continue;rdata.output = output;rdata.when = now;rdata.x = c->surface.xwayland->x;rdata.y = c->surface.xwayland->y;wlr_surface_for_each_surface(c->surface.xwayland->surface, render, &rdata);}}void
}voidupdatewindowtype(Client *c){size_t i;if (c->type != XDGShell)for (i = 0; i < c->surface.xwayland->window_type_len; i++)if (c->surface.xwayland->window_type[i] == netatom[NetWMWindowTypeDialog] ||c->surface.xwayland->window_type[i] == netatom[NetWMWindowTypeSplash] ||c->surface.xwayland->window_type[i] == netatom[NetWMWindowTypeToolbar] ||c->surface.xwayland->window_type[i] == netatom[NetWMWindowTypeUtility])c->isfloating = 1;}voidxwaylandready(struct wl_listener *listener, void *data) {xcb_connection_t *xc = xcb_connect(xwayland->display_name, NULL);int err = xcb_connection_has_error(xc);if (err) {fprintf(stderr, "xcb_connect to X server failed with code %d\n. Continuing with degraded functionality.\n", err);return;}/* Collect atoms we are interested in. If getatom returns 0, we will* not detect that window type. */netatom[NetWMWindowTypeDialog] = getatom(xc, "_NET_WM_WINDOW_TYPE_DIALOG");netatom[NetWMWindowTypeSplash] = getatom(xc, "_NET_WM_WINDOW_TYPE_SPLASH");netatom[NetWMWindowTypeUtility] = getatom(xc, "_NET_WM_WINDOW_TYPE_TOOLBAR");netatom[NetWMWindowTypeToolbar] = getatom(xc, "_NET_WM_WINDOW_TYPE_UTILITY");/* assign the one and only seat */wlr_xwayland_set_seat(xwayland, seat);xcb_disconnect(xc);
}#ifdef XWAYLANDvoidactivatex11(struct wl_listener *listener, void *data){Client *c = wl_container_of(listener, c, activate);/* Only "managed" windows can be activated */if (c->type == X11Managed)wlr_xwayland_surface_activate(c->surface.xwayland, 1);}voidcreatenotifyx11(struct wl_listener *listener, void *data){struct wlr_xwayland_surface *xwayland_surface = data;Client *c;/* Allocate a Client for this surface */c = xwayland_surface->data = calloc(1, sizeof(*c));c->surface.xwayland = xwayland_surface;c->type = xwayland_surface->override_redirect ? X11Unmanaged : X11Managed;c->bw = borderpx;/* Listen to the various events it can emit */c->map.notify = maprequest;wl_signal_add(&xwayland_surface->events.map, &c->map);c->unmap.notify = unmapnotify;wl_signal_add(&xwayland_surface->events.unmap, &c->unmap);c->activate.notify = activatex11;wl_signal_add(&xwayland_surface->events.request_activate, &c->activate);c->destroy.notify = destroynotify;wl_signal_add(&xwayland_surface->events.destroy, &c->destroy);}Atomgetatom(xcb_connection_t *xc, const char *name){Atom atom = 0;xcb_intern_atom_cookie_t cookie;xcb_intern_atom_reply_t *reply;cookie = xcb_intern_atom(xc, 0, strlen(name), name);if ((reply = xcb_intern_atom_reply(xc, cookie, NULL)))atom = reply->atom;free(reply);return atom;}voidrenderindependents(struct wlr_output *output, struct timespec *now){Client *c;struct render_data rdata;struct wlr_box geom;wl_list_for_each_reverse(c, &independents, link) {geom.x = c->surface.xwayland->x;geom.y = c->surface.xwayland->y;geom.width = c->surface.xwayland->width;geom.height = c->surface.xwayland->height;/* Only render visible clients which show on this output */if (!wlr_output_layout_intersects(output_layout, output, &geom))continue;rdata.output = output;rdata.when = now;rdata.x = c->surface.xwayland->x;rdata.y = c->surface.xwayland->y;wlr_surface_for_each_surface(c->surface.xwayland->surface, render, &rdata);}}voidupdatewindowtype(Client *c){size_t i;if (c->type != XDGShell)for (i = 0; i < c->surface.xwayland->window_type_len; i++)if (c->surface.xwayland->window_type[i] == netatom[NetWMWindowTypeDialog] ||c->surface.xwayland->window_type[i] == netatom[NetWMWindowTypeSplash] ||c->surface.xwayland->window_type[i] == netatom[NetWMWindowTypeToolbar] ||c->surface.xwayland->window_type[i] == netatom[NetWMWindowTypeUtility])c->isfloating = 1;
voidxwaylandready(struct wl_listener *listener, void *data){xcb_connection_t *xc = xcb_connect(xwayland->display_name, NULL);int err = xcb_connection_has_error(xc);if (err) {fprintf(stderr, "xcb_connect to X server failed with code %d\n. Continuing with degraded functionality.\n", err);return;}/* Collect atoms we are interested in. If getatom returns 0, we will* not detect that window type. */netatom[NetWMWindowTypeDialog] = getatom(xc, "_NET_WM_WINDOW_TYPE_DIALOG");netatom[NetWMWindowTypeSplash] = getatom(xc, "_NET_WM_WINDOW_TYPE_SPLASH");netatom[NetWMWindowTypeUtility] = getatom(xc, "_NET_WM_WINDOW_TYPE_TOOLBAR");netatom[NetWMWindowTypeToolbar] = getatom(xc, "_NET_WM_WINDOW_TYPE_UTILITY");/* assign the one and only seat */wlr_xwayland_set_seat(xwayland, seat);xcb_disconnect(xc);}#endif
# Default compile flags (overridable by environment)CFLAGS ?= -g -Wall -Wextra -Werror -Wno-unused-parameter -Wno-sign-compare -Wno-error=unused-function# Uncomment to build XWayland support#CFLAGS += -DXWAYLAND
CFLAGS ?= -g -Wall -Wextra -Werror -Wno-unused-parameter -Wno-sign-compare -Wno-error=unused-functionCFLAGS += -I. -DWLR_USE_UNSTABLE -std=c99 -Werror=declaration-after-statement