diff options
Diffstat (limited to 'experimental/tqtinterface/qt4/src/kernel/tqwidget.cpp')
-rw-r--r-- | experimental/tqtinterface/qt4/src/kernel/tqwidget.cpp | 33 |
1 files changed, 29 insertions, 4 deletions
diff --git a/experimental/tqtinterface/qt4/src/kernel/tqwidget.cpp b/experimental/tqtinterface/qt4/src/kernel/tqwidget.cpp index 9e60bacf7..67d0e1be9 100644 --- a/experimental/tqtinterface/qt4/src/kernel/tqwidget.cpp +++ b/experimental/tqtinterface/qt4/src/kernel/tqwidget.cpp @@ -5953,8 +5953,24 @@ void TQWidget::setFocus() if ( isActiveWindow() ) { TQWidget * prev = tqApp->focus_widget; if ( prev ) { - if ( prev != this ) + // This part is never executed when TQ_WS_X11? Preceding XFocusOut + // had already reset focus_widget when received XFocusIn + + // Don't reset input context explicitly here. Whether reset or not + // when focusing out is a responsibility of input methods. For + // example, Japanese input context should not be reset here. The + // context sometimes contains a whole paragraph and has minutes of + // lifetime different to ephemeral one in other languages. The + // input context should be survived until focused again. So we + // delegate the responsibility to input context via + // unfocusInputContext(). + if ( prev != this && prev->isInputMethodEnabled() ) { +#if 0 prev->resetInputContext(); +#else + prev->unfocusInputContext(); +#endif + } } #if defined(TQ_WS_WIN) else { @@ -5962,9 +5978,8 @@ void TQWidget::setFocus() } #endif tqApp->focus_widget = this; -#if defined(TQ_WS_X11) - focusInputContext(); -#endif + if( isInputMethodEnabled() ) + focusInputContext(); #if defined(TQ_WS_WIN) if ( !tqtopLevelWidget()->isPopup() ) @@ -6012,7 +6027,11 @@ void TQWidget::clearFocus() focusProxy()->clearFocus(); return; } else if ( hasFocus() ) { +#if !defined(TQ_WS_X11) resetInputContext(); +#else + unfocusInputContext(); +#endif TQWidget* w = tqApp->tqfocusWidget(); // clear active focus tqApp->focus_widget = 0; @@ -7338,7 +7357,13 @@ bool TQWidget::event( TQEvent *e ) break; case TQEvent::MouseButtonPress: + // Don't reset input context here. Whether reset or not is + // a responsibility of input method. reset() will be + // called by mouseHandler() of input method if necessary + // via mousePressEvent() of text widgets. +#if 0 resetInputContext(); +#endif mousePressEvent( (TQMouseEvent*)e ); if ( ! ((TQMouseEvent*)e)->isAccepted() ) return FALSE; |