summaryrefslogtreecommitdiff
path: root/src/platform/wayland/surface.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/platform/wayland/surface.c')
-rw-r--r--src/platform/wayland/surface.c38
1 files changed, 9 insertions, 29 deletions
diff --git a/src/platform/wayland/surface.c b/src/platform/wayland/surface.c
index 1820642..7daa679 100644
--- a/src/platform/wayland/surface.c
+++ b/src/platform/wayland/surface.c
@@ -26,11 +26,6 @@ static void report_display_error(struct wayland_display *c)
fprintf(stderr, "[yasl] display error %d\n", err);
}
-void display_enter(struct wayland_display *c)
-{
- c->depth++;
-}
-
void display_leave(struct wayland_display *c)
{
if (--c->depth > 0)
@@ -50,7 +45,7 @@ static void display_lose(struct wayland_display *c)
c->lost = true;
report_display_error(c);
display_cancel_read(c);
- display_enter(c);
+ c->depth++;
for (struct wayland_surface *w = c->surfaces, *next; w; w = next) {
next = w->conn_next;
surface_fail(w);
@@ -75,7 +70,7 @@ static int display_ready(int fd, short revents, void *ud)
struct wayland_display *c = ud;
if (c->lost)
return 0;
- display_enter(c);
+ c->depth++;
if (c->reading) {
c->reading = false;
if (!(revents & POLLIN))
@@ -140,7 +135,7 @@ int wayland_display_dispatch_timeout(struct wayland_display *c, int timeout_ms)
if (!c || c->lost)
return -1;
- display_enter(c);
+ c->depth++;
if (wl_display_dispatch_pending(c->wl) < 0) {
display_lose(c);
@@ -181,7 +176,7 @@ void wayland_display_flush(struct wayland_display *c)
{
if (!c || c->lost)
return;
- display_enter(c);
+ c->depth++;
for (struct wayland_surface *w = c->surfaces, *next; w; w = next) {
next = w->conn_next;
surface_draw_frame(w);
@@ -286,7 +281,7 @@ uint32_t wayland_display_caps(const struct wayland_display *c)
if (!c) return 0;
uint32_t caps = YASL_CAP_POPUPS | YASL_CAP_CSD | YASL_CAP_FRAME_PACING;
if (c->tablet_mgr) caps |= YASL_CAP_TABLET;
- struct seat *s = conn_active_seat(c);
+ struct seat *s = c->active_seat ? c->active_seat : c->seats;
const struct wl_data_device *device = s ? clipboard_data_device(s->clipboard) : NULL;
if (device && wl_data_device_get_version((struct wl_data_device *)device) >= 3)
caps |= YASL_CAP_DRAG;
@@ -338,7 +333,7 @@ struct wayland_surface *wayland_surface_create_toplevel(struct wayland_display *
display_cancel_read(c);
struct wayland_surface *w = calloc(1, sizeof(*w));
if (!w) return NULL;
- display_enter(c);
+ c->depth++;
conn_link(c, w);
wayland_surface_set_callbacks(w, NULL, NULL);
w->cursor = YASL_CURSOR_TEXT;
@@ -440,11 +435,6 @@ void wayland_surface_destroy(struct wayland_surface *w)
}
}
-struct wayland_display *wayland_surface_display(const struct wayland_surface *w)
-{
- return w ? w->conn : NULL;
-}
-
void wayland_surface_schedule_redraw(struct wayland_surface *w)
{
if (!w || w->closed) return;
@@ -469,7 +459,7 @@ void wayland_surface_set_background_color(struct wayland_surface *w, uint32_t bg
bool wayland_surface_start_interactive_move(struct wayland_surface *s)
{
if (!s || !s->toplevel || !s->conn) return false;
- struct seat *seat = conn_active_seat(s->conn);
+ struct seat *seat = s->conn->active_seat ? s->conn->active_seat : s->conn->seats;
if (!seat || !seat->proxy || !seat->press_serial) return false;
xdg_toplevel_move(s->toplevel, seat->proxy, seat->press_serial);
return true;
@@ -478,7 +468,7 @@ bool wayland_surface_start_interactive_move(struct wayland_surface *s)
bool wayland_surface_start_interactive_resize(struct wayland_surface *s, enum yasl_resize_edge edge)
{
if (!s || !s->toplevel || !s->conn || edge == YASL_EDGE_NONE) return false;
- struct seat *seat = conn_active_seat(s->conn);
+ struct seat *seat = s->conn->active_seat ? s->conn->active_seat : s->conn->seats;
if (!seat || !seat->proxy || !seat->press_serial) return false;
xdg_toplevel_resize(s->toplevel, seat->proxy, seat->press_serial, (uint32_t)edge);
return true;
@@ -487,7 +477,7 @@ bool wayland_surface_start_interactive_resize(struct wayland_surface *s, enum ya
bool wayland_surface_show_window_menu(struct wayland_surface *s, struct yasl_vector2i pos)
{
if (!s || !s->toplevel || !s->conn) return false;
- struct seat *seat = conn_active_seat(s->conn);
+ struct seat *seat = s->conn->active_seat ? s->conn->active_seat : s->conn->seats;
if (!seat || !seat->proxy || !seat->press_serial) return false;
uint32_t scale = s->scale_120 ? s->scale_120 : YASL_SCALE_UNIT;
xdg_toplevel_show_window_menu(s->toplevel, seat->proxy, seat->press_serial,
@@ -495,13 +485,3 @@ bool wayland_surface_show_window_menu(struct wayland_surface *s, struct yasl_vec
yasl_scale_to_logical(pos.y, scale));
return true;
}
-
-void *wayland_display_get_native_handle(struct wayland_display *d)
-{
- return d ? d->wl : NULL;
-}
-
-void *wayland_surface_get_native_handle(struct wayland_surface *s)
-{
- return s ? s->surface : NULL;
-}