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
+16 -16
View File
@@ -900,26 +900,26 @@ Window::MouseDown(BMessage* message, BPoint where,
if (!IsFocus()) {
bool acceptFirstClick
= (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
// click, depending on the mouse mode
DesktopSettings desktopSettings(fDesktop);
if (desktopSettings.MouseMode() == B_NORMAL_MOUSE
&& !acceptFirstClick)
fDesktop->ActivateWindow(this);
else if (!avoidFocus)
fDesktop->SetFocusWindow(this);
if (!acceptFirstClick) {
bool avoidFocus = (Flags() & B_AVOID_FOCUS) != 0;
DesktopSettings desktopSettings(fDesktop);
if (desktopSettings.MouseMode() == B_NORMAL_MOUSE)
fDesktop->ActivateWindow(this);
else if (!avoidFocus)
fDesktop->SetFocusWindow(this);
// Eat the click if we don't accept first click
// (B_AVOID_FOCUS never gets the focus, so they always accept
// the first click)
// TODO: the latter is unlike BeOS - if we really wanted to
// imitate this behaviour, we would need to check if we're
// the front window instead of the focus window
if (!acceptFirstClick && !desktopSettings.AcceptFirstClick()
&& !avoidFocus)
return;
// Eat the click if we don't accept first click
// (B_AVOID_FOCUS never gets the focus, so they always accept
// the first click)
// TODO: the latter is unlike BeOS - if we really wanted to
// imitate this behaviour, we would need to check if we're
// the front window instead of the focus window
if (!desktopSettings.AcceptFirstClick() && !avoidFocus)
return;
}
}
// fill out view token for the view under the mouse