Author: axeld Date: 2009-10-21 12:14:09 +0200 (Wed, 21 Oct 2009) New Revision: 33697 Changeset: http://dev.haiku-os.org/changeset/33697/haiku Modified: haiku/trunk/src/servers/app/Desktop.cpp Log: * 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. Modified: haiku/trunk/src/servers/app/Desktop.cpp =================================================================== --- haiku/trunk/src/servers/app/Desktop.cpp 2009-10-21 10:06:31 UTC (rev 33696) +++ haiku/trunk/src/servers/app/Desktop.cpp 2009-10-21 10:14:09 UTC (rev 33697) @@ -74,7 +74,7 @@ virtual void RemoveTarget(EventTarget* target); private: - void _UpdateFocus(int32 key, EventTarget** _target); + void _UpdateFocus(int32 key, uint32 modifiers, EventTarget** _target); Desktop* fDesktop; EventTarget* fLastFocus; @@ -106,12 +106,14 @@ void -KeyboardFilter::_UpdateFocus(int32 key, EventTarget** _target) +KeyboardFilter::_UpdateFocus(int32 key, uint32 modifiers, EventTarget** _target) { if (!fDesktop->LockSingleWindow()) return; EventTarget* focus = fDesktop->KeyboardEventTarget(); + +#if 0 bigtime_t now = system_time(); // TODO: this is a try to not steal focus from the current window @@ -123,20 +125,26 @@ if (fLastFocus == NULL || (focus != fLastFocus && now - fTimestamp > 100000)) { // 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 // it, and the event focus passed in is always valid (or NULL) *_target = focus; fLastFocus = focus; } +#endif + *_target = focus; + fLastFocus = focus; fDesktop->UnlockSingleWindow(); +#if 0 // 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; else fTimestamp = now; +#endif } @@ -182,7 +190,7 @@ || message->what == B_MODIFIERS_CHANGED || message->what == B_UNMAPPED_KEY_DOWN || message->what == B_INPUT_METHOD_EVENT) - _UpdateFocus(key, _target); + _UpdateFocus(key, modifiers, _target); return B_DISPATCH_MESSAGE; } @@ -3043,11 +3051,13 @@ // But only normal windows are following uint32 oldWorkspaces = fMouseEventWindow->Workspaces(); - _Windows(index).AddWindow(fMouseEventWindow); _Windows(previousIndex).RemoveWindow(fMouseEventWindow); + _Windows(index).AddWindow(fMouseEventWindow, + fMouseEventWindow->Frontmost(_Windows(index).FirstWindow(), + index)); - _UpdateSubsetWorkspaces(fMouseEventWindow, previousIndex, - index); + // TODO: subset windows will always flicker this way + movedMouseEventWindow = true; // send B_WORKSPACES_CHANGED message