Skip to content

Commit d004c66

Browse files
daipomashie
authored andcommitted
Add API: SetImeStatus
This is for GLFW3: glfwSetInputMode (mode: GLFW_IME)
1 parent 8d5d9cc commit d004c66

File tree

7 files changed

+39
-0
lines changed

7 files changed

+39
-0
lines changed

src/platforms/rcore_android.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -626,6 +626,12 @@ bool IsImeOn(void)
626626
return false;
627627
}
628628

629+
// Set IME status
630+
void SetImeStatus(bool on)
631+
{
632+
TRACELOG(LOG_WARNING, "SetImeStatus() not implemented on target platform");
633+
}
634+
629635
// Set internal gamepad mappings
630636
int SetGamepadMappings(const char *mappings)
631637
{

src/platforms/rcore_desktop_glfw.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1062,6 +1062,13 @@ bool IsImeOn(void)
10621062
return false;
10631063
}
10641064

1065+
// Set IME status
1066+
void SetImeStatus(bool on)
1067+
{
1068+
if (on) glfwSetInputMode(platform.handle, GLFW_IME, GLFW_TRUE);
1069+
else glfwSetInputMode(platform.handle, GLFW_IME, GLFW_FALSE);
1070+
}
1071+
10651072
// Set internal gamepad mappings
10661073
int SetGamepadMappings(const char *mappings)
10671074
{

src/platforms/rcore_desktop_sdl.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -947,6 +947,12 @@ bool IsImeOn(void)
947947
return false;
948948
}
949949

950+
// Set IME status
951+
void SetImeStatus(bool on)
952+
{
953+
TRACELOG(LOG_WARNING, "SetImeStatus() not implemented on target platform");
954+
}
955+
950956
// Set internal gamepad mappings
951957
int SetGamepadMappings(const char *mappings)
952958
{

src/platforms/rcore_drm.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -622,6 +622,12 @@ bool IsImeOn(void)
622622
return false;
623623
}
624624

625+
// Set IME status
626+
void SetImeStatus(bool on)
627+
{
628+
TRACELOG(LOG_WARNING, "SetImeStatus() not implemented on target platform");
629+
}
630+
625631
// Set internal gamepad mappings
626632
int SetGamepadMappings(const char *mappings)
627633
{

src/platforms/rcore_template.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -384,6 +384,12 @@ bool IsImeOn(void)
384384
return false;
385385
}
386386

387+
// Set IME status
388+
void SetImeStatus(bool on)
389+
{
390+
TRACELOG(LOG_WARNING, "SetImeStatus() not implemented on target platform");
391+
}
392+
387393
// Set internal gamepad mappings
388394
int SetGamepadMappings(const char *mappings)
389395
{

src/platforms/rcore_web.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -868,6 +868,13 @@ bool IsImeOn(void)
868868
return false;
869869
}
870870

871+
// Set IME status
872+
void SetImeStatus(bool on)
873+
{
874+
if (on) glfwSetInputMode(platform.handle, GLFW_IME, GLFW_TRUE);
875+
else glfwSetInputMode(platform.handle, GLFW_IME, GLFW_FALSE);
876+
}
877+
871878
// Set internal gamepad mappings
872879
int SetGamepadMappings(const char *mappings)
873880
{

src/raylib.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1174,6 +1174,7 @@ RLAPI void SetPreeditCallback(PreeditCallback callback); // Set a callback
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
11761176
RLAPI bool IsImeOn(void); // Check if IME is ON
1177+
RLAPI void SetImeStatus(bool on); // Set IME status
11771178

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

0 commit comments

Comments
 (0)