app_server: don't focus the window on mouse down if it accepts first click

* matches BeOS behaviour. Fixes #15544.

Change-Id: I2a3636024753b53ba9ad6446c187e6a4479c31b6
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2020
Reviewed-by: John Scipione <[email protected]>
This commit is contained in:
X512
2019-12-31 09:28:59 +00:00
committed by Adrien Destugues
parent c9606abe0c
commit 9ca1f3a903
+5 -5
View File
@@ -900,13 +900,13 @@ Window::MouseDown(BMessage* message, BPoint where,
if (!IsFocus()) { if (!IsFocus()) {
bool acceptFirstClick bool acceptFirstClick
= (Flags() & B_WILL_ACCEPT_FIRST_CLICK) != 0; = (Flags() & B_WILL_ACCEPT_FIRST_CLICK) != 0;
bool avoidFocus = (Flags() & B_AVOID_FOCUS) != 0;
// Activate or focus the window in case it doesn't accept first // Activate or focus the window in case it doesn't accept first
// click, depending on the mouse mode // click, depending on the mouse mode
if (!acceptFirstClick) {
bool avoidFocus = (Flags() & B_AVOID_FOCUS) != 0;
DesktopSettings desktopSettings(fDesktop); DesktopSettings desktopSettings(fDesktop);
if (desktopSettings.MouseMode() == B_NORMAL_MOUSE if (desktopSettings.MouseMode() == B_NORMAL_MOUSE)
&& !acceptFirstClick)
fDesktop->ActivateWindow(this); fDesktop->ActivateWindow(this);
else if (!avoidFocus) else if (!avoidFocus)
fDesktop->SetFocusWindow(this); fDesktop->SetFocusWindow(this);
@@ -917,10 +917,10 @@ Window::MouseDown(BMessage* message, BPoint where,
// TODO: the latter is unlike BeOS - if we really wanted to // TODO: the latter is unlike BeOS - if we really wanted to
// imitate this behaviour, we would need to check if we're // imitate this behaviour, we would need to check if we're
// the front window instead of the focus window // the front window instead of the focus window
if (!acceptFirstClick && !desktopSettings.AcceptFirstClick() if (!desktopSettings.AcceptFirstClick() && !avoidFocus)
&& !avoidFocus)
return; return;
} }
}
// fill out view token for the view under the mouse // fill out view token for the view under the mouse
viewToken = view->Token(); viewToken = view->Token();