1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 02:38:11 +00:00

WindowServer: Re-evaluate the mouse cursor when alpha hit-testing

A window repaint may change the alpha value, resulting in a different
hit test outcome. In those cases, re-evaluate the cursor hit testing
after a window was painted, and update the cursor if needed.
This commit is contained in:
Tom 2021-02-21 11:56:59 -07:00 committed by Andreas Kling
parent bd830c2dfe
commit 2d29bfc89e
4 changed files with 60 additions and 5 deletions

View file

@ -603,6 +603,8 @@ void ClientConnection::handle(const Messages::WindowServer::DidFinishPainting& m
auto& window = *(*it).value;
for (auto& rect : message.rects())
window.invalidate(rect);
if (window.has_alpha_channel() && window.alpha_hit_threshold() > 0.0)
WindowManager::the().reevaluate_hovered_window(&window);
WindowSwitcher::the().refresh_if_needed();
}
@ -661,7 +663,8 @@ OwnPtr<Messages::WindowServer::SetWindowCursorResponse> ClientConnection::handle
return {};
}
window.set_cursor(Cursor::create((Gfx::StandardCursor)message.cursor_type()));
Compositor::the().invalidate_cursor();
if (&window == WindowManager::the().hovered_window())
Compositor::the().invalidate_cursor();
return make<Messages::WindowServer::SetWindowCursorResponse>();
}