Files
absinthe/src/xwayland.c
T

54 lines
1.9 KiB
C
Raw Normal View History

2026-04-06 23:38:06 +07:00
#ifdef XWAYLAND
#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)
{
struct absinthe_toplevel *toplevel = wl_container_of(listener, toplevel, xwayland_activate);
if (!absinthe_toplevel_is_unmanaged(toplevel))
wlr_xwayland_surface_activate(toplevel->toplevel.x11, 1);
}
void xwayland_associate(struct wl_listener *listener, void *data)
{
2026-04-07 11:36:55 +07:00
struct absinthe_toplevel *toplevel = wl_container_of(listener, toplevel, xwayland_associate);
2026-04-06 23:50:12 +07:00
2026-04-07 11:48:15 +07:00
toplevel->map.notify = absinthe_toplevel_map;
2026-04-07 11:36:55 +07:00
wl_signal_add(&toplevel->toplevel.x11->surface->events.map, &toplevel->map);
2026-04-07 11:48:15 +07:00
toplevel->unmap.notify = absinthe_toplevel_unmap;
2026-04-07 11:36:55 +07:00
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-07 11:36:55 +07:00
struct absinthe_toplevel *toplevel = wl_container_of(listener, toplevel, xwayland_dissociate);
2026-04-06 23:50:12 +07:00
wl_list_remove(&toplevel->map.link);
wl_list_remove(&toplevel->unmap.link);
}
2026-04-07 11:36:55 +07:00
void xwayland_configure(struct wl_listener *listener, void *data)
{
2026-04-15 22:57:27 +07:00
struct absinthe_toplevel *toplevel = wl_container_of(listener, toplevel, xwayland_configure);
2026-04-07 11:36:55 +07:00
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)) {
2026-04-15 22:57:27 +07:00
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-06 23:38:06 +07:00
void xwayland_set_hints(struct wl_listener *listener, void *data) {}
#endif