mirror of
https://github.com/holub/mame
synced 2025-04-23 08:49:55 +03:00
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
This commit is contained in:
parent
0f3ac71cc4
commit
def1777e74
@ -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");
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -701,7 +701,6 @@ void osd_common_t::input_resume()
|
||||
void osd_common_t::exit_subsystems()
|
||||
{
|
||||
video_exit();
|
||||
input_exit();
|
||||
}
|
||||
|
||||
void osd_common_t::video_exit()
|
||||
@ -712,18 +711,6 @@ void osd_common_t::window_exit()
|
||||
{
|
||||
}
|
||||
|
||||
void osd_common_t::input_exit()
|
||||
{
|
||||
if (m_keyboard_input)
|
||||
m_keyboard_input->exit();
|
||||
if (m_mouse_input)
|
||||
m_mouse_input->exit();
|
||||
if (m_lightgun_input)
|
||||
m_lightgun_input->exit();
|
||||
if (m_joystick_input)
|
||||
m_joystick_input->exit();
|
||||
}
|
||||
|
||||
void osd_common_t::osd_exit()
|
||||
{
|
||||
m_mod_man.exit();
|
||||
|
@ -224,7 +224,6 @@ public:
|
||||
virtual void exit_subsystems();
|
||||
virtual void video_exit();
|
||||
virtual void window_exit();
|
||||
virtual void input_exit();
|
||||
|
||||
virtual void osd_exit();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user