From 52182fcbec690c40a37099568e792ea8c284b131 Mon Sep 17 00:00:00 2001 From: Window Maker Date: Tue, 2 Jun 2026 16:10:42 +0200 Subject: [PATCH] decompose wl_backend.c: extract wl_text_input.c --- src/Makefile.am | 1 + src/backend/wayland/wl_backend.c | 47 ++-------------------------- src/backend/wayland/wl_text_input.c | 48 +++++++++++++++++++++++++++++ 3 files changed, 52 insertions(+), 44 deletions(-) create mode 100644 src/backend/wayland/wl_text_input.c diff --git a/src/Makefile.am b/src/Makefile.am index ae4c6c0..d147e21 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -190,6 +190,7 @@ wmaker_SOURCES += \ backend/wayland/wl_grab.c \ backend/wayland/wl_keyboard.c \ backend/wayland/wl_popup.c \ + backend/wayland/wl_text_input.c \ backend/wayland/wl_output_mgmt.c \ backend/wayland/wl_output.c \ backend/wayland/wl_xdg.c \ diff --git a/src/backend/wayland/wl_backend.c b/src/backend/wayland/wl_backend.c index 95f7ab6..2ecba3c 100644 --- a/src/backend/wayland/wl_backend.c +++ b/src/backend/wayland/wl_backend.c @@ -331,9 +331,9 @@ extern void handle_output_mgr_apply(struct wl_listener *listener, void *data); extern void handle_output_mgr_test(struct wl_listener *listener, void *data); extern void handle_output_power_set_mode(struct wl_listener *listener, void *data); /* Phase 34: text input, input method, virtual keyboard new-instance handlers. */ -static void handle_text_input_new(struct wl_listener *listener, void *data); -static void handle_input_method_new(struct wl_listener *listener, void *data); -static void handle_virtual_keyboard_new(struct wl_listener *listener, void *data); +extern void handle_text_input_new(struct wl_listener *listener, void *data); +extern void handle_input_method_new(struct wl_listener *listener, void *data); +extern void handle_virtual_keyboard_new(struct wl_listener *listener, void *data); /* Phase 35: xdg_activation request_activate handler. */ static void handle_xdg_activation_request(struct wl_listener *listener, void *data); /* Phase 36: layer shell new_surface handler. */ @@ -1703,47 +1703,6 @@ handle_new_shortcuts_inhibitor(struct wl_listener *listener, void *data) /* ------------------------------------------------------------------ */ /* ------------------------------------------------------------------ */ -/* Phase 34: text input v3, input method v2, virtual keyboard v1 */ -/* ------------------------------------------------------------------ */ - -/* - * handle_text_input_new — a client created a zwp_text_input_v3 object. - * Text input objects are managed entirely by wlroots; the compositor just - * needs to call wlr_text_input_v3_send_enter/leave to activate the IME - * for a focused surface. For now we log and do nothing — the IME framework - * will still register; full integration (enter on focus) can be added later. - */ -static void -handle_text_input_new(struct wl_listener *listener, void *data) -{ - (void)listener; (void)data; - wwarning("wl_backend: text input v3 object created"); -} - -/* - * handle_input_method_new — an IME server (ibus, fcitx5) connected. - * The input method protocol is symmetric with text_input; wlroots handles - * the protocol exchange. We log its arrival. - */ -static void -handle_input_method_new(struct wl_listener *listener, void *data) -{ - (void)listener; (void)data; - wwarning("wl_backend: input method v2 connected"); -} - -/* - * handle_virtual_keyboard_new — a client created a virtual keyboard device. - * wlroots has already created the wlr_virtual_keyboard_v1 and wired its - * input_device into the backend. We just log it; the seat will advertise - * the keyboard capability automatically via handle_backend_new_input. - */ -static void -handle_virtual_keyboard_new(struct wl_listener *listener, void *data) -{ - (void)listener; (void)data; - wwarning("wl_backend: virtual keyboard v1 created"); -} /* ------------------------------------------------------------------ */ /* Phase 35: foreign toplevel management + xdg_activation */ diff --git a/src/backend/wayland/wl_text_input.c b/src/backend/wayland/wl_text_input.c new file mode 100644 index 0000000..07d6771 --- /dev/null +++ b/src/backend/wayland/wl_text_input.c @@ -0,0 +1,48 @@ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif +#include +#include +#include "wl_types.h" + +/* Phase 34: text input v3, input method v2, virtual keyboard v1 */ +/* ------------------------------------------------------------------ */ + +/* + * handle_text_input_new — a client created a zwp_text_input_v3 object. + * Text input objects are managed entirely by wlroots; the compositor just + * needs to call wlr_text_input_v3_send_enter/leave to activate the IME + * for a focused surface. For now we log and do nothing — the IME framework + * will still register; full integration (enter on focus) can be added later. + */ +void +handle_text_input_new(struct wl_listener *listener, void *data) +{ + (void)listener; (void)data; + wwarning("wl_backend: text input v3 object created"); +} + +/* + * handle_input_method_new — an IME server (ibus, fcitx5) connected. + * The input method protocol is symmetric with text_input; wlroots handles + * the protocol exchange. We log its arrival. + */ +void +handle_input_method_new(struct wl_listener *listener, void *data) +{ + (void)listener; (void)data; + wwarning("wl_backend: input method v2 connected"); +} + +/* + * handle_virtual_keyboard_new — a client created a virtual keyboard device. + * wlroots has already created the wlr_virtual_keyboard_v1 and wired its + * input_device into the backend. We just log it; the seat will advertise + * the keyboard capability automatically via handle_backend_new_input. + */ +void +handle_virtual_keyboard_new(struct wl_listener *listener, void *data) +{ + (void)listener; (void)data; + wwarning("wl_backend: virtual keyboard v1 created"); +}