summaryrefslogtreecommitdiff
path: root/Userland/Services
diff options
context:
space:
mode:
authorMacDue <macdue@dueutil.tech>2022-06-07 21:12:23 +0100
committerLinus Groh <mail@linusgroh.de>2022-06-10 23:02:34 +0100
commitd3ed490cb48245485a533ffdad166a586946f410 (patch)
treeb8c7b1c7f0062df51b374f81405e3e4122299b6d /Userland/Services
parentfc3fd7212f4f40a9e1405f5d35679fe6e9a6d6e4 (diff)
downloadserenity-d3ed490cb48245485a533ffdad166a586946f410.zip
WindowServer: Fix the cursor being offset with highlighting enabled
Diffstat (limited to 'Userland/Services')
-rw-r--r--Userland/Services/WindowServer/Compositor.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/Userland/Services/WindowServer/Compositor.cpp b/Userland/Services/WindowServer/Compositor.cpp
index 485e5987dc..d41c656355 100644
--- a/Userland/Services/WindowServer/Compositor.cpp
+++ b/Userland/Services/WindowServer/Compositor.cpp
@@ -846,9 +846,11 @@ Gfx::IntRect Compositor::current_cursor_rect() const
Gfx::IntRect cursor_rect { ScreenInput::the().cursor_location().translated(-current_cursor.params().hotspot()), current_cursor.size() };
if (wm.is_cursor_highlight_enabled()) {
auto highlight_diameter = wm.cursor_highlight_radius() * 2;
- cursor_rect.inflate(
- highlight_diameter - cursor_rect.width(),
- highlight_diameter - cursor_rect.height());
+ auto inflate_w = highlight_diameter - cursor_rect.width();
+ auto inflate_h = highlight_diameter - cursor_rect.height();
+ cursor_rect.inflate(inflate_w, inflate_h);
+ // Ensures cursor stays in the same location when highlighting is enabled.
+ cursor_rect.translate_by(-(inflate_w % 2), -(inflate_h % 2));
}
return cursor_rect;
}