summaryrefslogtreecommitdiff
path: root/src/platform/wayland/drag.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/platform/wayland/drag.c')
-rw-r--r--src/platform/wayland/drag.c54
1 files changed, 27 insertions, 27 deletions
diff --git a/src/platform/wayland/drag.c b/src/platform/wayland/drag.c
index 1f4a78b..07e31b5 100644
--- a/src/platform/wayland/drag.c
+++ b/src/platform/wayland/drag.c
@@ -11,13 +11,13 @@ static void icon_clear(struct drag_icon *icon)
*icon = (struct drag_icon){0};
}
-static bool icon_create(struct wayland_display *c, const struct yasl_drag_image *image)
+static bool icon_create(struct wayland_display *c, const struct yasl_private_drag_image *image)
{
struct drag_icon *icon = &c->drag.icon;
size_t bytes;
if (!image->pixels || !buffer_size(image->size.x, image->size.y, &bytes))
return false;
- int fd = memfd_create("yasl_drag_icon", MFD_CLOEXEC | MFD_ALLOW_SEALING);
+ int fd = memfd_create("yasl_private_drag_icon", MFD_CLOEXEC | MFD_ALLOW_SEALING);
if (fd < 0)
return false;
void *mapping = MAP_FAILED;
@@ -48,7 +48,7 @@ static bool icon_create(struct wayland_display *c, const struct yasl_drag_image
return true;
}
-static void icon_show(struct wayland_display *c, const struct yasl_drag_image *image)
+static void icon_show(struct wayland_display *c, const struct yasl_private_drag_image *image)
{
struct drag_icon *icon = &c->drag.icon;
uint32_t scale = c->drag.scale_120;
@@ -56,18 +56,18 @@ static void icon_show(struct wayland_display *c, const struct yasl_drag_image *i
icon->viewport = wp_viewporter_get_viewport(c->viewporter, icon->surface);
if (icon->viewport)
wp_viewport_set_destination(icon->viewport,
- yasl_scale_to_logical(image->size.x, scale),
- yasl_scale_to_logical(image->size.y, scale));
- } else if (scale % YASL_SCALE_UNIT == 0 &&
+ yasl_private_scale_to_logical(image->size.x, scale),
+ yasl_private_scale_to_logical(image->size.y, scale));
+ } else if (scale % YASL_PRIVATE_SCALE_UNIT == 0 &&
wl_proxy_get_version((struct wl_proxy *)icon->surface) >=
WL_SURFACE_SET_BUFFER_SCALE_SINCE_VERSION) {
- wl_surface_set_buffer_scale(icon->surface, (int32_t)(scale / YASL_SCALE_UNIT));
+ wl_surface_set_buffer_scale(icon->surface, (int32_t)(scale / YASL_PRIVATE_SCALE_UNIT));
}
if (wl_proxy_get_version((struct wl_proxy *)icon->surface) >=
WL_SURFACE_OFFSET_SINCE_VERSION)
wl_surface_offset(icon->surface,
- -yasl_scale_to_logical(image->hotspot.x, scale),
- -yasl_scale_to_logical(image->hotspot.y, scale));
+ -yasl_private_scale_to_logical(image->hotspot.x, scale),
+ -yasl_private_scale_to_logical(image->hotspot.y, scale));
wl_surface_attach(icon->surface, icon->buffer, 0, 0);
wl_surface_damage_buffer(icon->surface, 0, 0, image->size.x, image->size.y);
wl_surface_commit(icon->surface);
@@ -88,9 +88,9 @@ static void drag_clear(struct wayland_display *c, bool ended)
*d = (struct conn_drag){0};
}
-static void drag_finish(struct wayland_display *c, enum yasl_drag_end how, bool ended)
+static void drag_finish(struct wayland_display *c, enum yasl_private_drag_end how, bool ended)
{
- struct yasl_drag_listener l = c->drag.listener;
+ struct yasl_private_drag_listener l = c->drag.listener;
void *ud = c->drag.ud;
drag_clear(c, ended);
if (l.end)
@@ -100,7 +100,7 @@ static void drag_finish(struct wayland_display *c, enum yasl_drag_end how, bool
void conn_drag_end(struct wayland_display *c)
{
if (c && c->drag.source)
- drag_finish(c, YASL_DRAG_CANCELLED, false);
+ drag_finish(c, YASL_PRIVATE_DRAG_CANCELLED, false);
}
static void source_target(void *ud, struct wl_data_source *s, const char *mime) { (void)ud; (void)s; (void)mime; }
@@ -112,7 +112,7 @@ static void source_cancelled(void *ud, struct wl_data_source *s)
(void)s;
struct wayland_display *c = ud;
bool released = c->drag.dropped;
- drag_finish(c, released ? YASL_DRAG_DROPPED : YASL_DRAG_CANCELLED, true);
+ drag_finish(c, released ? YASL_PRIVATE_DRAG_DROPPED : YASL_PRIVATE_DRAG_CANCELLED, true);
}
static void source_dropped(void *ud, struct wl_data_source *s)
@@ -124,7 +124,7 @@ static void source_dropped(void *ud, struct wl_data_source *s)
static void source_finished(void *ud, struct wl_data_source *s)
{
(void)s;
- drag_finish(ud, YASL_DRAG_DROPPED, true);
+ drag_finish(ud, YASL_PRIVATE_DRAG_DROPPED, true);
}
static const struct wl_data_source_listener source_listener = {
@@ -150,8 +150,8 @@ static struct seat *drag_seat(struct wayland_display *c, struct wayland_surface
}
bool wayland_display_drag_start(struct wayland_display *c, struct wayland_surface *origin,
- const struct yasl_drag_image *image,
- const struct yasl_drag_listener *l, void *ud)
+ const struct yasl_private_drag_image *image,
+ const struct yasl_private_drag_listener *l, void *ud)
{
if (!c || !origin || origin->conn != c || !l || c->drag.source)
return false;
@@ -190,39 +190,39 @@ bool wayland_display_drag_start(struct wayland_display *c, struct wayland_surfac
void wayland_display_drag_cancel(struct wayland_display *c)
{
if (c && c->drag.source)
- drag_finish(c, YASL_DRAG_CANCELLED, false);
+ drag_finish(c, YASL_PRIVATE_DRAG_CANCELLED, false);
}
-bool wayland_surface_drag_carry(struct wayland_surface *w, struct yasl_vector2i offset)
+bool wayland_surface_drag_carry(struct wayland_surface *w, struct yasl_private_vector2i offset)
{
struct wayland_display *c = w ? w->conn : NULL;
if (!c || !c->drag.source || !c->drag.toplevel || !w->toplevel)
return false;
uint32_t scale = c->drag.scale_120;
xdg_toplevel_drag_v1_attach(c->drag.toplevel, w->toplevel,
- yasl_scale_to_logical(offset.x, scale),
- yasl_scale_to_logical(offset.y, scale));
+ yasl_private_scale_to_logical(offset.x, scale),
+ yasl_private_scale_to_logical(offset.y, scale));
c->drag.carrying = true;
return true;
}
-bool wayland_surface_place_under_pointer(struct wayland_surface *w, struct yasl_vector2i at)
+bool wayland_surface_place_under_pointer(struct wayland_surface *w, struct yasl_private_vector2i at)
{
(void)w;
(void)at;
return false;
}
-static struct yasl_vector2i drag_device_pos(const struct wayland_surface *w, double x, double y)
+static struct yasl_private_vector2i drag_device_pos(const struct wayland_surface *w, double x, double y)
{
double dx = x * w->scale_factor, dy = y * w->scale_factor;
- return (struct yasl_vector2i){
+ return (struct yasl_private_vector2i){
.x = (int)(dx < 0 ? dx - 0.5 : dx + 0.5),
.y = (int)(dy < 0 ? dy - 0.5 : dy + 0.5),
};
}
-void conn_drop_target(struct wayland_display *c, enum yasl_drop_event ev,
+void conn_drop_target(struct wayland_display *c, enum yasl_private_drop_event ev,
struct wl_surface *on, double x, double y)
{
(void)c;
@@ -230,10 +230,10 @@ void conn_drop_target(struct wayland_display *c, enum yasl_drop_event ev,
(struct wayland_surface *)wl_surface_get_user_data(on) : NULL;
if (!w || w->parent || w->closed)
return;
- yasl_surface_notify_drop(&w->base, ev, drag_device_pos(w, x, y));
+ yasl_private_surface_notify_drop(&w->base, ev, drag_device_pos(w, x, y));
}
-void conn_drag_target(struct wayland_display *c, enum yasl_drag_event ev,
+void conn_drag_target(struct wayland_display *c, enum yasl_private_drag_event ev,
struct wl_surface *on, double x, double y)
{
(void)c;
@@ -241,5 +241,5 @@ void conn_drag_target(struct wayland_display *c, enum yasl_drag_event ev,
(struct wayland_surface *)wl_surface_get_user_data(on) : NULL;
if (!w || w->parent || w->closed)
return;
- yasl_surface_notify_drag(&w->base, ev, drag_device_pos(w, x, y));
+ yasl_private_surface_notify_drag(&w->base, ev, drag_device_pos(w, x, y));
}