@@ -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
@@ -3543,6 +3546,12 @@ int GetCharPressed(void)
3543
3546
return value ;
3544
3547
}
3545
3548
3549
+ // Set a callback for preedit
3550
+ void SetPreeditCallback (PreeditCallback callback )
3551
+ {
3552
+ CORE .Input .Keyboard .preeditCallback = callback ;
3553
+ }
3554
+
3546
3555
// Set a custom key to exit program
3547
3556
// NOTE: default exitKey is ESCAPE
3548
3557
void SetExitKey (int key )
@@ -4139,6 +4148,7 @@ static bool InitGraphicsDevice(int width, int height)
4139
4148
// Set input callback events
4140
4149
glfwSetKeyCallback (CORE .Window .handle , KeyCallback );
4141
4150
glfwSetCharCallback (CORE .Window .handle , CharCallback );
4151
+ glfwSetPreeditCallback (CORE .Window .handle , PreeditCallbackInner );
4142
4152
glfwSetMouseButtonCallback (CORE .Window .handle , MouseButtonCallback );
4143
4153
glfwSetCursorPosCallback (CORE .Window .handle , MouseCursorPosCallback ); // Track mouse position changes
4144
4154
glfwSetScrollCallback (CORE .Window .handle , MouseScrollCallback );
@@ -5378,6 +5388,14 @@ static void CharCallback(GLFWwindow *window, unsigned int key)
5378
5388
}
5379
5389
}
5380
5390
5391
+ // GLFW3 Preedit Callback
5392
+ static void PreeditCallbackInner (GLFWwindow * window , int preeditLength , unsigned int * preeditString , int blockCount , int * blockSizes , int focusedBlock , int caret )
5393
+ {
5394
+ if (!CORE .Input .Keyboard .preeditCallback ) return ;
5395
+ CORE .Input .Keyboard .preeditCallback (preeditLength , (int * )preeditString , blockCount , blockSizes , focusedBlock , caret );
5396
+ }
5397
+
5398
+
5381
5399
// GLFW3 Mouse Button Callback, runs on mouse button pressed
5382
5400
static void MouseButtonCallback (GLFWwindow * window , int button , int action , int mods )
5383
5401
{
0 commit comments