From df2a0eb67ea58c90b02cb74a1470134651dca119 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 29 Oct 2017 19:43:46 +0100 Subject: [PATCH] Stop using m_winPosition to pass position to the main thread We can just ask for the window rectangle directly from the main thread, there is no need to update the position in wxProgressDialogSharedData all the time. --- src/msw/progdlg.cpp | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-) diff --git a/src/msw/progdlg.cpp b/src/msw/progdlg.cpp index f732dd5bf4..03fa9d7262 100644 --- a/src/msw/progdlg.cpp +++ b/src/msw/progdlg.cpp @@ -808,16 +808,16 @@ void wxProgressDialog::DoGetPosition(int *x, int *y) const #ifdef wxHAS_MSW_TASKDIALOG if ( HasNativeTaskDialog() ) { - wxPoint pos; + wxRect r; if ( m_sharedData ) { wxCriticalSectionLocker locker(m_sharedData->m_cs); - pos = m_sharedData->m_winPosition; + r = wxRectFromRECT(wxGetWindowRect(m_sharedData->m_hwnd)); } if (x) - *x = pos.x; + *x = r.x; if (y) - *y = pos.y; + *y = r.y; return; } @@ -1115,14 +1115,6 @@ wxProgressDialogTaskRunner::TaskDialogCallbackProc SWP_NOZORDER); } - // Store current position for the main thread use - // if no position update is pending. - if ( !(sharedData->m_notifications & wxSPDD_WINDOW_MOVED) ) - { - RECT r = wxGetWindowRect(hwnd); - sharedData->m_winPosition = wxPoint(r.left, r.top); - } - // If we can't be aborted, the "Close" button will only be enabled // when the progress ends (and not even then with wxPD_AUTO_HIDE). if ( !(sharedData->m_style & wxPD_CAN_ABORT) ) @@ -1192,12 +1184,6 @@ wxProgressDialogTaskRunner::TaskDialogCallbackProc } sharedData->m_notifications = 0; - { - // Update current position for the main thread use. - RECT r = wxGetWindowRect(hwnd); - sharedData->m_winPosition = wxPoint(r.left, r.top); - } - return S_FALSE; }