diff --git a/src/debugger/gui/DebuggerDialog.cxx b/src/debugger/gui/DebuggerDialog.cxx index 890148933..e42f955ec 100644 --- a/src/debugger/gui/DebuggerDialog.cxx +++ b/src/debugger/gui/DebuggerDialog.cxx @@ -93,7 +93,7 @@ void DebuggerDialog::loadConfig() } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void DebuggerDialog::handleKeyDown(StellaKey key, StellaMod mod) +void DebuggerDialog::handleKeyDown(StellaKey key, StellaMod mod, bool repeated) { if(key == KBDK_GRAVE && !StellaModTest::isShift(mod)) { diff --git a/src/debugger/gui/DebuggerDialog.hxx b/src/debugger/gui/DebuggerDialog.hxx index fc687365a..4a38930e8 100644 --- a/src/debugger/gui/DebuggerDialog.hxx +++ b/src/debugger/gui/DebuggerDialog.hxx @@ -75,7 +75,7 @@ class DebuggerDialog : public Dialog private: void center() override { positionAt(0); } void loadConfig() override; - void handleKeyDown(StellaKey key, StellaMod mod) override; + void handleKeyDown(StellaKey key, StellaMod mod, bool repeated) override; void handleCommand(CommandSender* sender, int cmd, int data, int id) override; void doStep(); diff --git a/src/gui/ContextMenu.cxx b/src/gui/ContextMenu.cxx index 21b39b8c8..c801fa550 100644 --- a/src/gui/ContextMenu.cxx +++ b/src/gui/ContextMenu.cxx @@ -280,7 +280,7 @@ void ContextMenu::handleMouseWheel(int x, int y, int direction) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void ContextMenu::handleKeyDown(StellaKey key, StellaMod mod) +void ContextMenu::handleKeyDown(StellaKey key, StellaMod mod, bool repeated) { handleEvent(instance().eventHandler().eventForKey(kMenuMode, key, mod)); } diff --git a/src/gui/ContextMenu.hxx b/src/gui/ContextMenu.hxx index 90bcaa8e4..508200bcb 100644 --- a/src/gui/ContextMenu.hxx +++ b/src/gui/ContextMenu.hxx @@ -86,7 +86,7 @@ class ContextMenu : public Dialog, public CommandSender void handleMouseMoved(int x, int y) override; bool handleMouseClicks(int x, int y, MouseButton b) override; void handleMouseWheel(int x, int y, int direction) override; - void handleKeyDown(StellaKey key, StellaMod mod) override; + void handleKeyDown(StellaKey key, StellaMod mod, bool repeated) override; void handleJoyDown(int stick, int button, bool longPress) override; void handleJoyAxis(int stick, int axis, int value, int button) override; bool handleJoyHat(int stick, int hat, JoyHat value, int button) override; diff --git a/src/gui/Dialog.cxx b/src/gui/Dialog.cxx index be0b03533..4aaafb58f 100644 --- a/src/gui/Dialog.cxx +++ b/src/gui/Dialog.cxx @@ -443,7 +443,7 @@ void Dialog::handleText(char text) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void Dialog::handleKeyDown(StellaKey key, StellaMod mod) +void Dialog::handleKeyDown(StellaKey key, StellaMod mod, bool repeated) { Event::Type e = Event::NoType; @@ -463,7 +463,7 @@ void Dialog::handleKeyDown(StellaKey key, StellaMod mod) // Unless a widget has claimed all responsibility for data, we assume // that if an event exists for the given data, it should have priority. - if(!handleNavEvent(e) && _focusedWidget) + if(!handleNavEvent(e, repeated) && _focusedWidget) { if(_focusedWidget->wantsRaw() || e == Event::NoType) _focusedWidget->handleKeyDown(key, mod); @@ -653,7 +653,7 @@ bool Dialog::handleJoyHat(int stick, int hat, JoyHat value, int button) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -bool Dialog::handleNavEvent(Event::Type e) +bool Dialog::handleNavEvent(Event::Type e, bool repeated) { switch(e) { @@ -692,7 +692,7 @@ bool Dialog::handleNavEvent(Event::Type e) break; case Event::UIOK: - if(_okWidget && _okWidget->isEnabled()) + if(_okWidget && _okWidget->isEnabled() && !repeated) { // Receiving 'OK' is the same as getting the 'Select' event _okWidget->handleEvent(Event::UISelect); @@ -701,7 +701,7 @@ bool Dialog::handleNavEvent(Event::Type e) break; case Event::UICancel: - if(_cancelWidget && _cancelWidget->isEnabled()) + if(_cancelWidget && _cancelWidget->isEnabled() && !repeated) { // Receiving 'Cancel' is the same as getting the 'Select' event _cancelWidget->handleEvent(Event::UISelect); diff --git a/src/gui/Dialog.hxx b/src/gui/Dialog.hxx index 31b067c51..9c46fa763 100644 --- a/src/gui/Dialog.hxx +++ b/src/gui/Dialog.hxx @@ -130,7 +130,7 @@ class Dialog : public GuiObject void releaseFocus() override; virtual void handleText(char text); - virtual void handleKeyDown(StellaKey key, StellaMod modifiers); + virtual void handleKeyDown(StellaKey key, StellaMod modifiers, bool repeated = false); virtual void handleKeyUp(StellaKey key, StellaMod modifiers); virtual void handleMouseDown(int x, int y, MouseButton b, int clickCount); virtual void handleMouseUp(int x, int y, MouseButton b, int clickCount); @@ -169,7 +169,7 @@ class Dialog : public GuiObject private: void buildCurrentFocusList(int tabID = -1); - bool handleNavEvent(Event::Type e); + bool handleNavEvent(Event::Type e, bool repeated = false); void getTabIdForWidget(Widget* w); bool cycleTab(int direction); diff --git a/src/gui/DialogContainer.cxx b/src/gui/DialogContainer.cxx index 2a7f8c719..0b5977bce 100644 --- a/src/gui/DialogContainer.cxx +++ b/src/gui/DialogContainer.cxx @@ -188,7 +188,7 @@ void DialogContainer::handleKeyEvent(StellaKey key, StellaMod mod, bool pressed, // Send the event to the dialog box on the top of the stack Dialog* activeDialog = myDialogStack.top(); if(pressed) - activeDialog->handleKeyDown(key, mod); + activeDialog->handleKeyDown(key, mod, repeated); else activeDialog->handleKeyUp(key, mod); } diff --git a/src/gui/InputDialog.cxx b/src/gui/InputDialog.cxx index 875caf2fe..89d10279c 100644 --- a/src/gui/InputDialog.cxx +++ b/src/gui/InputDialog.cxx @@ -451,7 +451,7 @@ bool InputDialog::repeatEnabled() } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void InputDialog::handleKeyDown(StellaKey key, StellaMod mod) +void InputDialog::handleKeyDown(StellaKey key, StellaMod mod, bool repeated) { // Remap key events in remap mode, otherwise pass to parent dialog if (myEmulEventMapper->remapMode()) diff --git a/src/gui/InputDialog.hxx b/src/gui/InputDialog.hxx index 845a00fb5..5b14d9f80 100644 --- a/src/gui/InputDialog.hxx +++ b/src/gui/InputDialog.hxx @@ -47,7 +47,7 @@ class InputDialog : public Dialog bool repeatEnabled() override; private: - void handleKeyDown(StellaKey key, StellaMod mod) override; + void handleKeyDown(StellaKey key, StellaMod mod, bool repeated) override; void handleKeyUp(StellaKey key, StellaMod mod) override; void handleJoyDown(int stick, int button, bool longPress) override; void handleJoyUp(int stick, int button) override; diff --git a/src/gui/LauncherDialog.cxx b/src/gui/LauncherDialog.cxx index 77054ba1b..3b424df51 100644 --- a/src/gui/LauncherDialog.cxx +++ b/src/gui/LauncherDialog.cxx @@ -428,7 +428,7 @@ bool LauncherDialog::matchPattern(const string& s, const string& pattern) const } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void LauncherDialog::handleKeyDown(StellaKey key, StellaMod mod) +void LauncherDialog::handleKeyDown(StellaKey key, StellaMod mod, bool repeated) { // Grab the key before passing it to the actual dialog and check for // Control-R (reload ROM listing) diff --git a/src/gui/LauncherDialog.hxx b/src/gui/LauncherDialog.hxx index 6ea7e567b..b9fa49e6f 100644 --- a/src/gui/LauncherDialog.hxx +++ b/src/gui/LauncherDialog.hxx @@ -88,7 +88,7 @@ class LauncherDialog : public Dialog private: void center() override { positionAt(0); } - void handleKeyDown(StellaKey key, StellaMod mod) override; + void handleKeyDown(StellaKey key, StellaMod mod, bool repeated) override; void handleMouseDown(int x, int y, MouseButton b, int clickCount) override; void handleCommand(CommandSender* sender, int cmd, int data, int id) override; void handleJoyDown(int stick, int button, bool longPress) override; diff --git a/src/gui/MinUICommandDialog.cxx b/src/gui/MinUICommandDialog.cxx index b44dd8e66..ad3dc792e 100644 --- a/src/gui/MinUICommandDialog.cxx +++ b/src/gui/MinUICommandDialog.cxx @@ -136,7 +136,7 @@ void MinUICommandDialog::loadConfig() } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void MinUICommandDialog::handleKeyDown(StellaKey key, StellaMod mod) +void MinUICommandDialog::handleKeyDown(StellaKey key, StellaMod mod, bool repeated) { switch (key) { diff --git a/src/gui/MinUICommandDialog.hxx b/src/gui/MinUICommandDialog.hxx index d4e75ecd5..7b997f239 100644 --- a/src/gui/MinUICommandDialog.hxx +++ b/src/gui/MinUICommandDialog.hxx @@ -35,7 +35,7 @@ class MinUICommandDialog : public Dialog protected: void loadConfig() override; - void handleKeyDown(StellaKey key, StellaMod mod) override; + void handleKeyDown(StellaKey key, StellaMod mod, bool repeated) override; void handleCommand(CommandSender* sender, int cmd, int data, int id) override; void updateSlot(int slot); void updateWinds(); diff --git a/src/gui/TimeMachineDialog.cxx b/src/gui/TimeMachineDialog.cxx index b3c6d08ec..4ff83b72a 100644 --- a/src/gui/TimeMachineDialog.cxx +++ b/src/gui/TimeMachineDialog.cxx @@ -34,7 +34,6 @@ #include "Base.hxx" using Common::Base; - const int BUTTON_W = 14, BUTTON_H = 14; static uInt32 RECORD[BUTTON_H] = @@ -193,7 +192,6 @@ static uInt32 LOAD_ALL[BUTTON_H] = 0b11111111111111, }; - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - TimeMachineDialog::TimeMachineDialog(OSystem& osystem, DialogContainer& parent, int width) @@ -305,7 +303,7 @@ void TimeMachineDialog::loadConfig() } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void TimeMachineDialog::handleKeyDown(StellaKey key, StellaMod mod) +void TimeMachineDialog::handleKeyDown(StellaKey key, StellaMod mod, bool repeated) { // The following 'Alt' shortcuts duplicate the shortcuts in EventHandler // It is best to keep them the same, so changes in EventHandler mean we diff --git a/src/gui/TimeMachineDialog.hxx b/src/gui/TimeMachineDialog.hxx index b54c02185..c0adc17a2 100644 --- a/src/gui/TimeMachineDialog.hxx +++ b/src/gui/TimeMachineDialog.hxx @@ -37,7 +37,7 @@ class TimeMachineDialog : public Dialog private: void loadConfig() override; - void handleKeyDown(StellaKey key, StellaMod mod) override; + void handleKeyDown(StellaKey key, StellaMod mod, bool repeated) override; void handleCommand(CommandSender* sender, int cmd, int data, int id) override; /** initialize timeline bar */