From: <sv...@op...> - 2025-05-03 19:35:17
|
Author: sagamusix Date: Sat May 3 21:34:50 2025 New Revision: 23158 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=23158 Log: [Fix] Tree view: Don't disable MIDI callback just because focus was removed. This would also redirect focus to the active MDI window when switching to another application (https://bugs.openmpt.org/view.php?id=1881). Modified: trunk/OpenMPT/mptrack/View_tre.cpp trunk/OpenMPT/mptrack/View_tre.h Modified: trunk/OpenMPT/mptrack/View_tre.cpp ============================================================================== --- trunk/OpenMPT/mptrack/View_tre.cpp Sat May 3 21:07:49 2025 (r23157) +++ trunk/OpenMPT/mptrack/View_tre.cpp Sat May 3 21:34:50 2025 (r23158) @@ -99,6 +99,9 @@ BEGIN_MESSAGE_MAP(CModTree, CTreeCtrl) //{{AFX_MSG_MAP(CViewModTree) + ON_WM_DESTROY() + ON_WM_KILLFOCUS() + ON_WM_SETFOCUS() ON_WM_MOUSEMOVE() ON_WM_LBUTTONUP() ON_WM_RBUTTONUP() @@ -156,8 +159,6 @@ ON_MESSAGE(WM_MOD_KEYCOMMAND, &CModTree::OnCustomKeyMsg) ON_MESSAGE(WM_MOD_MIDIMSG, &CModTree::OnMidiMsg) //}}AFX_MSG_MAP - ON_WM_KILLFOCUS() - ON_WM_SETFOCUS() END_MESSAGE_MAP() @@ -261,6 +262,15 @@ } +void CModTree::OnDestroy() +{ + if(CMainFrame::GetMainFrame()->GetMidiRecordWnd() == m_hWnd) + { + CMainFrame::GetMainFrame()->SetMidiRecordWnd(nullptr); + } +} + + LRESULT CModTree::OnDPIChangedAfterParent(WPARAM, LPARAM) { auto result = Default(); @@ -4375,8 +4385,6 @@ } CTreeCtrl::OnKillFocus(pNewWnd); CMainFrame::GetMainFrame()->m_bModTreeHasFocus = false; - if(pNewWnd != nullptr) - CMainFrame::GetMainFrame()->SetMidiRecordWnd(pNewWnd->m_hWnd); } Modified: trunk/OpenMPT/mptrack/View_tre.h ============================================================================== --- trunk/OpenMPT/mptrack/View_tre.h Sat May 3 21:07:49 2025 (r23157) +++ trunk/OpenMPT/mptrack/View_tre.h Sat May 3 21:34:50 2025 (r23158) @@ -345,6 +345,7 @@ afx_msg void OnDropFiles(HDROP hDropInfo); afx_msg void OnKillFocus(CWnd *pNewWnd); afx_msg void OnSetFocus(CWnd *pOldWnd); + afx_msg void OnDestroy(); afx_msg void OnSetItemPath(); afx_msg void OnSaveItem(); |