mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 02:07:34 +00:00
LibGUI: Extend mimic pressed across keyboard shortcuts for buttons
Primary motivation for this was to get a visual indication in the browser for Ctrl-R refresh. This extends what ForLoveOfCats had done for calculator button shortcuts across all buttons with shortcuts. When an action is triggered without an activator each associated button will be set as mimic pressed.
This commit is contained in:
parent
7af87e8e6b
commit
554709fec6
3 changed files with 25 additions and 2 deletions
|
@ -224,8 +224,23 @@ void Button::set_default(bool default_button)
|
|||
|
||||
void Button::set_mimic_pressed(bool mimic_pressed)
|
||||
{
|
||||
m_mimic_pressed = mimic_pressed;
|
||||
update();
|
||||
if (!is_being_pressed()) {
|
||||
m_mimic_pressed = mimic_pressed;
|
||||
|
||||
stop_timer();
|
||||
start_timer(80, Core::TimerShouldFireWhenNotVisible::Yes);
|
||||
|
||||
update();
|
||||
}
|
||||
}
|
||||
|
||||
void Button::timer_event(Core::TimerEvent&)
|
||||
{
|
||||
if (is_mimic_pressed()) {
|
||||
m_mimic_pressed = false;
|
||||
|
||||
update();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue