summaryrefslogtreecommitdiffstatshomepage
path: root/src/osd
diff options
context:
space:
mode:
Diffstat (limited to 'src/osd')
-rw-r--r--src/osd/modules/input/input_sdlcommon.cpp36
-rw-r--r--src/osd/modules/input/input_sdlcommon.h2
-rw-r--r--src/osd/sdl/window.cpp19
-rw-r--r--src/osd/windows/window.cpp33
4 files changed, 42 insertions, 48 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)
{
}
diff --git a/src/osd/sdl/window.cpp b/src/osd/sdl/window.cpp
index 3216589de6e..d751472ebd7 100644
--- a/src/osd/sdl/window.cpp
+++ b/src/osd/sdl/window.cpp
@@ -193,7 +193,7 @@ void sdl_osd_interface::window_exit()
window->destroy();
}
- switch(video_config.mode)
+ switch (video_config.mode)
{
case VIDEO_MODE_SDL2ACCEL:
renderer_sdl1::exit();
@@ -528,11 +528,7 @@ osd_dim sdl_window_info::pick_best_mode()
void sdl_window_info::update()
{
- osd_ticks_t event_wait_ticks;
-
// adjust the cursor state
- //sdlwindow_update_cursor_state(machine, window);
-
update_cursor_state();
// if we're visible and running and not in the middle of a resize, draw
@@ -558,6 +554,7 @@ void sdl_window_info::update()
}
}
+ osd_ticks_t event_wait_ticks;
if (video_config.waitvsync && video_config.syncrefresh)
event_wait_ticks = osd_ticks_per_second(); // block at most a second
else
@@ -585,20 +582,20 @@ void sdl_window_info::update()
m_primlist = &primlist;
- // if no bitmap, just fill
if (m_primlist == nullptr)
{
+ // if no bitmap, just fill
}
- // otherwise, render with our drawing system
else
{
- if( video_config.perftest )
+ // otherwise, render with our drawing system
+ if (video_config.perftest)
measure_fps(update);
else
renderer().draw(update);
}
- /* all done, ready for next */
+ // all done, ready for next
m_rendered_event.set();
}
}
@@ -768,8 +765,8 @@ int sdl_window_info::complete_create()
return 1;
// Make sure we have a consistent state
- SDL_ShowCursor(0);
- SDL_ShowCursor(1);
+ SDL_ShowCursor(SDL_DISABLE);
+ SDL_ShowCursor(SDL_ENABLE);
return 0;
}
diff --git a/src/osd/windows/window.cpp b/src/osd/windows/window.cpp
index 75090e0548f..cc9ff4484ba 100644
--- a/src/osd/windows/window.cpp
+++ b/src/osd/windows/window.cpp
@@ -921,9 +921,10 @@ void winwindow_ui_pause(running_machine &machine, int pause)
assert(GetCurrentThreadId() == main_threadid);
- // if we're pausing, increment the pause counter
if (pause)
{
+ // if we're pausing, increment the pause counter
+
// if we're the first to pause, we have to actually initiate it
if (ui_temp_pause++ == 0)
{
@@ -935,10 +936,10 @@ void winwindow_ui_pause(running_machine &machine, int pause)
SetEvent(ui_pause_event);
}
}
-
- // if we're resuming, decrement the pause counter
else
{
+ // if we're resuming, decrement the pause counter
+
// if we're the last to resume, unpause MAME
if (--ui_temp_pause == 0)
{
@@ -1273,18 +1274,26 @@ LRESULT CALLBACK win_window_info::video_window_proc(HWND wnd, UINT message, WPAR
return DefWindowProc(wnd, message, wparam, lparam);
case WM_ACTIVATE:
- if (window->has_renderer() && window->fullscreen())
+ if (window->has_renderer())
{
- if ((wparam == WA_ACTIVE) || (wparam == WA_CLICKACTIVE))
- {
- for (const auto &w : osd_common_t::s_window_list)
- ShowWindow(std::static_pointer_cast<win_window_info>(w)->platform_window(), SW_RESTORE);
- }
- else if ((wparam == WA_INACTIVE) && !is_mame_window(HWND(lparam)))
+ if (window->fullscreen())
{
- for (const auto &w : osd_common_t::s_window_list)
- ShowWindow(std::static_pointer_cast<win_window_info>(w)->platform_window(), SW_MINIMIZE);
+ if ((wparam == WA_ACTIVE) || (wparam == WA_CLICKACTIVE))
+ {
+ for (const auto &w : osd_common_t::s_window_list)
+ ShowWindow(std::static_pointer_cast<win_window_info>(w)->platform_window(), SW_RESTORE);
+ }
+ else if ((wparam == WA_INACTIVE) && !is_mame_window(HWND(lparam)))
+ {
+ for (const auto &w : osd_common_t::s_window_list)
+ ShowWindow(std::static_pointer_cast<win_window_info>(w)->platform_window(), SW_MINIMIZE);
+ }
}
+
+ if ((wparam == WA_ACTIVE) || (wparam == WA_CLICKACTIVE))
+ window->machine().ui_input().push_window_focus_event(window->target());
+ else if (wparam == WA_INACTIVE)
+ window->machine().ui_input().push_window_defocus_event(window->target());
}
return DefWindowProc(wnd, message, wparam, lparam);