Skip to content

Commit 8d5d9cc

Browse files
daipomashie
authored andcommitted
Add API: IsImeOn
This is for GLFW3: glfwGetInputMode (mode: GLFW_IME)
1 parent 6c7e13e commit 8d5d9cc

File tree

7 files changed

+43
-0
lines changed

7 files changed

+43
-0
lines changed

src/platforms/rcore_android.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -619,6 +619,13 @@ void GetPreeditCursorRectangle(int *x, int *y, int *w, int *h)
619619
TRACELOG(LOG_WARNING, "GetPreeditCursorRectangle() not implemented on target platform");
620620
}
621621

622+
// Check if IME is ON
623+
bool IsImeOn(void)
624+
{
625+
TRACELOG(LOG_WARNING, "IsImeOn() not implemented on target platform");
626+
return false;
627+
}
628+
622629
// Set internal gamepad mappings
623630
int SetGamepadMappings(const char *mappings)
624631
{

src/platforms/rcore_desktop_glfw.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1055,6 +1055,13 @@ void GetPreeditCursorRectangle(int *x, int *y, int *w, int *h)
10551055
glfwGetPreeditCursorRectangle(platform.handle, x, y, w, h);
10561056
}
10571057

1058+
// Check if IME is ON
1059+
bool IsImeOn(void)
1060+
{
1061+
if (glfwGetInputMode(platform.handle, GLFW_IME) == GLFW_TRUE) return true;
1062+
return false;
1063+
}
1064+
10581065
// Set internal gamepad mappings
10591066
int SetGamepadMappings(const char *mappings)
10601067
{

src/platforms/rcore_desktop_sdl.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -940,6 +940,13 @@ void GetPreeditCursorRectangle(int *x, int *y, int *w, int *h)
940940
TRACELOG(LOG_WARNING, "GetPreeditCursorRectangle() not implemented on target platform");
941941
}
942942

943+
// Check if IME is ON
944+
bool IsImeOn(void)
945+
{
946+
TRACELOG(LOG_WARNING, "IsImeOn() not implemented on target platform");
947+
return false;
948+
}
949+
943950
// Set internal gamepad mappings
944951
int SetGamepadMappings(const char *mappings)
945952
{

src/platforms/rcore_drm.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -615,6 +615,13 @@ void GetPreeditCursorRectangle(int *x, int *y, int *w, int *h)
615615
TRACELOG(LOG_WARNING, "GetPreeditCursorRectangle() not implemented on target platform");
616616
}
617617

618+
// Check if IME is ON
619+
bool IsImeOn(void)
620+
{
621+
TRACELOG(LOG_WARNING, "IsImeOn() not implemented on target platform");
622+
return false;
623+
}
624+
618625
// Set internal gamepad mappings
619626
int SetGamepadMappings(const char *mappings)
620627
{

src/platforms/rcore_template.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,13 @@ void GetPreeditCursorRectangle(int *x, int *y, int *w, int *h)
377377
TRACELOG(LOG_WARNING, "GetPreeditCursorRectangle() not implemented on target platform");
378378
}
379379

380+
// Check if IME is ON
381+
bool IsImeOn(void)
382+
{
383+
TRACELOG(LOG_WARNING, "IsImeOn() not implemented on target platform");
384+
return false;
385+
}
386+
380387
// Set internal gamepad mappings
381388
int SetGamepadMappings(const char *mappings)
382389
{

src/platforms/rcore_web.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -861,6 +861,13 @@ void GetPreeditCursorRectangle(int *x, int *y, int *w, int *h)
861861
glfwGetPreeditCursorRectangle(platform.handle, x, y, w, h);
862862
}
863863

864+
// Check if IME is ON
865+
bool IsImeOn(void)
866+
{
867+
if (glfwGetInputMode(platform.handle, GLFW_IME) == GLFW_TRUE) return true;
868+
return false;
869+
}
870+
864871
// Set internal gamepad mappings
865872
int SetGamepadMappings(const char *mappings)
866873
{

src/raylib.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1173,6 +1173,7 @@ RLAPI void SetExitKey(int key); // Set a custom ke
11731173
RLAPI void SetPreeditCallback(PreeditCallback callback); // Set a callback for preedit
11741174
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
11751175
RLAPI void GetPreeditCursorRectangle(int *x, int *y, int *w, int *h); // Get the preedit cursor area
1176+
RLAPI bool IsImeOn(void); // Check if IME is ON
11761177

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

0 commit comments

Comments
 (0)