WindowServer: Reevaluate hovered window on window rect change

When a new Window instance is added to the WindowManager, it does not
yet have an updated value for `m_frame->rect()` and we're not checking
if there is a new candidate for the hovered window, which we need to do
since the mouse cursor might hover above the newly opened window.

This fixes both issues: as soon as a Window frame's rect is changed,
ask the WindowManager to reevaluate its hovered window. This takes care
of newly opened windows _and_ windows that are programmatically changed
in size.

This works because when a Window becomes hovered, the WindowManager
sends out an enter event. This event in turn triggers the Window to
evaluate the cursor type under the mouse position and to update it when
necessary.

Fixes #4809.
This commit is contained in:
Jelle Raaijmakers 2021-04-27 01:17:00 +02:00 committed by Andreas Kling
parent 83dfc4aa46
commit 2e1320f264

View file

@ -414,6 +414,7 @@ void WindowManager::notify_rect_changed(Window& window, const Gfx::IntRect& old_
AppletManager::the().relayout();
MenuManager::the().refresh();
reevaluate_hovered_window(&window);
}
void WindowManager::notify_opacity_changed(Window&)