mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-20 17:58:18 +03:00
LibGUI: Fix issue where buttons with a menu sometimes stayed depressed
When a Button has a menu, the AbstractButton behaviour will now not be used in the mousemove_event. This was already the case for mousedown_event. Why only sometimes? Normally the presence of the menu prevents mousemove_events from being delivered to the button. But the menu doesn't spawn immediately. So sometimes mousemove events got through to the AbstractButton after the menu was told to spawn but before it appeared. This caused the m_being_pressed field of AbstractButton to be set to true. But there was never a mouseup_event because the menu got those instead.
This commit is contained in:
parent
da72c6987f
commit
d96aae32ef
Notes:
sideshowbarker
2024-07-18 18:57:32 +09:00
Author: https://github.com/Maato Commit: https://github.com/SerenityOS/serenity/commit/d96aae32ef2 Pull-request: https://github.com/SerenityOS/serenity/pull/6718 Issue: https://github.com/SerenityOS/serenity/issues/6555
@ -174,4 +174,12 @@ void Button::mousedown_event(MouseEvent& event)
|
||||
AbstractButton::mousedown_event(event);
|
||||
}
|
||||
|
||||
void Button::mousemove_event(MouseEvent& event)
|
||||
{
|
||||
if (m_menu) {
|
||||
return;
|
||||
}
|
||||
AbstractButton::mousemove_event(event);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -50,6 +50,7 @@ public:
|
||||
protected:
|
||||
explicit Button(String text = {});
|
||||
virtual void mousedown_event(MouseEvent&) override;
|
||||
virtual void mousemove_event(MouseEvent&) override;
|
||||
virtual void paint_event(PaintEvent&) override;
|
||||
|
||||
private:
|
||||
|
Loading…
Reference in New Issue
Block a user