diff options
| author | Berke Güzel <wenekar1@gmail.com> | 2026-10-11 23:51:43 +0300 |
|---|---|---|
| committer | Berke Güzel <wenekar1@gmail.com> | 2026-10-11 23:51:43 +0300 |
| commit | e813252e685d761235ad45e170d97c9375f51958 (patch) | |
| tree | e57bae545c0eb22aac4119a890b8344ee7cd09d2 /src/wayland/keyboard.c | |
| parent | 608b49052178ea74f593c925cdeedf352aa1c357 (diff) | |
| parent | 6eac0a5f2c552728efca420b1129fae7d4fea773 (diff) | |
Merge branch 'backend-selection' into main
- Implement runtime backend selection (Wayland, X11, Cocoa)
- Add native X11 backend with clipboard, keyboard, mouse, and placement
- Integrate multi-backend integration tests running under Weston and Xwayland
- Retain zero-hole struct packing, branchless ALU/LUT primitives, and paced event loop
Diffstat (limited to 'src/wayland/keyboard.c')
| -rw-r--r-- | src/wayland/keyboard.c | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/src/wayland/keyboard.c b/src/wayland/keyboard.c index 6045962..6bdd58c 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; @@ -353,12 +353,12 @@ int seat_modifiers(const struct seat *s) (mod_index_active(s, s->mod_super) * YASL_MOD_SUPER); } -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) @@ -369,7 +369,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) @@ -381,7 +381,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); } |
