summaryrefslogtreecommitdiffstatshomepage
path: root/src/osd/modules/input
diff options
context:
space:
mode:
author Brad Hughes <bradhugh@outlook.com>2016-06-25 11:43:15 -0400
committer Brad Hughes <bradhugh@outlook.com>2016-06-25 11:43:15 -0400
commitdef1777e74a13ac30309f4142de32b9b73e1185c (patch)
treec4290ceb1159127367b92e05da6c5dea49b5f094 /src/osd/modules/input
parent0f3ac71cc4bcc7f0c1201297cd353820657325df (diff)
A few minor input fixes and cleanups
- input modules exit() is called twice. Remove the unnecessary input_exit() method - removed unnecessary pointer init in handle_input_event and should_hide_mouse - When registering event callbacks in SDL, don't assume the SDL enum values are int-sized
Diffstat (limited to 'src/osd/modules/input')
-rw-r--r--src/osd/modules/input/input_sdl.cpp30
-rw-r--r--src/osd/modules/input/input_windows.cpp4
2 files changed, 26 insertions, 8 deletions
diff --git a/src/osd/modules/input/input_sdl.cpp b/src/osd/modules/input/input_sdl.cpp
index 64e30302a3e..a60746ca3fa 100644
--- a/src/osd/modules/input/input_sdl.cpp
+++ b/src/osd/modules/input/input_sdl.cpp
@@ -512,8 +512,13 @@ public:
{
sdl_input_module::input_init(machine);
- SDL_EventType event_types[] = { SDL_KEYDOWN, SDL_KEYUP, SDL_TEXTINPUT };
- sdl_event_manager::instance().subscribe(reinterpret_cast<int*>(event_types), ARRAY_LENGTH(event_types), this);
+ static int event_types[] = {
+ static_cast<int>(SDL_KEYDOWN),
+ static_cast<int>(SDL_KEYUP),
+ static_cast<int>(SDL_TEXTINPUT)
+ };
+
+ sdl_event_manager::instance().subscribe(event_types, ARRAY_LENGTH(event_types), this);
sdl_keyboard_device *devinfo;
@@ -645,8 +650,14 @@ public:
{
sdl_input_module::input_init(machine);
- SDL_EventType event_types[] = { SDL_MOUSEMOTION, SDL_MOUSEBUTTONDOWN, SDL_MOUSEBUTTONUP, SDL_MOUSEWHEEL };
- sdl_event_manager::instance().subscribe(reinterpret_cast<int*>(event_types), ARRAY_LENGTH(event_types), this);
+ static int event_types[] = {
+ static_cast<int>(SDL_MOUSEMOTION),
+ static_cast<int>(SDL_MOUSEBUTTONDOWN),
+ static_cast<int>(SDL_MOUSEBUTTONUP),
+ static_cast<int>(SDL_MOUSEWHEEL)
+ };
+
+ sdl_event_manager::instance().subscribe(event_types, ARRAY_LENGTH(event_types), this);
sdl_mouse_device *devinfo;
char defname[20];
@@ -834,8 +845,15 @@ public:
}
}
- SDL_EventType event_types[] = { SDL_JOYAXISMOTION, SDL_JOYBALLMOTION, SDL_JOYHATMOTION, SDL_JOYBUTTONDOWN, SDL_JOYBUTTONUP };
- sdl_event_manager::instance().subscribe(reinterpret_cast<int*>(event_types), ARRAY_LENGTH(event_types), this);
+ static int event_types[] = {
+ static_cast<int>(SDL_JOYAXISMOTION),
+ static_cast<int>(SDL_JOYBALLMOTION),
+ static_cast<int>(SDL_JOYHATMOTION),
+ static_cast<int>(SDL_JOYBUTTONDOWN),
+ static_cast<int>(SDL_JOYBUTTONUP)
+ };
+
+ sdl_event_manager::instance().subscribe(event_types, ARRAY_LENGTH(event_types), this);
osd_printf_verbose("Joystick: End initialization\n");
}
diff --git a/src/osd/modules/input/input_windows.cpp b/src/osd/modules/input/input_windows.cpp
index 606072d1997..4455a77c991 100644
--- a/src/osd/modules/input/input_windows.cpp
+++ b/src/osd/modules/input/input_windows.cpp
@@ -23,7 +23,7 @@
bool windows_osd_interface::should_hide_mouse() const
{
bool hidemouse = false;
- wininput_module* mod = nullptr;
+ wininput_module* mod;
mod = dynamic_cast<wininput_module*>(m_keyboard_input);
if (mod) hidemouse |= mod->should_hide_mouse();
@@ -44,7 +44,7 @@ bool windows_osd_interface::handle_input_event(input_event eventid, void* eventd
{
bool handled = false;
- wininput_module* mod = nullptr;
+ wininput_module* mod;
mod = dynamic_cast<wininput_module*>(m_keyboard_input);
if (mod) handled |= mod->handle_input_event(eventid, eventdata);