openMSX
InputEventGenerator.cc
Go to the documentation of this file.
1 #include "InputEventGenerator.hh"
2 #include "EventDistributor.hh"
3 #include "InputEvents.hh"
4 #include "IntegerSetting.hh"
5 #include "GlobalSettings.hh"
6 #include "Keys.hh"
7 #include "FileOperations.hh"
8 #include "checked_cast.hh"
9 #include "one_of.hh"
10 #include "outer.hh"
11 #include "unreachable.hh"
12 #include "utf8_unchecked.hh"
13 #include "build-info.hh"
14 #include <cassert>
15 #include <memory>
16 
17 using std::string;
18 using std::vector;
19 using std::make_shared;
20 
21 namespace openmsx {
22 
24  EventDistributor& eventDistributor_,
25  GlobalSettings& globalSettings_)
26  : eventDistributor(eventDistributor_)
27  , globalSettings(globalSettings_)
28  , grabInput(
29  commandController, "grabinput",
30  "This setting controls if openMSX takes over mouse and keyboard input",
31  false, Setting::DONT_SAVE)
32  , escapeGrabCmd(commandController)
33  , escapeGrabState(ESCAPE_GRAB_WAIT_CMD)
34 {
35  setGrabInput(grabInput.getBoolean());
36  eventDistributor.registerEventListener(OPENMSX_FOCUS_EVENT, *this);
37 
38  osdControlButtonsState = unsigned(~0); // 0 is pressed, 1 is released
39 
40 #ifndef SDL_JOYSTICK_DISABLED
41  SDL_JoystickEventState(SDL_ENABLE); // joysticks generate events
42 #endif
43 }
44 
46 {
47  eventDistributor.unregisterEventListener(OPENMSX_FOCUS_EVENT, *this);
48 }
49 
51 {
52  // SDL bug workaround
53  if (!SDL_WasInit(SDL_INIT_VIDEO)) {
54  SDL_Delay(100);
55  }
56 
57  if (SDL_WaitEvent(nullptr)) {
58  poll();
59  }
60 }
61 
63 {
64  // Heuristic to emulate the old SDL1 behavior:
65  //
66  // SDL1 had a unicode field on each KEYDOWN event. In SDL2 that
67  // information is moved to the (new) SDL_TEXTINPUT events.
68  //
69  // Though our MSX keyboard emulation code needs to relate KEYDOWN
70  // events with the associated unicode. We try to mimic this by the
71  // following heuristic:
72  // When two successive events in a single batch (so, the same
73  // invocation of poll()) are KEYDOWN followed by TEXTINPUT, then copy
74  // the unicode (of the first character) of the TEXT event to the
75  // KEYDOWN event.
76  // Implementing this requires a lookahead of 1 event. So the code below
77  // deals with a 'current' and a 'previous' event, and keeps track of
78  // whether the previous event is still pending (not yet processed).
79  //
80  // In a previous version we also added the constraint that these two
81  // consecutive events must have the same timestamp, but that had mixed
82  // results:
83  // - on Linux it worked fine
84  // - on Windows the timestamps sometimes did not match
85  // - on Mac the timestamps mostly did not match
86  // So we removed this constraint.
87  //
88  // We also split SDL_TEXTINPUT events into (possibly) multiple KEYDOWN
89  // events because a single event type makes it easier to handle higher
90  // priority listeners that can block the event for lower priority
91  // listener (console > hotkey > msx).
92 
93  SDL_Event event1, event2;
94  auto* prev = &event1;
95  auto* curr = &event2;
96  bool pending = false;
97 
98  while (SDL_PollEvent(curr)) {
99  if (pending) {
100  pending = false;
101  if ((prev->type == SDL_KEYDOWN) && (curr->type == SDL_TEXTINPUT)) {
102  const char* utf8 = curr->text.text;
103  auto unicode = utf8::unchecked::next(utf8);
104  handleKeyDown(prev->key, unicode);
105  if (unicode) { // possibly there are more characters
106  handleText(utf8);
107  }
108  continue;
109  } else {
110  handle(*prev);
111  }
112  }
113  if (curr->type == SDL_KEYDOWN) {
114  pending = true;
115  std::swap(curr, prev);
116  } else {
117  handle(*curr);
118  }
119  }
120  if (pending) {
121  handle(*prev);
122  }
123 }
124 
125 void InputEventGenerator::setNewOsdControlButtonState(
126  unsigned newState, const EventPtr& origEvent)
127 {
128  unsigned deltaState = osdControlButtonsState ^ newState;
129  for (unsigned i = OsdControlEvent::LEFT_BUTTON;
130  i <= OsdControlEvent::B_BUTTON; ++i) {
131  if (deltaState & (1 << i)) {
132  if (newState & (1 << i)) {
133  eventDistributor.distributeEvent(
134  make_shared<OsdControlReleaseEvent>(
135  i, origEvent));
136  } else {
137  eventDistributor.distributeEvent(
138  make_shared<OsdControlPressEvent>(
139  i, origEvent));
140  }
141  }
142  }
143  osdControlButtonsState = newState;
144 }
145 
146 void InputEventGenerator::triggerOsdControlEventsFromJoystickAxisMotion(
147  unsigned axis, int value, const EventPtr& origEvent)
148 {
149  unsigned neg_button, pos_button;
150  switch (axis) {
151  case 0:
152  neg_button = 1 << OsdControlEvent::LEFT_BUTTON;
153  pos_button = 1 << OsdControlEvent::RIGHT_BUTTON;
154  break; // axis 0
155  case 1:
156  neg_button = 1 << OsdControlEvent::UP_BUTTON;
157  pos_button = 1 << OsdControlEvent::DOWN_BUTTON;
158  break;
159  default:
160  // Ignore all other axis (3D joysticks and flight joysticks may
161  // have more than 2 axis)
162  return;
163  }
164 
165  if (value > 0) {
166  // release negative button, press positive button
167  setNewOsdControlButtonState(
168  (osdControlButtonsState | neg_button) & ~pos_button,
169  origEvent);
170  } else if (value < 0) {
171  // press negative button, release positive button
172  setNewOsdControlButtonState(
173  (osdControlButtonsState | pos_button) & ~neg_button,
174  origEvent);
175  } else {
176  // release both buttons
177  setNewOsdControlButtonState(
178  osdControlButtonsState | neg_button | pos_button,
179  origEvent);
180  }
181 }
182 
183 void InputEventGenerator::triggerOsdControlEventsFromJoystickHat(
184  int value, const EventPtr& origEvent)
185 {
186  unsigned dir = 0;
187  if (!(value & SDL_HAT_UP )) dir |= 1 << OsdControlEvent::UP_BUTTON;
188  if (!(value & SDL_HAT_DOWN )) dir |= 1 << OsdControlEvent::DOWN_BUTTON;
189  if (!(value & SDL_HAT_LEFT )) dir |= 1 << OsdControlEvent::LEFT_BUTTON;
190  if (!(value & SDL_HAT_RIGHT)) dir |= 1 << OsdControlEvent::RIGHT_BUTTON;
191  unsigned ab = osdControlButtonsState & ((1 << OsdControlEvent::A_BUTTON) |
193  setNewOsdControlButtonState(ab | dir, origEvent);
194 }
195 
196 void InputEventGenerator::osdControlChangeButton(
197  bool up, unsigned changedButtonMask, const EventPtr& origEvent)
198 {
199  auto newButtonState = up
200  ? osdControlButtonsState | changedButtonMask
201  : osdControlButtonsState & ~changedButtonMask;
202  setNewOsdControlButtonState(newButtonState, origEvent);
203 }
204 
205 void InputEventGenerator::triggerOsdControlEventsFromJoystickButtonEvent(
206  unsigned button, bool up, const EventPtr& origEvent)
207 {
208  osdControlChangeButton(
209  up,
210  ((button & 1) ? (1 << OsdControlEvent::B_BUTTON)
211  : (1 << OsdControlEvent::A_BUTTON)),
212  origEvent);
213 }
214 
215 void InputEventGenerator::triggerOsdControlEventsFromKeyEvent(
216  Keys::KeyCode keyCode, bool up, bool repeat, const EventPtr& origEvent)
217 {
218  unsigned buttonMask = [&] {
219  switch (static_cast<Keys::KeyCode>(keyCode & Keys::K_MASK)) {
220  case Keys::K_LEFT: return 1 << OsdControlEvent::LEFT_BUTTON;
222  case Keys::K_UP: return 1 << OsdControlEvent::UP_BUTTON;
223  case Keys::K_DOWN: return 1 << OsdControlEvent::DOWN_BUTTON;
224  case Keys::K_SPACE: return 1 << OsdControlEvent::A_BUTTON;
225  case Keys::K_RETURN: return 1 << OsdControlEvent::A_BUTTON;
226  case Keys::K_ESCAPE: return 1 << OsdControlEvent::B_BUTTON;
227  default: return 0;
228  }
229  }();
230  if (buttonMask) {
231  if (repeat) {
232  osdControlChangeButton(!up, buttonMask, origEvent);
233  }
234  osdControlChangeButton(up, buttonMask, origEvent);
235  }
236 }
237 
238 static Uint16 normalizeModifier(SDL_Keycode sym, Uint16 mod)
239 {
240  // Apparently modifier-keys also have the corresponding
241  // modifier attribute set. See here for a discussion:
242  // https://github.com/openMSX/openMSX/issues/1202
243  // As a solution, on pure modifier keys, we now clear the
244  // modifier attributes.
245  return (sym == one_of(SDLK_LCTRL, SDLK_LSHIFT, SDLK_LALT, SDLK_LGUI,
246  SDLK_RCTRL, SDLK_RSHIFT, SDLK_RALT, SDLK_RGUI,
247  SDLK_MODE))
248  ? 0
249  : mod;
250 }
251 
252 void InputEventGenerator::handleKeyDown(const SDL_KeyboardEvent& key, uint32_t unicode)
253 {
254  EventPtr event;
255  /*if (PLATFORM_ANDROID && evt.key.keysym.sym == SDLK_WORLD_93) {
256  event = make_shared<JoystickButtonDownEvent>(0, 0);
257  triggerOsdControlEventsFromJoystickButtonEvent(
258  0, false, event);
259  androidButtonA = true;
260  } else if (PLATFORM_ANDROID && evt.key.keysym.sym == SDLK_WORLD_94) {
261  event = make_shared<JoystickButtonDownEvent>(0, 1);
262  triggerOsdControlEventsFromJoystickButtonEvent(
263  1, false, event);
264  androidButtonB = true;
265  } else*/ {
266  auto mod = normalizeModifier(key.keysym.sym, key.keysym.mod);
267  auto [keyCode, scanCode] = Keys::getCodes(
268  key.keysym.sym, mod, key.keysym.scancode, false);
269  event = make_shared<KeyDownEvent>(keyCode, scanCode, unicode);
270  triggerOsdControlEventsFromKeyEvent(keyCode, false, key.repeat, event);
271  }
272  eventDistributor.distributeEvent(event);
273 }
274 
275 void InputEventGenerator::handleText(const char* utf8)
276 {
277  while (true) {
278  auto unicode = utf8::unchecked::next(utf8);
279  if (unicode == 0) return;
280  eventDistributor.distributeEvent(
281  make_shared<KeyDownEvent>(Keys::K_NONE, unicode));
282  }
283 }
284 
285 void InputEventGenerator::handle(const SDL_Event& evt)
286 {
287  EventPtr event;
288  switch (evt.type) {
289  case SDL_KEYUP:
290  // Virtual joystick of SDL Android port does not have joystick
291  // buttons. It has however up to 6 virtual buttons that can be
292  // mapped to SDL keyboard events. Two of these virtual buttons
293  // will be mapped to keys SDLK_WORLD_93 and 94 and are
294  // interpeted here as joystick buttons (respectively button 0
295  // and 1).
296  // TODO Android code should be rewritten for SDL2
297  /*if (PLATFORM_ANDROID && evt.key.keysym.sym == SDLK_WORLD_93) {
298  event = make_shared<JoystickButtonUpEvent>(0, 0);
299  triggerOsdControlEventsFromJoystickButtonEvent(
300  0, true, event);
301  androidButtonA = false;
302  } else if (PLATFORM_ANDROID && evt.key.keysym.sym == SDLK_WORLD_94) {
303  event = make_shared<JoystickButtonUpEvent>(0, 1);
304  triggerOsdControlEventsFromJoystickButtonEvent(
305  1, true, event);
306  androidButtonB = false;
307  } else*/ {
308  auto mod = normalizeModifier(evt.key.keysym.sym, evt.key.keysym.mod);
309  auto [keyCode, scanCode] = Keys::getCodes(
310  evt.key.keysym.sym, mod, evt.key.keysym.scancode, true);
311  event = make_shared<KeyUpEvent>(keyCode, scanCode);
312  bool repeat = false;
313  triggerOsdControlEventsFromKeyEvent(keyCode, true, repeat, event);
314  }
315  break;
316  case SDL_KEYDOWN:
317  handleKeyDown(evt.key, 0);
318  break;
319 
320  case SDL_MOUSEBUTTONUP:
321  event = make_shared<MouseButtonUpEvent>(evt.button.button);
322  break;
323  case SDL_MOUSEBUTTONDOWN:
324  event = make_shared<MouseButtonDownEvent>(evt.button.button);
325  break;
326  case SDL_MOUSEWHEEL: {
327  int x = evt.wheel.x;
328  int y = evt.wheel.y;
329  if (evt.wheel.direction == SDL_MOUSEWHEEL_FLIPPED)
330  {
331  x = -x;
332  y = -y;
333  }
334  event = make_shared<MouseWheelEvent>(x, y);
335  break;
336  }
337  case SDL_MOUSEMOTION:
338  event = make_shared<MouseMotionEvent>(
339  evt.motion.xrel, evt.motion.yrel,
340  evt.motion.x, evt.motion.y);
341  break;
342 
343  case SDL_JOYBUTTONUP:
344  event = make_shared<JoystickButtonUpEvent>(
345  evt.jbutton.which, evt.jbutton.button);
346  triggerOsdControlEventsFromJoystickButtonEvent(
347  evt.jbutton.button, true, event);
348  break;
349  case SDL_JOYBUTTONDOWN:
350  event = make_shared<JoystickButtonDownEvent>(
351  evt.jbutton.which, evt.jbutton.button);
352  triggerOsdControlEventsFromJoystickButtonEvent(
353  evt.jbutton.button, false, event);
354  break;
355  case SDL_JOYAXISMOTION: {
356  auto& setting = globalSettings.getJoyDeadzoneSetting(evt.jaxis.which);
357  int threshold = (setting.getInt() * 32768) / 100;
358  auto value = (evt.jaxis.value < -threshold) ? evt.jaxis.value
359  : (evt.jaxis.value > threshold) ? evt.jaxis.value
360  : 0;
361  event = make_shared<JoystickAxisMotionEvent>(
362  evt.jaxis.which, evt.jaxis.axis, value);
363  triggerOsdControlEventsFromJoystickAxisMotion(
364  evt.jaxis.axis, value, event);
365  break;
366  }
367  case SDL_JOYHATMOTION:
368  event = make_shared<JoystickHatEvent>(
369  evt.jhat.which, evt.jhat.hat, evt.jhat.value);
370  triggerOsdControlEventsFromJoystickHat(evt.jhat.value, event);
371  break;
372 
373  case SDL_TEXTINPUT:
374  handleText(evt.text.text);
375  break;
376 
377  case SDL_WINDOWEVENT:
378  switch (evt.window.event) {
379  case SDL_WINDOWEVENT_FOCUS_GAINED:
380  event = make_shared<FocusEvent>(true);
381  break;
382  case SDL_WINDOWEVENT_FOCUS_LOST:
383  event = make_shared<FocusEvent>(false);
384  break;
385  case SDL_WINDOWEVENT_RESIZED:
386  event = make_shared<ResizeEvent>(
387  evt.window.data1, evt.window.data2);
388  break;
389  case SDL_WINDOWEVENT_EXPOSED:
390  event = make_shared<SimpleEvent>(OPENMSX_EXPOSE_EVENT);
391  break;
392  default:
393  break;
394  }
395  break;
396 
397  case SDL_DROPFILE:
398  event = make_shared<FileDropEvent>(FileOperations::getConventionalPath(evt.drop.file));
399  SDL_free(evt.drop.file);
400  break;
401 
402  case SDL_QUIT:
403  event = make_shared<QuitEvent>();
404  break;
405 
406  default:
407  break;
408  }
409 
410 #if 0
411  if (event) {
412  std::cerr << "SDL event converted to: " << event->toString() << '\n';
413  } else {
414  std::cerr << "SDL event was of unknown type, not converted to an openMSX event\n";
415  }
416 #endif
417 
418  if (event) eventDistributor.distributeEvent(event);
419 }
420 
421 
423 {
424  escapeGrabState = ESCAPE_GRAB_WAIT_CMD;
425  setGrabInput(grab);
426 }
427 
428 int InputEventGenerator::signalEvent(const std::shared_ptr<const Event>& event)
429 {
430  auto& focusEvent = checked_cast<const FocusEvent&>(*event);
431  switch (escapeGrabState) {
432  case ESCAPE_GRAB_WAIT_CMD:
433  // nothing
434  break;
435  case ESCAPE_GRAB_WAIT_LOST:
436  if (!focusEvent.getGain()) {
437  escapeGrabState = ESCAPE_GRAB_WAIT_GAIN;
438  }
439  break;
440  case ESCAPE_GRAB_WAIT_GAIN:
441  if (focusEvent.getGain()) {
442  escapeGrabState = ESCAPE_GRAB_WAIT_CMD;
443  }
444  setGrabInput(true);
445  break;
446  default:
447  UNREACHABLE;
448  }
449  return 0;
450 }
451 
452 void InputEventGenerator::setGrabInput(bool grab)
453 {
454  SDL_SetRelativeMouseMode(grab ? SDL_TRUE : SDL_FALSE);
455 
456  // TODO is this still the correct place in SDL2
457  // TODO get the SDL_window
458  //SDL_Window* window = ...;
459  //SDL_SetWindowGrab(window, grab ? SDL_TRUE : SDL_FALSE);
460 }
461 
462 
463 // Wrap SDL joystick button functions to handle the 'fake' android joystick
464 // buttons. The method InputEventGenerator::handle() already takes care of fake
465 // events for the andoid joystick buttons, these two wrappers handle the direct
466 // joystick button state queries.
467 int InputEventGenerator::joystickNumButtons(SDL_Joystick* joystick)
468 {
469  if (PLATFORM_ANDROID) {
470  return 2;
471  } else {
472  return SDL_JoystickNumButtons(joystick);
473  }
474 }
475 bool InputEventGenerator::joystickGetButton(SDL_Joystick* joystick, int button)
476 {
477  if (PLATFORM_ANDROID) {
478  switch (button) {
479  case 0: return androidButtonA;
480  case 1: return androidButtonB;
481  default: UNREACHABLE; return false;
482  }
483  } else {
484  return SDL_JoystickGetButton(joystick, button) != 0;
485  }
486 }
487 
488 
489 // class EscapeGrabCmd
490 
491 InputEventGenerator::EscapeGrabCmd::EscapeGrabCmd(
492  CommandController& commandController_)
493  : Command(commandController_, "escape_grab")
494 {
495 }
496 
497 void InputEventGenerator::EscapeGrabCmd::execute(
498  span<const TclObject> /*tokens*/, TclObject& /*result*/)
499 {
500  auto& inputEventGenerator = OUTER(InputEventGenerator, escapeGrabCmd);
501  if (inputEventGenerator.grabInput.getBoolean()) {
502  inputEventGenerator.escapeGrabState =
503  InputEventGenerator::ESCAPE_GRAB_WAIT_LOST;
504  inputEventGenerator.setGrabInput(false);
505  }
506 }
507 
508 string InputEventGenerator::EscapeGrabCmd::help(
509  const vector<string>& /*tokens*/) const
510 {
511  return "Temporarily release input grab.";
512 }
513 
514 } // namespace openmsx
one_of.hh
openmsx::OsdControlEvent::DOWN_BUTTON
@ DOWN_BUTTON
Definition: InputEvents.hh:271
openmsx::Keys::K_ESCAPE
@ K_ESCAPE
Definition: Keys.hh:36
openmsx::OsdControlEvent::RIGHT_BUTTON
@ RIGHT_BUTTON
Definition: InputEvents.hh:271
openmsx::Keys::getCodes
std::pair< KeyCode, KeyCode > getCodes(SDL_Keycode sdlkeycode, Uint16 mod, SDL_Scancode sdlscancode, bool release)
Translate SDL_Keycode/SDL_Scancode into openMSX key/scan Keycode's.
Definition: Keys.cc:369
IntegerSetting.hh
openmsx::InputEventGenerator::poll
void poll()
Definition: InputEventGenerator.cc:62
utf8
Definition: utf8_checked.hh:36
openmsx::CommandController
Definition: CommandController.hh:18
utf8::unchecked::next
uint32_t next(octet_iterator &it)
Definition: utf8_unchecked.hh:64
openmsx::InputEventGenerator::joystickGetButton
static bool joystickGetButton(SDL_Joystick *joystick, int button)
Definition: InputEventGenerator.cc:475
openmsx::Keys::K_RIGHT
@ K_RIGHT
Definition: Keys.hh:126
openmsx::Setting
Definition: Setting.hh:120
openmsx::EventDistributor
Definition: EventDistributor.hh:17
openmsx::Keys::K_SPACE
@ K_SPACE
Definition: Keys.hh:37
span
Definition: span.hh:126
openmsx::InputEventGenerator::InputEventGenerator
InputEventGenerator(const InputEventGenerator &)=delete
PLATFORM_ANDROID
#define PLATFORM_ANDROID
Definition: build-info.hh:17
OUTER
#define OUTER(type, member)
Definition: outer.hh:41
openmsx::Keys::K_NONE
@ K_NONE
Definition: Keys.hh:29
openmsx::InputEventGenerator::wait
void wait()
Wait for event(s) and handle it.
Definition: InputEventGenerator.cc:50
UNREACHABLE
#define UNREACHABLE
Definition: unreachable.hh:38
openmsx::Keys::K_DOWN
@ K_DOWN
Definition: Keys.hh:125
utf8_unchecked.hh
openmsx::InputEventGenerator::joystickNumButtons
static int joystickNumButtons(SDL_Joystick *joystick)
Normally the following two functions simply delegate to SDL_JoystickNumButtons() and SDL_JoystickGetB...
Definition: InputEventGenerator.cc:467
one_of
Definition: one_of.hh:7
EventDistributor.hh
InputEvents.hh
openmsx::InputEventGenerator::~InputEventGenerator
~InputEventGenerator()
Definition: InputEventGenerator.cc:45
build-info.hh
Keys.hh
GlobalSettings.hh
openmsx::InputEventFactory::EventPtr
std::shared_ptr< const Event > EventPtr
Definition: InputEventFactory.hh:15
FileOperations.hh
outer.hh
openmsx::GlobalSettings::getJoyDeadzoneSetting
IntegerSetting & getJoyDeadzoneSetting(int i)
Definition: GlobalSettings.hh:51
openmsx::x
constexpr KeyMatrixPosition x
Keyboard bindings.
Definition: Keyboard.cc:1419
checked_cast.hh
openmsx::OPENMSX_EXPOSE_EVENT
@ OPENMSX_EXPOSE_EVENT
Send when (part of) the openMSX window gets exposed, and thus should be repainted.
Definition: Event.hh:69
openmsx::OPENMSX_FOCUS_EVENT
@ OPENMSX_FOCUS_EVENT
Definition: Event.hh:29
openmsx::GlobalSettings
This class contains settings that are used by several other class (including some singletons).
Definition: GlobalSettings.hh:25
openmsx::Keys::K_UP
@ K_UP
Definition: Keys.hh:124
openmsx::OsdControlEvent::UP_BUTTON
@ UP_BUTTON
Definition: InputEvents.hh:271
openmsx::Keys::K_LEFT
@ K_LEFT
Definition: Keys.hh:127
openmsx::OsdControlEvent::LEFT_BUTTON
@ LEFT_BUTTON
Definition: InputEvents.hh:271
openmsx::FileOperations::getConventionalPath
const std::string & getConventionalPath(const std::string &path)
Returns the path in conventional path-delimiter.
Definition: FileOperations.hh:147
openmsx::Keys::K_RETURN
@ K_RETURN
Definition: Keys.hh:34
openmsx::Command
Definition: Command.hh:41
openmsx::InputEventGenerator::updateGrab
void updateGrab(bool grab)
Must be called when 'grabinput' or 'fullscreen' setting changes.
Definition: InputEventGenerator.cc:422
openmsx::OsdControlEvent::A_BUTTON
@ A_BUTTON
Definition: InputEvents.hh:272
InputEventGenerator.hh
openmsx::OsdControlEvent::B_BUTTON
@ B_BUTTON
Definition: InputEvents.hh:272
openmsx::Keys::KeyCode
KeyCode
Constants that identify keys and key modifiers.
Definition: Keys.hh:26
openmsx::EventDistributor::registerEventListener
void registerEventListener(EventType type, EventListener &listener, Priority priority=OTHER)
Registers a given object to receive certain events.
Definition: EventDistributor.cc:23
unreachable.hh
openmsx::EventDistributor::unregisterEventListener
void unregisterEventListener(EventType type, EventListener &listener)
Unregisters a previously registered event listener.
Definition: EventDistributor.cc:35
openmsx
This file implemented 3 utility functions:
Definition: Autofire.cc:5
openmsx::Keys::K_MASK
@ K_MASK
Definition: Keys.hh:27
openmsx::BooleanSetting::getBoolean
bool getBoolean() const noexcept
Definition: BooleanSetting.hh:17
openmsx::EventDistributor::distributeEvent
void distributeEvent(const EventPtr &event)
Schedule the given event for delivery.
Definition: EventDistributor.cc:44