Changeset View
Changeset View
Standalone View
Standalone View
intern/ghost/intern/GHOST_SystemWin32.cpp
| Show First 20 Lines • Show All 1,213 Lines • ▼ Show 20 Lines | if (!is_repeated_modifier) { | ||||
| if (!keyDown) { | if (!keyDown) { | ||||
| utf8_char[0] = '\0'; | utf8_char[0] = '\0'; | ||||
| ascii = '\0'; | ascii = '\0'; | ||||
| } | } | ||||
| else { | else { | ||||
| ascii = utf8_char[0] & 0x80 ? '?' : utf8_char[0]; | ascii = utf8_char[0] & 0x80 ? '?' : utf8_char[0]; | ||||
| } | } | ||||
| #ifdef WITH_INPUT_IME | |||||
| if (window->getImeInput()->IsImeKeyEvent(ascii, key)) { | |||||
| return NULL; | |||||
| } | |||||
| #endif /* WITH_INPUT_IME */ | |||||
| event = new GHOST_EventKey(system->getMilliSeconds(), | event = new GHOST_EventKey(system->getMilliSeconds(), | ||||
| keyDown ? GHOST_kEventKeyDown : GHOST_kEventKeyUp, | keyDown ? GHOST_kEventKeyDown : GHOST_kEventKeyUp, | ||||
| window, | window, | ||||
| key, | key, | ||||
| ascii, | ascii, | ||||
| utf8_char, | utf8_char, | ||||
| is_repeat); | is_repeat); | ||||
| // GHOST_PRINTF("%c\n", ascii); // we already get this info via EventPrinter | // GHOST_PRINTF("%c\n", ascii); // we already get this info via EventPrinter | ||||
| #ifdef WITH_INPUT_IME | |||||
| window->getImeInput()->evt_ImeNotHandledEventCandidate = NULL; | |||||
| if (window->getImeInput()->IsImeKeyEventCandidateToForward(keyDown, key)) { | |||||
| /* When the IME is enabled, input events are superseded by WM_IME_STARTCOMPOSITION or | |||||
| * WM_IME_COMPOSITION messages. Therefore, NULL is returned here. However, some keys are | |||||
| * not handled by IME, so they are temporarily stored (evt_ImeNotHandledEventCandidate) and | |||||
| * used when WM_CHAR message is posted. */ | |||||
| window->getImeInput()->evt_ImeNotHandledEventCandidate = event; | |||||
| return NULL; | |||||
| } | |||||
| #endif /* WITH_INPUT_IME */ | |||||
| } | } | ||||
| else { | else { | ||||
| event = NULL; | event = NULL; | ||||
| } | } | ||||
| return event; | return event; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 230 Lines • ▼ Show 20 Lines | #ifdef WITH_INPUT_IME | ||||
| ime->UpdateConversionStatus(hwnd); | ime->UpdateConversionStatus(hwnd); | ||||
| ime->CreateImeWindow(hwnd); | ime->CreateImeWindow(hwnd); | ||||
| ime->CleanupComposition(hwnd); | ime->CleanupComposition(hwnd); | ||||
| ime->CheckFirst(hwnd); | ime->CheckFirst(hwnd); | ||||
| break; | break; | ||||
| } | } | ||||
| case WM_IME_STARTCOMPOSITION: { | case WM_IME_STARTCOMPOSITION: { | ||||
| GHOST_ImeWin32 *ime = window->getImeInput(); | GHOST_ImeWin32 *ime = window->getImeInput(); | ||||
| delete ime->evt_ImeNotHandledEventCandidate; | |||||
| ime->evt_ImeNotHandledEventCandidate = NULL; | |||||
| eventHandled = true; | eventHandled = true; | ||||
| ime->CreateImeWindow(hwnd); | ime->CreateImeWindow(hwnd); | ||||
| ime->ResetComposition(hwnd); | ime->ResetComposition(hwnd); | ||||
| event = processImeEvent(GHOST_kEventImeCompositionStart, window, &ime->eventImeData); | event = processImeEvent(GHOST_kEventImeCompositionStart, window, &ime->eventImeData); | ||||
| break; | break; | ||||
| } | } | ||||
| case WM_IME_COMPOSITION: { | case WM_IME_COMPOSITION: { | ||||
| GHOST_ImeWin32 *ime = window->getImeInput(); | GHOST_ImeWin32 *ime = window->getImeInput(); | ||||
| delete ime->evt_ImeNotHandledEventCandidate; | |||||
| ime->evt_ImeNotHandledEventCandidate = NULL; | |||||
| eventHandled = true; | eventHandled = true; | ||||
| ime->UpdateImeWindow(hwnd); | ime->UpdateImeWindow(hwnd); | ||||
| ime->UpdateInfo(hwnd); | ime->UpdateInfo(hwnd); | ||||
| if (ime->eventImeData.result_len) { | if (ime->eventImeData.result_len) { | ||||
| /* remove redundant IME event */ | /* remove redundant IME event */ | ||||
| eventManager->removeTypeEvents(GHOST_kEventImeComposition, window); | eventManager->removeTypeEvents(GHOST_kEventImeComposition, window); | ||||
| } | } | ||||
| event = processImeEvent(GHOST_kEventImeComposition, window, &ime->eventImeData); | event = processImeEvent(GHOST_kEventImeComposition, window, &ime->eventImeData); | ||||
| break; | break; | ||||
| } | } | ||||
| case WM_IME_ENDCOMPOSITION: { | case WM_IME_ENDCOMPOSITION: { | ||||
| GHOST_ImeWin32 *ime = window->getImeInput(); | GHOST_ImeWin32 *ime = window->getImeInput(); | ||||
| delete ime->evt_ImeNotHandledEventCandidate; | |||||
| ime->evt_ImeNotHandledEventCandidate = NULL; | |||||
| eventHandled = true; | eventHandled = true; | ||||
| /* remove input event after end comp event, avoid redundant input */ | /* remove input event after end comp event, avoid redundant input */ | ||||
| eventManager->removeTypeEvents(GHOST_kEventKeyDown, window); | eventManager->removeTypeEvents(GHOST_kEventKeyDown, window); | ||||
| ime->ResetComposition(hwnd); | ime->ResetComposition(hwnd); | ||||
| ime->DestroyImeWindow(hwnd); | ime->DestroyImeWindow(hwnd); | ||||
| event = processImeEvent(GHOST_kEventImeCompositionEnd, window, &ime->eventImeData); | event = processImeEvent(GHOST_kEventImeCompositionEnd, window, &ime->eventImeData); | ||||
| break; | break; | ||||
| } | } | ||||
| #endif /* WITH_INPUT_IME */ | #endif /* WITH_INPUT_IME */ | ||||
| //////////////////////////////////////////////////////////////////////// | //////////////////////////////////////////////////////////////////////// | ||||
| // Keyboard events, ignored | // Keyboard events, ignored | ||||
| //////////////////////////////////////////////////////////////////////// | //////////////////////////////////////////////////////////////////////// | ||||
| case WM_KEYDOWN: | case WM_KEYDOWN: | ||||
| case WM_SYSKEYDOWN: | case WM_SYSKEYDOWN: | ||||
| case WM_KEYUP: | case WM_KEYUP: | ||||
| case WM_SYSKEYUP: | case WM_SYSKEYUP: | ||||
| /* These functions were replaced by #WM_INPUT. */ | /* These functions were replaced by #WM_INPUT. */ | ||||
| case WM_CHAR: | break; | ||||
| case WM_CHAR: { | |||||
| /* The WM_CHAR message is posted to the window with the keyboard focus when | /* The WM_CHAR message is posted to the window with the keyboard focus when | ||||
| * a WM_KEYDOWN message is translated by the TranslateMessage function. WM_CHAR | * a WM_KEYDOWN message is translated by the TranslateMessage function. WM_CHAR | ||||
| * contains the character code of the key that was pressed. | * contains the character code of the key that was pressed. | ||||
| */ | */ | ||||
| #ifdef WITH_INPUT_IME | |||||
| /* evt_ImeNotHandledEventCandidate is NULL in most cases. When IME is enabled but a | |||||
| * key is not handled by IME, evt_ImeNotHandledEventCandidate is an event created | |||||
| * by WM_INPUT. The WM_CHAR message is posted when the key is not handled by IME. | |||||
| */ | |||||
| event = window->getImeInput()->evt_ImeNotHandledEventCandidate; | |||||
| window->getImeInput()->evt_ImeNotHandledEventCandidate = NULL; | |||||
| break; | |||||
| #endif /* WITH_INPUT_IME */ | |||||
| } | |||||
| case WM_DEADCHAR: | case WM_DEADCHAR: | ||||
| /* The WM_DEADCHAR message is posted to the window with the keyboard focus when a | /* The WM_DEADCHAR message is posted to the window with the keyboard focus when a | ||||
| * WM_KEYUP message is translated by the TranslateMessage function. WM_DEADCHAR | * WM_KEYUP message is translated by the TranslateMessage function. WM_DEADCHAR | ||||
| * specifies a character code generated by a dead key. A dead key is a key that | * specifies a character code generated by a dead key. A dead key is a key that | ||||
| * generates a character, such as the umlaut (double-dot), that is combined with | * generates a character, such as the umlaut (double-dot), that is combined with | ||||
| * another character to form a composite character. For example, the umlaut-O | * another character to form a composite character. For example, the umlaut-O | ||||
| * character (Ö) is generated by typing the dead key for the umlaut character, and | * character (Ö) is generated by typing the dead key for the umlaut character, and | ||||
| * then typing the O key. | * then typing the O key. | ||||
| ▲ Show 20 Lines • Show All 720 Lines • Show Last 20 Lines | |||||