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