void InputContext::changeContext(const char *engine) { const char *encoding, *im_lang; if (!strcmp(mEngineName, engine)) return; encoding = mXic->get_encoding(); im_lang = get_im_lang_from_engine(engine); // Don't change im unless encoding matches for clients with legacy locales. if (strcmp(encoding, "UTF-8")) { const char *client_locale = mXic->get_lang_region(); const char *engine_locales = compose_localenames_from_im_lang(im_lang); if (!is_locale_included(engine_locales, client_locale)) return; } clear(); uim_release_context(mUc); createUimContext(engine); // mUc, mEngineName, and locale will be set here. if (mConvdisp) { mConvdisp->set_im_lang(get_im_lang_from_engine(mEngineName)); mConvdisp->set_locale_name(mLocaleName); } }
QUimInputContext::QUimInputContext( const char *imname, const char *lang ) : QInputContext(), m_imname( imname ), m_lang( lang ), m_uc( 0 ), candwinIsActive( false ) { #ifdef ENABLE_DEBUG qDebug( "QUimInputContext()" ); #endif contextList.append( this ); // must be initialized before createUimContext() call if ( !m_HelperManager ) m_HelperManager = new QUimHelperManager(); if ( imname ) m_uc = createUimContext( imname ); psegs.setAutoDelete( true ); psegs.clear(); cwin = new CandidateWindow( 0 ); cwin->setQUimInputContext( this ); cwin->hide(); #ifdef Q_WS_X11 if ( !mTreeTop ) create_compose_tree(); mCompose = new Compose( mTreeTop, this ); #endif mTextUtil = new QUimTextUtil( this ); // read configuration readIMConf(); }
// // Methods for InputContext InputContext::InputContext(XimServer *svr, XimIC *ic, const char *engine) { mXic = ic; m_pe = new pe_stat(this); mConvdisp = NULL; mServer = svr; mEngineName = NULL; mLocaleName = NULL; mFocusedContext = this; createUimContext(engine); mCandwinActive = false; #if UIM_XIM_USE_NEW_PAGE_HANDLING mNumCandidates = 0; #endif mNumPage = 1; mDisplayLimit = 0; mCaretStateShown = false; }