diff --git a/src/kits/interface/View.cpp b/src/kits/interface/View.cpp index a916a356f7..c2f8decfe1 100644 --- a/src/kits/interface/View.cpp +++ b/src/kits/interface/View.cpp @@ -1386,13 +1386,11 @@ BView::MakeFocus(bool focusState) if (focus && focus != this) focus->MakeFocus(false); // if we want to make this view the current focus view - fOwner->fFocus = this; - fOwner->SetPreferredHandler(this); + fOwner->_SetFocus(this, true); } else { // we want to unfocus this view, but only if it actually has focus if (focus == this) { - fOwner->fFocus = NULL; - fOwner->SetPreferredHandler(NULL); + fOwner->_SetFocus(NULL, true); } } } diff --git a/src/kits/interface/Window.cpp b/src/kits/interface/Window.cpp index 1d3bf0c870..1de4cef90c 100644 --- a/src/kits/interface/Window.cpp +++ b/src/kits/interface/Window.cpp @@ -2659,9 +2659,6 @@ BWindow::_SetFocus(BView *focusView, bool notifyInputServer) if (fFocus == focusView) return; - if (focusView) - focusView->MakeFocus(true); - // we notify the input server if we are passing focus // from a view which has the B_INPUT_METHOD_AWARE to a one // which does not, or vice-versa @@ -2669,17 +2666,16 @@ BWindow::_SetFocus(BView *focusView, bool notifyInputServer) bool oldIMAware = false, newIMAware = false; if (focusView) newIMAware = focusView->Flags() & B_INPUT_METHOD_AWARE; - if (fFocus) - oldIMAware = fFocus->Flags() & B_INPUT_METHOD_AWARE; - if (newIMAware ^ oldIMAware) { - BMessage msg(newIMAware ? IS_FOCUS_IM_AWARE_VIEW : IS_UNFOCUS_IM_AWARE_VIEW); - BMessage reply; - _control_input_server_(&msg, &reply); - // do we care return code ? - } + BMessage msg(newIMAware ? IS_FOCUS_IM_AWARE_VIEW : IS_UNFOCUS_IM_AWARE_VIEW); + BMessenger messenger(focusView); + BMessage reply; + if (focusView) + msg.AddMessenger("view", messenger); + _control_input_server_(&msg, &reply); } fFocus = focusView; + SetPreferredHandler(focusView); } @@ -3014,8 +3010,9 @@ BWindow::_KeyboardNavigation() else nextFocus = _FindNextNavigable(fFocus, jumpGroups); - if (nextFocus && nextFocus != fFocus) - _SetFocus(nextFocus, false); + if (nextFocus && nextFocus != fFocus) { + nextFocus->MakeFocus(true); + } }