From c6906c2832dfea48b42e8443c07120468a71a1b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Fri, 31 Jul 2009 11:58:59 +0000 Subject: [PATCH] * In FFM mode, when a window was closed, or the workspace was changed, the window under the mouse was given focus. This makes using FFM with the keyboard alone very inconvenient to use, which is why now the window that previously had focus will regain it instead; as soon as you actually move the mouse, the focus is changed as usual. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32014 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/servers/app/Desktop.cpp | 9 +++++---- src/servers/app/Window.cpp | 9 ++++++--- src/servers/app/Window.h | 5 +++-- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/src/servers/app/Desktop.cpp b/src/servers/app/Desktop.cpp index 4304b4ed7b..bb9ee8044d 100644 --- a/src/servers/app/Desktop.cpp +++ b/src/servers/app/Desktop.cpp @@ -236,7 +236,8 @@ MouseFilter::Filter(BMessage* message, EventTarget** _target, int32* _viewToken, case B_MOUSE_MOVED: window->MouseMoved(message, where, &viewToken, - latestMouseMoved == NULL || latestMouseMoved == message); + latestMouseMoved == NULL || latestMouseMoved == message, + false); break; } @@ -1394,8 +1395,7 @@ Desktop::RemoveWorkspacesView(WorkspacesView* view) } -/*! - \brief Sends a fake B_MOUSE_MOVED event to the window under the mouse, +/*! \brief Sends a fake B_MOUSE_MOVED event to the window under the mouse, and also updates the current view under the mouse. This has only to be done in case the view changed without user interaction, @@ -1416,7 +1416,8 @@ Desktop::_SendFakeMouseMoved(Window* window) if (window != NULL) { BMessage message; - window->MouseMoved(&message, fLastMousePosition, &viewToken, true); + window->MouseMoved(&message, fLastMousePosition, &viewToken, true, + true); if (viewToken != B_NULL_TOKEN) target = &window->EventTarget(); diff --git a/src/servers/app/Window.cpp b/src/servers/app/Window.cpp index d42fc9a131..90954eb91f 100644 --- a/src/servers/app/Window.cpp +++ b/src/servers/app/Window.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001-2009, Haiku, Inc. + * Copyright 2001-2009, Haiku, Inc. * Distributed under the terms of the MIT license. * * Authors: @@ -981,7 +981,7 @@ Window::MouseUp(BMessage* message, BPoint where, int32* _viewToken) void Window::MouseMoved(BMessage *message, BPoint where, int32* _viewToken, - bool isLatestMouseMoved) + bool isLatestMouseMoved, bool isFake) { #if 0 if (fDecorator != NULL && fTopView != NULL) { @@ -1110,7 +1110,10 @@ Window::MouseMoved(BMessage *message, BPoint where, int32* _viewToken, DesktopSettings desktopSettings(fDesktop); if (desktopSettings.FocusFollowsMouse() && !IsFocus() && !(Flags() & B_AVOID_FOCUS)) { - fDesktop->SetFocusWindow(this); + // If the mouse move is a fake one, we set the focus to NULL, which + // will cause the window that had focus last to retrieve it again - this + // makes FFM much nicer to use with the keyboard. + fDesktop->SetFocusWindow(isFake ? NULL : this); } // mouse cursor diff --git a/src/servers/app/Window.h b/src/servers/app/Window.h index c26343a15f..bf12efb16a 100644 --- a/src/servers/app/Window.h +++ b/src/servers/app/Window.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001-2009, Haiku, Inc. + * Copyright 2001-2009, Haiku, Inc. * Distributed under the terms of the MIT license. * * Authors: @@ -139,7 +139,8 @@ public: void MouseUp(BMessage* message, BPoint where, int32* _viewToken); void MouseMoved(BMessage* message, BPoint where, - int32* _viewToken, bool isLatestMouseMoved); + int32* _viewToken, bool isLatestMouseMoved, + bool isFake); // some hooks to inform the client window // TODO: move this to ServerWindow maybe?