diff options
author | Bob Arnson <bob@firegiant.com> | 2024-07-09 15:07:48 -0400 |
---|---|---|
committer | Rob Mensching <rob@firegiant.com> | 2024-10-04 12:24:34 -0700 |
commit | 956796ee24804b59f2a4d987103e57e5fb68b11c (patch) | |
tree | c91740ee31c926567d2d16c8249d43a4f0572c8b | |
parent | 6b0a0837afdcaea5cf6f55832ad88fb147b9860b (diff) | |
download | wix-956796ee24804b59f2a4d987103e57e5fb68b11c.tar.gz wix-956796ee24804b59f2a4d987103e57e5fb68b11c.tar.bz2 wix-956796ee24804b59f2a4d987103e57e5fb68b11c.zip |
Prevent unnecessary refreshes that move focus.
Spillover from having more interactive controls. In WiX v3, showing a
page moved the focus as a typical person might expect. When WiX v4
added interactivity, the same code was used to update controls (e.g.,
when checking a checkbox set a property used in a `VisibleCondition` or
`EnableCondition` for another control on the same page). This change
prevents the focus-setting behavior if the same page is being shown.
Fixes https://github.com/wixtoolset/issues/issues/8144
-rw-r--r-- | src/libs/dutil/WixToolset.DUtil/thmutil.cpp | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/libs/dutil/WixToolset.DUtil/thmutil.cpp b/src/libs/dutil/WixToolset.DUtil/thmutil.cpp index 7938cd0b..7cea3a17 100644 --- a/src/libs/dutil/WixToolset.DUtil/thmutil.cpp +++ b/src/libs/dutil/WixToolset.DUtil/thmutil.cpp | |||
@@ -312,13 +312,14 @@ static HRESULT ShowControl( | |||
312 | __in BOOL fSaveEditboxes, | 312 | __in BOOL fSaveEditboxes, |
313 | __in THEME_SHOW_PAGE_REASON reason, | 313 | __in THEME_SHOW_PAGE_REASON reason, |
314 | __in DWORD dwPageId, | 314 | __in DWORD dwPageId, |
315 | __out_opt HWND* phwndFocus | 315 | __inout_opt HWND* phwndFocus |
316 | ); | 316 | ); |
317 | static HRESULT ShowControls( | 317 | static HRESULT ShowControls( |
318 | __in THEME* pTheme, | 318 | __in THEME* pTheme, |
319 | __in_opt const THEME_CONTROL* pParentControl, | 319 | __in_opt const THEME_CONTROL* pParentControl, |
320 | __in int nCmdShow, | 320 | __in int nCmdShow, |
321 | __in BOOL fSaveEditboxes, | 321 | __in BOOL fSaveEditboxes, |
322 | __in BOOL fSetFocus, | ||
322 | __in THEME_SHOW_PAGE_REASON reason, | 323 | __in THEME_SHOW_PAGE_REASON reason, |
323 | __in DWORD dwPageId | 324 | __in DWORD dwPageId |
324 | ); | 325 | ); |
@@ -1192,8 +1193,9 @@ DAPI_(HRESULT) ThemeShowPageEx( | |||
1192 | BOOL fHide = SW_HIDE == nCmdShow; | 1193 | BOOL fHide = SW_HIDE == nCmdShow; |
1193 | BOOL fSaveEditboxes = FALSE; | 1194 | BOOL fSaveEditboxes = FALSE; |
1194 | THEME_SAVEDVARIABLE* pSavedVariable = NULL; | 1195 | THEME_SAVEDVARIABLE* pSavedVariable = NULL; |
1195 | THEME_PAGE* pPage = ThemeGetPage(pTheme, dwPage); | ||
1196 | SIZE_T cb = 0; | 1196 | SIZE_T cb = 0; |
1197 | BOOL fSetFocus = dwPage != pTheme->dwCurrentPageId; | ||
1198 | THEME_PAGE* pPage = ThemeGetPage(pTheme, dwPage); | ||
1197 | 1199 | ||
1198 | if (pPage) | 1200 | if (pPage) |
1199 | { | 1201 | { |
@@ -1257,7 +1259,7 @@ DAPI_(HRESULT) ThemeShowPageEx( | |||
1257 | } | 1259 | } |
1258 | } | 1260 | } |
1259 | 1261 | ||
1260 | hr = ShowControls(pTheme, NULL, nCmdShow, fSaveEditboxes, reason, dwPage); | 1262 | hr = ShowControls(pTheme, NULL, nCmdShow, fSaveEditboxes, fSetFocus, reason, dwPage); |
1261 | ThmExitOnFailure(hr, "Failed to show page controls."); | 1263 | ThmExitOnFailure(hr, "Failed to show page controls."); |
1262 | 1264 | ||
1263 | LExit: | 1265 | LExit: |
@@ -5561,7 +5563,7 @@ static HRESULT ShowControl( | |||
5561 | __in BOOL fSaveEditboxes, | 5563 | __in BOOL fSaveEditboxes, |
5562 | __in THEME_SHOW_PAGE_REASON reason, | 5564 | __in THEME_SHOW_PAGE_REASON reason, |
5563 | __in DWORD dwPageId, | 5565 | __in DWORD dwPageId, |
5564 | __out_opt HWND* phwndFocus | 5566 | __inout_opt HWND* phwndFocus |
5565 | ) | 5567 | ) |
5566 | { | 5568 | { |
5567 | HRESULT hr = S_OK; | 5569 | HRESULT hr = S_OK; |
@@ -5810,7 +5812,7 @@ static HRESULT ShowControl( | |||
5810 | 5812 | ||
5811 | if (0 < pControl->cControls) | 5813 | if (0 < pControl->cControls) |
5812 | { | 5814 | { |
5813 | ShowControls(pTheme, pControl, nCmdShow, fSaveEditboxes, reason, dwPageId); | 5815 | ShowControls(pTheme, pControl, nCmdShow, fSaveEditboxes, FALSE/*fSetFocus*/, reason, dwPageId); |
5814 | } | 5816 | } |
5815 | 5817 | ||
5816 | if (THEME_CONTROL_TYPE_BILLBOARD == pControl->type && pControl->wPageId) | 5818 | if (THEME_CONTROL_TYPE_BILLBOARD == pControl->type && pControl->wPageId) |
@@ -5842,6 +5844,7 @@ static HRESULT ShowControls( | |||
5842 | __in_opt const THEME_CONTROL* pParentControl, | 5844 | __in_opt const THEME_CONTROL* pParentControl, |
5843 | __in int nCmdShow, | 5845 | __in int nCmdShow, |
5844 | __in BOOL fSaveEditboxes, | 5846 | __in BOOL fSaveEditboxes, |
5847 | __in BOOL fSetFocus, | ||
5845 | __in THEME_SHOW_PAGE_REASON reason, | 5848 | __in THEME_SHOW_PAGE_REASON reason, |
5846 | __in DWORD dwPageId | 5849 | __in DWORD dwPageId |
5847 | ) | 5850 | ) |
@@ -5865,7 +5868,7 @@ static HRESULT ShowControls( | |||
5865 | } | 5868 | } |
5866 | } | 5869 | } |
5867 | 5870 | ||
5868 | if (hwndFocus) | 5871 | if (fSetFocus && hwndFocus) |
5869 | { | 5872 | { |
5870 | ::SendMessage(pTheme->hwndParent, WM_NEXTDLGCTL, (WPARAM)hwndFocus, TRUE); | 5873 | ::SendMessage(pTheme->hwndParent, WM_NEXTDLGCTL, (WPARAM)hwndFocus, TRUE); |
5871 | } | 5874 | } |