summaryrefslogtreecommitdiff
path: root/Servers/WindowServer
diff options
context:
space:
mode:
authorBen Wiederhake <BenWiederhake.GitHub@gmx.de>2020-05-04 05:00:34 +0200
committerAndreas Kling <kling@serenityos.org>2020-05-07 22:15:16 +0200
commit124cbea347646bcc083fbbd275b862d7ea69ec01 (patch)
treea59a7dfd65e6e1303bb1fa2a2180c7abd65e936c /Servers/WindowServer
parentcc67671d959f29fccf6bca0f0fcdeaf84b74c3d3 (diff)
downloadserenity-124cbea347646bcc083fbbd275b862d7ea69ec01.zip
WindowServer: Fix 'Maximize' Button
When a window is maximized by clicking the 'maximize' button in the window frame, the WindowFrame *is* invalidated and repainted properly. However, the internal state of the WindowServer::Button does not get updated until the next mouse movement. This means that the 'maximize' button is erroneously highlighted until the mouse moves again. This is very visible. Ideally, a patch should compute the actual new m_hovered. However, this requires knowledge of the new rect, or calling something on the Button after the new rect has been determined. Until someone can figure out a good way around this, setting m_hovered to false is a solution that 'usually' works. Note that this does *not* work when after maximizing/restoring, the maximize button falls exactly under the mouse again. The button functions properly, but is erroneously not highlighted. At least a *missing* highlight is less noticable than a highlight too many.
Diffstat (limited to 'Servers/WindowServer')
-rw-r--r--Servers/WindowServer/Button.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/Servers/WindowServer/Button.cpp b/Servers/WindowServer/Button.cpp
index 449ce083e0..95037d4bc8 100644
--- a/Servers/WindowServer/Button.cpp
+++ b/Servers/WindowServer/Button.cpp
@@ -78,8 +78,14 @@ void Button::on_mouse_event(const MouseEvent& event)
if (on_click)
on_click(*this);
}
- if (old_pressed != m_pressed)
+ if (old_pressed != m_pressed) {
+ // Would like to compute:
+ // m_hovered = rect_after_action().contains(event.position());
+ // However, we don't know that rect yet. We can make an educated
+ // guess which also looks okay even when wrong:
+ m_hovered = false;
wm.invalidate(screen_rect());
+ }
return;
}