debugqt: Un-revert and add fix for focus seizure [Carl]

This commit is contained in:
R. Belmont 2014-05-24 03:32:55 +00:00
parent 04139b9d8b
commit bf70eebc2b

View File

@ -2,7 +2,7 @@
// //
// debugqt.c - SDL/QT debug window handling // debugqt.c - SDL/QT debug window handling
// //
// Copyright (c) 1996-2010, Nicola Salmoria and the MAME Team. // Copyright (c) 1996-2014, Nicola Salmoria and the MAME Team.
// Visit http://mamedev.org for licensing and usage restrictions. // Visit http://mamedev.org for licensing and usage restrictions.
// //
// SDLMAME by Olivier Galibert and R. Belmont // SDLMAME by Olivier Galibert and R. Belmont
@ -278,51 +278,51 @@ void debugger_qt::wait_for_debugger(device_t &device, bool firststop)
continue; continue;
widget->show(); widget->show();
} }
bring_main_window_to_front();
if (firststop)
{
bring_main_window_to_front();
}
// Set the main window to display the proper cpu // Set the main window to display the proper cpu
mainQtWindow->setProcessor(&device); mainQtWindow->setProcessor(&device);
// Run our own QT event loop // Run our own QT event loop
while (debug_cpu_is_stopped(m_osd.machine())) osd_sleep(50000);
qApp->processEvents(QEventLoop::AllEvents, 1);
// Refresh everyone if requested
if (mainQtWindow->wantsRefresh())
{ {
osd_sleep(50000); QWidgetList allWidgets = qApp->allWidgets();
qApp->processEvents(QEventLoop::AllEvents, 1); for (int i = 0; i < allWidgets.length(); i++)
allWidgets[i]->update();
mainQtWindow->clearRefreshFlag();
}
// Refresh everyone if requested // Hide all top level widgets if requested
if (mainQtWindow->wantsRefresh()) if (mainQtWindow->wantsHide())
{
foreach (QWidget* widget, QApplication::topLevelWidgets())
{ {
QWidgetList allWidgets = qApp->allWidgets(); if (!widget->isWindow() || widget->windowType() != Qt::Window)
for (int i = 0; i < allWidgets.length(); i++) continue;
allWidgets[i]->update(); widget->hide();
mainQtWindow->clearRefreshFlag();
} }
mainQtWindow->clearHideFlag();
}
// Hide all top level widgets if requested // Exit if the machine has been instructed to do so (scheduled event == exit || hard_reset)
if (mainQtWindow->wantsHide()) if (m_osd.machine().scheduled_event_pending())
{ {
foreach (QWidget* widget, QApplication::topLevelWidgets()) // Keep a list of windows we want to save.
{ // We need to do this here because by the time xml_configuration_save gets called
if (!widget->isWindow() || widget->windowType() != Qt::Window) // all the QT windows are already gone.
continue; gather_save_configurations();
widget->hide(); }
}
mainQtWindow->clearHideFlag();
}
// Exit if the machine has been instructed to do so (scheduled event == exit || hard_reset)
if (m_osd.machine().scheduled_event_pending())
{
// Keep a list of windows we want to save.
// We need to do this here because by the time xml_configuration_save gets called
// all the QT windows are already gone.
gather_save_configurations();
break;
}
#if defined(WIN32) && !defined(SDLMAME_WIN32) #if defined(WIN32) && !defined(SDLMAME_WIN32)
winwindow_update_cursor_state(m_osd.machine()); // make sure the cursor isn't hidden while in debugger winwindow_update_cursor_state(m_osd.machine()); // make sure the cursor isn't hidden while in debugger
#endif #endif
}
} }