* When switching the workspace while moving a window around, that window got
added to the window list without considering its frontmost window. That caused problems with all feels that were always on top, like B_ALL_WINDOW_FLOATING_FEEL. This was causing bug #4700. * Disabled the "previous window keep keyboard focus" heuristic - it doesn't really work that well. There should be a central mechanism that detects active typing that could also be used to disable touchpads. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33697 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -74,7 +74,7 @@ class KeyboardFilter : public EventFilter {
|
|||||||
virtual void RemoveTarget(EventTarget* target);
|
virtual void RemoveTarget(EventTarget* target);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void _UpdateFocus(int32 key, EventTarget** _target);
|
void _UpdateFocus(int32 key, uint32 modifiers, EventTarget** _target);
|
||||||
|
|
||||||
Desktop* fDesktop;
|
Desktop* fDesktop;
|
||||||
EventTarget* fLastFocus;
|
EventTarget* fLastFocus;
|
||||||
@@ -106,12 +106,14 @@ KeyboardFilter::KeyboardFilter(Desktop* desktop)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
KeyboardFilter::_UpdateFocus(int32 key, EventTarget** _target)
|
KeyboardFilter::_UpdateFocus(int32 key, uint32 modifiers, EventTarget** _target)
|
||||||
{
|
{
|
||||||
if (!fDesktop->LockSingleWindow())
|
if (!fDesktop->LockSingleWindow())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
EventTarget* focus = fDesktop->KeyboardEventTarget();
|
EventTarget* focus = fDesktop->KeyboardEventTarget();
|
||||||
|
|
||||||
|
#if 0
|
||||||
bigtime_t now = system_time();
|
bigtime_t now = system_time();
|
||||||
|
|
||||||
// TODO: this is a try to not steal focus from the current window
|
// TODO: this is a try to not steal focus from the current window
|
||||||
@@ -123,20 +125,26 @@ KeyboardFilter::_UpdateFocus(int32 key, EventTarget** _target)
|
|||||||
|
|
||||||
if (fLastFocus == NULL || (focus != fLastFocus && now - fTimestamp > 100000)) {
|
if (fLastFocus == NULL || (focus != fLastFocus && now - fTimestamp > 100000)) {
|
||||||
// if the time span between the key presses is very short
|
// if the time span between the key presses is very short
|
||||||
// we keep our previous focus alive - this is save even
|
// we keep our previous focus alive - this is safe even
|
||||||
// if the target doesn't exist anymore, as we don't reset
|
// if the target doesn't exist anymore, as we don't reset
|
||||||
// it, and the event focus passed in is always valid (or NULL)
|
// it, and the event focus passed in is always valid (or NULL)
|
||||||
*_target = focus;
|
*_target = focus;
|
||||||
fLastFocus = focus;
|
fLastFocus = focus;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
*_target = focus;
|
||||||
|
fLastFocus = focus;
|
||||||
|
|
||||||
fDesktop->UnlockSingleWindow();
|
fDesktop->UnlockSingleWindow();
|
||||||
|
|
||||||
|
#if 0
|
||||||
// we always allow to switch focus after the enter key has pressed
|
// we always allow to switch focus after the enter key has pressed
|
||||||
if (key == B_ENTER)
|
if (key == B_ENTER || modifiers == B_COMMAND_KEY
|
||||||
|
|| modifiers == B_CONTROL_KEY || modifiers == B_OPTION_KEY)
|
||||||
fTimestamp = 0;
|
fTimestamp = 0;
|
||||||
else
|
else
|
||||||
fTimestamp = now;
|
fTimestamp = now;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -182,7 +190,7 @@ KeyboardFilter::Filter(BMessage* message, EventTarget** _target,
|
|||||||
|| message->what == B_MODIFIERS_CHANGED
|
|| message->what == B_MODIFIERS_CHANGED
|
||||||
|| message->what == B_UNMAPPED_KEY_DOWN
|
|| message->what == B_UNMAPPED_KEY_DOWN
|
||||||
|| message->what == B_INPUT_METHOD_EVENT)
|
|| message->what == B_INPUT_METHOD_EVENT)
|
||||||
_UpdateFocus(key, _target);
|
_UpdateFocus(key, modifiers, _target);
|
||||||
|
|
||||||
return B_DISPATCH_MESSAGE;
|
return B_DISPATCH_MESSAGE;
|
||||||
}
|
}
|
||||||
@@ -3043,11 +3051,13 @@ Desktop::_SetWorkspace(int32 index)
|
|||||||
// But only normal windows are following
|
// But only normal windows are following
|
||||||
uint32 oldWorkspaces = fMouseEventWindow->Workspaces();
|
uint32 oldWorkspaces = fMouseEventWindow->Workspaces();
|
||||||
|
|
||||||
_Windows(index).AddWindow(fMouseEventWindow);
|
|
||||||
_Windows(previousIndex).RemoveWindow(fMouseEventWindow);
|
_Windows(previousIndex).RemoveWindow(fMouseEventWindow);
|
||||||
|
_Windows(index).AddWindow(fMouseEventWindow,
|
||||||
|
fMouseEventWindow->Frontmost(_Windows(index).FirstWindow(),
|
||||||
|
index));
|
||||||
|
|
||||||
|
// TODO: subset windows will always flicker this way
|
||||||
|
|
||||||
_UpdateSubsetWorkspaces(fMouseEventWindow, previousIndex,
|
|
||||||
index);
|
|
||||||
movedMouseEventWindow = true;
|
movedMouseEventWindow = true;
|
||||||
|
|
||||||
// send B_WORKSPACES_CHANGED message
|
// send B_WORKSPACES_CHANGED message
|
||||||
|
|||||||
Reference in New Issue
Block a user