Skip to content

Commit 35110db

Browse files
fix(nsis): delete app data button gone on higher scaling (#10106)
* Fix delete app data button gone on high DPI * Add change file * change back translation template * Use w string instead of t * Add in some comment explaining PerMonitorV2
1 parent bb50315 commit 35110db

2 files changed

Lines changed: 38 additions & 10 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"tauri-build": "patch:enhance"
3+
---
4+
5+
Fix delete app data button gone on higher scaling (>= 1.5)

tooling/bundler/src/bundle/windows/templates/installer.nsi

Lines changed: 33 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
Unicode true
22
ManifestDPIAware true
3+
; Add in `dpiAwareness` `PerMonitorV2` to manifest for Windows 10 1607+ (note this should not affect lower versions since they should be able to ignore this and pick up `dpiAware` `true` set by `ManifestDPIAware true`)
4+
; Currently undocumented on NSIS's website but is in the Docs folder of source tree, see
5+
; https://github.com/kichik/nsis/blob/5fc0b87b819a9eec006df4967d08e522ddd651c9/Docs/src/attributes.but#L286-L300
6+
; https://github.com/tauri-apps/tauri/pull/10106
7+
ManifestDPIAwareness PerMonitorV2
38

49
!if "{{compression}}" == "none"
510
SetCompress off
@@ -364,19 +369,37 @@ Var DeleteAppDataCheckboxState
364369
!define /ifndef WS_EX_LAYOUTRTL 0x00400000
365370
!define MUI_PAGE_CUSTOMFUNCTION_SHOW un.ConfirmShow
366371
Function un.ConfirmShow ; Add add a `Delete app data` check box
367-
FindWindow $1 "#32770" "" $HWNDPARENT ; Find inner dialog
368-
${If} $(^RTL) = 1
369-
System::Call 'USER32::CreateWindowEx(i${__NSD_CheckBox_EXSTYLE}|${WS_EX_LAYOUTRTL},t"${__NSD_CheckBox_CLASS}",t "$(deleteAppData)",i${__NSD_CheckBox_STYLE},i 50,i 100,i 400, i 25,i$1,i0,i0,i0)i.s'
370-
${Else}
371-
System::Call 'USER32::CreateWindowEx(i${__NSD_CheckBox_EXSTYLE},t"${__NSD_CheckBox_CLASS}",t "$(deleteAppData)",i${__NSD_CheckBox_STYLE},i 0,i 100,i 400, i 25,i$1,i0,i0,i0)i.s'
372-
${EndIf}
373-
Pop $DeleteAppDataCheckbox
374-
SendMessage $HWNDPARENT ${WM_GETFONT} 0 0 $1
375-
SendMessage $DeleteAppDataCheckbox ${WM_SETFONT} $1 1
372+
; $1 inner dialog HWND
373+
; $2 window DPI
374+
; $3 style
375+
; $4 x
376+
; $5 y
377+
; $6 width
378+
; $7 height
379+
FindWindow $1 "#32770" "" $HWNDPARENT ; Find inner dialog
380+
System::Call "user32::GetDpiForWindow(p r1) i .r2"
381+
${If} $(^RTL) = 1
382+
StrCpy $3 "${__NSD_CheckBox_EXSTYLE} | ${WS_EX_LAYOUTRTL}"
383+
IntOp $4 50 * $2
384+
${Else}
385+
StrCpy $3 "${__NSD_CheckBox_EXSTYLE}"
386+
IntOp $4 0 * $2
387+
${EndIf}
388+
IntOp $5 100 * $2
389+
IntOp $6 400 * $2
390+
IntOp $7 25 * $2
391+
IntOp $4 $4 / 96
392+
IntOp $5 $5 / 96
393+
IntOp $6 $6 / 96
394+
IntOp $7 $7 / 96
395+
System::Call 'user32::CreateWindowEx(i r3, w "${__NSD_CheckBox_CLASS}", w "$(deleteAppData)", i ${__NSD_CheckBox_STYLE}, i r4, i r5, i r6, i r7, p r1, i0, i0, i0) i .s'
396+
Pop $DeleteAppDataCheckbox
397+
SendMessage $HWNDPARENT ${WM_GETFONT} 0 0 $1
398+
SendMessage $DeleteAppDataCheckbox ${WM_SETFONT} $1 1
376399
FunctionEnd
377400
!define MUI_PAGE_CUSTOMFUNCTION_LEAVE un.ConfirmLeave
378401
Function un.ConfirmLeave
379-
SendMessage $DeleteAppDataCheckbox ${BM_GETCHECK} 0 0 $DeleteAppDataCheckboxState
402+
SendMessage $DeleteAppDataCheckbox ${BM_GETCHECK} 0 0 $DeleteAppDataCheckboxState
380403
FunctionEnd
381404
!insertmacro MUI_UNPAGE_CONFIRM
382405

0 commit comments

Comments
 (0)