mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-02 16:25:34 +03:00
WindowServer: Fix the cursor being offset with highlighting enabled
This commit is contained in:
parent
fc3fd7212f
commit
d3ed490cb4
Notes:
sideshowbarker
2024-07-17 10:19:28 +09:00
Author: https://github.com/MacDue Commit: https://github.com/SerenityOS/serenity/commit/d3ed490cb4 Pull-request: https://github.com/SerenityOS/serenity/pull/14219
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user