Jelajahi Sumber

LibGUI: Allow activating a focused button by pressing the space key :^)

This applies to normal push buttons, checkboxes, and radio buttons.
It feels very natural. Even moreso than activating with return..
Andreas Kling 4 tahun lalu
induk
melakukan
06b5d292d7
1 mengubah file dengan 1 tambahan dan 1 penghapusan
  1. 1 1
      Libraries/LibGUI/AbstractButton.cpp

+ 1 - 1
Libraries/LibGUI/AbstractButton.cpp

@@ -155,7 +155,7 @@ void AbstractButton::leave_event(Core::Event&)
 
 
 void AbstractButton::keydown_event(KeyEvent& event)
 void AbstractButton::keydown_event(KeyEvent& event)
 {
 {
-    if (event.key() == KeyCode::Key_Return) {
+    if (event.key() == KeyCode::Key_Return || event.key() == KeyCode::Key_Space) {
         click(event.modifiers());
         click(event.modifiers());
         event.accept();
         event.accept();
         return;
         return;