ZOOCZQBGZ4PCOU54EPPUPWNOIFWCM5RMZ4EFL2WFR7LFJTAMHZGAC
}
void
createnotify(struct wl_listener *listener, void *data)
{
/* This event is raised when wlr_xdg_shell receives a new xdg surface from a
* client, either a toplevel (application window) or popup. */
struct wlr_xdg_surface *xdg_surface = data;
if (xdg_surface->role != WLR_XDG_SURFACE_ROLE_TOPLEVEL) {
return;
}
/* Allocate a Client for this surface */
Client *c = calloc(1, sizeof(*c));
c->xdg_surface = xdg_surface;
/* Listen to the various events it can emit */
c->map.notify = maprequest;
wl_signal_add(&xdg_surface->events.map, &c->map);
c->unmap.notify = unmapnotify;
wl_signal_add(&xdg_surface->events.unmap, &c->unmap);
c->destroy.notify = destroynotify;
wl_signal_add(&xdg_surface->events.destroy, &c->destroy);
/* Add it to the list of clients. */
wl_list_insert(&clients, &c->link);
}
void
createnotify(struct wl_listener *listener, void *data)
{
/* This event is raised when wlr_xdg_shell receives a new xdg surface from a
* client, either a toplevel (application window) or popup. */
struct wlr_xdg_surface *xdg_surface = data;
if (xdg_surface->role != WLR_XDG_SURFACE_ROLE_TOPLEVEL) {
return;
}
/* Allocate a Client for this surface */
Client *c = calloc(1, sizeof(*c));
c->xdg_surface = xdg_surface;
/* Listen to the various events it can emit */
c->map.notify = maprequest;
wl_signal_add(&xdg_surface->events.map, &c->map);
c->unmap.notify = unmapnotify;
wl_signal_add(&xdg_surface->events.unmap, &c->unmap);
c->destroy.notify = destroynotify;
wl_signal_add(&xdg_surface->events.destroy, &c->destroy);
/* Add it to the list of clients. */
wl_list_insert(&clients, &c->link);
}
Client *
xytoclient(double lx, double ly,
struct wlr_surface **surface, double *sx, double *sy)
{
/* This iterates over all of our surfaces and attempts to find one under the
* cursor. This relies on clients being ordered from top-to-bottom. */
Client *c;
wl_list_for_each(c, &clients, link) {
if (xytosurface(c, lx, ly, surface, sx, sy)) {
return c;
}
}
return NULL;
}
Client *
xytoclient(double lx, double ly,
struct wlr_surface **surface, double *sx, double *sy)
{
/* This iterates over all of our surfaces and attempts to find one under the
* cursor. This relies on clients being ordered from top-to-bottom. */
Client *c;
wl_list_for_each(c, &clients, link) {
if (xytosurface(c, lx, ly, surface, sx, sy)) {
return c;
}
}
return NULL;