Compare commits

..

2 Commits

Author SHA1 Message Date
Jaime Bernardo
41971e2113 [PowerRename]Don't crash dllhost on right-click (#19723)
* Add version to PowerRename context menu

* [PowerRename]Don't crash dllhost on right-click
2022-08-02 19:31:57 +01:00
Seraphima Zykova
223de590c8 [Installer]Revert ignore start menu shortcut on update (#19715)
This reverts commit 7f6c91e166.

Co-authored-by: Jaime Bernardo <jaime@janeasystems.com>
2022-08-02 15:31:12 +01:00
655 changed files with 3492 additions and 19468 deletions

View File

@@ -48,14 +48,11 @@ body:
- G-code Thumbnail
- PowerRename
- PowerToys Run
- Quick Accent
- Screen ruler
- Shortcut Guide
- STL Thumbnail
- SVG Preview
- SVG Thumbnail
- Settings
- TextExtractor
- Video Conference Mute
- Welcome / PowerToys Tour window
- System tray interaction

View File

@@ -37,10 +37,8 @@ body:
- PDF Thumbnail
- G-code Preview
- G-code Thumbnail
- Quick Accent
- PowerRename
- PowerToys Run
- Screen Ruler
- Shortcut Guide
- SVG Preview
- SVG Thumbnail

View File

@@ -1,5 +1 @@
bkmeneguello
FWest
obairka
unuing
wil

View File

@@ -5,6 +5,7 @@ abgr
abi
ABlocked
ABOUTBOX
ABradley
Abug
accctrl
Acceleratorkeys
@@ -60,11 +61,13 @@ APeriod
api
APIENTRY
APIIs
Apm
APPBARDATA
appdata
APPICON
appid
appium
APPLASTZONE
Applets
Applicationcan
applicationframehost
@@ -116,12 +119,11 @@ Aut
Authenticode
AUTHN
AUTHZ
Autofill
autogenerate
autogenerated
AUTOHIDE
AUTOMATIONPROPERTIES
Autorun
Autosave
Autostart
AUTOUPDATE
AValid
@@ -129,7 +131,9 @@ Avanc
Awaitable
awakeness
awakeversion
AWAYMODE
AYUV
azchohfi
backend
backtracer
BADD
@@ -148,12 +152,10 @@ Bicubic
bigbar
bigobj
binlog
BITMAPFILEHEADER
bitmapimage
BITMAPINFO
BITMAPINFOHEADER
bitmask
BITSPIXEL
bla
Blockquotes
blog
@@ -259,7 +261,6 @@ CMINVOKECOMMANDINFOEX
CMock
CMONITORS
cmp
cmpgt
cmyk
cnt
Cocklebiddy
@@ -269,7 +270,6 @@ CODENAME
codeofconduct
codereview
Codespaces
codicon
COINIT
colorconv
colorformat
@@ -303,7 +303,6 @@ CONFLICTINGMODIFIERSHORTCUT
CONOUT
Consolas
constexpr
consts
contentdialog
contentfiles
CONTEXTHELP
@@ -312,7 +311,7 @@ CONTEXTMENUHANDLER
CONTROLL
CONTROLPARENT
Controlz
coord
Coords
copiedcolorrepresentation
cortana
cotaskmem
@@ -363,8 +362,6 @@ customaction
CUSTOMACTIONTEST
cvd
CVirtual
cvtepu
cvtsi
cwchar
cwd
cxfksword
@@ -378,9 +375,6 @@ CYVIRTUALSCREEN
cziplib
Dac
dacl
DAffine
DAFFINETRANSFORM
damienleroy
Danmarkshavn
DARKPURPLE
DARKTEAL
@@ -394,16 +388,11 @@ Dbg
Dbghelp
DBLCLKS
DBLEPSILON
DCapture
DCBA
DCOM
dcommon
dcomp
dcompi
DComposition
DDevice
ddf
DDxgi
Deact
debian
debugbreak
@@ -428,6 +417,7 @@ Delimarsky
dend
DENORMAL
Deondre
dependabot
depersist
deprioritized
deps
@@ -479,14 +469,12 @@ DPolicy
DPSAPI
DQTAT
DQTYPE
dragdrop
DRAWFRAME
drawingcolor
dreamsofameaningfullife
drivedetectionwarning
dshow
dst
DTo
dutil
DVASPECT
DVASPECTINFO
@@ -516,7 +504,6 @@ DWORDLONG
dworigin
dwrite
dxgi
dxgidebug
dxgiformat
dxguid
ecount
@@ -531,11 +518,8 @@ EFile
ekus
elif
elseif
eltociear
emmintrin
Emoji
emptyrecyclebin
ENABLEDELAYEDEXPANSION
ENABLEDPOPUP
endforeach
endian
@@ -550,13 +534,11 @@ enum
EOAC
EOL
epicgames
epu
Eqn
ERASEBKGND
EREOF
EResize
ERole
ERRORLEVEL
ERRORMESSAGE
ERRORTITLE
ESettings
@@ -578,7 +560,6 @@ EWXREBOOT
EWXSHUTDOWN
examplehandler
examplepowertoy
EXCLUDEFROMCAPTURE
exdisp
Executables
executionpolicy
@@ -618,7 +599,7 @@ FILESUBTYPE
FILESYSPATH
filesystem
FILETIME
filetype
FILETYPE
FILEVERSION
Filtergraph
Filterkeyboard
@@ -627,6 +608,8 @@ finalizer
findfast
Firefox
FIXEDFILEINFO
FLASHZONES
FLASHZONESONQUICKSWITCH
flt
flyout
fmtlib
@@ -641,7 +624,6 @@ FRAMECHANGED
franky
frankychen
Froml
FROMTOUCH
fstream
FTYPE
func
@@ -649,6 +631,7 @@ Functiondiscoverykeys
Futuna
fwlink
fwrite
fxcop
FZE
gabime
GAC
@@ -673,15 +656,12 @@ GETMINMAXINFO
GETSTATE
GETTEXT
GETTEXTLENGTH
GHND
github
githubusercontent
globals
GMEM
GNumber
google
GPTR
gpu
GSM
gtm
gui
@@ -690,7 +670,7 @@ GUITHREADINFO
GValue
gwl
GWLP
HACCEL
haccel
hangeul
hanselman
hardcoded
@@ -719,12 +699,13 @@ helptext
Heure
HEVC
hfile
HGFE
hglobal
hhk
HHmmss
HHOOK
hhx
Hiber
Hiberboot
HIBYTE
HICON
HIDEWINDOW
@@ -751,7 +732,6 @@ hmonitor
HOLDENTER
HOLDESC
homepage
HOMEPATH
homljgmgpmcbpjbnjpfijnhipfkiclkd
HOOKPROC
Hostbackdropbrush
@@ -763,7 +743,6 @@ hotlight
hotspot
Hovd
HPAINTBUFFER
HPALETTE
HRAWINPUT
hread
HREDRAW
@@ -778,9 +757,7 @@ hsl
hstring
hsv
htcfreek
HTCLIENT
HTHUMBNAIL
HTOUCHINPUT
HTTRANSPARENT
HValue
Hvci
@@ -808,7 +785,6 @@ ICapture
icase
ICEBLUE
IClass
IClosable
ICollection
IColor
ICommand
@@ -822,7 +798,6 @@ IDD
IDelayed
IDesktop
IDictionary
IDirect
IDirectory
IDispatch
IDispatcher
@@ -831,7 +806,6 @@ idl
IDLIST
IDOn
IDR
IDrawing
IDrive
idx
IDXGI
@@ -857,16 +831,13 @@ IFilter
ifndef
IFolder
IFormat
IFormatter
ifstream
IGraph
IGraphics
iid
IImage
Iindex
IInitialize
IInspectable
IInvoke
IIO
IItem
IJson
@@ -1113,10 +1084,10 @@ LMEM
LMENU
lnk
LOADLIBRARYASDATAFILE
LOADSTRING
LOBYTE
LOCALAPPDATA
LOCALDISPLAY
localhost
LOCALPACKAGE
localport
localtime
@@ -1134,7 +1105,6 @@ lookbehind
lowlevel
LOWORD
lparam
LPBITMAPINFOHEADER
LPBYTE
LPCITEMIDLIST
LPCMINVOKECOMMANDINFO
@@ -1154,6 +1124,7 @@ lpsz
lpt
LPTHREAD
LPTOP
lptpm
LPTSTR
LPVOID
LPW
@@ -1218,6 +1189,7 @@ Melman
memcmp
memcpy
memset
MENUBREAK
MENUITEMINFO
MENUITEMINFOW
Metadatas
@@ -1244,7 +1216,6 @@ MINIMIZEEND
MINIMIZESTART
miniz
minlevel
minmax
MINORVERSION
Miracast
Mishkeegogamang
@@ -1270,14 +1241,14 @@ monitorinfof
Monthand
Moq
MOUSEACTIVATE
MOUSEEVENTF
MOUSEHWHEEL
MOUSEINPUT
MOUSELEAVE
MOUSEMOVE
MOUSESWITCH
MOUSEWHEEL
MOVESIZEEND
MOVESIZESTART
MOVEWINDOWS
mozilla
mpmc
MRM
@@ -1313,6 +1284,7 @@ multizone
Mundrabilla
mutex
mutexes
muxc
MVVM
myfile
MYICON
@@ -1321,6 +1293,7 @@ NAMECHANGE
nameof
namespace
Navassa
naveensrinivasan
NCACTIVATE
ncc
NCCALCSIZE
@@ -1346,7 +1319,6 @@ NDEBUG
Ndombe
ndp
NEEDDISPATCH
NEQ
NESW
netcore
netcoreapp
@@ -1374,7 +1346,6 @@ NOASYNC
NOCLOSEPROCESS
NOCOPYBITS
nodeca
nodiscard
nodoc
noexcept
NOINHERITLAYOUT
@@ -1422,6 +1393,7 @@ ntdll
NTFS
NTSTATUS
nuget
nuint
nullonfailure
nullopt
nullptr
@@ -1437,7 +1409,6 @@ Objbase
OBJID
objidl
oblitum
ocr
odbc
odbccp
Oem
@@ -1483,6 +1454,7 @@ overlaywindow
Overridable
Oversampling
OWNDC
OWNERDRAW
PACL
pagos
PAINTSTRUCT
@@ -1495,7 +1467,6 @@ PARENTNOTIFY
PARENTRELATIVEEDITING
PARENTRELATIVEFORADDRESSBAR
PARENTRELATIVEPARSING
PArgb
parray
PARTIALCONFIRMATIONDIALOGTITLE
pathcch
@@ -1517,14 +1488,12 @@ PDWORD
pedrolamas
PERCEIVEDFLAG
pesi
peteblois
PEXCEPTION
pfn
pfo
pft
pgp
pguid
PHANDLER
phbm
phbmp
phwnd
@@ -1552,10 +1521,8 @@ Pohnpei
popup
POPUPWINDOW
posix
poweraccent
powercfg
powerlauncher
POWEROCR
powerpreview
powerrename
POWERRENAMECONTEXTMENU
@@ -1646,6 +1613,7 @@ QUERYENDSESSION
QUERYOPEN
QUEUESYNC
Quickime
QUICKLAYOUTSWITCH
QUNS
qwertyuiopasdfghjklzxcvbnm
qword
@@ -1714,10 +1682,11 @@ requerying
rescap
resgen
resheader
Resizable
resizable
resizers
resmimetype
RESOURCEID
RESTORESIZE
RESTORETOMAXIMIZED
restrictedcapabilities
restrictederrorinfo
@@ -1739,13 +1708,11 @@ RIGHTSCROLLBAR
riid
riverar
RKey
RLO
RMENU
RNumber
roadmap
robmensching
Roboto
rooler
roslyn
Rothera
roundf
@@ -1819,7 +1786,6 @@ SETTINGCHANGE
settingsheader
settingshotkeycontrol
SETWORKAREA
setzero
sfgao
SFGAOF
SFP
@@ -1835,6 +1801,7 @@ SHELLEXECUTEINFOW
shellscalingapi
SHFILEINFO
SHGFI
SHIFTDRAG
Shl
shldisp
shlobj
@@ -1923,11 +1890,9 @@ srme
srre
srw
srwlock
sse
ssf
ssh
sstream
stackalloc
STACKFRAME
stackoverflow
stackpanel
@@ -1968,7 +1933,6 @@ stoull
strcmp
streampos
strftime
strikethrough
Stringified
Stringify
STRINGIZE
@@ -1989,7 +1953,6 @@ subkey
SUBLANG
submenu
subquery
subresource
substr
Sul
Superbar
@@ -2006,7 +1969,6 @@ swprintf
SWRESTORE
swscanf
SYMED
symlink
SYMOPT
SYNCMFT
SYNCPAINT
@@ -2043,7 +2005,6 @@ taskkill
tasklist
taskschd
tchar
Tcollab
tcscpy
TCustom
tdbuild
@@ -2056,9 +2017,9 @@ Tenggara
testcase
testhost
testprocess
testzones
TEXCOORD
textblock
TEXTEXTRACTOR
TEXTINCLUDE
THH
THICKFRAME
@@ -2084,8 +2045,6 @@ Toolset
toolwindow
TOPDOWNDIB
toplevel
TOUCHEVENTF
TOUCHINPUT
touchpad
toupper
Towindow
@@ -2105,7 +2064,6 @@ Tshuapa
TStr
Tuva
TValue
TWF
TYMED
typedef
TYPEKEY
@@ -2128,7 +2086,6 @@ uefi
UHash
UIA
uid
UIEx
uint
uintptr
UIPI
@@ -2146,7 +2103,6 @@ undef
UNDNAME
unescape
Unicast
UNICODETEXT
Unindent
Uninitialize
uninstall
@@ -2195,20 +2151,15 @@ Uvs
uwp
uxtheme
UYVY
vabdq
validmodulename
Vanara
vcamp
vcdl
vcgtq
VCINSTALLDIR
vcm
Vcpkg
VCRT
vcvars
VDesktop
vdi
vdupq
vec
VERBSONLY
VERBW
@@ -2218,8 +2169,6 @@ VERSIONINFO
Versioning
vformat
VFT
vget
vgetq
vid
VIDCAP
videoconference
@@ -2229,36 +2178,27 @@ viewbox
viewmodel
vih
virtualization
Virtualizing
visiblecolorformats
Visibletrue
visualbrush
visualstudio
VKey
VKTAB
vmovl
vorrq
VOS
vpaddlq
Vpn
vqsubq
VREDRAW
vreinterpretq
VSC
VSCBD
vscdb
vscode
vsconfig
VSCROLL
vsetq
vsonline
vstemplate
VSTHRD
VSTT
vswhere
vtable
Vtbl
WANTPALM
wbem
wbemuuid
WBounds
@@ -2275,7 +2215,6 @@ wcscpy
wcslen
wcsncmp
wcsnicmp
WDA
wdp
wdupenv
weakme
@@ -2337,7 +2276,6 @@ winsdkver
winspool
WINTHRESHOLD
winui
winuiex
winxamlmanager
wistd
withinrafael
@@ -2414,7 +2352,6 @@ XLoc
XNamespace
XOffset
xpath
XPixel
XResource
xsi
XStr
@@ -2435,7 +2372,10 @@ ZEROINIT
ZIndex
zipfile
zonable
ZONECOLOR
ZONEHIGHLIGHTCOLOR
zoneset
ZONESETCHANGE
Zoneszonabletester
Zonev
zzz

View File

@@ -25,14 +25,14 @@
"modules\\AlwaysOnTop\\PowerToys.AlwaysOnTop.exe",
"modules\\AlwaysOnTop\\PowerToys.AlwaysOnTopModuleInterface.dll",
"modules\\ColorPicker\\ColorPicker.dll",
"modules\\ColorPicker\\ColorPickerUI.dll",
"modules\\ColorPicker\\ColorPickerUI.exe",
"modules\\ColorPicker\\PowerToys.ColorPicker.dll",
"modules\\ColorPicker\\PowerToys.ColorPickerUI.dll",
"modules\\ColorPicker\\PowerToys.ColorPickerUI.exe",
"modules\\PowerOCR\\PowerToys.PowerOCRModuleInterface.dll",
"modules\\PowerOCR\\PowerToys.PowerOCR.dll",
"modules\\PowerOCR\\PowerToys.PowerOCR.exe",
"modules\\Awake\\PowerToys.AwakeModuleInterface.dll",
"modules\\Awake\\PowerToys.Awake.exe",
"modules\\Awake\\PowerToys.Awake.dll",
@@ -86,7 +86,6 @@
"modules\\launcher\\Plugins\\Folder\\Microsoft.Plugin.Folder.dll",
"modules\\launcher\\Plugins\\Indexer\\Microsoft.Plugin.Indexer.dll",
"modules\\launcher\\Plugins\\OneNote\\Microsoft.PowerToys.Run.Plugin.OneNote.dll",
"modules\\launcher\\Plugins\\History\\Microsoft.PowerToys.Run.Plugin.History.dll",
"modules\\launcher\\Plugins\\Program\\Microsoft.Plugin.Program.dll",
"modules\\launcher\\Plugins\\Registry\\Microsoft.PowerToys.Run.Plugin.Registry.dll",
"modules\\launcher\\Plugins\\WindowsSettings\\Microsoft.PowerToys.Run.Plugin.WindowsSettings.dll",
@@ -102,23 +101,10 @@
"modules\\launcher\\Plugins\\WebSearch\\Community.PowerToys.Run.Plugin.WebSearch.dll",
"modules\\launcher\\Plugins\\WindowsTerminal\\Microsoft.PowerToys.Run.Plugin.WindowsTerminal.dll",
"modules\\MeasureTool\\PowerToys.MeasureToolModuleInterface.dll",
"modules\\MeasureTool\\PowerToys.MeasureToolCore.dll",
"modules\\MeasureTool\\PowerToys.MeasureToolUI.dll",
"modules\\MeasureTool\\PowerToys.MeasureToolUI.exe",
"modules\\MouseUtils\\PowerToys.FindMyMouse.dll",
"modules\\MouseUtils\\PowerToys.MouseHighlighter.dll",
"modules\\MouseUtils\\PowerToys.MousePointerCrosshairs.dll",
"modules\\PowerAccent\\PowerAccent.Core.dll",
"modules\\PowerAccent\\PowerAccent.dll",
"modules\\PowerAccent\\PowerAccent.exe",
"modules\\PowerAccent\\PowerToys.PowerAccent.dll",
"modules\\PowerAccent\\PowerToys.PowerAccent.exe",
"modules\\PowerAccent\\PowerToys.PowerAccentModuleInterface.dll",
"modules\\PowerAccent\\PowerToys.PowerAccentKeyboardService.dll",
"modules\\PowerRename\\PowerToys.PowerRenameExt.dll",
"modules\\PowerRename\\PowerToys.PowerRename.exe",
"modules\\PowerRename\\PowerToys.PowerRenameContextMenu.dll",
@@ -200,19 +186,7 @@
"vccorlib140_app.dll",
"vcomp140_app.dll",
"vcruntime140_1_app.dll",
"vcruntime140_app.dll",
"modules\\PowerAccent\\Vanara.Core.dll",
"modules\\PowerAccent\\Vanara.PInvoke.ComCtl32.dll",
"modules\\PowerAccent\\Vanara.PInvoke.Cryptography.dll",
"modules\\PowerAccent\\Vanara.PInvoke.Gdi32.dll",
"modules\\PowerAccent\\Vanara.PInvoke.Kernel32.dll",
"modules\\PowerAccent\\Vanara.PInvoke.Ole.dll",
"modules\\PowerAccent\\Vanara.PInvoke.Rpc.dll",
"modules\\PowerAccent\\Vanara.PInvoke.Security.dll",
"modules\\PowerAccent\\Vanara.PInvoke.Shared.dll",
"modules\\PowerAccent\\Vanara.PInvoke.Shell32.dll",
"modules\\PowerAccent\\Vanara.PInvoke.ShlwApi.dll",
"modules\\PowerAccent\\Vanara.PInvoke.User32.dll",
"vcruntime140_app.dll",
"modules\\FileExplorerPreview\\Microsoft.Web.WebView2.Core.dll",
"modules\\FileExplorerPreview\\Microsoft.Web.WebView2.WinForms.dll",
"modules\\FileExplorerPreview\\Microsoft.Web.WebView2.Wpf.dll",

View File

@@ -7,41 +7,6 @@ steps:
submodules: true
clean: true
- task: PowerShell@2
displayName: Verify Arm64 configuration for PowerToys.sln
inputs:
filePath: '$(build.sourcesdirectory)\.pipelines\verifyArm64Configuration.ps1'
arguments: -solution '$(build.sourcesdirectory)\PowerToys.sln'
pwsh: true
- task: PowerShell@2
displayName: Verify Arm64 configuration for BugReportTool.sln
inputs:
filePath: '$(build.sourcesdirectory)\.pipelines\verifyArm64Configuration.ps1'
arguments: -solution '$(build.sourcesdirectory)\tools\BugReportTool\BugReportTool.sln'
pwsh: true
- task: PowerShell@2
displayName: Verify Arm64 configuration for WebcamReportTool.sln
inputs:
filePath: '$(build.sourcesdirectory)\.pipelines\verifyArm64Configuration.ps1'
arguments: -solution '$(build.sourcesdirectory)\tools\WebcamReportTool\WebcamReportTool.sln'
pwsh: true
- task: PowerShell@2
displayName: Verify Arm64 configuration for StylesReportTool.sln
inputs:
filePath: '$(build.sourcesdirectory)\.pipelines\verifyArm64Configuration.ps1'
arguments: -solution '$(build.sourcesdirectory)\tools\StylesReportTool\StylesReportTool.sln'
pwsh: true
- task: PowerShell@2
displayName: Verify Arm64 configuration for PowerToysSetup.sln
inputs:
filePath: '$(build.sourcesdirectory)\.pipelines\verifyArm64Configuration.ps1'
arguments: -solution '$(build.sourcesdirectory)\installer\PowerToysSetup.sln'
pwsh: true
- task: UseDotNet@2
displayName: 'Use .NET 6 SDK'
inputs:
@@ -197,12 +162,14 @@ steps:
**\Microsoft.PowerToys.Run.Plugin.TimeZone.UnitTests.dll
**\Microsoft.Plugin.WindowsTerminal.UnitTests.dll
**\Microsoft.Plugin.WindowWalker.UnitTests.dll
**\PreviewPaneUnitTests.dll
**\UnitTests-SvgThumbnailProvider.dll
**\UnitTests-SvgPreviewHandler.dll
!**\obj\**
!**\ref\**
# TODO: Enable these tests after figuring out what caused the tests that depend on WebView2 to start timing out in CI.
# **\PreviewPaneUnitTests.dll # It's UnitTests-MarkdownPreviewHandler
# **\UnitTests-SvgThumbnailProvider.dll
# **\UnitTests-SvgPreviewHandler.dll
# Native dlls
- task: VSTest@2
condition: ne(variables['BuildPlatform'],'arm64') # No arm64 agents to run the tests.
@@ -217,5 +184,4 @@ steps:
**\UnitTests-CommonLib.dll
**\PowerRenameUnitTests.dll
**\powerpreviewTest.dll
**\UnitTests-FancyZones.dll
!**\obj\**

View File

@@ -279,22 +279,6 @@ jobs:
configuration: $(BuildConfiguration)
maximumCpuCount: true
- task: VSBuild@1
displayName: Publish Measure Tool UI for Packaging
inputs:
solution: 'src/modules/MeasureTool/MeasureToolUI/MeasureToolUI.csproj'
vsVersion: 17.0
# The arguments should be the same as the ones for Settings; make sure they are.
msbuildArgs: >-
/target:Publish
/p:Configuration=$(BuildConfiguration);Platform=$(BuildPlatform);AppxBundle=Never
/p:VCRTForwarders-IncludeDebugCRT=false
/p:PowerToysRoot=$(Build.SourcesDirectory)
/p:PublishProfile=InstallationPublishProfile.pubxml
platform: $(BuildPlatform)
configuration: $(BuildConfiguration)
maximumCpuCount: true
- task: VSBuild@1
displayName: Build PowerToysSetupCustomActions DLL # This dll needs to be build and signed before building the MSI.
inputs:

View File

@@ -1,63 +0,0 @@
[CmdletBinding()]
Param(
[Parameter(Mandatory=$True,Position=1)]
[string]$solution
)
Write-Output "Verifying Arm64 configuration for $solution"
$errorTable = @{}
$MSBuildLoc = & "C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe" -prerelease -requires Microsoft.Component.MSBuild -find MSBuild\**\Bin\Microsoft.Build.dll
if ($null -eq $MSBuildLoc) {
throw "Unable to locate Microsoft.Build.dll"
}
try {
Add-Type -Path $MSBuildLoc
}
catch {
# Catching because it may error on loading all the types from the assembly, but we only need one
}
$solutionFile = [Microsoft.Build.Construction.SolutionFile]::Parse($solution);
$arm64SlnConfigs = $solutionFile.SolutionConfigurations | Where-Object {
$_.PlatformName -eq "ARM64"
};
# Should have two configurations. Debug and Release.
if($arm64SlnConfigs.Length -lt 2) {
Write-Host -ForegroundColor Red "Missing Solution-level Arm64 platforms"
exit 1;
}
# List projects only.
$projects = $solutionFile.ProjectsInOrder | Where-Object {
$_.ProjectType -eq "KnownToBeMSBuildFormat"
};
# Enumerate through the projects and add any project with a mismatched platform and project configuration
foreach ($project in $projects) {
foreach ($slnConfig in $arm64SlnConfigs.FullName) {
if ($project.ProjectConfigurations.$slnConfig.FullName -ne $slnConfig) {
$errorTable[$project.ProjectName] += @(""
| Select-Object @{n = "Configuration"; e = { $project.ProjectConfigurations.$slnConfig.FullName } },
@{n = "ExpectedConfiguration"; e = { $slnConfig } })
}
}
}
if ($errorTable.Count -gt 0) {
Write-Host -ForegroundColor Red "Verification failed for the following projects:`n"
$errorTable.Keys | ForEach-Object {
Write-Host -ForegroundColor Red $_`:;
$errorTable[$_] | ForEach-Object {
Write-Host -ForegroundColor Red "$($_.ExpectedConfiguration)=$($_.Configuration)";
};
Write-Host -ForegroundColor Red `r
}
exit 1;
}
Write-Output "Verification Complete"
exit 0;

View File

@@ -25,7 +25,7 @@ if($items.Count -eq 0)
exit 1;
}
$items | ForEach-Object {
$items | ForEach-Object {
if($_.VersionInfo.FileVersion -eq "1.0.0.0" )
{
# These items are exceptions that actually have the 1.0.0.0 version.
@@ -39,30 +39,6 @@ $items | ForEach-Object {
(-not $_.Name.EndsWith("Microsoft.Xaml.Interactivity.dll")) -and
(-not $_.Name.EndsWith("Microsoft.WindowsAppRuntime.Release.Net.dll"))
)
{
Write-Host "Version set to 1.0.0.0: " + $_.FullName
$totalFailure++;
}
}
}
$items | ForEach-Object {
if($_.VersionInfo.FileVersion -eq $null )
{
# These items are exceptions that actually a version not set.
if ((-not $_.Name.EndsWith("codicon.ttf")) -and
(-not $_.Name.EndsWith("e_sqlite3.dll")) -and
(-not $_.Name.EndsWith("vcamp140_app.dll")) -and
(-not $_.Name.EndsWith("marshal.dll")) -and
(-not $_.Name.EndsWith("Microsoft.UI.Composition.OSSupport.dll")) -and
(-not $_.Name.EndsWith("Microsoft.UI.Xaml.Internal.dll")) -and
(-not $_.Name.EndsWith("Microsoft.Windows.ApplicationModel.Resources.dll")) -and
(-not $_.Name.EndsWith("Microsoft.WindowsAppRuntime.dll")) -and
(-not $_.Name.EndsWith("Microsoft.WindowsAppRuntime.Bootstrap.dll")) -and
(-not $_.Name.EndsWith("MRM.dll")) -and
(-not $_.Name.EndsWith("PushNotificationsLongRunningTask.ProxyStub.dll")) -and
(-not $_.Name.EndsWith("WindowsAppSdk.AppxDeploymentExtensions.Desktop.dll"))
)
{
Write-Host "Version not set: " + $_.FullName
$totalFailure++;

View File

@@ -39,22 +39,4 @@ $verProps.Project.PropertyGroup.Version = $versionNumber;
$verProps.Project.PropertyGroup.DevEnvironment = $DevEnvironment;
Write-Host "xml" $verProps.Project.PropertyGroup.Version
$verProps.Save($verPropWriteFileLocation);
# Set PowerRenameContextMenu package version in AppManifest.xml
$powerRenameContextMenuAppManifestWriteFileLocation = $PSScriptRoot + '/../src/modules/powerrename/PowerRenameContextMenu/AppxManifest.xml';
$powerRenameContextMenuAppManifestReadFileLocation = $powerRenameContextMenuAppManifestWriteFileLocation;
[XML]$powerRenameContextMenuAppManifest = Get-Content $powerRenameContextMenuAppManifestReadFileLocation
$powerRenameContextMenuAppManifest.Package.Identity.Version = $versionNumber + '.0'
Write-Host "PowerRenameContextMenu version" $powerRenameContextMenuAppManifest.Package.Identity.Version
$powerRenameContextMenuAppManifest.Save($powerRenameContextMenuAppManifestWriteFileLocation);
# Set ImageResizerContextMenu package version in AppManifest.xml
$imageResizerContextMenuAppManifestWriteFileLocation = $PSScriptRoot + '/../src/modules/imageresizer/ImageResizerContextMenu/AppxManifest.xml';
$imageResizerContextMenuAppManifestReadFileLocation = $imageResizerContextMenuAppManifestWriteFileLocation;
[XML]$imageResizerContextMenuAppManifest = Get-Content $imageResizerContextMenuAppManifestReadFileLocation
$imageResizerContextMenuAppManifest.Package.Identity.Version = $versionNumber + '.0'
Write-Host "ImageResizerContextMenu version" $imageResizerContextMenuAppManifest.Package.Identity.Version
$imageResizerContextMenuAppManifest.Save($imageResizerContextMenuAppManifestWriteFileLocation);
$verProps.Save($verPropWriteFileLocation);

View File

@@ -6,8 +6,7 @@
"Microsoft.VisualStudio.Workload.NativeDesktop",
"Microsoft.VisualStudio.Workload.ManagedDesktop",
"Microsoft.VisualStudio.Workload.Universal",
"Microsoft.VisualStudio.Component.Windows10SDK.19041",
"Microsoft.VisualStudio.Component.Windows10SDK.20348",
"Microsoft.VisualStudio.Component.Windows10SDK.18362",
"Microsoft.VisualStudio.ComponentGroup.UWP.VC",
"Microsoft.VisualStudio.Component.VC.Runtimes.x86.x64.Spectre",
"Microsoft.VisualStudio.Component.VC.ATL.Spectre"

View File

@@ -12,9 +12,6 @@ Aaron has helped triaging, discussing, and creating a substantial number of issu
### [@CleanCodeDeveloper](https://github.com/CleanCodeDeveloper)
CleanCodeDeveloper helped do massive amounts of code stability and image resizer work.
### [@damienleroy](https://github.com/damienleroy) - [Damien Leroy](https://www.linkedin.com/in/Damien-Leroy-b2734416a/)
Damien has helped out by developing and contributing the Quick Accent utility.
### [@davidegiacometti](https://github.com/davidegiacometti) - [Davide Giacometti](https://www.linkedin.com/in/davidegiacometti/)
Davide has helped fix multiple bugs, added new features, as well as help us with the ARM64 effort by porting applications to .NET Core.
@@ -62,9 +59,6 @@ Their fork of Wox was the base of PowerToys Run.
Initial base of jjw24's fork, which makes it the base of PowerToys Run.
### [Text-Grab](https://github.com/TheJoeFin/Text-Grab) - Joseph Finney
Joe helped develop and contribute to the Text Extractor utility. It is directly based on his Text Grab application.
## Microsoft community members
We would like to also directly call out some extremely helpful Microsoft employees that have directly contributed to PowerToys. This isn't their day job and was work they did out of passion. We want to say thank you and recognize your work.

View File

@@ -12,14 +12,14 @@
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|ARM64">
<Configuration>Debug</Configuration>
<Platform>ARM64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|ARM64">
<Configuration>Release</Configuration>
<Platform>ARM64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|ARM64">
<Configuration>Debug</Configuration>
<Platform>ARM64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|ARM64">
<Configuration>Release</Configuration>
<Platform>ARM64</Platform>
</ProjectConfiguration>
</ItemGroup>
<!-- Props that should be disabled while building on CI server -->
@@ -32,13 +32,11 @@
<!-- C++ source compile-specific things for all configurations -->
<PropertyGroup>
<PreferredToolArchitecture>x64</PreferredToolArchitecture>
<VcpkgEnabled>false</VcpkgEnabled>
<ExternalIncludePath>$(MSBuildThisFileFullPath)\..\deps\;$(ExternalIncludePath)</ExternalIncludePath>
</PropertyGroup>
<ItemDefinitionGroup>
<ClCompile>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<WarningLevel>Level3</WarningLevel>
<DisableAnalyzeExternal >true</DisableAnalyzeExternal>
<ExternalWarningLevel>TurnOffAllWarnings</ExternalWarningLevel>
@@ -85,10 +83,8 @@
</ItemDefinitionGroup>
<!-- Global props -->
<PropertyGroup Label="Globals"
Condition="'$(OverrideWindowsTargetPlatformVersion)'!='True'">
<PropertyGroup Label="Globals" Condition="'$(OverrideWindowsTargetPlatformVersion)'!='True'">
<WindowsTargetPlatformVersion>10.0.19041.0</WindowsTargetPlatformVersion>
<TargetPlatformVersion>10.0.19041.0</TargetPlatformVersion>
</PropertyGroup>
<!-- Props that are constant for both Debug and Release configurations -->
@@ -96,17 +92,14 @@
<PlatformToolset Condition="'$(OverridePlatformToolset)'!='True'">v143</PlatformToolset>
<IntDir>$(SolutionDir)$(Platform)\$(Configuration)\obj\$(ProjectName)\</IntDir>
<CharacterSet>Unicode</CharacterSet>
<DesktopCompatible>true</DesktopCompatible>
</PropertyGroup>
<!-- Debug/Release props -->
<PropertyGroup Condition="'$(Configuration)'=='Debug'"
Label="Configuration">
<PropertyGroup Condition="'$(Configuration)'=='Debug'" Label="Configuration">
<UseDebugLibraries>true</UseDebugLibraries>
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)'=='Release'"
Label="Configuration">
<PropertyGroup Condition="'$(Configuration)'=='Release'" Label="Configuration">
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<LinkIncremental>false</LinkIncremental>

View File

@@ -6,7 +6,6 @@ This software incorporates material from third parties.
- ImageResizer
- PowerToys Run
- Installer/Runner
- Measure tool
## Utility: Color Picker
@@ -275,26 +274,3 @@ OTHER DEALINGS IN THE SOFTWARE.
For more information, please refer to <http://unlicense.org/>
## Utility: Measure tool
### sse2neon
We adopted some functions from it.
**Source**: https://github.com/DLTcollab/sse2neon
sse2neon is freely redistributable under the MIT License.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@@ -284,7 +284,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "utils", "utils", "{B39DC643
src\common\utils\process_path.h = src\common\utils\process_path.h
src\common\utils\registry.h = src\common\utils\registry.h
src\common\utils\resources.h = src\common\utils\resources.h
src\common\utils\serialized.h = src\common\utils\serialized.h
src\common\utils\string_utils.h = src\common\utils\string_utils.h
src\common\utils\timeutil.h = src\common\utils\timeutil.h
src\common\utils\UnhandledExceptionHandler.h = src\common\utils\UnhandledExceptionHandler.h
@@ -408,7 +407,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PowerRenameUI", "src\module
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PowerRenameContextMenu", "src\modules\powerrename\PowerRenameContextMenu\PowerRenameContextMenu.vcxproj", "{1DBBB112-4BB1-444B-8EBB-E66555C76BA6}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.PowerToys.Run.Plugin.TimeZone.UnitTests", "src\modules\launcher\Plugins\Microsoft.PowerToys.Run.Plugin.TimeZone.UnitTests\Microsoft.PowerToys.Run.Plugin.TimeZone.UnitTests.csproj", "{C5D46169-5334-48C3-8C28-644C72832E54}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.PowerToys.Run.Plugin.TimeZone.UnitTests", "src\modules\launcher\Plugins\Microsoft.PowerToys.Run.Plugin.TimeZone.UnitTests\Microsoft.PowerToys.Run.Plugin.TimeZone.UnitTests.csproj", "{C5D46169-5334-48C3-8C28-644C72832E54}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.PowerToys.Run.Plugin.OneNote", "src\modules\launcher\Plugins\Microsoft.PowerToys.Run.Plugin.OneNote\Microsoft.PowerToys.Run.Plugin.OneNote.csproj", "{5A1DB2F0-0715-4B3B-98E6-79BC41540045}"
EndProject
@@ -416,39 +415,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ImageResizerContextMenu", "
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ImageResizerLib", "src\modules\imageresizer\ImageResizerLib\ImageResizerLib.vcxproj", "{18B3DB45-4FFE-4D01-97D6-5223FEEE1853}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "PowerAccent", "PowerAccent", "{0F14491C-6369-4C45-AAA8-135814E66E6B}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PowerAccentModuleInterface", "src\modules\poweraccent\PowerAccentModuleInterface\PowerAccentModuleInterface.vcxproj", "{34A354C5-23C7-4343-916C-C52DAF4FC39D}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PowerAccent", "src\modules\poweraccent\PowerAccent\PowerAccent.csproj", "{7B4CDB0D-28C9-4F95-88AA-73FCC06E354C}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PowerAccent.Core", "src\modules\poweraccent\PowerAccent.Core\PowerAccent.Core.csproj", "{3264DF53-C805-4B0C-867C-FCEAF7AEF762}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PowerAccent.UI", "src\modules\poweraccent\PowerAccent.UI\PowerAccent.UI.csproj", "{31CAD28E-778A-441C-85BC-40AB3EAA2A10}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "PowerOCR", "PowerOCR", "{A50C70A6-2DA0-4027-B90E-B1A40755A8A5}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PowerOCR", "src\modules\PowerOCR\PowerOCR\PowerOCR.csproj", "{25C91A4E-BA4E-467A-85CD-8B62545BF674}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PowerOCRModuleInterface", "src\modules\PowerOCR\PowerOCRModuleInterface\PowerOCRModuleInterface.vcxproj", "{6AB6A2D6-F859-4A82-9184-0BD29C9F07D1}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.PowerToys.Run.Plugin.History", "src\modules\launcher\Plugins\Microsoft.PowerToys.Run.Plugin.History\Microsoft.PowerToys.Run.Plugin.History.csproj", "{212AD910-8488-4036-BE20-326931B75FB2}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "MeasureTool", "MeasureTool", "{7AC943C9-52E8-44CF-9083-744D8049667B}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PowerToys.MeasureToolCore", "src\modules\MeasureTool\MeasureToolCore\PowerToys.MeasureToolCore.vcxproj", "{54A93AF7-60C7-4F6C-99D2-FBB1F75F853A}"
ProjectSection(ProjectDependencies) = postProject
{6955446D-23F7-4023-9BB3-8657F904AF99} = {6955446D-23F7-4023-9BB3-8657F904AF99}
{CABA8DFB-823B-4BF2-93AC-3F31984150D9} = {CABA8DFB-823B-4BF2-93AC-3F31984150D9}
{CC6E41AC-8174-4E8A-8D22-85DD7F4851DF} = {CC6E41AC-8174-4E8A-8D22-85DD7F4851DF}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MeasureToolModuleInterface", "src\modules\MeasureTool\MeasureToolModuleInterface\MeasureToolModuleInterface.vcxproj", "{92C39820-9F84-4529-BC7D-22AAE514D63B}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MeasureToolUI", "src\modules\MeasureTool\MeasureToolUI\MeasureToolUI.csproj", "{515554D1-D004-4F7F-A107-2211FC0F6B2C}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PowerAccentKeyboardService", "src\modules\poweraccent\PowerAccentKeyboardService\PowerAccentKeyboardService.vcxproj", "{C97D9A5D-206C-454E-997E-009E227D7F02}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|ARM64 = Debug|ARM64
@@ -1666,144 +1632,6 @@ Global
{18B3DB45-4FFE-4D01-97D6-5223FEEE1853}.Release|x64.Build.0 = Release|x64
{18B3DB45-4FFE-4D01-97D6-5223FEEE1853}.Release|x86.ActiveCfg = Release|x64
{18B3DB45-4FFE-4D01-97D6-5223FEEE1853}.Release|x86.Build.0 = Release|x64
{34A354C5-23C7-4343-916C-C52DAF4FC39D}.Debug|ARM64.ActiveCfg = Debug|ARM64
{34A354C5-23C7-4343-916C-C52DAF4FC39D}.Debug|ARM64.Build.0 = Debug|ARM64
{34A354C5-23C7-4343-916C-C52DAF4FC39D}.Debug|x64.ActiveCfg = Debug|x64
{34A354C5-23C7-4343-916C-C52DAF4FC39D}.Debug|x64.Build.0 = Debug|x64
{34A354C5-23C7-4343-916C-C52DAF4FC39D}.Debug|x86.ActiveCfg = Debug|x64
{34A354C5-23C7-4343-916C-C52DAF4FC39D}.Debug|x86.Build.0 = Debug|x64
{34A354C5-23C7-4343-916C-C52DAF4FC39D}.Release|ARM64.ActiveCfg = Release|ARM64
{34A354C5-23C7-4343-916C-C52DAF4FC39D}.Release|ARM64.Build.0 = Release|ARM64
{34A354C5-23C7-4343-916C-C52DAF4FC39D}.Release|x64.ActiveCfg = Release|x64
{34A354C5-23C7-4343-916C-C52DAF4FC39D}.Release|x64.Build.0 = Release|x64
{34A354C5-23C7-4343-916C-C52DAF4FC39D}.Release|x86.ActiveCfg = Release|x64
{34A354C5-23C7-4343-916C-C52DAF4FC39D}.Release|x86.Build.0 = Release|x64
{7B4CDB0D-28C9-4F95-88AA-73FCC06E354C}.Debug|ARM64.ActiveCfg = Debug|ARM64
{7B4CDB0D-28C9-4F95-88AA-73FCC06E354C}.Debug|ARM64.Build.0 = Debug|ARM64
{7B4CDB0D-28C9-4F95-88AA-73FCC06E354C}.Debug|x64.ActiveCfg = Debug|x64
{7B4CDB0D-28C9-4F95-88AA-73FCC06E354C}.Debug|x64.Build.0 = Debug|x64
{7B4CDB0D-28C9-4F95-88AA-73FCC06E354C}.Debug|x86.ActiveCfg = Debug|x64
{7B4CDB0D-28C9-4F95-88AA-73FCC06E354C}.Debug|x86.Build.0 = Debug|x64
{7B4CDB0D-28C9-4F95-88AA-73FCC06E354C}.Release|ARM64.ActiveCfg = Release|ARM64
{7B4CDB0D-28C9-4F95-88AA-73FCC06E354C}.Release|ARM64.Build.0 = Release|ARM64
{7B4CDB0D-28C9-4F95-88AA-73FCC06E354C}.Release|x64.ActiveCfg = Release|x64
{7B4CDB0D-28C9-4F95-88AA-73FCC06E354C}.Release|x64.Build.0 = Release|x64
{7B4CDB0D-28C9-4F95-88AA-73FCC06E354C}.Release|x86.ActiveCfg = Release|x64
{7B4CDB0D-28C9-4F95-88AA-73FCC06E354C}.Release|x86.Build.0 = Release|x64
{3264DF53-C805-4B0C-867C-FCEAF7AEF762}.Debug|ARM64.ActiveCfg = Debug|ARM64
{3264DF53-C805-4B0C-867C-FCEAF7AEF762}.Debug|ARM64.Build.0 = Debug|ARM64
{3264DF53-C805-4B0C-867C-FCEAF7AEF762}.Debug|x64.ActiveCfg = Debug|x64
{3264DF53-C805-4B0C-867C-FCEAF7AEF762}.Debug|x64.Build.0 = Debug|x64
{3264DF53-C805-4B0C-867C-FCEAF7AEF762}.Debug|x86.ActiveCfg = Debug|x64
{3264DF53-C805-4B0C-867C-FCEAF7AEF762}.Debug|x86.Build.0 = Debug|x64
{3264DF53-C805-4B0C-867C-FCEAF7AEF762}.Release|ARM64.ActiveCfg = Release|ARM64
{3264DF53-C805-4B0C-867C-FCEAF7AEF762}.Release|ARM64.Build.0 = Release|ARM64
{3264DF53-C805-4B0C-867C-FCEAF7AEF762}.Release|x64.ActiveCfg = Release|x64
{3264DF53-C805-4B0C-867C-FCEAF7AEF762}.Release|x64.Build.0 = Release|x64
{3264DF53-C805-4B0C-867C-FCEAF7AEF762}.Release|x86.ActiveCfg = Release|x64
{3264DF53-C805-4B0C-867C-FCEAF7AEF762}.Release|x86.Build.0 = Release|x64
{31CAD28E-778A-441C-85BC-40AB3EAA2A10}.Debug|ARM64.ActiveCfg = Debug|ARM64
{31CAD28E-778A-441C-85BC-40AB3EAA2A10}.Debug|ARM64.Build.0 = Debug|ARM64
{31CAD28E-778A-441C-85BC-40AB3EAA2A10}.Debug|x64.ActiveCfg = Debug|x64
{31CAD28E-778A-441C-85BC-40AB3EAA2A10}.Debug|x64.Build.0 = Debug|x64
{31CAD28E-778A-441C-85BC-40AB3EAA2A10}.Debug|x86.ActiveCfg = Debug|x64
{31CAD28E-778A-441C-85BC-40AB3EAA2A10}.Debug|x86.Build.0 = Debug|x64
{31CAD28E-778A-441C-85BC-40AB3EAA2A10}.Release|ARM64.ActiveCfg = Release|ARM64
{31CAD28E-778A-441C-85BC-40AB3EAA2A10}.Release|ARM64.Build.0 = Release|ARM64
{31CAD28E-778A-441C-85BC-40AB3EAA2A10}.Release|x64.ActiveCfg = Release|x64
{31CAD28E-778A-441C-85BC-40AB3EAA2A10}.Release|x64.Build.0 = Release|x64
{31CAD28E-778A-441C-85BC-40AB3EAA2A10}.Release|x86.ActiveCfg = Release|x64
{31CAD28E-778A-441C-85BC-40AB3EAA2A10}.Release|x86.Build.0 = Release|x64
{25C91A4E-BA4E-467A-85CD-8B62545BF674}.Debug|ARM64.ActiveCfg = Debug|ARM64
{25C91A4E-BA4E-467A-85CD-8B62545BF674}.Debug|ARM64.Build.0 = Debug|ARM64
{25C91A4E-BA4E-467A-85CD-8B62545BF674}.Debug|x64.ActiveCfg = Debug|x64
{25C91A4E-BA4E-467A-85CD-8B62545BF674}.Debug|x64.Build.0 = Debug|x64
{25C91A4E-BA4E-467A-85CD-8B62545BF674}.Debug|x86.ActiveCfg = Debug|x64
{25C91A4E-BA4E-467A-85CD-8B62545BF674}.Debug|x86.Build.0 = Debug|x64
{25C91A4E-BA4E-467A-85CD-8B62545BF674}.Release|ARM64.ActiveCfg = Release|ARM64
{25C91A4E-BA4E-467A-85CD-8B62545BF674}.Release|ARM64.Build.0 = Release|ARM64
{25C91A4E-BA4E-467A-85CD-8B62545BF674}.Release|x64.ActiveCfg = Release|x64
{25C91A4E-BA4E-467A-85CD-8B62545BF674}.Release|x64.Build.0 = Release|x64
{25C91A4E-BA4E-467A-85CD-8B62545BF674}.Release|x86.ActiveCfg = Release|x64
{25C91A4E-BA4E-467A-85CD-8B62545BF674}.Release|x86.Build.0 = Release|x64
{6AB6A2D6-F859-4A82-9184-0BD29C9F07D1}.Debug|ARM64.ActiveCfg = Debug|ARM64
{6AB6A2D6-F859-4A82-9184-0BD29C9F07D1}.Debug|ARM64.Build.0 = Debug|ARM64
{6AB6A2D6-F859-4A82-9184-0BD29C9F07D1}.Debug|x64.ActiveCfg = Debug|x64
{6AB6A2D6-F859-4A82-9184-0BD29C9F07D1}.Debug|x64.Build.0 = Debug|x64
{6AB6A2D6-F859-4A82-9184-0BD29C9F07D1}.Debug|x86.ActiveCfg = Debug|x64
{6AB6A2D6-F859-4A82-9184-0BD29C9F07D1}.Debug|x86.Build.0 = Debug|x64
{6AB6A2D6-F859-4A82-9184-0BD29C9F07D1}.Release|ARM64.ActiveCfg = Release|ARM64
{6AB6A2D6-F859-4A82-9184-0BD29C9F07D1}.Release|ARM64.Build.0 = Release|ARM64
{6AB6A2D6-F859-4A82-9184-0BD29C9F07D1}.Release|x64.ActiveCfg = Release|x64
{6AB6A2D6-F859-4A82-9184-0BD29C9F07D1}.Release|x64.Build.0 = Release|x64
{6AB6A2D6-F859-4A82-9184-0BD29C9F07D1}.Release|x86.ActiveCfg = Release|x64
{6AB6A2D6-F859-4A82-9184-0BD29C9F07D1}.Release|x86.Build.0 = Release|x64
{212AD910-8488-4036-BE20-326931B75FB2}.Debug|ARM64.ActiveCfg = Debug|ARM64
{212AD910-8488-4036-BE20-326931B75FB2}.Debug|ARM64.Build.0 = Debug|ARM64
{212AD910-8488-4036-BE20-326931B75FB2}.Debug|x64.ActiveCfg = Debug|x64
{212AD910-8488-4036-BE20-326931B75FB2}.Debug|x64.Build.0 = Debug|x64
{212AD910-8488-4036-BE20-326931B75FB2}.Debug|x86.ActiveCfg = Debug|x64
{212AD910-8488-4036-BE20-326931B75FB2}.Debug|x86.Build.0 = Debug|x64
{212AD910-8488-4036-BE20-326931B75FB2}.Release|ARM64.ActiveCfg = Release|ARM64
{212AD910-8488-4036-BE20-326931B75FB2}.Release|ARM64.Build.0 = Release|ARM64
{212AD910-8488-4036-BE20-326931B75FB2}.Release|x64.ActiveCfg = Release|x64
{212AD910-8488-4036-BE20-326931B75FB2}.Release|x64.Build.0 = Release|x64
{212AD910-8488-4036-BE20-326931B75FB2}.Release|x86.ActiveCfg = Release|x64
{212AD910-8488-4036-BE20-326931B75FB2}.Release|x86.Build.0 = Release|x64
{54A93AF7-60C7-4F6C-99D2-FBB1F75F853A}.Debug|ARM64.ActiveCfg = Debug|arm64
{54A93AF7-60C7-4F6C-99D2-FBB1F75F853A}.Debug|ARM64.Build.0 = Debug|arm64
{54A93AF7-60C7-4F6C-99D2-FBB1F75F853A}.Debug|x64.ActiveCfg = Debug|x64
{54A93AF7-60C7-4F6C-99D2-FBB1F75F853A}.Debug|x64.Build.0 = Debug|x64
{54A93AF7-60C7-4F6C-99D2-FBB1F75F853A}.Debug|x86.ActiveCfg = Debug|x64
{54A93AF7-60C7-4F6C-99D2-FBB1F75F853A}.Debug|x86.Build.0 = Debug|x64
{54A93AF7-60C7-4F6C-99D2-FBB1F75F853A}.Release|ARM64.ActiveCfg = Release|arm64
{54A93AF7-60C7-4F6C-99D2-FBB1F75F853A}.Release|ARM64.Build.0 = Release|arm64
{54A93AF7-60C7-4F6C-99D2-FBB1F75F853A}.Release|x64.ActiveCfg = Release|x64
{54A93AF7-60C7-4F6C-99D2-FBB1F75F853A}.Release|x64.Build.0 = Release|x64
{54A93AF7-60C7-4F6C-99D2-FBB1F75F853A}.Release|x86.ActiveCfg = Release|x64
{54A93AF7-60C7-4F6C-99D2-FBB1F75F853A}.Release|x86.Build.0 = Release|x64
{92C39820-9F84-4529-BC7D-22AAE514D63B}.Debug|ARM64.ActiveCfg = Debug|ARM64
{92C39820-9F84-4529-BC7D-22AAE514D63B}.Debug|ARM64.Build.0 = Debug|ARM64
{92C39820-9F84-4529-BC7D-22AAE514D63B}.Debug|x64.ActiveCfg = Debug|x64
{92C39820-9F84-4529-BC7D-22AAE514D63B}.Debug|x64.Build.0 = Debug|x64
{92C39820-9F84-4529-BC7D-22AAE514D63B}.Debug|x86.ActiveCfg = Debug|x64
{92C39820-9F84-4529-BC7D-22AAE514D63B}.Debug|x86.Build.0 = Debug|x64
{92C39820-9F84-4529-BC7D-22AAE514D63B}.Release|ARM64.ActiveCfg = Release|ARM64
{92C39820-9F84-4529-BC7D-22AAE514D63B}.Release|ARM64.Build.0 = Release|ARM64
{92C39820-9F84-4529-BC7D-22AAE514D63B}.Release|x64.ActiveCfg = Release|x64
{92C39820-9F84-4529-BC7D-22AAE514D63B}.Release|x64.Build.0 = Release|x64
{92C39820-9F84-4529-BC7D-22AAE514D63B}.Release|x86.ActiveCfg = Release|x64
{92C39820-9F84-4529-BC7D-22AAE514D63B}.Release|x86.Build.0 = Release|x64
{515554D1-D004-4F7F-A107-2211FC0F6B2C}.Debug|ARM64.ActiveCfg = Debug|arm64
{515554D1-D004-4F7F-A107-2211FC0F6B2C}.Debug|ARM64.Build.0 = Debug|arm64
{515554D1-D004-4F7F-A107-2211FC0F6B2C}.Debug|ARM64.Deploy.0 = Debug|arm64
{515554D1-D004-4F7F-A107-2211FC0F6B2C}.Debug|x64.ActiveCfg = Debug|x64
{515554D1-D004-4F7F-A107-2211FC0F6B2C}.Debug|x64.Build.0 = Debug|x64
{515554D1-D004-4F7F-A107-2211FC0F6B2C}.Debug|x64.Deploy.0 = Debug|x64
{515554D1-D004-4F7F-A107-2211FC0F6B2C}.Debug|x86.ActiveCfg = Debug|x86
{515554D1-D004-4F7F-A107-2211FC0F6B2C}.Debug|x86.Build.0 = Debug|x86
{515554D1-D004-4F7F-A107-2211FC0F6B2C}.Debug|x86.Deploy.0 = Debug|x86
{515554D1-D004-4F7F-A107-2211FC0F6B2C}.Release|ARM64.ActiveCfg = Release|arm64
{515554D1-D004-4F7F-A107-2211FC0F6B2C}.Release|ARM64.Build.0 = Release|arm64
{515554D1-D004-4F7F-A107-2211FC0F6B2C}.Release|ARM64.Deploy.0 = Release|arm64
{515554D1-D004-4F7F-A107-2211FC0F6B2C}.Release|x64.ActiveCfg = Release|x64
{515554D1-D004-4F7F-A107-2211FC0F6B2C}.Release|x64.Build.0 = Release|x64
{515554D1-D004-4F7F-A107-2211FC0F6B2C}.Release|x64.Deploy.0 = Release|x64
{515554D1-D004-4F7F-A107-2211FC0F6B2C}.Release|x86.ActiveCfg = Release|x86
{515554D1-D004-4F7F-A107-2211FC0F6B2C}.Release|x86.Build.0 = Release|x86
{515554D1-D004-4F7F-A107-2211FC0F6B2C}.Release|x86.Deploy.0 = Release|x86
{C97D9A5D-206C-454E-997E-009E227D7F02}.Debug|ARM64.ActiveCfg = Debug|ARM64
{C97D9A5D-206C-454E-997E-009E227D7F02}.Debug|ARM64.Build.0 = Debug|ARM64
{C97D9A5D-206C-454E-997E-009E227D7F02}.Debug|x64.ActiveCfg = Debug|x64
{C97D9A5D-206C-454E-997E-009E227D7F02}.Debug|x64.Build.0 = Debug|x64
{C97D9A5D-206C-454E-997E-009E227D7F02}.Debug|x86.ActiveCfg = Debug|x64
{C97D9A5D-206C-454E-997E-009E227D7F02}.Debug|x86.Build.0 = Debug|x64
{C97D9A5D-206C-454E-997E-009E227D7F02}.Release|ARM64.ActiveCfg = Release|ARM64
{C97D9A5D-206C-454E-997E-009E227D7F02}.Release|ARM64.Build.0 = Release|ARM64
{C97D9A5D-206C-454E-997E-009E227D7F02}.Release|x64.ActiveCfg = Release|x64
{C97D9A5D-206C-454E-997E-009E227D7F02}.Release|x64.Build.0 = Release|x64
{C97D9A5D-206C-454E-997E-009E227D7F02}.Release|x86.ActiveCfg = Release|x64
{C97D9A5D-206C-454E-997E-009E227D7F02}.Release|x86.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -1942,20 +1770,6 @@ Global
{5A1DB2F0-0715-4B3B-98E6-79BC41540045} = {4AFC9975-2456-4C70-94A4-84073C1CED93}
{93B72A06-C8BD-484F-A6F7-C9F280B150BF} = {6C7F47CC-2151-44A3-A546-41C70025132C}
{18B3DB45-4FFE-4D01-97D6-5223FEEE1853} = {6C7F47CC-2151-44A3-A546-41C70025132C}
{0F14491C-6369-4C45-AAA8-135814E66E6B} = {4574FDD0-F61D-4376-98BF-E5A1262C11EC}
{34A354C5-23C7-4343-916C-C52DAF4FC39D} = {0F14491C-6369-4C45-AAA8-135814E66E6B}
{7B4CDB0D-28C9-4F95-88AA-73FCC06E354C} = {0F14491C-6369-4C45-AAA8-135814E66E6B}
{3264DF53-C805-4B0C-867C-FCEAF7AEF762} = {0F14491C-6369-4C45-AAA8-135814E66E6B}
{31CAD28E-778A-441C-85BC-40AB3EAA2A10} = {0F14491C-6369-4C45-AAA8-135814E66E6B}
{A50C70A6-2DA0-4027-B90E-B1A40755A8A5} = {4574FDD0-F61D-4376-98BF-E5A1262C11EC}
{25C91A4E-BA4E-467A-85CD-8B62545BF674} = {A50C70A6-2DA0-4027-B90E-B1A40755A8A5}
{6AB6A2D6-F859-4A82-9184-0BD29C9F07D1} = {A50C70A6-2DA0-4027-B90E-B1A40755A8A5}
{212AD910-8488-4036-BE20-326931B75FB2} = {4AFC9975-2456-4C70-94A4-84073C1CED93}
{7AC943C9-52E8-44CF-9083-744D8049667B} = {4574FDD0-F61D-4376-98BF-E5A1262C11EC}
{54A93AF7-60C7-4F6C-99D2-FBB1F75F853A} = {7AC943C9-52E8-44CF-9083-744D8049667B}
{92C39820-9F84-4529-BC7D-22AAE514D63B} = {7AC943C9-52E8-44CF-9083-744D8049667B}
{515554D1-D004-4F7F-A107-2211FC0F6B2C} = {7AC943C9-52E8-44CF-9083-744D8049667B}
{C97D9A5D-206C-454E-997E-009E227D7F02} = {0F14491C-6369-4C45-AAA8-135814E66E6B}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {C3A2F9D1-7930-4EF4-A6FC-7EE0A99821D0}

167
README.md
View File

@@ -13,32 +13,31 @@
## About
Microsoft PowerToys is a set of utilities for power users to tune and streamline their Windows experience for greater productivity. For more info on [PowerToys overviews and how to use the utilities][usingPowerToys-docs-link], or any other tools and resources for [Windows development environments](https://learn.microsoft.com/windows/dev-environment/overview), head over to [learn.microsoft.com][usingPowerToys-docs-link]!
Microsoft PowerToys is a set of utilities for power users to tune and streamline their Windows experience for greater productivity. For more info on [PowerToys overviews and how to use the utilities][usingPowerToys-docs-link], or any other tools and resources for [Windows development environments](https://docs.microsoft.com/windows/dev-environment/overview), head over to [docs.microsoft.com][usingPowerToys-docs-link]!
| | Current utilities: | |
|--------------|--------------------|--------------|
| [Always on Top](https://aka.ms/PowerToysOverview_AoT) | [PowerToys Awake](https://aka.ms/PowerToysOverview_Awake) | [Color Picker](https://aka.ms/PowerToysOverview_ColorPicker) |
| [FancyZones](https://aka.ms/PowerToysOverview_FancyZones) | [File Explorer Add-ons](https://aka.ms/PowerToysOverview_FileExplorerAddOns) | [Image Resizer](https://aka.ms/PowerToysOverview_ImageResizer) |
| [Keyboard Manager](https://aka.ms/PowerToysOverview_KeyboardManager) | [Mouse utilities](https://aka.ms/PowerToysOverview_MouseUtilities) | [PowerRename](https://aka.ms/PowerToysOverview_PowerRename) |
| [PowerToys Run](https://aka.ms/PowerToysOverview_PowerToysRun) | [Quick Accent](https://aka.ms/PowerToysOverview_QuickAccent) | [Screen Ruler](https://aka.ms/PowerToysOverview_ScreenRuler) |
| [Shortcut Guide](https://aka.ms/PowerToysOverview_ShortcutGuide) | [Text Extractor](https://aka.ms/PowerToysOverview_TextExtractor) | [Video Conference Mute](https://aka.ms/PowerToysOverview_VideoConference) |
| [PowerToys Run](https://aka.ms/PowerToysOverview_PowerToysRun) | [Shortcut Guide](https://aka.ms/PowerToysOverview_ShortcutGuide) | [Video Conference Mute](https://aka.ms/PowerToysOverview_VideoConference) |
## Installing and running Microsoft PowerToys
### Requirements
- Windows 11 or Windows 10 version 2004 (code name 20H1 / build number 19041) or newer.
- Windows 11 or Windows 10 v2004 (19041) or newer.
- Our installer will install the following items:
- [.NET 6.0.8 Desktop Runtime](https://dotnet.microsoft.com/download/dotnet/6.0#runtime-desktop-6.0.8) or a newer 6.0.x runtime.
- [.NET 6.0.6 Desktop Runtime](https://dotnet.microsoft.com/download/dotnet/6.0#runtime-desktop-6.0.6) or a newer 6.0.x runtime.
- [Microsoft Edge WebView2 Runtime](https://go.microsoft.com/fwlink/p/?LinkId=2124703) bootstrapper. This will install the latest version.
- [Microsoft Visual C++ Redistributable](https://learn.microsoft.com/cpp/windows/latest-supported-vc-redist?view=msvc-170#visual-studio-2015-2017-2019-and-2022) installer. This will install one of the latest versions available.
- [Microsoft Visual C++ Redistributable](https://docs.microsoft.com/cpp/windows/latest-supported-vc-redist?view=msvc-170#visual-studio-2015-2017-2019-and-2022) installer. This will install one of the latest versions available.
### Via GitHub with EXE [Recommended]
[Microsoft PowerToys GitHub releases page][github-release-link], click on `Assets` at the bottom to show the files available in the release. Please use the appropriate the PowerToys installer that matches your machine's architecture. For most people, it is `x64`.
- **For x64 processors (most common):** [PowerToysSetup-0.62.0-x64.exe](https://github.com/microsoft/PowerToys/releases/download/v0.62.0/PowerToysSetup-0.62.0-x64.exe)
- **For ARM64 processors:** [PowerToysSetup-0.62.0-arm64.exe](https://github.com/microsoft/PowerToys/releases/download/v0.62.0/PowerToysSetup-0.62.0-arm64.exe)
- **For x64 processors (most common):** click on `PowerToysSetup-0.60.1-x64.exe`
- **For ARM64 processors:** `PowerToysSetup-0.60.1-arm64.exe`
This is our preferred method.
@@ -73,112 +72,120 @@ For guidance on developing for PowerToys, please read the [developer docs](/doc/
Our [prioritized roadmap][roadmap] of features and utilities that the core team is focusing on.
### 0.62 - August 2022 Update
### 0.60 - June 2022 Update
In this release, we focused on releasing three new PowerToys.
In this release, we focused heavily on stability and improvements. Below are some of the highlights!
**Highlights**
- New utility: Screen Ruler is a quick and easy way to measure pixels on your screen.
- New utility: Quick Accent is an easy way to write letters with accents. Thanks [@damienleroy](https://github.com/damienleroy)!
- New utility: Text Extractor works like Snipping Tool, but copies the text out of the selected region using OCR and puts it on the clipboard. Thanks [@TheJoeFin](https://github.com/TheJoeFin)!
- PowerToy Run ships with a new Plugin letting you search in past query results. Thanks [@jefflord](https://github.com/jefflord)!
- PowerRename and Image Resizer now appear on the new Windows 11 context menu.
- There's a new PowerToys Run plugin for OneNote. Thanks [@palenshus](https://github.com/palenshus)!
- FancyZones uses a new zone identification with monitor Id to increase stability and avoid zone resets.
- AlwaysOnTop now uses rounded corners for highlighting rounded windows on Windows 11.
- Added settings to PowerToys Run to better control the query results order. Thanks [@jefflord](https://github.com/jefflord)!
### Known issues
- The Text Extractor utility [fails to recognize text in some cases on ARM64 devices running Windows 10](https://github.com/microsoft/PowerToys/issues/20278).
- After installing PowerToys, [the new Windows 11 context menu entries for PowerRename and Image Resizer might not appear before a system restart](https://github.com/microsoft/PowerToys/issues/19124).
- After installing PowerToys, [the new Windows 11 context menu entries for PowerRename and Image Resizer might not appear before a system restart](https://github.com/microsoft/PowerToys/issues/19124). On some Windows 11 dev channel insider builds, the new context menu entries are not registering correctly and the classic context menu entries will be shown instead.
- There are reports of users who are [unable to open the Settings window](https://github.com/microsoft/PowerToys/issues/18015). This is being caused by incompatibilities with some applications (RTSS RivaTuner Statistics Server and MSI AfterBurner are known examples of this). If you're affected by this, please check the linked issue to verify if any of the presented solutions works for you.
### General
- Added a new utility: Screen Ruler.
- Added a new utility: Quick Accent. Thanks [@damienleroy](https://github.com/damienleroy)!
- Added a new utility: Text Extractor. Thanks [@TheJoeFin](https://github.com/TheJoeFin)!
- Upgraded the Windows App SDK runtimes to 1.1.4.
- Upgraded the Windows App SDK runtimes to 1.1.1. (This was a hotfix for 0.59)
### Always on Top
- Fixed a bug causing the border to linger when closing an Outlook popup window.
### Color Picker
- Fixed the HSB color format to correctly track HSV instead of HSL.
- Fixed an issue where the zoom factor wasn't reset when reopening the zoom window. Thanks [@FWest98](https://github.com/FWest98)!
- Added support for more diverse keyboard shortcuts with a fallback to low level keyboard hooks. Thanks [@davidegiacometti](https://github.com/davidegiacometti)!
- Added rounded corner highlights for rounded corner windows on Windows 11.
### FancyZones
- Removed the button to open Settings from the FancyZones Editor, as it was opening behind the overlay.
- Changed the Highlight distance control to a slider in the FancyZones Editor, to address accessibility issues with screen readers.
- Fixed an issue where the FancyZones Editor would duplicate or edit the wrong layout.
- Fixed an issue that caused canvas layout width/height to be changed without even opening the layout in FancyZones Editor.
- Fixed a bug where windows shown on all desktops were not working with FancyZones. (This was a hotfix for 0.59)
- When changing zone layouts, windows will match a new size/position if the option is on. (This was a hotfix for 0.59)
- Minor UI fix in FancyZones Editor. Thanks [@ZetaSp](https://github.com/ZetaSp)!
- Fixed proper canvas layout rendering in FancyZones Editor and the unscaled monitor resolution is now shown.
- Fixed an issue with transparency in certain windows causing the window to go blank.
### Image Resizer
- The Image Resizer entry is now shown in the new Windows 11 context menu.
### File explorer add-ons
- Quality of life improvements to Developer Files preview, including a progress bar while loading, performance improvements, an improved dark mode, and logs. Thanks [@Aaron-Junker](https://github.com/Aaron-Junker)!
- Fixed possible WebView related vulnerabilities in the SVG and Markdown handlers.
- Fixed some race conditions in Developer Files preview causing the loading bar to hang.
- Added localization support to the Developer Files preview messages.
- It's now possible to configure default color for Stl Thumbnails. Thanks [@pedrolamas](https://github.com/pedrolamas)!
- Added an option to format JSON and XML files before rendering. Thanks [@davidegiacometti](https://github.com/davidegiacometti)!
- Add a viewBox attribute to svg file thumbnails so that it tries to show the whole image, similar to what was done in the preview handler.
- Removed access to a remote image in the tests for markdown preview.
- Fixed flakiness in the markdown preview test suite with proper component initialization timeouts.
- Fixed the leaking WebView2 resources caused by svg thumbnails.
### Keyboard Manager
- The Editor title bar is now shown in the immersive dark mode theme. Thanks [@WilliamABradley](https://github.com/WilliamABradley)!
### Mouse utility
- The Mouse Pointer Crosshairs default activation shortcut was changed to not collide with a special character combination on some internation keyboards.
### PowerRename
- Fixed an issue that was generating a silent crash when the context menu was triggered when not selecting any file or folder. (This was a hotfix for 0.61)
- Improved performance when loading a big number of files.
- Fixed a specific case in which PowerRename tried to rename a file to an empty string.
- The UI now shows when a file can't be renamed due to its name being too long or containing invalid characters.
- Fixed the file enumeration logic to only change enumerations at the end of the file name.
- Clicking on regex/date and time cheat sheet appends that item to the selected search or replace text field.
- The PowerRename entry is now shown in the new Windows 11 context menu.
- The title bar is now shown in the immersive dark mode theme. Thanks [@WilliamABradley](https://github.com/WilliamABradley)!
### PowerToys Run
- Added a fix to the VSCodeWorkspaces plugin to better support portable installations. Thanks [@bkmeneguello](https://github.com/bkmeneguello)!
- The Folder plugin now expands `%HOMEPATH%` correctly.
- Fixed a case where a previous result was being activated when searching for new results. Added a setting to better control input throttling. Thanks [@jefflord](https://github.com/jefflord)!
- Added support for port numbers in the URI plugin. Thanks [@KohGeek](https://github.com/KohGeek)!
- Fixed query errors when the search delay option was turned off.
- New History plugin to search for old search results. Thanks [@jefflord](https://github.com/jefflord)!
- Changed the default TimeDate activation keyword to `)`, as queries starting by `(` are expected as Calculator global queries, and added information in Settings so users know that some activation keywords may conflict with normal usage of some plugins when trying to do a global query. Thanks [@htcfreek](https://github.com/htcfreek)!
- The Unit Converter plugin updated its UnitsNet dependency and now supports plural units. Thanks [@FWest98](https://github.com/FWest98)!
- Improved the validation logic in the Calculator plugin. Thanks [@htcfreek](https://github.com/htcfreek)!
### Runner
- Improved: Clean up old install folders and logs at startup. Thanks [@davidegiacometti](https://github.com/davidegiacometti)!
- A setting was added to disable and configure the input delay on searching queries. (This was a hotfix for 0.59)
- Fixed and added logs for default Web Browser detection. (This was a hotfix for 0.59)
- The Program plugin can now search .lnk shortcuts by their executable name. Thanks [@davidegiacometti](https://github.com/davidegiacometti)!
- A new plugin for OneNote was added. Thanks [@palenshus](https://github.com/palenshus)!
- Query caching and delayed execution was added to the OneNote plugin. Thanks [@palenshus](https://github.com/palenshus)!
- Quality of life fixes for the TimeZone plugin, including fixes for empty subtitles, missing time zones and results not being found when expected. Thanks [@TobiasSekan](https://github.com/TobiasSekan)!
- Calls to the obsolete WebRequest API were removed. Thanks [@davidegiacometti](https://github.com/davidegiacometti)!
- Added common names for the share settings in the Settings plugins. Thanks [@htcfreek](https://github.com/htcfreek)!
- The Calculator Mages engine was updated to 2.0.1, for higher precision. Thanks for the testing and for pushing for the changes [@htcfreek](https://github.com/htcfreek)!
- Translation fixes for the Calculator and TimeDate plugins. Thanks [@htcfreek](https://github.com/htcfreek)!
- An entry for "Search Settings" was added to the Settings plugin. Thanks [@jefflord](https://github.com/jefflord)!
- Removed uses of the deprecated BinaryFormatter, which contained vulnerabilities. Thanks [@davidegiacometti](https://github.com/davidegiacometti)!
- Added settings to better control the query results order. Thanks [@jefflord](https://github.com/jefflord)!
- The Terminal plugin now uses a better API to detect installed Terminal packages. Thanks [@htcfreek](https://github.com/htcfreek)!
### Settings
- Image and phrasing adjustments.
- Icon and image updates for the new utilities. Thanks [@niels9001](https://github.com/niels9001)!
### Shortcut Guide
- Fixed the Narrator shortcut to include the newly added Control key.
- Fixed a bug that said an update had failed, even if PowerToys was fully updated. (This was a hotfix for 0.59)
- OOBE window is resizable. (This was a hotfix for 0.59)
- OOBE can now show release notes through authenticated proxies.
- OOBE now hides the x64 and ARM64 installer hashes on the What's New page.
- Minor UI fix in the Keyboard Manager page. Thanks [@ZetaSp](https://github.com/ZetaSp)!
- Fix in internal data type of CheckBox controls. Thanks [@ghost1372](https://github.com/ghost1372)!
- The title bar is now shown in the immersive dark mode theme. Thanks [@WilliamABradley](https://github.com/WilliamABradley)!
- Fixed a crash accessing/loading the System.Management API on ARM64 versions of Windows.
### Installer
- Fixed a regression that was causing the PowerToys shortcut to be deleted on update. (This was a hotfix for 0.61)
- Updated the .NET dependency to 6.0.8.
### Documentation
- Fixed wrong links to installers in README. Thanks [@unuing](https://github.com/unuing)!
- Fixed signing of the setup custom actions dll in the new pipeline.
- The Visual C++ redistributable was updated to 14.32.31332 and fixed an installer error when a newer version was installed. Thanks [@snickler](https://github.com/snickler)!
- Updated the .NET dependency to 6.0.6.
### Development
- Removed FXCop leftovers. Thanks [@CleanCodeDeveloper](https://github.com/CleanCodeDeveloper)!
- Added version number to missing binaries and added a CI script to verify that all binaries have their version numbers set correctly.
- Updated a dependency to fix building on Visual Studio 17.3 C++ tools.
- Fixed and reactivated the CI unit tests for FancyZones.
- Cleaned up and removed dead code from PowerRename code base.
- Added a script for verifying the solution targets match the expected CPU architectures. Thanks [@snickler](https://github.com/snickler)!
- Obsolete package Castle.Core was removed. Thanks [@davidegiacometti](https://github.com/davidegiacometti)!
- Language typos were corrected across the PowerToys assets. Thanks [@pea-sys](https://github.com/pea-sys), [@eltociear](https://github.com/eltociear) and [@obairka](https://github.com/obairka)!
- Clean up of the CA1031 warning suppression. Thanks [@davidegiacometti](https://github.com/davidegiacometti)!
- Support for ARM64 binaries was added to the Microsoft Store submission task. Thanks [@azchohfi](https://github.com/azchohfi)!
- Added code for a tool to help identify monitor IDs.
- Support for ARM64 binaries was added to the winget package creation task.
- Updated the Pull Request template to better reflect project changes.
- Component Governance checks were re-activated on the new main branch.
- CI is failing to run tests calling the newer WebView 2 version, so these were disabled until a fix is found.
- Updated the tests SDK to 17.2.0.
- Nuget package versions used in the solution were consolidated.
- The CodeQL CI task was disabled in the repo, but was causing issues on forks, so it was removed.
- A specific Newtonsoft.Json version was specified in tests to avoid a vulnerability present in previous versions.
- FabricBot configurations were added to the repository.
- Added a dependabot configuration for updating GitHub actions dependencies. Thanks [@naveensrinivasan](https://github.com/naveensrinivasan)!
- Updated the check-spelling action and added quality of life fixes to the workflow. Thanks [@jsoref](https://github.com/jsoref)!
#### What is being planned for v0.63
#### What is being planned for v0.61
For [v0.63][github-next-release-work], we'll work on below:
For [v0.61][github-next-release-work], we'll work on below:
- Environment Variables Editor PowerToy
- GPO policies for PowerToys
- Screen Measure PowerToy
- Stability / bug fixes
## PowerToys Community
@@ -206,5 +213,5 @@ The application logs basic telemetry. Our Telemetry Data page (Coming Soon) has
[usingPowerToys-docs-link]: https://aka.ms/powertoys-docs
<!-- items that need to be updated release to release -->
[github-next-release-work]: https://github.com/microsoft/PowerToys/issues?q=is%3Aopen+is%3Aissue+project%3Amicrosoft%2FPowerToys%2F36
[github-current-release-work]: https://github.com/microsoft/PowerToys/issues?q=is%3Aopen+is%3Aissue+project%3Amicrosoft%2FPowerToys%2F35
[github-next-release-work]: https://github.com/microsoft/PowerToys/issues?q=is%3Aopen+is%3Aissue+project%3Amicrosoft%2FPowerToys%2F34
[github-current-release-work]: https://github.com/microsoft/PowerToys/issues?q=is%3Aopen+is%3Aissue+project%3Amicrosoft%2FPowerToys%2F33

View File

@@ -3,7 +3,7 @@
## How to use Microsoft PowerToys
For more info on [PowerToys overviews and how to use the utilities][usingPowerToys-docs-link], or any other tools and resources for [Windows development environments](https://learn.microsoft.com/windows/dev-environment/overview), head over to [learn.microsoft.com][usingPowerToys-docs-link]!
For more info on [PowerToys overviews and how to use the utilities][usingPowerToys-docs-link], or any other tools and resources for [Windows development environments](https://docs.microsoft.com/windows/dev-environment/overview), head over to [docs.microsoft.com][usingPowerToys-docs-link]!
## How to file issues and get help

View File

@@ -7,11 +7,11 @@
| powertoys-license | https://github.com/microsoft/PowerToys/blob/main/LICENSE |
| powertoys | https://github.com/microsoft/PowerToys |
| PowerToysAppCompat | https://github.com/microsoft/PowerToys/wiki/Application-Compatibility |
| powerToysCannotRemapKeys | https://learn.microsoft.com/windows/powertoys/keyboard-manager#keys-that-cannot-be-remapped |
| powerToysCannotRemapKeys | https://docs.microsoft.com/windows/powertoys/keyboard-manager#keys-that-cannot-be-remapped |
| powerToysColorPickerImageSmall | https://github.com/microsoft/PowerToys/wiki/images/overview/ColorPicker_small.png |
| powerToysColorPickerSettingImage | https://raw.githubusercontent.com/microsoft/PowerToys/main/doc/images/overview/ColorPicker_large.png |
| powertoysDetectedElevatedHelp | https://learn.microsoft.com/windows/powertoys/administrator |
| powertoys-docs | https://learn.microsoft.com/windows/powertoys |
| powertoysDetectedElevatedHelp | https://docs.microsoft.com/windows/powertoys/administrator |
| powertoys-docs | https://docs.microsoft.com/windows/powertoys/?WT.mc_id=twitter-0000-docsmsft |
| powerToysFancyZoneImageSmall | https://github.com/microsoft/PowerToys/wiki/images/overview/FancyZones_small.png |
| powerToysFancyZoneSettingImage | https://raw.githubusercontent.com/microsoft/PowerToys/main/doc/images/overview/FancyZones_large.png |
| powerToysGiveFeedback | https://github.com/microsoft/PowerToys/issues |
@@ -19,17 +19,17 @@
| powerToysImageResizerSettingImage | https://raw.githubusercontent.com/microsoft/PowerToys/main/doc/images/overview/ImageResizer_large.png |
| powerToysKBMImageSmall | https://github.com/microsoft/PowerToys/wiki/images/overview/KBM_small.png |
| powerToysKBMSettingImage | https://raw.githubusercontent.com/microsoft/PowerToys/main/doc/images/overview/KBM_large.png |
| PowerToysOverview | https://learn.microsoft.com/windows/powertoys/ |
| PowerToysOverview_ColorPicker | https://learn.microsoft.com/windows/powertoys/color-picker |
| PowerToysOverview_FancyZones | https://learn.microsoft.com/windows/powertoys/fancyzones |
| PowerToysOverview_FileExplorerAddOns | https://learn.microsoft.com/windows/powertoys/file-explorer |
| PowerToysOverview_ImageResizer | https://learn.microsoft.com/windows/powertoys/image-resizer |
| PowerToysOverview_KeyboardManager | https://learn.microsoft.com/windows/powertoys/keyboard-manager |
| PowerToysOverview_MouseUtilities | https://learn.microsoft.com/windows/powertoys/mouse-utilities |
| PowerToysOverview_PowerRename | https://learn.microsoft.com/windows/powertoys/powerrename |
| PowerToysOverview_PowerToysRun | https://learn.microsoft.com/windows/powertoys/run |
| PowerToysOverview_ShortcutGuide | https://learn.microsoft.com/windows/powertoys/shortcut-guide |
| PowerToysOverview_VideoConference | https://learn.microsoft.com/windows/powertoys/video-conference-mute |
| PowerToysOverview | https://docs.microsoft.com/windows/powertoys/ |
| PowerToysOverview_ColorPicker | https://docs.microsoft.com/windows/powertoys/color-picker |
| PowerToysOverview_FancyZones | https://docs.microsoft.com/windows/powertoys/fancyzones |
| PowerToysOverview_FileExplorerAddOns | https://docs.microsoft.com/windows/powertoys/file-explorer |
| PowerToysOverview_ImageResizer | https://docs.microsoft.com/windows/powertoys/image-resizer |
| PowerToysOverview_KeyboardManager | https://docs.microsoft.com/windows/powertoys/keyboard-manager |
| PowerToysOverview_MouseUtilities | https://docs.microsoft.com/windows/powertoys/mouse-utilities |
| PowerToysOverview_PowerRename | https://docs.microsoft.com/windows/powertoys/powerrename |
| PowerToysOverview_PowerToysRun | https://docs.microsoft.com/windows/powertoys/run |
| PowerToysOverview_ShortcutGuide | https://docs.microsoft.com/windows/powertoys/shortcut-guide |
| PowerToysOverview_VideoConference | https://docs.microsoft.com/windows/powertoys/video-conference-mute |
| powerToysPowerLauncherImageSmall | https://github.com/microsoft/PowerToys/wiki/images/overview/PowerLauncher_small.png |
| powerToysPowerLauncherSettingImage | https://raw.githubusercontent.com/microsoft/PowerToys/main/doc/images/overview/PowerLauncher_large.png |
| powerToysPowerPreviewImageSmall | https://github.com/microsoft/PowerToys/wiki/images/overview/PowerPreview_small.png |

View File

@@ -95,6 +95,6 @@ namespace
```
Note: since _background activation_ implies that your toast handler will be invoked in a separate process, you can't share data directly from within a handler and your PT process. Also, since PT is currently a Desktop Bridge app, _foreground activation_ is [handled the same as background](https://learn.microsoft.com/windows/uwp/design/shell/tiles-and-notifications/send-local-toast-desktop-cpp-wrl#foreground-vs-background-activation), therefore we don't make a dedicated API for it. You can read more on the rationale of the current design [here](https://github.com/microsoft/PowerToys/pull/1178#issue-368768337).
Note: since _background activation_ implies that your toast handler will be invoked in a separate process, you can't share data directly from within a handler and your PT process. Also, since PT is currently a Desktop Bridge app, _foreground activation_ is [handled the same as background](https://docs.microsoft.com/en-US/windows/uwp/design/shell/tiles-and-notifications/send-local-toast-desktop-cpp-wrl#foreground-vs-background-activation), therefore we don't make a dedicated API for it. You can read more on the rationale of the current design [here](https://github.com/microsoft/PowerToys/pull/1178#issue-368768337).

View File

@@ -62,8 +62,8 @@ Please review these brief docs below relating to our coding standards etc.
* [Code Organization](./readme.md)
[VS Resource Editor]: https://learn.microsoft.com/cpp/windows/resource-editors?view=vs-2019
[String Table]: https://learn.microsoft.com/windows/win32/menurc/stringtable-resource
[Resx Files VS]: https://learn.microsoft.com/dotnet/framework/resources/creating-resource-files-for-desktop-apps#resource-files-in-visual-studio
[Resx Files]: https://learn.microsoft.com/dotnet/framework/resources/creating-resource-files-for-desktop-apps#resources-in-resx-files
[Resource Manager]: https://learn.microsoft.com/dotnet/api/system.resources.resourcemanager?view=netframework-4.8
[VS Resource Editor]: https://docs.microsoft.com/en-us/cpp/windows/resource-editors?view=vs-2019
[String Table]: https://docs.microsoft.com/en-us/windows/win32/menurc/stringtable-resource
[Resx Files VS]: https://docs.microsoft.com/en-us/dotnet/framework/resources/creating-resource-files-for-desktop-apps#resource-files-in-visual-studio
[Resx Files]: https://docs.microsoft.com/en-us/dotnet/framework/resources/creating-resource-files-for-desktop-apps#resources-in-resx-files
[Resource Manager]: https://docs.microsoft.com/en-us/dotnet/api/system.resources.resourcemanager?view=netframework-4.8

View File

@@ -50,7 +50,7 @@ The rest of the steps depend on the project type and are covered in the sections
### C++
C++ projects do not support `resx` files, and instead use `rc` files along with `resource.h` files. The CDPX pipeline however doesn't support localizing `rc` files and the other alternative they support is directly translating the resources from the binary which makes it harder to maintain resources. To avoid this, a custom script has been added which expects a resx file and converts the entries to an rc file with a string table and adds resource declarations to a resource.h file so that the resources can be compiled with the C++ project.
If you already have a .rc file, copy the string table to a separate txt file and run the [convert-stringtable-to-resx.ps1](https://github.com/microsoft/PowerToys/blob/main/tools/build/convert-stringtable-to-resx.ps1) script on it. This script is not very robust to input, and requires the data in a specific format, where `IDS_ResName L"ResourceValue"` and any number of spaces can be present in between. The script converts this file to the format expected by [`resgen`](https://learn.microsoft.com/dotnet/framework/tools/resgen-exe-resource-file-generator#Convert), which will convert it to resx. The resource names are changed from all uppercase to title case, and the `IDS_` prefix is removed. Escape characters might have to be manually replaced, for example .rc files would have escaped double quotes as `""`, so this should be replaced with just `"` before converting to the resx files.
If you already have a .rc file, copy the string table to a separate txt file and run the [convert-stringtable-to-resx.ps1](https://github.com/microsoft/PowerToys/blob/main/tools/build/convert-stringtable-to-resx.ps1) script on it. This script is not very robust to input, and requires the data in a specific format, where `IDS_ResName L"ResourceValue"` and any number of spaces can be present in between. The script converts this file to the format expected by [`resgen`](https://docs.microsoft.com/en-us/dotnet/framework/tools/resgen-exe-resource-file-generator#Convert), which will convert it to resx. The resource names are changed from all uppercase to title case, and the `IDS_` prefix is removed. Escape characters might have to be manually replaced, for example .rc files would have escaped double quotes as `""`, so this should be replaced with just `"` before converting to the resx files.
After generating the resx file, rename the existing rc and h files to ProjName.base.rc and resource.base.h. In the rc file remove the string table which is to be localized and in the .h file remove all `#define`s corresponding to localized resources. In the vcxproj of the C++ project, add the following build event:
```
@@ -59,7 +59,7 @@ After generating the resx file, rename the existing rc and h files to ProjName.b
</Target>
```
This event runs a script which generates a resource.h and ProjName.rc in the `Generated Files` folder using the strings in all the resx files along with the existing information in resource.base.h and ProjName.base.rc. The script can be found [here](https://github.com/microsoft/PowerToys/blob/main/tools/build/convert-resx-to-rc.ps1). The script uses [`resgen`](https://learn.microsoft.com/dotnet/framework/tools/resgen-exe-resource-file-generator#Convert) to convert the resx file to a string table expected in the .rc file format. When the resources are added to the rc file the `IDS_` prefix is added and resource names are in upper case (as it was originally). Any occurrences of `"` in the string resource is escaped as `""` to prevent build errors. The string tables are added to the rc file in the following format:
This event runs a script which generates a resource.h and ProjName.rc in the `Generated Files` folder using the strings in all the resx files along with the existing information in resource.base.h and ProjName.base.rc. The script can be found [here](https://github.com/microsoft/PowerToys/blob/main/tools/build/convert-resx-to-rc.ps1). The script uses [`resgen`](https://docs.microsoft.com/en-us/dotnet/framework/tools/resgen-exe-resource-file-generator#Convert) to convert the resx file to a string table expected in the .rc file format. When the resources are added to the rc file the `IDS_` prefix is added and resource names are in upper case (as it was originally). Any occurrences of `"` in the string resource is escaped as `""` to prevent build errors. The string tables are added to the rc file in the following format:
```
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
@@ -88,7 +88,7 @@ Since C# projects natively support `resx` files, the only step required here is
**Note:** Building with localized resources may cause a build warning `Referenced assembly 'mscorlib.dll' targets a different processor` which is a VS bug. More details can be found [here](https://github.com/microsoft/PowerToys/issues/7269).
**Note:** If a project needs to be migrated from XAML resources to resx, the easiest way to convert the resources would be to change to format to `=` separates resources by either manually (by Ctrl+H on a text editor), or by a script, and then running [`resgen`](https://learn.microsoft.com/dotnet/framework/tools/resgen-exe-resource-file-generator#Convert) on `Developer Command Prompt for VS` to convert it to resx format.
**Note:** If a project needs to be migrated from XAML resources to resx, the easiest way to convert the resources would be to change to format to `=` separates resources by either manually (by Ctrl+H on a text editor), or by a script, and then running [`resgen`](https://docs.microsoft.com/en-us/dotnet/framework/tools/resgen-exe-resource-file-generator#Convert) on `Developer Command Prompt for VS` to convert it to resx format.
```
<system:String x:Key="wox_plugin_calculator_plugin_name">Calculator</system:String>
<system:String x:Key="wox_plugin_calculator_plugin_description">Allows to do mathematical calculations.(Try 5*3-2 in Wox)</system:String>

View File

@@ -66,15 +66,15 @@ This file contains documentation for all the methods involved in key/shortcut re
[This method](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/dll/KeyboardEventHandlers.cpp#L126-L176) was added to support a feature for converting the behavior of a key from behaving like a toggle (like Caps Lock/Num Lock) to a modifier (like Ctrl), such that when you hold Caps Lock it would behave as if Caps Lock was active, and when it was not pressed Caps Lock would be off. For Caps Lock this would be similar to behaving like Shift, but for Num Lock there is no existing key which can substitute for this. This was added while testing out remapping for the KBM PoC, but wasn't added as a feature since it wasn't a priority.
## Tests
In order to test the remapping logic, a mocked keyboard input handler had to be created because otherwise the tests would process and send actual key events. For this the [`InputInterface`](https://github.com/microsoft/PowerToys/blob/main/src/modules/keyboardmanager/common/InputInterface.h) was made, and in production code the methods are implemented using [`SendInput`](https://learn.microsoft.com/windows/win32/api/winuser/nf-winuser-sendinput) and [`GetAsyncKeyState`](https://learn.microsoft.com/windows/win32/api/winuser/nf-winuser-getasynckeystate). In addition to this, [`GetCurrentApplication`](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/common/Helpers.cpp#L226-L268) had to be mocked so that app-specific remapping can be tested.
In order to test the remapping logic, a mocked keyboard input handler had to be created because otherwise the tests would process and send actual key events. For this the [`InputInterface`](https://github.com/microsoft/PowerToys/blob/main/src/modules/keyboardmanager/common/InputInterface.h) was made, and in production code the methods are implemented using [`SendInput`](https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-sendinput) and [`GetAsyncKeyState`](https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-getasynckeystate). In addition to this, [`GetCurrentApplication`](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/common/Helpers.cpp#L226-L268) had to be mocked so that app-specific remapping can be tested.
### MockedInput
The [`MockedInput`](https://github.com/microsoft/PowerToys/blob/main/src/modules/keyboardmanager/test/MockedInput.h) class uses a 256 size `bool` vector to store the key state for each key code. Identifying the foreground process is mocked by simply setting and getting a string value for the name of the current process.
[To mock the `SendInput` method](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/test/MockedInput.cpp#L10-L110), the steps for processing the input are as follows. This implementation is based on public documentation for SendInput and the behavior of key messages and keyboard hooks:
- Iterate over all the inputs in the INPUT array argument
- If the event is a key up event, then it is considered [`WM_SYSKEYUP`](https://learn.microsoft.com/windows/win32/inputdev/wm-syskeyup) if Alt is held down, otherwise it is `WM_KEYUP`.
- If the event is a key down event, then it is considered [`WM_SYSKEYDOWN`](https://learn.microsoft.com/windows/win32/inputdev/wm-syskeydown) if either Alt is held down or if it is F10, otherwise it is `WM_KEYDOWN`.
- If the event is a key up event, then it is considered [`WM_SYSKEYUP`](https://docs.microsoft.com/en-us/windows/win32/inputdev/wm-syskeyup) if Alt is held down, otherwise it is `WM_KEYUP`.
- If the event is a key down event, then it is considered [`WM_SYSKEYDOWN`](https://docs.microsoft.com/en-us/windows/win32/inputdev/wm-syskeydown) if either Alt is held down or if it is F10, otherwise it is `WM_KEYDOWN`.
- An optional function which can be set on the `MockedInput` handler can be used to test for the number of times a key event is received by the system with a particular condition using [`sendVirtualInputCallCondition`](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/test/MockedInput.cpp#L48-L52).
- The hook logic for a low level hook which returns 0 or 1 can be set on the `MockedInput` handler such that it behaves like a low level hook would behave with actual keyboard input. If the method returns 1, then the keyboard state is not updated, and if it returns 0 the corresponding key event is used to update the key state. This works in the recursive way as well similar to low level hooks, as `SendVirtualInput` can be called from within the hook, thus simulating identical behavior to calling `SendInput` in a low level hook (as soon as SendInput is called, the low level hook is called for the new input event, and only after those are processed it returns back to the current event, check this [blog](https://devblogs.microsoft.com/oldnewthing/20140213-00/?p=1773) for more details).
- For updating the keyboard state, KEYUP messages result in the state for that key code being set to false, and KEYDOWN result in the state for that key code being set to true.

View File

@@ -27,7 +27,7 @@ The `KeyboardManager` module has [3 main class members](https://github.com/micro
- An object of type `KeyboardManagerState`. This object contains all the data related to remappings and is also used in the sense of a View Model as it used to communicate common data that is shared between the KBM UI and the backend. This class is described in more detail [here](keyboardmanagercommon.md#keyboardmanagerstate).
## Enable/Disable
On enabling KBM, the low level keyboard hook is started, and it is unhooked on disable. This is done to allow users to manually restart KBM if some other application which registers a keyboard hook was launched after PowerToys, so that it can be brought back to the highest priority hook (as the last hook to be registered receives the input first as mentioned [here](https://learn.microsoft.com/windows/win32/winmsg/about-hooks#hook-procedures)).
On enabling KBM, the low level keyboard hook is started, and it is unhooked on disable. This is done to allow users to manually restart KBM if some other application which registers a keyboard hook was launched after PowerToys, so that it can be brought back to the highest priority hook (as the last hook to be registered receives the input first as mentioned [here](https://docs.microsoft.com/en-us/windows/win32/winmsg/about-hooks#hook-procedures)).
In addition to stopping the hook, any active KBM UI windows are also closed on disabling. This is done because the KBM UI uses the same keyboard hook for the Type button where you can type a key/shortcut, so if KBM is disabled the windows would not be completely functional.
@@ -96,7 +96,7 @@ KBM uses two sets of settings files.
}
- `originalKeys` stores the key/shortcut which is to be pressed for the remap, and `newKeys` stores the key/shortcut which is to be executed.
- Both contain semi-colon separated virtual key codes. For `remapKeys`, `originalKeys` must have only one key code, whereas for `remapShortcuts` it must have at least two key codes.
- Both contain semi-colon separated virtual key codes. For `remapKeys`, `originalKeys` must have only one key code, whereas for `remapShortcuts` it must have atleast two key codes.
- `inProcess` sub-key was added in `remapKeys` because there was a possibility of adding the registry based remapping approach (used by [SharpKeys](https://github.com/randyrants/sharpkeys)), so that would be under a separate sub-key while `inProcess` would be for keyboard hook based remaps. This was deprioritized as there weren't enough requests for it.
- `remapShortcuts` is split into `global` and `appSpecific`, where `global` remaps would apply to all applications, whereas `appSpecific` would apply on when the `targetApp` is in focus. `targetApp` must be the process name of the app (with or without it's extension), e.g. `msedge` or `msedge.exe` for Microsoft Edge.
@@ -129,7 +129,7 @@ KBM uses the [`call_custom_action`](https://github.com/microsoft/PowerToys/blob/
## SendInput Special Scenarios
### Extended keys
Certain keys such as the arrow keys, <kbd>right Ctrl/Alt</kbd>, and <kbd>Del/Home/Ins</kbd>, etc need to be sent with the `KEYEVENTF_EXTENDEDKEY` flag because otherwise the NumPad versions get sent, which can cause weird behavior when NumLock is on. The code can be found [here](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/common/Helpers.cpp#L190-L194) and the list of extended keys in code can be found [here](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/common/Helpers.cpp#L73-L98). Docs about extended keys can be found [here](https://learn.microsoft.com/windows/win32/inputdev/about-keyboard-input#extended-key-flag).
Certain keys such as the arrow keys, <kbd>right Ctrl/Alt</kbd>, and <kbd>Del/Home/Ins</kbd>, etc need to be sent with the `KEYEVENTF_EXTENDEDKEY` flag because otherwise the NumPad versions get sent, which can cause weird behavior when NumLock is on. The code can be found [here](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/common/Helpers.cpp#L190-L194) and the list of extended keys in code can be found [here](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/common/Helpers.cpp#L73-L98). Docs about extended keys can be found [here](https://docs.microsoft.com/en-us/windows/win32/inputdev/about-keyboard-input#extended-key-flag).
The weird behavior that is caused by this can be found at these issues:
- https://github.com/microsoft/PowerToys/issues/3478
@@ -173,7 +173,7 @@ For example, while [remapping <kbd>Ctrl</kbd> to <kbd>Caps Lock</kbd>](https://g
While the above work around fixes most of the cases, there are still some scenarios where the modifier can get stuck, mentioned at this [comment](https://github.com/microsoft/PowerToys/issues/3397#issuecomment-663729278), which is why the issue is still open. This occurs if a modifier is pressed after the remap has been invoked before releasing the remapped key and it is a harder scenario to solve which requires refactoring the single key remap code.
### UIPI Issues (not resolved)
`SendInput` does not work directly with certain key codes such as Play/Pause Media, Calculator key, etc as it requires UAC privileges to be injected to the OS and accordingly play the active media app or launch the Calculator app. In order to resolve this the correct approach is that the executable which calls `SendInput` needs to have the [UIAccess flag](https://learn.microsoft.com/windows/win32/winauto/uiauto-securityoverview) set to true, which will also avoid the requirement of KBM having to run as administrator to intercept key events when an elevated window is in focus. The UIAccess flag has many constraints such as it must be a signed executable and must be located in a protected path like Program Files. Since KBM currently runs out of the runner process, it would make more sense to do this work after KBM is moved to a separate executable, and it could be enabled by a separate toggle in settings only if PowerToys is installed in Program Files. [This comment](https://github.com/microsoft/PowerToys/issues/3192#issuecomment-646323661) has more details on this approach and (this)[https://github.com/microsoft/PowerToys/issues/3255] is the tracking issue.
`SendInput` does not work directly with certain key codes such as Play/Pause Media, Calculator key, etc as it requires UAC privileges to be injected to the OS and accordingly play the active media app or launch the Calculator app. In order to resolve this the correct approach is that the executable which calls `SendInput` needs to have the [UIAccess flag](https://docs.microsoft.com/en-us/windows/win32/winauto/uiauto-securityoverview) set to true, which will also avoid the requirement of KBM having to run as administrator to intercept key events when an elevated window is in focus. The UIAccess flag has many constraints such as it must be a signed executable and must be located in a protected path like Program Files. Since KBM currently runs out of the runner process, it would make more sense to do this work after KBM is moved to a separate executable, and it could be enabled by a separate toggle in settings only if PowerToys is installed in Program Files. [This comment](https://github.com/microsoft/PowerToys/issues/3192#issuecomment-646323661) has more details on this approach and (this)[https://github.com/microsoft/PowerToys/issues/3255] is the tracking issue.
## Other remapping approaches
Other approaches for remapping which were deprioritized are:

View File

@@ -28,7 +28,7 @@ The windows are [created as C++ windows](https://github.com/microsoft/PowerToys/
Once the UI controls are created, the parent container is set as the content for the `DesktopWindowXamlSource` and the `XamlBridge.MessageLoop` is executed. Messages are processed by the C++ window handler like [`EditKeyboardWindowProc`](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/ui/EditKeyboardWindow.cpp#L364-L404). The general structure we use for this is, for any `WM_PAINT` or `WM_SIZE` message we resize the Xaml Island window. For `WM_GETMINMAXINFO` we set minimum widths so that the window cannot be resized beyond a minimum height and width. This is done to prevent the WinUI elements from overlapping and getting cropped. If it is neither of these cases we send the message to the [`XamlBridge.MessageHandler`](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/ui/XamlBridge.cpp#L291-L301) which handles Destroy, Activation and Focus. If `WM_NCDESTROY` is received when the `XamlBridge` is `nullptr`, the window thread is terminated.
**Note:** `ContentDialog` in Xaml Islands requires manually settings a `XamlRoot`. This can generally be done by passing the XamlRoot from a component in the main window, such as the button used to open the dialog ([`sender.as<Button>().XamlRoot()`](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/ui/ShortcutControl.cpp#L31-L32)). [These docs]((https://learn.microsoft.com/uwp/api/windows.ui.xaml.controls.contentdialog#contentdialog-in-appwindow-or-xaml-islands)) have more details about this.
**Note:** `ContentDialog` in Xaml Islands requires manually settings a `XamlRoot`. This can generally be done by passing the XamlRoot from a component in the main window, such as the button used to open the dialog ([`sender.as<Button>().XamlRoot()`](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/ui/ShortcutControl.cpp#L31-L32)). [These docs]((https://docs.microsoft.com/en-us/uwp/api/windows.ui.xaml.controls.contentdialog#contentdialog-in-appwindow-or-xaml-islands)) have more details about this.
### Debugging exceptions in XAML Islands
Sometimes if an exception occurs in XAML Islands, the stack trace may not always point to the correct code causing the exception and instead it will point to the Xaml Island message loop. In these cases the output window in VS will generally show the correct exception.

View File

@@ -1,103 +0,0 @@
# History Plugin
The History Plugin allows users to search or display results they have used (selected).
## How it works
The plugin uses data that was already being captured which is, what results were clicked, and how many times. We do add a little more data to this set now.
When this plugin is queried, it creates results based on this previously selected results data.
In order to make sure selected results in the history are still valid, we re-query the plugin the relevant plug using the PluginManager. If there are no results,
this history item is not included. This usually means that the result is no longer valid. For instance, if a file was deleted, but it's still in the selected history
we don't want to show it as a selectable result.
Because the results from the History Plugin are actually created from calls to the PluginManager, they will be exactly the same is if they did not come from the History Plugin.
## Special notes
While the results returned from the plugin are from the PluginManager, they are sometimes modified before returning. One example is the Calculator plugin.
Since the Calculator plugin operates on the current query input by the user, the results from Calculator plugin don't include that in the title. However, as a history item,
the query is very important. In this case, and maybe others in the future, we modify the tile to also include the search.
### Modified title example:
This is what the Calculator plugin normally might show:
![image](https://user-images.githubusercontent.com/4396667/184661303-4f8cf0da-2956-46b9-bdc1-ed879cd0b7cc.png)
But this is how it will look returned from the History plugin
![image](https://user-images.githubusercontent.com/4396667/184661450-9ec3c416-66df-40c8-b004-da8b0cebc5c5.png)
As you can see, here and maybe other places, other non-history plugin might be able to include extra data for the History plugin to use later.
For example, in future, plugins might be able to also set a "History Title", "History Icon", etc... But for now, it's not needed.
## Duplicates from the History Plugin in global results
If the History plugin is set to show in the global results, it might return a result that is also returned from another plugin. If a match is found,
the result from the history plugin is discarded.
## Removing items from history
A new context menu item is added to each History result, which can be used to delete it from the history.
![image](https://user-images.githubusercontent.com/4396667/184656195-6d9f1a49-652c-4027-a424-535e9fb1f2a8.png)
## Context menus
Because these results are coming from the History plugin, this plugin must invoke each menu items `LoadContextMenus` method.
We then also add the "Remove this from history" context menu action.
## Results score
When the plugin is used with the activation command, the scores are configured so the results show with the more recently selected items at the top.
If the history results are shown in the global results, the scores are not modified from that the original plugin set.
## Old Data
Items selected before this plugin was created will not show in the history because they don't contain enough data.
## Important for developers
### Important plugin values (meta-data)
| Name | Value |
| --------------- | ---------------------------------------------------- |
| ActionKeyword | `!!` |
| ExecuteFileName | `Microsoft.PowerToys.Run.Plugin.History.dll` |
| ID | `C88512156BB74580AADF7252E130BA8D` |
### Interfaces used by this plugin
The plugin uses only these interfaces (all inside the `Main.cs`):
* `Wox.Plugin.IPlugin`
* `Wox.Plugin.IContextMenu`
* `Wox.Plugin.IPluginI18n`
### Program files
| File | Content |
| ------------------------------------- | ----------------------------------------------------------------------- |
| `Images\history.dark.png` | Symbol for the results for the dark theme |
| `Images\history.light.png` | Symbol for the results for the light theme |
| `Properties\Resources.Designer.resx` | File that contain all translatable keys |
| `Properties\Resources.resx` | File that contains all translatable strings in the neutral language |
| `Main.cs` | Main class, the only place that implements the WOX interfaces |
| `ErrorHandler.cs` | Class to build error result on plugin failure |
| `plugin.json` | All meta-data for this plugin |
### Important project values (*.csproj)
| Name | Value |
| --------------- | ------------------------------------------------- |
| TargetFramework | `net6.0-windows10.0.19041.0` |
### Project dependencies
#### Projects
* `Wox.Infrastructure`
* `Wox.Plugin`
* `PowerToys.PowerLauncher`
#### Build Dependency
Access to PluginManager was needed to make this plugin work. Because of this a reference to PowerToys.PowerLauncher was needed.
Since History Plugin needs a reference to PowerToys.PowerLauncher, it can not be set as a dependency reference in PowerToys.PowerLauncher project (else a circular reference would exist).
This means that if you build PowerToys.PowerLauncher only it will not build History Plugin. You will need to manually build History Plugin at least once and again manually if you change it.
### Caching
Right now, there is no caching. But since this plugin does cause more queries than expected to many plugins, the `BuildResult` method is likely to be improved with some level of caching.

View File

@@ -33,7 +33,7 @@ The indexer plugin is used to search for files within the indexed locations of t
### Score
Each of the indexer plugin results has a score set to 0 so they are present at the bottom of the list.
[OLEDBCommand]: https://learn.microsoft.com/dotnet/api/system.data.oledb.oledbcommand?view=dotnet-plat-ext-3.1
[OLEDBConnection]: https://learn.microsoft.com/dotnet/api/system.data.oledb.oledbconnection?view=dotnet-plat-ext-3.1
[Contains]: https://learn.microsoft.com/windows/win32/search/-search-sql-contains
[Like]: https://learn.microsoft.com/windows/win32/search/-search-sql-like
[OLEDBCommand]: https://docs.microsoft.com/en-us/dotnet/api/system.data.oledb.oledbcommand?view=dotnet-plat-ext-3.1
[OLEDBConnection]: https://docs.microsoft.com/en-us/dotnet/api/system.data.oledb.oledbconnection?view=dotnet-plat-ext-3.1
[Contains]: https://docs.microsoft.com/en-us/windows/win32/search/-search-sql-contains
[Like]: https://docs.microsoft.com/en-us/windows/win32/search/-search-sql-like

View File

@@ -12,11 +12,11 @@ The registry plugin allows users to search the Windows registry.
The registry contains all settings for the Windows operating system and many settings of the installed (Windows only) programs.
*Note: Linux and macOS program ports typical store the settings in their own configuration files and not in the Windows registry.*
*Note: Linux and macOS program ports typical store the settings in it's own configuration files and not in the Windows registry.*
For more information about the Windows registry, see [the official documentation](https://learn.microsoft.com/windows/win32/sysinfo/registry).
For more information about the Windows registry, see [the official documentation](https://docs.microsoft.com/en-us/windows/win32/sysinfo/registry).
For advanced information about the Windows registry, see [Windows registry information for advanced users](https://learn.microsoft.com/troubleshoot/windows-server/performance/windows-registry-advanced-users).
For advanced information about the Windows registry, see [Windows registry information for advanced users](https://docs.microsoft.com/en-us/troubleshoot/windows-server/performance/windows-registry-advanced-users).
## Score

View File

@@ -39,7 +39,7 @@ Once you've discussed your proposed feature/fix/etc. with a team member, and you
1. Windows 10 April 2018 Update (version 1803) or newer
2. Visual Studio Community/Professional/Enterprise 2022
3. Install the [required Windows Apps SDK workloads](https://learn.microsoft.com/windows/apps/windows-app-sdk/set-up-your-development-environment?tabs=vs-2022-17-1-a%2Cvs-2022-17-1-b#required-workloads-and-components), the [Windows App SDK 1.0.3 C# Visual Studio 2022 extension](https://learn.microsoft.com/windows/apps/windows-app-sdk/downloads) and the [Windows Apps SDK 1.0.3 runtime](https://learn.microsoft.com/windows/apps/windows-app-sdk/downloads#windows-app-sdk-10).
3. Install the [required Windows Apps SDK workloads](https://docs.microsoft.com/en-us/windows/apps/windows-app-sdk/set-up-your-development-environment?tabs=vs-2022-17-1-a%2Cvs-2022-17-1-b#required-workloads-and-components), the [Windows App SDK 1.0.3 C# Visual Studio 2022 extension](https://docs.microsoft.com/en-us/windows/apps/windows-app-sdk/downloads) and the [Windows Apps SDK 1.0.3 runtime](https://docs.microsoft.com/en-us/windows/apps/windows-app-sdk/downloads#windows-app-sdk-10).
4. Once you've cloned and started the `PowerToys.sln`, in the solution explorer, if you see a dialog that says `install extra components`, click `install`
### Get Submodules to compile

View File

@@ -1,5 +1,5 @@
#### [`main.cpp`](/src/runner/main.cpp)
Contains the executable starting point, initialization code and the list of known PowerToys. All singletones are also initialized here at the start. Loads all the powertoys by scanning the `./modules` folder and `enable()`s those marked as enabled in `%LOCALAPPDATA%\Microsoft\PowerToys\settings.json` config. Then it runs [a message loop](https://learn.microsoft.com/windows/win32/winmsg/using-messages-and-message-queues) for the tray UI. Note that this message loop also [handles lowlevel_keyboard_hook events](https://github.com/microsoft/PowerToys/blob/1760af50c8803588cb575167baae0439af38a9c1/src/runner/lowlevel_keyboard_event.cpp#L24).
Contains the executable starting point, initialization code and the list of known PowerToys. All singletones are also initialized here at the start. Loads all the powertoys by scanning the `./modules` folder and `enable()`s those marked as enabled in `%LOCALAPPDATA%\Microsoft\PowerToys\settings.json` config. Then it runs [a message loop](https://docs.microsoft.com/en-us/windows/win32/winmsg/using-messages-and-message-queues) for the tray UI. Note that this message loop also [handles lowlevel_keyboard_hook events](https://github.com/microsoft/PowerToys/blob/1760af50c8803588cb575167baae0439af38a9c1/src/runner/lowlevel_keyboard_event.cpp#L24).
#### [`powertoy_module.h`](/src/runner/powertoy_module.h) and [`powertoy_module.cpp`](/src/runner/powertoy_module.cpp)
Contains code for initializing and managing the PowerToy modules. `PowertoyModule` is a RAII-style holder for the `PowertoyModuleIface` pointer, which we got by [invoking module DLL's `powertoy_create` function](https://github.com/microsoft/PowerToys/blob/1760af50c8803588cb575167baae0439af38a9c1/src/runner/powertoy_module.cpp#L13-L24).
@@ -17,7 +17,7 @@ Contains code for registering a Windows event hook through `SetWinEventHook`, th
Contains code for managing the PowerToys tray icon and its menu commands. Note that `dispatch_run_on_main_ui_thread` is used to
transfer received json message from the [Settings window](/doc/devdocs/settings.md) to the main thread, since we're communicating with it from [a dedicated thread](https://github.com/microsoft/PowerToys/blob/7357e40d3f54de51176efe54fda6d57028837b8c/src/runner/settings_window.cpp#L267-L271).
#### [`settings_window.cpp`](/src/runner/settings_window.cpp)
Contains code for starting the PowerToys settings window and communicating with it. Settings window is a separate process, so we're using [Windows pipes](https://learn.microsoft.com/windows/win32/ipc/pipes) as a transport for json messages.
Contains code for starting the PowerToys settings window and communicating with it. Settings window is a separate process, so we're using [Windows pipes](https://docs.microsoft.com/en-us/windows/win32/ipc/pipes) as a transport for json messages.
#### [`general_settings.cpp`](/src/runner/general_settings.cpp)
Contains code for loading, saving and applying the general settings.

View File

@@ -14,4 +14,4 @@ The Settings.UI.Library project contains the data that is to be rendered by the
#### [Settings Runner:](/src/settings-ui/Settings.UI)
The function of the settings runner project is to communicate all changes that the user makes in the user interface, to the runner so that it can be dispatched and reflected in all the modules.
[MVVM]: https://learn.microsoft.com/windows/uwp/data-binding/data-binding-and-mvvm
[MVVM]: https://docs.microsoft.com/en-us/windows/uwp/data-binding/data-binding-and-mvvm

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 66 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 53 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 139 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 67 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

View File

@@ -6,9 +6,13 @@
<?define BinDir="$(var.RepoDir)$(var.Platform)\$(var.Configuration)\" ?>
<?define PowerToysPlatform="x64"?>
<?define Dotnet6DownloadUrl="https://download.visualstudio.microsoft.com/download/pr/fe8415d4-8a35-4af9-80a5-51306a96282d/05f9b2a1b4884238e69468e49b3a5453/windowsdesktop-runtime-6.0.9-win-x64.exe"?>
<?define Dotnet6PayloadSize="57328120"?>
<?define Dotnet6PayloadHash="71DD37FB8A5DF79F5EEE8983D472683F5A01F73C"?>
<?define Dotnet6DownloadUrl="https://download.visualstudio.microsoft.com/download/pr/dc0e0e83-0115-4518-8b6a-590ed594f38a/65b63e41f6a80decb37fa3c5af79a53d/windowsdesktop-runtime-6.0.7-win-x64.exe"?>
<?define Dotnet6PayloadSize="57708544"?>
<?define Dotnet6PayloadHash="16DDD34B1E1AEA0D89D3B0A8786026436CD17234"?>
<?define VCRedistDownloadUrl="https://download.visualstudio.microsoft.com/download/pr/ed95ef9e-da02-4735-9064-bd1f7f69b6ed/CE6593A1520591E7DEA2B93FD03116E3FC3B3821A0525322B0A430FAA6B3C0B4/VC_redist.x64.exe"?>
<?define VCRedistPayloadSize="25234792"?>
<?define VCRedistPayloadHash="D4F9181E70E3F1AA6C8EDFFCC15B3C3D4BABE36B"?>
<?define PlatformProgramFiles="[ProgramFiles64Folder]"?>
<?else?>
@@ -16,10 +20,14 @@
<?define BinDir="$(var.RepoDir)ARM64\$(var.Configuration)\" ?>
<?define PowerToysPlatform="ARM64"?>
<?define Dotnet6DownloadUrl="https://download.visualstudio.microsoft.com/download/pr/e207429e-4cdc-43ed-868e-aeecbd1ae9d0/d32e40bb2385e7407ea235dc5541ef29/windowsdesktop-runtime-6.0.9-win-arm64.exe"?>
<?define Dotnet6PayloadSize="51262992"?>
<?define Dotnet6PayloadHash="57E51507E21B3665EF2AA8FCA77A6DDED1374837"?>
<?define Dotnet6DownloadUrl="https://download.visualstudio.microsoft.com/download/pr/f33cf7ce-bf03-428c-8aa7-e32ef6d7ddc6/e61dc60fce686844c41ec2901ad5b01e/windowsdesktop-runtime-6.0.7-win-arm64.exe"?>
<?define Dotnet6PayloadSize="51539968"?>
<?define Dotnet6PayloadHash="F98232B9B572848B8425462F9458E92710BBF55F"?>
<?define VCRedistDownloadUrl="https://download.visualstudio.microsoft.com/download/pr/ed95ef9e-da02-4735-9064-bd1f7f69b6ed/8E126191012691AE22A0D5A89FAC01B59BABC7B680E5D9B65828935FD366E375/VC_redist.arm64.exe"?>
<?define VCRedistPayloadSize="11500416"?>
<?define VCRedistPayloadHash="FEECAC80EF04125B058381487332872896F38477"?>
<!--TODO: define to ARM64 Program files once it's available-->
<?define PlatformProgramFiles="[ProgramFiles6432Folder]"?>
@@ -41,7 +49,7 @@
SuppressRepair="yes" />
</BootstrapperApplicationRef>
<util:FileSearch Variable="HasDotnet609" Path="$(var.PlatformProgramFiles)dotnet\shared\Microsoft.WindowsDesktop.App\6.0.9\System.Xaml.dll" Result="exists" />
<util:FileSearch Variable="HasDotnet607" Path="$(var.PlatformProgramFiles)dotnet\shared\Microsoft.WindowsDesktop.App\6.0.7\System.Xaml.dll" Result="exists" />
<util:RegistrySearch Variable="HasWebView2PerMachine" Root="HKLM" Key="SOFTWARE\WOW6432Node\Microsoft\EdgeUpdate\Clients\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}" Result="exists" />
<util:RegistrySearch Variable="HasWebView2PerUser" Root="HKCU" Key="Software\Microsoft\EdgeUpdate\Clients\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}" Result="exists" />
@@ -61,24 +69,14 @@
<util:RegistrySearch Id="SearchWindowsBuildNumber" Root="HKLM" Key="SOFTWARE\Microsoft\Windows NT\CurrentVersion" Value="CurrentBuildNumber" Result="value" Format="raw" Variable="DetectedWindowsBuildNumber" />
<bal:Condition Message="This application is only supported on Windows 10 version v2004 (build 19041) or higher.">DetectedWindowsBuildNumber &gt;= 19041 OR WixBundleInstalled</bal:Condition>
<util:RegistrySearch Variable="DetectedVCRedistVersion" Root="HKLM" Key="Software\Microsoft\VisualStudio\14.0\VC\Runtimes\$(var.PowerToysPlatform)" Value="Minor" Result="value" Format="raw" />
<Chain>
<ExePackage
DisplayName="Closing PowerToys application"
Name="terminate_powertoys.cmd"
Cache="no"
Compressed="yes"
Id="TerminatePowerToys"
SourceFile="terminate_powertoys.cmd"
Permanent="yes"
PerMachine="yes"
Vital="no">
</ExePackage>
<ExePackage
DisplayName="Downloading and installing .NET 6 Desktop Runtime"
Name="windowsdesktop-runtime-6.0.9-win-$(var.PowerToysPlatform).exe"
Name="windowsdesktop-runtime-6.0.7-win-$(var.PowerToysPlatform).exe"
Compressed="no"
Id="DotnetRuntime6"
DetectCondition="HasDotnet609"
DetectCondition="HasDotnet607"
DownloadUrl="$(var.Dotnet6DownloadUrl)"
InstallCommand="/install /quiet /norestart"
RepairCommand="/repair /passive /norestart"
@@ -87,14 +85,13 @@
UninstallCommand="/uninstall /quiet /norestart">
<ExitCode Value="1638" Behavior="success"/>
<RemotePayload
Description="Microsoft Windows Desktop Runtime - 6.0.9 ($(var.PowerToysPlatform))"
ProductName="Microsoft Windows Desktop Runtime - 6.0.9 ($(var.PowerToysPlatform))"
Description="Microsoft Windows Desktop Runtime - 6.0.7 ($(var.PowerToysPlatform))"
ProductName="Microsoft Windows Desktop Runtime - 6.0.7 ($(var.PowerToysPlatform))"
Size="$(var.Dotnet6PayloadSize)"
Version="6.0.9.31620"
Version="6.0.7.31422"
Hash="$(var.Dotnet6PayloadHash)" />
</ExePackage>
<ExePackage
DisplayName="Installing Microsoft Edge WebView2"
Name="MicrosoftEdgeWebview2Setup.exe"
Compressed="yes"
Id="WebView2"
@@ -106,8 +103,24 @@
PerMachine="yes"
UninstallCommand="/silent /uninstall">
</ExePackage>
<ExePackage
Name="VCRedist-14.32.31332.exe"
DetectCondition="DetectedVCRedistVersion >= 32"
Compressed="no"
Id="VCRedist"
DownloadUrl="$(var.VCRedistDownloadUrl)"
InstallCommand="/install /quiet /norestart"
RepairCommand="/repair /quiet /norestart"
Permanent="yes">
<ExitCode Value="1638" Behavior="success"/>
<RemotePayload
Description="Microsoft Visual C++ 2015-2022 Redistributable ($(var.PowerToysPlatform)) - 14.32.31332"
ProductName="Microsoft Visual C++ 2015-2022 Redistributable ($(var.PowerToysPlatform)) - 14.32.31332"
Size="$(var.VCRedistPayloadSize)"
Version="14.32.31332.0"
Hash="$(var.VCRedistPayloadHash)" />
</ExePackage>
<MsiPackage
DisplayName="Installing PowerToys"
SourceFile="$(var.PowerToysPlatform)\Release\PowerToysSetup-$(var.Version)-$(var.PowerToysPlatform).msi"
Compressed="yes"
DisplayInternalUI="no">

View File

@@ -6,15 +6,12 @@
<?define FancyZonesProjectName="FancyZones"?>
<?define ImageResizerProjectName="ImageResizer"?>
<?define KeyboardManagerProjectName="KeyboardManager"?>
<?define PowerAccentProjectName="PowerAccent"?>
<?define PowerRenameProjectName="PowerRename"?>
<?define ColorPickerProjectName="ColorPicker"?>
<?define PowerOCRProjectName="PowerOCR"?>
<?define VideoConferenceProjectName="VideoConference"?>
<?define AwakeProjectName="Awake"?>
<?define MouseUtilsProjectName="MouseUtils"?>
<?define AlwaysOnTopProjectName="AlwaysOnTop"?>
<?define MeasureToolProjectName="MeasureTool"?>
<?define RepoDir="$(var.ProjectDir)..\..\" ?>
<?if $(var.Platform) = x64?>
@@ -43,19 +40,19 @@
-->
<?define ShortcutGuideSvgsFiles=0.svg;1.svg;2.svg;3.svg;4.svg;5.svg;6.svg;7.svg;8.svg;9.svg;no_active_window.svg;overlay.svg;overlay_portrait.svg?>
<?define FancyZonesFiles=PowerToys.FancyZonesModuleInterface.dll;PowerToys.FancyZonesEditor.dll;PowerToys.FancyZonesEditor.runtimeconfig.json;PowerToys.FancyZonesEditor.deps.json;PowerToys.FancyZonesEditor.exe;PowerToys.FancyZones.exe;ControlzEx.dll;Microsoft.Xaml.Behaviors.dll;ModernWpf.dll;ModernWpf.Controls.dll;System.Text.Json.dll;PowerToys.ManagedCommon.dll;System.Management.dll;PowerToys.Common.UI.dll;PowerToys.ManagedTelemetry.dll;System.IO.Abstractions.dll;Microsoft.Windows.SDK.NET.dll;WinRT.Runtime.dll;Ijwhost.dll?>
<?define FancyZonesFiles=PowerToys.FancyZonesModuleInterface.dll;PowerToys.FancyZonesEditor.dll;PowerToys.FancyZonesEditor.runtimeconfig.json;PowerToys.FancyZonesEditor.deps.json;PowerToys.FancyZonesEditor.exe;PowerToys.FancyZones.exe;ControlzEx.dll;Microsoft.Xaml.Behaviors.dll;ModernWpf.dll;ModernWpf.Controls.dll;System.Text.Json.dll;PowerToys.Interop.dll;PowerToys.ManagedCommon.dll;System.Management.dll;PowerToys.Common.UI.dll;PowerToys.ManagedTelemetry.dll;System.IO.Abstractions.dll;Microsoft.Windows.SDK.NET.dll;WinRT.Runtime.dll;Ijwhost.dll?>
<?define ImageResizerFiles=ImageResizer.ico;PowerToys.ImageResizer.exe;PowerToys.ImageResizerExt.dll;PowerToys.ImageResizer.dll;PowerToys.ImageResizer.deps.json;PowerToys.ImageResizer.runtimeconfig.json;PowerToys.ManagedCommon.dll;System.Management.dll;PowerToys.ManagedTelemetry.dll;PowerToys.Common.UI.dll;ControlzEx.dll;ModernWpf.Controls.dll;ModernWpf.dll;System.Text.Json.dll;Microsoft.Xaml.Behaviors.dll;System.IO.Abstractions.dll;WinRT.Runtime.dll;Microsoft.Windows.SDK.NET.dll;Ijwhost.dll;ImageResizerContextMenuPackage.msix;PowerToys.ImageResizerContextMenu.dll ?>
<?define ImageResizerFiles=ImageResizer.ico;PowerToys.ImageResizer.exe;PowerToys.ImageResizerExt.dll;PowerToys.ImageResizer.dll;PowerToys.ImageResizer.deps.json;PowerToys.ImageResizer.runtimeconfig.json;PowerToys.ManagedCommon.dll;System.Management.dll;PowerToys.ManagedTelemetry.dll;PowerToys.Common.UI.dll;ControlzEx.dll;ModernWpf.Controls.dll;ModernWpf.dll;System.Text.Json.dll;Microsoft.Xaml.Behaviors.dll;PowerToys.Interop.dll;System.IO.Abstractions.dll;WinRT.Runtime.dll;Microsoft.Windows.SDK.NET.dll;Ijwhost.dll;ImageResizerContextMenuPackage.msix;PowerToys.ImageResizerContextMenu.dll ?>
<?define PowerPreviewFiles=PowerToys.powerpreview.dll;PowerToys.PreviewHandlerCommon.dll;PowerToys.PreviewHandlerCommon.deps.json;PowerToys.ManagedCommon.dll;System.Management.dll;PowerToys.ManagedTelemetry.dll;PowerToys.SvgPreviewHandler.dll;PowerToys.SvgPreviewHandler.comhost.dll;PowerToys.SvgPreviewHandler.runtimeconfig.json;PowerToys.SvgPreviewHandler.deps.json;PowerToys.SvgThumbnailProvider.dll;PowerToys.SvgThumbnailProvider.comhost.dll;PowerToys.SvgThumbnailProvider.runtimeconfig.json;PowerToys.SvgThumbnailProvider.deps.json;PowerToys.MarkdownPreviewHandler.dll;PowerToys.MarkdownPreviewHandler.comhost.dll;PowerToys.MarkdownPreviewHandler.runtimeconfig.json;PowerToys.MarkdownPreviewHandler.deps.json;Markdig.Signed.dll;HtmlAgilityPack.dll;System.IO.Abstractions.dll;monaco_languages.json;monacoSpecialLanguages.js;PowerToys.Common.UI.dll;PowerToys.Settings.UI.Lib.dll;PowerToys.MonacoPreviewHandler.dll;PowerToys.MonacoPreviewHandler.comhost.dll;PowerToys.MonacoPreviewHandler.runtimeconfig.json;PowerToys.MonacoPreviewHandler.deps.json;ControlzEx.dll;Microsoft.Web.WebView2.Core.dll;Microsoft.Web.WebView2.WinForms.dll;Microsoft.Web.WebView2.Wpf.dll;WebView2Loader.dll;System.Runtime.WindowsRuntime.dll;index.html;PowerToys.PdfPreviewHandler.dll;PowerToys.PdfPreviewHandler.comhost.dll;PowerToys.PdfPreviewHandler.runtimeconfig.json;PowerToys.PdfPreviewHandler.deps.json;Microsoft.Windows.SDK.NET.dll;WinRT.Runtime.dll;PowerToys.PdfThumbnailProvider.dll;PowerToys.PdfThumbnailProvider.comhost.dll;PowerToys.PdfThumbnailProvider.runtimeconfig.json;PowerToys.PdfThumbnailProvider.deps.json;PowerToys.GcodePreviewHandler.dll;PowerToys.GcodePreviewHandler.comhost.dll;PowerToys.GcodePreviewHandler.runtimeconfig.json;PowerToys.GcodePreviewHandler.deps.json;PowerToys.GcodeThumbnailProvider.dll;PowerToys.GcodeThumbnailProvider.comhost.dll;PowerToys.GcodeThumbnailProvider.runtimeconfig.json;PowerToys.GcodeThumbnailProvider.deps.json;PowerToys.StlThumbnailProvider.dll;PowerToys.StlThumbnailProvider.comhost.dll;PowerToys.StlThumbnailProvider.runtimeconfig.json;PowerToys.StlThumbnailProvider.deps.json;HelixToolkit.dll;HelixToolkit.Core.Wpf.dll;Ijwhost.dll;Microsoft.Xaml.Behaviors.dll;System.Text.Json.dll?>
<?define SettingsV2Files=Ijwhost.dll;ColorCode.Core.dll;ColorCode.WinUI.dll;CommunityToolkit.Common.dll;CommunityToolkit.WinUI.dll;CommunityToolkit.WinUI.UI.Controls.Core.dll;CommunityToolkit.WinUI.UI.Controls.DataGrid.dll;CommunityToolkit.WinUI.UI.Controls.Input.dll;CommunityToolkit.WinUI.UI.Controls.Layout.dll;CommunityToolkit.WinUI.UI.Controls.Markdown.dll;CommunityToolkit.WinUI.UI.Controls.Media.dll;CommunityToolkit.WinUI.UI.Controls.Primitives.dll;CommunityToolkit.WinUI.UI.dll;icon.ico;Microsoft.Graphics.Canvas.Interop.dll;Microsoft.InteractiveExperiences.Projection.dll;Microsoft.Windows.ApplicationModel.DynamicDependency.Projection.dll;Microsoft.Windows.ApplicationModel.Resources.Projection.dll;Microsoft.Windows.ApplicationModel.WindowsAppRuntime.Projection.dll;Microsoft.Windows.AppLifecycle.Projection.dll;Microsoft.Windows.SDK.NET.dll;Microsoft.Windows.System.Power.Projection.dll;Microsoft.WindowsAppRuntime.Bootstrap.Net.dll;Microsoft.WinUI.dll;Microsoft.Xaml.Interactions.dll;Microsoft.Xaml.Interactivity.dll;PowerToys.ManagedCommon.dll;PowerToys.ManagedTelemetry.dll;PowerToys.Settings.deps.json;PowerToys.Settings.dll;PowerToys.Settings.exe;PowerToys.Settings.runtimeconfig.json;PowerToys.Settings.UI.Lib.dll;resources.pri;System.CodeDom.dll;System.IO.Abstractions.dll;System.Text.Json.dll;WinRT.Runtime.dll;Microsoft.Graphics.Canvas.dll?>
<?define SettingsV2Files=Ijwhost.dll;ColorCode.Core.dll;ColorCode.WinUI.dll;CommunityToolkit.Common.dll;CommunityToolkit.WinUI.dll;CommunityToolkit.WinUI.UI.Controls.Core.dll;CommunityToolkit.WinUI.UI.Controls.DataGrid.dll;CommunityToolkit.WinUI.UI.Controls.Input.dll;CommunityToolkit.WinUI.UI.Controls.Layout.dll;CommunityToolkit.WinUI.UI.Controls.Markdown.dll;CommunityToolkit.WinUI.UI.Controls.Media.dll;CommunityToolkit.WinUI.UI.Controls.Primitives.dll;CommunityToolkit.WinUI.UI.dll;icon.ico;Microsoft.Graphics.Canvas.Interop.dll;Microsoft.InteractiveExperiences.Projection.dll;Microsoft.Windows.ApplicationModel.DynamicDependency.Projection.dll;Microsoft.Windows.ApplicationModel.Resources.Projection.dll;Microsoft.Windows.ApplicationModel.WindowsAppRuntime.Projection.dll;Microsoft.Windows.AppLifecycle.Projection.dll;Microsoft.Windows.SDK.NET.dll;Microsoft.Windows.System.Power.Projection.dll;Microsoft.WindowsAppRuntime.Bootstrap.Net.dll;Microsoft.WinUI.dll;Microsoft.Xaml.Interactions.dll;Microsoft.Xaml.Interactivity.dll;PowerToys.Interop.dll;PowerToys.ManagedCommon.dll;System.Management.dll;PowerToys.ManagedTelemetry.dll;PowerToys.Settings.deps.json;PowerToys.Settings.dll;PowerToys.Settings.exe;PowerToys.Settings.runtimeconfig.json;PowerToys.Settings.UI.Lib.dll;resources.pri;System.IO.Abstractions.dll;System.Text.Json.dll;WinRT.Runtime.dll;Microsoft.Graphics.Canvas.dll;Microsoft.WindowsAppRuntime.Bootstrap.dll;CoreMessagingXP.dll;dcompi.dll;dwmcorei.dll;DwmSceneI.dll;DWriteCore.dll;marshal.dll;Microsoft.DirectManipulation.dll;Microsoft.InputStateManager.dll;Microsoft.Internal.FrameworkUdk.dll;Microsoft.UI.Composition.OSSupport.dll;Microsoft.UI.Input.dll;Microsoft.UI.Windowing.Core.dll;Microsoft.UI.Xaml.Controls.dll;Microsoft.UI.Xaml.Controls.pri;Microsoft.ui.xaml.dll;Microsoft.UI.Xaml.Internal.dll;Microsoft.UI.Xaml.Phone.dll;Microsoft.ui.xaml.resources.19h1.dll;Microsoft.ui.xaml.resources.common.dll;Microsoft.Web.WebView2.Core.dll;Microsoft.Windows.ApplicationModel.Resources.dll;Microsoft.Windows.AppNotifications.Projection.dll;Microsoft.Windows.PushNotifications.Projection.dll;Microsoft.Windows.System.Projection.dll;Microsoft.WindowsAppRuntime.dll;Microsoft.WindowsAppRuntime.Insights.Resource.dll;Microsoft.WindowsAppRuntime.Release.Net.dll;MRM.dll;PushNotificationsLongRunningTask.ProxyStub.dll;WindowsAppRuntime.png;WindowsAppSdk.AppxDeploymentExtensions.Desktop.dll;WinUIEdit.dll;wuceffectsi.dll?>
<?define SettingsV2AssetsModulesFiles=ColorPicker.png;FancyZones.png;AlwaysOnTop.png;Awake.png;ImageResizer.png;KBM.png;MouseUtils.png;PowerAccent.png;PowerOCR.png;PowerLauncher.png;PowerPreview.png;PowerRename.png;PT.png;ScreenRuler.png;ShortcutGuide.png;VideoConference.png?>
<?define SettingsV2AssetsModulesFiles=ColorPicker.png;FancyZones.png;AlwaysOnTop.png;Awake.png;ImageResizer.png;KBM.png;MouseUtils.png;PowerLauncher.png;PowerPreview.png;PowerRename.png;PT.png;ShortcutGuide.png;VideoConference.png?>
<?define SettingsV2OOBEAssetsModulesFiles=ColorPicker.gif;AlwaysOnTop.png;Awake.png;FancyZones.gif;FileExplorer.png;ImageResizer.gif;KBM.gif;MouseUtils.gif;PowerAccent.gif;PowerOCR.gif;PowerRename.gif;Run.gif;ScreenRuler.gif;OOBEShortcutGuide.png;VideoConferenceMute.png;OOBEPTHero.png?>
<?define SettingsV2OOBEAssetsModulesFiles=ColorPicker.gif;AlwaysOnTop.png;Awake.png;FancyZones.gif;FileExplorer.png;ImageResizer.gif;KBM.gif;MouseUtils.gif;PowerRename.gif;Run.gif;OOBEShortcutGuide.png;VideoConferenceMute.png;OOBEPTHero.png?>
<?define SettingsV2OOBEAssetsFluentIconsFiles=ColorPicker.png;FancyZones.png;AlwaysOnTop.png;Awake.png;FileExplorerPreview.png;FindMyMouse.png;ImageResizer.png;KeyboardManager.png;MouseHighlighter.png;MouseCrosshairs.png;MouseUtils.png;PowerAccent.png;PowerOcr.png;PowerRename.png;PowerToys.png;PowerToysRun.png;ScreenRuler.png;Settings.png;ShortcutGuide.png;VideoConferenceMute.png?>
<?define SettingsV2OOBEAssetsFluentIconsFiles=ColorPicker.png;FancyZones.png;AlwaysOnTop.png;Awake.png;FileExplorerPreview.png;FindMyMouse.png;ImageResizer.png;KeyboardManager.png;MouseHighlighter.png;MouseCrosshairs.png;MouseUtils.png;PowerRename.png;PowerToys.png;PowerToysRun.png;Settings.png;ShortcutGuide.png;VideoConferenceMute.png?>
<?define SettingsV2MicrosoftUIXamlAssetsInstallFiles=NoiseAsset_256x256_PNG.png?>
@@ -73,8 +70,6 @@
<?define ShellComponentFiles=plugin.json;Microsoft.Plugin.Shell.deps.json;Microsoft.Plugin.Shell.dll;PowerToys.ManagedTelemetry.dll?>
<?define HistoryPluginComponentFiles=plugin.json;Microsoft.PowerToys.Run.Plugin.History.deps.json;Microsoft.PowerToys.Run.Plugin.History.dll?>
<?define ShellImagesComponentFiles=shell.light.png;shell.dark.png;user.light.png;user.dark.png?>
<?define IndexerComponentFiles=Microsoft.Plugin.Indexer.deps.json;Microsoft.Plugin.Indexer.dll;plugin.json;PowerToys.ManagedTelemetry.dll;Ijwhost.dll?>
@@ -113,24 +108,14 @@
<?define WinTermCmpFiles=plugin.json;Microsoft.PowerToys.Run.Plugin.WindowsTerminal.deps.json;Microsoft.PowerToys.Run.Plugin.WindowsTerminal.dll;PowerToys.ManagedTelemetry.dll?>
<?define PowerRenameFiles=PowerRenameUI.ico;PowerToys.PowerRename.exe;resources.pri;PowerToys.PowerRenameExt.dll?>
<?define PowerRenameFiles=PowerRenameUI.ico;Microsoft.WindowsAppRuntime.Bootstrap.dll;PowerToys.PowerRename.exe;resources.pri;PowerToys.PowerRenameExt.dll;CoreMessagingXP.dll;dcompi.dll;dwmcorei.dll;DwmSceneI.dll;DWriteCore.dll;marshal.dll;Microsoft.DirectManipulation.dll;Microsoft.InputStateManager.dll;Microsoft.Internal.FrameworkUdk.dll;Microsoft.UI.Composition.OSSupport.dll;Microsoft.UI.Input.dll;Microsoft.UI.Windowing.Core.dll;Microsoft.UI.Xaml.Controls.dll;Microsoft.UI.Xaml.Controls.pri;Microsoft.ui.xaml.dll;Microsoft.UI.Xaml.Internal.dll;Microsoft.UI.Xaml.Phone.dll;Microsoft.ui.xaml.resources.19h1.dll;Microsoft.ui.xaml.resources.common.dll;Microsoft.Web.WebView2.Core.dll;Microsoft.Windows.ApplicationModel.Resources.dll;Microsoft.WindowsAppRuntime.dll;Microsoft.WindowsAppRuntime.Insights.Resource.dll;Microsoft.WindowsAppRuntime.Release.Net.dll;MRM.dll;PushNotificationsLongRunningTask.ProxyStub.dll;WindowsAppRuntime.png;WindowsAppSdk.AppxDeploymentExtensions.Desktop.dll;WinUIEdit.dll;wuceffectsi.dll;PowerRenameContextMenuPackage.msix;PowerToys.PowerRenameContextMenu.dll?>
<?define PowerRenameSparsePackageAssets=LargeTile.png;SmallTile.png;SplashScreen.png;Square150x150Logo.png;Square44x44Logo.png;storelogo.png;Wide310x150Logo.png?>
<?define ImageResizerSparsePackageAssets=LargeTile.png;SmallTile.png;SplashScreen.png;Square150x150Logo.png;Square44x44Logo.png;storelogo.png;Wide310x150Logo.png?>
<?define MeasureToolFiles=Ijwhost.dll;Microsoft.InteractiveExperiences.Projection.dll;Microsoft.Windows.ApplicationModel.DynamicDependency.Projection.dll;Microsoft.Windows.ApplicationModel.Resources.Projection.dll;Microsoft.Windows.ApplicationModel.WindowsAppRuntime.Projection.dll;Microsoft.Windows.AppLifecycle.Projection.dll;Microsoft.Windows.SDK.NET.dll;Microsoft.Windows.System.Power.Projection.dll;Microsoft.WindowsAppRuntime.Bootstrap.Net.dll;Microsoft.WinUI.dll;PowerToys.ManagedCommon.dll;PowerToys.ManagedTelemetry.dll;PowerToys.MeasureToolCore.dll;PowerToys.MeasureToolUI.deps.json;PowerToys.MeasureToolUI.dll;PowerToys.MeasureToolUI.exe;PowerToys.MeasureToolUI.runtimeconfig.json;resources.pri;System.CodeDom.dll;System.Management.dll;WinRT.Runtime.dll;WinUIEx.dll?>
<?define PowerRenameMicrosoftUIXamlAssetsInstallFiles=NoiseAsset_256x256_PNG.png?>
<?define WinAppSDKFiles=CoreMessagingXP.dll;DWriteCore.dll;DwmSceneI.dll;MRM.dll;Microsoft.DirectManipulation.dll;Microsoft.InputStateManager.dll;Microsoft.Internal.FrameworkUdk.dll;Microsoft.UI.Composition.OSSupport.dll;Microsoft.UI.Input.dll;Microsoft.UI.Windowing.Core.dll;Microsoft.UI.Xaml.Controls.dll;Microsoft.UI.Xaml.Controls.pri;Microsoft.UI.Xaml.Internal.dll;Microsoft.UI.Xaml.Phone.dll;Microsoft.Web.WebView2.Core.dll;Microsoft.Windows.AppNotifications.Projection.dll;Microsoft.Windows.ApplicationModel.Resources.dll;Microsoft.WindowsAppRuntime.Bootstrap.dll;Microsoft.Windows.PushNotifications.Projection.dll;Microsoft.Windows.System.Projection.dll;Microsoft.WindowsAppRuntime.Insights.Resource.dll;Microsoft.WindowsAppRuntime.Release.Net.dll;Microsoft.WindowsAppRuntime.dll;Microsoft.ui.xaml.dll;Microsoft.ui.xaml.resources.19h1.dll;Microsoft.ui.xaml.resources.common.dll;PushNotificationsLongRunningTask.ProxyStub.dll;WinUIEdit.dll;WindowsAppRuntime.png;WindowsAppSdk.AppxDeploymentExtensions.Desktop.dll;dcompi.dll;dwmcorei.dll;marshal.dll;wuceffectsi.dll?>
<?define PowerToysInteropFiles=concrt140.dll;msvcp140.dll;msvcp140_1.dll;msvcp140_2.dll;msvcp140_atomic_wait.dll;msvcp140_codecvt_ids.dll;PowerToys.Interop.dll;vcamp140.dll;vccorlib140.dll;vcomp140.dll;vcruntime140.dll;vcruntime140_1.dll?>
<?define MeasureToolMicrosoftUIXamlAssetsInstallFiles=NoiseAsset_256x256_PNG.png?>
<?define PowerAccentFiles=ControlzEx.dll;GongSolutions.WPF.DragDrop.dll;Ijwhost.dll;MahApps.Metro.dll;Microsoft.Xaml.Behaviors.dll;PowerAccent.Core.dll;PowerAccent.deps.json;PowerAccent.dll;PowerAccent.exe;PowerAccent.runtimeconfig.json;PowerToys.PowerAccentModuleInterface.dll;PowerToys.ManagedCommon.dll;PowerToys.ManagedTelemetry.dll;PowerToys.PowerAccent.deps.json;PowerToys.PowerAccent.dll;PowerToys.PowerAccent.exe;PowerToys.PowerAccent.runtimeconfig.json;PowerToys.Settings.UI.Lib.dll;System.IO.Abstractions.dll;System.Management.dll;System.Text.Json.dll;Vanara.Core.dll;Vanara.PInvoke.ComCtl32.dll;Vanara.PInvoke.Cryptography.dll;Vanara.PInvoke.Gdi32.dll;Vanara.PInvoke.Kernel32.dll;Vanara.PInvoke.Ole.dll;Vanara.PInvoke.Rpc.dll;Vanara.PInvoke.Security.dll;Vanara.PInvoke.Shared.dll;Vanara.PInvoke.Shell32.dll;Vanara.PInvoke.ShlwApi.dll;Vanara.PInvoke.User32.dll;PowerToys.PowerAccentKeyboardService.dll;Microsoft.Windows.SDK.NET.dll;WinRT.Runtime.dll?>
<Product Id="*"
Name="PowerToys (Preview)"
Language="1033"
@@ -224,22 +209,12 @@
<Custom Action="SetRegisterPowerToysSchTaskParam" Before="RegisterPowerToysSchTask" />
<Custom Action="SetApplyModulesRegistryChangeSetsParam" Before="ApplyModulesRegistryChangeSets" />
<Custom Action="SetUnApplyModulesRegistryChangeSetsParam" Before="UnApplyModulesRegistryChangeSets" />
<Custom Action="SetCreateWinAppSDKHardlinksParam" Before="CreateWinAppSDKHardlinks" />
<Custom Action="SetDeleteWinAppSDKHardlinksParam" Before="DeleteWinAppSDKHardlinks" />
<Custom Action="SetCreatePTInteropHardlinksParam" Before="CreatePTInteropHardlinks" />
<Custom Action="SetDeletePTInteropHardlinksParam" Before="DeletePTInteropHardlinks" />
<Custom Action="RegisterPowerToysSchTask" After="InstallFiles">
NOT Installed and CREATESCHEDULEDTASK = 1
</Custom>
<Custom Action="ApplyModulesRegistryChangeSets" After="InstallFiles">
NOT Installed
</Custom>
<Custom Action="CreateWinAppSDKHardlinks" After="InstallFiles">
NOT Installed
</Custom>
<Custom Action="CreatePTInteropHardlinks" After="InstallFiles">
NOT Installed
</Custom>
<Custom Action="WixCloseApplications" Before="RemoveFiles" />
<Custom Action="RemovePowerToysSchTasks" After="RemoveFiles" />
<!-- TODO: Use to activate embedded MSIX -->
@@ -258,12 +233,6 @@
<Custom Action="UnRegisterContextMenuPackages" Before="RemoveFiles">
Installed AND (REMOVE="ALL")
</Custom>
<Custom Action="DeleteWinAppSDKHardlinks" Before="RemoveFiles">
Installed AND (REMOVE="ALL")
</Custom>
<Custom Action="DeletePTInteropHardlinks" Before="RemoveFiles">
Installed AND (REMOVE="ALL")
</Custom>
<!-- TODO: Use to activate embedded MSIX -->
<!--<Custom Action="UninstallEmbeddedMSIXTask" After="InstallFinalize">
@@ -302,22 +271,6 @@
Property="UnApplyModulesRegistryChangeSets"
Value="[INSTALLFOLDER]" />
<CustomAction Id="SetCreateWinAppSDKHardlinksParam"
Property="CreateWinAppSDKHardlinks"
Value="[INSTALLFOLDER]" />
<CustomAction Id="SetDeleteWinAppSDKHardlinksParam"
Property="DeleteWinAppSDKHardlinks"
Value="[INSTALLFOLDER]" />
<CustomAction Id="SetCreatePTInteropHardlinksParam"
Property="CreatePTInteropHardlinks"
Value="[INSTALLFOLDER]" />
<CustomAction Id="SetDeletePTInteropHardlinksParam"
Property="DeletePTInteropHardlinks"
Value="[INSTALLFOLDER]" />
<!-- Needs to Impersonate="no" and Execute="deferred" in order to run elevated. -->
<CustomAction Id="RegisterPowerToysSchTask"
Return="ignore"
@@ -327,38 +280,6 @@
DllEntry="CreateScheduledTaskCA"
/>
<CustomAction Id="DeleteWinAppSDKHardlinks"
Return="ignore"
Impersonate="no"
Execute="deferred"
BinaryKey="PTCustomActions"
DllEntry="DeleteWinAppSDKHardlinksCA"
/>
<CustomAction Id="CreateWinAppSDKHardlinks"
Return="ignore"
Impersonate="no"
Execute="deferred"
BinaryKey="PTCustomActions"
DllEntry="CreateWinAppSDKHardlinksCA"
/>
<CustomAction Id="DeletePTInteropHardlinks"
Return="ignore"
Impersonate="no"
Execute="deferred"
BinaryKey="PTCustomActions"
DllEntry="DeletePTInteropHardlinksCA"
/>
<CustomAction Id="CreatePTInteropHardlinks"
Return="ignore"
Impersonate="no"
Execute="deferred"
BinaryKey="PTCustomActions"
DllEntry="CreatePTInteropHardlinksCA"
/>
<CustomAction Id="RemovePowerToysSchTasks"
Return="ignore"
Impersonate="no"
@@ -468,6 +389,7 @@
DllEntry="UnRegisterContextMenuPackagesCA"
/>
<!-- Close 'PowerToys.exe' before uninstall-->
<Property Id="MSIRESTARTMANAGERCONTROL" Value="DisableShutdown" />
<Property Id="MSIFASTINSTALL" Value="DisableShutdown" />
@@ -482,17 +404,11 @@
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFiles64Folder">
<Directory Id="INSTALLFOLDER" Name="PowerToys">
<Directory Id="DllsFolder" Name="dll">
<Directory Id="WinAppSDKDlls" Name="WinAppSDK" />
<Directory Id="PowerToysInteropDlls" Name="Interop" />
</Directory>
<Directory Id="ToolsFolder" Name="Tools"/>
<Directory Id="ModulesInstallFolder" Name="modules">
<Directory Id="ImageResizerInstallFolder" Name="$(var.ImageResizerProjectName)">
<Directory Id="ImageResizerAssetsFolder" Name="Assets" />
</Directory>
<Directory Id="PowerAccentInstallFolder" Name="$(var.PowerAccentProjectName)">
</Directory>
<Directory Id="PowerRenameInstallFolder" Name="$(var.PowerRenameProjectName)">
<Directory Id="PowerRenameAssetsFolder" Name="Assets" />
<Directory Id="PowerRenameMicrosoftUIXamlInstallFolder" Name="Microsoft.UI.Xaml">
@@ -513,7 +429,6 @@
<Directory Id="MonacoPreviewHandlerMonacoSRCFolder" Name="monacoSRC" />
</Directory>
<Directory Id="FancyZonesInstallFolder" Name="$(var.FancyZonesProjectName)" />
<Directory Id="PowerOCRInstallFolder" Name="$(var.PowerOCRProjectName)" />
<Directory Id="AwakeInstallFolder" Name="$(var.AwakeProjectName)">
<Directory Id="AwakeImagesFolder" Name="Images" />
</Directory>
@@ -537,13 +452,6 @@
<Directory Id="AlwaysOnTopInstallFolder" Name="$(var.AlwaysOnTopProjectName)">
</Directory>
<!-- MeasureTool -->
<Directory Id="MeasureToolInstallFolder" Name="$(var.MeasureToolProjectName)">
<Directory Id="MeasureToolMicrosoftUIXamlInstallFolder" Name="Microsoft.UI.Xaml">
<Directory Id="MeasureToolMicrosoftUIXamlAssetsInstallFolder" Name="Assets" />
</Directory>
</Directory>
<!-- Launcher -->
<Directory Id="LauncherInstallFolder" Name="launcher">
<Directory Id="LauncherImagesFolder" Name="Images" />
@@ -579,10 +487,6 @@
<Directory Id="UriImagesFolder" Name="Images" />
<Directory Id="UriLanguagesFolder" Name="Languages" />
</Directory>
<Directory Id="HistoryPluginFolder" Name="History">
<Directory Id="HistoryImagesFolder" Name="Images" />
<Directory Id="HistoryLanguagesFolder" Name="Languages" />
</Directory>
<Directory Id="UnitConverterPluginFolder" Name="UnitConverter">
<Directory Id="UnitConverterImagesFolder" Name="Images" />
<Directory Id="UnitConverterLanguagesFolder" Name="Languages" />
@@ -688,6 +592,9 @@
<Component Id="Notice_md" Win64="yes">
<File Source="$(var.RepoDir)\Notice.md" Id="Notice.md" KeyPath="yes" />
</Component>
<Component Id="powertoysinterop_dll" Win64="yes">
<File Id="PowerToys.Interop.dll" KeyPath="yes" Checksum="yes" />
</Component>
</DirectoryRef>
<DirectoryRef Id="ApplicationProgramsFolder">
@@ -737,22 +644,6 @@
</Component>
</DirectoryRef>
<DirectoryRef Id="WinAppSDKDlls">
<?foreach File in $(var.WinAppSDKFiles)?>
<Component Id="Dlls_WinAppSdkFiles_$(var.File)" Win64="yes">
<File Id="Dlls_WinAppSdk_File_$(var.File)" Source="$(var.BinDir)Settings\$(var.File)" />
</Component>
<?endforeach?>
</DirectoryRef>
<DirectoryRef Id="PowerToysInteropDlls">
<?foreach File in $(var.PowerToysInteropFiles)?>
<Component Id="Dlls_PowerToysInteropFiles_$(var.File)" Win64="yes">
<File Id="Dlls_PowerToysInterop_File_$(var.File)" Source="$(var.BinDir)\$(var.File)" />
</Component>
<?endforeach?>
</DirectoryRef>
<DirectoryRef Id="ModulesInstallFolder" FileSource="$(var.BinDir)modules\">
<Component Id="Module_PowerPreview_Registry" Win64="yes">
<!-- Update Key to use IE11 for prevhost.exe -->
@@ -855,15 +746,6 @@
</Component>
</DirectoryRef>
<!-- PowerAccent -->
<DirectoryRef Id="PowerAccentInstallFolder" FileSource="$(var.BinDir)modules\$(var.PowerAccentProjectName)">
<?foreach File in $(var.PowerAccentFiles)?>
<Component Id="PowerAccent_$(var.File)" Win64="yes">
<File Id="PowerAccentFile_$(var.File)" Source="$(var.BinDir)modules\$(var.PowerAccentProjectName)\$(var.File)" />
</Component>
<?endforeach?>
</DirectoryRef>
<!-- PowerRename -->
<DirectoryRef Id="PowerRenameInstallFolder" FileSource="$(var.BinDir)modules\$(var.PowerRenameProjectName)">
<?foreach File in $(var.PowerRenameFiles)?>
@@ -885,13 +767,13 @@
</Component>
</DirectoryRef>
<DirectoryRef Id="PowerRenameMicrosoftUIXamlAssetsInstallFolder" FileSource="$(var.BinDir)modules\$(var.PowerRenameProjectName)\Microsoft.UI.Xaml\Assets">
<?foreach File in $(var.PowerRenameMicrosoftUIXamlAssetsInstallFiles)?>
<Component Id="PowerRenameMicrosoftUIXamlAssets_$(var.File)" Win64="yes">
<File Id="PowerRenameMicrosoftUIXamlAssetsFile_$(var.File)" Source="$(var.BinDir)modules\$(var.PowerRenameProjectName)\Microsoft.UI.Xaml\Assets\$(var.File)" />
</Component>
<?endforeach?>
</DirectoryRef>
<DirectoryRef Id="PowerRenameMicrosoftUIXamlAssetsInstallFolder" FileSource="$(var.BinDir)modules\$(var.PowerRenameProjectName)\Microsoft.UI.Xaml\Assets">
<?foreach File in $(var.PowerRenameMicrosoftUIXamlAssetsInstallFiles)?>
<Component Id="PowerRenameMicrosoftUIXamlAssets_$(var.File)" Win64="yes">
<File Id="PowerRenameMicrosoftUIXamlAssetsFile_$(var.File)" Source="$(var.BinDir)modules\$(var.PowerRenameProjectName)\Microsoft.UI.Xaml\Assets\$(var.File)" />
</Component>
<?endforeach?>
</DirectoryRef>
<DirectoryRef Id="PowerRenameAssetsFolder" FileSource="$(var.BinDir)modules\$(var.PowerRenameProjectName)">
<!-- !Warning! Make sure to change Component Guid if you update the file list -->
@@ -990,7 +872,7 @@
<DirectoryRef Id="ColorPickerInstallFolder" FileSource="$(var.BinDir)modules\$(var.ColorPickerProjectName)">
<!-- !Warning! Make sure to change Component Guid if you update the file list -->
<Component Id="Module_ColorPicker" Guid="C15076EC-70EE-4CE9-BEA0-665B1EECCAAF" Win64="yes">
<?foreach File in PowerToys.ColorPicker.dll;System.IO.Abstractions.dll;PowerToys.ColorPickerUI.exe;PowerToys.ColorPickerUI.dll;PowerToys.ColorPickerUI.deps.json;PowerToys.ColorPickerUI.runtimeconfig.json;PowerToys.Settings.UI.Lib.dll;PowerToys.ManagedTelemetry.dll;PowerToys.ManagedCommon.dll;System.Management.dll;ControlzEx.dll;Microsoft.Xaml.Behaviors.dll;ModernWpf.Controls.dll;ModernWpf.dll;System.ComponentModel.Composition.dll;PowerToys.Common.UI.dll;WinRT.Runtime.dll;Microsoft.Windows.SDK.NET.dll;System.Text.Json.dll;Ijwhost.dll?>
<?foreach File in PowerToys.ColorPicker.dll;System.IO.Abstractions.dll;PowerToys.ColorPickerUI.exe;PowerToys.ColorPickerUI.dll;PowerToys.ColorPickerUI.deps.json;PowerToys.ColorPickerUI.runtimeconfig.json;PowerToys.Settings.UI.Lib.dll;PowerToys.Interop.dll;PowerToys.ManagedTelemetry.dll;PowerToys.ManagedCommon.dll;System.Management.dll;ControlzEx.dll;Microsoft.Xaml.Behaviors.dll;ModernWpf.Controls.dll;ModernWpf.dll;System.ComponentModel.Composition.dll;PowerToys.Common.UI.dll;WinRT.Runtime.dll;Microsoft.Windows.SDK.NET.dll;System.Text.Json.dll;Ijwhost.dll?>
<File Id="ColorPickerFile_$(var.File)" Source="$(var.BinDir)modules\$(var.ColorPickerProjectName)\$(var.File)" />
<?endforeach?>
</Component>
@@ -1006,21 +888,11 @@
</Component>
</DirectoryRef>
<!-- PowerOCR Resources -->
<DirectoryRef Id="PowerOCRInstallFolder" FileSource="$(var.BinDir)modules\$(var.PowerOCRProjectName)">
<!-- !Warning! Make sure to change Component Guid if you update the file list -->
<Component Id="Module_PowerOCR" Guid="5640A7E8-E165-4368-8F08-F8E1E9242BDD" Win64="yes">
<?foreach File in PowerToys.PowerOCR.dll;ControlzEx.dll;Ijwhost.dll;Microsoft.Windows.SDK.NET.dll;Microsoft.Xaml.Behaviors.dll;PowerToys.Common.UI.dll;PowerToys.ManagedCommon.dll;PowerToys.ManagedTelemetry.dll;PowerToys.PowerOCR.deps.json;PowerToys.PowerOCR.exe;PowerToys.PowerOCR.runtimeconfig.json;PowerToys.PowerOCRModuleInterface.dll;PowerToys.Settings.UI.Lib.dll;System.ComponentModel.Composition.dll;System.IO.Abstractions.dll;System.Management.dll;System.Text.Json.dll;WinRT.Runtime.dll?>
<File Id="PowerOCRFile_$(var.File)" Source="$(var.BinDir)modules\$(var.PowerOCRProjectName)\$(var.File)" />
<?endforeach?>
</Component>
</DirectoryRef>
<!-- Awake -->
<DirectoryRef Id="AwakeInstallFolder" FileSource="$(var.BinDir)modules\$(var.AwakeProjectName)">
<!-- !Warning! Make sure to change Component Guid if you update the file list -->
<Component Id="Module_Awake" Guid="0D571D9A-743B-4CC5-9297-F0289FBE3398" Win64="yes">
<?foreach File in PowerToys.AwakeModuleInterface.dll;PowerToys.ManagedCommon.dll;System.Management.dll;PowerToys.ManagedTelemetry.dll;PowerToys.Settings.UI.Lib.dll;NLog.config;NLog.dll;PowerToys.Awake.deps.json;PowerToys.Awake.dll;PowerToys.Awake.exe;PowerToys.Awake.runtimeconfig.json;System.CommandLine.dll;System.IO.Abstractions.dll;System.Reactive.dll;System.Runtime.Caching.dll;System.Text.Json.dll;Ijwhost.dll;Microsoft.Windows.SDK.NET.dll;WinRT.Runtime.dll?>
<?foreach File in PowerToys.AwakeModuleInterface.dll;PowerToys.ManagedCommon.dll;System.Management.dll;PowerToys.ManagedTelemetry.dll;PowerToys.Settings.UI.Lib.dll;NLog.config;NLog.dll;PowerToys.Awake.deps.json;PowerToys.Awake.dll;PowerToys.Awake.exe;PowerToys.Awake.runtimeconfig.json;PowerToys.Interop.dll;System.CommandLine.dll;System.IO.Abstractions.dll;System.Reactive.dll;System.Runtime.Caching.dll;System.Text.Json.dll;Ijwhost.dll;Microsoft.Windows.SDK.NET.dll;WinRT.Runtime.dll?>
<File Id="AwakeFile_$(var.File)" Source="$(var.BinDir)modules\$(var.AwakeProjectName)\$(var.File)" />
<?endforeach?>
</Component>
@@ -1057,28 +929,6 @@
</DirectoryRef>
<!-- Measure Tool -->
<DirectoryRef Id="MeasureToolInstallFolder" FileSource="$(var.BinDir)modules\$(var.MeasureToolProjectName)">
<Component Id="Module_MeasureToolInterface" Win64="yes">
<File Source="$(var.BinDir)modules\$(var.MeasureToolProjectName)\PowerToys.MeasureToolModuleInterface.dll" />
</Component>
<?foreach File in $(var.MeasureToolFiles)?>
<Component Id="MT_$(var.File)" Win64="yes">
<File Id="MT_$(var.File)" Source="$(var.BinDir)modules\$(var.MeasureToolProjectName)\$(var.File)" />
</Component>
<?endforeach?>
</DirectoryRef>
<DirectoryRef Id="MeasureToolMicrosoftUIXamlAssetsInstallFolder" FileSource="$(var.BinDir)modules\$(var.MeasureToolProjectName)\Microsoft.UI.Xaml\Assets">
<?foreach File in $(var.MeasureToolMicrosoftUIXamlAssetsInstallFiles)?>
<Component Id="MeasureToolMicrosoftUIXamlAssets_$(var.File)" Win64="yes">
<File Id="MeasureToolMicrosoftUIXamlAssetsFile_$(var.File)" Source="$(var.BinDir)modules\$(var.MeasureToolProjectName)\Microsoft.UI.Xaml\Assets\$(var.File)" />
</Component>
<?endforeach?>
</DirectoryRef>
<!-- SettingsV2 components -->
<DirectoryRef Id="SettingsV2InstallFolder" FileSource="$(var.BinDir)Settings\">
<?foreach File in $(var.SettingsV2Files)?>
@@ -1173,6 +1023,7 @@
<ComponentRef Id="powertoys_toast_clsid" />
<ComponentRef Id="License_rtf" />
<ComponentRef Id="Notice_md" />
<ComponentRef Id="powertoysinterop_dll" />
<?foreach File in $(var.ShortcutGuideSvgsFiles)?>
<ComponentRef Id="ShortcutGuideSvgs_$(var.File)" />
<?endforeach?>
@@ -1185,9 +1036,6 @@
<?endforeach?>
<ComponentRef Id="DesktopShortcut" />
<ComponentRef Id="Module_PowerRename" />
<?foreach File in $(var.PowerAccentFiles)?>
<ComponentRef Id="PowerAccent_$(var.File)" />
<?endforeach?>
<?foreach File in $(var.PowerRenameFiles)?>
<ComponentRef Id="PowerRename_$(var.File)" />
<?endforeach?>
@@ -1209,7 +1057,6 @@
<ComponentRef Id="Module_KeyboardManager" />
<ComponentRef Id="Module_KeyboardManager_Editor" />
<ComponentRef Id="Module_KeyboardManager_Engine" />
<ComponentRef Id="Module_PowerOCR" />
<ComponentRef Id="Module_ColorPicker" />
<ComponentRef Id="Module_ColorPicker_Icon"/>
<ComponentRef Id="Module_ColorPicker_Cursor"/>
@@ -1220,14 +1067,6 @@
<ComponentRef Id="Module_MousePointerCrosshairs" />
<ComponentRef Id="Module_AlwaysOnTop"/>
<ComponentRef Id="Module_AlwaysOnTopInterface"/>
<ComponentRef Id="Module_MeasureToolInterface"/>
<?foreach File in $(var.MeasureToolFiles)?>
<ComponentRef Id="MT_$(var.File)" />
<?endforeach?>
<?foreach File in $(var.MeasureToolMicrosoftUIXamlAssetsInstallFiles)?>
<ComponentRef Id="MeasureToolMicrosoftUIXamlAssets_$(var.File)" />
<?endforeach?>
<?foreach File in $(var.SettingsV2Files)?>
<ComponentRef Id="SV2C_$(var.File)" />
<?endforeach?>
@@ -1251,12 +1090,6 @@
<?foreach File in $(var.SettingsV2MicrosoftUIXamlAssetsInstallFiles)?>
<ComponentRef Id="SettingsV2MicrosoftUIXamlAssets_$(var.File)" />
<?endforeach?>
<?foreach File in $(var.WinAppSDKFiles)?>
<ComponentRef Id="Dlls_WinAppSdkFiles_$(var.File)" />
<?endforeach?>
<?foreach File in $(var.PowerToysInteropFiles)?>
<ComponentRef Id="Dlls_PowerToysInteropFiles_$(var.File)" />
<?endforeach?>
</ComponentGroup>
<ComponentGroup Id="ToolComponents" Directory="ToolsFolder">
<ComponentRef Id="BugReportTool_exe" />
@@ -1272,7 +1105,7 @@
<Fragment>
<!-- Resource directories should be added only if the installer is built on the build farm -->
<?ifdef env.IsPipeline?>
<?foreach ParentDirectory in LauncherInstallFolder;FancyZonesInstallFolder;ImageResizerInstallFolder;ColorPickerInstallFolder;FileExplorerPreviewInstallFolder;HistoryPluginFolder;CalculatorPluginFolder;FolderPluginFolder;ProgramPluginFolder;ShellPluginFolder;IndexerPluginFolder;UnitConverterPluginFolder;UriPluginFolder;WindowWalkerPluginFolder;OneNotePluginFolder;RegistryPluginFolder;VSCodeWorkspacesPluginFolder;ServicePluginFolder;SystemPluginFolder;TimeDatePluginFolder;TimeZonePluginFolder;WindowsSettingsPluginFolder;WindowsTerminalPluginFolder;WebSearchPluginFolder?>
<?foreach ParentDirectory in LauncherInstallFolder;FancyZonesInstallFolder;ImageResizerInstallFolder;ColorPickerInstallFolder;FileExplorerPreviewInstallFolder;CalculatorPluginFolder;FolderPluginFolder;ProgramPluginFolder;ShellPluginFolder;IndexerPluginFolder;UnitConverterPluginFolder;UriPluginFolder;WindowWalkerPluginFolder;OneNotePluginFolder;RegistryPluginFolder;VSCodeWorkspacesPluginFolder;ServicePluginFolder;SystemPluginFolder;TimeDatePluginFolder;TimeZonePluginFolder;WindowsSettingsPluginFolder;WindowsTerminalPluginFolder;WebSearchPluginFolder?>
<DirectoryRef Id="$(var.ParentDirectory)">
<!-- Resource file directories -->
<?foreach Language in $(var.LocLanguageList)?>
@@ -1558,18 +1391,6 @@
Directory="Resource$(var.IdSafeLanguage)OneNotePluginFolder">
<File Id="Launcher_OneNote_$(var.IdSafeLanguage)_File" Source="$(var.BinDir)modules\launcher\Plugins\OneNote\$(var.Language)\Microsoft.PowerToys.Run.Plugin.OneNote.resources.dll" />
</Component>
<Component
Id="MonacoPreviewHandler_$(var.IdSafeLanguage)_Component"
Directory="Resource$(var.IdSafeLanguage)FileExplorerPreviewInstallFolder"
Guid="$(var.CompGUIDPrefix)1A">
<File Id="MonacoPreviewHandler_$(var.IdSafeLanguage)_File" Source="$(var.BinDir)modules\FileExplorerPreview\$(var.Language)\PowerToys.MonacoPreviewHandler.resources.dll" />
</Component>
<Component
Id="Launcher_History_$(var.IdSafeLanguage)_Component"
Directory="Resource$(var.IdSafeLanguage)HistoryPluginFolder"
Guid="$(var.CompGUIDPrefix)1B">
<File Id="Launcher_History_$(var.IdSafeLanguage)_File" Source="$(var.BinDir)modules\launcher\Plugins\History\$(var.Language)\Microsoft.PowerToys.Run.Plugin.History.resources.dll" />
</Component>
<?undef IdSafeLanguage?>
<?undef CompGUIDPrefix?>
<?endforeach?>
@@ -1580,7 +1401,7 @@
<!-- Localization languages shipped with WinAppSDK. We should ship these as well. -->
<?define WinAppSDKLocLanguageList = af-ZA;ar-SA;az-Latn-AZ;bg-BG;bs-Latn-BA;ca-ES;cs-CZ;cy-GB;da-DK;de-DE;el-GR;en-GB;en-us;es-ES;es-MX;et-EE;eu-ES;fa-IR;fi-FI;fr-CA;fr-FR;gl-ES;he-IL;hi-IN;hr-HR;hu-HU;id-ID;is-IS;it-IT;ja-JP;ka-GE;kk-KZ;ko-KR;lt-LT;lv-LV;ms-MY;nb-NO;nl-NL;nn-NO;pl-PL;pt-BR;pt-PT;ro-RO;ru-RU;sk-SK;sl-SI;sq-AL;sr-Cyrl-RS;sr-Latn-RS;sv-SE;th-TH;tr-TR;uk-UA;vi-VN;zh-CN;zh-TW?>
<Fragment>
<?foreach ParentDirectory in SettingsV2InstallFolder;PowerRenameInstallFolder;MeasureToolInstallFolder?>
<?foreach ParentDirectory in SettingsV2InstallFolder;PowerRenameInstallFolder?>
<DirectoryRef Id="$(var.ParentDirectory)">
<?foreach Language in $(var.WinAppSDKLocLanguageList)?>
<?if $(var.Language) = af-ZA?>
@@ -1892,13 +1713,6 @@
<File Id="PowerRename_WinAppSDKLoc_$(var.IdSafeLanguage)_XamlMui_File" Source="$(var.BinDir)modules\$(var.PowerRenameProjectName)\$(var.Language)\Microsoft.ui.xaml.dll.mui" />
<File Id="PowerRename_WinAppSDKLoc_$(var.IdSafeLanguage)_XamlPhoneMui_File" Source="$(var.BinDir)modules\$(var.PowerRenameProjectName)\$(var.Language)\Microsoft.UI.Xaml.Phone.dll.mui" />
</Component>
<Component
Id="MeasureTool_WinAppSDKLoc_$(var.IdSafeLanguage)_Component"
Directory="WinAppSDKLoc$(var.IdSafeLanguage)MeasureToolInstallFolder"
Guid="$(var.CompGUIDPrefix)03">
<File Id="MeasureTool_WinAppSDKLoc_$(var.IdSafeLanguage)_XamlMui_File" Source="$(var.BinDir)modules\$(var.MeasureToolProjectName)\$(var.Language)\Microsoft.ui.xaml.dll.mui" />
<File Id="MeasureTool_WinAppSDKLoc_$(var.IdSafeLanguage)_XamlPhoneMui_File" Source="$(var.BinDir)modules\$(var.MeasureToolProjectName)\$(var.Language)\Microsoft.UI.Xaml.Phone.dll.mui" />
</Component>
<?undef IdSafeLanguage?>
<?undef CompGUIDPrefix?>
<?endforeach?>
@@ -1917,7 +1731,7 @@
<!-- !Warning! Make sure to change Component Guid if you update the file list -->
<Component Id="launcherInstallComponent" Guid="ab0d0567-1e41-4da4-9934-dcb74b7048a4" Directory="LauncherInstallFolder" >
<File Source="$(var.BinDir)modules\Launcher\PowerToys.Launcher.dll" />
<?foreach File in e_sqlite3.dll;JetBrains.Annotations.dll;Mages.Core.dll;Mono.Cecil.dll;Mono.Cecil.Mdb.dll;Mono.Cecil.Pdb.dll;Mono.Cecil.Rocks.dll;NLog.dll;NLog.Extensions.Logging.dll;PowerToys.PowerLauncher.deps.json;PowerToys.PowerLauncher.dll;PowerToys.PowerLauncher.exe;Microsoft.Xaml.Behaviors.dll;PowerToys.PowerLauncher.runtimeconfig.json;System.Data.OleDb.dll;UnitsNet.dll;vcamp140_app.dll;Wox.Infrastructure.dll;Wox.Plugin.dll;PowerToys.ManagedTelemetry.dll;PowerToys.PowerLauncher.Telemetry.dll;Microsoft.Data.Sqlite.dll;SQLitePCLRaw.batteries_v2.dll;SQLitePCLRaw.core.dll;SQLitePCLRaw.provider.e_sqlite3.dll;Microsoft.Extensions.Configuration.Abstractions.dll;Microsoft.Extensions.DependencyInjection.Abstractions.dll;Microsoft.Extensions.DependencyInjection.dll;Microsoft.Extensions.Logging.Abstractions.dll;Microsoft.Extensions.Logging.dll;Microsoft.Extensions.Options.dll;Microsoft.Extensions.Primitives.dll;ControlzEx.dll;PowerToys.ManagedCommon.dll;System.Management.dll;System.IO.Abstractions.dll;PowerToys.Common.UI.dll;System.ServiceProcess.ServiceController.dll;Microsoft.Toolkit.Uwp.Notifications.dll;ModernWpf.Controls.dll;ModernWpf.dll;WinRT.Runtime.dll;Microsoft.Windows.SDK.NET.dll;System.Reactive.dll;System.Text.Json.dll;Ijwhost.dll;ScipBe.Common.Office.OneNote.dll;Interop.Microsoft.Office.Interop.OneNote.dll;LazyCache.dll;Microsoft.Extensions.Caching.Abstractions.dll;Microsoft.Extensions.Caching.Memory.dll?>
<?foreach File in e_sqlite3.dll;JetBrains.Annotations.dll;Mages.Core.dll;Mono.Cecil.dll;Mono.Cecil.Mdb.dll;Mono.Cecil.Pdb.dll;Mono.Cecil.Rocks.dll;NLog.dll;NLog.Extensions.Logging.dll;PowerToys.PowerLauncher.deps.json;PowerToys.PowerLauncher.dll;PowerToys.PowerLauncher.exe;Microsoft.Xaml.Behaviors.dll;PowerToys.PowerLauncher.runtimeconfig.json;System.Data.OleDb.dll;UnitsNet.dll;vcamp140_app.dll;Wox.Infrastructure.dll;Wox.Plugin.dll;PowerToys.Interop.dll;PowerToys.ManagedTelemetry.dll;PowerToys.PowerLauncher.Telemetry.dll;Microsoft.Data.Sqlite.dll;SQLitePCLRaw.batteries_v2.dll;SQLitePCLRaw.core.dll;SQLitePCLRaw.provider.e_sqlite3.dll;Microsoft.Extensions.Configuration.Abstractions.dll;Microsoft.Extensions.DependencyInjection.Abstractions.dll;Microsoft.Extensions.DependencyInjection.dll;Microsoft.Extensions.Logging.Abstractions.dll;Microsoft.Extensions.Logging.dll;Microsoft.Extensions.Options.dll;Microsoft.Extensions.Primitives.dll;ControlzEx.dll;PowerToys.ManagedCommon.dll;System.Management.dll;System.IO.Abstractions.dll;PowerToys.Common.UI.dll;System.ServiceProcess.ServiceController.dll;Microsoft.Toolkit.Uwp.Notifications.dll;ModernWpf.Controls.dll;ModernWpf.dll;WinRT.Runtime.dll;Microsoft.Windows.SDK.NET.dll;System.Reactive.dll;System.Text.Json.dll;Ijwhost.dll;ScipBe.Common.Office.OneNote.dll;Interop.Microsoft.Office.Interop.OneNote.dll;LazyCache.dll;Microsoft.Extensions.Caching.Abstractions.dll;Microsoft.Extensions.Caching.Memory.dll?>
<File Id="File_$(var.File)" Source="$(var.BinDir)modules\launcher\$(var.File)" />
<?endforeach?>
<File Source="$(var.BinDir)Settings\PowerToys.Settings.UI.Lib.dll" />
@@ -2016,19 +1830,6 @@
<File Id="WebSearchDark" Source="$(var.BinDir)modules\launcher\Plugins\WebSearch\Images\WebSearch.dark.png" />
</Component>
<!-- History Plugin -->
<?foreach File in $(var.HistoryPluginComponentFiles)?>
<Component Id="HistoryComponent_$(var.File)" Win64="yes" Directory="HistoryPluginFolder">
<File Id="HistoryComponentFile_$(var.File)" Source="$(var.BinDir)modules\launcher\Plugins\History\$(var.File)" />
</Component>
<?endforeach?>
<Component Id="HistoryImagesComponentLight" Directory="HistoryImagesFolder" >
<File Id="HistoryLightIcon" Source="$(var.BinDir)modules\launcher\Plugins\History\Images\history.light.png" />
</Component>
<Component Id="HistoryImagesComponentDark" Directory="HistoryImagesFolder" >
<File Id="HistoryDarkIcon" Source="$(var.BinDir)modules\launcher\Plugins\History\Images\history.dark.png" />
</Component>
<!-- Uri Plugin -->
<?foreach File in $(var.UriComponentFiles)?>
<Component Id="UriComponent_$(var.File)" Win64="yes" Directory="UriPluginFolder">

View File

@@ -18,5 +18,3 @@ msbuild !PTRoot!\src\modules\previewpane\MarkdownPreviewHandler\MarkdownPreviewH
msbuild !PTRoot!\src\modules\previewpane\SvgPreviewHandler\SvgPreviewHandler.csproj -t:Publish -p:Configuration="Release" -p:Platform="!PlatformArg!" -p:AppxBundle=Never -p:PowerToysRoot=!PTRoot! -p:VCRTForwarders-IncludeDebugCRT=false -p:PublishProfile=InstallationPublishProfile.pubxml
msbuild !PTRoot!\src\modules\previewpane\SvgThumbnailProvider\SvgThumbnailProvider.csproj -t:Publish -p:Configuration="Release" -p:Platform="!PlatformArg!" -p:AppxBundle=Never -p:PowerToysRoot=!PTRoot! -p:VCRTForwarders-IncludeDebugCRT=false -p:PublishProfile=InstallationPublishProfile.pubxml
msbuild !PTRoot!\src\modules\MeasureTool\MeasureToolUI\MeasureToolUI.csproj -t:Publish -p:Configuration="Release" -p:Platform="!PlatformArg!" -p:AppxBundle=Never -p:PowerToysRoot=!PTRoot! -p:VCRTForwarders-IncludeDebugCRT=false -p:PublishProfile=InstallationPublishProfile.pubxml

View File

@@ -1,12 +0,0 @@
@echo off
setlocal ENABLEDELAYEDEXPANSION
@REM We loop here until taskkill cannot find a PowerToys process. We can't use /F flag, because it
@REM doesn't give application an opportunity to cleanup. Thus we send WM_CLOSE which is being caught
@REM by multiple windows running a msg loop in PowerToys.exe process, which we close one by one.
for /l %%x in (1, 1, 100) do (
taskkill /IM PowerToys.exe 1>NUL 2>NUL
if !ERRORLEVEL! NEQ 0 goto quit
)
:quit

View File

@@ -32,56 +32,6 @@ const DWORD USERNAME_LEN = UNLEN + 1; // User Name + '\0'
static const wchar_t* POWERTOYS_EXE_COMPONENT = L"{A2C66D91-3485-4D00-B04D-91844E6B345B}";
static const wchar_t* POWERTOYS_UPGRADE_CODE = L"{42B84BF7-5FBF-473B-9C8B-049DC16F7708}";
const std::vector<std::wstring> winAppSdkFiles = {
L"CoreMessagingXP.dll",
L"DWriteCore.dll",
L"DwmSceneI.dll",
L"MRM.dll",
L"Microsoft.DirectManipulation.dll",
L"Microsoft.InputStateManager.dll",
L"Microsoft.Internal.FrameworkUdk.dll",
L"Microsoft.UI.Composition.OSSupport.dll",
L"Microsoft.UI.Input.dll",
L"Microsoft.UI.Windowing.Core.dll",
L"Microsoft.UI.Xaml.Controls.dll",
L"Microsoft.UI.Xaml.Controls.pri",
L"Microsoft.UI.Xaml.Internal.dll",
L"Microsoft.UI.Xaml.Phone.dll",
L"Microsoft.Web.WebView2.Core.dll",
L"Microsoft.Windows.AppNotifications.Projection.dll",
L"Microsoft.Windows.ApplicationModel.Resources.dll",
L"Microsoft.WindowsAppRuntime.Bootstrap.dll",
L"Microsoft.Windows.PushNotifications.Projection.dll",
L"Microsoft.Windows.System.Projection.dll",
L"Microsoft.WindowsAppRuntime.Insights.Resource.dll",
L"Microsoft.WindowsAppRuntime.Release.Net.dll",
L"Microsoft.WindowsAppRuntime.dll",
L"Microsoft.ui.xaml.dll",
L"Microsoft.ui.xaml.resources.19h1.dll",
L"Microsoft.ui.xaml.resources.common.dll",
L"PushNotificationsLongRunningTask.ProxyStub.dll",
L"WinUIEdit.dll",
L"WindowsAppRuntime.png",
L"WindowsAppSdk.AppxDeploymentExtensions.Desktop.dll",
L"dcompi.dll",
L"dwmcorei.dll",
L"marshal.dll",
L"wuceffectsi.dll" };
const std::vector<std::wstring> powerToysInteropFiles = {
L"concrt140.dll",
L"msvcp140.dll",
L"msvcp140_1.dll",
L"msvcp140_2.dll",
L"msvcp140_atomic_wait.dll",
L"msvcp140_codecvt_ids.dll",
L"PowerToys.Interop.dll",
L"vcamp140.dll",
L"vccorlib140.dll",
L"vcomp140.dll",
L"vcruntime140.dll",
L"vcruntime140_1.dll" };
struct WcaSink : spdlog::sinks::base_sink<std::mutex>
{
virtual void sink_it_(const spdlog::details::log_msg& msg) override
@@ -245,7 +195,7 @@ LExit:
// Creates a Scheduled Task to run at logon for the current user.
// The path of the executable to run should be passed as the CustomActionData (Value).
// Based on the Task Scheduler Logon Trigger Example:
// https://learn.microsoft.com/windows/win32/taskschd/logon-trigger-example--c---/
// https://docs.microsoft.com/en-us/windows/win32/taskschd/logon-trigger-example--c---/
UINT __stdcall CreateScheduledTaskCA(MSIHANDLE hInstall)
{
HRESULT hr = S_OK;
@@ -513,7 +463,7 @@ LExit:
// Removes all Scheduled Tasks in the PowerToys folder and deletes the folder afterwards.
// Based on the Task Scheduler Displaying Task Names and State example:
// https://learn.microsoft.com/windows/desktop/TaskSchd/displaying-task-names-and-state--c---/
// https://docs.microsoft.com/en-us/windows/desktop/TaskSchd/displaying-task-names-and-state--c---/
UINT __stdcall RemoveScheduledTasksCA(MSIHANDLE hInstall)
{
HRESULT hr = S_OK;
@@ -1032,7 +982,7 @@ UINT __stdcall UnRegisterContextMenuPackagesCA(MSIHANDLE hInstall)
}
}
}
catch (std::exception& e)
catch (std::exception e)
{
std::string errorMessage{ "Exception thrown while trying to unregister sparse packages: " };
errorMessage += e.what();
@@ -1045,185 +995,6 @@ UINT __stdcall UnRegisterContextMenuPackagesCA(MSIHANDLE hInstall)
return WcaFinalize(er);
}
UINT __stdcall CreateWinAppSDKHardlinksCA(MSIHANDLE hInstall)
{
HRESULT hr = S_OK;
UINT er = ERROR_SUCCESS;
std::wstring installationFolder, winAppSDKFilesSrcDir, settingsDir, powerRenameDir, measureToolDir;
hr = WcaInitialize(hInstall, "CreateWinAppSDKHardlinksCA");
ExitOnFailure(hr, "Failed to initialize");
hr = getInstallFolder(hInstall, installationFolder);
ExitOnFailure(hr, "Failed to get installation folder");
winAppSDKFilesSrcDir = installationFolder + L"dll\\WinAppSDK\\";
settingsDir = installationFolder + L"Settings\\";
powerRenameDir = installationFolder + L"modules\\PowerRename\\";
measureToolDir = installationFolder + L"modules\\MeasureTool\\";
for (auto file : winAppSdkFiles)
{
std::error_code ec;
std::filesystem::create_hard_link((winAppSDKFilesSrcDir + file).c_str(), (settingsDir + file).c_str(), ec);
std::filesystem::create_hard_link((winAppSDKFilesSrcDir + file).c_str(), (powerRenameDir + file).c_str(), ec);
std::filesystem::create_hard_link((winAppSDKFilesSrcDir + file).c_str(), (measureToolDir + file).c_str(), ec);
if (ec.value() != S_OK)
{
std::wstring errorMessage{ L"Error creating hard link for: " };
errorMessage += file;
errorMessage += L", error code: " + std::to_wstring(ec.value());
Logger::error(errorMessage);
}
}
LExit:
er = SUCCEEDED(hr) ? ERROR_SUCCESS : ERROR_INSTALL_FAILURE;
return WcaFinalize(er);
}
UINT __stdcall CreatePTInteropHardlinksCA(MSIHANDLE hInstall)
{
HRESULT hr = S_OK;
UINT er = ERROR_SUCCESS;
std::wstring installationFolder, interopFilesSrcDir, colorPickerDir, powerOCRDir, launcherDir, fancyZonesDir,
imageResizerDir, settingsDir, awakeDir, measureToolDir, powerAccentDir;
hr = WcaInitialize(hInstall, "CreatePTInteropHardlinksCA");
ExitOnFailure(hr, "Failed to initialize");
hr = getInstallFolder(hInstall, installationFolder);
ExitOnFailure(hr, "Failed to get installation folder");
interopFilesSrcDir = installationFolder + L"dll\\Interop\\";
colorPickerDir = installationFolder + L"modules\\ColorPicker\\";
powerOCRDir = installationFolder + L"modules\\PowerOCR\\";
launcherDir = installationFolder + L"modules\\launcher\\";
fancyZonesDir = installationFolder + L"modules\\FancyZones\\";
imageResizerDir = installationFolder + L"modules\\ImageResizer\\";
settingsDir = installationFolder + L"Settings\\";
awakeDir = installationFolder + L"modules\\Awake\\";
measureToolDir = installationFolder + L"modules\\MeasureTool\\";
powerAccentDir = installationFolder + L"modules\\PowerAccent\\";
for (auto file : powerToysInteropFiles)
{
std::error_code ec;
std::filesystem::create_hard_link((interopFilesSrcDir + file).c_str(), (colorPickerDir + file).c_str(), ec);
std::filesystem::create_hard_link((interopFilesSrcDir + file).c_str(), (powerOCRDir + file).c_str(), ec);
std::filesystem::create_hard_link((interopFilesSrcDir + file).c_str(), (launcherDir + file).c_str(), ec);
std::filesystem::create_hard_link((interopFilesSrcDir + file).c_str(), (fancyZonesDir + file).c_str(), ec);
std::filesystem::create_hard_link((interopFilesSrcDir + file).c_str(), (imageResizerDir + file).c_str(), ec);
std::filesystem::create_hard_link((interopFilesSrcDir + file).c_str(), (settingsDir + file).c_str(), ec);
std::filesystem::create_hard_link((interopFilesSrcDir + file).c_str(), (awakeDir + file).c_str(), ec);
std::filesystem::create_hard_link((interopFilesSrcDir + file).c_str(), (measureToolDir + file).c_str(), ec);
std::filesystem::create_hard_link((interopFilesSrcDir + file).c_str(), (powerAccentDir + file).c_str(), ec);
if (ec.value() != S_OK)
{
std::wstring errorMessage{ L"Error creating hard link for: " };
errorMessage += file;
errorMessage += L", error code: " + std::to_wstring(ec.value());
Logger::error(errorMessage);
}
}
LExit:
er = SUCCEEDED(hr) ? ERROR_SUCCESS : ERROR_INSTALL_FAILURE;
return WcaFinalize(er);
}
UINT __stdcall DeleteWinAppSDKHardlinksCA(MSIHANDLE hInstall)
{
HRESULT hr = S_OK;
UINT er = ERROR_SUCCESS;
std::wstring installationFolder, settingsDir, powerRenameDir, measureToolDir;
hr = WcaInitialize(hInstall, "DeleteWinAppSDKHardlinksCA");
ExitOnFailure(hr, "Failed to initialize");
hr = getInstallFolder(hInstall, installationFolder);
ExitOnFailure(hr, "Failed to get installation folder");
settingsDir = installationFolder + L"Settings\\";
powerRenameDir = installationFolder + L"modules\\PowerRename\\";
measureToolDir = installationFolder + L"modules\\MeasureTool\\";
try
{
for (auto file : winAppSdkFiles)
{
DeleteFile((settingsDir + file).c_str());
DeleteFile((powerRenameDir + file).c_str());
DeleteFile((measureToolDir + file).c_str());
}
}
catch (std::exception e)
{
std::string errorMessage{ "Exception thrown while trying to delete WAS hardlinks: " };
errorMessage += e.what();
Logger::error(errorMessage);
er = ERROR_INSTALL_FAILURE;
}
LExit:
er = SUCCEEDED(hr) ? ERROR_SUCCESS : ERROR_INSTALL_FAILURE;
return WcaFinalize(er);
}
UINT __stdcall DeletePTInteropHardlinksCA(MSIHANDLE hInstall)
{
HRESULT hr = S_OK;
UINT er = ERROR_SUCCESS;
std::wstring installationFolder, interopFilesSrcDir, colorPickerDir, powerOCRDir, launcherDir, fancyZonesDir,
imageResizerDir, settingsDir, awakeDir, measureToolDir, powerAccentDir;
hr = WcaInitialize(hInstall, "DeletePTInteropHardlinksCA");
ExitOnFailure(hr, "Failed to initialize");
hr = getInstallFolder(hInstall, installationFolder);
ExitOnFailure(hr, "Failed to get installation folder");
colorPickerDir = installationFolder + L"modules\\ColorPicker\\";
powerOCRDir = installationFolder + L"modules\\PowerOCR\\";
launcherDir = installationFolder + L"modules\\launcher\\";
fancyZonesDir = installationFolder + L"modules\\FancyZones\\";
imageResizerDir = installationFolder + L"modules\\ImageResizer\\";
settingsDir = installationFolder + L"Settings\\";
awakeDir = installationFolder + L"modules\\Awake\\";
measureToolDir = installationFolder + L"modules\\MeasureTool\\";
powerAccentDir = installationFolder + L"modules\\PowerAccent\\";
try
{
for (auto file : powerToysInteropFiles)
{
DeleteFile((colorPickerDir + file).c_str());
DeleteFile((powerOCRDir + file).c_str());
DeleteFile((launcherDir + file).c_str());
DeleteFile((fancyZonesDir + file).c_str());
DeleteFile((imageResizerDir + file).c_str());
DeleteFile((settingsDir + file).c_str());
DeleteFile((awakeDir + file).c_str());
DeleteFile((measureToolDir + file).c_str());
DeleteFile((powerAccentDir + file).c_str());
}
}
catch (std::exception e)
{
std::string errorMessage{ "Exception thrown while trying to delete PowerToys Interop and VC Redist hardlinks: " };
errorMessage += e.what();
Logger::error(errorMessage);
er = ERROR_INSTALL_FAILURE;
}
LExit:
er = SUCCEEDED(hr) ? ERROR_SUCCESS : ERROR_INSTALL_FAILURE;
return WcaFinalize(er);
}
UINT __stdcall TerminateProcessesCA(MSIHANDLE hInstall)
{

View File

@@ -3,10 +3,6 @@ LIBRARY "PowerToysSetupCustomActions"
EXPORTS
ApplyModulesRegistryChangeSetsCA
CreateScheduledTaskCA
CreateWinAppSDKHardlinksCA
DeleteWinAppSDKHardlinksCA
CreatePTInteropHardlinksCA
DeletePTInteropHardlinksCA
DetectPrevInstallPathCA
RemoveScheduledTasksCA
TelemetryLogInstallSuccessCA

View File

@@ -1,8 +1,6 @@
// Microsoft Visual C++ generated resource script.
//
#include <windows.h>
#include "resource.h"
#include "../../src/common/version/version.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
@@ -14,39 +12,6 @@
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
1 VERSIONINFO
FILEVERSION FILE_VERSION
PRODUCTVERSION PRODUCT_VERSION
FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
#ifdef _DEBUG
FILEFLAGS VS_FF_DEBUG
#else
FILEFLAGS 0x0L
#endif
FILEOS VOS_NT_WINDOWS32
FILETYPE VFT_DLL
FILESUBTYPE VFT2_UNKNOWN
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0" // US English (0x0409), Unicode (0x04B0) charset
BEGIN
VALUE "CompanyName", COMPANY_NAME
VALUE "FileDescription", FILE_DESCRIPTION
VALUE "FileVersion", FILE_VERSION_STRING
VALUE "InternalName", INTERNAL_NAME
VALUE "LegalCopyright", COPYRIGHT_NOTE
VALUE "OriginalFilename", ORIGINAL_FILENAME
VALUE "ProductName", PRODUCT_NAME
VALUE "ProductVersion", PRODUCT_VERSION_STRING
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200 // US English (0x0409), Unicode (1200) charset
END
END
/////////////////////////////////////////////////////////////////////////////
// English (United States) resources

View File

@@ -2,10 +2,6 @@
// Microsoft Visual C++ generated include file.
// Used by Resource.rc
#define FILE_DESCRIPTION "PowerToys Setup Custom Actions"
#define INTERNAL_NAME "PowerToysSetupCustomActions"
#define ORIGINAL_FILENAME "PowerToysSetupCustomActions.dll"
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED

View File

@@ -170,6 +170,29 @@ bool InstallNewVersionStage2(std::wstring installer_path, std::wstring_view inst
}
}
for (const auto& entry : fs::directory_iterator(updating::get_pending_updates_path()))
{
auto entryPath = entry.path().wstring();
std::transform(entryPath.begin(), entryPath.end(), entryPath.begin(), ::towlower);
// Delete only .msi and .exe
if (entryPath.ends_with(L".msi") || entryPath.ends_with(L".exe"))
{
// Skipping current installer in case of failed update
if (installer_path.find(entryPath) != std::string::npos && !success)
{
continue;
}
std::error_code err;
fs::remove(entry, err);
if (err.value())
{
Logger::warn("Failed to delete file {}. {}", entry.path().string(), err.message());
}
}
}
if (!success)
{
return false;

View File

@@ -50,7 +50,7 @@ using System.Diagnostics.CodeAnalysis;
[assembly: SuppressMessage("Microsoft.Globalization", "CA1303:Do not pass literals as localized parameters", MessageId = "System.Windows.Documents.InlineCollection.Add(System.String)", Scope = "member", Target = "Microsoft.Templates.UI.Extensions.TextBlockExtensions.#OnSequentialFlowStepChanged(System.Windows.DependencyObject,System.Windows.DependencyPropertyChangedEventArgs)", Justification = "No text here")]
[assembly: SuppressMessage("Globalization", "CA1309:Use ordinal string comparison", Justification = "The user's search term should be compared with culture based rules.", Scope = "type", Target = "~T:Microsoft.PowerToys.Run.Plugin.TimeDate.Components.SearchController")]
// Uninstantiated TestFixture classes
// FxCop warning suppression for uninstantiated TestFixture classes
[assembly: SuppressMessage("Microsoft.Performance", "CA1812: Avoid uninstantiated internal classes", Scope = "module", Justification = "CA1812 will be thrown for every file in the test project. This is mentioned here: dotnet/roslyn-analyzers#1830")]
// Code quality

View File

@@ -3,7 +3,6 @@
// See the LICENSE file in the project root for more information.
using System.Collections.Generic;
using ControlzEx.Theming;
namespace Common.UI

View File

@@ -2,53 +2,72 @@
#include <algorithm>
Box MonitorInfo::GetScreenSize(const bool includeNonWorkingArea) const
namespace
{
return includeNonWorkingArea ? Box{ info.rcMonitor } : Box{ info.rcWork };
// TODO: use compare
bool operator<(const RECT& lhs, const RECT& rhs)
{
auto lhs_tuple = std::make_tuple(lhs.left, lhs.right, lhs.top, lhs.bottom);
auto rhs_tuple = std::make_tuple(rhs.left, rhs.right, rhs.top, rhs.bottom);
return lhs_tuple < rhs_tuple;
}
}
bool MonitorInfo::IsPrimary() const
bool operator==(const ScreenSize& lhs, const ScreenSize& rhs)
{
return static_cast<bool>(info.dwFlags & MONITORINFOF_PRIMARY);
}
MonitorInfo::MonitorInfo(HMONITOR h) :
handle{ h }
{
info.cbSize = sizeof(MONITORINFOEX);
GetMonitorInfoW(handle, &info);
auto lhs_tuple = std::make_tuple(lhs.rect.left, lhs.rect.right, lhs.rect.top, lhs.rect.bottom);
auto rhs_tuple = std::make_tuple(rhs.rect.left, rhs.rect.right, rhs.rect.top, rhs.rect.bottom);
return lhs_tuple == rhs_tuple;
}
static BOOL CALLBACK GetDisplaysEnumCb(HMONITOR monitor, HDC hdc, LPRECT rect, LPARAM data)
{
auto* monitors = reinterpret_cast<std::vector<MonitorInfo>*>(data);
monitors->emplace_back(monitor);
MONITORINFOEX monitorInfo;
monitorInfo.cbSize = sizeof(MONITORINFOEX);
if (GetMonitorInfo(monitor, &monitorInfo))
{
reinterpret_cast<std::vector<MonitorInfo>*>(data)->emplace_back(monitor, monitorInfo.rcWork);
}
return true;
};
static BOOL CALLBACK GetDisplaysEnumCbWithNonWorkingArea(HMONITOR monitor, HDC hdc, LPRECT rect, LPARAM data)
{
MONITORINFOEX monitorInfo;
monitorInfo.cbSize = sizeof(MONITORINFOEX);
if (GetMonitorInfo(monitor, &monitorInfo))
{
reinterpret_cast<std::vector<MonitorInfo>*>(data)->emplace_back(monitor, monitorInfo.rcMonitor);
}
return true;
};
std::vector<MonitorInfo> MonitorInfo::GetMonitors(bool includeNonWorkingArea)
{
std::vector<MonitorInfo> monitors;
EnumDisplayMonitors(nullptr, nullptr, GetDisplaysEnumCb, reinterpret_cast<LPARAM>(&monitors));
std::sort(begin(monitors), end(monitors), [=](const MonitorInfo& lhs, const MonitorInfo& rhs) {
const auto lhsSize = lhs.GetScreenSize(includeNonWorkingArea);
const auto rhsSize = rhs.GetScreenSize(includeNonWorkingArea);
return lhsSize < rhsSize;
EnumDisplayMonitors(NULL, NULL, includeNonWorkingArea ? GetDisplaysEnumCbWithNonWorkingArea : GetDisplaysEnumCb, reinterpret_cast<LPARAM>(&monitors));
std::sort(begin(monitors), end(monitors), [](const MonitorInfo& lhs, const MonitorInfo& rhs) {
return lhs.rect < rhs.rect;
});
return monitors;
}
static BOOL CALLBACK GetPrimaryDisplayEnumCb(HMONITOR monitor, HDC hdc, LPRECT rect, LPARAM data)
{
MONITORINFOEX monitorInfo;
monitorInfo.cbSize = sizeof(MONITORINFOEX);
if (GetMonitorInfo(monitor, &monitorInfo) && (monitorInfo.dwFlags & MONITORINFOF_PRIMARY))
{
reinterpret_cast<MonitorInfo*>(data)->handle = monitor;
reinterpret_cast<MonitorInfo*>(data)->rect = monitorInfo.rcWork;
}
return true;
};
MonitorInfo MonitorInfo::GetPrimaryMonitor()
{
auto monitors = MonitorInfo::GetMonitors(false);
if (monitors.size() > 1)
{
for (auto monitor : monitors)
{
if (monitor.IsPrimary())
return monitor;
}
}
return monitors[0];
MonitorInfo primary({}, {});
EnumDisplayMonitors(NULL, NULL, GetPrimaryDisplayEnumCb, reinterpret_cast<LPARAM>(&primary));
return primary;
}

View File

@@ -1,20 +1,12 @@
#pragma once
#include <Windows.h>
#include <compare>
#include <optional>
#include <vector>
// TODO: merge with FZ::Rect
struct Box
struct ScreenSize
{
RECT rect;
explicit Box(RECT rect = {}) :
explicit ScreenSize(RECT rect) :
rect(rect) {}
Box(const Box&) = default;
Box& operator=(const Box&) = default;
RECT rect;
int left() const { return rect.left; }
int right() const { return rect.right; }
int top() const { return rect.top; }
@@ -30,31 +22,17 @@ struct Box
POINT bottom_left() const { return { rect.left, rect.bottom }; };
POINT bottom_middle() const { return { rect.left + width() / 2, rect.bottom }; };
POINT bottom_right() const { return { rect.right, rect.bottom }; };
inline bool inside(const POINT point) const { return PtInRect(&rect, point); }
inline friend auto operator<=>(const Box& lhs, const Box& rhs)
{
auto lhs_tuple = std::make_tuple(lhs.rect.left, lhs.rect.right, lhs.rect.top, lhs.rect.bottom);
auto rhs_tuple = std::make_tuple(rhs.rect.left, rhs.rect.right, rhs.rect.top, rhs.rect.bottom);
return lhs_tuple <=> rhs_tuple;
}
};
class MonitorInfo
struct MonitorInfo : ScreenSize
{
explicit MonitorInfo(HMONITOR monitor, RECT rect) :
handle(monitor), ScreenSize(rect) {}
HMONITOR handle;
MONITORINFOEX info = {};
public:
explicit MonitorInfo(HMONITOR h);
inline HMONITOR GetHandle() const
{
return handle;
}
Box GetScreenSize(const bool includeNonWorkingArea) const;
bool IsPrimary() const;
// Returns monitor rects ordered from left to right
static std::vector<MonitorInfo> GetMonitors(bool includeNonWorkingArea);
static MonitorInfo GetPrimaryMonitor();
};
bool operator==(const ScreenSize& lhs, const ScreenSize& rhs);

View File

@@ -3,6 +3,7 @@
// See the LICENSE file in the project root for more information.
using System;
using System.Linq;
using System.Runtime.InteropServices;
using Microsoft.Win32;

View File

@@ -25,22 +25,6 @@ namespace PTSettingsHelper
return result;
}
std::wstring get_local_low_folder_location()
{
PWSTR local_app_path;
winrt::check_hresult(SHGetKnownFolderPath(FOLDERID_LocalAppDataLow, 0, NULL, &local_app_path));
std::wstring result{ local_app_path };
CoTaskMemFree(local_app_path);
result += L"\\Microsoft\\PowerToys";
std::filesystem::path save_path(result);
if (!std::filesystem::exists(save_path))
{
std::filesystem::create_directories(save_path);
}
return result;
}
std::wstring get_module_save_folder_location(std::wstring_view powertoy_key)
{
std::wstring result = get_root_save_folder_location();

View File

@@ -12,7 +12,6 @@ namespace PTSettingsHelper
std::wstring get_module_save_file_location(std::wstring_view powertoy_key);
std::wstring get_module_save_folder_location(std::wstring_view powertoy_name);
std::wstring get_root_save_folder_location();
std::wstring get_local_low_folder_location();
void save_module_settings(std::wstring_view powertoy_name, json::JsonObject& settings);
json::JsonObject load_module_settings(std::wstring_view powertoy_name);

View File

@@ -20,6 +20,6 @@ To capture a trace for the PowerToys provider, run the following:
Open the trace.etl file in WPA.
## Additional Resources
[Tracelogging on Microsoft Learn](https://learn.microsoft.com/windows/win32/tracelogging/trace-logging-portal)
[Tracelogging on MSDN](https://docs.microsoft.com/en-us/windows/win32/tracelogging/trace-logging-portal)
[Recording and Viewing Events](https://learn.microsoft.com/windows/win32/tracelogging/tracelogging-record-and-display-tracelogging-events)
[Recording and Viewing Events](https://docs.microsoft.com/en-us/windows/win32/tracelogging/tracelogging-record-and-display-tracelogging-events)

View File

@@ -51,9 +51,6 @@
<TargetName>PowerToys.Interop</TargetName>
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
</PropertyGroup>
<PropertyGroup>
<CopyCppRuntimeToOutputDir>true</CopyCppRuntimeToOutputDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)'=='Debug'">
<ClCompile>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>

View File

@@ -25,7 +25,7 @@ using namespace System;
using namespace System::Runtime::InteropServices;
using System::Collections::Generic::List;
// https://learn.microsoft.com/cpp/dotnet/how-to-wrap-native-class-for-use-by-csharp?view=vs-2019
// https://docs.microsoft.com/en-us/cpp/dotnet/how-to-wrap-native-class-for-use-by-csharp?view=vs-2019
namespace interop
{
public
@@ -195,17 +195,8 @@ public
return gcnew String(CommonSharedConstants::SHOW_COLOR_PICKER_SHARED_EVENT);
}
static String ^ ShowPowerOCRSharedEvent() {
return gcnew String(CommonSharedConstants::SHOW_POWEROCR_SHARED_EVENT);
}
static String ^ AwakeExitEvent() {
return gcnew String(CommonSharedConstants::AWAKE_EXIT_EVENT);
}
static String ^ PowerAccentExitEvent() {
return gcnew String(CommonSharedConstants::POWERACCENT_EXIT_EVENT);
}
};
}

View File

@@ -38,12 +38,6 @@ namespace CommonSharedConstants
// Path to the event used by AlwaysOnTop
const wchar_t ALWAYS_ON_TOP_PIN_EVENT[] = L"Local\\AlwaysOnTopPinEvent-892e0aa2-cfa8-4cc4-b196-ddeb32314ce8";
// Path to the event used by PowerAccent
const wchar_t POWERACCENT_EXIT_EVENT[] = L"Local\\PowerToysPowerAccentExitEvent-53e93389-d19a-4fbb-9b36-1981c8965e17";
// Path to the event used by PowerOCR
const wchar_t SHOW_POWEROCR_SHARED_EVENT[] = L"Local\\PowerOCREvent-dc864e06-e1af-4ecc-9078-f98bee745e3a";
// Max DWORD for key code to disable keys.
const DWORD VK_DISABLED = 0x100;
}

View File

@@ -77,7 +77,7 @@ void TwoWayPipeMessageIPC::TwoWayPipeMessageIPCImpl::end()
void TwoWayPipeMessageIPC::TwoWayPipeMessageIPCImpl::send_pipe_message(std::wstring message)
{
// Adapted from https://learn.microsoft.com/windows/win32/ipc/named-pipe-client
// Adapted from https://docs.microsoft.com/en-us/windows/win32/ipc/named-pipe-client
HANDLE output_pipe_handle;
const wchar_t* message_send = message.c_str();
BOOL fSuccess = FALSE;
@@ -161,7 +161,7 @@ void TwoWayPipeMessageIPC::TwoWayPipeMessageIPCImpl::consume_output_queue_thread
BOOL TwoWayPipeMessageIPC::TwoWayPipeMessageIPCImpl::GetLogonSID(HANDLE hToken, PSID* ppsid)
{
// From https://learn.microsoft.com/previous-versions/aa446670(v=vs.85)
// From https://docs.microsoft.com/en-us/previous-versions/aa446670(v=vs.85)
BOOL bSuccess = FALSE;
DWORD dwIndex;
DWORD dwLength = 0;
@@ -240,7 +240,7 @@ Cleanup:
VOID TwoWayPipeMessageIPC::TwoWayPipeMessageIPCImpl::FreeLogonSID(PSID* ppsid)
{
// From https://learn.microsoft.com/previous-versions/aa446670(v=vs.85)
// From https://docs.microsoft.com/en-us/previous-versions/aa446670(v=vs.85)
HeapFree(GetProcessHeap(), 0, (LPVOID)*ppsid);
}
@@ -397,7 +397,7 @@ void TwoWayPipeMessageIPC::TwoWayPipeMessageIPCImpl::handle_pipe_connection(HAND
void TwoWayPipeMessageIPC::TwoWayPipeMessageIPCImpl::start_named_pipe_server(HANDLE token)
{
// Adapted from https://learn.microsoft.com/windows/win32/ipc/multithreaded-pipe-server
// Adapted from https://docs.microsoft.com/en-us/windows/win32/ipc/multithreaded-pipe-server
const wchar_t* pipe_name = input_pipe_name.c_str();
BOOL connected = FALSE;
HANDLE connect_pipe_handle = INVALID_HANDLE_VALUE;
@@ -465,4 +465,4 @@ void TwoWayPipeMessageIPC::TwoWayPipeMessageIPCImpl::consume_input_queue_thread(
}
outgoing_message = message;
}
}
}

View File

@@ -18,13 +18,11 @@ struct LogSettings
inline const static std::string launcherLoggerName = "launcher";
inline const static std::wstring launcherLogPath = L"LogsModuleInterface\\launcher-log.txt";
inline const static std::wstring awakeLogPath = L"Logs\\awake-log.txt";
inline const static std::wstring powerAccentLogPath = L"quick-accent-log.txt";
inline const static std::string fancyZonesLoggerName = "fancyzones";
inline const static std::wstring fancyZonesLogPath = L"fancyzones-log.txt";
inline const static std::wstring fancyZonesOldLogPath = L"FancyZonesLogs\\"; // needed to clean up old logs
inline const static std::string shortcutGuideLoggerName = "shortcut-guide";
inline const static std::wstring shortcutGuideLogPath = L"ShortcutGuideLogs\\shortcut-guide-log.txt";
inline const static std::wstring powerOcrLogPath = L"Logs\\text-extractor-log.txt";
inline const static std::string keyboardManagerLoggerName = "keyboard-manager";
inline const static std::wstring keyboardManagerLogPath = L"Logs\\keyboard-manager-log.txt";
inline const static std::string findMyMouseLoggerName = "find-my-mouse";
@@ -33,7 +31,6 @@ struct LogSettings
inline const static std::string imageResizerLoggerName = "imageresizer";
inline const static std::string powerRenameLoggerName = "powerrename";
inline const static std::string alwaysOnTopLoggerName = "always-on-top";
inline const static std::string powerOcrLoggerName = "TextExtractor";
inline const static std::wstring alwaysOnTopLogPath = L"always-on-top-log.txt";
inline const static int retention = 30;
std::wstring logLevel;

View File

@@ -244,7 +244,7 @@ void notifications::show_toast_with_activations(std::wstring message,
toast_params params)
{
// DO NOT LOCALIZE any string in this function, because they're XML tags and a subject to
// https://learn.microsoft.com/windows/uwp/design/shell/tiles-and-notifications/toast-xml-schema
// https://docs.microsoft.com/en-us/windows/uwp/design/shell/tiles-and-notifications/toast-xml-schema
std::wstring toast_xml;
toast_xml.reserve(2048);

View File

@@ -9,10 +9,10 @@ struct UpdateState
{
enum State
{
upToDate = 0,
errorDownloading = 1,
readyToDownload = 2,
readyToInstall = 3
upToDate = 0,
errorDownloading = 1,
readyToDownload = 2,
readyToInstall = 3
} state = upToDate;
std::wstring releasePageUrl;
std::optional<std::time_t> githubUpdateLastCheckedDate;

View File

@@ -7,7 +7,6 @@ public:
HDropIterator(IDataObject* pDataObject)
{
_current = 0;
_listCount = 0;
FORMATETC formatetc = {
CF_HDROP,
@@ -17,22 +16,14 @@ public:
TYMED_HGLOBAL
};
if (SUCCEEDED(pDataObject->GetData(&formatetc, &m_medium)))
{
_listCount = DragQueryFile((HDROP)m_medium.hGlobal, 0xFFFFFFFF, NULL, 0);
}
else
{
m_medium = {};
}
pDataObject->GetData(&formatetc, &m_medium);
_listCount = DragQueryFile((HDROP)m_medium.hGlobal, 0xFFFFFFFF, NULL, 0);
}
~HDropIterator()
{
if (m_medium.tymed)
{
ReleaseStgMedium(&m_medium);
}
ReleaseStgMedium(&m_medium);
}
void First()

View File

@@ -156,7 +156,7 @@ inline void LogStackTrace()
Logger::error(L"Failed to capture context. {}", get_last_error_or_default(GetLastError()));
return;
}
STACKFRAME64 stack;
memset(&stack, 0, sizeof(STACKFRAME64));
@@ -238,14 +238,14 @@ inline LONG WINAPI UnhandledExceptionHandler(PEXCEPTION_POINTERS info)
}
/* Handler to trap abort() calls */
inline void AbortHandler(int /*signal_number*/)
inline void AbortHandler(int signal_number)
{
Logger::error("--- ABORT");
try
{
LogStackTrace();
}
catch (...)
catch(...)
{
Logger::error("Failed to log stack trace on abort");
Logger::flush();
@@ -271,9 +271,9 @@ inline void InitUnhandledExceptionHandler(void)
// Global handler for unhandled exceptions
SetUnhandledExceptionFilter(UnhandledExceptionHandler);
// Handler for abort()
signal(SIGABRT, &AbortHandler);
signal(SIGABRT, &AbortHandler);
}
catch (...)
catch(...)
{
Logger::error("Failed to init global unhandled exception handler");
}

View File

@@ -102,7 +102,7 @@ namespace package {
return true;
}
catch (std::exception& e)
catch (std::exception e)
{
Logger::error("Exception thrown while trying to register package: {}", e.what());

View File

@@ -378,12 +378,6 @@ namespace registry
std::wstring kindMapPath = L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\KindMap";
changes.push_back({ HKEY_LOCAL_MACHINE, kindMapPath, fileType, fileKindType, false});
}
if (handlerType == PreviewHandlerType::preview && fileType == L".reg")
{
// this regfile registry key has precedence over Software\Classes\.reg for .reg files
std::wstring regfilePath = L"Software\\Classes\\regfile\\shellex\\" + IPREVIEW_HANDLER_CLSID + L"\\";
changes.push_back({ scope, regfilePath, std::nullopt, handlerClsid });
}
}
if (handlerType == PreviewHandlerType::preview)

View File

@@ -1,30 +0,0 @@
#pragma once
#include <functional>
#include <shared_mutex>
template<typename StateT>
class Serialized
{
mutable std::shared_mutex m;
StateT s;
public:
void Read(std::function<void(const StateT&)> fn) const
{
std::shared_lock lock{ m };
fn(s);
}
void Access(std::function<void(StateT&)> fn)
{
std::unique_lock lock{ m };
fn(s);
}
void Reset()
{
std::unique_lock lock{ m };
s = {};
}
};

View File

@@ -25,7 +25,7 @@ inline std::optional<std::wstring> get_last_error_message(const DWORD dw)
inline std::wstring get_last_error_or_default(const DWORD dw)
{
auto message = get_last_error_message(dw);
return message.has_value() ? *message : L"";
return message.has_value() ? message.value() : L"";
}
inline void show_last_error_message(const wchar_t* functionName, DWORD dw, const wchar_t* errorTitle)

View File

@@ -8,24 +8,24 @@
#include <optional>
// Initializes and runs windows message loop
inline int run_message_loop(const bool until_idle = false, const std::optional<uint32_t> timeout_ms = {})
inline int run_message_loop(const bool until_idle = false, const std::optional<uint32_t> timeout_seconds = {})
{
MSG msg{};
bool stop = false;
UINT_PTR timerId = 0;
if (timeout_ms.has_value())
if (timeout_seconds.has_value())
{
timerId = SetTimer(nullptr, 0, *timeout_ms, nullptr);
timerId = SetTimer(nullptr, 0, *timeout_seconds * 1000, nullptr);
}
while (!stop && (until_idle ? PeekMessageW(&msg, nullptr, 0, 0, PM_REMOVE) : GetMessageW(&msg, nullptr, 0, 0)))
while (!stop && GetMessageW(&msg, nullptr, 0, 0))
{
TranslateMessage(&msg);
DispatchMessageW(&msg);
stop = until_idle && !PeekMessageW(&msg, nullptr, 0, 0, PM_NOREMOVE);
stop = stop || (msg.message == WM_TIMER && msg.wParam == timerId);
}
if (timeout_ms.has_value())
if (timeout_seconds.has_value())
{
KillTimer(nullptr, timerId);
}
@@ -55,24 +55,3 @@ inline bool is_system_window(HWND hwnd, const char* class_name)
}
return false;
}
template<typename T>
inline T GetWindowCreateParam(LPARAM lparam)
{
static_assert(sizeof(T) <= sizeof(void*));
T data{ (T)(reinterpret_cast<CREATESTRUCT*>(lparam)->lpCreateParams) };
return data;
}
template<typename T>
inline void StoreWindowParam(HWND window, T data)
{
static_assert(sizeof(T) <= sizeof(void*));
SetWindowLongPtrW(window, GWLP_USERDATA, reinterpret_cast<LONG_PTR>(data));
}
template<typename T>
inline T GetWindowParam(HWND window)
{
return (T)GetWindowLongPtrW(window, GWLP_USERDATA);
}

View File

@@ -1,73 +0,0 @@
#include "pch.h"
#include "BGRATextureView.h"
#if defined(DEBUG_TEXTURE)
void BGRATextureView::SaveAsBitmap(const char* filename) const
{
wil::unique_hbitmap bitmap{ CreateBitmap(static_cast<int>(pitch), static_cast<int>(height), 1, 32, pixels) };
const HBITMAP hBitmap = bitmap.get();
DWORD dwPaletteSize = 0, dwBmBitsSize = 0, dwDIBSize = 0, dwWritten = 0;
LPBITMAPINFOHEADER lpBitmapInfo;
HANDLE hDib, hPal, hOldPal2 = NULL;
HDC hDC = CreateDC(TEXT("DISPLAY"), NULL, NULL, NULL);
const int iBits = GetDeviceCaps(hDC, BITSPIXEL) * GetDeviceCaps(hDC, PLANES);
DeleteDC(hDC);
WORD wBitCount = 24;
if (iBits <= 1)
wBitCount = 1;
else if (iBits <= 4)
wBitCount = 4;
else if (iBits <= 8)
wBitCount = 8;
BITMAP Bitmap0;
GetObject(hBitmap, sizeof(Bitmap0), (LPSTR)&Bitmap0);
BITMAPINFOHEADER bi = {};
bi.biSize = sizeof(BITMAPINFOHEADER);
bi.biWidth = Bitmap0.bmWidth;
bi.biHeight = -Bitmap0.bmHeight;
bi.biPlanes = 1;
bi.biBitCount = wBitCount;
bi.biCompression = BI_RGB;
bi.biClrUsed = 256;
dwBmBitsSize = ((Bitmap0.bmWidth * wBitCount + 31) & ~31) / 8 * Bitmap0.bmHeight;
hDib = GlobalAlloc(GHND, dwBmBitsSize + dwPaletteSize + sizeof(BITMAPINFOHEADER));
lpBitmapInfo = (LPBITMAPINFOHEADER)GlobalLock(hDib);
*lpBitmapInfo = bi;
hPal = GetStockObject(DEFAULT_PALETTE);
if (hPal)
{
hDC = GetDC(NULL);
hOldPal2 = SelectPalette(hDC, (HPALETTE)hPal, FALSE);
RealizePalette(hDC);
}
GetDIBits(hDC, hBitmap, 0, (UINT)Bitmap0.bmHeight, (LPSTR)lpBitmapInfo + sizeof(BITMAPINFOHEADER) + dwPaletteSize, (BITMAPINFO*)lpBitmapInfo, DIB_RGB_COLORS);
if (hOldPal2)
{
SelectPalette(hDC, (HPALETTE)hOldPal2, TRUE);
RealizePalette(hDC);
ReleaseDC(NULL, hDC);
}
wil::unique_handle fh{ CreateFileA(filename, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, NULL) };
if (!fh)
return;
BITMAPFILEHEADER bitmapFileHeader = {};
bitmapFileHeader.bfType = 0x4D42; // "BM"
dwDIBSize = sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER) + dwPaletteSize + dwBmBitsSize;
bitmapFileHeader.bfSize = dwDIBSize;
bitmapFileHeader.bfOffBits = (DWORD)sizeof(BITMAPFILEHEADER) + (DWORD)sizeof(BITMAPINFOHEADER) + dwPaletteSize;
WriteFile(fh.get(), (LPSTR)&bitmapFileHeader, sizeof(BITMAPFILEHEADER), &dwWritten, NULL);
WriteFile(fh.get(), (LPSTR)lpBitmapInfo, dwDIBSize, &dwWritten, NULL);
GlobalUnlock(hDib);
GlobalFree(hDib);
}
#endif

View File

@@ -1,169 +0,0 @@
#pragma once
#include <cinttypes>
#include <wil/resource.h>
#ifdef _M_ARM64
#include <arm64_neon.h.>
#else
#include <emmintrin.h>
#endif
#include <cassert>
#include <limits>
#include <d3d11.h>
//#define DEBUG_TEXTURE
#if defined(_M_ARM64)
// Adopted from https://github.com/DLTcollab/sse2neon/blob/master/sse2neon.h
using __m128i = int64x2_t;
inline __m128i _mm_cvtsi32_si128(int a)
{
return vreinterpretq_s64_s32(vsetq_lane_s32(a, vdupq_n_s32(0), 0));
}
inline __m128i _mm_or_si128(__m128i a, __m128i b)
{
return vreinterpretq_s64_s32(
vorrq_s32(vreinterpretq_s32_s64(a), vreinterpretq_s32_s64(b)));
}
inline __m128i _mm_subs_epu8(__m128i a, __m128i b)
{
return vreinterpretq_s64_u8(
vqsubq_u8(vreinterpretq_u8_s64(a), vreinterpretq_u8_s64(b)));
}
inline __m128i _mm_sad_epu8(__m128i a, __m128i b)
{
uint16x8_t t = vpaddlq_u8(vabdq_u8((uint8x16_t)a, (uint8x16_t)b));
return vreinterpretq_s64_u64(vpaddlq_u32(vpaddlq_u16(t)));
}
inline __m128i _mm_setzero_si128(void)
{
return vreinterpretq_s64_s32(vdupq_n_s32(0));
}
inline int _mm_cvtsi128_si32(__m128i a)
{
return vgetq_lane_s32(vreinterpretq_s32_s64(a), 0);
}
inline __m128i _mm_set1_epi16(short w)
{
return vreinterpretq_s64_s16(vdupq_n_s16(w));
}
inline __m128i _mm_cmpgt_epi16(__m128i a, __m128i b)
{
return vreinterpretq_s64_u16(
vcgtq_s16(vreinterpretq_s16_s64(a), vreinterpretq_s16_s64(b)));
}
inline __m128i _mm_cvtepu8_epi16(__m128i a)
{
uint8x16_t u8x16 = vreinterpretq_u8_s64(a); /* xxxx xxxx HGFE DCBA */
uint16x8_t u16x8 = vmovl_u8(vget_low_u8(u8x16)); /* 0H0G 0F0E 0D0C 0B0A */
return vreinterpretq_s64_u16(u16x8);
}
inline int64_t _mm_cvtsi128_si64(__m128i a)
{
return vgetq_lane_s64(a, 0);
}
#endif
inline __m128i distance_epu8(const __m128i a, __m128i b)
{
return _mm_or_si128(_mm_subs_epu8(a, b),
_mm_subs_epu8(b, a));
}
struct BGRATextureView
{
const uint32_t* pixels = nullptr;
size_t pitch = {};
size_t width = {};
size_t height = {};
BGRATextureView() = default;
BGRATextureView(BGRATextureView&& rhs) = default;
inline uint32_t GetPixel(const size_t x, const size_t y) const
{
assert(x < width && x >= 0);
assert(y < height && y >= 0);
return pixels[x + pitch * y];
}
template<bool perChannel>
static inline bool PixelsClose(const uint32_t pixel1, const uint32_t pixel2, uint8_t tolerance)
{
const __m128i rgba1 = _mm_cvtsi32_si128(pixel1);
const __m128i rgba2 = _mm_cvtsi32_si128(pixel2);
const __m128i distances = distance_epu8(rgba1, rgba2);
// Method 1: Test whether each channel distance is not greater than tolerance
if constexpr (perChannel)
{
const __m128i tolerances = _mm_set1_epi16(tolerance);
const auto gtResults128 = _mm_cmpgt_epi16(_mm_cvtepu8_epi16(distances), tolerances);
return _mm_cvtsi128_si64(gtResults128) == 0;
}
else
{
// Method 2: Test whether sum of all channel differences is smaller than tolerance
const int32_t score = _mm_cvtsi128_si32(_mm_sad_epu8(distances, _mm_setzero_si128())) & std::numeric_limits<uint8_t>::max();
return score <= tolerance;
}
}
#if defined(DEBUG_TEXTURE)
void SaveAsBitmap(const char* filename) const;
#endif
};
class MappedTextureView
{
winrt::com_ptr<ID3D11DeviceContext> context;
winrt::com_ptr<ID3D11Texture2D> texture;
public:
BGRATextureView view;
MappedTextureView(winrt::com_ptr<ID3D11Texture2D> _texture,
winrt::com_ptr<ID3D11DeviceContext> _context,
const size_t textureWidth,
const size_t textureHeight) :
texture{ std::move(_texture) }, context{ std::move(_context) }
{
D3D11_TEXTURE2D_DESC desc;
texture->GetDesc(&desc);
D3D11_MAPPED_SUBRESOURCE resource = {};
winrt::check_hresult(context->Map(texture.get(), D3D11CalcSubresource(0, 0, 0), D3D11_MAP_READ, 0, &resource));
view.pixels = static_cast<const uint32_t*>(resource.pData);
view.pitch = resource.RowPitch / 4;
view.width = textureWidth;
view.height = textureHeight;
}
MappedTextureView(MappedTextureView&&) = default;
MappedTextureView& operator=(MappedTextureView&&) = default;
inline winrt::com_ptr<ID3D11Texture2D> GetTexture() const
{
return texture;
}
~MappedTextureView()
{
if (context && texture)
context->Unmap(texture.get(), D3D11CalcSubresource(0, 0, 0));
}
};

View File

@@ -1,289 +0,0 @@
#include "pch.h"
#include "BoundsToolOverlayUI.h"
#include "CoordinateSystemConversion.h"
#include "Clipboard.h"
#include <common/utils/window.h>
#define MOUSEEVENTF_FROMTOUCH 0xFF515700
namespace
{
void ToggleCursor(const bool show)
{
if (show)
{
for (; ShowCursor(show) < 0;)
;
}
else
{
for (; ShowCursor(show) >= 0;)
;
}
}
void HandleCursorMove(HWND window, BoundsToolState* toolState, const POINT cursorPos, const DWORD touchID = 0)
{
if (!toolState->perScreen[window].currentBounds || (toolState->perScreen[window].currentBounds->touchID != touchID))
return;
toolState->perScreen[window].currentBounds->currentPos =
D2D_POINT_2F{ .x = static_cast<float>(cursorPos.x), .y = static_cast<float>(cursorPos.y) };
}
void HandleCursorDown(HWND window, BoundsToolState* toolState, const POINT cursorPos, const DWORD touchID = 0)
{
ToggleCursor(false);
RECT windowRect;
if (GetWindowRect(window, &windowRect))
ClipCursor(&windowRect);
const D2D_POINT_2F newBoundsStart = { .x = static_cast<float>(cursorPos.x), .y = static_cast<float>(cursorPos.y) };
toolState->perScreen[window].currentBounds = CursorDrag{
.startPos = newBoundsStart,
.currentPos = newBoundsStart,
.touchID = touchID
};
}
void HandleCursorUp(HWND window, BoundsToolState* toolState, const POINT cursorPos)
{
ToggleCursor(true);
ClipCursor(nullptr);
toolState->commonState->overlayBoxText.Read([](const OverlayBoxText& text) {
SetClipBoardToText(text.buffer);
});
if (const bool shiftPress = GetKeyState(VK_SHIFT) & 0x8000; shiftPress && toolState->perScreen[window].currentBounds)
{
D2D1_RECT_F rect;
std::tie(rect.left, rect.right) =
std::minmax(static_cast<float>(cursorPos.x), toolState->perScreen[window].currentBounds->startPos.x);
std::tie(rect.top, rect.bottom) =
std::minmax(static_cast<float>(cursorPos.y), toolState->perScreen[window].currentBounds->startPos.y);
toolState->perScreen[window].measurements.push_back(Measurement{ rect });
}
toolState->perScreen[window].currentBounds = std::nullopt;
}
}
LRESULT CALLBACK BoundsToolWndProc(HWND window, UINT message, WPARAM wparam, LPARAM lparam) noexcept
{
switch (message)
{
case WM_CREATE:
{
auto toolState = GetWindowCreateParam<BoundsToolState*>(lparam);
StoreWindowParam(window, toolState);
break;
}
case WM_ERASEBKGND:
return 1;
case WM_KEYUP:
if (wparam == VK_ESCAPE)
{
PostMessageW(window, WM_CLOSE, {}, {});
}
break;
case WM_LBUTTONDOWN:
{
const bool touchEvent = (GetMessageExtraInfo() & MOUSEEVENTF_FROMTOUCH) == MOUSEEVENTF_FROMTOUCH;
if (touchEvent)
break;
auto toolState = GetWindowParam<BoundsToolState*>(window);
if (!toolState)
break;
HandleCursorDown(window,
toolState,
convert::FromSystemToWindow(window, toolState->commonState->cursorPosSystemSpace));
break;
}
case WM_CURSOR_LEFT_MONITOR:
{
ToggleCursor(true);
ClipCursor(nullptr);
auto toolState = GetWindowParam<BoundsToolState*>(window);
if (!toolState)
break;
toolState->perScreen[window].currentBounds = std::nullopt;
break;
}
case WM_TOUCH:
{
auto toolState = GetWindowParam<BoundsToolState*>(window);
if (!toolState)
break;
std::array<TOUCHINPUT, 8> inputs;
const size_t nInputs = std::min(static_cast<size_t>(LOWORD(wparam)), inputs.size());
const auto inputHandle = std::bit_cast<HTOUCHINPUT>(lparam);
GetTouchInputInfo(inputHandle, static_cast<UINT>(nInputs), inputs.data(), sizeof(TOUCHINPUT));
for (UINT i = 0; i < nInputs; ++i)
{
const auto& input = inputs[i];
if (const bool down = (input.dwFlags & TOUCHEVENTF_DOWN) && (input.dwFlags & TOUCHEVENTF_PRIMARY); down)
{
HandleCursorDown(
window,
toolState,
POINT{ TOUCH_COORD_TO_PIXEL(input.x), TOUCH_COORD_TO_PIXEL(input.y) },
input.dwID);
continue;
}
if (const bool up = input.dwFlags & TOUCHEVENTF_UP; up)
{
HandleCursorUp(
window,
toolState,
POINT{ TOUCH_COORD_TO_PIXEL(input.x), TOUCH_COORD_TO_PIXEL(input.y) });
continue;
}
if (const bool move = input.dwFlags & TOUCHEVENTF_MOVE; move)
{
HandleCursorMove(window,
toolState,
POINT{ TOUCH_COORD_TO_PIXEL(input.x), TOUCH_COORD_TO_PIXEL(input.y) },
input.dwID);
continue;
}
}
CloseTouchInputHandle(inputHandle);
break;
}
case WM_MOUSEMOVE:
{
const bool touchEvent = (GetMessageExtraInfo() & MOUSEEVENTF_FROMTOUCH) == MOUSEEVENTF_FROMTOUCH;
if (touchEvent)
break;
auto toolState = GetWindowParam<BoundsToolState*>(window);
if (!toolState)
break;
HandleCursorMove(window,
toolState,
convert::FromSystemToWindow(window, toolState->commonState->cursorPosSystemSpace));
break;
}
case WM_LBUTTONUP:
{
const bool touchEvent = (GetMessageExtraInfo() & MOUSEEVENTF_FROMTOUCH) == MOUSEEVENTF_FROMTOUCH;
if (touchEvent)
break;
auto toolState = GetWindowParam<BoundsToolState*>(window);
if (!toolState)
break;
HandleCursorUp(window,
toolState,
convert::FromSystemToWindow(window, toolState->commonState->cursorPosSystemSpace));
break;
}
case WM_RBUTTONUP:
{
const bool touchEvent = (GetMessageExtraInfo() & MOUSEEVENTF_FROMTOUCH) == MOUSEEVENTF_FROMTOUCH;
if (touchEvent)
break;
ToggleCursor(true);
auto toolState = GetWindowParam<BoundsToolState*>(window);
if (!toolState)
break;
if (toolState->perScreen[window].currentBounds)
toolState->perScreen[window].currentBounds = std::nullopt;
else
{
if (toolState->perScreen[window].measurements.empty())
PostMessageW(window, WM_CLOSE, {}, {});
else
toolState->perScreen[window].measurements.clear();
}
break;
}
}
return DefWindowProcW(window, message, wparam, lparam);
}
namespace
{
void DrawMeasurement(const Measurement& measurement,
const CommonState& commonState,
HWND window,
const D2DState& d2dState,
std::optional<D2D_POINT_2F> textBoxCenter)
{
const bool screenQuadrantAware = textBoxCenter.has_value();
d2dState.ToggleAliasedLinesMode(true);
d2dState.dxgiWindowState.rt->DrawRectangle(measurement.rect, d2dState.solidBrushes[Brush::line].get());
d2dState.ToggleAliasedLinesMode(false);
OverlayBoxText text;
const auto [crossSymbolPos, measureStringBufLen] =
measurement.Print(text.buffer.data(),
text.buffer.size(),
true,
true,
commonState.units);
commonState.overlayBoxText.Access([&](OverlayBoxText& v) {
v = text;
});
D2D_POINT_2F textBoxPos;
if (textBoxCenter)
textBoxPos = *textBoxCenter;
else
{
textBoxPos.x = measurement.rect.left + measurement.Width(Measurement::Unit::Pixel) / 2;
textBoxPos.y = measurement.rect.top + measurement.Height(Measurement::Unit::Pixel) / 2;
}
d2dState.DrawTextBox(text.buffer.data(),
measureStringBufLen,
crossSymbolPos,
textBoxPos,
screenQuadrantAware,
window);
}
}
void DrawBoundsToolTick(const CommonState& commonState,
const BoundsToolState& toolState,
const HWND window,
const D2DState& d2dState)
{
const auto it = toolState.perScreen.find(window);
if (it == end(toolState.perScreen))
return;
d2dState.dxgiWindowState.rt->Clear();
const auto& perScreen = it->second;
for (const auto& measure : perScreen.measurements)
DrawMeasurement(measure, commonState, window, d2dState, {});
if (perScreen.currentBounds.has_value())
{
D2D1_RECT_F rect;
std::tie(rect.left, rect.right) = std::minmax(perScreen.currentBounds->startPos.x, perScreen.currentBounds->currentPos.x);
std::tie(rect.top, rect.bottom) = std::minmax(perScreen.currentBounds->startPos.y, perScreen.currentBounds->currentPos.y);
DrawMeasurement(Measurement{ rect }, commonState, window, d2dState, perScreen.currentBounds->currentPos);
}
}

View File

@@ -1,10 +0,0 @@
#pragma once
#include "D2DState.h"
#include "ToolState.h"
void DrawBoundsToolTick(const CommonState& commonState,
const BoundsToolState& toolState,
const HWND overlayWindow,
const D2DState& d2dState);
LRESULT CALLBACK BoundsToolWndProc(HWND window, UINT message, WPARAM wparam, LPARAM lparam) noexcept;

View File

@@ -1,28 +0,0 @@
#include "pch.h"
#include "Clipboard.h"
void SetClipBoardToText(const std::wstring_view text)
{
if (!OpenClipboard(nullptr))
{
return;
}
const wil::unique_hglobal handle{ GlobalAlloc(GMEM_MOVEABLE, static_cast<size_t>((text.length() + 1) * sizeof(wchar_t))) };
if (!handle)
{
CloseClipboard();
return;
}
if (auto* bufPtr = static_cast<wchar_t*>(GlobalLock(handle.get())); bufPtr != nullptr)
{
text.copy(bufPtr, text.length());
GlobalUnlock(handle.get());
}
EmptyClipboard();
SetClipboardData(CF_UNICODETEXT, handle.get());
CloseClipboard();
}

View File

@@ -1,5 +0,0 @@
#pragma once
#include <string_view>
void SetClipBoardToText(const std::wstring_view text);

View File

@@ -1,14 +0,0 @@
#pragma once
#define WIN32_LEAN_AND_MEAN
#include <Windows.h>
namespace convert
{
// Converts a given point from multi-monitor coordinate system to the one relative to HWND
inline POINT FromSystemToWindow(HWND window, POINT p)
{
ScreenToClient(window, &p);
return p;
}
}

View File

@@ -1,174 +0,0 @@
#include "pch.h"
#include "constants.h"
#include "D2DState.h"
#include "DxgiAPI.h"
#include <common/Display/dpi_aware.h>
#include <ToolState.h>
namespace
{
void DetermineScreenQuadrant(const HWND window, long x, long y, bool& inLeftHalf, bool& inTopHalf)
{
RECT windowRect{};
GetWindowRect(window, &windowRect);
const long w = windowRect.right - windowRect.left;
const long h = windowRect.bottom - windowRect.top;
inLeftHalf = x < w / 2;
inTopHalf = y < h / 2;
}
}
D2DState::D2DState(const DxgiAPI* dxgi,
HWND window,
std::vector<D2D1::ColorF> solidBrushesColors)
{
dxgiAPI = dxgi;
unsigned dpi = DPIAware::DEFAULT_DPI;
DPIAware::GetScreenDPIForWindow(window, dpi);
dpiScale = dpi / static_cast<float>(DPIAware::DEFAULT_DPI);
dxgiWindowState = dxgiAPI->CreateD2D1RenderTarget(window);
winrt::check_hresult(dxgiWindowState.rt->CreateCompatibleRenderTarget(bitmapRt.put()));
winrt::check_hresult(dxgiAPI->writeFactory->CreateTextFormat(L"Segoe UI Variable Text",
nullptr,
DWRITE_FONT_WEIGHT_NORMAL,
DWRITE_FONT_STYLE_NORMAL,
DWRITE_FONT_STRETCH_NORMAL,
consts::FONT_SIZE * dpiScale,
L"en-US",
textFormat.put()));
winrt::check_hresult(textFormat->SetTextAlignment(DWRITE_TEXT_ALIGNMENT_CENTER));
winrt::check_hresult(textFormat->SetParagraphAlignment(DWRITE_PARAGRAPH_ALIGNMENT_CENTER));
winrt::check_hresult(textFormat->SetWordWrapping(DWRITE_WORD_WRAPPING_NO_WRAP));
solidBrushes.resize(solidBrushesColors.size());
for (size_t i = 0; i < solidBrushes.size(); ++i)
{
winrt::check_hresult(dxgiWindowState.rt->CreateSolidColorBrush(solidBrushesColors[i], solidBrushes[i].put()));
}
const auto deviceContext = dxgiWindowState.rt.as<ID2D1DeviceContext>();
winrt::check_hresult(deviceContext->CreateEffect(CLSID_D2D1Shadow, shadowEffect.put()));
winrt::check_hresult(shadowEffect->SetValue(D2D1_SHADOW_PROP_BLUR_STANDARD_DEVIATION, consts::SHADOW_RADIUS));
winrt::check_hresult(shadowEffect->SetValue(D2D1_SHADOW_PROP_COLOR, D2D1::ColorF(0.f, 0.f, 0.f, consts::SHADOW_OPACITY)));
winrt::check_hresult(deviceContext->CreateEffect(CLSID_D2D12DAffineTransform, affineTransformEffect.put()));
affineTransformEffect->SetInputEffect(0, shadowEffect.get());
textRenderer = winrt::make_self<PerGlyphOpacityTextRender>(dxgi->d2dFactory2, dxgiWindowState.rt, solidBrushes[Brush::foreground]);
}
void D2DState::DrawTextBox(const wchar_t* text,
const size_t textLen,
const std::optional<size_t> halfOpaqueSymbolPos,
const D2D_POINT_2F center,
const bool screenQuadrantAware,
const HWND window) const
{
wil::com_ptr<IDWriteTextLayout> textLayout;
winrt::check_hresult(
dxgiAPI->writeFactory->CreateTextLayout(text,
static_cast<uint32_t>(textLen),
textFormat.get(),
std::numeric_limits<float>::max(),
std::numeric_limits<float>::max(),
&textLayout));
DWRITE_TEXT_METRICS textMetrics = {};
winrt::check_hresult(textLayout->GetMetrics(&textMetrics));
// Assumes text doesn't contain new lines
const float lineHeight = textMetrics.height;
textMetrics.width += lineHeight;
textMetrics.height += lineHeight * .5f;
winrt::check_hresult(textLayout->SetMaxWidth(textMetrics.width));
winrt::check_hresult(textLayout->SetMaxHeight(textMetrics.height));
D2D1_RECT_F textRect{ .left = center.x - textMetrics.width / 2.f,
.top = center.y - textMetrics.height / 2.f,
.right = center.x + textMetrics.width / 2.f,
.bottom = center.y + textMetrics.height / 2.f };
const float SHADOW_OFFSET = consts::SHADOW_OFFSET * dpiScale;
if (screenQuadrantAware)
{
bool cursorInLeftScreenHalf = false;
bool cursorInTopScreenHalf = false;
DetermineScreenQuadrant(window,
static_cast<long>(center.x),
static_cast<long>(center.y),
cursorInLeftScreenHalf,
cursorInTopScreenHalf);
float textQuadrantOffsetX = textMetrics.width / 2.f + SHADOW_OFFSET;
float textQuadrantOffsetY = textMetrics.height / 2.f + SHADOW_OFFSET;
if (!cursorInLeftScreenHalf)
textQuadrantOffsetX *= -1.f;
if (!cursorInTopScreenHalf)
textQuadrantOffsetY *= -1.f;
textRect.left += textQuadrantOffsetX;
textRect.right += textQuadrantOffsetX;
textRect.top += textQuadrantOffsetY;
textRect.bottom += textQuadrantOffsetY;
}
// Draw shadow
bitmapRt->BeginDraw();
bitmapRt->Clear(D2D1::ColorF(0.f, 0.f, 0.f, 0.f));
D2D1_ROUNDED_RECT textBoxRect;
textBoxRect.radiusX = textBoxRect.radiusY = consts::TEXT_BOX_CORNER_RADIUS * dpiScale;
textBoxRect.rect.bottom = textRect.bottom;
textBoxRect.rect.top = textRect.top;
textBoxRect.rect.left = textRect.left;
textBoxRect.rect.right = textRect.right;
bitmapRt->FillRoundedRectangle(textBoxRect, solidBrushes[Brush::border].get());
bitmapRt->EndDraw();
wil::com_ptr<ID2D1Bitmap> rtBitmap;
bitmapRt->GetBitmap(&rtBitmap);
shadowEffect->SetInput(0, rtBitmap.get());
const auto shadowMatrix = D2D1::Matrix3x2F::Translation(SHADOW_OFFSET, SHADOW_OFFSET);
winrt::check_hresult(affineTransformEffect->SetValue(D2D1_2DAFFINETRANSFORM_PROP_TRANSFORM_MATRIX,
shadowMatrix));
auto deviceContext = dxgiWindowState.rt.as<ID2D1DeviceContext>();
deviceContext->DrawImage(affineTransformEffect.get(), D2D1_INTERPOLATION_MODE_LINEAR);
// Draw text box border rectangle
dxgiWindowState.rt->DrawRoundedRectangle(textBoxRect, solidBrushes[Brush::border].get());
const float TEXT_BOX_PADDING = 1.f * dpiScale;
textBoxRect.rect.bottom -= TEXT_BOX_PADDING;
textBoxRect.rect.top += TEXT_BOX_PADDING;
textBoxRect.rect.left += TEXT_BOX_PADDING;
textBoxRect.rect.right -= TEXT_BOX_PADDING;
// Draw text & its box
dxgiWindowState.rt->FillRoundedRectangle(textBoxRect, solidBrushes[Brush::background].get());
if (halfOpaqueSymbolPos.has_value())
{
DWRITE_TEXT_RANGE textRange = { static_cast<uint32_t>(*halfOpaqueSymbolPos), 2 };
auto opacityEffect = winrt::make_self<OpacityEffect>();
opacityEffect->alpha = consts::CROSS_OPACITY;
winrt::check_hresult(textLayout->SetDrawingEffect(opacityEffect.get(), textRange));
}
winrt::check_hresult(textLayout->Draw(nullptr, textRenderer.get(), textRect.left, textRect.top));
}
void D2DState::ToggleAliasedLinesMode(const bool enabled) const
{
if (enabled)
{
// Draw lines in the middle of a pixel to avoid bleeding, since [0,0] pixel is
// a rectangle filled from (0,0) to (1,1) and the lines use thickness = 1.
dxgiWindowState.rt->SetTransform(D2D1::Matrix3x2F::Translation(.5f, .5f));
dxgiWindowState.rt->SetAntialiasMode(D2D1_ANTIALIAS_MODE_ALIASED);
}
else
{
dxgiWindowState.rt->SetTransform(D2D1::Matrix3x2F::Identity());
dxgiWindowState.rt->SetAntialiasMode(D2D1_ANTIALIAS_MODE_PER_PRIMITIVE);
}
}

View File

@@ -1,43 +0,0 @@
#pragma once
#include <optional>
#include <vector>
#include <windef.h>
#include "DxgiAPI.h"
#include "PerGlyphOpacityTextRender.h"
enum Brush : size_t
{
line,
foreground,
background,
border
};
struct D2DState
{
const DxgiAPI* dxgiAPI = nullptr;
DxgiWindowState dxgiWindowState;
winrt::com_ptr<ID2D1BitmapRenderTarget> bitmapRt;
winrt::com_ptr<IDWriteTextFormat> textFormat;
winrt::com_ptr<PerGlyphOpacityTextRender> textRenderer;
std::vector<winrt::com_ptr<ID2D1SolidColorBrush>> solidBrushes;
winrt::com_ptr<ID2D1Effect> shadowEffect;
winrt::com_ptr<ID2D1Effect> affineTransformEffect;
float dpiScale = 1.f;
D2DState(const DxgiAPI*,
HWND window,
std::vector<D2D1::ColorF> solidBrushesColors);
void DrawTextBox(const wchar_t* text,
const size_t textLen,
const std::optional<size_t> halfOpaqueSymbolPos,
const D2D_POINT_2F center,
const bool screenQuadrantAware,
const HWND window) const;
void ToggleAliasedLinesMode(const bool enabled) const;
};

View File

@@ -1,145 +0,0 @@
#include "pch.h"
#include "DxgiAPI.h"
#include <common/Display/dpi_aware.h>
//#define DEBUG_DEVICES
#define SEPARATE_D3D_FOR_CAPTURE
namespace
{
DxgiAPI::D3D CreateD3D()
{
DxgiAPI::D3D d3d;
UINT flags = D3D11_CREATE_DEVICE_BGRA_SUPPORT;
#if defined(DEBUG_DEVICES)
flags |= D3D11_CREATE_DEVICE_DEBUG;
#endif
HRESULT hr =
D3D11CreateDevice(nullptr,
D3D_DRIVER_TYPE_HARDWARE,
nullptr,
flags,
nullptr,
0,
D3D11_SDK_VERSION,
d3d.d3dDevice.put(),
nullptr,
nullptr);
if (hr == DXGI_ERROR_UNSUPPORTED)
{
hr = D3D11CreateDevice(nullptr,
D3D_DRIVER_TYPE_WARP,
nullptr,
flags,
nullptr,
0,
D3D11_SDK_VERSION,
d3d.d3dDevice.put(),
nullptr,
nullptr);
}
winrt::check_hresult(hr);
d3d.dxgiDevice = d3d.d3dDevice.as<IDXGIDevice>();
winrt::check_hresult(CreateDirect3D11DeviceFromDXGIDevice(d3d.dxgiDevice.get(), d3d.d3dDeviceInspectable.put()));
winrt::com_ptr<IDXGIAdapter> adapter;
winrt::check_hresult(d3d.dxgiDevice->GetParent(winrt::guid_of<IDXGIAdapter>(), adapter.put_void()));
winrt::check_hresult(adapter->GetParent(winrt::guid_of<IDXGIFactory2>(), d3d.dxgiFactory2.put_void()));
d3d.d3dDevice->GetImmediateContext(d3d.d3dContext.put());
winrt::check_bool(d3d.d3dContext);
auto contextMultithread = d3d.d3dContext.as<ID3D11Multithread>();
contextMultithread->SetMultithreadProtected(true);
return d3d;
}
}
DxgiAPI::DxgiAPI()
{
const D2D1_FACTORY_OPTIONS d2dFactoryOptions = {
#if defined(DEBUG_DEVICES)
D2D1_DEBUG_LEVEL_INFORMATION
#else
D2D1_DEBUG_LEVEL_NONE
#endif
};
winrt::check_hresult(D2D1CreateFactory(D2D1_FACTORY_TYPE_MULTI_THREADED, d2dFactoryOptions, d2dFactory2.put()));
winrt::check_hresult(DWriteCreateFactory(DWRITE_FACTORY_TYPE_SHARED,
winrt::guid_of<IDWriteFactory>(),
reinterpret_cast<IUnknown**>(writeFactory.put())));
auto d3d = CreateD3D();
d3dDevice = d3d.d3dDevice;
dxgiDevice = d3d.dxgiDevice;
d3dDeviceInspectable = d3d.d3dDeviceInspectable;
dxgiFactory2 = d3d.dxgiFactory2;
d3dContext = d3d.d3dContext;
#if defined(SEPARATE_D3D_FOR_CAPTURE)
auto d3dFC = CreateD3D();
d3dForCapture = d3dFC;
#else
d3dForCapture = d3d;
#endif
winrt::check_hresult(d2dFactory2->CreateDevice(dxgiDevice.get(), d2dDevice1.put()));
winrt::check_hresult(DCompositionCreateDevice(
dxgiDevice.get(),
winrt::guid_of<IDCompositionDevice>(),
compositionDevice.put_void()));
}
DxgiWindowState DxgiAPI::CreateD2D1RenderTarget(HWND window) const
{
RECT rect = {};
winrt::check_bool(GetClientRect(window, &rect));
const DXGI_SWAP_CHAIN_DESC1 desc = {
.Width = static_cast<UINT>(rect.right - rect.left),
.Height = static_cast<UINT>(rect.bottom - rect.top),
.Format = static_cast<DXGI_FORMAT>(winrt::DirectXPixelFormat::B8G8R8A8UIntNormalized),
.SampleDesc = { .Count = 1, .Quality = 0 },
.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT,
.BufferCount = 2,
.Scaling = DXGI_SCALING_STRETCH,
.SwapEffect = DXGI_SWAP_EFFECT_FLIP_DISCARD,
.AlphaMode = DXGI_ALPHA_MODE_PREMULTIPLIED,
};
DxgiWindowState state;
winrt::com_ptr<ID2D1DeviceContext> rt;
d2dDevice1->CreateDeviceContext(D2D1_DEVICE_CONTEXT_OPTIONS_NONE, rt.put());
state.rt = rt;
winrt::check_hresult(dxgiFactory2->CreateSwapChainForComposition(d3dDevice.get(),
&desc,
nullptr,
state.swapChain.put()));
winrt::com_ptr<IDXGISurface> surface;
winrt::check_hresult(state.swapChain->GetBuffer(0, winrt::guid_of<IDXGISurface>(), surface.put_void()));
const D2D1_BITMAP_PROPERTIES1 properties = {
.pixelFormat = { .format = DXGI_FORMAT_B8G8R8A8_UNORM, .alphaMode = D2D1_ALPHA_MODE_PREMULTIPLIED },
.bitmapOptions = D2D1_BITMAP_OPTIONS_TARGET | D2D1_BITMAP_OPTIONS_CANNOT_DRAW
};
winrt::com_ptr<ID2D1Bitmap1> bitmap;
winrt::check_hresult(rt->CreateBitmapFromDxgiSurface(surface.get(),
properties,
bitmap.put()));
rt->SetTarget(bitmap.get());
winrt::check_hresult(compositionDevice->CreateTargetForHwnd(window,
true,
state.compositionTarget.put()));
winrt::com_ptr<IDCompositionVisual> visual;
winrt::check_hresult(compositionDevice->CreateVisual(visual.put()));
winrt::check_hresult(visual->SetContent(state.swapChain.get()));
winrt::check_hresult(state.compositionTarget->SetRoot(visual.get()));
winrt::check_hresult(compositionDevice->Commit());
return state;
}

View File

@@ -1,49 +0,0 @@
#pragma once
#include <d2d1_3.h>
#include <d3d11_4.h>
#include <dcomp.h>
#include <dxgi1_3.h>
#include <inspectable.h>
#include <winrt/base.h>
struct DxgiWindowState
{
winrt::com_ptr<ID2D1RenderTarget> rt;
winrt::com_ptr<IDXGISwapChain1> swapChain;
winrt::com_ptr<IDCompositionTarget> compositionTarget;
};
struct DxgiAPI final
{
struct D3D
{
winrt::com_ptr<ID3D11Device> d3dDevice;
winrt::com_ptr<IDXGIDevice> dxgiDevice;
winrt::com_ptr<IInspectable> d3dDeviceInspectable;
winrt::com_ptr<IDXGIFactory2> dxgiFactory2;
winrt::com_ptr<ID3D11DeviceContext> d3dContext;
};
winrt::com_ptr<ID2D1Factory2> d2dFactory2;
winrt::com_ptr<IDWriteFactory> writeFactory;
winrt::com_ptr<ID3D11Device> d3dDevice;
winrt::com_ptr<IDXGIDevice> dxgiDevice;
winrt::com_ptr<IInspectable> d3dDeviceInspectable;
winrt::com_ptr<IDXGIFactory2> dxgiFactory2;
winrt::com_ptr<ID3D11DeviceContext> d3dContext;
D3D d3dForCapture;
winrt::com_ptr<ID2D1Device1> d2dDevice1;
winrt::com_ptr<IDCompositionDevice> compositionDevice;
DxgiAPI();
enum class Uninitialized
{
};
explicit inline DxgiAPI(Uninitialized) {}
DxgiWindowState CreateD2D1RenderTarget(HWND window) const;
};

View File

@@ -1,87 +0,0 @@
#include "pch.h"
#include "constants.h"
#include "EdgeDetection.h"
template<bool PerChannel,
bool IsX,
bool Increment>
inline long FindEdge(const BGRATextureView& texture, const POINT centerPoint, const uint8_t tolerance)
{
using namespace consts;
const size_t maxDim = IsX ? texture.width : texture.height;
long x = std::clamp<long>(centerPoint.x, 1, static_cast<long>(texture.width - 2));
long y = std::clamp<long>(centerPoint.y, 1, static_cast<long>(texture.height - 2));
const uint32_t startPixel = texture.GetPixel(x, y);
while (true)
{
long oldX = x;
long oldY = y;
if constexpr (IsX)
{
if constexpr (Increment)
{
if (++x == maxDim)
break;
}
else
{
if (--x == 0)
break;
}
}
else
{
if constexpr (Increment)
{
if (++y == maxDim)
break;
}
else
{
if (--y == 0)
break;
}
}
const uint32_t nextPixel = texture.GetPixel(x, y);
if (!texture.PixelsClose<PerChannel>(startPixel, nextPixel, tolerance))
{
return IsX ? oldX : oldY;
}
}
return Increment ? static_cast<long>(IsX ? texture.width : texture.height) - 1 : 0;
}
template<bool PerChannel>
inline RECT DetectEdgesInternal(const BGRATextureView& texture,
const POINT centerPoint,
const uint8_t tolerance)
{
return RECT{ .left = FindEdge<PerChannel,
true,
false>(texture, centerPoint, tolerance),
.top = FindEdge<PerChannel,
false,
false>(texture, centerPoint, tolerance),
.right = FindEdge<PerChannel,
true,
true>(texture, centerPoint, tolerance),
.bottom = FindEdge<PerChannel,
false,
true>(texture, centerPoint, tolerance) };
}
RECT DetectEdges(const BGRATextureView& texture,
const POINT centerPoint,
const bool perChannel,
const uint8_t tolerance)
{
auto function = perChannel ? &DetectEdgesInternal<true> : DetectEdgesInternal<false>;
return function(texture, centerPoint, tolerance);
}

View File

@@ -1,8 +0,0 @@
#pragma once
#include "BGRATextureView.h"
RECT DetectEdges(const BGRATextureView& texture,
const POINT centerPoint,
const bool perChannel,
const uint8_t tolerance);

View File

@@ -1,3 +0,0 @@
EXPORTS
DllCanUnloadNow = WINRT_CanUnloadNow PRIVATE
DllGetActivationFactory = WINRT_GetActivationFactory PRIVATE

View File

@@ -1,263 +0,0 @@
#include "pch.h"
#include "BGRATextureView.h"
#include "Clipboard.h"
#include "CoordinateSystemConversion.h"
#include "constants.h"
#include "MeasureToolOverlayUI.h"
#include <common/utils/window.h>
namespace
{
inline std::pair<D2D_POINT_2F, D2D_POINT_2F> ComputeCrossFeetLine(D2D_POINT_2F center, const bool horizontal)
{
D2D_POINT_2F start = center, end = center;
// Computing in this way to achieve pixel-perfect axial symmetry of aliased D2D lines
if (horizontal)
{
start.x -= consts::FEET_HALF_LENGTH;
end.x += consts::FEET_HALF_LENGTH + 1.f;
}
else
{
start.y -= consts::FEET_HALF_LENGTH;
end.y += consts::FEET_HALF_LENGTH + 1.f;
}
return { start, end };
}
}
winrt::com_ptr<ID2D1Bitmap> ConvertID3D11Texture2DToD2D1Bitmap(winrt::com_ptr<ID2D1RenderTarget> rt,
const MappedTextureView* capturedScreenTexture)
{
capturedScreenTexture->view.pixels;
D2D1_BITMAP_PROPERTIES props = { .pixelFormat = rt->GetPixelFormat() };
rt->GetDpi(&props.dpiX, &props.dpiY);
const auto sizeF = rt->GetSize();
winrt::com_ptr<ID2D1Bitmap> bitmap;
auto hr = rt->CreateBitmap(D2D1::SizeU(static_cast<uint32_t>(capturedScreenTexture->view.width),
static_cast<uint32_t>(capturedScreenTexture->view.height)),
capturedScreenTexture->view.pixels,
static_cast<uint32_t>(capturedScreenTexture->view.pitch * 4),
props,
bitmap.put());
if (FAILED(hr))
return nullptr;
return bitmap;
}
LRESULT CALLBACK MeasureToolWndProc(HWND window, UINT message, WPARAM wparam, LPARAM lparam) noexcept
{
switch (message)
{
case WM_MOUSELEAVE:
case WM_CURSOR_LEFT_MONITOR:
{
if (auto state = GetWindowParam<Serialized<MeasureToolState>*>(window))
{
state->Access([&](MeasureToolState& s) {
s.perScreen[window].measuredEdges = {};
});
}
break;
}
case WM_NCHITTEST:
return HTCLIENT;
case WM_CREATE:
{
auto state = GetWindowCreateParam<Serialized<MeasureToolState>*>(lparam);
StoreWindowParam(window, state);
#if !defined(DEBUG_OVERLAY)
for (; ShowCursor(false) >= 0;)
;
#endif
break;
}
case WM_ERASEBKGND:
return 1;
case WM_KEYUP:
if (wparam == VK_ESCAPE)
{
PostMessageW(window, WM_CLOSE, {}, {});
}
break;
case WM_RBUTTONUP:
PostMessageW(window, WM_CLOSE, {}, {});
break;
case WM_LBUTTONUP:
if (auto state = GetWindowParam<Serialized<MeasureToolState>*>(window))
{
state->Read([](const MeasureToolState& s) { s.commonState->overlayBoxText.Read([](const OverlayBoxText& text) {
SetClipBoardToText(text.buffer);
}); });
}
PostMessageW(window, WM_CLOSE, {}, {});
break;
case WM_MOUSEWHEEL:
if (auto state = GetWindowParam<Serialized<MeasureToolState>*>(window))
{
const int8_t step = static_cast<short>(HIWORD(wparam)) < 0 ? -consts::MOUSE_WHEEL_TOLERANCE_STEP : consts::MOUSE_WHEEL_TOLERANCE_STEP;
state->Access([step](MeasureToolState& s) {
int wideVal = s.global.pixelTolerance;
wideVal += step;
s.global.pixelTolerance = static_cast<uint8_t>(std::clamp(wideVal, 0, 255));
});
}
break;
}
return DefWindowProcW(window, message, wparam, lparam);
}
void DrawMeasureToolTick(const CommonState& commonState,
Serialized<MeasureToolState>& toolState,
HWND window,
D2DState& d2dState)
{
bool continuousCapture = {};
bool drawFeetOnCross = {};
bool drawHorizontalCrossLine = true;
bool drawVerticalCrossLine = true;
Measurement measuredEdges{};
MeasureToolState::Mode mode = {};
winrt::com_ptr<ID2D1Bitmap> backgroundBitmap;
const MappedTextureView* backgroundTextureToConvert = nullptr;
bool gotMeasurement = false;
toolState.Read([&](const MeasureToolState& state) {
continuousCapture = state.global.continuousCapture;
drawFeetOnCross = state.global.drawFeetOnCross;
mode = state.global.mode;
if (auto it = state.perScreen.find(window); it != end(state.perScreen))
{
const auto& perScreen = it->second;
if (!perScreen.measuredEdges)
{
return;
}
gotMeasurement = true;
measuredEdges = *perScreen.measuredEdges;
if (continuousCapture)
return;
if (perScreen.capturedScreenBitmap)
{
backgroundBitmap = perScreen.capturedScreenBitmap;
}
else if (perScreen.capturedScreenTexture)
{
backgroundTextureToConvert = perScreen.capturedScreenTexture;
}
}
});
if (!gotMeasurement)
return;
switch (mode)
{
case MeasureToolState::Mode::Cross:
drawHorizontalCrossLine = true;
drawVerticalCrossLine = true;
break;
case MeasureToolState::Mode::Vertical:
drawHorizontalCrossLine = false;
drawVerticalCrossLine = true;
break;
case MeasureToolState::Mode::Horizontal:
drawHorizontalCrossLine = true;
drawVerticalCrossLine = false;
break;
}
if (!continuousCapture && !backgroundBitmap && backgroundTextureToConvert)
{
backgroundBitmap = ConvertID3D11Texture2DToD2D1Bitmap(d2dState.dxgiWindowState.rt, backgroundTextureToConvert);
if (backgroundBitmap)
{
toolState.Access([&](MeasureToolState& state) {
state.perScreen[window].capturedScreenTexture = {};
state.perScreen[window].capturedScreenBitmap = backgroundBitmap;
});
}
}
if (continuousCapture || !backgroundBitmap)
d2dState.dxgiWindowState.rt->Clear();
const float hMeasure = measuredEdges.Width(Measurement::Unit::Pixel);
const float vMeasure = measuredEdges.Height(Measurement::Unit::Pixel);
if (!continuousCapture && backgroundBitmap)
{
d2dState.dxgiWindowState.rt->DrawBitmap(backgroundBitmap.get());
}
const auto cursorPos = convert::FromSystemToWindow(window, commonState.cursorPosSystemSpace);
d2dState.ToggleAliasedLinesMode(true);
if (drawHorizontalCrossLine)
{
const D2D_POINT_2F hLineStart{ .x = measuredEdges.rect.left, .y = static_cast<float>(cursorPos.y) };
D2D_POINT_2F hLineEnd{ .x = hLineStart.x + hMeasure, .y = hLineStart.y };
d2dState.dxgiWindowState.rt->DrawLine(hLineStart, hLineEnd, d2dState.solidBrushes[Brush::line].get());
if (drawFeetOnCross)
{
// To fill all pixels which are close, we call DrawLine with end point one pixel too far, since
// it doesn't get filled, i.e. end point of the range is excluded. However, we want to draw cross
// feet *on* the last pixel row, so we must subtract 1px from the corresponding axis.
hLineEnd.x -= 1.f;
auto [left_start, left_end] = ComputeCrossFeetLine(hLineStart, false);
auto [right_start, right_end] = ComputeCrossFeetLine(hLineEnd, false);
d2dState.dxgiWindowState.rt->DrawLine(left_start, left_end, d2dState.solidBrushes[Brush::line].get());
d2dState.dxgiWindowState.rt->DrawLine(right_start, right_end, d2dState.solidBrushes[Brush::line].get());
}
}
if (drawVerticalCrossLine)
{
const D2D_POINT_2F vLineStart{ .x = static_cast<float>(cursorPos.x), .y = measuredEdges.rect.top };
D2D_POINT_2F vLineEnd{ .x = vLineStart.x, .y = vLineStart.y + vMeasure };
d2dState.dxgiWindowState.rt->DrawLine(vLineStart, vLineEnd, d2dState.solidBrushes[Brush::line].get());
if (drawFeetOnCross)
{
vLineEnd.y -= 1.f;
auto [top_start, top_end] = ComputeCrossFeetLine(vLineStart, true);
auto [bottom_start, bottom_end] = ComputeCrossFeetLine(vLineEnd, true);
d2dState.dxgiWindowState.rt->DrawLine(top_start, top_end, d2dState.solidBrushes[Brush::line].get());
d2dState.dxgiWindowState.rt->DrawLine(bottom_start, bottom_end, d2dState.solidBrushes[Brush::line].get());
}
}
d2dState.ToggleAliasedLinesMode(false);
OverlayBoxText text;
const auto [crossSymbolPos, measureStringBufLen] =
measuredEdges.Print(text.buffer.data(),
text.buffer.size(),
drawHorizontalCrossLine,
drawVerticalCrossLine,
commonState.units);
commonState.overlayBoxText.Access([&](OverlayBoxText& v) {
v = text;
});
d2dState.DrawTextBox(text.buffer.data(),
measureStringBufLen,
crossSymbolPos,
D2D_POINT_2F{ static_cast<float>(cursorPos.x), static_cast<float>(cursorPos.y) },
true,
window);
}

View File

@@ -1,12 +0,0 @@
#pragma once
#include "D2DState.h"
#include "ToolState.h"
#include <common/utils/serialized.h>
void DrawMeasureToolTick(const CommonState& commonState,
Serialized<MeasureToolState>& toolState,
HWND overlayWindow,
D2DState& d2dState);
LRESULT CALLBACK MeasureToolWndProc(HWND window, UINT message, WPARAM wparam, LPARAM lparam) noexcept;

View File

@@ -1,91 +0,0 @@
#include "pch.h"
#include "Measurement.h"
Measurement::Measurement(RECT winRect)
{
rect.left = static_cast<float>(winRect.left);
rect.right = static_cast<float>(winRect.right);
rect.top = static_cast<float>(winRect.top);
rect.bottom = static_cast<float>(winRect.bottom);
}
Measurement::Measurement(D2D1_RECT_F d2dRect) :
rect{ d2dRect }
{
}
namespace
{
inline float Convert(const float pixels, const Measurement::Unit units)
{
switch (units)
{
case Measurement::Unit::Pixel:
return pixels;
case Measurement::Unit::Inch:
return pixels / 96.f;
case Measurement::Unit::Centimetre:
return pixels / 96.f * 2.54f;
default:
return pixels;
}
}
}
inline float Measurement::Width(const Unit units) const
{
return Convert(rect.right - rect.left + 1.f, units);
}
inline float Measurement::Height(const Unit units) const
{
return Convert(rect.bottom - rect.top + 1.f, units);
}
Measurement::PrintResult Measurement::Print(wchar_t* buf,
const size_t bufSize,
const bool printWidth,
const bool printHeight,
const Unit units) const
{
PrintResult result;
if (printWidth)
{
result.strLen += swprintf_s(buf,
bufSize,
L"%g",
Width(units));
if (printHeight)
{
result.crossSymbolPos = result.strLen + 1;
result.strLen += swprintf_s(buf + result.strLen,
bufSize - result.strLen,
L" \x00D7 ");
}
}
if (printHeight)
{
result.strLen += swprintf_s(buf + result.strLen,
bufSize - result.strLen,
L"%g",
Height(units));
}
switch (units)
{
case Measurement::Unit::Inch:
result.strLen += swprintf_s(buf + result.strLen,
bufSize - result.strLen,
L" in");
break;
case Measurement::Unit::Centimetre:
result.strLen += swprintf_s(buf + result.strLen,
bufSize - result.strLen,
L" cm");
break;
}
return result;
}

View File

@@ -1,38 +0,0 @@
#pragma once
#include <dcommon.h>
#include <windef.h>
struct Measurement
{
enum Unit
{
Pixel,
Inch,
Centimetre
};
D2D1_RECT_F rect = {}; // corners are inclusive
Measurement() = default;
Measurement(const Measurement&) = default;
Measurement& operator=(const Measurement&) = default;
explicit Measurement(D2D1_RECT_F d2dRect);
explicit Measurement(RECT winRect);
float Width(const Unit units) const;
float Height(const Unit units) const;
struct PrintResult
{
std::optional<size_t> crossSymbolPos;
size_t strLen = {};
};
PrintResult Print(wchar_t* buf,
const size_t bufSize,
const bool printWidth,
const bool printHeight,
const Unit units) const;
};

View File

@@ -1,274 +0,0 @@
#include "pch.h"
#include "BoundsToolOverlayUI.h"
#include "constants.h"
#include "MeasureToolOverlayUI.h"
#include "OverlayUI.h"
#include <common/Display/dpi_aware.h>
#include <common/Display/monitors.h>
#include <common/logger/logger.h>
#include <common/Themes/windows_colors.h>
#include <common/utils/window.h>
namespace NonLocalizable
{
const wchar_t MeasureToolOverlayWindowName[] = L"PowerToys.MeasureToolOverlayWindow";
const wchar_t BoundsToolOverlayWindowName[] = L"PowerToys.BoundsToolOverlayWindow";
}
void CreateOverlayWindowClasses()
{
WNDCLASSEXW wcex{ .cbSize = sizeof(WNDCLASSEX), .hInstance = GetModuleHandleW(nullptr) };
wcex.lpfnWndProc = MeasureToolWndProc;
wcex.lpszClassName = NonLocalizable::MeasureToolOverlayWindowName;
wcex.hCursor = LoadCursorW(nullptr, IDC_CROSS);
RegisterClassExW(&wcex);
wcex.lpfnWndProc = BoundsToolWndProc;
wcex.lpszClassName = NonLocalizable::BoundsToolOverlayWindowName;
RegisterClassExW(&wcex);
}
HWND CreateOverlayUIWindow(const CommonState& commonState,
const MonitorInfo& monitor,
const bool excludeFromCapture,
const wchar_t* windowClass,
void* extraParam)
{
static std::once_flag windowClassesCreatedFlag;
std::call_once(windowClassesCreatedFlag, CreateOverlayWindowClasses);
const auto screenArea = monitor.GetScreenSize(true);
DWORD windowStyle = WS_EX_NOREDIRECTIONBITMAP | WS_EX_TOOLWINDOW;
#if !defined(DEBUG_OVERLAY)
windowStyle |= WS_EX_TOPMOST;
#endif
HWND window{
CreateWindowExW(windowStyle,
windowClass,
L"PowerToys.MeasureToolOverlay",
WS_POPUP | CS_HREDRAW | CS_VREDRAW,
screenArea.left(),
screenArea.top(),
screenArea.width(),
screenArea.height(),
HWND_DESKTOP,
nullptr,
GetModuleHandleW(nullptr),
extraParam)
};
winrt::check_bool(window);
// Exclude overlay window from displaying in WIN+TAB preview, since WS_EX_TOOLWINDOW windows are displayed simultaneously on all virtual desktops.
// We can't remove WS_EX_TOOLWINDOW/WS_EX_NOACTIVATE flag, since we want to exclude the window from taskbar
BOOL val = TRUE;
DwmSetWindowAttribute(window, DWMWA_EXCLUDED_FROM_PEEK, &val, sizeof(val));
// We want to receive input events as soon as possible to prevent issues with touch input
RegisterTouchWindow(window, TWF_WANTPALM);
ShowWindow(window, SW_SHOWNORMAL);
UpdateWindow(window);
if (excludeFromCapture)
{
SetWindowDisplayAffinity(window, WDA_EXCLUDEFROMCAPTURE);
}
#if !defined(DEBUG_OVERLAY)
SetWindowPos(window, HWND_TOPMOST, {}, {}, {}, {}, SWP_NOMOVE | SWP_NOSIZE);
#else
(void)window;
#endif
const int pos = -GetSystemMetrics(SM_CXVIRTUALSCREEN) - 8;
if (wil::unique_hrgn hrgn{ CreateRectRgn(pos, 0, (pos + 1), 1) })
{
DWM_BLURBEHIND bh = { DWM_BB_ENABLE | DWM_BB_BLURREGION, TRUE, hrgn.get(), FALSE };
DwmEnableBlurBehindWindow(window, &bh);
}
RECT windowRect = {};
// Exclude toolbar from the window's region to be able to use toolbar during tool usage.
if (monitor.IsPrimary() && GetWindowRect(window, &windowRect))
{
// will be freed during SetWindowRgn call
const HRGN windowRegion{ CreateRectRgn(windowRect.left, windowRect.top, windowRect.right, windowRect.bottom) };
wil::unique_hrgn toolbarRegion{ CreateRectRgn(commonState.toolbarBoundingBox.left(),
commonState.toolbarBoundingBox.top(),
commonState.toolbarBoundingBox.right(),
commonState.toolbarBoundingBox.bottom()) };
const auto res = CombineRgn(windowRegion, windowRegion, toolbarRegion.get(), RGN_DIFF);
if (res != ERROR)
SetWindowRgn(window, windowRegion, true);
}
return window;
}
std::vector<D2D1::ColorF> AppendCommonOverlayUIColors(const D2D1::ColorF& lineColor)
{
D2D1::ColorF foreground = D2D1::ColorF::Black;
D2D1::ColorF background = D2D1::ColorF(0.96f, 0.96f, 0.96f, .93f);
D2D1::ColorF border = D2D1::ColorF(0.44f, 0.44f, 0.44f, 0.4f);
if (WindowsColors::is_dark_mode())
{
foreground = D2D1::ColorF::White;
background = D2D1::ColorF(0.17f, 0.17f, 0.17f, .93f);
border = D2D1::ColorF(0.44f, 0.44f, 0.44f, 0.4f);
}
return { lineColor, foreground, background, border };
}
void OverlayUIState::RunUILoop()
{
bool cursorOnScreen = false;
while (IsWindow(_window) && !_commonState.closeOnOtherMonitors)
{
const auto now = std::chrono::high_resolution_clock::now();
const auto cursor = _commonState.cursorPosSystemSpace;
const bool cursorOverToolbar = _commonState.toolbarBoundingBox.inside(cursor);
auto& dxgi = _d2dState.dxgiWindowState;
if (_monitorArea.inside(cursor) != cursorOnScreen)
{
cursorOnScreen = !cursorOnScreen;
if (!cursorOnScreen)
{
PostMessageW(_window, WM_CURSOR_LEFT_MONITOR, {}, {});
}
}
run_message_loop(true, 1);
dxgi.rt->BeginDraw();
dxgi.rt->Clear();
if (!cursorOverToolbar)
_tickFunc();
dxgi.rt->EndDraw();
dxgi.swapChain->Present(0, 0);
if (cursorOnScreen)
{
const auto frameTime = std::chrono::high_resolution_clock::now() - now;
if (frameTime < consts::TARGET_FRAME_DURATION)
{
std::this_thread::sleep_for(consts::TARGET_FRAME_DURATION - frameTime);
}
}
else
{
// Don't consume resources while nothing could be updated
std::this_thread::sleep_for(std::chrono::milliseconds{ 200 });
}
}
DestroyWindow(_window);
}
template<typename StateT, typename TickFuncT>
OverlayUIState::OverlayUIState(const DxgiAPI* dxgiAPI,
StateT& toolState,
TickFuncT tickFunc,
const CommonState& commonState,
HWND window) :
_window{ window },
_commonState{ commonState },
_d2dState{ dxgiAPI, window, AppendCommonOverlayUIColors(commonState.lineColor) },
_tickFunc{ [this, tickFunc, &toolState] {
tickFunc(_commonState, toolState, _window, _d2dState);
} }
{
}
OverlayUIState::~OverlayUIState()
{
PostMessageW(_window, WM_CLOSE, {}, {});
try
{
if (_uiThread.joinable())
_uiThread.join();
}
catch (...)
{
}
}
// Returning unique_ptr, since we need to pin ui state in memory
template<typename ToolT, typename TickFuncT>
inline std::unique_ptr<OverlayUIState> OverlayUIState::CreateInternal(const DxgiAPI* dxgi,
ToolT& toolState,
TickFuncT tickFunc,
CommonState& commonState,
const wchar_t* toolWindowClassName,
void* windowParam,
const MonitorInfo& monitor,
const bool excludeFromCapture)
{
wil::shared_event uiCreatedEvent(wil::EventOptions::ManualReset);
std::unique_ptr<OverlayUIState> uiState;
std::thread threadHandle = SpawnLoggedThread(L"OverlayUI thread", [&] {
OverlayUIState* state = nullptr;
{
auto sinalUICreatedEvent = wil::scope_exit([&] { uiCreatedEvent.SetEvent(); });
const HWND window = CreateOverlayUIWindow(commonState, monitor, excludeFromCapture, toolWindowClassName, windowParam);
uiState = std::unique_ptr<OverlayUIState>{ new OverlayUIState{ dxgi, toolState, tickFunc, commonState, window } };
uiState->_monitorArea = monitor.GetScreenSize(true);
// we must create window + d2d state in the same thread, then store thread handle in uiState, thus
// lifetime is ok here, since we join the thread in destructor
state = uiState.get();
}
state->RunUILoop();
commonState.closeOnOtherMonitors = true;
commonState.sessionCompletedCallback();
});
uiCreatedEvent.wait();
if (uiState)
uiState->_uiThread = std::move(threadHandle);
else if (threadHandle.joinable())
threadHandle.join();
return uiState;
}
std::unique_ptr<OverlayUIState> OverlayUIState::Create(const DxgiAPI* dxgi,
Serialized<MeasureToolState>& toolState,
CommonState& commonState,
const MonitorInfo& monitor)
{
bool excludeFromCapture = false;
toolState.Read([&](const MeasureToolState& s) {
excludeFromCapture = s.global.continuousCapture;
});
return OverlayUIState::CreateInternal(dxgi,
toolState,
DrawMeasureToolTick,
commonState,
NonLocalizable::MeasureToolOverlayWindowName,
&toolState,
monitor,
excludeFromCapture);
}
std::unique_ptr<OverlayUIState> OverlayUIState::Create(const DxgiAPI* dxgi,
BoundsToolState& toolState,
CommonState& commonState,
const MonitorInfo& monitor)
{
return OverlayUIState::CreateInternal(dxgi,
toolState,
DrawBoundsToolTick,
commonState,
NonLocalizable::BoundsToolOverlayWindowName,
&toolState,
monitor,
false);
}

View File

@@ -1,55 +0,0 @@
#pragma once
#include "DxgiAPI.h"
#include "D2DState.h"
#include "ToolState.h"
#include <common/display/monitors.h>
#include <common/utils/serialized.h>
class OverlayUIState final
{
template<typename StateT, typename TickFuncT>
OverlayUIState(const DxgiAPI* dxgiAPI,
StateT& toolState,
TickFuncT tickFunc,
const CommonState& commonState,
HWND window);
Box _monitorArea;
HWND _window = {};
const CommonState& _commonState;
D2DState _d2dState;
std::function<void()> _tickFunc;
std::thread _uiThread;
template<typename ToolT, typename TickFuncT>
static std::unique_ptr<OverlayUIState> CreateInternal(const DxgiAPI* dxgi,
ToolT& toolState,
TickFuncT tickFunc,
CommonState& commonState,
const wchar_t* toolWindowClassName,
void* windowParam,
const MonitorInfo& monitor,
const bool excludeFromCapture);
public:
OverlayUIState(OverlayUIState&&) noexcept = default;
~OverlayUIState();
static std::unique_ptr<OverlayUIState> Create(const DxgiAPI* dxgi,
BoundsToolState& toolState,
CommonState& commonState,
const MonitorInfo& monitor);
static std::unique_ptr<OverlayUIState> Create(const DxgiAPI* dxgi,
Serialized<MeasureToolState>& toolState,
CommonState& commonState,
const MonitorInfo& monitor);
inline HWND overlayWindowHandle() const
{
return _window;
}
void RunUILoop();
};

View File

@@ -1,136 +0,0 @@
#include "pch.h"
#include "PerGlyphOpacityTextRender.h"
PerGlyphOpacityTextRender::PerGlyphOpacityTextRender(
winrt::com_ptr<ID2D1Factory> pD2DFactory,
winrt::com_ptr<ID2D1RenderTarget> rt,
winrt::com_ptr<ID2D1SolidColorBrush> baseBrush) :
_pD2DFactory{ pD2DFactory.get() },
_rt{ rt.get() },
_baseBrush{ baseBrush.get() }
{
}
HRESULT __stdcall PerGlyphOpacityTextRender::DrawGlyphRun(void* /*clientDrawingContext*/,
FLOAT baselineOriginX,
FLOAT baselineOriginY,
DWRITE_MEASURING_MODE measuringMode,
_In_ const DWRITE_GLYPH_RUN* glyphRun,
_In_ const DWRITE_GLYPH_RUN_DESCRIPTION* /*glyphRunDescription*/,
IUnknown* clientDrawingEffect_) noexcept
{
HRESULT hr = S_OK;
if (!clientDrawingEffect_)
{
_rt->DrawGlyphRun(D2D1_POINT_2F{ .x = baselineOriginX, .y = baselineOriginY }, glyphRun, _baseBrush, measuringMode);
return hr;
}
wil::com_ptr<IUnknown> clientDrawingEffect{ clientDrawingEffect_ };
// Create the path geometry.
wil::com_ptr<ID2D1PathGeometry> pathGeometry;
hr = _pD2DFactory->CreatePathGeometry(&pathGeometry);
// Write to the path geometry using the geometry sink.
wil::com_ptr<ID2D1GeometrySink> pSink;
if (SUCCEEDED(hr))
{
hr = pathGeometry->Open(&pSink);
}
// Get the glyph run outline geometries back from DirectWrite and place them within the
// geometry sink.
if (SUCCEEDED(hr))
{
hr = glyphRun->fontFace->GetGlyphRunOutline(
glyphRun->fontEmSize,
glyphRun->glyphIndices,
glyphRun->glyphAdvances,
glyphRun->glyphOffsets,
glyphRun->glyphCount,
glyphRun->isSideways,
glyphRun->bidiLevel % 2,
pSink.get());
}
if (pSink)
{
hr = pSink->Close();
}
// Initialize a matrix to translate the origin of the glyph run.
D2D1::Matrix3x2F const matrix = D2D1::Matrix3x2F(
1.0f, 0.0f, 0.0f, 1.0f, baselineOriginX, baselineOriginY);
// Create the transformed geometry
wil::com_ptr<ID2D1TransformedGeometry> pTransformedGeometry;
if (SUCCEEDED(hr))
{
hr = _pD2DFactory->CreateTransformedGeometry(pathGeometry.get(), &matrix, &pTransformedGeometry);
}
float prevOpacity = _baseBrush->GetOpacity();
auto opacityEffect = clientDrawingEffect.try_query<IDrawingEffect>();
if (opacityEffect)
_baseBrush->SetOpacity(static_cast<OpacityEffect*>(opacityEffect.get())->alpha);
if (SUCCEEDED(hr))
{
_rt->DrawGeometry(pTransformedGeometry.get(), _baseBrush);
_rt->FillGeometry(pTransformedGeometry.get(), _baseBrush);
_baseBrush->SetOpacity(prevOpacity);
}
return hr;
}
HRESULT __stdcall PerGlyphOpacityTextRender::DrawUnderline(void* /*clientDrawingContext*/,
FLOAT /*baselineOriginX*/,
FLOAT /*baselineOriginY*/,
_In_ const DWRITE_UNDERLINE* /*underline*/,
IUnknown* /*clientDrawingEffect*/) noexcept
{
return E_NOTIMPL;
}
HRESULT __stdcall PerGlyphOpacityTextRender::DrawStrikethrough(void* /*clientDrawingContext*/,
FLOAT /*baselineOriginX*/,
FLOAT /*baselineOriginY*/,
_In_ const DWRITE_STRIKETHROUGH* /*strikethrough*/,
IUnknown* /*clientDrawingEffect*/) noexcept
{
return E_NOTIMPL;
}
HRESULT __stdcall PerGlyphOpacityTextRender::DrawInlineObject(void* /*clientDrawingContext*/,
FLOAT /*originX*/,
FLOAT /*originY*/,
IDWriteInlineObject* /*inlineObject*/,
BOOL /*isSideways*/,
BOOL /*isRightToLeft*/,
IUnknown* /*clientDrawingEffect*/) noexcept
{
return E_NOTIMPL;
}
HRESULT __stdcall PerGlyphOpacityTextRender::IsPixelSnappingDisabled(void* /*clientDrawingContext*/, BOOL* isDisabled) noexcept
{
RETURN_HR_IF_NULL(E_INVALIDARG, isDisabled);
*isDisabled = false;
return S_OK;
}
HRESULT __stdcall PerGlyphOpacityTextRender::GetCurrentTransform(void* /*clientDrawingContext*/, DWRITE_MATRIX* transform) noexcept
{
_rt->GetTransform(reinterpret_cast<D2D1_MATRIX_3X2_F*>(transform));
return S_OK;
}
HRESULT __stdcall PerGlyphOpacityTextRender::GetPixelsPerDip(void* /*clientDrawingContext*/, FLOAT* pixelsPerDip) noexcept
{
_rt->GetDpi(pixelsPerDip, pixelsPerDip);
return S_OK;
}

View File

@@ -1,55 +0,0 @@
#pragma once
#include <winrt/base.h>
#include <wil/resource.h>
#include <Windows.h>
#include <dwrite.h>
struct __declspec(uuid("{01557C9F-E3DD-4C28-AE64-E731EAB479CC}")) IDrawingEffect : IUnknown
{
};
struct OpacityEffect : winrt::implements<OpacityEffect, IDrawingEffect>
{
float alpha = 1.f;
};
struct PerGlyphOpacityTextRender : winrt::implements<PerGlyphOpacityTextRender, IDWriteTextRenderer>
{
ID2D1Factory* _pD2DFactory = nullptr;
ID2D1RenderTarget* _rt = nullptr;
ID2D1SolidColorBrush* _baseBrush = nullptr;
PerGlyphOpacityTextRender(
winrt::com_ptr<ID2D1Factory> pD2DFactory,
winrt::com_ptr<ID2D1RenderTarget> rt,
winrt::com_ptr<ID2D1SolidColorBrush> baseBrush);
HRESULT __stdcall DrawGlyphRun(void* clientDrawingContext,
FLOAT baselineOriginX,
FLOAT baselineOriginY,
DWRITE_MEASURING_MODE measuringMode,
_In_ const DWRITE_GLYPH_RUN* glyphRun,
_In_ const DWRITE_GLYPH_RUN_DESCRIPTION* glyphRunDescription,
IUnknown* clientDrawingEffect) noexcept override;
HRESULT __stdcall DrawUnderline(void* clientDrawingContext,
FLOAT baselineOriginX,
FLOAT baselineOriginY,
_In_ const DWRITE_UNDERLINE* underline,
IUnknown* clientDrawingEffect) noexcept override;
HRESULT __stdcall DrawStrikethrough(void* clientDrawingContext,
FLOAT baselineOriginX,
FLOAT baselineOriginY,
_In_ const DWRITE_STRIKETHROUGH* strikethrough,
IUnknown* clientDrawingEffect) noexcept override;
HRESULT __stdcall DrawInlineObject(void* clientDrawingContext,
FLOAT originX,
FLOAT originY,
IDWriteInlineObject* inlineObject,
BOOL isSideways,
BOOL isRightToLeft,
IUnknown* clientDrawingEffect) noexcept override;
HRESULT __stdcall IsPixelSnappingDisabled(void* clientDrawingContext, BOOL* isDisabled) noexcept override;
HRESULT __stdcall GetCurrentTransform(void* clientDrawingContext, DWRITE_MATRIX* transform) noexcept override;
HRESULT __stdcall GetPixelsPerDip(void* clientDrawingContext, FLOAT* pixelsPerDip) noexcept override;
};

View File

@@ -1,190 +0,0 @@
#include "pch.h"
#include <common/display/dpi_aware.h>
#include <common/display/monitors.h>
#include <common/utils/logger_helper.h>
#include <common/utils/UnhandledExceptionHandler.h>
#include <common/logger/logger.h>
#include "../MeasureToolModuleInterface/trace.h"
#include "constants.h"
#include "PowerToys.MeasureToolCore.h"
#include "Core.g.cpp"
#include "OverlayUI.h"
#include "ScreenCapturing.h"
//#define DEBUG_PRIMARY_MONITOR_ONLY
namespace winrt::PowerToys::MeasureToolCore::implementation
{
void Core::MouseCaptureThread()
{
while (!_stopMouseCaptureThreadSignal.is_signaled())
{
static_assert(sizeof(_commonState.cursorPosSystemSpace) == sizeof(LONG64));
POINT cursorPos = {};
GetCursorPos(&cursorPos);
InterlockedExchange64(reinterpret_cast<LONG64*>(&_commonState.cursorPosSystemSpace), std::bit_cast<LONG64>(cursorPos));
std::this_thread::sleep_for(consts::TARGET_FRAME_DURATION);
}
}
Core::Core() :
_stopMouseCaptureThreadSignal{ wil::EventOptions::ManualReset },
_mouseCaptureThread{ [this] { MouseCaptureThread(); } }
{
}
Core::~Core()
{
Close();
}
void Core::Close()
{
ResetState();
// avoid triggering d2d debug layer leak on shutdown
dxgiAPI = DxgiAPI{ DxgiAPI::Uninitialized{} };
#if 0
winrt::com_ptr<IDXGIDebug> dxgiDebug;
winrt::check_hresult(DXGIGetDebugInterface1({},
winrt::guid_of<IDXGIDebug>(),
dxgiDebug.put_void()));
dxgiDebug->ReportLiveObjects(DXGI_DEBUG_ALL, DXGI_DEBUG_RLO_ALL);
#endif
if (!_stopMouseCaptureThreadSignal.is_signaled())
_stopMouseCaptureThreadSignal.SetEvent();
if (_mouseCaptureThread.joinable())
_mouseCaptureThread.join();
}
void Core::ResetState()
{
_commonState.closeOnOtherMonitors = true;
_overlayUIStates.clear();
_boundsToolState = { .commonState = &_commonState };
for (auto& thread : _screenCaptureThreads)
{
if (thread.joinable())
{
thread.join();
}
}
_screenCaptureThreads.clear();
_measureToolState.Reset();
_measureToolState.Access([&](MeasureToolState& s) {
s.commonState = &_commonState;
});
_settings = Settings::LoadFromFile();
_commonState.units = _settings.units;
_commonState.lineColor.r = _settings.lineColor[0] / 255.f;
_commonState.lineColor.g = _settings.lineColor[1] / 255.f;
_commonState.lineColor.b = _settings.lineColor[2] / 255.f;
_commonState.closeOnOtherMonitors = false;
}
void Core::StartBoundsTool()
{
ResetState();
#if defined(DEBUG_PRIMARY_MONITOR_ONLY)
std::vector<MonitorInfo> monitors = { MonitorInfo::GetPrimaryMonitor() };
const auto& monitorInfo = monitors[0];
#else
const auto monitors = MonitorInfo::GetMonitors(true);
for (const auto& monitorInfo : monitors)
#endif
{
auto overlayUI = OverlayUIState::Create(&dxgiAPI,
_boundsToolState,
_commonState,
monitorInfo);
#if !defined(DEBUG_PRIMARY_MONITOR_ONLY)
if (!overlayUI)
continue;
#endif
_overlayUIStates.push_back(std::move(overlayUI));
}
Trace::BoundsToolActivated();
}
void Core::StartMeasureTool(const bool horizontal, const bool vertical)
{
ResetState();
_measureToolState.Access([horizontal, vertical, this](MeasureToolState& state) {
if (horizontal)
state.global.mode = vertical ? MeasureToolState::Mode::Cross : MeasureToolState::Mode::Horizontal;
else
state.global.mode = MeasureToolState::Mode::Vertical;
state.global.continuousCapture = _settings.continuousCapture;
state.global.drawFeetOnCross = _settings.drawFeetOnCross;
state.global.pixelTolerance = _settings.pixelTolerance;
state.global.perColorChannelEdgeDetection = _settings.perColorChannelEdgeDetection;
});
#if defined(DEBUG_PRIMARY_MONITOR_ONLY)
std::vector<MonitorInfo> monitors = { MonitorInfo::GetPrimaryMonitor() };
const auto& monitorInfo = monitors[0];
#else
const auto monitors = MonitorInfo::GetMonitors(true);
for (const auto& monitorInfo : monitors)
#endif
{
auto overlayUI = OverlayUIState::Create(&dxgiAPI,
_measureToolState,
_commonState,
monitorInfo);
#if !defined(DEBUG_PRIMARY_MONITOR_ONLY)
if (!overlayUI)
return;
#endif
_overlayUIStates.push_back(std::move(overlayUI));
}
for (size_t i = 0; i < monitors.size(); ++i)
{
auto thread = StartCapturingThread(
&dxgiAPI,
_commonState,
_measureToolState,
_overlayUIStates[i]->overlayWindowHandle(),
monitors[i]);
_screenCaptureThreads.emplace_back(std::move(thread));
}
Trace::MeasureToolActivated();
}
void MeasureToolCore::implementation::Core::SetToolCompletionEvent(ToolSessionCompleted sessionCompletedTrigger)
{
_commonState.sessionCompletedCallback = [trigger = std::move(sessionCompletedTrigger)] {
trigger();
};
}
void MeasureToolCore::implementation::Core::SetToolbarBoundingBox(const uint32_t fromX,
const uint32_t fromY,
const uint32_t toX,
const uint32_t toY)
{
_commonState.toolbarBoundingBox = Box{ RECT{ .left = static_cast<long>(fromX),
.top = static_cast<long>(fromY),
.right = static_cast<long>(toX),
.bottom = static_cast<long>(toY) } };
}
float MeasureToolCore::implementation::Core::GetDPIScaleForWindow(uint64_t windowHandle)
{
UINT dpi = DPIAware::DEFAULT_DPI;
DPIAware::GetScreenDPIForWindow(std::bit_cast<HWND>(windowHandle), dpi);
return static_cast<float>(dpi) / DPIAware::DEFAULT_DPI;
}
}

View File

@@ -1,61 +0,0 @@
#pragma once
#include "Core.g.h"
#include "ToolState.h"
#include "OverlayUI.h"
#include "Settings.h"
#include <common/utils/serialized.h>
#include "ScreenCapturing.h"
struct PowerToysMisc
{
PowerToysMisc()
{
Trace::RegisterProvider();
LoggerHelpers::init_logger(L"Measure Tool", L"Core", "Measure Tool");
InitUnhandledExceptionHandler();
}
~PowerToysMisc()
{
Trace::UnregisterProvider();
}
};
namespace winrt::PowerToys::MeasureToolCore::implementation
{
struct Core : PowerToysMisc, CoreT<Core>
{
Core();
~Core();
void Close();
void StartBoundsTool();
void StartMeasureTool(const bool horizontal, const bool vertical);
void SetToolCompletionEvent(ToolSessionCompleted sessionCompletedTrigger);
void SetToolbarBoundingBox(const uint32_t fromX, const uint32_t fromY, const uint32_t toX, const uint32_t toY);
void ResetState();
float GetDPIScaleForWindow(uint64_t windowHandle);
void MouseCaptureThread();
DxgiAPI dxgiAPI;
wil::shared_event _stopMouseCaptureThreadSignal;
std::thread _mouseCaptureThread;
std::vector<std::thread> _screenCaptureThreads;
std::vector<std::unique_ptr<OverlayUIState>> _overlayUIStates;
Serialized<MeasureToolState> _measureToolState;
BoundsToolState _boundsToolState;
CommonState _commonState;
Settings _settings;
};
}
namespace winrt::PowerToys::MeasureToolCore::factory_implementation
{
struct Core : CoreT<Core, implementation::Core>
{
};
}

View File

@@ -1,26 +0,0 @@
namespace PowerToys
{
namespace MeasureToolCore
{
struct Point
{
Int32 X;
Int32 Y;
};
delegate void ToolSessionCompleted();
[default_interface]
runtimeclass Core : Windows.Foundation.IClosable
{
Core();
void SetToolCompletionEvent(event ToolSessionCompleted completionTrigger);
void StartMeasureTool(Boolean horizontal, Boolean vertical);
void StartBoundsTool();
void ResetState();
void SetToolbarBoundingBox(Int32 fromX, Int32 fromY, Int32 toX, Int32 toY);
Single GetDPIScaleForWindow(Int64 windowHandle);
}
}
}

View File

@@ -1,40 +0,0 @@
#include <windows.h>
#include "resource.h"
#include "../../../common/version/version.h"
#define APSTUDIO_READONLY_SYMBOLS
#include "winres.h"
#undef APSTUDIO_READONLY_SYMBOLS
1 VERSIONINFO
FILEVERSION FILE_VERSION
PRODUCTVERSION PRODUCT_VERSION
FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
#ifdef _DEBUG
FILEFLAGS VS_FF_DEBUG
#else
FILEFLAGS 0x0L
#endif
FILEOS VOS_NT_WINDOWS32
FILETYPE VFT_DLL
FILESUBTYPE VFT2_UNKNOWN
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0" // US English (0x0409), Unicode (0x04B0) charset
BEGIN
VALUE "CompanyName", COMPANY_NAME
VALUE "FileDescription", FILE_DESCRIPTION
VALUE "FileVersion", FILE_VERSION_STRING
VALUE "InternalName", INTERNAL_NAME
VALUE "LegalCopyright", COPYRIGHT_NOTE
VALUE "OriginalFilename", ORIGINAL_FILENAME
VALUE "ProductName", PRODUCT_NAME
VALUE "ProductVersion", PRODUCT_VERSION_STRING
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200 // US English (0x0409), Unicode (1200) charset
END
END

Some files were not shown because too many files have changed in this diff Show More