Skip to content

Commit

Permalink
Windows: Reduce focus juggling on game start.
Browse files Browse the repository at this point in the history
Previously, we would activate the debugger (if enabled), and then
reactivate the main window.  This meant if you switched to something,
PPSSPP would demand focus once the game loaded.
  • Loading branch information
unknownbrackets committed Apr 25, 2021
1 parent 8d0ca1e commit 5f9dfee
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 10 deletions.
4 changes: 2 additions & 2 deletions Windows/Debugger/Debugger_Disasm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -848,14 +848,14 @@ void CDisasm::SetDebugMode(bool _bDebug, bool switchPC)
}
}

void CDisasm::Show(bool bShow) {
void CDisasm::Show(bool bShow, bool includeToTop) {
if (deferredSymbolFill_ && bShow) {
if (g_symbolMap) {
g_symbolMap->FillSymbolListBox(GetDlgItem(m_hDlg, IDC_FUNCTIONLIST), ST_FUNCTION);
deferredSymbolFill_ = false;
}
}
Dialog::Show(bShow);
Dialog::Show(bShow, includeToTop);
}

void CDisasm::NotifyMapLoaded() {
Expand Down
2 changes: 1 addition & 1 deletion Windows/Debugger/Debugger_Disasm.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class CDisasm : public Dialog
CDisasm(HINSTANCE _hInstance, HWND _hParent, DebugInterface *cpu);
~CDisasm();

void Show(bool bShow) override;
void Show(bool bShow, bool includeToTop = true) override;

void Update() override {
UpdateDialog(true);
Expand Down
4 changes: 1 addition & 3 deletions Windows/MainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,7 @@ namespace MainWindow
void CreateDebugWindows() {
disasmWindow = new CDisasm(MainWindow::GetHInstance(), MainWindow::GetHWND(), currentDebugMIPS);
DialogManager::AddDlg(disasmWindow);
disasmWindow->Show(g_Config.bShowDebuggerOnLoad);
disasmWindow->Show(g_Config.bShowDebuggerOnLoad, false);

#if PPSSPP_API(ANY_GL)
geDebuggerWindow = new CGEDebugger(MainWindow::GetHInstance(), MainWindow::GetHWND());
Expand Down Expand Up @@ -935,8 +935,6 @@ namespace MainWindow

if (disasmWindow)
disasmWindow->UpdateDialog();

SetForegroundWindow(hwndMain);
break;

case WM_USER_SAVESTATE_FINISH:
Expand Down
11 changes: 8 additions & 3 deletions Windows/W32Util/DialogManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,16 @@ void Dialog::Destroy()
DestroyWindow(m_hDlg);
}

void Dialog::Show(bool _bShow)
void Dialog::Show(bool _bShow, bool includeToTop)
{
m_bShowState = _bShow ? SW_NORMAL : SW_HIDE;
if (_bShow && includeToTop)
m_bShowState = SW_SHOWNORMAL;
else if (_bShow)
m_bShowState = SW_SHOWNOACTIVATE;
else
m_bShowState = SW_HIDE;
ShowWindow(m_hDlg, m_bShowState);
if (_bShow)
if (_bShow && includeToTop)
BringWindowToTop(m_hDlg);
}

Expand Down
2 changes: 1 addition & 1 deletion Windows/W32Util/DialogManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class Dialog
Dialog(LPCSTR res, HINSTANCE _hInstance, HWND _hParent);
virtual ~Dialog();

virtual void Show(bool _bShow);
virtual void Show(bool _bShow, bool includeToTop = true);
virtual void Update() {}

HWND GetDlgHandle() {
Expand Down

0 comments on commit 5f9dfee

Please sign in to comment.