From 6eac0a5f2c552728efca420b1129fae7d4fea773 Mon Sep 17 00:00:00 2001 From: Berke Güzel Date: Sun, 11 Oct 2026 23:40:57 +0300 Subject: feat: backend selection (Wayland, X11, Cocoa) --- src/wayland/keyboard.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) (limited to 'src/wayland/keyboard.c') diff --git a/src/wayland/keyboard.c b/src/wayland/keyboard.c index 7283d58..1746ac6 100644 --- a/src/wayland/keyboard.c +++ b/src/wayland/keyboard.c @@ -112,13 +112,13 @@ static void keyboard_keymap(void *data, struct wl_keyboard *keyboard, } } -static void keyboard_reset_keys(struct seat *s, struct yasl_surface *w) +static void keyboard_reset_keys(struct seat *s, struct wayland_surface *w) { (void)w; keyboard_repeat_stop(s); } -bool conn_keyboard_on(const struct yasl_display *c, const struct yasl_surface *w, +bool conn_keyboard_on(const struct wayland_display *c, const struct wayland_surface *w, const struct seat *except) { for (const struct seat *s = c->seats; s; s = s->next) @@ -127,11 +127,11 @@ bool conn_keyboard_on(const struct yasl_display *c, const struct yasl_surface *w return false; } -static void push_focus(struct yasl_surface *w, bool focused) +static void push_focus(struct wayland_surface *w, bool focused) { struct yasl_input_event ev = { .kind = YASL_INPUT_FOCUS, - .surface = w, + .surface = &w->base, .focus = { .focused = focused }, }; input_queue_push(&w->input, &ev); @@ -142,7 +142,7 @@ static void keyboard_enter(void *data, struct wl_keyboard *keyboard, { (void)keyboard; (void)serial; (void)keys; struct seat *s = data; - struct yasl_surface *w = surface_root(conn_surface_for(s->conn, surface)); + struct wayland_surface *w = surface_root(conn_surface_for(s->conn, surface)); bool same_window = w && w == s->focus_leaving; if (same_window) s->focus_leaving = NULL; @@ -159,7 +159,7 @@ static void keyboard_enter(void *data, struct wl_keyboard *keyboard, static void seat_settle_focus(struct seat *s) { - struct yasl_surface *w = s->focus_leaving; + struct wayland_surface *w = s->focus_leaving; if (!w) return; s->focus_leaving = NULL; @@ -167,7 +167,7 @@ static void seat_settle_focus(struct seat *s) push_focus(w, false); } -void keyboard_settle_focus(struct yasl_display *c) +void keyboard_settle_focus(struct wayland_display *c) { for (struct seat *s = c->seats; s; s = s->next) seat_settle_focus(s); @@ -178,7 +178,7 @@ static void keyboard_leave(void *data, struct wl_keyboard *keyboard, { (void)keyboard; (void)serial; (void)surface; struct seat *s = data; - struct yasl_surface *w = s->keyboard_focus; + struct wayland_surface *w = s->keyboard_focus; s->keyboard_focus = NULL; if (!w) return; keyboard_reset_keys(s, w); @@ -231,7 +231,7 @@ static struct yasl_key_event xkb_key_event(struct seat *s, uint32_t key, return k; } -static bool keyboard_dispatch_key(struct seat *s, struct yasl_surface *w, uint32_t key, +static bool keyboard_dispatch_key(struct seat *s, struct wayland_surface *w, uint32_t key, enum yasl_key_action action) { if (!s->xkb_state || !w->cbs) return false; @@ -239,7 +239,7 @@ static bool keyboard_dispatch_key(struct seat *s, struct yasl_surface *w, uint32 struct yasl_key_event k = xkb_key_event(s, key, action); struct yasl_input_event ev = { .kind = YASL_INPUT_KEY, - .surface = w, + .surface = &w->base, .key = k, }; input_queue_push(&w->input, &ev); @@ -251,7 +251,7 @@ static void keyboard_key(void *data, struct wl_keyboard *keyboard, { (void)keyboard; (void)time; struct seat *s = data; - struct yasl_surface *w = s->keyboard_focus; + struct wayland_surface *w = s->keyboard_focus; if (!w) return; seat_note_input(s, serial); if (state == WL_KEYBOARD_KEY_STATE_RELEASED) { @@ -276,7 +276,7 @@ static int keyboard_repeat_ready(int fd, short revents, void *data) uint64_t count; if (!(revents & POLLIN) || read(fd, &count, sizeof(count)) != sizeof(count)) return 0; - struct yasl_surface *w = s->keyboard_focus; + struct wayland_surface *w = s->keyboard_focus; if (!w) { keyboard_repeat_stop(s); return 0; @@ -355,12 +355,12 @@ int seat_modifiers(const struct seat *s) return mods; } -int yasl_display_modifiers(const struct yasl_display *c) +int wayland_display_modifiers(const struct wayland_display *c) { return c ? seat_modifiers(conn_active_seat(c)) : 0; } -void yasl_display_copy(struct yasl_display *c, enum yasl_selection sel, const char *text) +void wayland_display_copy(struct wayland_display *c, enum yasl_selection sel, const char *text) { struct seat *s = c ? conn_active_seat(c) : NULL; if (!s || !s->clipboard) @@ -371,7 +371,7 @@ void yasl_display_copy(struct yasl_display *c, enum yasl_selection sel, const ch clipboard_copy(s->clipboard, text, s->input_serial); } -void yasl_display_paste(struct yasl_display *c, enum yasl_selection sel, struct yasl_surface *target) +void wayland_display_paste(struct wayland_display *c, enum yasl_selection sel, struct wayland_surface *target) { struct seat *s = c ? conn_active_seat(c) : NULL; if (!s || !s->clipboard) @@ -383,7 +383,7 @@ void yasl_display_paste(struct yasl_display *c, enum yasl_selection sel, struct clipboard_paste(s->clipboard); } -bool yasl_surface_input_poll(struct yasl_surface *w, struct yasl_input_event *ev) +bool wayland_surface_input_poll(struct wayland_surface *w, struct yasl_input_event *ev) { return w && ev && input_queue_pop(&w->input, ev); } -- cgit v1.2.3