summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-06-18 17:43:36 +0200
committerAndreas Kling <kling@serenityos.org>2021-06-18 17:55:41 +0200
commit4895f46d8cd9a45fb3732f08389933ec40c57b43 (patch)
treedfc3f8b863925833c1377fc3a6123e3e0d4c62df /Userland
parent82f1ac73903c087c684f4f29c03e13b7fb8cd8ef (diff)
downloadserenity-4895f46d8cd9a45fb3732f08389933ec40c57b43.zip
WindowServer: Make various functions take MouseEvent by const reference
Some paths of the mouse event processing code will upgrade the event from a regular MouseDown to a MouseDoubleClick. That's why we were passing `MouseEvent&` everywhere. For the paths that don't need to do this, passing `MouseEvent const&` reduces the cognitive burden a bit, so let's do that.
Diffstat (limited to 'Userland')
-rw-r--r--Userland/Services/WindowServer/WindowManager.cpp8
-rw-r--r--Userland/Services/WindowServer/WindowManager.h8
2 files changed, 8 insertions, 8 deletions
diff --git a/Userland/Services/WindowServer/WindowManager.cpp b/Userland/Services/WindowServer/WindowManager.cpp
index c3e11360f5..38001b9ee3 100644
--- a/Userland/Services/WindowServer/WindowManager.cpp
+++ b/Userland/Services/WindowServer/WindowManager.cpp
@@ -896,7 +896,7 @@ void WindowManager::process_event_for_doubleclick(Window& window, MouseEvent& ev
metadata.last_position = event.position();
}
-void WindowManager::deliver_mouse_event(Window& window, MouseEvent& event, bool process_double_click)
+void WindowManager::deliver_mouse_event(Window& window, MouseEvent const& event, bool process_double_click)
{
auto translated_event = event.translated(-window.position());
window.dispatch_event(translated_event);
@@ -907,7 +907,7 @@ void WindowManager::deliver_mouse_event(Window& window, MouseEvent& event, bool
}
}
-bool WindowManager::process_ongoing_active_input_mouse_event(MouseEvent& event)
+bool WindowManager::process_ongoing_active_input_mouse_event(MouseEvent const& event)
{
if (!m_active_input_tracking_window)
return false;
@@ -927,7 +927,7 @@ bool WindowManager::process_ongoing_active_input_mouse_event(MouseEvent& event)
return true;
}
-bool WindowManager::process_mouse_event_for_titlebar_buttons(MouseEvent& event)
+bool WindowManager::process_mouse_event_for_titlebar_buttons(MouseEvent const& event)
{
if (m_cursor_tracking_button) {
m_cursor_tracking_button->on_mouse_event(event.translated(-m_cursor_tracking_button->screen_rect().location()));
@@ -941,7 +941,7 @@ bool WindowManager::process_mouse_event_for_titlebar_buttons(MouseEvent& event)
return false;
}
-void WindowManager::process_mouse_event_for_window(HitTestResult& result, MouseEvent& event)
+void WindowManager::process_mouse_event_for_window(HitTestResult& result, MouseEvent const& event)
{
auto& window = *result.window;
diff --git a/Userland/Services/WindowServer/WindowManager.h b/Userland/Services/WindowServer/WindowManager.h
index dbedc2c4d0..578c67ed67 100644
--- a/Userland/Services/WindowServer/WindowManager.h
+++ b/Userland/Services/WindowServer/WindowManager.h
@@ -182,7 +182,7 @@ public:
void invalidate_after_theme_or_font_change();
bool set_hovered_window(Window*);
- void deliver_mouse_event(Window&, MouseEvent&, bool process_double_click);
+ void deliver_mouse_event(Window&, MouseEvent const&, bool process_double_click);
void did_popup_a_menu(Badge<Menu>);
@@ -239,9 +239,9 @@ private:
bool process_ongoing_window_resize(MouseEvent const&);
bool process_ongoing_window_move(MouseEvent&);
bool process_ongoing_drag(MouseEvent&);
- bool process_ongoing_active_input_mouse_event(MouseEvent&);
- bool process_mouse_event_for_titlebar_buttons(MouseEvent&);
- void process_mouse_event_for_window(HitTestResult&, MouseEvent&);
+ bool process_ongoing_active_input_mouse_event(MouseEvent const&);
+ bool process_mouse_event_for_titlebar_buttons(MouseEvent const&);
+ void process_mouse_event_for_window(HitTestResult&, MouseEvent const&);
template<typename Callback>
void for_each_window_manager(Callback);