Skip to content

Windows: Do not drop into debugger when no MAME window has focus #13902

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 11 additions & 7 deletions src/osd/modules/debugger/debugwin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -235,16 +235,20 @@ void debugger_windows::debugger_update()
// if we're running live, do some checks
if (!winwindow_has_focus() && m_machine && !m_machine->debugger().cpu().is_stopped() && (m_machine->phase() == machine_phase::RUNNING))
{
// see if the interrupt key is pressed and break if it is
if (seq_pressed())
// check to see if a debugger window has focus
if (std::any_of(m_window_list.begin(), m_window_list.end(), [](auto const& window) { return window->has_focus(); }))
{
HWND const focuswnd = GetFocus();
// see if the interrupt key is pressed and break if it is
if (seq_pressed())
{
HWND const focuswnd = GetFocus();

m_machine->debugger().debug_break();
m_machine->debugger().debug_break();

// if we were focused on some window's edit box, reset it to default
for (auto &info : m_window_list)
info->restore_field(focuswnd);
// if we were focused on some window's edit box, reset it to default
for (auto& info : m_window_list)
info->restore_field(focuswnd);
}
}
}
}
Expand Down
8 changes: 8 additions & 0 deletions src/osd/modules/debugger/win/debugwininfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,14 @@ void debugwin_info::destroy()
DestroyWindow(m_wnd);
}


bool debugwin_info::has_focus() const
{
HWND focus_hwnd = GetFocus();
return m_wnd == focus_hwnd || IsChild(m_wnd, focus_hwnd);
}


bool debugwin_info::set_default_focus()
{
return false;
Expand Down
1 change: 1 addition & 0 deletions src/osd/modules/debugger/win/debugwininfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ class debugwin_info : protected debugbase_info
void set_foreground() const { SetForegroundWindow(m_wnd); }
void redraw();
void destroy();
bool has_focus() const;

virtual bool set_default_focus();
void prev_view(debugview_info *curview);
Expand Down
Loading