From 61e75e4a12f199368f28dd274d83fc4ecd9cfec3 Mon Sep 17 00:00:00 2001 From: ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> Date: Mon, 19 Jan 2026 16:34:50 +0100 Subject: All platforms use same code to remove context-dependent codepoints from text input. This commit introduces function fl_utf8_remove_context_dependent() that removes from an UTF-8 string its context-dependent codepoints. Platforms macOS, Wayland and X11 call this function to process UTF-8 text received from a character palette as input to FLTK text. This makes sure FLTK text-editing widgets process textual input equally and consistently across platforms, especially emojis entered via a palette. Platform Windows creates a series of separate system events to input an emoji via the character palette. For this reason, function fl_utf8_remove_context_dependent() is not used by this platform which does internally the same filtering of context- dependent codepoints. --- src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/drivers/Wayland') diff --git a/src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx b/src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx index c474867d5..3816dff2c 100644 --- a/src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx +++ b/src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx @@ -53,6 +53,7 @@ extern "C" { bool fl_is_surface_from_GTK_titlebar (struct wl_surface *surface, struct libdecor_frame *frame, bool *using_GTK); } +extern int fl_utf8_remove_context_dependent(char *text, int len); // set this to 1 for keyboard debug output, 0 for no debug output #define DEBUG_KEYBOARD 0 @@ -1017,6 +1018,7 @@ void text_input_commit_string(void *data, struct zwp_text_input_v3 *zwp_text_inp //printf("text_input_commit_string %s\n",text); free(pending_commit); pending_commit = text ? strdup(text) : NULL; + fl_utf8_remove_context_dependent(pending_commit, strlen(pending_commit)); } -- cgit v1.2.3