From 9ca1f3a903c3226daaab185fa9e4304b4fc6d6a6 Mon Sep 17 00:00:00 2001 From: X512 Date: Sat, 14 Dec 2019 00:06:47 +0900 Subject: [PATCH] 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 --- src/servers/app/Window.cpp | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/servers/app/Window.cpp b/src/servers/app/Window.cpp index 40e95b1896..261bb4eefa 100644 --- a/src/servers/app/Window.cpp +++ b/src/servers/app/Window.cpp @@ -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