From 79adc02bc6eeb389ef0c96681b81c77c23f91867 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Duval?= Date: Sun, 4 Jun 2006 21:54:21 +0000 Subject: [PATCH] begin to fix bug #658: makes use of BWindow::_SetFocus() in BView::MakeFocus() BWindow::_KeyboardNavigation() now uses BView::MakeFocus() This is though not enough: _SetFocus isn't called on window activation/deactivation, thus the input server isn't aware of a focus view change in this case. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17723 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kits/interface/View.cpp | 6 ++---- src/kits/interface/Window.cpp | 23 ++++++++++------------- 2 files changed, 12 insertions(+), 17 deletions(-) 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); + } }