diff options
author | Caolán McNamara <caolanm@redhat.com> | 2011-09-05 16:36:22 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2011-09-05 16:37:00 +0100 |
commit | 8b0287543d87659fd4bfde5edb6725ee5da5f80e (patch) | |
tree | dad4a29a495e4cb12642cb65d506d9edda53ff3f /vcl/unx | |
parent | 66ec27f69123a308926583180a6f45db80e3d427 (diff) |
These multi-lingual IMs have been always disabled for Linux
Where not-Linux was in practice solaris. We can be pretty sure that the
ismultlingual path is effectively unused. so following that chain of logic
quite a bit can go.
Diffstat (limited to 'vcl/unx')
-rw-r--r-- | vcl/unx/generic/app/i18n_cb.cxx | 163 | ||||
-rw-r--r-- | vcl/unx/generic/app/i18n_ic.cxx | 34 | ||||
-rw-r--r-- | vcl/unx/generic/app/i18n_im.cxx | 83 | ||||
-rw-r--r-- | vcl/unx/generic/app/saldata.cxx | 1 | ||||
-rw-r--r-- | vcl/unx/generic/window/salframe.cxx | 7 | ||||
-rw-r--r-- | vcl/unx/kde/kdedata.cxx | 1 | ||||
-rw-r--r-- | vcl/unx/kde4/KDEXLib.cxx | 1 |
7 files changed, 71 insertions, 219 deletions
diff --git a/vcl/unx/generic/app/i18n_cb.cxx b/vcl/unx/generic/app/i18n_cb.cxx index d0cf39fdc4d4..82849311c1d1 100644 --- a/vcl/unx/generic/app/i18n_cb.cxx +++ b/vcl/unx/generic/app/i18n_cb.cxx @@ -164,100 +164,91 @@ enlarge_buffer ( preedit_text_t *ptext, int nnewlimit ) // void -Preedit_InsertText(preedit_text_t *pText, XIMText *pInsertText, int where, - Bool isMultilingual) +Preedit_InsertText(preedit_text_t *pText, XIMText *pInsertText, int where) { - sal_Unicode *pInsertTextString; - int nInsertTextLength = 0; - XIMFeedback *pInsertTextCharStyle = pInsertText->feedback; + sal_Unicode *pInsertTextString; + int nInsertTextLength = 0; + XIMFeedback *pInsertTextCharStyle = pInsertText->feedback; - nInsertTextLength = pInsertText->length; + nInsertTextLength = pInsertText->length; - if (isMultilingual) + // can't handle wchar_t strings, so convert to multibyte chars first + char *pMBString; + size_t nMBLength; + if (pInsertText->encoding_is_wchar) { - XIMUnicodeText *pUniText = (XIMUnicodeText*)pInsertText; - pInsertTextString = pUniText->string.utf16_char; - } + wchar_t *pWCString = pInsertText->string.wide_char; + size_t nBytes = wcstombs ( NULL, pWCString, 1024 /* dont care */); + pMBString = (char*)alloca( nBytes + 1 ); + nMBLength = wcstombs ( pMBString, pWCString, nBytes + 1); + } else { - // can't handle wchar_t strings, so convert to multibyte chars first - char *pMBString; - size_t nMBLength; - if (pInsertText->encoding_is_wchar) - { - wchar_t *pWCString = pInsertText->string.wide_char; - size_t nBytes = wcstombs ( NULL, pWCString, 1024 /* dont care */); - pMBString = (char*)alloca( nBytes + 1 ); - nMBLength = wcstombs ( pMBString, pWCString, nBytes + 1); - } - else - { - pMBString = pInsertText->string.multi_byte; - nMBLength = strlen(pMBString); // xxx - } + pMBString = pInsertText->string.multi_byte; + nMBLength = strlen(pMBString); // xxx + } - // convert multibyte chars to unicode - rtl_TextEncoding nEncoding = osl_getThreadTextEncoding(); + // convert multibyte chars to unicode + rtl_TextEncoding nEncoding = osl_getThreadTextEncoding(); - if (nEncoding != RTL_TEXTENCODING_UNICODE) - { - rtl_TextToUnicodeConverter aConverter = - rtl_createTextToUnicodeConverter( nEncoding ); - rtl_TextToUnicodeContext aContext = - rtl_createTextToUnicodeContext(aConverter); + if (nEncoding != RTL_TEXTENCODING_UNICODE) + { + rtl_TextToUnicodeConverter aConverter = + rtl_createTextToUnicodeConverter( nEncoding ); + rtl_TextToUnicodeContext aContext = + rtl_createTextToUnicodeContext(aConverter); - sal_Size nBufferSize = nInsertTextLength * 2; + sal_Size nBufferSize = nInsertTextLength * 2; - pInsertTextString = (sal_Unicode*)alloca(nBufferSize); + pInsertTextString = (sal_Unicode*)alloca(nBufferSize); - sal_uInt32 nConversionInfo; - sal_Size nConvertedChars; + sal_uInt32 nConversionInfo; + sal_Size nConvertedChars; - rtl_convertTextToUnicode( aConverter, aContext, - pMBString, nMBLength, - pInsertTextString, nBufferSize, - RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_IGNORE - | RTL_TEXTTOUNICODE_FLAGS_INVALID_IGNORE, - &nConversionInfo, &nConvertedChars ); + rtl_convertTextToUnicode( aConverter, aContext, + pMBString, nMBLength, + pInsertTextString, nBufferSize, + RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_IGNORE + | RTL_TEXTTOUNICODE_FLAGS_INVALID_IGNORE, + &nConversionInfo, &nConvertedChars ); - rtl_destroyTextToUnicodeContext(aConverter, aContext); - rtl_destroyTextToUnicodeConverter(aConverter); + rtl_destroyTextToUnicodeContext(aConverter, aContext); + rtl_destroyTextToUnicodeConverter(aConverter); - } - else - { - pInsertTextString = (sal_Unicode*)pMBString; - } - } + } + else + { + pInsertTextString = (sal_Unicode*)pMBString; + } - // enlarge target text-buffer if necessary - if (pText->nSize <= (pText->nLength + nInsertTextLength)) - enlarge_buffer(pText, pText->nLength + nInsertTextLength); + // enlarge target text-buffer if necessary + if (pText->nSize <= (pText->nLength + nInsertTextLength)) + enlarge_buffer(pText, pText->nLength + nInsertTextLength); - // insert text: displace old mem and put new bytes in - int from = where; - int to = where + nInsertTextLength; - int howmany = pText->nLength - where; + // insert text: displace old mem and put new bytes in + int from = where; + int to = where + nInsertTextLength; + int howmany = pText->nLength - where; - memmove((void*)(pText->pUnicodeBuffer + to), - (void*)(pText->pUnicodeBuffer + from), - howmany * sizeof(sal_Unicode)); - memmove((void*)(pText->pCharStyle + to), - (void*)(pText->pCharStyle + from), - howmany * sizeof(XIMFeedback)); + memmove((void*)(pText->pUnicodeBuffer + to), + (void*)(pText->pUnicodeBuffer + from), + howmany * sizeof(sal_Unicode)); + memmove((void*)(pText->pCharStyle + to), + (void*)(pText->pCharStyle + from), + howmany * sizeof(XIMFeedback)); - to = from; - howmany = nInsertTextLength; + to = from; + howmany = nInsertTextLength; - memcpy((void*)(pText->pUnicodeBuffer + to), (void*)pInsertTextString, - howmany * sizeof(sal_Unicode)); - memcpy((void*)(pText->pCharStyle + to), (void*)pInsertTextCharStyle, - howmany * sizeof(XIMFeedback)); + memcpy((void*)(pText->pUnicodeBuffer + to), (void*)pInsertTextString, + howmany * sizeof(sal_Unicode)); + memcpy((void*)(pText->pCharStyle + to), (void*)pInsertTextCharStyle, + howmany * sizeof(XIMFeedback)); - pText->nLength += howmany; + pText->nLength += howmany; - // NULL-terminate the string - pText->pUnicodeBuffer[pText->nLength] = (sal_Unicode)0; + // NULL-terminate the string + pText->pUnicodeBuffer[pText->nLength] = (sal_Unicode)0; } // @@ -372,7 +363,7 @@ PreeditDrawCallback(XIC ic, XPointer client_data, && (call_data->text->string.wide_char != NULL)) { Preedit_InsertText(&(pPreeditData->aText), call_data->text, - call_data->chg_first, pPreeditData->bIsMultilingual); + call_data->chg_first); } else // handle text replacement by deletion and insertion of text, @@ -383,7 +374,7 @@ PreeditDrawCallback(XIC ic, XPointer client_data, Preedit_DeleteText(&(pPreeditData->aText), call_data->chg_first, call_data->chg_length); Preedit_InsertText(&(pPreeditData->aText), call_data->text, - call_data->chg_first, pPreeditData->bIsMultilingual); + call_data->chg_first); } else // not really a text update, only attributes are concerned @@ -567,27 +558,9 @@ StatusDoneCallback (XIC, XPointer, XPointer) } void -StatusDrawCallback (XIC ic, XPointer client_data, XIMStatusDrawCallbackStruct *call_data) +StatusDrawCallback (XIC, XPointer, XIMStatusDrawCallbackStruct *call_data) { - preedit_data_t* pPreeditData = (preedit_data_t*)client_data; - if( pPreeditData->bIsMultilingual ) - { - // IIIMP - XIMUnicodeText *cbtext = (XIMUnicodeText *)call_data->data.text; - ::vcl::I18NStatus::get().setStatusText( String( cbtext->string.utf16_char, call_data->data.text->length ) ); - XIMUnicodeCharacterSubset* pSubset = NULL; - if( ! XGetICValues( ic, - XNUnicodeCharacterSubset, & pSubset, - NULL ) - && pSubset ) - { - ::vcl::I18NStatus::get().changeIM( String( ByteString( pSubset->name ), RTL_TEXTENCODING_UTF8 ) ); -#if OSL_DEBUG_LEVEL > 1 - fprintf( stderr, "got XNUnicodeCharacterSubset\n %d\n %d\n %s\n %d\n", pSubset->index, pSubset->subset_id, pSubset->name, pSubset->is_active ); -#endif - } - } - else if( call_data->type == XIMTextType ) + if( call_data->type == XIMTextType ) { String aText; if( call_data->data.text ) diff --git a/vcl/unx/generic/app/i18n_ic.cxx b/vcl/unx/generic/app/i18n_ic.cxx index 8a8b5d620cb6..bb9b92a8354b 100644 --- a/vcl/unx/generic/app/i18n_ic.cxx +++ b/vcl/unx/generic/app/i18n_ic.cxx @@ -187,7 +187,6 @@ SalI18N_InputContext::SalI18N_InputContext ( SalFrame *pFrame ) : SalI18N_InputMethod *pInputMethod; pInputMethod = GetX11SalData()->GetDisplay()->GetInputMethod(); - mbMultiLingual = pInputMethod->IsMultiLingual(); mnSupportedPreeditStyle = XIMPreeditCallbacks | XIMPreeditPosition | XIMPreeditNothing | XIMPreeditNone; @@ -200,7 +199,6 @@ SalI18N_InputContext::SalI18N_InputContext ( SalFrame *pFrame ) : // for status callbacks and commit string callbacks #define PREEDIT_BUFSZ 16 - maClientData.bIsMultilingual = mbMultiLingual; maClientData.eState = ePreeditStatusStartPending; maClientData.pFrame = pFrame; maClientData.aText.pUnicodeBuffer = @@ -359,7 +357,6 @@ SalI18N_InputContext::SalI18N_InputContext ( SalFrame *pFrame ) : #endif mbUseable = False; - mbMultiLingual = False; if ( mpAttributes != NULL ) XFree( mpAttributes ); @@ -379,17 +376,6 @@ SalI18N_InputContext::SalI18N_InputContext ( SalFrame *pFrame ) : maClientData.aText.pCharStyle = NULL; } - if ( maContext != NULL && mbMultiLingual ) - { - maCommitStringCallback.callback = (XIMProc)::CommitStringCallback; - maCommitStringCallback.client_data = (XPointer)&maClientData; - maSwitchIMCallback.callback = (XIMProc)::SwitchIMCallback; - maSwitchIMCallback.client_data = (XPointer)&maClientData; - XSetICValues( maContext, - XNCommitStringCallback, &maCommitStringCallback, - XNSwitchIMNotifyCallback, &maSwitchIMCallback, - NULL ); - } if ( maContext != NULL) { maDestroyCallback.callback = (XIMProc)IC_IMDestroyCallback; @@ -398,21 +384,6 @@ SalI18N_InputContext::SalI18N_InputContext ( SalFrame *pFrame ) : XNDestroyCallback, &maDestroyCallback, NULL ); } - - if( mbMultiLingual ) - { - // set initial IM status - XIMUnicodeCharacterSubset* pSubset = NULL; - if( ! XGetICValues( maContext, - XNUnicodeCharacterSubset, & pSubset, - NULL ) - && pSubset ) - { - String aCurrent( ByteString( pSubset->name ), RTL_TEXTENCODING_UTF8 ); - ::vcl::I18NStatus::get().changeIM( aCurrent ); - ::vcl::I18NStatus::get().setStatusText( aCurrent ); - } - } } // --------------------------------------------------------------------------- @@ -454,11 +425,6 @@ SalI18N_InputContext::Map( SalFrame *pFrame ) maContext = XCreateIC( pInputMethod->GetMethod(), XNVaNestedList, mpAttributes, NULL ); - if ( maContext != NULL && mbMultiLingual ) - XSetICValues( maContext, - XNCommitStringCallback, &maCommitStringCallback, - XNSwitchIMNotifyCallback, &maSwitchIMCallback, - NULL ); } if( maClientData.pFrame != pFrame ) SetICFocus( pFrame ); diff --git a/vcl/unx/generic/app/i18n_im.cxx b/vcl/unx/generic/app/i18n_im.cxx index 5d30d74455ae..76d0c939df7a 100644 --- a/vcl/unx/generic/app/i18n_im.cxx +++ b/vcl/unx/generic/app/i18n_im.cxx @@ -268,8 +268,6 @@ SalI18N_InputMethod::SetLocale( const char* pLocale ) Bool SalI18N_InputMethod::PosixLocale() { - if (mbMultiLingual) - return False; if (maMethod) return IsPosixLocale (XLocaleOfIM (maMethod)); return False; @@ -282,7 +280,6 @@ SalI18N_InputMethod::PosixLocale() // ------------------------------------------------------------------------ SalI18N_InputMethod::SalI18N_InputMethod( ) : mbUseable( bUseInputMethodDefault ), - mbMultiLingual( False ), maMethod( (XIM)NULL ), mpStyles( (XIMStyles*)NULL ) { @@ -376,58 +373,7 @@ SalI18N_InputMethod::CreateMethod ( Display *pDisplay ) { if ( mbUseable ) { - const bool bTryMultiLingual = - #ifdef LINUX - false; - #else - true; - #endif - if ( bTryMultiLingual && getenv("USE_XOPENIM") == NULL ) - { - mbMultiLingual = True; // set ml-input flag to create input-method - maMethod = XvaOpenIM(pDisplay, NULL, NULL, NULL, - XNMultiLingualInput, mbMultiLingual, /* dummy */ - (void *)0); - // get ml-input flag from input-method - if ( maMethod == (XIM)NULL ) - mbMultiLingual = False; - else - if ( XGetIMValues(maMethod, - XNMultiLingualInput, &mbMultiLingual, NULL ) != NULL ) - mbMultiLingual = False; - if( mbMultiLingual ) - { - XIMUnicodeCharacterSubsets* subsets; - if( XGetIMValues( maMethod, - XNQueryUnicodeCharacterSubset, &subsets, NULL ) == NULL ) - { -#if OSL_DEBUG_LEVEL > 1 - fprintf( stderr, "IM reports %d subsets: ", subsets->count_subsets ); -#endif - I18NStatus& rStatus( I18NStatus::get() ); - rStatus.clearChoices(); - for( int i = 0; i < subsets->count_subsets; i++ ) - { -#if OSL_DEBUG_LEVEL > 1 - fprintf( stderr,"\"%s\" ", subsets->supported_subsets[i].name ); -#endif - rStatus.addChoice( String( subsets->supported_subsets[i].name, RTL_TEXTENCODING_UTF8 ), &subsets->supported_subsets[i] ); - } -#if OSL_DEBUG_LEVEL > 1 - fprintf( stderr, "\n" ); -#endif - } -#if OSL_DEBUG_LEVEL > 1 - else - fprintf( stderr, "query subsets failed\n" ); -#endif - } - } - else - { - maMethod = XOpenIM(pDisplay, NULL, NULL, NULL); - mbMultiLingual = False; - } + maMethod = XOpenIM(pDisplay, NULL, NULL, NULL); if ((maMethod == (XIM)NULL) && (getenv("XMODIFIERS") != NULL)) { @@ -435,7 +381,6 @@ SalI18N_InputMethod::CreateMethod ( Display *pDisplay ) osl_clearEnvironment(envVar.pData); XSetLocaleModifiers(""); maMethod = XOpenIM(pDisplay, NULL, NULL, NULL); - mbMultiLingual = False; } if ( maMethod != (XIM)NULL ) @@ -444,8 +389,7 @@ SalI18N_InputMethod::CreateMethod ( Display *pDisplay ) != NULL) mbUseable = False; #if OSL_DEBUG_LEVEL > 1 - fprintf(stderr, "Creating %s-Lingual InputMethod\n", - mbMultiLingual ? "Multi" : "Mono" ); + fprintf(stderr, "Creating Mono-Lingual InputMethod\n" ); PrintInputStyle( mpStyles ); #endif } @@ -510,7 +454,6 @@ void SalI18N_InputMethod::HandleDestroyIM() { mbUseable = False; - mbMultiLingual = False; maMethod = NULL; } @@ -596,26 +539,4 @@ InputMethod_ConnectionWatchProc (Display *pDisplay, XPointer pClientData, } } -Bool -SalI18N_InputMethod::AddConnectionWatch(Display *pDisplay, void *pConnectionHandler) -{ - // sanity check - if (pDisplay == NULL || pConnectionHandler == NULL) - return False; - - // if we are not ml all the extended text input comes on the stock X queue, - // so there is no need to monitor additional file descriptors. -#ifndef SOLARIS - if (!mbMultiLingual || !mbUseable) - return False; -#endif - - // pConnectionHandler must be really a pointer to a SalXLib - Status nStatus = XAddConnectionWatch (pDisplay, InputMethod_ConnectionWatchProc, - (XPointer)pConnectionHandler); - return (Bool)nStatus; -} - - - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/generic/app/saldata.cxx b/vcl/unx/generic/app/saldata.cxx index d865bfbc55d4..0dc426ea3168 100644 --- a/vcl/unx/generic/app/saldata.cxx +++ b/vcl/unx/generic/app/saldata.cxx @@ -464,7 +464,6 @@ void SalXLib::Init() SalDisplay *pSalDisplay = new SalX11Display( pDisp ); pInputMethod->CreateMethod( pDisp ); - pInputMethod->AddConnectionWatch( pDisp, (void*)this ); pSalDisplay->SetInputMethod( pInputMethod ); PushXErrorLevel( true ); diff --git a/vcl/unx/generic/window/salframe.cxx b/vcl/unx/generic/window/salframe.cxx index 58760be30656..f027d50b9c6d 100644 --- a/vcl/unx/generic/window/salframe.cxx +++ b/vcl/unx/generic/window/salframe.cxx @@ -3369,12 +3369,7 @@ long X11SalFrame::HandleKeyEvent( XKeyEvent *pEvent ) if( aDeleteWatch.isDeleted() ) return 0; - rtl_TextEncoding nEncoding; - - if (mpInputContext != NULL && mpInputContext->IsMultiLingual() ) - nEncoding = RTL_TEXTENCODING_UTF8; - else - nEncoding = osl_getThreadTextEncoding(); + rtl_TextEncoding nEncoding = osl_getThreadTextEncoding(); sal_Unicode *pBuffer; sal_Unicode *pString; diff --git a/vcl/unx/kde/kdedata.cxx b/vcl/unx/kde/kdedata.cxx index c13c0238f822..d1dc388b7d31 100644 --- a/vcl/unx/kde/kdedata.cxx +++ b/vcl/unx/kde/kdedata.cxx @@ -184,7 +184,6 @@ void KDEXLib::Init() SalDisplay *pSalDisplay = new SalKDEDisplay( pDisp ); pInputMethod->CreateMethod( pDisp ); - pInputMethod->AddConnectionWatch( pDisp, (void*)this ); pSalDisplay->SetInputMethod( pInputMethod ); PushXErrorLevel( true ); diff --git a/vcl/unx/kde4/KDEXLib.cxx b/vcl/unx/kde4/KDEXLib.cxx index d8f58fa79936..39c6e2fcac12 100644 --- a/vcl/unx/kde4/KDEXLib.cxx +++ b/vcl/unx/kde4/KDEXLib.cxx @@ -178,7 +178,6 @@ void KDEXLib::Init() SalKDEDisplay *pSalDisplay = new SalKDEDisplay(pDisp); pInputMethod->CreateMethod( pDisp ); - pInputMethod->AddConnectionWatch( pDisp, (void*)this ); pSalDisplay->SetInputMethod( pInputMethod ); PushXErrorLevel( true ); |