Skip to content

Commit 3a6ad34

Browse files
daipomashie
authored andcommitted
Add API: SetImeStatus
This is for GLFW3: glfwSetInputMode (mode: GLFW_IME)
1 parent 37fef37 commit 3a6ad34

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.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1055,6 +1055,13 @@ bool IsImeOn(void)
10551055
return false;
10561056
}
10571057

1058+
// Set IME status
1059+
void SetImeStatus(bool on)
1060+
{
1061+
if (on) glfwSetInputMode(platform.handle, GLFW_IME, GLFW_TRUE);
1062+
else glfwSetInputMode(platform.handle, GLFW_IME, GLFW_FALSE);
1063+
}
1064+
10581065
// Set internal gamepad mappings
10591066
int SetGamepadMappings(const char *mappings)
10601067
{

src/platforms/rcore_desktop_sdl.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -952,6 +952,12 @@ bool IsImeOn(void)
952952
return false;
953953
}
954954

955+
// Set IME status
956+
void SetImeStatus(bool on)
957+
{
958+
TRACELOG(LOG_WARNING, "SetImeStatus() not implemented on target platform");
959+
}
960+
955961
// Set internal gamepad mappings
956962
int SetGamepadMappings(const char *mappings)
957963
{

src/platforms/rcore_drm.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -532,6 +532,12 @@ bool IsImeOn(void)
532532
return false;
533533
}
534534

535+
// Set IME status
536+
void SetImeStatus(bool on)
537+
{
538+
TRACELOG(LOG_WARNING, "SetImeStatus() not implemented on target platform");
539+
}
540+
535541
// Set internal gamepad mappings
536542
int SetGamepadMappings(const char *mappings)
537543
{

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
@@ -863,6 +863,13 @@ bool IsImeOn(void)
863863
return false;
864864
}
865865

866+
// Set IME status
867+
void SetImeStatus(bool on)
868+
{
869+
if (on) glfwSetInputMode(platform.handle, GLFW_IME, GLFW_TRUE);
870+
else glfwSetInputMode(platform.handle, GLFW_IME, GLFW_FALSE);
871+
}
872+
866873
// Set internal gamepad mappings
867874
int SetGamepadMappings(const char *mappings)
868875
{

src/raylib.h

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

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

0 commit comments

Comments
 (0)