Exemplo n.º 1
0
void Mint::EnableIME(bool bEnable)
{
	_ASSERT(GetHWND());
	if ( (bEnable == true) && MEvent::GetIMESupport()) {
		if (m_hImc) {
			ImmAssociateContext(GetHWND(), m_hImc);
			m_hImc = NULL;	// EnableIME(false) ÇÒ¶§ ´Ù½Ã ¼ÂÆõȴÙ
			::SetFocus(GetHWND());
		}
		m_bEnableIME = true;
	} else {
		// HIMC¸¦ m_hImc¿¡ Àӽà º¸°üÇØ µ×´Ù°¡, Enable¶§ º¹±¸ÇÑ´Ù.
		m_hImc = ImmGetContext(GetHWND());
		if (m_hImc) {
			ImmAssociateContext(GetHWND(), NULL);
			ImmReleaseContext(GetHWND(), m_hImc);
			::SetFocus(GetHWND());
		}
		//ImmDisableIME(0);
		m_bEnableIME = false;
	}

	// CompositionÁßÀÎ ¹®ÀÚ¿­ Á¦°Å
	HIMC hImc = ImmGetContext(GetInstance()->GetHWND());
	if(hImc!=NULL){
		ImmNotifyIME(hImc, NI_COMPOSITIONSTR, CPS_CANCEL, 0);
		ImmReleaseContext(GetInstance()->GetHWND(), hImc);
	}
}
Exemplo n.º 2
0
BOOL
ImeUISetConversionMode(
    HWND hwnd
    )
{
    PCONSOLE_TABLE ConTbl;
    HIMC        hIMC;                   // Input context handle.
    LPCONIME_UIMODEINFO lpModeInfo ;
    COPYDATASTRUCT CopyData ;
    DWORD OldConversion ;


    DBGPRINT(("CONIME: Get IMN_SETCONVERSIONMODE Message\n"));

    ConTbl = SearchConsole(LastConsole);
    if (ConTbl == NULL) {
        DBGPRINT(("CONIME: Error! Cannot found registed Console\n"));
        return FALSE;
    }

    hIMC = ImmGetContext( hwnd ) ;
    if ( hIMC == 0 )
        return FALSE;

    lpModeInfo = (LPCONIME_UIMODEINFO)LocalAlloc(LPTR, sizeof(CONIME_UIMODEINFO) ) ;
    if ( lpModeInfo == NULL) {
        ImmReleaseContext( hwnd, hIMC );
        return FALSE;
    }

    OldConversion = ConTbl->dwConversion ;

    ImmGetConversionStatus(hIMC,
                           (LPDWORD)&ConTbl->dwConversion,
                           (LPDWORD)&ConTbl->dwSentence) ;

    CopyData.dwData = CI_CONIMEMODEINFO ;
    CopyData.cbData = sizeof(CONIME_UIMODEINFO) ;
    CopyData.lpData = lpModeInfo ;
    if (ImeUIMakeInfoString(ConTbl,
                            lpModeInfo))
    {
        ConsoleImeSendMessage( ConTbl->hWndCon,
                               (WPARAM)hwnd,
                               (LPARAM)&CopyData
                             ) ;
    }

    LocalFree( lpModeInfo );
    ImmReleaseContext( hwnd, hIMC );
    return TRUE ;

}
Exemplo n.º 3
0
static LONG WINAPI handle(HWND win, UINT msg, WPARAM w, LPARAM l) {
        LONG r;
        switch (msg) {
#define HANDLE(x) case WM_##x: cvReport("han " #x); r = HANDLE_WM_##x(win, w, l, on##x); break
                HANDLE(TIMER);
                HANDLE(PAINT);
                HANDLE(MOUSEMOVE);
                HANDLE(SIZE);
                HANDLE(KEYDOWN);
                HANDLE(SYSKEYDOWN);
                HANDLE(SYSKEYUP);
                HANDLE(CHAR);
                HANDLE(KEYUP);
                HANDLE(LBUTTONDOWN);
                HANDLE(RBUTTONDOWN);
                HANDLE(MBUTTONDOWN);
                HANDLE(LBUTTONUP);
                HANDLE(RBUTTONUP);
                HANDLE(MBUTTONUP);
                HANDLE(MOUSEWHEEL);
                HANDLE(DESTROY);
                HANDLE(CLOSE);
#undef HANDLE
        case WM_IME_STARTCOMPOSITION: {
                HIMC imc = ImmGetContext(win);
                COMPOSITIONFORM cf;
                cf.dwStyle = CFS_POINT;
                cf.ptCurrentPos.x = cvMouseX();
                cf.ptCurrentPos.y = cvMouseY();
                ImmSetCompositionWindow(imc, &cf);
                ImmReleaseContext(win, imc);
                r = 1;
        }
        break;
        case WM_IME_COMPOSITION: {
                if(l & GCS_RESULTSTR){
                        unsigned short str[4096];
                        unsigned len, i; 
                        HIMC imc = ImmGetContext(win);
                        HDC dc = GetDC(win);
                        len = ImmGetCompositionString(imc, GCS_RESULTSTR, str, sizeof(str));
                        len >>= 1;
                        for (i = 0; i < len; i++)
                                wgot(win, CVE_UNICODE, str[i], 0); 
                        ImmReleaseContext(win, imc);
                        chk(ReleaseDC(win, dc));
                }
                r = 0;
        }
        break;
        default: r = 0;
        }
Exemplo n.º 4
0
static bool handleCandidates(HWND hwnd) {
	/* Obtain IME context */
	HIMC imc = ImmGetContext(hwnd);
	if (!imc)  return false;

	/* Make sure there is at least one candidate list */
	DWORD count = 0;
	DWORD len = ImmGetCandidateListCountW(imc, &count);
	if (!count) {
		ImmReleaseContext(hwnd, imc);
		return false;
	}
	candidateIMEWindow=hwnd;
	/* Read first candidate list */
	CANDIDATELIST* list = (CANDIDATELIST*)malloc(len);
	ImmGetCandidateList(imc, 0, list, len);
	ImmReleaseContext(hwnd, imc);

	/* Determine candidates currently being shown */
	DWORD pageEnd = list->dwPageStart + list->dwPageSize;
	DWORD selection=list->dwSelection-list->dwPageStart;
	if (list->dwPageSize == 0) {
		pageEnd = list->dwCount;
	} else if (pageEnd > list->dwCount) {
		pageEnd = list->dwCount;
	}

	/* Concatenate currently shown candidates into a string */
	WCHAR* cand_str = (WCHAR*)malloc(len);
	WCHAR* ptr = cand_str;
	for (DWORD n = list->dwPageStart, count = 0;  n < pageEnd;  ++n) {
		DWORD offset = list->dwOffset[n];
		WCHAR* cand = (WCHAR*)(((char*)list) + offset);
		size_t clen = wcslen(cand);
		if (!clen)  continue;
		CopyMemory(ptr, cand, (clen + 1) * sizeof(WCHAR));
		if ((n + 1) < pageEnd)  ptr[clen] = '\n';
		ptr += (clen + 1);
		++count;
	}
	HKL kbd_layout = GetKeyboardLayout(0);
	WCHAR filename[MAX_PATH + 1]={0};
	ImmGetIMEFileNameW(kbd_layout, filename, MAX_PATH);
	if(cand_str&&wcslen(cand_str)>0) {
		nvdaControllerInternal_inputCandidateListUpdate(cand_str,selection,filename);
	}
	/* Clean up */
	free(cand_str);
	free(list);
	return (count > 0);
}
Exemplo n.º 5
0
Arquivo: imm32.c Projeto: krofna/wine
static void test_ImmMessages(void)
{
    CANDIDATEFORM cf;
    imm_msgs *msg;
    HWND defwnd;
    HIMC imc;
    UINT idx = 0;

    HWND hwnd = CreateWindowEx(WS_EX_CLIENTEDGE, "EDIT", "Wine imm32.dll test",
                          WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT,
                          240, 120, NULL, NULL, GetModuleHandle(0), NULL);

    ShowWindow(hwnd, SW_SHOWNORMAL);
    defwnd = ImmGetDefaultIMEWnd(hwnd);
    imc = ImmGetContext(hwnd);

    ImmSetOpenStatus(imc, TRUE);
    msg_spy_flush_msgs();
    SendMessage(defwnd, WM_IME_CONTROL, IMC_GETCANDIDATEPOS, (LPARAM)&cf );
    do
    {
        msg = msg_spy_find_next_msg(WM_IME_CONTROL,&idx);
        if (msg) ok(!msg->post, "Message should not be posted\n");
    } while (msg);
    msg_spy_flush_msgs();
    ImmSetOpenStatus(imc, FALSE);
    ImmReleaseContext(hwnd, imc);
    DestroyWindow(hwnd);
}
Exemplo n.º 6
0
Arquivo: imm32.c Projeto: krofna/wine
static void test_ImmSetCompositionString(void)
{
    HIMC imc;
    BOOL ret;

    SetLastError(0xdeadbeef);
    imc = ImmGetContext(hwnd);
    ok(imc != 0, "ImmGetContext() failed. Last error: %u\n", GetLastError());
    if (!imc)
        return;

    ret = ImmSetCompositionStringW(imc, SCS_SETSTR, NULL, 0, NULL, 0);
    ok(broken(!ret) ||
       ret, /* Vista+ */
       "ImmSetCompositionStringW() failed.\n");

    ret = ImmSetCompositionStringW(imc, SCS_SETSTR | SCS_CHANGEATTR,
        NULL, 0, NULL, 0);
    ok(!ret, "ImmSetCompositionStringW() succeeded.\n");

    ret = ImmSetCompositionStringW(imc, SCS_SETSTR | SCS_CHANGECLAUSE,
        NULL, 0, NULL, 0);
    ok(!ret, "ImmSetCompositionStringW() succeeded.\n");

    ret = ImmSetCompositionStringW(imc, SCS_CHANGEATTR | SCS_CHANGECLAUSE,
        NULL, 0, NULL, 0);
    ok(!ret, "ImmSetCompositionStringW() succeeded.\n");

    ret = ImmSetCompositionStringW(imc, SCS_SETSTR | SCS_CHANGEATTR | SCS_CHANGECLAUSE,
        NULL, 0, NULL, 0);
    ok(!ret, "ImmSetCompositionStringW() succeeded.\n");

    ImmReleaseContext(hwnd, imc);
}
Exemplo n.º 7
0
void imedel(){
	//imeをオフ
	HIMC hImc;
	hImc = ImmGetContext( hWnd );
	ImmSetOpenStatus(hImc, false);
	ImmReleaseContext(hWnd, hImc);
}
Exemplo n.º 8
0
Arquivo: ime.c Projeto: emonkak/cereja
static int
ui_ime_get_state(lua_State* L)
{
HWND hwnd;
	HIMC himc;
	DWORD conversion;
	DWORD sentence;

	hwnd = GetForegroundWindow();
	himc = ImmGetContext(hwnd);
	ImmGetConversionStatus(himc, &conversion, &sentence);
	Crj_BuildValues(L, "{Qll}",
					ImmGetOpenStatus(himc),
					conversion,
					sentence);

	char text[256];
	sprintf(text, "[%p] [%d] [%lx] [%lx]",
			(void*)hwnd,
			ImmGetOpenStatus(himc),
			conversion,
			sentence
			);
	MessageBox(NULL, text, "cereja", MB_OK);

	ImmReleaseContext(hwnd, himc);

	return 1;
}
Exemplo n.º 9
0
// &SetImeString
static void funcSetImeString(HWND i_hwnd, int i_size)
{
    _TCHAR *buf = new _TCHAR(i_size);
    DWORD len = 0;
    _TCHAR ImeDesc[GANA_MAX_ATOM_LENGTH];
    UINT ImeDescLen;
    DWORD error;
    DWORD denom = 1;
    HANDLE hPipe
        = CreateFile(addSessionId(HOOK_PIPE_NAME).c_str(), GENERIC_READ,
                     FILE_SHARE_READ, (SECURITY_ATTRIBUTES *)NULL,
                     OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, (HANDLE)NULL);
    error = ReadFile(hPipe, buf, i_size, &len, NULL);
    CloseHandle(hPipe);

    ImeDescLen = ImmGetDescription(GetKeyboardLayout(0),
                                   ImeDesc, sizeof(ImeDesc));
    if (_tcsncmp(ImeDesc, _T("SKKIME"), ImeDescLen) > 0)
        denom = sizeof(_TCHAR);

    HIMC hIMC = ImmGetContext(i_hwnd);
    if (hIMC == INVALID_HANDLE_VALUE)
        return;

    int status = ImmGetOpenStatus(hIMC);
    ImmSetCompositionString(hIMC, SCS_SETSTR, buf, len / denom, NULL, 0);
    delete buf;
    ImmNotifyIME(hIMC, NI_COMPOSITIONSTR, CPS_COMPLETE, 0);
    if (!status)
        ImmSetOpenStatus(hIMC, status);
    ImmReleaseContext(i_hwnd, hIMC);
}
Exemplo n.º 10
0
LRESULT CWkeWebkitWnd::OnImeStartComposition(UINT uMsg, WPARAM wParam,LPARAM lParam, BOOL& bHandled)
{
	wkeRect caret = m_pWebView->getCaret();

	RECT rcClient;
	GetClientRect(m_hWnd, &rcClient);

	CANDIDATEFORM form;
	form.dwIndex = 0;
	form.dwStyle = CFS_EXCLUDE;
	form.ptCurrentPos.x = caret.x + rcClient.left;
	form.ptCurrentPos.y = caret.y + caret.h + rcClient.top;
	form.rcArea.top = caret.y + rcClient.top;
	form.rcArea.bottom = caret.y + caret.h + rcClient.top;
	form.rcArea.left = caret.x + rcClient.left;
	form.rcArea.right = caret.x + caret.w + rcClient.left;
	COMPOSITIONFORM compForm;
	compForm.ptCurrentPos=form.ptCurrentPos;
	compForm.rcArea=form.rcArea;
	compForm.dwStyle=CFS_POINT;

	HWND hWnd=m_pOwner->GetManager()->GetPaintWindow();
	HIMC hIMC = ImmGetContext(hWnd);
	ImmSetCandidateWindow(hIMC, &form);
	ImmSetCompositionWindow(hIMC,&compForm);
	ImmReleaseContext(hWnd, hIMC);

	//bHandled = TRUE;
	return 0;
}
Exemplo n.º 11
0
	LRESULT CDuiWkeWebkit::OnImeStartComposition( UINT uMsg, WPARAM wParam,LPARAM lParam )
	{
		wkeRect caret = m_pWebView->getCaret();

		CRect rcClient;
		GetClient(&rcClient);

		CANDIDATEFORM form;
		form.dwIndex = 0;
		form.dwStyle = CFS_EXCLUDE;
		form.ptCurrentPos.x = caret.x + rcClient.left;
		form.ptCurrentPos.y = caret.y + caret.h + rcClient.top;
		form.rcArea.top = caret.y + rcClient.top;
		form.rcArea.bottom = caret.y + caret.h + rcClient.top;
		form.rcArea.left = caret.x + rcClient.left;
		form.rcArea.right = caret.x + caret.w + rcClient.left;
		COMPOSITIONFORM compForm;
		compForm.ptCurrentPos=form.ptCurrentPos;
		compForm.rcArea=form.rcArea;
		compForm.dwStyle=CFS_POINT;

		HWND hWnd=GetContainer()->GetHostHwnd();
		HIMC hIMC = ImmGetContext(hWnd);
		ImmSetCandidateWindow(hIMC, &form);
		ImmSetCompositionWindow(hIMC,&compForm);
		ImmReleaseContext(hWnd, hIMC);
		return 0;
	}
Exemplo n.º 12
0
DWORD
GetNLSMode(
    HWND hWnd,
    HANDLE hConsole
    )
{
    PCONSOLE_TABLE ConTbl;
    HIMC hIMC;

    ConTbl = SearchConsole(hConsole);
    if (ConTbl == NULL) {
        DBGPRINT(("CONIME: Error! Cannot found registed Console\n"));
        return 0;
    }

    hIMC = ImmGetContext( hWnd ) ;
    if ( hIMC == (HIMC)NULL )
        return IME_CMODE_DISABLE;

    ImmGetConversionStatus(hIMC,
                           &ConTbl->dwConversion,
                           &ConTbl->dwSentence);
    ConTbl->fOpen = GetOpenStatusByCodepage( hIMC, ConTbl ) ;

    ImmReleaseContext( hWnd, hIMC );


    return ((ConTbl->fOpen ? IME_CMODE_OPEN : 0) + ConTbl->dwConversion);
}
Exemplo n.º 13
0
/** Set the position of the candidate window. */
static void SetCandidatePos(HWND hwnd)
{
	HIMC hIMC = ImmGetContext(hwnd);
	if (hIMC != NULL) {
		CANDIDATEFORM cf;
		cf.dwIndex = 0;
		cf.dwStyle = CFS_EXCLUDE;

		if (EditBoxInGlobalFocus()) {
			Point pt = _focused_window->GetCaretPosition();
			cf.ptCurrentPos.x = _focused_window->left + pt.x;
			cf.ptCurrentPos.y = _focused_window->top  + pt.y;
			if (_focused_window->window_class == WC_CONSOLE) {
				cf.rcArea.left   = _focused_window->left;
				cf.rcArea.top    = _focused_window->top;
				cf.rcArea.right  = _focused_window->left + _focused_window->width;
				cf.rcArea.bottom = _focused_window->top  + _focused_window->height;
			} else {
				cf.rcArea.left   = _focused_window->left + _focused_window->nested_focus->pos_x;
				cf.rcArea.top    = _focused_window->top  + _focused_window->nested_focus->pos_y;
				cf.rcArea.right  = cf.rcArea.left + _focused_window->nested_focus->current_x;
				cf.rcArea.bottom = cf.rcArea.top  + _focused_window->nested_focus->current_y;
			}
		} else {
			cf.ptCurrentPos.x = 0;
			cf.ptCurrentPos.y = 0;
			SetRectEmpty(&cf.rcArea);
		}
		ImmSetCandidateWindow(hIMC, &cf);
	}
	ImmReleaseContext(hwnd, hIMC);
}
Exemplo n.º 14
0
BOOL CreateTBar(HWND hWnd)
{
    HIMC hIMC = NULL;
    BOOL fOpen;

    hWndToolBar = CreateToolbarEx(hWnd,
                                  WS_CHILD | WS_VISIBLE | TBSTYLE_TOOLTIPS,
                                  TOOLBAR_ID,
                                  NUMIMAGES,
                                  hInst,
                                  IDB_BMP,
                                  tbButton,
                                  sizeof(tbButton)/sizeof(TBBUTTON),
                                  BUTTONWIDTH,
                                  BUTTONHEIGHT,
                                  IMAGEWIDTH,
                                  IMAGEHEIGHT,
                                  sizeof(TBBUTTON));

    UpdateShowCandButton();

    hIMC = ImmGetContext(hWndCompStr);
    fOpen = ImmGetOpenStatus(hIMC);
    UpdateShowOpenStatusButton(fOpen);
    ImmReleaseContext(hWndCompStr,hIMC);

    return (hWndToolBar != 0);
}
Exemplo n.º 15
0
BOOL pymImmReleaseContext(HWND hWnd, HIMC hIMC) {
	PyMFC_PROLOGUE(pymFormatMessage);
	{
		PyMFCLeavePython lp;
		return ImmReleaseContext(hWnd, hIMC);
	}
	PyMFC_EPILOGUE(0);
}
Exemplo n.º 16
0
void JIme::ResetComposition()
{
	HWND hWnd = JMain::GetInstance().GetJWindow().GetWindowHandle();
	HIMC hImc = ImmGetContext(hWnd);
	ImmSetCompositionString(hImc, SCS_SETSTR, NULL, 0, NULL, 0);
	ImmReleaseContext(hWnd, hImc);
	ZeroMemory(&ime_comp_char, 3*sizeof(TCHAR));
}
void CTextInputCtrl::SetCompositionFont()
{
    HIMC himc = ImmGetContext(_hwnd);
    if (himc)
    {
        ImmSetCompositionFont(himc, &_lfCurrentFont);
    }
    ImmReleaseContext(_hwnd, himc);
}
Exemplo n.º 18
0
WCHAR* IME_getCompositionString() {
	HWND hwnd = GetFocus();
	if (!hwnd)  return NULL;
	HIMC imc = ImmGetContext(hwnd);
	if (!imc)  return NULL;
	WCHAR* comp_str = getCompositionString(imc, GCS_COMPSTR);
	ImmReleaseContext(hwnd, imc);
	return comp_str;
}
Exemplo n.º 19
0
void JIme::SetImeMode(const DWORD mode)
{
	HWND hWnd = JMain::GetInstance().GetJWindow().GetWindowHandle();
	HIMC hImc = ImmGetContext(hWnd);
	DWORD dwConv, dwSent;
	ImmGetConversionStatus(hImc, &dwConv, &dwSent);
	ImmSetConversionStatus(hImc, mode, dwSent);
	ImmReleaseContext(hWnd, hImc);
}
void CTextEditor::FlushCompositionString()
{
    // We flush the composition string at selection change.
    HIMC himc = ImmGetContext(_hwnd);
    if (himc)
    {
        ImmNotifyIME(himc, NI_COMPOSITIONSTR, CPS_CANCEL, 0);
        ImmReleaseContext(_hwnd, himc);
    }
}
Exemplo n.º 21
0
// Cancel current IME composition.
static inline void imeNotifyCancelComposition(HWND hwnd)
{
    if (!hwnd) {
        qWarning() << __FUNCTION__ << "called with" << hwnd;
        return;
    }
    const HIMC himc = ImmGetContext(hwnd);
    ImmNotifyIME(himc, NI_COMPOSITIONSTR, CPS_CANCEL, 0);
    ImmReleaseContext(hwnd, himc);
}
Exemplo n.º 22
0
//--------------------------------------------------------------------------
void VeWindows::_EnableIME(Window* pkWindow)
{
	WindowData* pkData = (WindowData*)(VeRefObject*)pkWindow->m_spDriverData;
	if(pkData->m_hImc)
	{
		ImmAssociateContext(pkData->m_hWnd, pkData->m_hImc);
		ImmReleaseContext(pkData->m_hWnd, pkData->m_hImc);
		pkData->m_hImc = NULL;
	}
}
Exemplo n.º 23
0
bool QWindowsInputContext::composition(HWND hwnd, LPARAM lParamIn)
{
    QObject *fo = qApp->focusObject();
    const int lParam = int(lParamIn);
    if (QWindowsContext::verboseInputMethods)
        qDebug() << '>' << __FUNCTION__ << fo << debugComposition(lParam)
                 << " composing=" << m_compositionContext.isComposing;
    if (!fo || m_compositionContext.hwnd != hwnd || !lParam)
        return false;
    const HIMC himc = ImmGetContext(m_compositionContext.hwnd);
    if (!himc)
        return false;

    QScopedPointer<QInputMethodEvent> event;
    if (lParam & (GCS_COMPSTR | GCS_COMPATTR | GCS_CURSORPOS)) {
        if (!m_compositionContext.isComposing)
            startContextComposition();
        // Some intermediate composition result. Parametrize event with
        // attribute sequence specifying the formatting of the converted part.
        int selStart, selLength;
        m_compositionContext.composition = getCompositionString(himc, GCS_COMPSTR);
        m_compositionContext.position = ImmGetCompositionString(himc, GCS_CURSORPOS, 0, 0);
        getCompositionStringConvertedRange(himc, &selStart, &selLength);
        if ((lParam & CS_INSERTCHAR) && (lParam & CS_NOMOVECARET)) {
            // make Korean work correctly. Hope this is correct for all IMEs
            selStart = 0;
            selLength = m_compositionContext.composition.size();
        }
        if (!selLength)
            selStart = 0;

        event.reset(new QInputMethodEvent(m_compositionContext.composition,
                                          intermediateMarkup(m_compositionContext.position,
                                                  m_compositionContext.composition.size(),
                                                  selStart, selLength)));
    }
    if (event.isNull())
        event.reset(new QInputMethodEvent);

    if (lParam & GCS_RESULTSTR) {
        // A fixed result, return the converted string
        event->setCommitString(getCompositionString(himc, GCS_RESULTSTR));
        endContextComposition();
    }
    const bool result = QCoreApplication::sendEvent(fo, event.data());
    if (QWindowsContext::verboseInputMethods)
        qDebug() << '<' << __FUNCTION__ << "sending markup="
                 << event->attributes().size()
                 << " commit=" << event->commitString()
                 << " to " << fo << " returns " << result;
    update(Qt::ImQueryAll);
    ImmReleaseContext(m_compositionContext.hwnd, himc);
    return result;
}
Exemplo n.º 24
0
Arquivo: win.c Projeto: zero-ui/btplay
ZuiVoid ZuiOsDestroyWindow(ZuiOsWindow OsWindow) {
	if (OsWindow) {
		/*释放由ImmGetContext得到的输入法句柄*/
		ImmReleaseContext(OsWindow->hWnd, OsWindow->hIMC);
		/*释放由GetDc得到的窗口DC*/
		ReleaseDC(OsWindow->hWnd, OsWindow->hDC);
		/*释放窗口*/
		DestroyWindow(OsWindow->hWnd);
		free(OsWindow);
	}
}
Exemplo n.º 25
0
		bool onNotify(int status)
		{
			if(IsWindow(hwnd_)) {
				Context himc(hwnd_);
				if(status == IMN_SETOPENSTATUS) {
					is_open_ = ImmGetOpenStatus(himc) ? true : false;
					ImmReleaseContext(hwnd_, himc);
					return false;
				}
			}
			return true;
		}
Exemplo n.º 26
0
static HRESULT WINAPI ActiveIMMApp_ReleaseContext(IActiveIMMApp* This,
        HWND hWnd, HIMC hIMC)
{
    BOOL rc;

    rc = ImmReleaseContext(hWnd,hIMC);

    if (rc)
        return S_OK;
    else
        return E_FAIL;
}
Exemplo n.º 27
0
void handleIMEConversionModeUpdate(HWND hwnd, bool report) {
	if(!ImmGetProperty(GetKeyboardLayout(0),IGP_CONVERSION)) return;
	/* Obtain IME context */
	HIMC imc = ImmGetContext(hwnd);
	if (!imc)  return;
	DWORD flags=0;
	ImmGetConversionStatus(imc,&flags,NULL);
	ImmReleaseContext(hwnd, imc);
	if(report&&flags!=lastConversionModeFlags) {
		nvdaControllerInternal_inputConversionModeUpdate(lastConversionModeFlags,flags,((unsigned long)GetKeyboardLayout(0))&0xffff);
	}
	lastConversionModeFlags=flags;
}
Exemplo n.º 28
0
void handleOpenStatus(HWND hwnd) {
	//Only reported for japanese
	if(((unsigned long)(GetKeyboardLayout(0))&0xff)!=0x11) return;
	/* Obtain IME context */
	HIMC imc = ImmGetContext(hwnd);
	if (!imc)  return;
	BOOL opened=ImmGetOpenStatus(imc);
	if(opened!=lastOpenStatus) {
		nvdaControllerInternal_IMEOpenStatusUpdate(opened);
		lastOpenStatus=opened;
	}
	ImmReleaseContext(hwnd, imc);
}
Exemplo n.º 29
-1
//***********************************************************************
//
// void GetResultStr()
//
// This handles WM_IME_COMPOSITION with GCS_RESULTSTR flag on.
//
//***********************************************************************
void GetResultStr( 
    HWND hwnd )
{
    LONG        bufLen;                 // Storage for length of result str.
    LPSTR       lpResultStr;            // Pointer to result string.
    HIMC        hIMC;                   // Input context handle.
    HLOCAL      hMem;                   // Memory handle.

    //
    // If fail to get input context handle then do nothing.
    //

    if ( !( hIMC = ImmGetContext( hwnd ) ) )
        return;

    //
    // Determines how much memory space to store the result string.
    // Applications should call ImmGetCompositionString with
    // GCS_RESULTSTR flag on, buffer length zero, to get the bullfer
    // length.
    //

    if ( ( bufLen = ImmGetCompositionString( hIMC, GCS_RESULTSTR,
                                  (void *)NULL, (DWORD) 0 ) ) <= 0 )
        goto exit2;

    //
    // Allocates memory with bufLen+1 bytes to store the result
    // string. Here we allocale on more byte to put null character.
    //

    if ( !( hMem = LocalAlloc( LPTR, (int)bufLen + 1 ) ) )
        goto exit2;

    if ( !( lpResultStr = (LPSTR) LocalLock( hMem ) ) )
        goto exit1;

    //
    // Reads in the result string.
    //

    ImmGetCompositionString( hIMC, GCS_RESULTSTR, lpResultStr, bufLen );

    //
    // Displays the result string.
    //

    DisplayResultString( hwnd, lpResultStr );

    LocalUnlock( hMem );

exit1:
    
    LocalFree( hMem );

exit2:

    ImmReleaseContext( hwnd, hIMC );

}
Exemplo n.º 30
-1
bool CIme::OnWM_IME_COMPOSITION( HWND hWnd, LPARAM lParam ){//输入改变
	HIMC hIMC;
	DWORD dwSize;
	hIMC = ImmGetContext( hWnd );
	if( lParam & GCS_COMPSTR ){
		dwSize = ImmGetCompositionString( hIMC, GCS_COMPSTR, (void*)m_szCompStr, sizeof( m_szCompStr ));
		m_szCompStr[ dwSize ] = 0;
	}//取得szCompStr
	if( lParam & GCS_COMPREADSTR ){
		dwSize = ImmGetCompositionString( hIMC, GCS_COMPREADSTR, (void*)m_szCompReadStr, sizeof( m_szCompReadStr ));
		m_szCompReadStr[ dwSize ] = 0;
	}//取得szCompReadStr
	if( lParam & GCS_CURSORPOS ){
		m_nImeCursor = 0xffff & ImmGetCompositionString( hIMC, GCS_CURSORPOS, NULL, 0 );
	}//?〉?.nImeCursor
	if( lParam & GCS_RESULTSTR ){
		unsigned char str[ MAX_PATH ];
		dwSize = ImmGetCompositionString( hIMC, GCS_RESULTSTR, (void*)str, sizeof( str ));//取得汉字输入串
		str[ dwSize ] = 0;
		unsigned char *p = str;
		while( *p )PostMessage( hWnd, WM_CHAR, (WPARAM)(*p++), 1 );//转成WM_CHAR消息
	}
	ImmReleaseContext( hWnd, hIMC );
	return true;//总是返回true,防止ime窗口打开
}