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
This commit is contained in:
Jérôme Duval 2006-06-04 21:54:21 +00:00
parent 360e569a2c
commit 79adc02bc6
2 changed files with 12 additions and 17 deletions

View File

@ -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);
}
}
}

View File

@ -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);
}
}