diff options
| author | Berke Güzel <wenekar1@gmail.com> | 2026-10-11 23:40:57 +0300 |
|---|---|---|
| committer | Berke Güzel <wenekar1@gmail.com> | 2026-10-11 23:40:57 +0300 |
| commit | 6eac0a5f2c552728efca420b1129fae7d4fea773 (patch) | |
| tree | 27fc9dc013de80787525696897771acec22c0f0c /src/wayland/drag.c | |
| parent | 8d9f7c7cb39359d62bf28ef1775b944a7dddd6fb (diff) | |
feat: backend selection (Wayland, X11, Cocoa)
Diffstat (limited to 'src/wayland/drag.c')
| -rw-r--r-- | src/wayland/drag.c | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/src/wayland/drag.c b/src/wayland/drag.c index 107ec52..7c15002 100644 --- a/src/wayland/drag.c +++ b/src/wayland/drag.c @@ -11,7 +11,7 @@ static void icon_clear(struct drag_icon *icon) *icon = (struct drag_icon){0}; } -static bool icon_create(struct yasl_display *c, const struct yasl_drag_image *image) +static bool icon_create(struct wayland_display *c, const struct yasl_drag_image *image) { struct drag_icon *icon = &c->drag.icon; size_t bytes; @@ -48,7 +48,7 @@ static bool icon_create(struct yasl_display *c, const struct yasl_drag_image *im return true; } -static void icon_show(struct yasl_display *c, const struct yasl_drag_image *image) +static void icon_show(struct wayland_display *c, const struct yasl_drag_image *image) { struct drag_icon *icon = &c->drag.icon; uint32_t scale = c->drag.scale_120; @@ -73,7 +73,7 @@ static void icon_show(struct yasl_display *c, const struct yasl_drag_image *imag wl_surface_commit(icon->surface); } -static void drag_clear(struct yasl_display *c, bool ended) +static void drag_clear(struct wayland_display *c, bool ended) { struct conn_drag *d = &c->drag; if (d->toplevel) { @@ -88,7 +88,7 @@ static void drag_clear(struct yasl_display *c, bool ended) *d = (struct conn_drag){0}; } -static void drag_finish(struct yasl_display *c, enum yasl_drag_end how, bool ended) +static void drag_finish(struct wayland_display *c, enum yasl_drag_end how, bool ended) { const struct yasl_drag_listener *l = c->drag.listener; void *ud = c->drag.ud; @@ -97,7 +97,7 @@ static void drag_finish(struct yasl_display *c, enum yasl_drag_end how, bool end l->end(ud, how); } -void conn_drag_end(struct yasl_display *c) +void conn_drag_end(struct wayland_display *c) { if (c && c->drag.source) drag_finish(c, YASL_DRAG_CANCELLED, false); @@ -110,7 +110,7 @@ static void source_action(void *ud, struct wl_data_source *s, uint32_t action) { static void source_cancelled(void *ud, struct wl_data_source *s) { (void)s; - struct yasl_display *c = ud; + struct wayland_display *c = ud; bool released = c->drag.dropped || !c->drag.carrying; drag_finish(c, released ? YASL_DRAG_DROPPED : YASL_DRAG_CANCELLED, true); } @@ -118,7 +118,7 @@ static void source_cancelled(void *ud, struct wl_data_source *s) static void source_dropped(void *ud, struct wl_data_source *s) { (void)s; - ((struct yasl_display *)ud)->drag.dropped = true; + ((struct wayland_display *)ud)->drag.dropped = true; } static void source_finished(void *ud, struct wl_data_source *s) @@ -136,9 +136,9 @@ static const struct wl_data_source_listener source_listener = { .action = source_action, }; -static struct seat *drag_seat(struct yasl_display *c, struct yasl_surface *origin) +static struct seat *drag_seat(struct wayland_display *c, struct wayland_surface *origin) { - struct yasl_surface *root = surface_root(origin); + struct wayland_surface *root = surface_root(origin); struct seat *active = conn_active_seat(c); if (active && active->press_serial && surface_root(active->press_surface) == root) @@ -149,7 +149,7 @@ static struct seat *drag_seat(struct yasl_display *c, struct yasl_surface *origi return NULL; } -bool yasl_display_drag_start(struct yasl_display *c, struct yasl_surface *origin, +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) { @@ -187,15 +187,15 @@ bool yasl_display_drag_start(struct yasl_display *c, struct yasl_surface *origin return true; } -void yasl_display_drag_cancel(struct yasl_display *c) +void wayland_display_drag_cancel(struct wayland_display *c) { if (c && c->drag.source) drag_clear(c, false); } -bool yasl_surface_drag_carry(struct yasl_surface *w, struct yasl_vector2i offset) +bool wayland_surface_drag_carry(struct wayland_surface *w, struct yasl_vector2i offset) { - struct yasl_display *c = w ? w->conn : NULL; + 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; @@ -206,14 +206,14 @@ bool yasl_surface_drag_carry(struct yasl_surface *w, struct yasl_vector2i offset return true; } -bool yasl_surface_place_under_pointer(struct yasl_surface *w, struct yasl_vector2i at) +bool wayland_surface_place_under_pointer(struct wayland_surface *w, struct yasl_vector2i at) { (void)w; (void)at; return false; } -static struct yasl_vector2i drag_device_pos(const struct yasl_surface *w, double x, double y) +static struct yasl_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){ @@ -222,20 +222,20 @@ static struct yasl_vector2i drag_device_pos(const struct yasl_surface *w, double }; } -void conn_drop_target(struct yasl_display *c, enum yasl_drop_event ev, +void conn_drop_target(struct wayland_display *c, enum yasl_drop_event ev, struct wl_surface *on, double x, double y) { - struct yasl_surface *w = conn_surface_for(c, on); + struct wayland_surface *w = conn_surface_for(c, on); if (!w || w->parent || !w->cbs->drop) return; - w->cbs->drop(w, ev, drag_device_pos(w, x, y), w->ud); + w->cbs->drop(&w->base, ev, drag_device_pos(w, x, y), w->ud); } -void conn_drag_target(struct yasl_display *c, enum yasl_drag_event ev, +void conn_drag_target(struct wayland_display *c, enum yasl_drag_event ev, struct wl_surface *on, double x, double y) { - struct yasl_surface *w = conn_surface_for(c, on); + struct wayland_surface *w = conn_surface_for(c, on); if (!w || w->parent || !w->cbs->drag) return; - w->cbs->drag(w, ev, drag_device_pos(w, x, y), w->ud); + w->cbs->drag(&w->base, ev, drag_device_pos(w, x, y), w->ud); } |
