Files
absinthe/src/xwayland.c
T

63 lines
1.9 KiB
C
Raw Normal View History

2026-04-06 23:38:06 +07:00
#ifdef XWAYLAND
2026-04-25 14:09:14 +07:00
2026-04-06 23:38:06 +07:00
#include "types.h"
#include "absinthe-toplevel.h"
2026-04-07 11:36:55 +07:00
#include "xdg-toplevel.h"
2026-04-06 23:38:06 +07:00
#include "xwayland.h"
2026-04-06 23:50:12 +07:00
void xwayland_activate(struct wl_listener *listener, void *data)
{
2026-04-26 14:31:03 +07:00
UNUSED(data);
2026-04-25 14:09:14 +07:00
struct absinthe_toplevel *toplevel = wl_container_of(listener, toplevel, xwayland_activate);
2026-04-06 23:50:12 +07:00
2026-04-25 14:09:14 +07:00
if (!absinthe_toplevel_is_unmanaged(toplevel))
wlr_xwayland_surface_activate(toplevel->toplevel.x11, 1);
2026-04-06 23:50:12 +07:00
}
void xwayland_associate(struct wl_listener *listener, void *data)
{
2026-04-26 14:31:03 +07:00
UNUSED(data);
2026-04-25 14:09:14 +07:00
struct absinthe_toplevel *toplevel = wl_container_of(listener, toplevel, xwayland_associate);
2026-04-06 23:50:12 +07:00
2026-04-25 14:09:14 +07:00
toplevel->map.notify = absinthe_toplevel_map;
wl_signal_add(&toplevel->toplevel.x11->surface->events.map, &toplevel->map);
toplevel->unmap.notify = absinthe_toplevel_unmap;
wl_signal_add(&toplevel->toplevel.x11->surface->events.unmap, &toplevel->unmap);
2026-04-06 23:50:12 +07:00
}
void xwayland_dissociate(struct wl_listener *listener, void *data)
{
2026-04-26 14:31:03 +07:00
UNUSED(data);
2026-04-25 14:09:14 +07:00
struct absinthe_toplevel *toplevel = wl_container_of(listener, toplevel, xwayland_dissociate);
2026-04-06 23:50:12 +07:00
2026-04-25 14:09:14 +07:00
wl_list_remove(&toplevel->map.link);
wl_list_remove(&toplevel->unmap.link);
2026-04-06 23:50:12 +07:00
}
2026-04-07 11:36:55 +07:00
void xwayland_configure(struct wl_listener *listener, void *data)
{
2026-04-26 14:31:03 +07:00
UNUSED(data);
2026-04-25 14:09:14 +07:00
struct absinthe_toplevel *toplevel = wl_container_of(listener, toplevel, xwayland_configure);
struct wlr_xwayland_surface_configure_event *event = data;
if (!toplevel->toplevel.x11->surface || !toplevel->toplevel.x11->surface->mapped) {
wlr_xwayland_surface_configure(toplevel->toplevel.x11, event->x, event->y, event->width, event->height);
return;
}
if (absinthe_toplevel_is_unmanaged(toplevel)) {
wlr_scene_node_set_position(&toplevel->scene_tree->node, event->x, event->y);
wlr_xwayland_surface_configure(toplevel->toplevel.x11,
event->x, event->y, event->width, event->height);
return;
}
2026-04-07 11:36:55 +07:00
}
2026-04-06 23:50:12 +07:00
2026-04-26 14:31:03 +07:00
void xwayland_set_hints(struct wl_listener *listener, void *data)
{
UNUSED(listener);
UNUSED(data);
}
2026-04-06 23:38:06 +07:00
#endif