diff --git a/src/osd/modules/debugger/debugosx.mm b/src/osd/modules/debugger/debugosx.mm index db04b641a..e749c20e2 100644 --- a/src/osd/modules/debugger/debugosx.mm +++ b/src/osd/modules/debugger/debugosx.mm @@ -161,7 +161,7 @@ void debugger_osx::wait_for_debugger(device_t &device, bool firststop) // get and process messages NSEvent *ev = [NSApp nextEventMatchingMask:NSEventMaskAny - untilDate:[NSDate distantFuture] + untilDate:[NSDate dateWithTimeIntervalSinceNow:0.001] inMode:NSDefaultRunLoopMode dequeue:YES]; if (ev != nil) diff --git a/src/osd/modules/debugger/debugwin.cpp b/src/osd/modules/debugger/debugwin.cpp index 1ad713a96..aeb97db8c 100644 --- a/src/osd/modules/debugger/debugwin.cpp +++ b/src/osd/modules/debugger/debugwin.cpp @@ -1,5 +1,5 @@ // license:BSD-3-Clause -// copyright-holders:Aaron Giles, Vas Crabb +// copyright-holders:Aaron Giles, Vas Crabb, Janko Stamenović //============================================================ // // debugwin.cpp - Win32 debug window handling @@ -39,6 +39,31 @@ namespace osd { namespace { +class win_timer { +public: + win_timer() : m_timer_id(0) {} + ~win_timer() + { + kill(); + } + void set_timer(HWND hwnd, UINT_PTR id_event, UINT u_elapse) + { + kill(); + m_idevent = id_event; + m_hwnd = hwnd; + m_timer_id = SetTimer(hwnd, id_event, u_elapse, (TIMERPROC)NULL); + } + void kill() + { + if (m_timer_id) + KillTimer(m_hwnd, m_idevent); + } +private: + UINT_PTR m_idevent; + HWND m_hwnd; + UINT_PTR m_timer_id; +}; + class debugger_windows : public osd_module, public debug_module, @@ -118,6 +143,8 @@ private: bool m_save_windows; bool m_group_windows; bool m_group_windows_setting; + + win_timer m_min_periodic_timer; }; @@ -161,10 +188,10 @@ void debugger_windows::wait_for_debugger(device_t &device, bool firststop) { m_main_console = create_window(); + HWND const front_hwnd = dynamic_cast(*osd_common_t::window_list().front()).platform_window(); + // set the starting position for new auxiliary windows - HMONITOR const nearest_monitor = MonitorFromWindow( - dynamic_cast(*osd_common_t::window_list().front()).platform_window(), - MONITOR_DEFAULTTONEAREST); + HMONITOR const nearest_monitor = MonitorFromWindow(front_hwnd, MONITOR_DEFAULTTONEAREST); if (nearest_monitor) { MONITORINFO info; @@ -177,6 +204,11 @@ void debugger_windows::wait_for_debugger(device_t &device, bool firststop) m_window_start_x = m_next_window_pos.x; } } + + // 10 == 100 times per second tick to interrupt GetMessage + // when no user input messages happen + // which allows lua's periodic to be called periodically + m_min_periodic_timer.set_timer(front_hwnd, WM_USER+1, 10); } // update the views in the console to reflect the current CPU