From c2286f280449b6ede1186695dc9ede25b8c79d00 Mon Sep 17 00:00:00 2001 From: Daijiro Fukuda Date: Fri, 26 Aug 2022 17:40:27 +0900 Subject: [PATCH] Add API: ResetPreedit This is for GLFW3: glfwResetPreeditText --- src/platforms/rcore_android.c | 6 ++++++ src/platforms/rcore_desktop_glfw.c | 6 ++++++ src/platforms/rcore_desktop_sdl.c | 6 ++++++ src/platforms/rcore_drm.c | 6 ++++++ src/platforms/rcore_template.c | 6 ++++++ src/platforms/rcore_web.c | 6 ++++++ src/raylib.h | 1 + 7 files changed, 37 insertions(+) diff --git a/src/platforms/rcore_android.c b/src/platforms/rcore_android.c index 8ca1738f7..7e54a8c6a 100644 --- a/src/platforms/rcore_android.c +++ b/src/platforms/rcore_android.c @@ -632,6 +632,12 @@ void SetImeStatus(bool on) TRACELOG(LOG_WARNING, "SetImeStatus() not implemented on target platform"); } +// Reset preedit text +void ResetPreedit(void) +{ + TRACELOG(LOG_WARNING, "ResetPreedit() not implemented on target platform"); +} + // Set internal gamepad mappings int SetGamepadMappings(const char *mappings) { diff --git a/src/platforms/rcore_desktop_glfw.c b/src/platforms/rcore_desktop_glfw.c index e0a7da1c9..933154024 100644 --- a/src/platforms/rcore_desktop_glfw.c +++ b/src/platforms/rcore_desktop_glfw.c @@ -1069,6 +1069,12 @@ void SetImeStatus(bool on) else glfwSetInputMode(platform.handle, GLFW_IME, GLFW_FALSE); } +// Reset preedit text +void ResetPreedit(void) +{ + glfwResetPreeditText(platform.handle); +} + // Set internal gamepad mappings int SetGamepadMappings(const char *mappings) { diff --git a/src/platforms/rcore_desktop_sdl.c b/src/platforms/rcore_desktop_sdl.c index af27e1bb4..4ad1e0818 100644 --- a/src/platforms/rcore_desktop_sdl.c +++ b/src/platforms/rcore_desktop_sdl.c @@ -953,6 +953,12 @@ void SetImeStatus(bool on) TRACELOG(LOG_WARNING, "SetImeStatus() not implemented on target platform"); } +// Reset preedit text +void ResetPreedit(void) +{ + TRACELOG(LOG_WARNING, "ResetPreedit() not implemented on target platform"); +} + // Set internal gamepad mappings int SetGamepadMappings(const char *mappings) { diff --git a/src/platforms/rcore_drm.c b/src/platforms/rcore_drm.c index 8788927b9..788ff27b8 100644 --- a/src/platforms/rcore_drm.c +++ b/src/platforms/rcore_drm.c @@ -628,6 +628,12 @@ void SetImeStatus(bool on) TRACELOG(LOG_WARNING, "SetImeStatus() not implemented on target platform"); } +// Reset preedit text +void ResetPreedit(void) +{ + TRACELOG(LOG_WARNING, "ResetPreedit() not implemented on target platform"); +} + // Set internal gamepad mappings int SetGamepadMappings(const char *mappings) { diff --git a/src/platforms/rcore_template.c b/src/platforms/rcore_template.c index ab3720b1b..77af80c75 100644 --- a/src/platforms/rcore_template.c +++ b/src/platforms/rcore_template.c @@ -390,6 +390,12 @@ void SetImeStatus(bool on) TRACELOG(LOG_WARNING, "SetImeStatus() not implemented on target platform"); } +// Reset preedit text +void ResetPreedit(void) +{ + TRACELOG(LOG_WARNING, "ResetPreedit() not implemented on target platform"); +} + // Set internal gamepad mappings int SetGamepadMappings(const char *mappings) { diff --git a/src/platforms/rcore_web.c b/src/platforms/rcore_web.c index ae7bff656..b3dcd2834 100644 --- a/src/platforms/rcore_web.c +++ b/src/platforms/rcore_web.c @@ -875,6 +875,12 @@ void SetImeStatus(bool on) else glfwSetInputMode(platform.handle, GLFW_IME, GLFW_FALSE); } +// Reset preedit text +void ResetPreedit(void) +{ + glfwResetPreeditText(platform.handle); +} + // Set internal gamepad mappings int SetGamepadMappings(const char *mappings) { diff --git a/src/raylib.h b/src/raylib.h index 19329ff58..c651f75e4 100644 --- a/src/raylib.h +++ b/src/raylib.h @@ -1175,6 +1175,7 @@ RLAPI void SetPreeditCursorRectangle(int x, int y, int w, int h); // Set the pre RLAPI void GetPreeditCursorRectangle(int *x, int *y, int *w, int *h); // Get the preedit cursor area RLAPI bool IsImeOn(void); // Check if IME is ON RLAPI void SetImeStatus(bool on); // Set IME status +RLAPI void ResetPreedit(void); // Reset preedit text // Input-related functions: gamepads RLAPI bool IsGamepadAvailable(int gamepad); // Check if a gamepad is available