summaryrefslogtreecommitdiff
path: root/src/platform/wayland/keyboard.c
diff options
context:
space:
mode:
authorBerke Güzel <wenekar1@gmail.com>2026-10-13 15:41:39 +0300
committerBerke Güzel <wenekar1@gmail.com>2026-10-13 15:41:39 +0300
commit537b2d768b31deb0f95c5122e0d562e4406ae9a0 (patch)
treecc3e85cb2990672c11b4e35c6dbcfaac733d09f5 /src/platform/wayland/keyboard.c
parent98f0d51157fa2a2b8ccaae54ed4850a88d223d01 (diff)
Unify core and runner events into struct yasl_event
The core input queue and the yasl_run() runner each had their own event type, and the runner translated one into the other. Both now share struct yasl_event in <yasl/yasl.h>: yasl_surface_poll_event() returns the same events the app event callback receives, so the runner forwards them unchanged. Pointer input becomes POINTER_DOWN/UP/MOTION/SCROLL/LEAVE with a named yasl_pointer_button and a motion delta computed in the input queue. TEXT, PASTE and DROP share one text payload, scale changes fold into WINDOW_RESIZE, and every event carries a monotonic time_ns. yasl_surface_set_mouse_mode() is replaced by yasl_surface_set_pointer_mode(); no backend implements relative mode yet. The export check now only counts YASL_API declarations, so function pointer fields returning enum yasl_app_result are not mistaken for exports. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'src/platform/wayland/keyboard.c')
-rw-r--r--src/platform/wayland/keyboard.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/platform/wayland/keyboard.c b/src/platform/wayland/keyboard.c
index ebd0fc7..038ba78 100644
--- a/src/platform/wayland/keyboard.c
+++ b/src/platform/wayland/keyboard.c
@@ -133,8 +133,8 @@ bool conn_keyboard_on(const struct wayland_display *c, const struct wayland_surf
static void push_focus(struct wayland_surface *w, bool focused)
{
- struct yasl_input_event ev = {
- .kind = YASL_INPUT_FOCUS,
+ struct yasl_event ev = {
+ .type = YASL_EVENT_FOCUS,
.surface = &w->base,
.focus = { .focused = focused },
};
@@ -278,13 +278,13 @@ static void keyboard_text(struct seat *s, struct wayland_surface *w, uint32_t ke
else xkb_state_key_get_utf8(s->xkb_state, code, text, (size_t)len + 1);
/* Editing commands belong to key events, not text insertion. */
if ((unsigned char)text[0] >= 0x20 && text[0] != 0x7f) {
- struct yasl_input_event ev = {.kind = YASL_INPUT_TEXT,
- .surface = &w->base, .text = {text, (size_t)len}};
+ struct yasl_event ev = {.type = YASL_EVENT_TEXT,
+ .surface = &w->base, .text = {.data = text, .len = (size_t)len}};
input_queue_push(&w->input, &ev);
}
if (text != local) free(text);
} else {
- struct yasl_input_event ev = {.kind = YASL_INPUT_RESET, .surface = &w->base};
+ struct yasl_event ev = {.type = YASL_EVENT_INPUT_RESET, .surface = &w->base};
input_queue_push(&w->input, &ev);
}
}
@@ -297,8 +297,8 @@ static bool keyboard_dispatch_key(struct seat *s, struct wayland_surface *w, uin
if (!s->xkb_state || !w->cbs) return false;
struct yasl_key_event k = xkb_key_event(s, key, action);
- struct yasl_input_event ev = {
- .kind = YASL_INPUT_KEY,
+ struct yasl_event ev = {
+ .type = YASL_EVENT_KEY,
.surface = &w->base,
.key = k,
};
@@ -448,7 +448,7 @@ void wayland_display_paste(struct wayland_display *c, enum yasl_selection sel, s
clipboard_paste(s->clipboard, target->surface);
}
-bool wayland_surface_input_poll(struct wayland_surface *w, struct yasl_input_event *ev)
+bool wayland_surface_poll_event(struct wayland_surface *w, struct yasl_event *ev)
{
return w && ev && input_queue_pop(&w->input, ev);
}