summaryrefslogtreecommitdiffstatshomepage
path: root/src/osd/modules/input
diff options
context:
space:
mode:
author Vas Crabb <vas@vastheman.com>2021-03-12 01:15:08 +1100
committer Vas Crabb <vas@vastheman.com>2021-03-12 01:15:08 +1100
commit4cf96da22c09651c1da2b27ee61028d558e7af49 (patch)
tree4482cdc706be33b29d050fb8b0f84c457ba20ba9 /src/osd/modules/input
parentb38a77bca54c007f995b9bb47687354d154b6be5 (diff)
-A few incremental UI code improvements:
* Simplified message when toggling UI controls. * Show actual configured UI toggle key, not misleading hard-coded text. * Push window activated/deactivated events to UI manager. * Simplified SDL window event handling code - events are pretty precise. -Miscellaneous code cleanup.
Diffstat (limited to 'src/osd/modules/input')
-rw-r--r--src/osd/modules/input/input_sdlcommon.cpp36
-rw-r--r--src/osd/modules/input/input_sdlcommon.h2
2 files changed, 13 insertions, 25 deletions
diff --git a/src/osd/modules/input/input_sdlcommon.cpp b/src/osd/modules/input/input_sdlcommon.cpp
index 1f2606fd973..17186c24eb9 100644
--- a/src/osd/modules/input/input_sdlcommon.cpp
+++ b/src/osd/modules/input/input_sdlcommon.cpp
@@ -86,23 +86,9 @@ void sdl_event_manager::process_window_event(running_machine &machine, SDL_Event
switch (sdlevent.window.event)
{
- case SDL_WINDOWEVENT_SHOWN:
- m_has_focus = true;
- break;
-
- case SDL_WINDOWEVENT_CLOSE:
- machine.schedule_exit();
- break;
-
- case SDL_WINDOWEVENT_LEAVE:
- machine.ui_input().push_mouse_leave_event(window->target());
- m_mouse_over_window = 0;
- break;
-
case SDL_WINDOWEVENT_MOVED:
window->notify_changed();
m_focus_window = window;
- m_has_focus = true;
break;
case SDL_WINDOWEVENT_RESIZED:
@@ -116,24 +102,28 @@ void sdl_event_manager::process_window_event(running_machine &machine, SDL_Event
//printf("event data1,data2 %d x %d %ld\n", event.window.data1, event.window.data2, sizeof(SDL_Event));
window->resize(sdlevent.window.data1, sdlevent.window.data2);
}
- m_focus_window = window;
- m_has_focus = true;
break;
case SDL_WINDOWEVENT_ENTER:
m_mouse_over_window = 1;
- [[fallthrough]];
+ break;
+
+ case SDL_WINDOWEVENT_LEAVE:
+ machine.ui_input().push_mouse_leave_event(window->target());
+ m_mouse_over_window = 0;
+ break;
+
case SDL_WINDOWEVENT_FOCUS_GAINED:
- case SDL_WINDOWEVENT_EXPOSED:
- case SDL_WINDOWEVENT_MAXIMIZED:
- case SDL_WINDOWEVENT_RESTORED:
m_focus_window = window;
- m_has_focus = true;
+ machine.ui_input().push_window_focus_event(window->target());
break;
- case SDL_WINDOWEVENT_MINIMIZED:
case SDL_WINDOWEVENT_FOCUS_LOST:
- m_has_focus = false;
+ machine.ui_input().push_window_defocus_event(window->target());
+ break;
+
+ case SDL_WINDOWEVENT_CLOSE:
+ machine.schedule_exit();
break;
}
}
diff --git a/src/osd/modules/input/input_sdlcommon.h b/src/osd/modules/input/input_sdlcommon.h
index ee13ce307dd..030a8ca4bd7 100644
--- a/src/osd/modules/input/input_sdlcommon.h
+++ b/src/osd/modules/input/input_sdlcommon.h
@@ -117,12 +117,10 @@ class sdl_event_manager : public event_manager_t<sdl_event_subscriber>
{
private:
bool m_mouse_over_window;
- bool m_has_focus;
std::shared_ptr<sdl_window_info> m_focus_window;
sdl_event_manager()
: m_mouse_over_window(true),
- m_has_focus(true),
m_focus_window(nullptr)
{
}