mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 06:17:35 +00:00
LibGUI: Use Variant's built-in equality operator in Window and Widget
Now that Variant has operator==(), we don't need to go through all this trouble to compare two Variant values.
This commit is contained in:
parent
a268dcb1e2
commit
98b8bab441
3 changed files with 4 additions and 23 deletions
|
@ -1128,15 +1128,7 @@ Gfx::IntRect Widget::children_clip_rect() const
|
|||
|
||||
void Widget::set_override_cursor(AK::Variant<Gfx::StandardCursor, NonnullRefPtr<Gfx::Bitmap const>> cursor)
|
||||
{
|
||||
auto const& are_cursors_the_same = [](auto const& a, auto const& b) {
|
||||
if (a.template has<Gfx::StandardCursor>() != b.template has<Gfx::StandardCursor>())
|
||||
return false;
|
||||
if (a.template has<Gfx::StandardCursor>())
|
||||
return a.template get<Gfx::StandardCursor>() == b.template get<Gfx::StandardCursor>();
|
||||
return a.template get<NonnullRefPtr<Gfx::Bitmap const>>().ptr() == b.template get<NonnullRefPtr<Gfx::Bitmap const>>().ptr();
|
||||
};
|
||||
|
||||
if (are_cursors_the_same(m_override_cursor, cursor))
|
||||
if (m_override_cursor == cursor)
|
||||
return;
|
||||
|
||||
m_override_cursor = move(cursor);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue