mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 18:28:12 +00:00
LibGUI: Retain the active input tracking widget's cursor
Until the tracking stops, we want to keep displaying the same cursor.
This commit is contained in:
parent
1885445a79
commit
6548ae8afd
2 changed files with 12 additions and 5 deletions
|
@ -1177,10 +1177,17 @@ void Window::update_cursor()
|
|||
{
|
||||
auto new_cursor = m_cursor;
|
||||
|
||||
if (m_hovered_widget) {
|
||||
auto override_cursor = m_hovered_widget->override_cursor();
|
||||
if (override_cursor.has<NonnullRefPtr<Gfx::Bitmap>>() || override_cursor.get<Gfx::StandardCursor>() != Gfx::StandardCursor::None)
|
||||
new_cursor = move(override_cursor);
|
||||
auto is_usable_cursor = [](auto& cursor) {
|
||||
return cursor.template has<NonnullRefPtr<Gfx::Bitmap>>() || cursor.template get<Gfx::StandardCursor>() != Gfx::StandardCursor::None;
|
||||
};
|
||||
|
||||
// NOTE: If there's an automatic cursor tracking widget, we retain its cursor until tracking stops.
|
||||
if (auto widget = m_automatic_cursor_tracking_widget) {
|
||||
if (is_usable_cursor(widget->override_cursor()))
|
||||
new_cursor = widget->override_cursor();
|
||||
} else if (auto widget = m_hovered_widget) {
|
||||
if (is_usable_cursor(widget->override_cursor()))
|
||||
new_cursor = widget->override_cursor();
|
||||
}
|
||||
|
||||
if (are_cursors_the_same(m_effective_cursor, new_cursor))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue