1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 01:47:35 +00:00

Calculator: Avoid focusing any keypad button other than the equal button

Having the return key sometimes press the equal button when nothing is
focused and press a different button when there is focus felt confusing.

The equal button is still able to be focused for the tab cycle to have
something to go to in order to jump out of the textbox but no other
keypad button can be focused now.
This commit is contained in:
ForLoveOfCats 2022-02-01 18:48:24 -05:00 committed by Linus Groh
parent 0d0ba375e2
commit 19f80f88bf
2 changed files with 26 additions and 4 deletions

View file

@ -160,10 +160,6 @@ void CalculatorWidget::update_display()
void CalculatorWidget::keydown_event(GUI::KeyEvent& event)
{
//Clear button selection when we are typing
m_equals_button->set_focus(true);
m_equals_button->set_focus(false);
if (event.key() == KeyCode::Key_Return || event.key() == KeyCode::Key_Equal) {
m_keypad.set_value(m_calculator.finish_operation(m_keypad.value()));
mimic_pressed_button(m_equals_button);