add missing modifier to 'eventForKey'

remove default modifier KBDM_NONE
This commit is contained in:
thrust26 2019-05-25 17:13:12 +02:00
parent a38776decc
commit 28b22f57a5
5 changed files with 12 additions and 12 deletions

View File

@ -40,9 +40,9 @@ class KeyMap
Mapping() : mode(EventMode(0)), key(StellaKey(0)), mod(StellaMod(0)) { }
Mapping(const Mapping& k) : mode(k.mode), key(k.key), mod(k.mod) { }
explicit Mapping(EventMode c_mode, StellaKey c_key, StellaMod c_mod = StellaMod::KBDM_NONE)
explicit Mapping(EventMode c_mode, StellaKey c_key, StellaMod c_mod)
: mode(c_mode), key(c_key), mod(c_mod) { }
explicit Mapping(int c_mode, int c_key, int c_mod = StellaMod::KBDM_NONE)
explicit Mapping(int c_mode, int c_key, int c_mod)
: mode(EventMode(c_mode)), key(StellaKey(c_key)), mod(StellaMod(c_mod)) { }
bool operator==(const Mapping& other) const
@ -58,22 +58,22 @@ class KeyMap
/** Add new mapping for given event */
void add(const Event::Type event, const Mapping& input);
void add(const Event::Type event, const int mode, const int key, const int mod = StellaMod::KBDM_NONE);
void add(const Event::Type event, const int mode, const int key, const int mod);
/** Erase mapping */
void erase(const Mapping& input);
void erase(const int mode, const int key, const int mod = StellaMod::KBDM_NONE);
void erase(const int mode, const int key, const int mod);
/** Get event for mapping */
Event::Type get(const Mapping& input) const;
Event::Type get(const int mode, const int key, const int mod = StellaMod::KBDM_NONE) const;
Event::Type get(const int mode, const int key, const int mod) const;
/** Get the mapping(s) description for given event and mode */
string getEventMappingDesc(const Event::Type event, const int mode) const;
/** Get mapping description */
string getDesc(const Mapping& input) const;
string getDesc(const int mode, const int key, const int mod = StellaMod::KBDM_NONE) const;
string getDesc(const int mode, const int key, const int mod) const;
string saveMapping(const int mode) const;
int loadMapping(string& list, const int mode);

View File

@ -56,8 +56,8 @@ class PhysicalKeyboardHandler
/** Handle a physical keyboard event. */
void handleEvent(StellaKey key, StellaMod mod, bool pressed);
Event::Type eventForKey(StellaKey key, EventMode mode) const {
return myKeyMap.get(mode, key);
Event::Type eventForKey(EventMode mode, StellaKey key, StellaMod mod) const {
return myKeyMap.get(mode, key, mod);
}
/** See comments on 'myAltKeyCounter' for more information. */

View File

@ -158,8 +158,8 @@ class EventHandler
void setComboListForEvent(Event::Type event, const StringList& events);
/** Convert keys and physical joystick events into Stella events. */
Event::Type eventForKey(StellaKey key, EventMode mode) const {
return myPKeyHandler->eventForKey(key, mode);
Event::Type eventForKey(EventMode mode, StellaKey key, StellaMod mod) const {
return myPKeyHandler->eventForKey(mode, key, mod);
}
Event::Type eventForJoyAxis(int stick, int axis, int value, EventMode mode) const {
return myPJoyHandler->eventForAxis(stick, axis, value, mode);

View File

@ -282,7 +282,7 @@ void ContextMenu::handleMouseWheel(int x, int y, int direction)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void ContextMenu::handleKeyDown(StellaKey key, StellaMod mod)
{
handleEvent(instance().eventHandler().eventForKey(key, kMenuMode));
handleEvent(instance().eventHandler().eventForKey(kMenuMode, key, mod));
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -483,7 +483,7 @@ void Dialog::handleKeyDown(StellaKey key, StellaMod mod)
// Check the keytable now, since we might get one of the above events,
// which must always be processed before any widget sees it.
if(e == Event::NoType)
e = instance().eventHandler().eventForKey(key, kMenuMode);
e = instance().eventHandler().eventForKey(kMenuMode, key, 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.