Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[rcore] Draft: IME support #2809

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add API: IsImeOn
This is for GLFW3: glfwGetInputMode (mode: GLFW_IME)
daipom authored and ashie committed Aug 19, 2024

Verified

This commit was signed with the committer’s verified signature.
Rendez Luis Merino
commit 8d5d9cc87490ec0b3c4fcaec1cd266664aefe65e
7 changes: 7 additions & 0 deletions src/platforms/rcore_android.c
Original file line number Diff line number Diff line change
@@ -619,6 +619,13 @@ void GetPreeditCursorRectangle(int *x, int *y, int *w, int *h)
TRACELOG(LOG_WARNING, "GetPreeditCursorRectangle() not implemented on target platform");
}

// Check if IME is ON
bool IsImeOn(void)
{
TRACELOG(LOG_WARNING, "IsImeOn() not implemented on target platform");
return false;
}

// Set internal gamepad mappings
int SetGamepadMappings(const char *mappings)
{
7 changes: 7 additions & 0 deletions src/platforms/rcore_desktop_glfw.c
Original file line number Diff line number Diff line change
@@ -1055,6 +1055,13 @@ void GetPreeditCursorRectangle(int *x, int *y, int *w, int *h)
glfwGetPreeditCursorRectangle(platform.handle, x, y, w, h);
}

// Check if IME is ON
bool IsImeOn(void)
{
if (glfwGetInputMode(platform.handle, GLFW_IME) == GLFW_TRUE) return true;
return false;
}

// Set internal gamepad mappings
int SetGamepadMappings(const char *mappings)
{
7 changes: 7 additions & 0 deletions src/platforms/rcore_desktop_sdl.c
Original file line number Diff line number Diff line change
@@ -940,6 +940,13 @@ void GetPreeditCursorRectangle(int *x, int *y, int *w, int *h)
TRACELOG(LOG_WARNING, "GetPreeditCursorRectangle() not implemented on target platform");
}

// Check if IME is ON
bool IsImeOn(void)
{
TRACELOG(LOG_WARNING, "IsImeOn() not implemented on target platform");
return false;
}

// Set internal gamepad mappings
int SetGamepadMappings(const char *mappings)
{
7 changes: 7 additions & 0 deletions src/platforms/rcore_drm.c
Original file line number Diff line number Diff line change
@@ -615,6 +615,13 @@ void GetPreeditCursorRectangle(int *x, int *y, int *w, int *h)
TRACELOG(LOG_WARNING, "GetPreeditCursorRectangle() not implemented on target platform");
}

// Check if IME is ON
bool IsImeOn(void)
{
TRACELOG(LOG_WARNING, "IsImeOn() not implemented on target platform");
return false;
}

// Set internal gamepad mappings
int SetGamepadMappings(const char *mappings)
{
7 changes: 7 additions & 0 deletions src/platforms/rcore_template.c
Original file line number Diff line number Diff line change
@@ -377,6 +377,13 @@ void GetPreeditCursorRectangle(int *x, int *y, int *w, int *h)
TRACELOG(LOG_WARNING, "GetPreeditCursorRectangle() not implemented on target platform");
}

// Check if IME is ON
bool IsImeOn(void)
{
TRACELOG(LOG_WARNING, "IsImeOn() not implemented on target platform");
return false;
}

// Set internal gamepad mappings
int SetGamepadMappings(const char *mappings)
{
7 changes: 7 additions & 0 deletions src/platforms/rcore_web.c
Original file line number Diff line number Diff line change
@@ -861,6 +861,13 @@ void GetPreeditCursorRectangle(int *x, int *y, int *w, int *h)
glfwGetPreeditCursorRectangle(platform.handle, x, y, w, h);
}

// Check if IME is ON
bool IsImeOn(void)
{
if (glfwGetInputMode(platform.handle, GLFW_IME) == GLFW_TRUE) return true;
return false;
}

// Set internal gamepad mappings
int SetGamepadMappings(const char *mappings)
{
1 change: 1 addition & 0 deletions src/raylib.h
Original file line number Diff line number Diff line change
@@ -1173,6 +1173,7 @@ RLAPI void SetExitKey(int key); // Set a custom ke
RLAPI void SetPreeditCallback(PreeditCallback callback); // Set a callback for preedit
RLAPI void SetPreeditCursorRectangle(int x, int y, int w, int h); // Set the preedit cursor area that is used to decide the position of the candidate window
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

// Input-related functions: gamepads
RLAPI bool IsGamepadAvailable(int gamepad); // Check if a gamepad is available