Beispiel #1
0
LRESULT CALLBACK IME_getMessageHook(int code, WPARAM wParam, LPARAM lParam) {
	MSG* pmsg=(MSG*)lParam;
	if(pmsg->message==wm_candidateChange) {
		handleCandidates(pmsg->hwnd);
	} else {
		handleCandidatesClosed(pmsg->hwnd);
	}
	handleIMEWindowMessage(pmsg->hwnd,pmsg->message,pmsg->wParam,pmsg->lParam);
	return 0;
}
Beispiel #2
0
static LRESULT handleIMEWindowMessage(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) {
	switch (message) {
		case WM_IME_NOTIFY:
			if(!hasValidIMEContext(hwnd)) return 0;
			switch (wParam) {
				case IMN_SETOPENSTATUS:
					handleOpenStatus(hwnd);
					break;
				case IMN_OPENCANDIDATE:
				case IMN_CHANGECANDIDATE:
					PostMessage(hwnd,wm_candidateChange,0,0);
					break;

				case IMN_CLOSECANDIDATE:
					nvdaControllerInternal_inputCandidateListUpdate(L"",-1,L"");
					break;

				case IMN_SETCONVERSIONMODE:
					PostMessage(hwnd,wm_handleIMEConversionModeUpdate,0,0);
					break;

				case IMN_PRIVATE:
					// Needed in XP to support EasyDots IME
					if (!isUIElementMgrSafe || !isTSFThread(true))
						handleReadingStringUpdate(hwnd);
					break;
			}
			break;

		case WM_IME_COMPOSITION:
			if(!hasValidIMEContext(hwnd)) return 0;
			curIMEWindow=hwnd;
			if(!isTSFThread(true)) {\
				if(lParam&GCS_COMPSTR||lParam&GCS_CURSORPOS) {
					handleComposition(hwnd, wParam, lParam);
				}
			}
			break;

		case WM_IME_ENDCOMPOSITION:
			if(!hasValidIMEContext(hwnd)) return 0;
			if(curIMEWindow==hwnd) {
				if(handleEndComposition(hwnd, wParam, lParam)) {
					//Disable further typed character notifications produced by TSF
					typedCharacter_window=NULL;
				}
				curIMEWindow=NULL;
			}
			break;

		case WM_ACTIVATE:
		case WM_SETFOCUS:
			if(!hasValidIMEContext(hwnd)) return 0;
			handleIMEConversionModeUpdate(hwnd,false);
			if(!isTSFThread(true)) {
				if (hwnd != GetFocus())  break;
				handleComposition(hwnd, wParam, lParam);
				handleCandidates(hwnd);
			}
			break;
		default:
			break;
	}
	return 0;
}