summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-06-18 17:38:21 +0200
committerAndreas Kling <kling@serenityos.org>2021-06-18 17:40:05 +0200
commit82f1ac73903c087c684f4f29c03e13b7fb8cd8ef (patch)
tree07a6dc1ed4b079bbd55b327f3bdbc73d4a90f0c2 /Userland
parent1537172a6b378c1b9e01495214b557abffd16bc9 (diff)
downloadserenity-82f1ac73903c087c684f4f29c03e13b7fb8cd8ef.zip
WindowServer: Don't include frame when determining hovered window
We only consider a window "hovered" if its *content area* is hovered.
Diffstat (limited to 'Userland')
-rw-r--r--Userland/Services/WindowServer/WindowManager.cpp2
-rw-r--r--Userland/Services/WindowServer/WindowStack.cpp4
-rw-r--r--Userland/Services/WindowServer/WindowStack.h6
3 files changed, 9 insertions, 3 deletions
diff --git a/Userland/Services/WindowServer/WindowManager.cpp b/Userland/Services/WindowServer/WindowManager.cpp
index 08d980b877..c3e11360f5 100644
--- a/Userland/Services/WindowServer/WindowManager.cpp
+++ b/Userland/Services/WindowServer/WindowManager.cpp
@@ -1149,7 +1149,7 @@ void WindowManager::event(Core::Event& event)
m_previous_event_was_super_keydown = false;
process_mouse_event(mouse_event);
- set_hovered_window(m_window_stack.window_at(mouse_event.position()));
+ set_hovered_window(m_window_stack.window_at(mouse_event.position(), WindowStack::IncludeWindowFrame::No));
return;
}
diff --git a/Userland/Services/WindowServer/WindowStack.cpp b/Userland/Services/WindowServer/WindowStack.cpp
index fdff6f4bbe..3b914f2b8b 100644
--- a/Userland/Services/WindowServer/WindowStack.cpp
+++ b/Userland/Services/WindowServer/WindowStack.cpp
@@ -38,11 +38,13 @@ void WindowStack::move_to_front(Window& window)
m_windows.append(window);
}
-Window* WindowStack::window_at(Gfx::IntPoint const& position) const
+Window* WindowStack::window_at(Gfx::IntPoint const& position, IncludeWindowFrame include_window_frame) const
{
auto result = hit_test(position);
if (!result.has_value())
return nullptr;
+ if (include_window_frame == IncludeWindowFrame::No && result->is_frame_hit)
+ return nullptr;
return result->window;
}
diff --git a/Userland/Services/WindowServer/WindowStack.h b/Userland/Services/WindowServer/WindowStack.h
index f11a43ba3f..ccabb8bb6a 100644
--- a/Userland/Services/WindowServer/WindowStack.h
+++ b/Userland/Services/WindowServer/WindowStack.h
@@ -20,7 +20,11 @@ public:
void remove(Window&);
void move_to_front(Window&);
- Window* window_at(Gfx::IntPoint const&) const;
+ enum class IncludeWindowFrame {
+ Yes,
+ No,
+ };
+ Window* window_at(Gfx::IntPoint const&, IncludeWindowFrame = IncludeWindowFrame::Yes) const;
template<typename Callback>
IterationDecision for_each_visible_window_from_back_to_front(Callback);