mirror of
https://github.com/glfw/glfw.git
synced 2025-06-14 19:52:14 +00:00
Add comments and reshape codes
This commit is contained in:
parent
89c7e252f9
commit
52f0ca1ab6
11
src/input.c
11
src/input.c
@ -313,14 +313,23 @@ void _glfwInputChar(_GLFWwindow* window, uint32_t codepoint, int mods, GLFWbool
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Notifies shrared code of a preedit event
|
||||||
|
//
|
||||||
void _glfwInputPreedit(_GLFWwindow* window, int focusedBlock)
|
void _glfwInputPreedit(_GLFWwindow* window, int focusedBlock)
|
||||||
{
|
{
|
||||||
if (window->callbacks.preedit)
|
if (window->callbacks.preedit)
|
||||||
{
|
{
|
||||||
window->callbacks.preedit((GLFWwindow*) window, window->ntext, window->preeditText, window->nblocks, window->preeditAttributeBlocks, focusedBlock);
|
window->callbacks.preedit((GLFWwindow*) window,
|
||||||
|
window->ntext,
|
||||||
|
window->preeditText,
|
||||||
|
window->nblocks,
|
||||||
|
window->preeditAttributeBlocks,
|
||||||
|
focusedBlock);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Notifies shared code of a IME status event
|
||||||
|
//
|
||||||
void _glfwInputIMEStatus(_GLFWwindow* window)
|
void _glfwInputIMEStatus(_GLFWwindow* window)
|
||||||
{
|
{
|
||||||
if (window->callbacks.imestatus)
|
if (window->callbacks.imestatus)
|
||||||
|
@ -568,6 +568,8 @@ static void maximizeWindowManually(_GLFWwindow* window)
|
|||||||
SWP_NOACTIVATE | SWP_NOZORDER | SWP_FRAMECHANGED);
|
SWP_NOACTIVATE | SWP_NOZORDER | SWP_FRAMECHANGED);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Get preedit texts of Imm32 and path them to preedit-callback
|
||||||
|
//
|
||||||
static GLFWbool getImmPreedit(_GLFWwindow* window)
|
static GLFWbool getImmPreedit(_GLFWwindow* window)
|
||||||
{
|
{
|
||||||
HIMC hIMC = ImmGetContext(window->win32.handle);
|
HIMC hIMC = ImmGetContext(window->win32.handle);
|
||||||
@ -668,6 +670,8 @@ static GLFWbool getImmPreedit(_GLFWwindow* window)
|
|||||||
return GLFW_TRUE;
|
return GLFW_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Commit the result texts of Imm32 to character-callback
|
||||||
|
//
|
||||||
static GLFWbool commitImmResultStr(_GLFWwindow* window)
|
static GLFWbool commitImmResultStr(_GLFWwindow* window)
|
||||||
{
|
{
|
||||||
HIMC hIMC;
|
HIMC hIMC;
|
||||||
|
@ -556,6 +556,8 @@ static void _ximPreeditDoneCallback(XIC xic, XPointer clientData, XPointer callD
|
|||||||
}
|
}
|
||||||
|
|
||||||
// IME Draw callback
|
// IME Draw callback
|
||||||
|
// When using the dafault style: STYLE_OVERTHESPOT, this is not used since applications
|
||||||
|
// don't need to display preedit texts.
|
||||||
//
|
//
|
||||||
static void _ximPreeditDrawCallback(XIC xic, XPointer clientData, XIMPreeditDrawCallbackStruct *callData)
|
static void _ximPreeditDrawCallback(XIC xic, XPointer clientData, XIMPreeditDrawCallbackStruct *callData)
|
||||||
{
|
{
|
||||||
@ -678,18 +680,30 @@ static void _ximPreeditCaretCallback(XIC xic, XPointer clientData, XPointer call
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// IME Status Start callback
|
||||||
|
// When using the dafault style: STYLE_OVERTHESPOT, this is not used and the IME status
|
||||||
|
// can not be taken.
|
||||||
|
//
|
||||||
static void _ximStatusStartCallback(XIC xic, XPointer clientData, XPointer callData)
|
static void _ximStatusStartCallback(XIC xic, XPointer clientData, XPointer callData)
|
||||||
{
|
{
|
||||||
_GLFWwindow* window = (_GLFWwindow*) clientData;
|
_GLFWwindow* window = (_GLFWwindow*) clientData;
|
||||||
window->x11.imeFocus = GLFW_TRUE;
|
window->x11.imeFocus = GLFW_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// IME Status Done callback
|
||||||
|
// When using the dafault style: STYLE_OVERTHESPOT, this is not used and the IME status
|
||||||
|
// can not be taken.
|
||||||
|
//
|
||||||
static void _ximStatusDoneCallback(XIC xic, XPointer clientData, XPointer callData)
|
static void _ximStatusDoneCallback(XIC xic, XPointer clientData, XPointer callData)
|
||||||
{
|
{
|
||||||
_GLFWwindow* window = (_GLFWwindow*) clientData;
|
_GLFWwindow* window = (_GLFWwindow*) clientData;
|
||||||
window->x11.imeFocus = GLFW_FALSE;
|
window->x11.imeFocus = GLFW_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// IME Status Draw callback
|
||||||
|
// When using the dafault style: STYLE_OVERTHESPOT, this is not used and the IME status
|
||||||
|
// can not be taken.
|
||||||
|
//
|
||||||
static void _ximStatusDrawCallback(XIC xic, XPointer clientData, XIMStatusDrawCallbackStruct* callData)
|
static void _ximStatusDrawCallback(XIC xic, XPointer clientData, XIMStatusDrawCallbackStruct* callData)
|
||||||
{
|
{
|
||||||
_GLFWwindow* window = (_GLFWwindow*) clientData;
|
_GLFWwindow* window = (_GLFWwindow*) clientData;
|
||||||
@ -697,6 +711,8 @@ static void _ximStatusDrawCallback(XIC xic, XPointer clientData, XIMStatusDrawCa
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Create XIM Preedit callback
|
// Create XIM Preedit callback
|
||||||
|
// When using the dafault style: STYLE_OVERTHESPOT, this is not used since applications
|
||||||
|
// don't need to display preedit texts.
|
||||||
//
|
//
|
||||||
static XVaNestedList _createXIMPreeditCallbacks(_GLFWwindow* window)
|
static XVaNestedList _createXIMPreeditCallbacks(_GLFWwindow* window)
|
||||||
{
|
{
|
||||||
@ -721,6 +737,8 @@ static XVaNestedList _createXIMPreeditCallbacks(_GLFWwindow* window)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Create XIM status callback
|
// Create XIM status callback
|
||||||
|
// When using the dafault style: STYLE_OVERTHESPOT, this is not used and the IME status
|
||||||
|
// can not be taken.
|
||||||
//
|
//
|
||||||
static XVaNestedList _createXIMStatusCallbacks(_GLFWwindow* window)
|
static XVaNestedList _createXIMStatusCallbacks(_GLFWwindow* window)
|
||||||
{
|
{
|
||||||
@ -2065,6 +2083,9 @@ void _glfwCreateInputContextX11(_GLFWwindow* window)
|
|||||||
|
|
||||||
if (_glfw.x11.imStyle == STYLE_ONTHESPOT)
|
if (_glfw.x11.imStyle == STYLE_ONTHESPOT)
|
||||||
{
|
{
|
||||||
|
// On X11, on-the-spot style is unstable.
|
||||||
|
// Status callbacks are not called and the preedit cursor position
|
||||||
|
// can not be changed.
|
||||||
XVaNestedList preeditList = _createXIMPreeditCallbacks(window);
|
XVaNestedList preeditList = _createXIMPreeditCallbacks(window);
|
||||||
XVaNestedList statusList = _createXIMStatusCallbacks(window);
|
XVaNestedList statusList = _createXIMStatusCallbacks(window);
|
||||||
|
|
||||||
@ -3229,6 +3250,8 @@ const char* _glfwGetClipboardStringX11(void)
|
|||||||
return getSelectionString(_glfw.x11.CLIPBOARD);
|
return getSelectionString(_glfw.x11.CLIPBOARD);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// When using STYLE_ONTHESPOT, this doesn't work and the cursor position can't be updated
|
||||||
|
//
|
||||||
void _glfwUpdatePreeditCursorPosX11(_GLFWwindow* window)
|
void _glfwUpdatePreeditCursorPosX11(_GLFWwindow* window)
|
||||||
{
|
{
|
||||||
XVaNestedList preedit_attr;
|
XVaNestedList preedit_attr;
|
||||||
|
Loading…
Reference in New Issue
Block a user