diff --git a/Userland/Libraries/LibGfx/Point.cpp b/Userland/Libraries/LibGfx/Point.cpp index 88d542bc38..1b35b50203 100644 --- a/Userland/Libraries/LibGfx/Point.cpp +++ b/Userland/Libraries/LibGfx/Point.cpp @@ -15,8 +15,8 @@ namespace Gfx { template void Point::constrain(Rect const& rect) { - m_x = AK::clamp(x(), rect.left(), rect.left() + rect.width()); - m_y = AK::clamp(y(), rect.top(), rect.top() + rect.height()); + m_x = AK::clamp(x(), rect.left(), rect.right()); + m_y = AK::clamp(y(), rect.top(), rect.bottom()); } template diff --git a/Userland/Services/WindowServer/Screen.cpp b/Userland/Services/WindowServer/Screen.cpp index 4b95c9fa3d..2ce1ea4337 100644 --- a/Userland/Services/WindowServer/Screen.cpp +++ b/Userland/Services/WindowServer/Screen.cpp @@ -421,7 +421,7 @@ void ScreenInput::on_receive_mouse_data(MousePacket const& packet) auto* moved_to_screen = Screen::find_by_location(m_cursor_location); if (!moved_to_screen) { - m_cursor_location = m_cursor_location.constrained(current_screen.rect()); + m_cursor_location.constrain(current_screen.rect()); moved_to_screen = ¤t_screen; }