diff options
author | Karol Baraniecki <karol@baraniecki.eu> | 2022-12-26 17:07:00 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-12-31 00:07:13 +0100 |
commit | ef9fd6c2863fb393b422675d8121293c98e44f51 (patch) | |
tree | 40ee7ca7420728fc7befe9f44b239d7572a7679e /Userland/Applications/Calculator | |
parent | c65df44eee2c7814c4eb38601c29a4e36308ebb8 (diff) | |
download | serenity-ef9fd6c2863fb393b422675d8121293c98e44f51.zip |
Calculator: Fix which digits get animated when pressing keyboard keys
Previously every digit press would appear like "0" was pressed on the
keypad.
Diffstat (limited to 'Userland/Applications/Calculator')
-rw-r--r-- | Userland/Applications/Calculator/CalculatorWidget.cpp | 3 | ||||
-rw-r--r-- | Userland/Applications/Calculator/Keypad.cpp | 3 | ||||
-rw-r--r-- | Userland/Applications/Calculator/Keypad.h | 2 |
3 files changed, 4 insertions, 4 deletions
diff --git a/Userland/Applications/Calculator/CalculatorWidget.cpp b/Userland/Applications/Calculator/CalculatorWidget.cpp index 6f2cc8b5ab..c1129e5e07 100644 --- a/Userland/Applications/Calculator/CalculatorWidget.cpp +++ b/Userland/Applications/Calculator/CalculatorWidget.cpp @@ -159,7 +159,8 @@ void CalculatorWidget::keydown_event(GUI::KeyEvent& event) m_keypad.set_value(m_calculator.finish_operation(m_keypad.value())); mimic_pressed_button(m_equals_button); } else if (event.code_point() >= '0' && event.code_point() <= '9') { - auto const digit = m_keypad.type_digit(event.code_point() - '0'); + auto const digit = event.code_point() - '0'; + m_keypad.type_digit(digit); mimic_pressed_button(m_digit_button[digit]); } else if (event.code_point() == '.') { m_keypad.type_decimal_point(); diff --git a/Userland/Applications/Calculator/Keypad.cpp b/Userland/Applications/Calculator/Keypad.cpp index b89e0f5d2e..c116c02580 100644 --- a/Userland/Applications/Calculator/Keypad.cpp +++ b/Userland/Applications/Calculator/Keypad.cpp @@ -12,7 +12,7 @@ #include <LibCrypto/BigInt/UnsignedBigInteger.h> #include <LibCrypto/NumberTheory/ModularFunctions.h> -unsigned Keypad::type_digit(int digit) +void Keypad::type_digit(int digit) { switch (m_state) { case State::External: @@ -34,7 +34,6 @@ unsigned Keypad::type_digit(int digit) m_frac_length.set_to(m_frac_length.plus(1)); break; } - return m_frac_length.to_u64(); } void Keypad::type_decimal_point() diff --git a/Userland/Applications/Calculator/Keypad.h b/Userland/Applications/Calculator/Keypad.h index 0106eb88c9..62a993a76d 100644 --- a/Userland/Applications/Calculator/Keypad.h +++ b/Userland/Applications/Calculator/Keypad.h @@ -21,7 +21,7 @@ public: Keypad() = default; ~Keypad() = default; - unsigned type_digit(int digit); + void type_digit(int digit); void type_decimal_point(); void type_backspace(); |