@@ -438,6 +438,8 @@ typedef struct CoreData {
438
438
int charPressedQueue [MAX_CHAR_PRESSED_QUEUE ]; // Input characters queue (unicode)
439
439
int charPressedQueueCount ; // Input characters queue count
440
440
441
+ PreeditCallback preeditCallback ; // Preedit callback
442
+
441
443
#if defined(PLATFORM_RPI ) || defined(PLATFORM_DRM )
442
444
int defaultMode ; // Default keyboard mode
443
445
#if defined(SUPPORT_SSH_KEYBOARD_RPI )
@@ -639,6 +641,7 @@ static void WindowDropCallback(GLFWwindow *window, int count, const char **paths
639
641
// Input callbacks events
640
642
static void KeyCallback (GLFWwindow * window , int key , int scancode , int action , int mods ); // GLFW3 Keyboard Callback, runs on key pressed
641
643
static void CharCallback (GLFWwindow * window , unsigned int key ); // GLFW3 Char Key Callback, runs on key pressed (get char value)
644
+ static void PreeditCallbackInner (GLFWwindow * window , int preeditLength , unsigned int * preeditString , int blockCount , int * blockSizes , int focusedBlock , int caret ); // GLFW3 Preedit Callback
642
645
static void MouseButtonCallback (GLFWwindow * window , int button , int action , int mods ); // GLFW3 Mouse Button Callback, runs on mouse button pressed
643
646
static void MouseCursorPosCallback (GLFWwindow * window , double x , double y ); // GLFW3 Cursor Position Callback, runs on mouse move
644
647
static void MouseScrollCallback (GLFWwindow * window , double xoffset , double yoffset ); // GLFW3 Srolling Callback, runs on mouse wheel
@@ -3548,6 +3551,12 @@ int GetCharPressed(void)
3548
3551
return value ;
3549
3552
}
3550
3553
3554
+ // Set a callback for preedit
3555
+ void SetPreeditCallback (PreeditCallback callback )
3556
+ {
3557
+ CORE .Input .Keyboard .preeditCallback = callback ;
3558
+ }
3559
+
3551
3560
// Set a custom key to exit program
3552
3561
// NOTE: default exitKey is ESCAPE
3553
3562
void SetExitKey (int key )
@@ -4144,6 +4153,7 @@ static bool InitGraphicsDevice(int width, int height)
4144
4153
// Set input callback events
4145
4154
glfwSetKeyCallback (CORE .Window .handle , KeyCallback );
4146
4155
glfwSetCharCallback (CORE .Window .handle , CharCallback );
4156
+ glfwSetPreeditCallback (CORE .Window .handle , PreeditCallbackInner );
4147
4157
glfwSetMouseButtonCallback (CORE .Window .handle , MouseButtonCallback );
4148
4158
glfwSetCursorPosCallback (CORE .Window .handle , MouseCursorPosCallback ); // Track mouse position changes
4149
4159
glfwSetScrollCallback (CORE .Window .handle , MouseScrollCallback );
@@ -5383,6 +5393,14 @@ static void CharCallback(GLFWwindow *window, unsigned int key)
5383
5393
}
5384
5394
}
5385
5395
5396
+ // GLFW3 Preedit Callback
5397
+ static void PreeditCallbackInner (GLFWwindow * window , int preeditLength , unsigned int * preeditString , int blockCount , int * blockSizes , int focusedBlock , int caret )
5398
+ {
5399
+ if (!CORE .Input .Keyboard .preeditCallback ) return ;
5400
+ CORE .Input .Keyboard .preeditCallback (preeditLength , (int * )preeditString , blockCount , blockSizes , focusedBlock , caret );
5401
+ }
5402
+
5403
+
5386
5404
// GLFW3 Mouse Button Callback, runs on mouse button pressed
5387
5405
static void MouseButtonCallback (GLFWwindow * window , int button , int action , int mods )
5388
5406
{
0 commit comments