mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-02-05 02:39:59 +01:00
Compare commits
130 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4b9cbc2c32 | ||
|
|
47fc7be669 | ||
|
|
b968e5733b | ||
|
|
7d2c8db43a | ||
|
|
4edb4dee10 | ||
|
|
a0bb3dedc1 | ||
|
|
b4250c1235 | ||
|
|
c428f0787d | ||
|
|
c3b378101c | ||
|
|
489335e4d0 | ||
|
|
ddc075d24c | ||
|
|
50a73965d9 | ||
|
|
d5fc4547a2 | ||
|
|
84e142631e | ||
|
|
8edfb8fe80 | ||
|
|
d9c98bbc29 | ||
|
|
4ff7e4150f | ||
|
|
f4044ffd51 | ||
|
|
2b747d02d3 | ||
|
|
6a722e2961 | ||
|
|
230c199ee5 | ||
|
|
87bb89ab15 | ||
|
|
e9dccf82ab | ||
|
|
4cc74602c1 | ||
|
|
6b2cde7eb0 | ||
|
|
af65d79573 | ||
|
|
dabf657761 | ||
|
|
4572f62ce5 | ||
|
|
f2093ec423 | ||
|
|
51aba915f0 | ||
|
|
9fff2b535f | ||
|
|
3ede2a6467 | ||
|
|
35bfb0f83e | ||
|
|
832f580aa8 | ||
|
|
03b7cb4690 | ||
|
|
d744ca33b6 | ||
|
|
05728a6dc2 | ||
|
|
10a5629fe8 | ||
|
|
38e401007a | ||
|
|
3508301f06 | ||
|
|
3df2c5fe6a | ||
|
|
dc15a6cecc | ||
|
|
f6a292d47f | ||
|
|
f0d084c59c | ||
|
|
9fc3727709 | ||
|
|
218e9cfcb9 | ||
|
|
9e029c0867 | ||
|
|
01a3106450 | ||
|
|
416419ffde | ||
|
|
57a8d505c0 | ||
|
|
ddcb065b22 | ||
|
|
8c64a0b6f8 | ||
|
|
cc68133ddc | ||
|
|
692817e382 | ||
|
|
651e823c30 | ||
|
|
11bb7ccf60 | ||
|
|
c3dda238e9 | ||
|
|
ff95257e5f | ||
|
|
e284b07da7 | ||
|
|
49a2218358 | ||
|
|
c46ccce373 | ||
|
|
2cdf6f9cc0 | ||
|
|
8bb0772ae5 | ||
|
|
2a34cf740b | ||
|
|
314425e32e | ||
|
|
26e3eb9350 | ||
|
|
a3dbb55404 | ||
|
|
f62dd6933c | ||
|
|
3e7b04891d | ||
|
|
ddf96e28b8 | ||
|
|
567cc50fb7 | ||
|
|
79c13aec6e | ||
|
|
26f01431ff | ||
|
|
55e3a94da3 | ||
|
|
0fc69ca222 | ||
|
|
51a43d58de | ||
|
|
b27a7261be | ||
|
|
8144f5cedd | ||
|
|
f67ae38aba | ||
|
|
6b5fd308cb | ||
|
|
fb4ab87fdd | ||
|
|
d302c761d7 | ||
|
|
814c8e382c | ||
|
|
b98be49bfa | ||
|
|
91d36b4b47 | ||
|
|
03c36b4f65 | ||
|
|
792a04cf48 | ||
|
|
a1bb281386 | ||
|
|
941ff0a5a6 | ||
|
|
39b98dab3b | ||
|
|
f9434ac812 | ||
|
|
022ed601ec | ||
|
|
e131d0ff4b | ||
|
|
f6f8e4c4eb | ||
|
|
5880f3855b | ||
|
|
1a25dacc73 | ||
|
|
b6a207c4b6 | ||
|
|
cccadec44c | ||
|
|
edc43e39ca | ||
|
|
5eaf60e8a2 | ||
|
|
2182aabe35 | ||
|
|
2ccf492707 | ||
|
|
0506f06a18 | ||
|
|
2e8dfa73d2 | ||
|
|
453bb613af | ||
|
|
7833ace553 | ||
|
|
6a01be2c38 | ||
|
|
ac4f725433 | ||
|
|
a1f319afa7 | ||
|
|
714ca349ff | ||
|
|
dec1aca97f | ||
|
|
409f58e55a | ||
|
|
f721c1f226 | ||
|
|
a1643b0a2e | ||
|
|
f6576e01f3 | ||
|
|
758a21a22f | ||
|
|
167ec5a3a8 | ||
|
|
8c24d7e942 | ||
|
|
5035dc6754 | ||
|
|
ba431c5bfd | ||
|
|
a96187bd04 | ||
|
|
127cf4e412 | ||
|
|
aa876838d4 | ||
|
|
1a9473c896 | ||
|
|
d52037fd5e | ||
|
|
bcba63e4b2 | ||
|
|
f303c29d4c | ||
|
|
cf0c45a319 | ||
|
|
67933a8470 | ||
|
|
a0dca4f401 |
2
.gitattributes
vendored
2
.gitattributes
vendored
@@ -13,3 +13,5 @@
|
||||
# entries below.
|
||||
###############################################################################
|
||||
*.rc diff
|
||||
|
||||
*.gcode linguist-detectable=false
|
||||
|
||||
7
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
7
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
@@ -12,7 +12,7 @@ body:
|
||||
attributes:
|
||||
label: Microsoft PowerToys version
|
||||
placeholder: |
|
||||
"0.33.1"
|
||||
"0.53.0"
|
||||
description: |
|
||||
Hover over system tray icon or look at Settings
|
||||
validations:
|
||||
@@ -32,8 +32,10 @@ body:
|
||||
multiple: true
|
||||
options:
|
||||
- General
|
||||
- Always on Top
|
||||
- Awake
|
||||
- ColorPicker
|
||||
- Developer file preview
|
||||
- FancyZones
|
||||
- FancyZones Editor
|
||||
- Image Resizer
|
||||
@@ -47,6 +49,7 @@ body:
|
||||
- PowerRename
|
||||
- PowerToys Run
|
||||
- Shortcut Guide
|
||||
- STL Thumbnail
|
||||
- SVG Preview
|
||||
- SVG Thumbnail
|
||||
- Settings
|
||||
@@ -77,7 +80,7 @@ body:
|
||||
label: ❌ Actual Behavior
|
||||
placeholder: What happened instead?
|
||||
validations:
|
||||
required: true
|
||||
required: false
|
||||
|
||||
- type: textarea
|
||||
attributes:
|
||||
|
||||
11
.github/ISSUE_TEMPLATE/translation_issue.yml
vendored
11
.github/ISSUE_TEMPLATE/translation_issue.yml
vendored
@@ -13,7 +13,7 @@ body:
|
||||
- type: input
|
||||
attributes:
|
||||
label: Microsoft PowerToys version
|
||||
placeholder: "0.35.0"
|
||||
placeholder: "0.53.0"
|
||||
description: |
|
||||
Hover over system tray icon or look at Settings
|
||||
validations:
|
||||
@@ -23,20 +23,27 @@ body:
|
||||
label: Utility with translation issue
|
||||
options:
|
||||
- General
|
||||
- PowerToys Awake
|
||||
- Always on Top
|
||||
- Awake
|
||||
- ColorPicker
|
||||
- Developer file preview
|
||||
- FancyZones
|
||||
- FancyZones Editor
|
||||
- Image Resizer
|
||||
- Keyboard Manager
|
||||
- MD Preview
|
||||
- Mouse Utilities
|
||||
- PDF Preview
|
||||
- PDF Thumbnail
|
||||
- G-code Preview
|
||||
- G-code Thumbnail
|
||||
- PowerRename
|
||||
- PowerToys Run
|
||||
- Shortcut Guide
|
||||
- SVG Preview
|
||||
- SVG Thumbnail
|
||||
- Settings
|
||||
- Video Conference Mute
|
||||
- Welcome / PowerToys Tour window
|
||||
- System tray interaction
|
||||
- Installer
|
||||
|
||||
3
.github/actions/spell-check/allow/names.txt
vendored
Normal file
3
.github/actions/spell-check/allow/names.txt
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
bdoserror
|
||||
crutkas
|
||||
edwinzap
|
||||
10
.github/actions/spell-check/excludes.txt
vendored
10
.github/actions/spell-check/excludes.txt
vendored
@@ -1,4 +1,8 @@
|
||||
# See https://github.com/check-spelling/check-spelling/wiki/Configuration-Examples:-excludes
|
||||
(?:^|/)monacoSRC/
|
||||
(?:^|/)MonacoPreviewHandler/monaco_languages.json
|
||||
(?:^|/)MonacoPreviewHandler/index.html
|
||||
(?:^|/)MonacoPreviewHandler/generateLanguagesJson.html
|
||||
(?:^|/)(?i)COPYRIGHT
|
||||
(?:^|/)(?i)LICEN[CS]E
|
||||
(?:^|/)package(?:-lock)\.json$
|
||||
@@ -26,9 +30,11 @@ ignore$
|
||||
\.pdf$
|
||||
\.PNG$
|
||||
\.png$
|
||||
\.stl$
|
||||
\.woff$
|
||||
\.zip$
|
||||
^doc/devdocs/akaLinks\.md$
|
||||
^installer/PowerToysSetup/WebView2/MicrosoftEdgeWebview2Setup.exe$
|
||||
^src/common/logger/logger\.vcxproj\.filters$
|
||||
^src/common/notifications/BackgroundActivatorDLL/BackgroundActivator\.vcxproj\.filters$
|
||||
^src/common/notifications/BackgroundActivatorDLL/cpp\.hint$
|
||||
@@ -37,11 +43,11 @@ ignore$
|
||||
^src/modules/imageresizer/dll/ContextMenuHandler\.rgs$
|
||||
^src/modules/imageresizer/dll/ImageResizerExt\.rgs$
|
||||
^src/modules/powerrename/testapp/PowerRenameTest\.vcxproj\.filters$
|
||||
^src/modules/powerrename/UWPui/pch\.h$
|
||||
^src/modules/powerrename/UWPui/PowerRenameUWPUI\.vcxproj\.filters$
|
||||
^src/modules/previewpane/PreviewPaneUnitTests/HelperFiles/MarkdownWithHTMLImageTag\.txt$
|
||||
^src/modules/previewpane/UnitTests-MarkdownPreviewHandler/HelperFiles/MarkdownWithHTMLImageTag.txt$
|
||||
^tools/CleanUp_tool/CleanUp_tool\.vcxproj\.filters$
|
||||
^\.github/
|
||||
^\.github/actions/spell-check/
|
||||
^\.gitmodules$
|
||||
(?:^|/)WindowsSettings\.json$
|
||||
(?:^|/)timezones\.json$
|
||||
|
||||
255
.github/actions/spell-check/expect.txt
vendored
255
.github/actions/spell-check/expect.txt
vendored
File diff suppressed because it is too large
Load Diff
1
.github/workflows/spelling2.yml
vendored
1
.github/workflows/spelling2.yml
vendored
@@ -72,5 +72,6 @@ jobs:
|
||||
- name: comment
|
||||
uses: check-spelling/check-spelling@v0.0.20-alpha3
|
||||
with:
|
||||
config: .github/actions/spell-check
|
||||
custom_task: comment
|
||||
internal_state_directory: /tmp/data
|
||||
|
||||
3
.gitignore
vendored
3
.gitignore
vendored
@@ -344,3 +344,6 @@ src/common/Telemetry/*.etl
|
||||
/src/modules/previewpane/SvgThumbnailProvider/$(SolutionDir)$(Platform)/$(Configuration)/modules/FileExplorerPreview/SvgThumbnailProvider.xml
|
||||
/src/modules/powerrename/ui/RCa24464
|
||||
/src/modules/powerrename/ui/RCb24464
|
||||
|
||||
# Generated installer file for Monaco source files.
|
||||
/installer/PowerToysSetup/MonacoSRC.wxs
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
"*.resources.dll",
|
||||
|
||||
"PowerToysSetupCustomActions.dll",
|
||||
|
||||
|
||||
"PowerToys.ActionRunner.exe",
|
||||
"PowerToys.Update.exe",
|
||||
@@ -16,14 +15,17 @@
|
||||
"os-detection.dll",
|
||||
"PowerToys.exe",
|
||||
"PowerToys.Interop.dll",
|
||||
"BugReportTool\\BugReportTool.exe",
|
||||
"WebcamReportTool\\WebcamReportTool.exe",
|
||||
"BugReportTool\\PowerToys.BugReportTool.exe",
|
||||
"WebcamReportTool\\PowerToys.WebcamReportTool.exe",
|
||||
"Telemetry.dll",
|
||||
"PowerToys.ManagedTelemetry.dll",
|
||||
"PowerToys.ManagedCommon.dll",
|
||||
"PowerToys.Common.UI.dll",
|
||||
"PowerToys.Settings.UI.Lib.dll",
|
||||
|
||||
"modules\\AlwaysOnTop\\PowerToys.AlwaysOnTop.exe",
|
||||
"modules\\AlwaysOnTop\\PowerToys.AlwaysOnTopModuleInterface.dll",
|
||||
|
||||
"modules\\ColorPicker\\ColorPicker.dll",
|
||||
"modules\\ColorPicker\\ColorPickerUI.dll",
|
||||
"modules\\ColorPicker\\ColorPickerUI.exe",
|
||||
@@ -32,9 +34,6 @@
|
||||
"modules\\ColorPicker\\PowerToys.ColorPickerUI.dll",
|
||||
"modules\\ColorPicker\\PowerToys.ColorPickerUI.exe",
|
||||
|
||||
"modules\\AlwaysOnTop\\PowerToys.AlwaysOnTop.exe",
|
||||
"modules\\AlwaysOnTop\\PowerToys.AlwaysOnTopModuleInterface.dll",
|
||||
|
||||
"modules\\Awake\\PowerToys.AwakeModuleInterface.dll",
|
||||
"modules\\Awake\\PowerToys.Awake.exe",
|
||||
"modules\\Awake\\PowerToys.Awake.dll",
|
||||
@@ -52,12 +51,16 @@
|
||||
"modules\\FileExplorerPreview\\PowerToys.ManagedTelemetry.dll",
|
||||
"modules\\FileExplorerPreview\\PowerToys.MarkdownPreviewHandler.dll",
|
||||
"modules\\FileExplorerPreview\\PowerToys.MarkdownPreviewHandler.comhost.dll",
|
||||
"modules\\FileExplorerPreview\\PowerToys.MonacoPreviewHandler.dll",
|
||||
"modules\\FileExplorerPreview\\PowerToys.MonacoPreviewHandler.comhost.dll",
|
||||
"modules\\FileExplorerPreview\\PowerToys.PdfPreviewHandler.dll",
|
||||
"modules\\FileExplorerPreview\\PowerToys.PdfPreviewHandler.comhost.dll",
|
||||
"modules\\FileExplorerPreview\\PowerToys.PdfThumbnailProvider.dll",
|
||||
"modules\\FileExplorerPreview\\PowerToys.PdfThumbnailProvider.comhost.dll",
|
||||
"modules\\FileExplorerPreview\\PowerToys.powerpreview.dll",
|
||||
"modules\\FileExplorerPreview\\PowerToys.PreviewHandlerCommon.dll",
|
||||
"modules\\FileExplorerPreview\\PowerToys.StlThumbnailProvider.dll",
|
||||
"modules\\FileExplorerPreview\\PowerToys.StlThumbnailProvider.comhost.dll",
|
||||
"modules\\FileExplorerPreview\\PowerToys.SvgPreviewHandler.dll",
|
||||
"modules\\FileExplorerPreview\\PowerToys.SvgPreviewHandler.comhost.dll",
|
||||
"modules\\FileExplorerPreview\\PowerToys.SvgThumbnailProvider.dll",
|
||||
@@ -91,11 +94,13 @@
|
||||
"modules\\launcher\\Plugins\\VSCodeWorkspaces\\Community.PowerToys.Run.Plugin.VSCodeWorkspaces.dll",
|
||||
"modules\\launcher\\Plugins\\Service\\Microsoft.PowerToys.Run.Plugin.Service.dll",
|
||||
"modules\\launcher\\Plugins\\System\\Microsoft.PowerToys.Run.Plugin.System.dll",
|
||||
"modules\\launcher\\Plugins\\TimeZone\\Microsoft.PowerToys.Run.Plugin.TimeZone.dll",
|
||||
"modules\\launcher\\Plugins\\WebSearch\\Community.PowerToys.Run.Plugin.WebSearch.dll",
|
||||
"modules\\launcher\\Plugins\\WindowsTerminal\\Microsoft.PowerToys.Run.Plugin.WindowsTerminal.dll",
|
||||
|
||||
"modules\\MouseUtils\\PowerToys.FindMyMouse.dll",
|
||||
"modules\\MouseUtils\\PowerToys.MouseHighlighter.dll",
|
||||
"modules\\MouseUtils\\PowerToys.MousePointerCrosshairs.dll",
|
||||
|
||||
"modules\\PowerRename\\PowerToys.PowerRenameExt.dll",
|
||||
"modules\\PowerRename\\PowerToys.PowerRenameUILib.dll",
|
||||
@@ -154,7 +159,6 @@
|
||||
},
|
||||
{
|
||||
"MatchedPath": [
|
||||
"Microsoft.Search.Interop.dll",
|
||||
"ModernWpf.dll",
|
||||
"ModernWpf.Controls.dll",
|
||||
"System.IO.Abstractions.dll",
|
||||
@@ -165,9 +169,10 @@
|
||||
"NLog.dll",
|
||||
"HtmlAgilityPack.dll",
|
||||
"Markdig.Signed.dll",
|
||||
"HelixToolkit.dll",
|
||||
"HelixToolkit.Core.Wpf.dll",
|
||||
"Mages.Core.dll",
|
||||
"JetBrains.Annotations.dll",
|
||||
"ICSharpCode.SharpZipLib.dll",
|
||||
"NLog.Extensions.Logging.dll",
|
||||
"concrt140_app.dll",
|
||||
"msvcp140_1_app.dll",
|
||||
@@ -178,6 +183,14 @@
|
||||
"vcomp140_app.dll",
|
||||
"vcruntime140_1_app.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",
|
||||
"modules\\FileExplorerPreview\\runtimes\\win-x64\\native\\WebView2Loader.dll",
|
||||
"modules\\launcher\\e_sqlite3.dll",
|
||||
"modules\\launcher\\SQLitePCLRaw.batteries_v2.dll",
|
||||
"modules\\launcher\\SQLitePCLRaw.core.dll",
|
||||
"modules\\launcher\\SQLitePCLRaw.provider.e_sqlite3.dll",
|
||||
"ColorCode.Core.dll",
|
||||
"ColorCode.UWP.dll",
|
||||
"UnitsNet.dll"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
cd /D "%~dp0"
|
||||
|
||||
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\Tools\VsDevCmd.bat" -arch=amd64 -host_arch=amd64 -winsdk=10.0.18362.0
|
||||
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\Tools\VsDevCmd.bat" -arch=amd64 -host_arch=amd64 -winsdk=10.0.18362.0
|
||||
SET IsPipeline=1
|
||||
call msbuild ../installer/PowerToysSetup.sln /target:PowerToysInstaller /p:Configuration=Release /p:Platform=x64 /p:CIBuild=true || exit /b 1
|
||||
|
||||
@@ -10,6 +10,7 @@ jobs:
|
||||
BuildConfiguration: ${{ parameters.configuration }}
|
||||
BuildPlatform: ${{ parameters.platform }}
|
||||
pool:
|
||||
demands: ImageOverride -equals WinDevVS17-latest
|
||||
${{ if eq(variables['System.CollectionUri'], 'https://dev.azure.com/ms/') }}:
|
||||
name: WinDevPoolOSS-L
|
||||
${{ if ne(variables['System.CollectionUri'], 'https://dev.azure.com/ms/') }}:
|
||||
|
||||
@@ -7,12 +7,20 @@ steps:
|
||||
submodules: true
|
||||
clean: true
|
||||
|
||||
- task: NuGetToolInstaller@0
|
||||
displayName: Ensure NuGet 5.8.0
|
||||
- task: UseDotNet@2
|
||||
displayName: 'Use .NET 3.1 for unit test SDK'
|
||||
inputs:
|
||||
versionSpec: 5.8.0
|
||||
packageType: sdk
|
||||
version: '3.1.x'
|
||||
|
||||
#- template: .\..\..\..\restore-dependencies.yml
|
||||
- task: UseDotNet@2
|
||||
displayName: 'Use .NET 6 SDK'
|
||||
inputs:
|
||||
packageType: sdk
|
||||
version: '6.x'
|
||||
|
||||
- task: NuGetToolInstaller@1
|
||||
displayName: Ensure NuGet Installer
|
||||
|
||||
- task: VisualStudioTestPlatformInstaller@1
|
||||
displayName: Ensure VSTest Platform
|
||||
@@ -30,7 +38,7 @@ steps:
|
||||
displayName: 'Build PowerToys.sln'
|
||||
inputs:
|
||||
solution: '**\PowerToys.sln'
|
||||
vsVersion: 16.0
|
||||
vsVersion: 17.0
|
||||
platform: '$(BuildPlatform)'
|
||||
configuration: '$(BuildConfiguration)'
|
||||
msbuildArgs: ${{ parameters.additionalBuildArguments }}
|
||||
@@ -49,7 +57,7 @@ steps:
|
||||
displayName: 'Build BugReportTool.sln'
|
||||
inputs:
|
||||
solution: '**\BugReportTool.sln'
|
||||
vsVersion: 16.0
|
||||
vsVersion: 17.0
|
||||
platform: '$(BuildPlatform)'
|
||||
configuration: '$(BuildConfiguration)'
|
||||
msbuildArgs: ${{ parameters.additionalBuildArguments }}
|
||||
@@ -68,7 +76,7 @@ steps:
|
||||
displayName: 'Build WebcamReportTool.sln'
|
||||
inputs:
|
||||
solution: '**\WebcamReportTool.sln'
|
||||
vsVersion: 16.0
|
||||
vsVersion: 17.0
|
||||
platform: '$(BuildPlatform)'
|
||||
configuration: '$(BuildConfiguration)'
|
||||
msbuildArgs: ${{ parameters.additionalBuildArguments }}
|
||||
@@ -87,7 +95,7 @@ steps:
|
||||
displayName: 'Build PowerToysSetup.sln'
|
||||
inputs:
|
||||
solution: '**\installer\PowerToysSetup.sln'
|
||||
vsVersion: 16.0
|
||||
vsVersion: 17.0
|
||||
platform: '$(BuildPlatform)'
|
||||
configuration: '$(BuildConfiguration)'
|
||||
msbuildArgs: ${{ parameters.additionalBuildArguments }}
|
||||
@@ -103,6 +111,7 @@ steps:
|
||||
testAssemblyVer2: |
|
||||
**\UnitTests-GcodeThumbnailProvider.dll
|
||||
**\UnitTests-SvgThumbnailProvider.dll
|
||||
**\UnitTests-StlThumbnailProvider.dll
|
||||
**\UnitTests-PdfThumbnailProvider.dll
|
||||
**\Settings.UI.UnitTests.dll
|
||||
**\UnitTests-MarkdownPreviewHandler.dll
|
||||
@@ -122,8 +131,9 @@ steps:
|
||||
**\Microsoft.Plugin.Uri.UnitTests.dll
|
||||
**\Wox.Test.dll
|
||||
**\Microsoft.PowerToys.Run.Plugin.System.UnitTests.dll
|
||||
**\Microsoft.PowerToys.Run.Plugin.WindowsTerminal.UnitTests.dll
|
||||
**\Microsoft.Plugin.WindowsTerminal.UnitTests.dll
|
||||
!**\obj\**
|
||||
!**\ref\**
|
||||
|
||||
# Native dlls
|
||||
- task: VSTest@2
|
||||
|
||||
@@ -4,7 +4,7 @@ pr: none
|
||||
|
||||
pool:
|
||||
name: WinDevPool-L
|
||||
demands: ImageOverride -equals WinDevVS16-latest
|
||||
demands: ImageOverride -equals WinDevVS17-latest
|
||||
|
||||
parameters:
|
||||
- name: buildConfigurations
|
||||
@@ -53,37 +53,26 @@ jobs:
|
||||
scriptName: .pipelines/versionSetting.ps1
|
||||
arguments: -versionNumber '${{ parameters.versionNumber }}' -DevEnvironment ''
|
||||
|
||||
- task: MicrosoftTDBuild.tdbuild-task.tdbuild-task.TouchdownBuildTask@1
|
||||
displayName: 'Download Localization Files -- PowerToys 37400'
|
||||
# Guardian tool needs 'Microsoft.NETCore.App', version '2.1.0' (x64)
|
||||
- task: UseDotNet@2
|
||||
displayName: 'Use .NET Core 2.1 SDK'
|
||||
inputs:
|
||||
teamId: 37400
|
||||
authId: '$(TouchdownApplicationID)'
|
||||
authKey: '$(TouchdownApplicationKey)'
|
||||
resourceFilePath: |
|
||||
**\Resources.resx
|
||||
**\Resource.resx
|
||||
**\Resources.resw
|
||||
appendRelativeDir: true
|
||||
localizationTarget: false
|
||||
pseudoSetting: Included
|
||||
- task: PowerShell@2
|
||||
displayName: Move Loc files into correct locations
|
||||
packageType: sdk
|
||||
version: '2.1.x'
|
||||
|
||||
- task: UseDotNet@2
|
||||
displayName: 'Use .NET 6 SDK'
|
||||
inputs:
|
||||
targetType: inline
|
||||
script: >-
|
||||
$VerbosePreference = "Continue"
|
||||
packageType: sdk
|
||||
version: '6.x'
|
||||
|
||||
./tools/build/move-and-rename-resx.ps1
|
||||
|
||||
./tools/build/move-uwp-resw.ps1
|
||||
pwsh: true
|
||||
- task: NuGetAuthenticate@0
|
||||
inputs:
|
||||
nuGetServiceConnections: PowerToysCDPxFeed
|
||||
|
||||
- task: NuGetToolInstaller@1
|
||||
displayName: Use NuGet 5.10
|
||||
inputs:
|
||||
versionSpec: 5.10
|
||||
displayName: Use NuGet Installer latest
|
||||
|
||||
# this will restore the following nugets:
|
||||
# - main solution
|
||||
# - Bug report tool
|
||||
@@ -98,6 +87,32 @@ jobs:
|
||||
selectOrConfig: config
|
||||
nugetConfigPath: .pipelines/release-nuget.config
|
||||
|
||||
- task: MicrosoftTDBuild.tdbuild-task.tdbuild-task.TouchdownBuildTask@1
|
||||
displayName: 'Download Localization Files -- PowerToys 37400'
|
||||
inputs:
|
||||
teamId: 37400
|
||||
authId: '$(TouchdownApplicationID)'
|
||||
authKey: '$(TouchdownApplicationKey)'
|
||||
resourceFilePath: |
|
||||
**\Resources.resx
|
||||
**\Resource.resx
|
||||
**\Resources.resw
|
||||
appendRelativeDir: true
|
||||
localizationTarget: false
|
||||
# pseudoSetting: Included
|
||||
|
||||
- task: PowerShell@2
|
||||
displayName: Move Loc files into correct locations
|
||||
inputs:
|
||||
targetType: inline
|
||||
script: >-
|
||||
$VerbosePreference = "Continue"
|
||||
|
||||
./tools/build/move-and-rename-resx.ps1
|
||||
|
||||
./tools/build/move-uwp-resw.ps1
|
||||
pwsh: true
|
||||
|
||||
- task: CmdLine@2
|
||||
displayName: Moving telem files
|
||||
inputs:
|
||||
@@ -111,7 +126,7 @@ jobs:
|
||||
displayName: Build PowerToys main project
|
||||
inputs:
|
||||
solution: '**\PowerToys.sln'
|
||||
vsVersion: 16.0
|
||||
vsVersion: 17.0
|
||||
msbuildArgs: /p:CIBuild=true /bl:$(Build.SourcesDirectory)\msbuild.binlog
|
||||
platform: $(BuildPlatform)
|
||||
configuration: $(BuildConfiguration)
|
||||
@@ -122,7 +137,7 @@ jobs:
|
||||
displayName: Build BugReportTool
|
||||
inputs:
|
||||
solution: '**/tools/BugReportTool/BugReportTool.sln'
|
||||
vsVersion: 16.0
|
||||
vsVersion: 17.0
|
||||
msbuildArgs: /p:CIBuild=true /bl:$(Build.SourcesDirectory)\msbuild.binlog
|
||||
platform: $(BuildPlatform)
|
||||
configuration: $(BuildConfiguration)
|
||||
@@ -133,7 +148,7 @@ jobs:
|
||||
displayName: Build WebcamReportTool
|
||||
inputs:
|
||||
solution: '**/tools/WebcamReportTool/WebcamReportTool.sln'
|
||||
vsVersion: 16.0
|
||||
vsVersion: 17.0
|
||||
msbuildArgs: /p:CIBuild=true /bl:$(Build.SourcesDirectory)\msbuild.binlog
|
||||
platform: $(BuildPlatform)
|
||||
configuration: $(BuildConfiguration)
|
||||
@@ -144,7 +159,7 @@ jobs:
|
||||
displayName: Build PowerToysSetupCustomActions
|
||||
inputs:
|
||||
solution: '**/installer/PowerToysSetup.sln'
|
||||
vsVersion: 16.0
|
||||
vsVersion: 17.0
|
||||
msbuildArgs: /target:PowerToysSetupCustomActions /p:CIBuild=true /bl:$(Build.SourcesDirectory)\msbuild.binlog
|
||||
platform: $(BuildPlatform)
|
||||
configuration: $(BuildConfiguration)
|
||||
@@ -155,7 +170,7 @@ jobs:
|
||||
displayName: Publish Settings for Packaging
|
||||
inputs:
|
||||
solution: 'src/settings-ui/PowerToys.Settings/PowerToys.Settings.csproj'
|
||||
vsVersion: 16.0
|
||||
vsVersion: 17.0
|
||||
msbuildArgs: >-
|
||||
/target:Publish
|
||||
/p:Configuration=$(BuildConfiguration);Platform=$(BuildPlatform);AppxBundle=Never
|
||||
@@ -170,7 +185,7 @@ jobs:
|
||||
displayName: Publish Launcher for Packaging
|
||||
inputs:
|
||||
solution: 'src/modules/launcher/PowerLauncher/PowerLauncher.csproj'
|
||||
vsVersion: 16.0
|
||||
vsVersion: 17.0
|
||||
# The arguments should be the same as the ones for Settings; make sure they are.
|
||||
msbuildArgs: >-
|
||||
/target:Publish
|
||||
@@ -185,6 +200,7 @@ jobs:
|
||||
#### MAIN SIGNING AREA
|
||||
# reference https://dev.azure.com/microsoft/Dart/_git/AppDriver?path=/ESRPSigning.json&version=GBarm64-netcore&_a=contents for winappdriver
|
||||
# https://dev.azure.com/microsoft/Dart/_git/AppDriver?path=/CIPolicy.xml&version=GBarm64-netcore&_a=contents
|
||||
|
||||
- task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@1
|
||||
displayName: Sign Core PT
|
||||
inputs:
|
||||
@@ -210,13 +226,27 @@ jobs:
|
||||
displayName: Build MSI
|
||||
inputs:
|
||||
solution: '**/installer/PowerToysSetup.sln'
|
||||
vsVersion: 16.0
|
||||
vsVersion: 17.0
|
||||
msbuildArgs: /p:CIBuild=true /target:PowerToysInstaller /bl:$(Build.SourcesDirectory)\msbuild.binlog
|
||||
platform: $(BuildPlatform)
|
||||
configuration: $(BuildConfiguration)
|
||||
clean: true
|
||||
maximumCpuCount: true
|
||||
|
||||
- task: CmdLine@2
|
||||
displayName: 'Extracting MSI to verify contents'
|
||||
inputs:
|
||||
script: |
|
||||
.\installer\packages\WiX.3.11.2\tools\dark.exe -x $(build.sourcesdirectory)\extractedMsi installer\PowerToysSetup\$(BuildPlatform)\$(BuildConfiguration)\PowerToysSetup-${{ parameters.versionNumber }}-$(BuildPlatform).msi
|
||||
dir $(build.sourcesdirectory)\extractedMsi
|
||||
|
||||
# Did we sign all files
|
||||
- task: PowerShell@1
|
||||
displayName: Verifying entire build is signed and version set
|
||||
inputs:
|
||||
scriptName: .pipelines/versionAndSignCheck.ps1
|
||||
arguments: -targetDir '$(build.sourcesdirectory)\extractedMsi\File'
|
||||
|
||||
- task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@1
|
||||
displayName: Sign MSI
|
||||
inputs:
|
||||
@@ -232,7 +262,7 @@ jobs:
|
||||
displayName: Build Bootstrapper
|
||||
inputs:
|
||||
solution: '**/installer/PowerToysSetup.sln'
|
||||
vsVersion: 16.0
|
||||
vsVersion: 17.0
|
||||
msbuildArgs: /p:CIBuild=true /bl:$(Build.SourcesDirectory)\msbuild.binlog
|
||||
platform: $(BuildPlatform)
|
||||
configuration: $(BuildConfiguration)
|
||||
@@ -304,14 +334,54 @@ jobs:
|
||||
displayName: Component Detection
|
||||
|
||||
- task: CopyFiles@2
|
||||
displayName: Copying files for symbols
|
||||
inputs:
|
||||
contents: >-
|
||||
**/*.pdb
|
||||
flattenFolders: True
|
||||
targetFolder: $(Build.ArtifactStagingDirectory)/Symbols/
|
||||
|
||||
- task: PowerShell@2
|
||||
displayName: 'Remove unneeded files from ArtifactStagingDirectory'
|
||||
inputs:
|
||||
targetType: 'inline'
|
||||
script: |
|
||||
cd $(Build.ArtifactStagingDirectory)/Symbols/
|
||||
Remove-Item vc143.pdb
|
||||
Remove-Item *test*
|
||||
|
||||
- task: PublishSymbols@2
|
||||
displayName: Publish symbols path
|
||||
continueOnError: True
|
||||
inputs:
|
||||
SearchPattern: |
|
||||
$(Build.ArtifactStagingDirectory)/Symbols/**/*.*
|
||||
IndexSources: false
|
||||
SymbolServerType: TeamServices
|
||||
|
||||
- task: PublishBuildArtifacts@1
|
||||
displayName: 'Publish Artifact: Symbols'
|
||||
inputs:
|
||||
PathtoPublish: $(System.ArtifactsDirectory)/Symbols/
|
||||
ArtifactName: Symbols
|
||||
|
||||
- task: DeleteFiles@1
|
||||
displayName: 'Remove symbols from ArtifactStagingDirectory'
|
||||
inputs:
|
||||
Contents: '*'
|
||||
SourceFolder: $(Build.ArtifactStagingDirectory)/Symbols/
|
||||
RemoveSourceFolder: True
|
||||
|
||||
- task: CopyFiles@2
|
||||
displayName: Copying setup file over
|
||||
inputs:
|
||||
contents: '**/PowerToysSetup-*.exe'
|
||||
flattenFolders: True
|
||||
targetFolder: $(Build.ArtifactStagingDirectory)
|
||||
|
||||
|
||||
- task: PublishBuildArtifacts@1
|
||||
displayName: 'Publish Artifact: PowerToySetup'
|
||||
inputs:
|
||||
PathtoPublish: $(System.ArtifactsDirectory)
|
||||
ArtifactName: BuildArtifacts
|
||||
ArtifactName: setup-$(BuildPlatform)
|
||||
...
|
||||
|
||||
50
.pipelines/versionAndSignCheck.ps1
Normal file
50
.pipelines/versionAndSignCheck.ps1
Normal file
@@ -0,0 +1,50 @@
|
||||
[CmdletBinding()]
|
||||
# todo: send in arch / conf, could send in actual path
|
||||
Param(
|
||||
[Parameter(Mandatory=$True,Position=1)]
|
||||
[AllowEmptyString()]
|
||||
[string]$targetDir = $PSScriptRoot + '/../extractedMsi/File'
|
||||
)
|
||||
|
||||
$DirPath = $targetDir; #this file is in pipeline, we need root.
|
||||
$items = Get-ChildItem -Path $DirPath -File -Include *.exe,*.dll,*.ttf -Recurse -Force -ErrorAction SilentlyContinue
|
||||
$totalFailure = 0;
|
||||
|
||||
Write-Host $DirPath;
|
||||
|
||||
if(-not (Test-Path $DirPath))
|
||||
{
|
||||
Write-Host "Folder does not exist!"
|
||||
}
|
||||
|
||||
Write-Host "Total items: " $items.Count
|
||||
|
||||
if($items.Count -eq 0)
|
||||
{
|
||||
# no items means something bad happened. We should fail ASAP
|
||||
exit 1;
|
||||
}
|
||||
|
||||
$items | ForEach-Object {
|
||||
if($_.VersionInfo.FileVersion -eq "1.0.0.0" )
|
||||
{
|
||||
Write-Host "Version not set: " + $_.FullName
|
||||
$totalFailure++;
|
||||
}
|
||||
}
|
||||
|
||||
$items | ForEach-Object {
|
||||
$auth = Get-AuthenticodeSignature $_.FullName
|
||||
if($auth.SignerCertificate -eq $null)
|
||||
{
|
||||
Write-Host "Not Signed: " + $_.FullName
|
||||
$totalFailure++;
|
||||
}
|
||||
}
|
||||
|
||||
if($totalFailure -gt 0)
|
||||
{
|
||||
exit 1
|
||||
}
|
||||
|
||||
exit 0
|
||||
@@ -6,7 +6,6 @@
|
||||
"Microsoft.VisualStudio.Workload.NativeDesktop",
|
||||
"Microsoft.VisualStudio.Workload.ManagedDesktop",
|
||||
"Microsoft.VisualStudio.Workload.Universal",
|
||||
"Microsoft.VisualStudio.Component.Windows10SDK.17134",
|
||||
"Microsoft.VisualStudio.Component.Windows10SDK.18362",
|
||||
"Microsoft.VisualStudio.ComponentGroup.UWP.VC",
|
||||
"Microsoft.VisualStudio.Component.VC.Runtimes.x86.x64.Spectre",
|
||||
|
||||
11
COMMUNITY.md
11
COMMUNITY.md
@@ -6,11 +6,20 @@ Names are in alphabetical order based on first name.
|
||||
|
||||
## High impact community members
|
||||
|
||||
### [@Aaron-Junker](https://github.com/Aaron-Junker) - [Aaron Junker](https://aaron-junker.github.io)
|
||||
Aaron has helped triaging, discussing, and creating a substantial number of issues and contributed features/fixes as well as work on an upcoming 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.
|
||||
|
||||
### [@franky920920](https://github.com/franky920920) - [Franky Chen](https://frankychen.net)
|
||||
Franky has helped triaging, discussing, and creating a substantial number of issues and contributed features/fixes to PowerToys.
|
||||
|
||||
### [@htcfreek](https://github.com/htcfreek) - Heiko
|
||||
Heiko has helped triaging, discussing, and creating a substantial number of issues and contributed features/fixes to PowerToys Run.
|
||||
Heiko has helped triaging, discussing, and creating a substantial number of issues and contributed features/fixes to PowerToys.
|
||||
|
||||
### [@Jay-o-Way](https://github.com/Jay-o-Way) - Jay
|
||||
Jay has helped triaging, discussing, creating a substantial number of issues and PRs.
|
||||
|
||||
### [@jsoref](https://github.com/jsoref) - [Josh Soref](https://check-spelling.dev/)
|
||||
Helping keep our spelling correct :)
|
||||
|
||||
@@ -81,7 +81,7 @@
|
||||
|
||||
<!-- Props that are constant for both Debug and Release configurations -->
|
||||
<PropertyGroup Label="Configuration">
|
||||
<PlatformToolset Condition="'$(OverridePlatformToolset)'!='True'">v142</PlatformToolset>
|
||||
<PlatformToolset Condition="'$(OverridePlatformToolset)'!='True'">v143</PlatformToolset>
|
||||
<IntDir>$(SolutionDir)$(Platform)\$(Configuration)\obj\$(ProjectName)\</IntDir>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
|
||||
44
NOTICE.md
44
NOTICE.md
@@ -1,7 +1,13 @@
|
||||
# NOTICES AND INFORMATION
|
||||
This software incorporates material from third parties.
|
||||
|
||||
## PowerToy: Color Picker
|
||||
- Color Picker
|
||||
- File Explorer Add-ins
|
||||
- ImageResizer
|
||||
- PowerToys Run
|
||||
- Installer/Runner
|
||||
|
||||
## Utility: Color Picker
|
||||
|
||||
### Martin Chrzan's Color Picker
|
||||
|
||||
@@ -29,7 +35,37 @@ 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.
|
||||
|
||||
## PowerToy: ImageResizer
|
||||
## Utility: File Explorer Add-ins
|
||||
|
||||
### Monaco Editor
|
||||
|
||||
**Source**: https://github.com/Microsoft/monaco-editor
|
||||
|
||||
**Additional third party notifications:** https://github.com/microsoft/monaco-editor/blob/main/ThirdPartyNotices.txt
|
||||
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2016 - present Microsoft Corporation
|
||||
|
||||
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.
|
||||
|
||||
## Utility: ImageResizer
|
||||
|
||||
### Brice Lams's Image Resizer License
|
||||
|
||||
@@ -57,7 +93,7 @@ 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.
|
||||
|
||||
## PowerToy: Launcher
|
||||
## Utility: PowerToys Run
|
||||
|
||||
### Wox License
|
||||
|
||||
@@ -99,7 +135,7 @@ The above copyright notice and this permission notice shall be included in all c
|
||||
|
||||
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.
|
||||
|
||||
## PowerToy: PowerRename
|
||||
## Utility: PowerRename
|
||||
|
||||
### Chris Davis's SmartRename License
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.28803.452
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.0.32014.148
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "runner", "src\runner\runner.vcxproj", "{9412D5C6-2CF2-4FC2-A601-B55508EA9B27}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
@@ -9,7 +9,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "runner", "src\runner\runner
|
||||
{51920F1F-C28C-4ADF-8660-4238766796C2} = {51920F1F-C28C-4ADF-8660-4238766796C2}
|
||||
{6A71162E-FC4C-4A2C-B90F-3CF94F59A9BB} = {6A71162E-FC4C-4A2C-B90F-3CF94F59A9BB}
|
||||
{031AC72E-FA28-4AB7-B690-6F7B9C28AA73} = {031AC72E-FA28-4AB7-B690-6F7B9C28AA73}
|
||||
{0485F45C-EA7A-4BB5-804B-3E8D14699387} = {0485F45C-EA7A-4BB5-804B-3E8D14699387}
|
||||
{D29DDD63-E2CF-4657-9FD5-2AEDE4257E5D} = {D29DDD63-E2CF-4657-9FD5-2AEDE4257E5D}
|
||||
{5CCC8468-DEC8-4D36-99D4-5C891BEBD481} = {5CCC8468-DEC8-4D36-99D4-5C891BEBD481}
|
||||
{BA58206B-1493-4C75-BFEA-A85768A1E156} = {BA58206B-1493-4C75-BFEA-A85768A1E156}
|
||||
@@ -74,8 +73,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PowerRenameUnitTests", "src
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ModuleTemplateCompileTest", "tools\project_template\ModuleTemplate\ModuleTemplateCompileTest.vcxproj", "{64A80062-4D8B-4229-8A38-DFA1D7497749}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PowerRenameUWPUI", "src\modules\powerrename\UWPui\PowerRenameUWPUI.vcxproj", "{0485F45C-EA7A-4BB5-804B-3E8D14699387}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "KeyboardManager", "src\modules\keyboardmanager\dll\KeyboardManager.vcxproj", "{89F34AF7-1C34-4A72-AA6E-534BCF972BD9}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "imageresizer", "imageresizer", "{6C7F47CC-2151-44A3-A546-41C70025132C}"
|
||||
@@ -177,7 +174,7 @@ EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{4981CCD1-4CD9-4A49-B240-00AA46493FF8}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
src\.editorconfig = src\.editorconfig
|
||||
src\tests\win-app-driver\packages.config = src\tests\win-app-driver\packages.config
|
||||
.vsconfig = .vsconfig
|
||||
Solution.props = Solution.props
|
||||
EndProjectSection
|
||||
EndProject
|
||||
@@ -268,6 +265,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "utils", "utils", "{B39DC643
|
||||
src\common\utils\elevation.h = src\common\utils\elevation.h
|
||||
src\common\utils\EventLocker.h = src\common\utils\EventLocker.h
|
||||
src\common\utils\EventWaiter.h = src\common\utils\EventWaiter.h
|
||||
src\common\utils\excluded_apps.h = src\common\utils\excluded_apps.h
|
||||
src\common\utils\exec.h = src\common\utils\exec.h
|
||||
src\common\utils\game_mode.h = src\common\utils\game_mode.h
|
||||
src\common\utils\HDropIterator.h = src\common\utils\HDropIterator.h
|
||||
@@ -360,7 +358,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UnitTests-PdfThumbnailProvi
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.PowerToys.Run.Plugin.WindowsTerminal", "src\modules\launcher\Plugins\Microsoft.PowerToys.Run.Plugin.WindowsTerminal\Microsoft.PowerToys.Run.Plugin.WindowsTerminal.csproj", "{A2D583F0-B70C-4462-B1F0-8E81AFB7BA85}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.PowerToys.Run.Plugin.WindowsTerminal.UnitTests", "src\modules\launcher\Plugins\Microsoft.PowerToys.Run.Plugin.WindowsTerminal.UnitTests\Microsoft.PowerToys.Run.Plugin.WindowsTerminal.UnitTests.csproj", "{4ED320BC-BA04-4D42-8D15-CBE62151F08B}"
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Plugin.WindowsTerminal.UnitTests", "src\modules\launcher\Plugins\Microsoft.PowerToys.Run.Plugin.WindowsTerminal.UnitTests\Microsoft.Plugin.WindowsTerminal.UnitTests.csproj", "{4ED320BC-BA04-4D42-8D15-CBE62151F08B}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PowerRenameUIHost", "src\modules\powerrename\PowerRenameUIHost\PowerRenameUIHost.vcxproj", "{F7EC4E6C-19CA-4FBD-9918-B8AC5FEF4F63}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
@@ -391,6 +389,16 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "AlwaysOnTopModuleInterface"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Community.PowerToys.Run.Plugin.WebSearch", "src\modules\launcher\Plugins\Community.PowerToys.Run.Plugin.WebSearch\Community.PowerToys.Run.Plugin.WebSearch.csproj", "{9F94B303-5E21-4364-9362-64426F8DB932}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MousePointerCrosshairs", "src\modules\MouseUtils\MousePointerCrosshairs\MousePointerCrosshairs.vcxproj", "{EAE14C0E-7A6B-45DA-9080-A7D8C077BA6E}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "StlThumbnailProvider", "src\modules\previewpane\StlThumbnailProvider\StlThumbnailProvider.csproj", "{F7C8C0F1-5431-4347-89D0-8E5354F93CF2}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UnitTests-StlThumbnailProvider", "src\modules\previewpane\UnitTests-StlThumbnailProvider\UnitTests-StlThumbnailProvider.csproj", "{F1F6B6B6-9F18-4A17-8B5C-97DF552C53DC}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MonacoPreviewHandler", "src\modules\previewpane\MonacoPreviewHandler\MonacoPreviewHandler.csproj", "{04B193D7-3E21-46B8-A958-89B63A8A69DE}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.PowerToys.Run.Plugin.TimeZone", "src\modules\launcher\Plugins\Microsoft.PowerToys.Run.Plugin.TimeZone\Microsoft.PowerToys.Run.Plugin.TimeZone.csproj", "{F44934A8-36F3-49B0-9465-3831BE041CDE}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|x64 = Debug|x64
|
||||
@@ -459,12 +467,6 @@ Global
|
||||
{64A80062-4D8B-4229-8A38-DFA1D7497749}.Release|x64.ActiveCfg = Release|x64
|
||||
{64A80062-4D8B-4229-8A38-DFA1D7497749}.Release|x64.Build.0 = Release|x64
|
||||
{64A80062-4D8B-4229-8A38-DFA1D7497749}.Release|x86.ActiveCfg = Release|x64
|
||||
{0485F45C-EA7A-4BB5-804B-3E8D14699387}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{0485F45C-EA7A-4BB5-804B-3E8D14699387}.Debug|x64.Build.0 = Debug|x64
|
||||
{0485F45C-EA7A-4BB5-804B-3E8D14699387}.Debug|x86.ActiveCfg = Debug|x64
|
||||
{0485F45C-EA7A-4BB5-804B-3E8D14699387}.Release|x64.ActiveCfg = Release|x64
|
||||
{0485F45C-EA7A-4BB5-804B-3E8D14699387}.Release|x64.Build.0 = Release|x64
|
||||
{0485F45C-EA7A-4BB5-804B-3E8D14699387}.Release|x86.ActiveCfg = Release|x64
|
||||
{89F34AF7-1C34-4A72-AA6E-534BCF972BD9}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{89F34AF7-1C34-4A72-AA6E-534BCF972BD9}.Debug|x64.Build.0 = Debug|x64
|
||||
{89F34AF7-1C34-4A72-AA6E-534BCF972BD9}.Debug|x86.ActiveCfg = Debug|x64
|
||||
@@ -986,8 +988,8 @@ Global
|
||||
{4ED320BC-BA04-4D42-8D15-CBE62151F08B}.Debug|x86.ActiveCfg = Debug|x64
|
||||
{4ED320BC-BA04-4D42-8D15-CBE62151F08B}.Release|x64.ActiveCfg = Release|x64
|
||||
{4ED320BC-BA04-4D42-8D15-CBE62151F08B}.Release|x64.Build.0 = Release|x64
|
||||
{4ED320BC-BA04-4D42-8D15-CBE62151F08B}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{4ED320BC-BA04-4D42-8D15-CBE62151F08B}.Release|x86.Build.0 = Release|Any CPU
|
||||
{4ED320BC-BA04-4D42-8D15-CBE62151F08B}.Release|x86.ActiveCfg = Release|x64
|
||||
{4ED320BC-BA04-4D42-8D15-CBE62151F08B}.Release|x86.Build.0 = Release|x64
|
||||
{F7EC4E6C-19CA-4FBD-9918-B8AC5FEF4F63}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{F7EC4E6C-19CA-4FBD-9918-B8AC5FEF4F63}.Debug|x64.Build.0 = Debug|x64
|
||||
{F7EC4E6C-19CA-4FBD-9918-B8AC5FEF4F63}.Debug|x86.ActiveCfg = Debug|x64
|
||||
@@ -1054,6 +1056,41 @@ Global
|
||||
{9F94B303-5E21-4364-9362-64426F8DB932}.Release|x64.ActiveCfg = Release|x64
|
||||
{9F94B303-5E21-4364-9362-64426F8DB932}.Release|x64.Build.0 = Release|x64
|
||||
{9F94B303-5E21-4364-9362-64426F8DB932}.Release|x86.ActiveCfg = Release|x64
|
||||
{EAE14C0E-7A6B-45DA-9080-A7D8C077BA6E}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{EAE14C0E-7A6B-45DA-9080-A7D8C077BA6E}.Debug|x64.Build.0 = Debug|x64
|
||||
{EAE14C0E-7A6B-45DA-9080-A7D8C077BA6E}.Debug|x86.ActiveCfg = Debug|x64
|
||||
{EAE14C0E-7A6B-45DA-9080-A7D8C077BA6E}.Release|x64.ActiveCfg = Release|x64
|
||||
{EAE14C0E-7A6B-45DA-9080-A7D8C077BA6E}.Release|x64.Build.0 = Release|x64
|
||||
{EAE14C0E-7A6B-45DA-9080-A7D8C077BA6E}.Release|x86.ActiveCfg = Release|x64
|
||||
{F7C8C0F1-5431-4347-89D0-8E5354F93CF2}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{F7C8C0F1-5431-4347-89D0-8E5354F93CF2}.Debug|x64.Build.0 = Debug|x64
|
||||
{F7C8C0F1-5431-4347-89D0-8E5354F93CF2}.Debug|x86.ActiveCfg = Debug|x64
|
||||
{F7C8C0F1-5431-4347-89D0-8E5354F93CF2}.Release|x64.ActiveCfg = Release|x64
|
||||
{F7C8C0F1-5431-4347-89D0-8E5354F93CF2}.Release|x64.Build.0 = Release|x64
|
||||
{F7C8C0F1-5431-4347-89D0-8E5354F93CF2}.Release|x86.ActiveCfg = Release|x64
|
||||
{F1F6B6B6-9F18-4A17-8B5C-97DF552C53DC}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{F1F6B6B6-9F18-4A17-8B5C-97DF552C53DC}.Debug|x64.Build.0 = Debug|x64
|
||||
{F1F6B6B6-9F18-4A17-8B5C-97DF552C53DC}.Debug|x86.ActiveCfg = Debug|x64
|
||||
{F1F6B6B6-9F18-4A17-8B5C-97DF552C53DC}.Release|x64.ActiveCfg = Release|x64
|
||||
{F1F6B6B6-9F18-4A17-8B5C-97DF552C53DC}.Release|x64.Build.0 = Release|x64
|
||||
{F1F6B6B6-9F18-4A17-8B5C-97DF552C53DC}.Release|x86.ActiveCfg = Release|x64
|
||||
{04B193D7-3E21-46B8-A958-89B63A8A69DE}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{04B193D7-3E21-46B8-A958-89B63A8A69DE}.Debug|x64.Build.0 = Debug|x64
|
||||
{04B193D7-3E21-46B8-A958-89B63A8A69DE}.Debug|x86.ActiveCfg = Debug|x64
|
||||
{04B193D7-3E21-46B8-A958-89B63A8A69DE}.Debug|x86.Build.0 = Debug|x64
|
||||
{04B193D7-3E21-46B8-A958-89B63A8A69DE}.Release|x64.ActiveCfg = Release|x64
|
||||
{04B193D7-3E21-46B8-A958-89B63A8A69DE}.Release|x64.Build.0 = Release|x64
|
||||
{04B193D7-3E21-46B8-A958-89B63A8A69DE}.Release|x86.ActiveCfg = Release|x64
|
||||
{04B193D7-3E21-46B8-A958-89B63A8A69DE}.Release|x86.Build.0 = Release|x64
|
||||
{04B193D7-3E21-46B8-A958-89B63A8A69DE}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{F44934A8-36F3-49B0-9465-3831BE041CDE}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{F44934A8-36F3-49B0-9465-3831BE041CDE}.Debug|x64.Build.0 = Debug|x64
|
||||
{F44934A8-36F3-49B0-9465-3831BE041CDE}.Debug|x86.ActiveCfg = Debug|x64
|
||||
{F44934A8-36F3-49B0-9465-3831BE041CDE}.Debug|x86.Build.0 = Debug|x64
|
||||
{F44934A8-36F3-49B0-9465-3831BE041CDE}.Release|x64.ActiveCfg = Release|x64
|
||||
{F44934A8-36F3-49B0-9465-3831BE041CDE}.Release|x64.Build.0 = Release|x64
|
||||
{F44934A8-36F3-49B0-9465-3831BE041CDE}.Release|x86.ActiveCfg = Release|x64
|
||||
{F44934A8-36F3-49B0-9465-3831BE041CDE}.Release|x86.Build.0 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
@@ -1070,7 +1107,6 @@ Global
|
||||
{51920F1F-C28C-4ADF-8660-4238766796C2} = {89E20BCE-EB9C-46C8-8B50-E01A82E6FDC3}
|
||||
{A3935CF4-46C5-4A88-84D3-6B12E16E6BA2} = {89E20BCE-EB9C-46C8-8B50-E01A82E6FDC3}
|
||||
{2151F984-E006-4A9F-92EF-C6DDE3DC8413} = {89E20BCE-EB9C-46C8-8B50-E01A82E6FDC3}
|
||||
{0485F45C-EA7A-4BB5-804B-3E8D14699387} = {89E20BCE-EB9C-46C8-8B50-E01A82E6FDC3}
|
||||
{89F34AF7-1C34-4A72-AA6E-534BCF972BD9} = {38BDB927-829B-4C65-9CD9-93FB05D66D65}
|
||||
{6C7F47CC-2151-44A3-A546-41C70025132C} = {4574FDD0-F61D-4376-98BF-E5A1262C11EC}
|
||||
{2BE46397-4DFA-414C-9BD4-41E4BBF8CB34} = {6C7F47CC-2151-44A3-A546-41C70025132C}
|
||||
@@ -1182,6 +1218,11 @@ Global
|
||||
{1DC3BE92-CE89-43FB-8110-9C043A2FE7A2} = {60CD2D4F-C3B9-4897-9821-FCA5098B41CE}
|
||||
{48A0A19E-A0BE-4256-ACF8-CC3B80291AF9} = {60CD2D4F-C3B9-4897-9821-FCA5098B41CE}
|
||||
{9F94B303-5E21-4364-9362-64426F8DB932} = {4AFC9975-2456-4C70-94A4-84073C1CED93}
|
||||
{EAE14C0E-7A6B-45DA-9080-A7D8C077BA6E} = {322566EF-20DC-43A6-B9F8-616AF942579A}
|
||||
{F7C8C0F1-5431-4347-89D0-8E5354F93CF2} = {2F305555-C296-497E-AC20-5FA1B237996A}
|
||||
{F1F6B6B6-9F18-4A17-8B5C-97DF552C53DC} = {2F305555-C296-497E-AC20-5FA1B237996A}
|
||||
{04B193D7-3E21-46B8-A958-89B63A8A69DE} = {2F305555-C296-497E-AC20-5FA1B237996A}
|
||||
{F44934A8-36F3-49B0-9465-3831BE041CDE} = {4AFC9975-2456-4C70-94A4-84073C1CED93}
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {C3A2F9D1-7930-4EF4-A6FC-7EE0A99821D0}
|
||||
|
||||
158
README.md
158
README.md
@@ -6,10 +6,10 @@
|
||||
|
||||
## Build status
|
||||
|
||||
| Architecture | Solution (Main) | Solution (Stable) | Installer (Main)<br/>Existing pipeline | Installer (Main)<br/>New pipeline |
|
||||
|--------------|-----------------|-------------------|-----------------------|-------------------------------|
|
||||
| x64 | [](https://dev.azure.com/ms/PowerToys/_build/latest?definitionId=219&branchName=main) | [](https://dev.azure.com/ms/PowerToys/_build/latest?definitionId=219&branchName=stable) | [](https://github-private.visualstudio.com/microsoft/_build/latest?definitionId=61&branchName=main) | [](https://dev.azure.com/microsoft/Dart/_build/latest?definitionId=76541&branchName=main) |
|
||||
| ARM64 | Currently investigating | [Issue #490](https://github.com/microsoft/PowerToys/issues/490) | | |
|
||||
| Architecture | Solution (Main) | Solution (Stable) | Installer (Main) |
|
||||
|--------------|-----------------|-------------------|------------------|
|
||||
| x64 | [](https://dev.azure.com/ms/PowerToys/_build/latest?definitionId=219&branchName=main) | [](https://dev.azure.com/ms/PowerToys/_build/latest?definitionId=219&branchName=stable) | [](https://dev.azure.com/microsoft/Dart/_build/latest?definitionId=76541&branchName=main) |
|
||||
| ARM64 | Currently investigating | [Issue #490](https://github.com/microsoft/PowerToys/issues/490) | |
|
||||
|
||||
## About
|
||||
|
||||
@@ -17,21 +17,24 @@ Microsoft PowerToys is a set of utilities for power users to tune and streamline
|
||||
|
||||
| | Current utilities: | |
|
||||
|--------------|--------------------|--------------|
|
||||
| [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) |
|
||||
| [Shortcut Guide](https://aka.ms/PowerToysOverview_ShortcutGuide) | [Video Conference Mute](https://aka.ms/PowerToysOverview_VideoConference) | |
|
||||
| [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) | [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 v1903 (18362) or newer.
|
||||
- [.NET Core 3.1.20 Desktop Runtime](https://dotnet.microsoft.com/download/dotnet/thank-you/runtime-desktop-3.1.20-windows-x64-installer) or a newer 3.1.x runtime. The installer will handle this if not present.
|
||||
- Our installer will install the following items:
|
||||
- [.NET Core 3.1.22 Desktop Runtime](https://dotnet.microsoft.com/download/dotnet/thank-you/runtime-desktop-3.1.22-windows-x64-installer) or a newer 3.1.x runtime. This is needed currently for the Settings application.
|
||||
- [.NET 5.0.13 Desktop Runtime](https://dotnet.microsoft.com/download/dotnet/thank-you/runtime-desktop-5.0.13-windows-x64-installer) or a newer 5.0.x runtime.
|
||||
- [Microsoft Edge WebView2 Runtime](https://go.microsoft.com/fwlink/p/?LinkId=2124703) bootstrapper. This will install the latest version.
|
||||
|
||||
### 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 and then click on `PowerToysSetup-0.51.1-x64.exe` to download the PowerToys installer.
|
||||
[Microsoft PowerToys GitHub releases page][github-release-link], click on `Assets` at the bottom to show the files available in the release and then click on `PowerToysSetup-0.55.0-x64.exe` to download the PowerToys installer.
|
||||
|
||||
This is our preferred method.
|
||||
|
||||
@@ -66,104 +69,83 @@ 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.51 - November 2021 Update
|
||||
### 0.55 - January 2022 Update
|
||||
|
||||
The [v0.51 release cycle][github-current-release-work] introduces some new things regarding our mouse utilities. First is we've added in a presentation mode helper to highlight your mouse when you click. We've also added additional settings toward Find my mouse to enable more customization.
|
||||
In this release, we are continuing our progress toward getting PowerToys ARM64 ready, fix some top issues and new utilities. Work from last month enabled us to upgrade the code base to .NET 5 and next month onward to .NET 6. This will provide stability and speed improvements.
|
||||
|
||||
Next we've been focusing work on "Always on Top" system to help make any window you want to be the top most. A lot of thought is currently going into interaction models to make sure it 'feels' right for toggling as well as visualizing.
|
||||
We're also extremely excited to bring on 3 new PowerToy utilities.
|
||||
|
||||
Last, we've been working on our engineering systems this month and into next. This work will improve our localization integration and our 'build farm' match our CI system far more. Behind the scene work but very important work for working faster.
|
||||
- File Explorer add-on: Developer files for preview pane. This should add about 150 file extensions total. We are using the [Monaco Editor](https://github.com/Microsoft/monaco-editor) to power this experience. Thanks [@aaron-junker](https://github.com/aaron-junker)!
|
||||
- File Explorer add-on: STL file format thumbnail generation! Since STL is a common 3D file format, this allows a quick visual check. Thanks [@pedrolamas](https://github.com/pedrolamas)! Preview pane support is already in Windows.
|
||||
- Mouse Utility: Crosshair over pointer via <kbd>Ctrl</kbd>+<kbd>Alt</kbd>+<kbd>P</kbd>. This feature was co-developed with the accessibility team at Microsoft. When the team told us about the idea and described trying to find your cursor by looking through a straw, we knew we could leverage code from the other mouse utilities to quickly enable this feature. Below is a quote from one of the testers with a rough validation build:
|
||||
|
||||
#### Highlights from v0.51
|
||||
> "This will change my life and allow me to use any PC without constantly losing the pointer. This is huge! I will be able to work at my normal speed again. It is a total game changer for people with visual field impairments!" – Joanna A.
|
||||
|
||||
**Things to note**
|
||||
- We shifted our localization internal service and are working on adding automated integrations back in.
|
||||
#### Community
|
||||
- We would love to directly say THANK YOU. Filing issues and feature requests takes time and we greatly appreciate it. You help us quickly diagnose, spot trends, and prioritize. We love when people fix bugs and develop new PowerToys every little bit does really help.
|
||||
- [@edwinzap](https://github.com/edwinzap) really helped us validate translation issues when our localization system was in transition.
|
||||
- [@bdoserror](https://github.com/bdoserror) quickly pointed out a release note error
|
||||
|
||||
**PowerToys Awake**
|
||||
- System tray and settings use same language for turning things on.
|
||||
#### General
|
||||
- .NET runtime is now on 5, our next release will be upgraded to .NET 6. Moving to .NET 5 and then 6 helped reduce our moving parts in a single release so we went this route. Why this is important is this is one of the major work items needed for ARM64 support. In addition, this should help provide a speed boosts once we are on .NET 6.
|
||||
- [@jsoref's](https://github.com/jsoref) spelling plugin help
|
||||
|
||||
**Color Picker**
|
||||
- New formats added to copy colors as a float or decimal value.
|
||||
- Adjust color window now accepts lower-case HEX codes.
|
||||
#### Always on Top
|
||||
- Fixed one of two borders showing incorrectly bugs.
|
||||
- Border defaults to OS accent color now. Thanks [@davidegiacometti](https://github.com/davidegiacometti)
|
||||
- Reduced CPU / GPU activity. Not done improving, we know we can do better.
|
||||
|
||||
**FancyZones**
|
||||
- New window switching functionality! Now users can assign multiple windows to a zone and cycle between them using the <kbd>Win</kbd> + <kbd>PgDn/PgUp</kbd> commands by default. Thanks [@FLOAT4](https://github.com/FLOAT4)!
|
||||
- Added functionality for zones to adopt system accent color and theme. Thanks [@davidegiacometti](https://github.com/davidegiacometti)!
|
||||
- Added visual preview of zone appearance in settings menu. Thanks [@niels9001](https://github.com/niels9001)!
|
||||
- Fixed bug where FancyZones crashes on launch.
|
||||
#### FancyZones
|
||||
- Bug fixed to not lose zones after update
|
||||
- Fixed editor margin issue for Chinese language. Thanks [@niels9001](https://github.com/niels9001)
|
||||
|
||||
**Image Resizer**
|
||||
- Fixed bug where resizing images creates empty folders.
|
||||
- Added option to remove non-essential metadata. Helps significantly reduce the size of files. Thanks [@CleanCodeDeveloper](https://github.com/CleanCodeDeveloper)!
|
||||
- Fixed bug caused by Image Resizer receiving an unexpected property type or value. Thanks [@CleanCodeDeveloper](https://github.com/CleanCodeDeveloper)!
|
||||
#### File explorer add-ons
|
||||
- GCode thumbnails now have transparency. Thanks [@pedrolamas](https://github.com/pedrolamas)
|
||||
- New Utility - Developer files for File Explorer preview pane. This should add about 150 file extensions total. We are using the [Monaco Editor](https://github.com/Microsoft/monaco-editor) to power this experience. Thanks [@aaron-junker](https://github.com/aaron-junker)!
|
||||
- New Utility - STL thumbnails added! Preview pane support is already in Windows. Thanks [@pedrolamas](https://github.com/pedrolamas)!
|
||||
|
||||
**Mouse utilities**
|
||||
- Find My Mouse: Improved functionality to activate when user double click time configuration is set above 100ms.
|
||||
- Find My Mouse: Fixed display on all virtual desktops as opposed to only the virtual desktop where it was created.
|
||||
- Find My Mouse: New settings to enable a lot more customization based on your feedback.
|
||||
- Minor UI tweaks for fluent icons, appearance, <kbd>Ctrl</kbd> usage, and utility descriptions. Thanks [@niels9001](https://github.com/niels9001)!
|
||||
- New Mouse Highlighter PowerToy! When enabled, activate mouse highlighting with <kbd>Win</kbd> + <kbd>Shift</kbd> + <kbd>H</kbd> by default to begin displaying visual cues on your display when either the left or right mouse buttons are clicked. There is a much more powerful tool called [SysInternal ZoomIt](https://docs.microsoft.com/en-us/sysinternals/downloads/zoomit) that is very helpful as well.
|
||||
#### Image Resizer
|
||||
- Fixed bug with too much meta data. Thanks [@CleanCodeDeveloper](https://github.com/CleanCodeDeveloper)
|
||||
- Fixed bug resizing bug for constant height while maintaining aspect ratio. Thanks [@CleanCodeDeveloper](https://github.com/CleanCodeDeveloper)
|
||||
|
||||

|
||||
#### Mouse utilities
|
||||
- New Utility - Crosshair over pointer via <kbd>Ctrl</kbd>+<kbd>Alt</kbd>+<kbd>P</kbd>. This feature was co-developed with the accessibility team at Microsoft. Thanks [@niels9001](https://github.com/niels9001) for helping with the icon!
|
||||
|
||||
**PowerRename**
|
||||
- Improved rename performance! This is now at parity (or better) with the prior version based on multiple tests.
|
||||
- Added keyboard accelerators with <kbd>Enter</kbd> and <kbd>Ctrl</kbd> + <kbd>Enter</kbd> to execute rename. Thanks [@niels9001](https://github.com/niels9001)!
|
||||
- UI tweaks to now add number of items selected, grid-lines for improved readability, reduced font sizes & margins, and improved window resizing.
|
||||
- Fixed UI focus issues. Thanks [@niels9001](https://github.com/niels9001)!
|
||||
- Added default window width and height. Thanks [@niels9001](https://github.com/niels9001)!
|
||||
- Added PowerRename event logging for BugReportTool
|
||||
#### PowerRename
|
||||
- Files are sorted now how File Explorer sorts.
|
||||
|
||||
**PowerToys Run**
|
||||
- New entries added for settings plugin. Thanks [@htcfreek](https://github.com/htcfreek)!
|
||||
- Added support for application URI handling like `mailto:` and `ms-settings:`. Thanks [@franky920920](https://github.com/franky920920)!
|
||||
- Added DevContainer workspaces to search results of the VSCode Workspaces Plugin. Thanks [@JacobDeuchert](https://github.com/JacobDeuchert)!
|
||||
- Fixes for crashing issues.
|
||||
#### PowerToys Run
|
||||
- Improved speed and fixed bugs with Window walker plugin. Thanks [@htcfreek](https://github.com/htcfreek)
|
||||
- Window Walker will now show path of elevated apps. Thanks [@davidegiacometti](https://github.com/davidegiacometti)
|
||||
- Added UEFI command to system commands. Thanks [@htcfreek](https://github.com/htcfreek)
|
||||
- Fixed crashing bug in EnvironmentHelper class. Thanks [@htcfreek](https://github.com/htcfreek)
|
||||
- Fix URI plugin bug with `^:`. Thanks [@franky920920](https://github.com/franky920920)
|
||||
- VS Code plugin not showing workspaces with latest Code version was corrected. Thanks [@ricardosantos9521](https://github.com/ricardosantos9521)
|
||||
- Fixed bug that caused plugins to not load. Thanks [@davidegiacometti](https://github.com/davidegiacometti)
|
||||
- Fixed crash in Uri plugin and Web search plugin. Thanks [@cyberrex5](https://github.com/cyberrex5)!
|
||||
|
||||
**Shortcut Guide**
|
||||
- Added rounded corners to keys and tooltips, and system accent colors for desktop backdrop. Thanks [@niels9001](https://github.com/niels9001)!
|
||||
#### Settings
|
||||
- Fixed a regression with settings being reset when moving from admin to non-admin
|
||||
|
||||
**Settings**
|
||||
- Fixed default settings window size to prevent it from opening offscreen. Thanks [@davidegiacometti](https://github.com/davidegiacometti)!
|
||||
#### Video Conference Mute
|
||||
- Fixed crashing bug with Zoom and other clients. We found someone we could remotely debug with and identify the actual crashing part.
|
||||
- Change of behavior: When leaving a meeting, VCM will now leave your microphone in the state it was. This mimics behavior of applications if VCM was not present.
|
||||
- Change of behavior: When you exit PowerToys, your current microphone state will remain.
|
||||
|
||||
**Video Conference Mute**
|
||||
- Minor UI tweaks for icon, clear button, and overlay image selection [#14248](https://github.com/microsoft/PowerToys/issues/14248). Thanks [@niels9001](https://github.com/niels9001)!
|
||||
|
||||
**Prototype work**
|
||||
- Always on top prototype of being actively worked on. Right now you hit a key-combo and it enables it. We are investigating ways to highlight the window in some form as well.
|
||||
|
||||
**Installer**
|
||||
- Investigated how to fully shift to WIX bootstrapper and remove custom boot strapper
|
||||
- Investigated how to fully shift to HKCU vs HKLM.
|
||||
|
||||
**Random helping out**
|
||||
- Spell check fix - Thanks [@franky920920](https://github.com/franky920920)!
|
||||
- Fix a URL - Thanks [@JeffersonQin](https://github.com/JeffersonQin)!
|
||||
|
||||
**Development relevant**
|
||||
- Focusing on cleaning up backlog of issues and developing a method to aid in prioritizing. [@Dend](https://github.com/dend) and [@crutkas](https://github.com/crutkas) are partnering to see if we can develop one signal to see what we are calling ['centers of gravity'](https://gravity-issues.netlify.app/).
|
||||
- Our primary dev branch is now named `Main`.
|
||||
- Adjusting plugin folder structure for PT Run [#10796](https://github.com/microsoft/PowerToys/issues/10796)
|
||||
- Working on shifting our release pipeline onto same system that Windows Terminal uses.
|
||||
- Improvements to environment variable usage/update process in PT Run. Thanks [@htcfreek](https://github.com/htcfreek)!
|
||||
- Update .NET to 3.1.20.
|
||||
- Centralized process list in the BugReportTool.
|
||||
- Registry handling improvement for MSI and File Explorer add-ons.
|
||||
|
||||
**Community contributions**
|
||||
#### Community contributions
|
||||
|
||||
We'd like to directly mention certain contributors (in alphabetical order) for their continued community support this month and helping directly make PowerToys a better piece of software.
|
||||
[@Aaron-Junker](https://github.com/Aaron-Junker), [@bdoserror](https://github.com/bdoserror), [@CleanCodeDeveloper](https://github.com/CleanCodeDeveloper), [@cyberrex5](https://github.com/cyberrex5), [@davidegiacometti](https://github.com/davidegiacometti), [@edwinzap](https://github.com/edwinzap), [@franky920920](https://github.com/franky920920), [@jay-o-way](https://github.com/jay-o-way), [@jsoref](https://github.com/jsoref), [@niels9001](https://github.com/niels9001), and [@ricardosantos9521](https://github.com/ricardosantos9521)
|
||||
|
||||
[@AnonymousWP](https://github.com/AnonymousWP), [@Aaron-Junker](https://github.com/Aaron-Junker), [@CleanCodeDeveloper](https://github.com/CleanCodeDeveloper), [@davidegiacometti](https://github.com/davidegiacometti), [@FLOAT4](https://github.com/FLOAT4), [@franky920920](https://github.com/franky920920), [@htcfreek](https://github.com/htcfreek), [@JacobDeuchert](https://github.com/JacobDeuchert), [@Jay-o-Way](https://github.com/jay-o-way) [@JeffersonQin](https://github.com/JeffersonQin), [@niels9001](https://github.com/niels9001), and [@rdeveen](https://github.com/rdeveen).
|
||||
|
||||
#### What is being planned for v0.53
|
||||
#### What is being planned for v0.56
|
||||
|
||||
For [v0.53][github-next-release-work], due to holidays, we'll be in a maintenance sprint but here are some of the larger items:
|
||||
For [v0.56][github-next-release-work], we plan on finishing up the .NET upgrade path to 6. This will require development to migrate to Visual Studio 2022. We are also shifting back to a continuous version number system versus Odd for main and Even for experimental releases.
|
||||
|
||||
- Hope to add Always on Top into PowerToys. We currently have a proof of concept ready.
|
||||
- We are working to heavily reduce / remove the UAC prompt over the next few releases on install. This is a big shift so it is spanning multiple releases so we can isolate issues if they do occur. Work is tracked in [#10126](https://github.com/microsoft/PowerToys/issues/10126)
|
||||
- Update the PowerToys Build Pipeline to allow .NET 6 integration
|
||||
- Engineering Systems/Stability/Bug fixes
|
||||
- .NET 6 upgrade to all available surfaces
|
||||
- A Dialog on update making you aware of what has changed.
|
||||
- 'Shake to activate' find my mouse
|
||||
- PowerToy Run plugin improvements
|
||||
|
||||
## PowerToys Community
|
||||
|
||||
@@ -190,5 +172,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%2F27
|
||||
[github-current-release-work]: https://github.com/microsoft/PowerToys/issues?q=is%3Aopen+is%3Aissue+project%3Amicrosoft%2FPowerToys%2F26
|
||||
[github-next-release-work]: https://github.com/microsoft/PowerToys/issues?q=is%3Aopen+is%3Aissue+project%3Amicrosoft%2FPowerToys%2F29
|
||||
[github-current-release-work]: https://github.com/microsoft/PowerToys/issues?q=is%3Aopen+is%3Aissue+project%3Amicrosoft%2FPowerToys%2F28
|
||||
|
||||
@@ -78,7 +78,7 @@ The plugin use only these interfaces (all inside the `Main.cs`):
|
||||
|
||||
| Name | Value |
|
||||
| --------------- | ------------------------------------------------------------------------------ |
|
||||
| TargetFramework | `netcoreapp3.1` (means .NET Core 3.1) |
|
||||
| TargetFramework | `net6.0-windows` (.NET 5) or `net6.0-windows10.0.18362.0` (OS version specific)|
|
||||
| LangVersion | `8.0` (mean C# 8.0) |
|
||||
| Platforms | `x64` |
|
||||
| Nullable | `true` |
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
# Sys Plugin
|
||||
|
||||
As the name suggests, the Sys Plugin is used to directly run Windows system commands that have been entered by the user as a query. This is done by parsing the entry and validating the command, followed by executing it.
|
||||
|
||||
* Shutdown
|
||||
* Restart
|
||||
* Sign Out
|
||||
* Lock
|
||||
* Sleep
|
||||
* Hibernate
|
||||
* Empty Recycle Bin
|
||||
|
||||

|
||||
|
||||
## [`Sys`](/src/modules/launcher/Plugins/Microsoft.Plugin.Sys/Main.cs)
|
||||
|
||||
* Tries to parse the user input and returns a specific Windows system command by using a [`Result`](/src/modules/launcher/Wox.Plugin/Result.cs) list.
|
||||
|
||||
* While parsing, the Sys plugin uses [`FuzzyMatch`](/src/modules/launcher/Wox.Infrastructure/StringMatcher.cs) to get characters matching a result in the list.
|
||||
|
||||
### Score
|
||||
|
||||
* [`CalculateSearchScore`](/src/modules/launcher/Wox.Infrastructure/StringMatcher.cs) A match found near the beginning of a string is scored more than a match found near the end. A match is scored more if the characters in the patterns are closer to each other, while the score is lower if they are more spread out.
|
||||
46
doc/devdocs/modules/launcher/plugins/system.md
Normal file
46
doc/devdocs/modules/launcher/plugins/system.md
Normal file
@@ -0,0 +1,46 @@
|
||||
# Windows System Commands Plugin
|
||||
|
||||
As the name suggests, the Windows System Commands Plugin is used to directly run Windows system commands that have been entered by the user as a query. This is done by parsing the entry and validating the command, followed by executing it.
|
||||
|
||||
The user can change the behavior of the plugin (language, confirmation dialog, ...) with optional plugin settings.
|
||||
|
||||

|
||||
|
||||
Available commands:
|
||||
* Shutdown
|
||||
* Restart
|
||||
* Sign Out
|
||||
* Lock
|
||||
* Sleep
|
||||
* Hibernate
|
||||
* Empty Recycle Bin
|
||||
* UEFI Firmware Settings (Only available on systems, that boot in UEFI mode.)
|
||||
|
||||
## Optional plugin settings
|
||||
|
||||
* We have the following settings that the user can configure to change the behavior of the plugin:
|
||||
|
||||
| Key | Default value | Name/Description |
|
||||
|--------------|-----------|------------|
|
||||
| `ConfirmSystemCommands` | `false` | Show a dialog to confirm system commands |
|
||||
| `LocalizeSystemCommands` | `true` | Use localized system commands instead of English ones |
|
||||
|
||||
* The optional plugin settings are implemented via the [`ISettingProvider`](/src/modules/launcher/Wox.Plugin/ISettingProvider.cs) interface from `Wox.Plugin` project. All available settings for the plugin are defined in the [`Main`](/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.System/Main.cs) class of the plugin.
|
||||
|
||||
## Technical details
|
||||
|
||||
### [`Main`](/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.System/Main.cs)
|
||||
|
||||
* Tries to parse the user input and returns a specific Windows system command by using a [`Result`](/src/modules/launcher/Wox.Plugin/Result.cs) list.
|
||||
|
||||
* While parsing, the plugin uses [`FuzzyMatch`](/src/modules/launcher/Wox.Infrastructure/StringMatcher.cs) to get characters matching a result in the list.
|
||||
|
||||
### UEFI command
|
||||
|
||||
* The UEFI command is only available on systems, that boot in UEFI mode.
|
||||
|
||||
* This is validated by checking the result of the method [`GetSystemFirmwareType`](/src/modules/launcher/Wox.Plugin/Common/Win32/Win32Helpers.cs), which uses the native method [`GetFirmwareType`](/src/modules/launcher/Wox.Plugin/Common/Win32/NativeMethods.cs) in `kernel32.dll`.
|
||||
|
||||
### Score
|
||||
|
||||
* [`CalculateSearchScore`](/src/modules/launcher/Wox.Infrastructure/StringMatcher.cs) A match found near the beginning of a string is scored more than a match found near the end. A match is scored more if the characters in the patterns are closer to each other, while the score is lower if they are more spread out.
|
||||
150
doc/devdocs/modules/launcher/plugins/timeZone.md
Normal file
150
doc/devdocs/modules/launcher/plugins/timeZone.md
Normal file
@@ -0,0 +1,150 @@
|
||||
# Time Zone Plugin
|
||||
|
||||
The Time Zone plugin allows users to search a time zone.
|
||||
|
||||
## Special functions (differ from the regular functions)
|
||||
|
||||
* Search for a country, like Kamchatka, Prince Edward Island, France
|
||||
* Search for a shortcuts, like WEST, UTC, PST
|
||||
* Search for a offset, like -12:00, -7, 5, 9:30
|
||||
* Search for a military time zone name (must activate in plugin settings)
|
||||
|
||||
## How to add a new time zone or change one
|
||||
|
||||
All time zones are located in `TimeZone.json` in root folder of the project.
|
||||
The `TimeZone.json` use a JSON schema file that make it easier to edit it.
|
||||
|
||||
| Key | Optional | Value type |
|
||||
| ------------------- | -------- | ----------------- |
|
||||
| `Offset` | **No** | String |
|
||||
| `Name` | Yes | String |
|
||||
| `MilitaryName` | Yes | String |
|
||||
| `Shortcut` | Yes | String |
|
||||
| `TimeNamesStandard` | Yes | List with strings |
|
||||
| `TimeNamesDaylight` | Yes | List with strings |
|
||||
| `ShortcutsStandard` | Yes | List with strings |
|
||||
| `ShortcutsDaylight` | Yes | List with strings |
|
||||
| `CountriesStandard` | Yes | List with strings |
|
||||
| `CountriesDaylight` | Yes | List with strings |
|
||||
|
||||
A minimum entry for the `TimeZone.json` looks like:
|
||||
|
||||
```json
|
||||
{
|
||||
"Offset": "11:55",
|
||||
"Name": "My crazy time zone",
|
||||
}
|
||||
```
|
||||
|
||||
A full entry for the `TimeZone.json` looks like:
|
||||
|
||||
```json
|
||||
{
|
||||
"Offset": "11:55",
|
||||
"Name": "My crazy time zone",
|
||||
"Shortcut" : "MYTZ",
|
||||
"MilitaryName" : "Order Time Zone",
|
||||
"TimeNamesStandard": [
|
||||
"My crazy standard time"
|
||||
],
|
||||
"ShortcutsStandard": [
|
||||
"MCST"
|
||||
],
|
||||
"TimeNamesDaylight": [
|
||||
"My crazy daylight time"
|
||||
],
|
||||
"ShortcutsDaylight": [
|
||||
"MCDT"
|
||||
],
|
||||
"CountriesStandard": [
|
||||
"Crazy Land East"
|
||||
],
|
||||
"CountriesDaylight": [
|
||||
"Crazy Land West"
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
### Remarks
|
||||
|
||||
* At minimum one of the optional value should be filled.
|
||||
|
||||
## Scores
|
||||
|
||||
* Scores are not used
|
||||
|
||||
## Important for developers
|
||||
|
||||
### General
|
||||
|
||||
* The assembly name is cached into `_assemblyName` (to avoid to many calls of `Assembly.GetExecutingAssembly()`)
|
||||
|
||||
## Microsoft.PowerToys.Run.Plugin.TimeZone project
|
||||
|
||||
### Important plugin values (meta-data)
|
||||
|
||||
| Name | Value |
|
||||
| --------------- | ---------------------------------------------------- |
|
||||
| ActionKeyword | `&` |
|
||||
| ExecuteFileName | `Microsoft.PowerToys.Run.Plugin.TimeZone.dll` |
|
||||
| ID | `BADD1B06EF0A4B61AD95395F24241D69` |
|
||||
|
||||
### Interfaces used by this plugin
|
||||
|
||||
The plugin use only these interfaces (all inside the `Main.cs`):
|
||||
|
||||
* `Wox.Plugin.IPlugin`
|
||||
* `Wox.Plugin.IContextMenu`
|
||||
* `Wox.Plugin.IPluginI18n`
|
||||
* `Wox.Plugin.ISettingProvider`
|
||||
* `IDisposable`
|
||||
|
||||
### Program files
|
||||
|
||||
| File | Content |
|
||||
| -------------------------------------- | ----------------------------------------------------------------------- |
|
||||
| `Classes\TimeZoneProperties.cs` | A class that represent one time zone |
|
||||
| `Classes\TimeZones.cs` | A wrapper class that only contains a list with time zones (see 1) |
|
||||
| `Classes\TimeZoneSettings.cs` | A class that contains all settings for the Time Zone plugin |
|
||||
| `Extensions\StringBuilderExtension.cs` | Extension methods for `StringBuilder` Objects |
|
||||
| `Helper\ContextMenuHelper.cs` | All functions to build the context menu (for each result entry) |
|
||||
| `Helper\JsonHelper.cs` | All functions to load the time zones from a JSON file |
|
||||
| `Helper\ResultHelper.cs` | All functions to convert internal results into WOX results |
|
||||
| `Helper\TranslationHelper.cs` | All functions to translate the result in the surface language |
|
||||
| `Images\timeZone.dark.png` | Symbol for the results for the dark theme |
|
||||
| `Images\timeZone.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 contain all translatable strings in the neutral language |
|
||||
| `GlobalSuppressions.cs` | Code suppressions (no real file, linked via *.csproj) |
|
||||
| `Main.cs` | Main class, the only place that implement the WOX interfaces |
|
||||
| `plugin.json` | All meta-data for this plugin |
|
||||
| `StyleCop.json` | Code style (no real file, linked via *.csproj) |
|
||||
| `timezones.json` | File that contains all time zone information |
|
||||
| `timeZones.schema.json` | JSON schema for `timezones.json` |
|
||||
| `StyleCop.json` | Code style (no real file, linked via *.csproj) |
|
||||
|
||||
1. We need this extra wrapper class to make it possible that the JSON file can have and use a JSON schema file.
|
||||
Because the JSON file must have a object as root type, instead of a array.
|
||||
|
||||
### Important project values (*.csproj)
|
||||
|
||||
| Name | Value |
|
||||
| --------------- | ------------------------------------------------------------- |
|
||||
| TargetFramework | `net6.0-windows` |
|
||||
| Platforms | `x64` |
|
||||
| Output | `..\..\..\..\..\x64\Debug\modules\launcher\Plugins\TimeZone\` |
|
||||
| RootNamespace | `Microsoft.PowerToys.Run.Plugin.TimeZone` |
|
||||
| AssemblyName | `Microsoft.PowerToys.Run.Plugin.TimeZone` |
|
||||
|
||||
### Project dependencies
|
||||
|
||||
#### Packages
|
||||
|
||||
| Package | Version |
|
||||
| ------------------------------------------------------------------------------------- | ------- |
|
||||
| [`StyleCop.Analyzers`](https://github.com/DotNetAnalyzers/StyleCopAnalyzers) | 1.1.118 |
|
||||
|
||||
#### Projects
|
||||
|
||||
* `Wox.Infrastructure`
|
||||
* `Wox.Plugin`
|
||||
@@ -141,7 +141,7 @@ Because the JSON file must have a object as root type, instead of a array.
|
||||
|
||||
| Name | Value |
|
||||
| --------------- | --------------------------------------------------------------------------------------------------- |
|
||||
| TargetFramework | `netcoreapp3.1` (means .NET Core 3.1) |
|
||||
| TargetFramework | `net6.0-windows` (.NET 5) or `net6.0-windows10.0.18362.0` (OS version specific) |
|
||||
| Platforms | `x64` |
|
||||
| Output | `..\..\..\..\..\x64\Debug\modules\launcher\Plugins\Microsoft.PowerToys.Run.Plugin.WindowsSettings\` |
|
||||
| RootNamespace | `Microsoft.PowerToys.Run.Plugin.WindowsSettings` |
|
||||
|
||||
@@ -3,16 +3,19 @@ The window walker plugin matches the user entered query with the open windows on
|
||||
|
||||

|
||||
|
||||
### [`OpenWindows.cs`](src/modules/launcher/Plugins/Microsoft.Plugin.WindowWalker/Components/OpenWindows.cs)
|
||||
- The window walker plugin uses the `EnumWindows` function to enumerate all the open windows in the [`OpenWindows.cs`](src/modules/launcher/Plugins/Microsoft.Plugin.WindowWalker/Components/OpenWindows.cs) class.
|
||||
### [`OpenWindows.cs`](/src/modules/launcher/Plugins/Microsoft.Plugin.WindowWalker/Components/OpenWindows.cs)
|
||||
- The window walker plugin uses the `EnumWindows` function to enumerate all the open windows in the [`OpenWindows.cs`](/src/modules/launcher/Plugins/Microsoft.Plugin.WindowWalker/Components/OpenWindows.cs) class.
|
||||
|
||||
### [`SearchController.cs`](/src/modules/launcher/Plugins/Microsoft.Plugin.WindowWalker/Components/SearchController.cs)
|
||||
- The [`SearchController`](/src/modules/launcher/Plugins/Microsoft.Plugin.WindowWalker/Components/SearchController.cs) encapsulates the functions needed to search and find matches.
|
||||
- It is responsible for updating the search text and performing a fuzzy search on all the open windows.
|
||||
|
||||
### [`SearchController.cs`](src/modules/launcher/Plugins/Microsoft.Plugin.WindowWalker/Components/SearchController.cs)
|
||||
- The [`SearchController`](src/modules/launcher/Plugins/Microsoft.Plugin.WindowWalker/Components/SearchController.cs) encapsulates the functions needed to search and find matches.
|
||||
- It is responsible for updating the search text and performing a fuzzy search on all the open windows in an asynchronous manner.
|
||||
### [`Window.cs`](/src/modules/launcher/Plugins/Microsoft.Plugin.WindowWalker/Components/Window.cs)
|
||||
- The [`Window`](/src/modules/launcher/Plugins/Microsoft.Plugin.WindowWalker/Components/Window.cs) class represents a specific window and has functions to get the name of the window, the state of the window (whether it is visible or not), and the `SwitchTowindow` function which switches the desktop focus to the selected window. This action is performed when the user clicks on a window walker plugin result.
|
||||
- The `Window` class holds a static cache with the process information of all windows we know so far and each window instance has a property which holds its process information (name, file, ...). The process data in the cache and the window property are of the type `WindowProcess`.
|
||||
|
||||
### [`Window.cs`](src/modules/launcher/Plugins/Microsoft.Plugin.WindowWalker/Components/Window.cs)
|
||||
- The [`Window`](src/modules/launcher/Plugins/Microsoft.Plugin.WindowWalker/Components/Window.cs) class represents a specific window and has functions to get the name of the process, the state of the window (whether it is visible or not), and the `SwitchTowindow` function which switches the desktop focus to the selected window. This action is performed when the user clicks on a window walker plugin result.
|
||||
### [`WindowProcess.cs`](/src/modules/launcher/Plugins/Microsoft.Plugin.WindowWalker/Components/WindowProcess.cs)
|
||||
- The [`WindowProcess`](/src/modules/launcher/Plugins/Microsoft.Plugin.WindowWalker/Components/WindowProcess.cs) class represents a specific process for a window. It contains static methods to query process information from the system. And it contains instance methods and properties to hold/retrieve the process information we want to know about a window's process.
|
||||
|
||||
### Score
|
||||
The window walker plugin uses [`FuzzyMatching`](src/modules/launcher/Plugins/Microsoft.Plugin.WindowWalker/Components/FuzzyMatching.cs) to get the matching indices and calculates the score by creating a 2 dimensional array of the window and the query text.
|
||||
The window walker plugin uses [`FuzzyMatching`](/src/modules/launcher/Plugins/Microsoft.Plugin.WindowWalker/Components/FuzzyMatching.cs) to get the matching indices and calculates the score by creating a 2 dimensional array of the window and the query text.
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
- [Program](/doc/devdocs/modules/launcher/plugins/program.md)
|
||||
- [Registry](/doc/devdocs/modules/launcher/plugins/registry.md)
|
||||
- [Shell](/doc/devdocs/modules/launcher/plugins/shell.md)
|
||||
- [Sys](/doc/devdocs/modules/launcher/plugins/sys.md)
|
||||
- [Windows System Commands](/doc/devdocs/modules/launcher/plugins/system.md)
|
||||
- [Uri](/doc/devdocs/modules/launcher/plugins/uri.md)
|
||||
- [Window Walker](/doc/devdocs/modules/launcher/plugins/windowwalker.md)
|
||||
- [Web Search](/doc/devdocs/modules/launcher/plugins/WebSearch.md)
|
||||
|
||||
22
doc/devdocs/modules/powerpreview/monaco/readme.md
Normal file
22
doc/devdocs/modules/powerpreview/monaco/readme.md
Normal file
@@ -0,0 +1,22 @@
|
||||
# Developer Preview (Monaco)
|
||||
|
||||
Developer preview is based on [Microsofts Monaco Editor](https://microsoft.github.io/monaco-editor/) which is maintained by the Visual Studio Code team.
|
||||
|
||||
## Update monaco editor
|
||||
|
||||
1. Download Monaco editor with npm: `npm i monaco-editor`.
|
||||
2. Delete everything except the `min` folder (the minimised code).
|
||||
3. Copy the `min` folder inside the [`monacoSRC`](/src/modules/previewpane/MonacoPreviewHandler/monacoSRC) folder.
|
||||
4. Generate the JSON file (see section below)
|
||||
|
||||
## monaco_languages.json
|
||||
|
||||
[`monaco_languages.json`](/src/modules/previewpane/MonacoPreviewHandler/monaco_languages.json) contains all extensions and Id's for the supported languages of Monaco. The [`FileHandler`](/src/modules/previewpane/MonacoPreviewHandler/FileHandler.cs) class and the installer are using this file.
|
||||
|
||||
### Generate monaco_languages.json file
|
||||
|
||||
After you updated monaco editor or adding a new language you should update the [`monaco_languages.json`](/src/modules/previewpane/MonacoPreviewHandler/monaco_languages.json) file.
|
||||
|
||||
1. Build monaco in debug mode.
|
||||
2. Open [generateLanguagesJson.html](/src/modules/previewpane/MonacoPreviewHandler/generateLanguagesJson.html) in a browser.
|
||||
3. Replace the old JSON file.
|
||||
@@ -38,7 +38,7 @@ Once you've discussed your proposed feature/fix/etc. with a team member, and you
|
||||
### Prerequisites for Compiling PowerToys
|
||||
|
||||
1. Windows 10 April 2018 Update (version 1803) or newer
|
||||
2. Visual Studio Community/Professional/Enterprise 2019
|
||||
2. Visual Studio Community/Professional/Enterprise 2022
|
||||
3. 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
|
||||
@@ -69,7 +69,7 @@ The installer can only be compiled in `Release` mode, step 1 and 2 must be done
|
||||
|
||||
### Prerequisites for building the MSI installer
|
||||
|
||||
1. Install the [WiX Toolset Visual Studio 2019 Extension](https://marketplace.visualstudio.com/items?itemName=WixToolset.WixToolsetVisualStudio2019Extension).
|
||||
1. Install the [WiX Toolset Visual Studio 2022 Extension](https://marketplace.visualstudio.com/items?itemName=WixToolset.WixToolsetVisualStudio2022Extension).
|
||||
2. Install the [WiX Toolset build tools](https://wixtoolset.org/releases/).
|
||||
|
||||
### Locally compiling the Bug reporting tool
|
||||
|
||||
BIN
doc/images/icons/Mouse Crosshairs.png
Normal file
BIN
doc/images/icons/Mouse Crosshairs.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 12 KiB |
@@ -16,7 +16,6 @@
|
||||
<File DestinationPath="modules\Microsoft.Xaml.Behaviors.dll" SourcePath="..\..\x64\Release\modules\Microsoft.Xaml.Behaviors.dll"/>
|
||||
<File DestinationPath="modules\PowerToys.PowerRenameExt.dll" SourcePath="..\..\x64\Release\modules\PowerToys.PowerRenameExt.dll"/>
|
||||
<File DestinationPath="modules\shortcut_guide.dll" SourcePath="..\..\x64\Release\modules\shortcut_guide.dll"/>
|
||||
<File DestinationPath="modules\PowerRenameUWPUI.exe" SourcePath="..\..\x64\Release\modules\PowerRenameUWPUI.exe"/>
|
||||
<File DestinationPath="modules\PowerToys.ImageResizer.exe" SourcePath="..\..\x64\Release\modules\PowerToys.ImageResizer.exe"/>
|
||||
<File DestinationPath="modules\PowerToys.ImageResizerExt.dll" SourcePath="..\..\x64\Release\modules\PowerToys.ImageResizerExt.dll"/>
|
||||
<File DestinationPath="modules\GalaSoft.MvvmLight.dll" SourcePath="..\..\x64\Release\modules\GalaSoft.MvvmLight.dll"/>
|
||||
|
||||
@@ -42,9 +42,6 @@
|
||||
</uap5:Extension>
|
||||
<com:Extension Category="windows.comServer">
|
||||
<com:ComServer>
|
||||
<com:ExeServer Executable="modules\PowerRenameUWPUI.exe" DisplayName="PowerRenameUWPUI">
|
||||
<com:Class Id="0440049F-D1DC-4E46-B27B-98393D79486B"/>
|
||||
</com:ExeServer>
|
||||
<com:SurrogateServer DisplayName="ImageResizerExt">
|
||||
<com:Class Id="51B4D7E5-7568-4234-B4BB-47FB3C016A69" Path="modules\PowerToys.ImageResizerExt.dll" ThreadingModel="STA"/>
|
||||
</com:SurrogateServer>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
cd /D "%~dp0"
|
||||
|
||||
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\Tools\VsDevCmd.bat" -arch=amd64 -host_arch=amd64 -winsdk=10.0.18362.0
|
||||
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\Tools\VsDevCmd.bat" -arch=amd64 -host_arch=amd64 -winsdk=10.0.18362.0
|
||||
|
||||
powershell -file update_appxmanifest_version.ps1 || exit /b 1
|
||||
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
taskkill /f /im PowerRenameUWPUI.exe
|
||||
|
||||
.\uninstall_msix.ps1
|
||||
.\build_msix.ps1
|
||||
.\sign_msix.ps1
|
||||
|
||||
@@ -21,6 +21,9 @@
|
||||
</BootstrapperApplicationRef>
|
||||
|
||||
<util:FileSearch Variable="HasDotnet3122" Path="[ProgramFiles64Folder]dotnet\shared\Microsoft.WindowsDesktop.App\3.1.22\System.Xaml.dll" Result="exists" />
|
||||
<util:FileSearch Variable="HasDotnet602" Path="[ProgramFiles64Folder]dotnet\shared\Microsoft.WindowsDesktop.App\6.0.2\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" />
|
||||
|
||||
<Variable Name="InstallFolder" Type="string" Value="[ProgramFiles64Folder]PowerToys" bal:Overridable="yes"/>
|
||||
|
||||
@@ -43,11 +46,12 @@
|
||||
Id="DotnetRuntime"
|
||||
DetectCondition="HasDotnet3122"
|
||||
DownloadUrl="https://download.visualstudio.microsoft.com/download/pr/1c14e24b-7f31-42dc-ba3c-83295a2d6f7e/41b93591162dfe556cc160ae44fbe75e/windowsdesktop-runtime-3.1.22-win-x64.exe"
|
||||
InstallCommand="/install /quiet"
|
||||
RepairCommand="/repair /passive"
|
||||
InstallCommand="/install /quiet /norestart"
|
||||
RepairCommand="/repair /passive /norestart"
|
||||
Permanent="yes"
|
||||
PerMachine="yes"
|
||||
UninstallCommand="/uninstall /quiet">
|
||||
UninstallCommand="/uninstall /quiet /norestart">
|
||||
<ExitCode Value="1638" Behavior="success"/>
|
||||
<RemotePayload
|
||||
Description="Microsoft Windows Desktop Runtime - 3.1.22 (x64)"
|
||||
ProductName="Microsoft Windows Desktop Runtime - 3.1.22 (x64)"
|
||||
@@ -55,6 +59,37 @@
|
||||
Version="3.1.22.30721"
|
||||
Hash="08EF2F6CFDB33946061884B1CE13FA867EFBD576" />
|
||||
</ExePackage>
|
||||
<ExePackage
|
||||
Name="windowsdesktop-runtime-6.0.2-win-x64.exe"
|
||||
Compressed="no"
|
||||
Id="DotnetRuntime6"
|
||||
DetectCondition="HasDotnet602"
|
||||
DownloadUrl="https://download.visualstudio.microsoft.com/download/pr/efa32b7a-6eec-4d97-9cdc-c7336a29a749/3df4296170397cf60884dae1be3d103b/windowsdesktop-runtime-6.0.2-win-x64.exe"
|
||||
InstallCommand="/install /quiet /norestart"
|
||||
RepairCommand="/repair /passive /norestart"
|
||||
Permanent="yes"
|
||||
PerMachine="yes"
|
||||
UninstallCommand="/uninstall /quiet /norestart">
|
||||
<ExitCode Value="1638" Behavior="success"/>
|
||||
<RemotePayload
|
||||
Description="Microsoft Windows Desktop Runtime - 6.0.2 (x64)"
|
||||
ProductName="Microsoft Windows Desktop Runtime - 6.0.2 (x64)"
|
||||
Size="57296456"
|
||||
Version="6.0.2.30914"
|
||||
Hash="EA8DB9D01555D0EA2A3D3CD41D56A28199A064F5" />
|
||||
</ExePackage>
|
||||
<ExePackage
|
||||
Name="MicrosoftEdgeWebview2Setup.exe"
|
||||
Compressed="yes"
|
||||
Id="WebView2"
|
||||
DetectCondition="HasWebView2PerMachine OR HasWebView2PerUser"
|
||||
SourceFile="WebView2\MicrosoftEdgeWebview2Setup.exe"
|
||||
InstallCommand="/silent /install"
|
||||
RepairCommand="/repair /passive"
|
||||
Permanent="yes"
|
||||
PerMachine="yes"
|
||||
UninstallCommand="/silent /uninstall">
|
||||
</ExePackage>
|
||||
<MsiPackage
|
||||
SourceFile="x64\Release\PowerToysSetup-$(var.Version)-x64.msi"
|
||||
Compressed="yes"
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<Import Project="..\packages\WiX.3.11.2\build\wix.props" Condition="Exists('..\packages\WiX.3.11.2\build\wix.props')" />
|
||||
<Import Project="..\..\src\Version.props" />
|
||||
<PropertyGroup>
|
||||
<DefineConstants>Version=$(Version)</DefineConstants>
|
||||
<DefineConstants>Version=$(Version);MonacoSRCHarvestPath=$(ProjectDir)..\..\x64\$(Configuration)\modules\FileExplorerPreview\monacoSRC</DefineConstants>
|
||||
<Name>PowerToysInstaller</Name>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
@@ -35,6 +35,7 @@
|
||||
<Compile Include="CustomDialogs\PTLicenseDlg.wxs" />
|
||||
<Compile Include="CustomDialogs\WixUI_PTInstallDir.wxs" />
|
||||
<Compile Include="Product.wxs" />
|
||||
<Compile Include="MonacoSRC.wxs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<WixExtension Include="WixUtilExtension">
|
||||
@@ -96,4 +97,17 @@ call "..\..\publish.cmd"
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
<Target Name="BeforeBuild">
|
||||
<HeatDirectory Directory="..\..\src\modules\previewpane\MonacoPreviewHandler\monacoSRC"
|
||||
PreprocessorVariable="var.MonacoSRCHarvestPath"
|
||||
OutputFile="MonacoSRC.wxs"
|
||||
ComponentGroupName="MonacoSRCHeatGenerated"
|
||||
DirectoryRefId="MonacoPreviewHandlerMonacoSRCFolder"
|
||||
AutogenerateGuids="true"
|
||||
ToolPath="$(WixToolPath)"
|
||||
RunAsSeparateProcess="true"
|
||||
SuppressFragments="true"
|
||||
SuppressRegistry="true"
|
||||
SuppressRootDirectory="true" />
|
||||
</Target>
|
||||
</Project>
|
||||
File diff suppressed because it is too large
Load Diff
BIN
installer/PowerToysSetup/WebView2/MicrosoftEdgeWebview2Setup.exe
Normal file
BIN
installer/PowerToysSetup/WebView2/MicrosoftEdgeWebview2Setup.exe
Normal file
Binary file not shown.
@@ -22,13 +22,13 @@
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<Import Project="..\..\deps\spdlog.props" />
|
||||
|
||||
@@ -11,6 +11,12 @@
|
||||
<ProjectName>PowerToys.ActionRunner</ProjectName>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<Import Project="..\..\deps\expected.props" />
|
||||
<PropertyGroup>
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
|
||||
@@ -3,6 +3,6 @@
|
||||
## Code organization
|
||||
The PowerToys are split into DLLs for each PowerToy module ([`modules`](/src/modules) folder), and an executable ([`runner`](/src/runner) folder) that loads and manages those DLLs.
|
||||
|
||||
The settings window is a separate executable, contained in [`settings`](/src/settings) folder. It utilizes a WebView to display an HTML-based settings window (contained in [`settings-web`](/src/settings-web) folder).
|
||||
The settings window is a separate executable, contained in [`settings-ui`](/src/settings-ui) folder. It utilizes a WebView to display an HTML-based settings window.
|
||||
|
||||
The [`common`](/src/common) contains code for a static library with helper functions, used by both the runner and the PowerToys modules.
|
||||
|
||||
@@ -11,6 +11,12 @@
|
||||
<ProjectName>PowerToys.Update</ProjectName>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<Import Project="..\..\deps\expected.props" />
|
||||
<PropertyGroup>
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
|
||||
@@ -31,6 +31,8 @@ using System.Diagnostics.CodeAnalysis;
|
||||
[assembly: SuppressMessage("Microsoft.Globalization", "CA1308:NormalizeStringsToUppercase", Justification = "We need to have the names of these keys in lowercase to be able to compare with the keys becoming form the template json. ContainsKey does not allow StringComparer specification to IgnoreCase", Scope = "member", Target = "Microsoft.Templates.Core.ITemplateInfoExtensions.#GetQueryableProperties(Microsoft.TemplateEngine.Abstractions.ITemplateInfo)")]
|
||||
[assembly: SuppressMessage("Microsoft.Globalization", "CA1308:NormalizeStringsToUppercase", Justification = "We need to have the names of these keys in lowercase to be able to compare with the keys becoming form the template json. ContainsKey does not allow StringComparer specification to IgnoreCase", Scope = "member", Target = "Microsoft.Templates.Core.Composition.CompositionQuery.#Match(System.Collections.Generic.IEnumerable`1<Microsoft.Templates.Core.Composition.QueryNode>,Microsoft.Templates.Core.Composition.QueryablePropertyDictionary)")]
|
||||
[assembly: SuppressMessage("Usage", "VSTHRD103:Call async methods when in an async method", Justification = "Resource DictionaryWriter does not implement flush async", Scope = "member", Target = "~M:Microsoft.Templates.Core.PostActions.Catalog.Merge.MergeResourceDictionaryPostAction.ExecuteInternalAsync~System.Threading.Tasks.Task")]
|
||||
[assembly: SuppressMessage("Naming", "CA1707:Identifiers should not contain underscores", Justification = "Used in a lot of places for meaningful method names")]
|
||||
[assembly: SuppressMessage("Performance", "CA1822:Mark members as static", Justification = "Static methods may improve performance but decrease maintainability")]
|
||||
|
||||
// Threading suppressions
|
||||
[assembly: SuppressMessage("Microsoft.VisualStudio.Threading.Analyzers", "VSTHRD100:Avoid async void methods", Justification = "Event handlers needs async void", Scope = "member", Target = "~M:Microsoft.Templates.UI.Controls.Notification.OnClose")]
|
||||
|
||||
@@ -11,6 +11,12 @@
|
||||
<PropertyGroup Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Import Project="..\..\Version.props" />
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
<TargetFramework>net6.0-windows</TargetFramework>
|
||||
<UseWPF>true</UseWPF>
|
||||
<Platforms>x64</Platforms>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
@@ -10,11 +10,11 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="ControlzEx" Version="4.4.0" />
|
||||
<PackageReference Include="ControlzEx" Version="5.0.1" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="3.3.0">
|
||||
<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="6.0.0">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
|
||||
@@ -107,6 +107,11 @@ namespace Common.UI
|
||||
ChangeTheme(_settingsTheme == Theme.System ? Theme.System : _currentTheme);
|
||||
}
|
||||
|
||||
public static string GetWindowsBaseColor()
|
||||
{
|
||||
return ControlzEx.Theming.WindowsThemeHelper.GetWindowsBaseColor();
|
||||
}
|
||||
|
||||
public void ChangeTheme(Theme theme, bool fromSettings = false)
|
||||
{
|
||||
if (fromSettings)
|
||||
|
||||
@@ -11,6 +11,12 @@
|
||||
<PropertyGroup Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
@@ -25,7 +31,7 @@
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<ItemDefinitionGroup>
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<AdditionalIncludeDirectories>..\..\..\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<Authors>Microsoft Corporation</Authors>
|
||||
<Product>PowerToys</Product>
|
||||
<Description>PowerToys ManagedCommon</Description>
|
||||
<Copyright>Copyright (C) 2020 Microsoft Corporation</Copyright>
|
||||
<Copyright>Copyright (C) 2022 Microsoft Corporation</Copyright>
|
||||
<RepositoryUrl>https://github.com/microsoft/PowerToys</RepositoryUrl>
|
||||
<RepositoryType>Github</RepositoryType>
|
||||
<PackageTags>PowerToys</PackageTags>
|
||||
@@ -27,7 +27,7 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="3.3.0">
|
||||
<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="6.0.0">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
<Authors>Microsoft Corporation</Authors>
|
||||
<Product>PowerToys</Product>
|
||||
<Description>PowerToys Telemetry</Description>
|
||||
<Copyright>Copyright (C) 2020 Microsoft Corporation</Copyright>
|
||||
<Copyright>Copyright (C) 2022 Microsoft Corporation</Copyright>
|
||||
<RepositoryUrl>https://github.com/microsoft/PowerToys</RepositoryUrl>
|
||||
<RepositoryType>Github</RepositoryType>
|
||||
<PackageTags>PowerToys</PackageTags>
|
||||
@@ -27,6 +27,10 @@
|
||||
</AdditionalFiles>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="6.0.0">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="StyleCop.Analyzers">
|
||||
<Version>1.1.118</Version>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
|
||||
@@ -12,6 +12,12 @@
|
||||
<PropertyGroup Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
@@ -40,7 +46,7 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
<Import Project="..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200729.8\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200729.8\build\native\Microsoft.Windows.CppWinRT.targets')" />
|
||||
|
||||
@@ -5,6 +5,9 @@ namespace PTSettingsHelper
|
||||
{
|
||||
constexpr inline const wchar_t* settings_filename = L"\\settings.json";
|
||||
constexpr inline const wchar_t* oobe_filename = L"oobe_settings.json";
|
||||
constexpr inline const wchar_t* last_version_run_filename = L"last_version_run.json";
|
||||
constexpr inline const wchar_t* opened_at_first_launch_json_field_name = L"openedAtFirstLaunch";
|
||||
constexpr inline const wchar_t* last_version_json_field_name = L"last_version";
|
||||
|
||||
std::wstring get_root_save_folder_location()
|
||||
{
|
||||
@@ -90,7 +93,7 @@ namespace PTSettingsHelper
|
||||
return false;
|
||||
}
|
||||
|
||||
bool opened = saved_settings->GetNamedBoolean(L"openedAtFirstLaunch", false);
|
||||
bool opened = saved_settings->GetNamedBoolean(opened_at_first_launch_json_field_name, false);
|
||||
return opened;
|
||||
}
|
||||
|
||||
@@ -103,8 +106,39 @@ namespace PTSettingsHelper
|
||||
oobePath = oobePath.append(oobe_filename);
|
||||
|
||||
json::JsonObject obj;
|
||||
obj.SetNamedValue(L"openedAtFirstLaunch", json::value(true));
|
||||
obj.SetNamedValue(opened_at_first_launch_json_field_name, json::value(true));
|
||||
|
||||
json::to_file(oobePath.c_str(), obj);
|
||||
}
|
||||
|
||||
std::wstring get_last_version_run()
|
||||
{
|
||||
|
||||
std::filesystem::path lastVersionRunPath(PTSettingsHelper::get_root_save_folder_location());
|
||||
lastVersionRunPath = lastVersionRunPath.append(last_version_run_filename);
|
||||
if (std::filesystem::exists(lastVersionRunPath))
|
||||
{
|
||||
auto saved_settings = json::from_file(lastVersionRunPath.c_str());
|
||||
if (!saved_settings.has_value())
|
||||
{
|
||||
return L"";
|
||||
}
|
||||
|
||||
std::wstring last_version = saved_settings->GetNamedString(last_version_json_field_name, L"").c_str();
|
||||
return last_version;
|
||||
}
|
||||
return L"";
|
||||
}
|
||||
|
||||
void save_last_version_run(const std::wstring& version)
|
||||
{
|
||||
std::filesystem::path lastVersionRunPath(PTSettingsHelper::get_root_save_folder_location());
|
||||
lastVersionRunPath = lastVersionRunPath.append(last_version_run_filename);
|
||||
|
||||
json::JsonObject obj;
|
||||
obj.SetNamedValue(last_version_json_field_name, json::value(version));
|
||||
|
||||
json::to_file(lastVersionRunPath.c_str(), obj);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -21,4 +21,6 @@ namespace PTSettingsHelper
|
||||
|
||||
bool get_oobe_opened_state();
|
||||
void save_oobe_opened_state();
|
||||
std::wstring get_last_version_run();
|
||||
void save_last_version_run(const std::wstring& version);
|
||||
}
|
||||
|
||||
@@ -12,6 +12,12 @@
|
||||
<PropertyGroup Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
|
||||
@@ -13,6 +13,12 @@
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<PropertyGroup>
|
||||
<AssemblyTitle>PowerToys.Interop</AssemblyTitle>
|
||||
<AssemblyCompany>Microsoft Corp.</AssemblyCompany>
|
||||
<AssemblyCopyright>Copyright (C) 2019 Microsoft Corp.</AssemblyCopyright>
|
||||
<AssemblyCopyright>Copyright (C) 2022 Microsoft Corp.</AssemblyCopyright>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<VCProjectVersion>16.0</VCProjectVersion>
|
||||
@@ -19,6 +19,12 @@
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<CLRSupport>true</CLRSupport>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<Import Project="..\..\..\Version.props" />
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
<TargetFramework>net6.0-windows</TargetFramework>
|
||||
<IsPackable>false</IsPackable>
|
||||
|
||||
<RuntimeIdentifiers>win-x64</RuntimeIdentifiers>
|
||||
@@ -12,7 +12,7 @@
|
||||
<Platforms>x64</Platforms>
|
||||
<AssemblyTitle>interop-tests</AssemblyTitle>
|
||||
<Company>Microsoft Corp.</Company>
|
||||
<Copyright>Copyright (C) 2020 Microsoft Corp.</Copyright>
|
||||
<Copyright>Copyright (C) 2022 Microsoft Corp.</Copyright>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
@@ -52,21 +52,20 @@
|
||||
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.10.0" />
|
||||
<PackageReference Include="MSTest.TestAdapter" Version="2.2.5" />
|
||||
<PackageReference Include="MSTest.TestFramework" Version="2.2.5" />
|
||||
<PackageReference Include="coverlet.collector" Version="3.0.3">
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.1.0" />
|
||||
<PackageReference Include="MSTest.TestAdapter" Version="2.2.3" />
|
||||
<PackageReference Include="MSTest.TestFramework" Version="2.2.3" />
|
||||
<PackageReference Include="coverlet.collector" Version="3.1.2">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers">
|
||||
<Version>3.3.0</Version>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="6.0.0">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="StyleCop.Analyzers">
|
||||
<Version>1.1.118</Version>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
|
||||
@@ -11,6 +11,12 @@
|
||||
<PropertyGroup Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<Import Project="..\..\..\deps\spdlog.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
|
||||
@@ -27,6 +27,7 @@ struct LogSettings
|
||||
inline const static std::wstring keyboardManagerLogPath = L"Logs\\keyboard-manager-log.txt";
|
||||
inline const static std::string findMyMouseLoggerName = "find-my-mouse";
|
||||
inline const static std::string mouseHighlighterLoggerName = "mouse-highlighter";
|
||||
inline const static std::string mousePointerCrosshairsLoggerName = "mouse-pointer-crosshairs";
|
||||
inline const static std::string powerRenameLoggerName = "powerrename";
|
||||
inline const static std::string alwaysOnTopLoggerName = "always-on-top";
|
||||
inline const static std::wstring alwaysOnTopLogPath = L"always-on-top-log.txt";
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<GenerateManifest>false</GenerateManifest>
|
||||
</PropertyGroup>
|
||||
|
||||
@@ -11,6 +11,12 @@
|
||||
<PropertyGroup Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
|
||||
@@ -12,6 +12,12 @@
|
||||
<PropertyGroup Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
|
||||
@@ -13,6 +13,12 @@
|
||||
<PropertyGroup Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
|
||||
@@ -189,6 +189,7 @@ inline bool drop_elevated_privileges()
|
||||
// Run command as elevated user, returns true if succeeded
|
||||
inline HANDLE run_elevated(const std::wstring& file, const std::wstring& params)
|
||||
{
|
||||
Logger::info(L"run_elevated with params={}", params);
|
||||
SHELLEXECUTEINFOW exec_info = { 0 };
|
||||
exec_info.cbSize = sizeof(SHELLEXECUTEINFOW);
|
||||
exec_info.lpVerb = L"runas";
|
||||
@@ -206,6 +207,7 @@ inline HANDLE run_elevated(const std::wstring& file, const std::wstring& params)
|
||||
// Run command as non-elevated user, returns true if succeeded, puts the process id into returnPid if returnPid != NULL
|
||||
inline bool run_non_elevated(const std::wstring& file, const std::wstring& params, DWORD* returnPid)
|
||||
{
|
||||
Logger::info(L"run_non_elevated with params={}", params);
|
||||
auto executable_args = L"\"" + file + L"\"";
|
||||
if (!params.empty())
|
||||
{
|
||||
|
||||
32
src/common/utils/excluded_apps.h
Normal file
32
src/common/utils/excluded_apps.h
Normal file
@@ -0,0 +1,32 @@
|
||||
#pragma once
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
// Checks if a process path is included in a list of strings.
|
||||
inline bool find_app_name_in_path(const std::wstring& where, const std::vector<std::wstring>& what)
|
||||
{
|
||||
for (const auto& row : what)
|
||||
{
|
||||
const auto pos = where.rfind(row);
|
||||
const auto last_slash = where.rfind('\\');
|
||||
//Check that row occurs in where, and its last occurrence contains in itself the first character after the last backslash.
|
||||
if (pos != std::wstring::npos && pos <= last_slash + 1 && pos + row.length() > last_slash)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
inline bool find_folder_in_path(const std::wstring& where, const std::vector<std::wstring>& what)
|
||||
{
|
||||
for (const auto& row : what)
|
||||
{
|
||||
const auto pos = where.rfind(row);
|
||||
if (pos != std::wstring::npos)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -2,10 +2,21 @@
|
||||
|
||||
#include "registry.h"
|
||||
|
||||
#include <common/utils/json.h>
|
||||
|
||||
#include <filesystem>
|
||||
|
||||
namespace fs = std::filesystem;
|
||||
|
||||
namespace NonLocalizable
|
||||
{
|
||||
const static wchar_t* MONACO_LANGUAGES_FILE_NAME = L"modules\\FileExplorerPreview\\monaco_languages.json";
|
||||
const static wchar_t* ListID = L"list";
|
||||
const static wchar_t* ExtensionsID = L"extensions";
|
||||
const static wchar_t* MDExtension = L".md";
|
||||
const static wchar_t* SVGExtension = L".svg";
|
||||
}
|
||||
|
||||
inline registry::ChangeSet getSvgPreviewHandlerChangeSet(const std::wstring installationDir, const bool perUser)
|
||||
{
|
||||
using namespace registry::shellex;
|
||||
@@ -19,7 +30,7 @@ inline registry::ChangeSet getSvgPreviewHandlerChangeSet(const std::wstring inst
|
||||
registry::DOTNET_COMPONENT_CATEGORY_CLSID,
|
||||
L"Microsoft.PowerToys.PreviewHandler.Svg.SvgPreviewHandler",
|
||||
L"Svg Preview Handler",
|
||||
L".svg");
|
||||
{ L".svg" });
|
||||
}
|
||||
|
||||
inline registry::ChangeSet getMdPreviewHandlerChangeSet(const std::wstring installationDir, const bool perUser)
|
||||
@@ -33,7 +44,55 @@ inline registry::ChangeSet getMdPreviewHandlerChangeSet(const std::wstring insta
|
||||
registry::DOTNET_COMPONENT_CATEGORY_CLSID,
|
||||
L"Microsoft.PowerToys.PreviewHandler.Markdown.MarkdownPreviewHandler",
|
||||
L"Markdown Preview Handler",
|
||||
L".md");
|
||||
{ L".md" });
|
||||
}
|
||||
|
||||
inline registry::ChangeSet getMonacoPreviewHandlerChangeSet(const std::wstring installationDir, const bool perUser)
|
||||
{
|
||||
using namespace registry::shellex;
|
||||
std::vector<std::wstring> extensions;
|
||||
|
||||
std::wstring languagesFilePath = fs::path{ installationDir } / NonLocalizable::MONACO_LANGUAGES_FILE_NAME;
|
||||
auto json = json::from_file(languagesFilePath);
|
||||
|
||||
if (json)
|
||||
{
|
||||
try
|
||||
{
|
||||
auto list = json->GetNamedArray(NonLocalizable::ListID);
|
||||
for (uint32_t i = 0; i < list.Size(); ++i)
|
||||
{
|
||||
auto entry = list.GetObjectAt(i);
|
||||
auto extensionsList = entry.GetNamedArray(NonLocalizable::ExtensionsID);
|
||||
|
||||
for (uint32_t j = 0; j < extensionsList.Size(); ++j)
|
||||
{
|
||||
auto extension = extensionsList.GetStringAt(j);
|
||||
|
||||
// Ignore extensions we already have dedicated handlers for
|
||||
if (std::wstring{ extension } == std::wstring{ NonLocalizable::MDExtension } ||
|
||||
std::wstring{ extension } == std::wstring{ NonLocalizable::SVGExtension })
|
||||
{
|
||||
continue;
|
||||
}
|
||||
extensions.push_back(std::wstring{ extension });
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
return generatePreviewHandler(PreviewHandlerType::preview,
|
||||
perUser,
|
||||
L"{afbd5a44-2520-4ae0-9224-6cfce8fe4400}",
|
||||
get_std_product_version(),
|
||||
(fs::path{ installationDir } / LR"d(modules\FileExplorerPreview\PowerToys.MonacoPreviewHandler.comhost.dll)d").wstring(),
|
||||
registry::DOTNET_COMPONENT_CATEGORY_CLSID,
|
||||
L"Microsoft.PowerToys.PreviewHandler.Monaco.MonacoPreviewHandler",
|
||||
L"Monaco Preview Handler",
|
||||
extensions);
|
||||
}
|
||||
|
||||
inline registry::ChangeSet getPdfPreviewHandlerChangeSet(const std::wstring installationDir, const bool perUser)
|
||||
@@ -47,7 +106,7 @@ inline registry::ChangeSet getPdfPreviewHandlerChangeSet(const std::wstring inst
|
||||
registry::DOTNET_COMPONENT_CATEGORY_CLSID,
|
||||
L"Microsoft.PowerToys.PreviewHandler.Pdf.PdfPreviewHandler",
|
||||
L"Pdf Preview Handler",
|
||||
L".pdf");
|
||||
{ L".pdf" });
|
||||
}
|
||||
|
||||
inline registry::ChangeSet getGcodePreviewHandlerChangeSet(const std::wstring installationDir, const bool perUser)
|
||||
@@ -61,7 +120,7 @@ inline registry::ChangeSet getGcodePreviewHandlerChangeSet(const std::wstring in
|
||||
registry::DOTNET_COMPONENT_CATEGORY_CLSID,
|
||||
L"Microsoft.PowerToys.PreviewHandler.Gcode.GcodePreviewHandler",
|
||||
L"G-code Preview Handler",
|
||||
L".gcode");
|
||||
{ L".gcode" });
|
||||
}
|
||||
|
||||
inline registry::ChangeSet getSvgThumbnailHandlerChangeSet(const std::wstring installationDir, const bool perUser)
|
||||
@@ -75,7 +134,7 @@ inline registry::ChangeSet getSvgThumbnailHandlerChangeSet(const std::wstring in
|
||||
registry::DOTNET_COMPONENT_CATEGORY_CLSID,
|
||||
L"Microsoft.PowerToys.ThumbnailHandler.Svg.SvgThumbnailProvider",
|
||||
L"Svg Thumbnail Provider",
|
||||
L".svg");
|
||||
{ L".svg" });
|
||||
}
|
||||
|
||||
inline registry::ChangeSet getPdfThumbnailHandlerChangeSet(const std::wstring installationDir, const bool perUser)
|
||||
@@ -89,7 +148,7 @@ inline registry::ChangeSet getPdfThumbnailHandlerChangeSet(const std::wstring in
|
||||
registry::DOTNET_COMPONENT_CATEGORY_CLSID,
|
||||
L"Microsoft.PowerToys.ThumbnailHandler.Pdf.PdfThumbnailProvider",
|
||||
L"Pdf Thumbnail Provider",
|
||||
L".pdf");
|
||||
{ L".pdf" });
|
||||
}
|
||||
|
||||
inline registry::ChangeSet getGcodeThumbnailHandlerChangeSet(const std::wstring installationDir, const bool perUser)
|
||||
@@ -103,7 +162,21 @@ inline registry::ChangeSet getGcodeThumbnailHandlerChangeSet(const std::wstring
|
||||
registry::DOTNET_COMPONENT_CATEGORY_CLSID,
|
||||
L"Microsoft.PowerToys.ThumbnailHandler.Gcode.GcodeThumbnailProvider",
|
||||
L"G-code Thumbnail Provider",
|
||||
L".gcode");
|
||||
{ L".gcode" });
|
||||
}
|
||||
|
||||
inline registry::ChangeSet getStlThumbnailHandlerChangeSet(const std::wstring installationDir, const bool perUser)
|
||||
{
|
||||
using namespace registry::shellex;
|
||||
return generatePreviewHandler(PreviewHandlerType::thumbnail,
|
||||
perUser,
|
||||
L"{8BC8AFC2-4E7C-4695-818E-8C1FFDCEA2AF}",
|
||||
get_std_product_version(),
|
||||
(fs::path{ installationDir } / LR"d(modules\FileExplorerPreview\PowerToys.StlThumbnailProvider.comhost.dll)d").wstring(),
|
||||
registry::DOTNET_COMPONENT_CATEGORY_CLSID,
|
||||
L"Microsoft.PowerToys.ThumbnailHandler.Stl.StlThumbnailProvider",
|
||||
L"Stl Thumbnail Provider",
|
||||
{ L".stl" });
|
||||
}
|
||||
|
||||
inline std::vector<registry::ChangeSet> getAllModulesChangeSets(const std::wstring installationDir)
|
||||
@@ -111,9 +184,11 @@ inline std::vector<registry::ChangeSet> getAllModulesChangeSets(const std::wstri
|
||||
constexpr bool PER_USER = true;
|
||||
return { getSvgPreviewHandlerChangeSet(installationDir, PER_USER),
|
||||
getMdPreviewHandlerChangeSet(installationDir, PER_USER),
|
||||
getMonacoPreviewHandlerChangeSet(installationDir, PER_USER),
|
||||
getPdfPreviewHandlerChangeSet(installationDir, PER_USER),
|
||||
getGcodePreviewHandlerChangeSet(installationDir, PER_USER),
|
||||
getSvgThumbnailHandlerChangeSet(installationDir, PER_USER),
|
||||
getPdfThumbnailHandlerChangeSet(installationDir, PER_USER),
|
||||
getGcodeThumbnailHandlerChangeSet(installationDir, PER_USER) };
|
||||
getGcodeThumbnailHandlerChangeSet(installationDir, PER_USER),
|
||||
getStlThumbnailHandlerChangeSet(installationDir, PER_USER) };
|
||||
}
|
||||
@@ -317,7 +317,7 @@ namespace registry
|
||||
std::wstring handlerCategory,
|
||||
std::wstring className,
|
||||
std::wstring displayName,
|
||||
std::wstring fileType)
|
||||
std::vector<std::wstring> fileTypes)
|
||||
{
|
||||
const HKEY scope = perUser ? HKEY_CURRENT_USER : HKEY_LOCAL_MACHINE;
|
||||
|
||||
@@ -350,11 +350,6 @@ namespace registry
|
||||
versionPath += L'\\';
|
||||
versionPath += powertoysVersion;
|
||||
|
||||
std::wstring fileAssociationPath = L"Software\\Classes\\";
|
||||
fileAssociationPath += fileType;
|
||||
fileAssociationPath += L"\\shellex\\";
|
||||
fileAssociationPath += handlerType == PreviewHandlerType::preview ? IPREVIEW_HANDLER_CLSID : ITHUMBNAIL_PROVIDER_CLSID;
|
||||
|
||||
using vec_t = std::vector<registry::ValueChange>;
|
||||
// TODO: verify that we actually need all of those
|
||||
vec_t changes = { { scope, clsidPath, L"DisplayName", displayName },
|
||||
@@ -365,8 +360,17 @@ namespace registry
|
||||
{ scope, inprocServerPath, L"Class", className },
|
||||
{ scope, inprocServerPath, L"ThreadingModel", L"Both" },
|
||||
{ scope, versionPath, L"Assembly", assemblyKeyValue },
|
||||
{ scope, versionPath, L"Class", className },
|
||||
{ scope, fileAssociationPath, std::nullopt, handlerClsid } };
|
||||
{ scope, versionPath, L"Class", className } };
|
||||
|
||||
for (const auto& fileType : fileTypes)
|
||||
{
|
||||
std::wstring fileAssociationPath = L"Software\\Classes\\";
|
||||
fileAssociationPath += fileType;
|
||||
fileAssociationPath += L"\\shellex\\";
|
||||
fileAssociationPath += handlerType == PreviewHandlerType::preview ? IPREVIEW_HANDLER_CLSID : ITHUMBNAIL_PROVIDER_CLSID;
|
||||
changes.push_back({ scope, fileAssociationPath, std::nullopt, handlerClsid });
|
||||
}
|
||||
|
||||
if (handlerType == PreviewHandlerType::preview)
|
||||
{
|
||||
const std::wstring previewHostClsid = L"{6d2b5079-2f0b-48dd-ab7f-97cec514d30b}";
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
#define PRODUCT_VERSION_STRING FILE_VERSION_STRING
|
||||
|
||||
#define COMPANY_NAME "Microsoft Corporation"
|
||||
#define COPYRIGHT_NOTE "Copyright (C) 2020 Microsoft Corporation"
|
||||
#define COPYRIGHT_NOTE "Copyright (C) 2022 Microsoft Corporation"
|
||||
#define PRODUCT_NAME "PowerToys"
|
||||
|
||||
#include <string>
|
||||
|
||||
@@ -21,6 +21,12 @@
|
||||
<PropertyGroup Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
|
||||
@@ -14,6 +14,12 @@
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Target Name="GenerateResourceFiles" BeforeTargets="PrepareForBuild">
|
||||
<Exec Command="powershell -NonInteractive -executionpolicy Unrestricted $(SolutionDir)tools\build\convert-resx-to-rc.ps1 .\ resource.base.h resource.h FindMyMouse.base.rc FindMyMouse.rc" />
|
||||
</Target>
|
||||
</Project>
|
||||
@@ -4,6 +4,9 @@
|
||||
#include "FindMyMouse.h"
|
||||
#include "trace.h"
|
||||
#include "common/utils/game_mode.h"
|
||||
#include "common/utils/process_path.h"
|
||||
#include "common/utils/excluded_apps.h"
|
||||
#include <vector>
|
||||
|
||||
#ifdef COMPOSITION
|
||||
namespace winrt
|
||||
@@ -43,6 +46,8 @@ protected:
|
||||
void BeforeMoveSonar() {}
|
||||
void AfterMoveSonar() {}
|
||||
void SetSonarVisibility(bool visible) = delete;
|
||||
void UpdateMouseSnooping();
|
||||
bool IsForegroundAppExcluded();
|
||||
|
||||
protected:
|
||||
// Base class members you can access.
|
||||
@@ -57,22 +62,49 @@ protected:
|
||||
static const int MIN_DOUBLE_CLICK_TIME = 100;
|
||||
|
||||
bool m_destroyed = false;
|
||||
bool m_doNotActivateOnGameMode = true;
|
||||
FindMyMouseActivationMethod m_activationMethod = FIND_MY_MOUSE_DEFAULT_ACTIVATION_METHOD;
|
||||
bool m_doNotActivateOnGameMode = FIND_MY_MOUSE_DEFAULT_DO_NOT_ACTIVATE_ON_GAME_MODE;
|
||||
int m_sonarRadius = FIND_MY_MOUSE_DEFAULT_SPOTLIGHT_RADIUS;
|
||||
int m_sonarZoomFactor = FIND_MY_MOUSE_DEFAULT_SPOTLIGHT_INITIAL_ZOOM;
|
||||
DWORD m_fadeDuration = FIND_MY_MOUSE_DEFAULT_ANIMATION_DURATION_MS;
|
||||
int m_finalAlphaNumerator = FIND_MY_MOUSE_DEFAULT_OVERLAY_OPACITY;
|
||||
std::vector<std::wstring> m_excludedApps;
|
||||
int m_shakeMinimumDistance = FIND_MY_MOUSE_DEFAULT_SHAKE_MINIMUM_DISTANCE;
|
||||
static constexpr int FinalAlphaDenominator = 100;
|
||||
winrt::DispatcherQueueController m_dispatcherQueueController{ nullptr };
|
||||
|
||||
private:
|
||||
|
||||
// Save the mouse movement that occurred in any direction.
|
||||
struct PointerRecentMovement
|
||||
{
|
||||
POINT diff;
|
||||
ULONGLONG tick;
|
||||
};
|
||||
std::vector<PointerRecentMovement> m_movementHistory;
|
||||
// Raw Input may give relative or absolute values. Need to take each case into account.
|
||||
bool m_seenAnAbsoluteMousePosition = false;
|
||||
POINT m_lastAbsolutePosition = { 0, 0 };
|
||||
// Don't consider movements started past these milliseconds to detect shaking.
|
||||
static constexpr LONG ShakeIntervalMs = 1000;
|
||||
// By which factor must travelled distance be than the diagonal of the rectangle containing the movements.
|
||||
static constexpr float ShakeFactor = 4.0f;
|
||||
|
||||
static inline byte GetSign(LONG const& num)
|
||||
{
|
||||
if (num > 0)
|
||||
return 1;
|
||||
if (num < 0)
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static bool IsEqual(POINT const& p1, POINT const& p2)
|
||||
{
|
||||
return p1.x == p2.x && p1.y == p2.y;
|
||||
}
|
||||
|
||||
static constexpr POINT ptNowhere = { -1, -1 };
|
||||
|
||||
static constexpr DWORD TIMER_ID_TRACK = 100;
|
||||
static constexpr DWORD IdlePeriod = 1000;
|
||||
|
||||
@@ -89,11 +121,11 @@ private:
|
||||
HWND m_hwndOwner;
|
||||
SonarState m_sonarState = SonarState::Idle;
|
||||
POINT m_lastKeyPos{};
|
||||
DWORD m_lastKeyTime{};
|
||||
ULONGLONG m_lastKeyTime{};
|
||||
|
||||
static constexpr DWORD NoSonar = 0;
|
||||
static constexpr DWORD SonarWaitingForMouseMove = 1;
|
||||
DWORD m_sonarStart = NoSonar;
|
||||
ULONGLONG m_sonarStart = NoSonar;
|
||||
bool m_isSnoopingMouse = false;
|
||||
|
||||
private:
|
||||
@@ -110,10 +142,10 @@ private:
|
||||
void OnSonarMouseInput(RAWINPUT const& input);
|
||||
void OnMouseTimer();
|
||||
|
||||
void DetectShake();
|
||||
|
||||
void StartSonar();
|
||||
void StopSonar();
|
||||
|
||||
void UpdateMouseSnooping();
|
||||
};
|
||||
|
||||
template<typename D>
|
||||
@@ -189,7 +221,9 @@ LRESULT SuperSonar<D>::BaseWndProc(UINT message, WPARAM wParam, LPARAM lParam) n
|
||||
switch (message)
|
||||
{
|
||||
case WM_CREATE:
|
||||
return OnSonarCreate() ? 0 : -1;
|
||||
if(!OnSonarCreate()) return -1;
|
||||
UpdateMouseSnooping();
|
||||
return 0;
|
||||
|
||||
case WM_DESTROY:
|
||||
OnSonarDestroy();
|
||||
@@ -257,13 +291,7 @@ void SuperSonar<D>::OnSonarInput(WPARAM flags, HRAWINPUT hInput)
|
||||
template<typename D>
|
||||
void SuperSonar<D>::OnSonarKeyboardInput(RAWINPUT const& input)
|
||||
{
|
||||
// Don't activate if game mode is on.
|
||||
if (m_doNotActivateOnGameMode && detect_game_mode())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (input.data.keyboard.VKey != VK_CONTROL)
|
||||
if ( m_activationMethod != FindMyMouseActivationMethod::DoubleControlKey || input.data.keyboard.VKey != VK_CONTROL)
|
||||
{
|
||||
StopSonar();
|
||||
return;
|
||||
@@ -293,7 +321,7 @@ void SuperSonar<D>::OnSonarKeyboardInput(RAWINPUT const& input)
|
||||
if (pressed)
|
||||
{
|
||||
m_sonarState = SonarState::ControlDown1;
|
||||
m_lastKeyTime = GetTickCount();
|
||||
m_lastKeyTime = GetTickCount64();
|
||||
m_lastKeyPos = {};
|
||||
GetCursorPos(&m_lastKeyPos);
|
||||
UpdateMouseSnooping();
|
||||
@@ -310,7 +338,7 @@ void SuperSonar<D>::OnSonarKeyboardInput(RAWINPUT const& input)
|
||||
case SonarState::ControlUp1:
|
||||
if (pressed)
|
||||
{
|
||||
auto now = GetTickCount();
|
||||
auto now = GetTickCount64();
|
||||
auto doubleClickInterval = now - m_lastKeyTime;
|
||||
POINT ptCursor{};
|
||||
auto doubleClickTimeSetting = GetDoubleClickTime();
|
||||
@@ -325,7 +353,7 @@ void SuperSonar<D>::OnSonarKeyboardInput(RAWINPUT const& input)
|
||||
else
|
||||
{
|
||||
m_sonarState = SonarState::ControlDown1;
|
||||
m_lastKeyTime = GetTickCount();
|
||||
m_lastKeyTime = GetTickCount64();
|
||||
m_lastKeyPos = {};
|
||||
GetCursorPos(&m_lastKeyPos);
|
||||
UpdateMouseSnooping();
|
||||
@@ -351,9 +379,97 @@ void SuperSonar<D>::OnSonarKeyboardInput(RAWINPUT const& input)
|
||||
}
|
||||
}
|
||||
|
||||
// Shaking detection algorithm is: Has distance travelled been much greater than the diagonal of the rectangle containing the movement?
|
||||
template<typename D>
|
||||
void SuperSonar<D>::DetectShake()
|
||||
{
|
||||
ULONGLONG shakeStartTick = GetTickCount64() - ShakeIntervalMs;
|
||||
|
||||
// Prune the story of movements for those movements that started too long ago.
|
||||
std::erase_if(m_movementHistory, [shakeStartTick](const PointerRecentMovement& movement) { return movement.tick < shakeStartTick; });
|
||||
|
||||
|
||||
double distanceTravelled = 0;
|
||||
LONGLONG currentX=0, minX=0, maxX=0;
|
||||
LONGLONG currentY=0, minY=0, maxY=0;
|
||||
|
||||
for (const PointerRecentMovement& movement : m_movementHistory)
|
||||
{
|
||||
currentX += movement.diff.x;
|
||||
currentY += movement.diff.y;
|
||||
distanceTravelled += sqrt((double)movement.diff.x * movement.diff.x + (double)movement.diff.y * movement.diff.y); // Pythagorean theorem
|
||||
minX = min(currentX, minX);
|
||||
maxX = max(currentX, maxX);
|
||||
minY = min(currentY, minY);
|
||||
maxY = max(currentY, maxY);
|
||||
}
|
||||
|
||||
if (distanceTravelled < m_shakeMinimumDistance)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Size of the rectangle the pointer moved in.
|
||||
double rectangleWidth = (double)maxX - minX;
|
||||
double rectangleHeight = (double)maxY - minY;
|
||||
|
||||
double diagonal = sqrt(rectangleWidth * rectangleWidth + rectangleHeight * rectangleHeight);
|
||||
if (diagonal > 0 && distanceTravelled / diagonal > ShakeFactor)
|
||||
{
|
||||
m_movementHistory.clear();
|
||||
StartSonar();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
template<typename D>
|
||||
void SuperSonar<D>::OnSonarMouseInput(RAWINPUT const& input)
|
||||
{
|
||||
if (m_activationMethod == FindMyMouseActivationMethod::ShakeMouse)
|
||||
{
|
||||
LONG relativeX = 0;
|
||||
LONG relativeY = 0;
|
||||
if ((input.data.mouse.usFlags & MOUSE_MOVE_ABSOLUTE) == MOUSE_MOVE_ABSOLUTE && (input.data.mouse.lLastX!=0 || input.data.mouse.lLastY!=0))
|
||||
{
|
||||
// Getting absolute mouse coordinates. Likely inside a VM / RDP session.
|
||||
if (m_seenAnAbsoluteMousePosition)
|
||||
{
|
||||
relativeX = input.data.mouse.lLastX - m_lastAbsolutePosition.x;
|
||||
relativeY = input.data.mouse.lLastY - m_lastAbsolutePosition.y;
|
||||
m_lastAbsolutePosition.x = input.data.mouse.lLastX;
|
||||
m_lastAbsolutePosition.y = input.data.mouse.lLastY;
|
||||
}
|
||||
m_seenAnAbsoluteMousePosition = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
relativeX = input.data.mouse.lLastX;
|
||||
relativeY = input.data.mouse.lLastY;
|
||||
}
|
||||
if (m_movementHistory.size() > 0)
|
||||
{
|
||||
PointerRecentMovement& lastMovement = m_movementHistory.back();
|
||||
// If the pointer is still moving in the same direction, just add to that movement instead of adding a new movement.
|
||||
// This helps in keeping the list of movements smaller even in cases where a high number of messages is sent.
|
||||
if (GetSign(lastMovement.diff.x) == GetSign(relativeX) && GetSign(lastMovement.diff.y) == GetSign(relativeY))
|
||||
{
|
||||
lastMovement.diff.x += relativeX;
|
||||
lastMovement.diff.y += relativeY;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_movementHistory.push_back({ .diff = { .x=relativeX, .y=relativeY }, .tick = GetTickCount64() });
|
||||
// Mouse movement changed directions. Take the opportunity do detect shake.
|
||||
DetectShake();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_movementHistory.push_back({ .diff = { .x = relativeX, .y = relativeY }, .tick = GetTickCount64() });
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (input.data.mouse.usButtonFlags)
|
||||
{
|
||||
StopSonar();
|
||||
@@ -367,6 +483,17 @@ void SuperSonar<D>::OnSonarMouseInput(RAWINPUT const& input)
|
||||
template<typename D>
|
||||
void SuperSonar<D>::StartSonar()
|
||||
{
|
||||
// Don't activate if game mode is on.
|
||||
if (m_doNotActivateOnGameMode && detect_game_mode())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (IsForegroundAppExcluded())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Logger::info("Focusing the sonar on the mouse cursor.");
|
||||
Trace::MousePointerFocused();
|
||||
// Cover the entire virtual screen.
|
||||
@@ -393,7 +520,7 @@ void SuperSonar<D>::StopSonar()
|
||||
template<typename D>
|
||||
void SuperSonar<D>::OnMouseTimer()
|
||||
{
|
||||
auto now = GetTickCount();
|
||||
auto now = GetTickCount64();
|
||||
|
||||
// If mouse has moved, then reset the sonar timer.
|
||||
POINT ptCursor{};
|
||||
@@ -433,7 +560,7 @@ void SuperSonar<D>::OnMouseTimer()
|
||||
template<typename D>
|
||||
void SuperSonar<D>::UpdateMouseSnooping()
|
||||
{
|
||||
bool wantSnoopingMouse = m_sonarStart != NoSonar || m_sonarState != SonarState::Idle;
|
||||
bool wantSnoopingMouse = m_sonarStart != NoSonar || m_sonarState != SonarState::Idle || m_activationMethod == FindMyMouseActivationMethod::ShakeMouse;
|
||||
if (m_isSnoopingMouse != wantSnoopingMouse)
|
||||
{
|
||||
m_isSnoopingMouse = wantSnoopingMouse;
|
||||
@@ -454,6 +581,25 @@ void SuperSonar<D>::UpdateMouseSnooping()
|
||||
}
|
||||
}
|
||||
|
||||
template<typename D>
|
||||
bool SuperSonar<D>::IsForegroundAppExcluded()
|
||||
{
|
||||
if (m_excludedApps.size() < 1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (HWND foregroundApp{ GetForegroundWindow() })
|
||||
{
|
||||
auto processPath = get_process_path(foregroundApp);
|
||||
CharUpperBuffW(processPath.data(), (DWORD)processPath.length());
|
||||
return find_app_name_in_path(processPath, m_excludedApps);
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
struct CompositionSpotlight : SuperSonar<CompositionSpotlight>
|
||||
{
|
||||
static constexpr UINT WM_OPACITY_ANIMATION_COMPLETED = WM_APP;
|
||||
@@ -590,14 +736,23 @@ public:
|
||||
m_sonarRadiusFloat = static_cast<float>(m_sonarRadius);
|
||||
m_backgroundColor = settings.backgroundColor;
|
||||
m_spotlightColor = settings.spotlightColor;
|
||||
m_activationMethod = settings.activationMethod;
|
||||
m_doNotActivateOnGameMode = settings.doNotActivateOnGameMode;
|
||||
m_fadeDuration = settings.animationDurationMs > 0 ? settings.animationDurationMs : 1;
|
||||
m_finalAlphaNumerator = settings.overlayOpacity;
|
||||
m_sonarZoomFactor = settings.spotlightInitialZoom;
|
||||
m_excludedApps = settings.excludedApps;
|
||||
m_shakeMinimumDistance = settings.shakeMinimumDistance;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Runtime objects already created. Should update in the owner thread.
|
||||
if (m_dispatcherQueueController == nullptr)
|
||||
{
|
||||
Logger::warn("Tried accessing the dispatch queue controller before it was initialized.");
|
||||
// No dispatcher Queue Controller? Means initialization still hasn't run, so settings will be applied then.
|
||||
return;
|
||||
}
|
||||
auto dispatcherQueue = m_dispatcherQueueController.DispatcherQueue();
|
||||
FindMyMouseSettings localSettings = settings;
|
||||
bool enqueueSucceeded = dispatcherQueue.TryEnqueue([=]() {
|
||||
@@ -608,11 +763,15 @@ public:
|
||||
m_sonarRadiusFloat = static_cast<float>(m_sonarRadius);
|
||||
m_backgroundColor = localSettings.backgroundColor;
|
||||
m_spotlightColor = localSettings.spotlightColor;
|
||||
m_activationMethod = localSettings.activationMethod;
|
||||
m_doNotActivateOnGameMode = localSettings.doNotActivateOnGameMode;
|
||||
m_fadeDuration = localSettings.animationDurationMs > 0 ? localSettings.animationDurationMs : 1;
|
||||
m_finalAlphaNumerator = localSettings.overlayOpacity;
|
||||
m_sonarZoomFactor = localSettings.spotlightInitialZoom;
|
||||
|
||||
m_excludedApps = localSettings.excludedApps;
|
||||
m_shakeMinimumDistance = localSettings.shakeMinimumDistance;
|
||||
UpdateMouseSnooping(); // For the shake mouse activation method
|
||||
|
||||
// Apply new settings to runtime composition objects.
|
||||
m_backdrop.Brush().as<winrt::CompositionColorBrush>().Color(m_backgroundColor);
|
||||
m_circleShape.FillBrush().as<winrt::CompositionColorBrush>().Color(m_spotlightColor);
|
||||
|
||||
@@ -1,6 +1,13 @@
|
||||
#pragma once
|
||||
#include "pch.h"
|
||||
|
||||
enum struct FindMyMouseActivationMethod : int
|
||||
{
|
||||
DoubleControlKey = 0,
|
||||
ShakeMouse = 1,
|
||||
EnumElements = 2, // number of elements in the enum, not counting this
|
||||
};
|
||||
|
||||
constexpr bool FIND_MY_MOUSE_DEFAULT_DO_NOT_ACTIVATE_ON_GAME_MODE = true;
|
||||
const winrt::Windows::UI::Color FIND_MY_MOUSE_DEFAULT_BACKGROUND_COLOR = winrt::Windows::UI::ColorHelper::FromArgb(255, 0, 0, 0);
|
||||
const winrt::Windows::UI::Color FIND_MY_MOUSE_DEFAULT_SPOTLIGHT_COLOR = winrt::Windows::UI::ColorHelper::FromArgb(255, 255, 255, 255);
|
||||
@@ -8,9 +15,12 @@ constexpr int FIND_MY_MOUSE_DEFAULT_OVERLAY_OPACITY = 50;
|
||||
constexpr int FIND_MY_MOUSE_DEFAULT_SPOTLIGHT_RADIUS = 100;
|
||||
constexpr int FIND_MY_MOUSE_DEFAULT_ANIMATION_DURATION_MS = 500;
|
||||
constexpr int FIND_MY_MOUSE_DEFAULT_SPOTLIGHT_INITIAL_ZOOM = 9;
|
||||
constexpr FindMyMouseActivationMethod FIND_MY_MOUSE_DEFAULT_ACTIVATION_METHOD = FindMyMouseActivationMethod::DoubleControlKey;
|
||||
constexpr int FIND_MY_MOUSE_DEFAULT_SHAKE_MINIMUM_DISTANCE = 1000;
|
||||
|
||||
struct FindMyMouseSettings
|
||||
{
|
||||
FindMyMouseActivationMethod activationMethod = FIND_MY_MOUSE_DEFAULT_ACTIVATION_METHOD;
|
||||
bool doNotActivateOnGameMode = FIND_MY_MOUSE_DEFAULT_DO_NOT_ACTIVATE_ON_GAME_MODE;
|
||||
winrt::Windows::UI::Color backgroundColor = FIND_MY_MOUSE_DEFAULT_BACKGROUND_COLOR;
|
||||
winrt::Windows::UI::Color spotlightColor = FIND_MY_MOUSE_DEFAULT_SPOTLIGHT_COLOR;
|
||||
@@ -18,6 +28,8 @@ struct FindMyMouseSettings
|
||||
int spotlightRadius = FIND_MY_MOUSE_DEFAULT_SPOTLIGHT_RADIUS;
|
||||
int animationDurationMs = FIND_MY_MOUSE_DEFAULT_ANIMATION_DURATION_MS;
|
||||
int spotlightInitialZoom = FIND_MY_MOUSE_DEFAULT_SPOTLIGHT_INITIAL_ZOOM;
|
||||
int shakeMinimumDistance = FIND_MY_MOUSE_DEFAULT_SHAKE_MINIMUM_DISTANCE;
|
||||
std::vector<std::wstring> excludedApps;
|
||||
};
|
||||
|
||||
int FindMyMouseMain(HINSTANCE hinst, const FindMyMouseSettings& settings);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include <windows.h>
|
||||
#include "resource.h"
|
||||
#include "../../../../common/version/version.h"
|
||||
#include "../../../common/version/version.h"
|
||||
|
||||
#define APSTUDIO_READONLY_SYMBOLS
|
||||
#include "winres.h"
|
||||
@@ -24,13 +24,13 @@
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
@@ -106,8 +106,7 @@
|
||||
<ItemGroup>
|
||||
<ClInclude Include="FindMyMouse.h" />
|
||||
<ClInclude Include="pch.h" />
|
||||
<ClInclude Include="Generated Files\resource.h" />
|
||||
<None Include="resource.base.h" />
|
||||
<ClInclude Include="resource.h" />
|
||||
<ClInclude Include="trace.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
@@ -117,7 +116,6 @@
|
||||
<PrecompiledHeader Condition="'$(CIBuild)'!='true'">Create</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="trace.cpp" />
|
||||
<None Include="FindMyMouse.base.rc" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\common\logger\logger.vcxproj">
|
||||
@@ -128,7 +126,7 @@
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="Generated Files\FindMyMouse.rc" />
|
||||
<ResourceCompile Include="FindMyMouse.rc" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
|
||||
@@ -41,22 +41,16 @@
|
||||
<ClInclude Include="FindMyMouse.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Generated Files\resource.h">
|
||||
<Filter>Generated Files</Filter>
|
||||
<ClInclude Include="resource.h">
|
||||
<Filter>Resource Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
<None Include="resource.base.h">
|
||||
<Filter>Resource Files</Filter>
|
||||
</None>
|
||||
<None Include="FindMyMouse.base.rc">
|
||||
<Filter>Resource Files</Filter>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="Generated Files\FindMyMouse.rc">
|
||||
<Filter>Generated Files</Filter>
|
||||
<ResourceCompile Include="FindMyMouse.rc">
|
||||
<Filter>Resource Files</Filter>
|
||||
</ResourceCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -6,11 +6,13 @@
|
||||
#include <thread>
|
||||
#include <common/utils/logger_helper.h>
|
||||
#include <common/utils/color.h>
|
||||
#include <common/utils/string_utils.h>
|
||||
|
||||
namespace
|
||||
{
|
||||
const wchar_t JSON_KEY_PROPERTIES[] = L"properties";
|
||||
const wchar_t JSON_KEY_VALUE[] = L"value";
|
||||
const wchar_t JSON_KEY_ACTIVATION_METHOD[] = L"activation_method";
|
||||
const wchar_t JSON_KEY_DO_NOT_ACTIVATE_ON_GAME_MODE[] = L"do_not_activate_on_game_mode";
|
||||
const wchar_t JSON_KEY_BACKGROUND_COLOR[] = L"background_color";
|
||||
const wchar_t JSON_KEY_SPOTLIGHT_COLOR[] = L"spotlight_color";
|
||||
@@ -18,6 +20,8 @@ namespace
|
||||
const wchar_t JSON_KEY_SPOTLIGHT_RADIUS[] = L"spotlight_radius";
|
||||
const wchar_t JSON_KEY_ANIMATION_DURATION_MS[] = L"animation_duration_ms";
|
||||
const wchar_t JSON_KEY_SPOTLIGHT_INITIAL_ZOOM[] = L"spotlight_initial_zoom";
|
||||
const wchar_t JSON_KEY_EXCLUDED_APPS[] = L"excluded_apps";
|
||||
const wchar_t JSON_KEY_SHAKING_MINIMUM_DISTANCE[] = L"shaking_minimum_distance";
|
||||
}
|
||||
|
||||
extern "C" IMAGE_DOS_HEADER __ImageBase;
|
||||
@@ -171,6 +175,20 @@ void FindMyMouse::parse_settings(PowerToysSettings::PowerToyValues& settings)
|
||||
FindMyMouseSettings findMyMouseSettings;
|
||||
if (settingsObject.GetView().Size())
|
||||
{
|
||||
try
|
||||
{
|
||||
// Parse Activation Method
|
||||
auto jsonPropertiesObject = settingsObject.GetNamedObject(JSON_KEY_PROPERTIES).GetNamedObject(JSON_KEY_ACTIVATION_METHOD);
|
||||
UINT value = (UINT)jsonPropertiesObject.GetNamedNumber(JSON_KEY_VALUE);
|
||||
if (value < (int)FindMyMouseActivationMethod::EnumElements)
|
||||
{
|
||||
findMyMouseSettings.activationMethod = (FindMyMouseActivationMethod)value;
|
||||
}
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
Logger::warn("Failed to initialize Activation Method from settings. Will use default value");
|
||||
}
|
||||
try
|
||||
{
|
||||
auto jsonPropertiesObject = settingsObject.GetNamedObject(JSON_KEY_PROPERTIES).GetNamedObject(JSON_KEY_DO_NOT_ACTIVATE_ON_GAME_MODE);
|
||||
@@ -258,6 +276,41 @@ void FindMyMouse::parse_settings(PowerToysSettings::PowerToyValues& settings)
|
||||
{
|
||||
Logger::warn("Failed to initialize Spotlight Initial Zoom from settings. Will use default value");
|
||||
}
|
||||
try
|
||||
{
|
||||
// Parse Excluded Apps
|
||||
auto jsonPropertiesObject = settingsObject.GetNamedObject(JSON_KEY_PROPERTIES).GetNamedObject(JSON_KEY_EXCLUDED_APPS);
|
||||
std::wstring apps = jsonPropertiesObject.GetNamedString(JSON_KEY_VALUE).c_str();
|
||||
std::vector<std::wstring> excludedApps;
|
||||
auto excludedUppercase = apps;
|
||||
CharUpperBuffW(excludedUppercase.data(), (DWORD)excludedUppercase.length());
|
||||
std::wstring_view view(excludedUppercase);
|
||||
view = left_trim<wchar_t>(trim<wchar_t>(view));
|
||||
|
||||
while (!view.empty())
|
||||
{
|
||||
auto pos = (std::min)(view.find_first_of(L"\r\n"), view.length());
|
||||
excludedApps.emplace_back(view.substr(0, pos));
|
||||
view.remove_prefix(pos);
|
||||
view = left_trim<wchar_t>(trim<wchar_t>(view));
|
||||
}
|
||||
|
||||
findMyMouseSettings.excludedApps = excludedApps;
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
Logger::warn("Failed to initialize Excluded Apps from settings. Will use default value");
|
||||
}
|
||||
try
|
||||
{
|
||||
// Parse Shaking Minimum Distance
|
||||
auto jsonPropertiesObject = settingsObject.GetNamedObject(JSON_KEY_PROPERTIES).GetNamedObject(JSON_KEY_SHAKING_MINIMUM_DISTANCE);
|
||||
findMyMouseSettings.shakeMinimumDistance = (UINT)jsonPropertiesObject.GetNamedNumber(JSON_KEY_VALUE);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
Logger::warn("Failed to initialize Shaking Minimum Distance from settings. Will use default value");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
#define FILE_DESCRIPTION "PowerToys FindMyMouse"
|
||||
#define INTERNAL_NAME "PowerToys.FindMyMouse"
|
||||
#define ORIGINAL_FILENAME "PowerToys.FindMyMouse.dll"
|
||||
#define IDS_KEYBOARDMANAGER_ICON 1001
|
||||
|
||||
// Non-localizable
|
||||
//////////////////////////////
|
||||
@@ -1,5 +0,0 @@
|
||||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Target Name="GenerateResourceFiles" BeforeTargets="PrepareForBuild">
|
||||
<Exec Command="powershell -NonInteractive -executionpolicy Unrestricted $(SolutionDir)tools\build\convert-resx-to-rc.ps1 .\ resource.base.h resource.h MouseHighlighter.base.rc MouseHighlighter.rc" />
|
||||
</Target>
|
||||
</Project>
|
||||
@@ -1,6 +1,6 @@
|
||||
#include <windows.h>
|
||||
#include "resource.h"
|
||||
#include "../../../../common/version/version.h"
|
||||
#include "../../../common/version/version.h"
|
||||
|
||||
#define APSTUDIO_READONLY_SYMBOLS
|
||||
#include "winres.h"
|
||||
@@ -23,13 +23,13 @@
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
@@ -106,8 +106,7 @@
|
||||
<ClInclude Include="MouseHighlighter.h" />
|
||||
<ClInclude Include="pch.h" />
|
||||
<ClInclude Include="trace.h" />
|
||||
<ClInclude Include="Generated Files\resource.h" />
|
||||
<None Include="resource.base.h" />
|
||||
<ClInclude Include="resource.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="dllmain.cpp" />
|
||||
@@ -116,13 +115,12 @@
|
||||
<PrecompiledHeader Condition="'$(CIBuild)'!='true'">Create</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="trace.cpp" />
|
||||
<None Include="MouseHighlighter.base.rc" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="Generated Files\MouseHighlighter.rc" />
|
||||
<ResourceCompile Include="MouseHighlighter.rc" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\common\logger\logger.vcxproj">
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
<ClInclude Include="trace.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Generated Files\resource.h">
|
||||
<Filter>Generated Files</Filter>
|
||||
<ClInclude Include="resource.h">
|
||||
<Filter>Resource Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="MouseHighlighter.h">
|
||||
<Filter>Header Files</Filter>
|
||||
@@ -30,12 +30,6 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
<None Include="MouseHighlighter.base.rc">
|
||||
<Filter>Resource Files</Filter>
|
||||
</None>
|
||||
<None Include="resource.base.h">
|
||||
<Filter>Resource Files</Filter>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
@@ -55,8 +49,8 @@
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="Generated Files\MouseHighlighter.rc">
|
||||
<Filter>Generated Files</Filter>
|
||||
<ResourceCompile Include="MouseHighlighter.rc">
|
||||
<Filter>Resource Files</Filter>
|
||||
</ResourceCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -8,7 +8,6 @@
|
||||
#define FILE_DESCRIPTION "PowerToys MouseHighlighter"
|
||||
#define INTERNAL_NAME "PowerToys.MouseHighlighter"
|
||||
#define ORIGINAL_FILENAME "PowerToys.MouseHighlighter.dll"
|
||||
#define IDS_KEYBOARDMANAGER_ICON 1001
|
||||
|
||||
// Non-localizable
|
||||
//////////////////////////////
|
||||
@@ -0,0 +1,461 @@
|
||||
// InclusiveCrosshairs.cpp : Defines the entry point for the application.
|
||||
//
|
||||
|
||||
#include "pch.h"
|
||||
#include "InclusiveCrosshairs.h"
|
||||
#include "trace.h"
|
||||
|
||||
#ifdef COMPOSITION
|
||||
namespace winrt
|
||||
{
|
||||
using namespace winrt::Windows::System;
|
||||
using namespace winrt::Windows::UI::Composition;
|
||||
}
|
||||
|
||||
namespace ABI
|
||||
{
|
||||
using namespace ABI::Windows::System;
|
||||
using namespace ABI::Windows::UI::Composition::Desktop;
|
||||
}
|
||||
#endif
|
||||
|
||||
struct InclusiveCrosshairs
|
||||
{
|
||||
bool MyRegisterClass(HINSTANCE hInstance);
|
||||
static InclusiveCrosshairs* instance;
|
||||
void Terminate();
|
||||
void SwitchActivationMode();
|
||||
void ApplySettings(InclusiveCrosshairsSettings& settings, bool applyToRuntimeObjects);
|
||||
|
||||
private:
|
||||
enum class MouseButton
|
||||
{
|
||||
Left,
|
||||
Right
|
||||
};
|
||||
|
||||
void DestroyInclusiveCrosshairs();
|
||||
static LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) noexcept;
|
||||
void StartDrawing();
|
||||
void StopDrawing();
|
||||
bool CreateInclusiveCrosshairs();
|
||||
void UpdateCrosshairsPosition();
|
||||
HHOOK m_mouseHook = NULL;
|
||||
static LRESULT CALLBACK MouseHookProc(int nCode, WPARAM wParam, LPARAM lParam) noexcept;
|
||||
|
||||
static constexpr auto m_className = L"MousePointerCrosshairs";
|
||||
static constexpr auto m_windowTitle = L"PowerToys Mouse Pointer Crosshairs";
|
||||
HWND m_hwndOwner = NULL;
|
||||
HWND m_hwnd = NULL;
|
||||
HINSTANCE m_hinstance = NULL;
|
||||
static constexpr DWORD WM_SWITCH_ACTIVATION_MODE = WM_APP;
|
||||
|
||||
winrt::DispatcherQueueController m_dispatcherQueueController{ nullptr };
|
||||
winrt::Compositor m_compositor{ nullptr };
|
||||
winrt::Desktop::DesktopWindowTarget m_target{ nullptr };
|
||||
winrt::ContainerVisual m_root{ nullptr };
|
||||
winrt::LayerVisual m_crosshairs_border_layer{ nullptr };
|
||||
winrt::LayerVisual m_crosshairs_layer{ nullptr };
|
||||
winrt::SpriteVisual m_left_crosshairs_border{ nullptr };
|
||||
winrt::SpriteVisual m_left_crosshairs{ nullptr };
|
||||
winrt::SpriteVisual m_right_crosshairs_border{ nullptr };
|
||||
winrt::SpriteVisual m_right_crosshairs{ nullptr };
|
||||
winrt::SpriteVisual m_top_crosshairs_border{ nullptr };
|
||||
winrt::SpriteVisual m_top_crosshairs{ nullptr };
|
||||
winrt::SpriteVisual m_bottom_crosshairs_border{ nullptr };
|
||||
winrt::SpriteVisual m_bottom_crosshairs{ nullptr };
|
||||
|
||||
bool m_visible = false;
|
||||
bool m_destroyed = false;
|
||||
|
||||
// Configurable Settings
|
||||
winrt::Windows::UI::Color m_crosshairs_border_color = INCLUSIVE_MOUSE_DEFAULT_CROSSHAIRS_BORDER_COLOR;
|
||||
winrt::Windows::UI::Color m_crosshairs_color = INCLUSIVE_MOUSE_DEFAULT_CROSSHAIRS_COLOR;
|
||||
int m_crosshairs_radius = INCLUSIVE_MOUSE_DEFAULT_CROSSHAIRS_RADIUS;
|
||||
int m_crosshairs_thickness = INCLUSIVE_MOUSE_DEFAULT_CROSSHAIRS_THICKNESS;
|
||||
int m_crosshairs_border_size = INCLUSIVE_MOUSE_DEFAULT_CROSSHAIRS_BORDER_SIZE;
|
||||
float m_crosshairs_opacity = max(0.f, min(1.f, (float)INCLUSIVE_MOUSE_DEFAULT_CROSSHAIRS_OPACITY / 100.0f));
|
||||
};
|
||||
|
||||
InclusiveCrosshairs* InclusiveCrosshairs::instance = nullptr;
|
||||
|
||||
bool InclusiveCrosshairs::CreateInclusiveCrosshairs()
|
||||
{
|
||||
try
|
||||
{
|
||||
// We need a dispatcher queue.
|
||||
DispatcherQueueOptions options = {
|
||||
sizeof(options),
|
||||
DQTYPE_THREAD_CURRENT,
|
||||
DQTAT_COM_ASTA,
|
||||
};
|
||||
ABI::IDispatcherQueueController* controller;
|
||||
winrt::check_hresult(CreateDispatcherQueueController(options, &controller));
|
||||
*winrt::put_abi(m_dispatcherQueueController) = controller;
|
||||
|
||||
// Create the compositor for our window.
|
||||
m_compositor = winrt::Compositor();
|
||||
ABI::IDesktopWindowTarget* target;
|
||||
winrt::check_hresult(m_compositor.as<ABI::ICompositorDesktopInterop>()->CreateDesktopWindowTarget(m_hwnd, false, &target));
|
||||
*winrt::put_abi(m_target) = target;
|
||||
|
||||
// Our composition tree:
|
||||
//
|
||||
// [root] ContainerVisual
|
||||
// \ [crosshairs border layer] LayerVisual
|
||||
// \ [crosshairs border sprites]
|
||||
// [crosshairs layer] LayerVisual
|
||||
// \ [crosshairs sprites]
|
||||
|
||||
m_root = m_compositor.CreateContainerVisual();
|
||||
m_root.RelativeSizeAdjustment({ 1.0f, 1.0f });
|
||||
m_target.Root(m_root);
|
||||
|
||||
m_root.Opacity(m_crosshairs_opacity);
|
||||
|
||||
m_crosshairs_border_layer = m_compositor.CreateLayerVisual();
|
||||
m_crosshairs_border_layer.RelativeSizeAdjustment({ 1.0f, 1.0f });
|
||||
m_root.Children().InsertAtTop(m_crosshairs_border_layer);
|
||||
m_crosshairs_border_layer.Opacity(1.0f);
|
||||
|
||||
m_crosshairs_layer = m_compositor.CreateLayerVisual();
|
||||
m_crosshairs_layer.RelativeSizeAdjustment({ 1.0f, 1.0f });
|
||||
|
||||
// Create the crosshairs sprites.
|
||||
m_left_crosshairs_border = m_compositor.CreateSpriteVisual();
|
||||
m_left_crosshairs_border.AnchorPoint({ 1.0f, 0.5f });
|
||||
m_left_crosshairs_border.Brush(m_compositor.CreateColorBrush(m_crosshairs_border_color));
|
||||
m_crosshairs_border_layer.Children().InsertAtTop(m_left_crosshairs_border);
|
||||
m_left_crosshairs = m_compositor.CreateSpriteVisual();
|
||||
m_left_crosshairs.AnchorPoint({ 1.0f, 0.5f });
|
||||
m_left_crosshairs.Brush(m_compositor.CreateColorBrush(m_crosshairs_color));
|
||||
m_crosshairs_layer.Children().InsertAtTop(m_left_crosshairs);
|
||||
|
||||
m_right_crosshairs_border = m_compositor.CreateSpriteVisual();
|
||||
m_right_crosshairs_border.AnchorPoint({ 0.0f, 0.5f });
|
||||
m_right_crosshairs_border.Brush(m_compositor.CreateColorBrush(m_crosshairs_border_color));
|
||||
m_crosshairs_border_layer.Children().InsertAtTop(m_right_crosshairs_border);
|
||||
m_right_crosshairs = m_compositor.CreateSpriteVisual();
|
||||
m_right_crosshairs.AnchorPoint({ 0.0f, 0.5f });
|
||||
m_right_crosshairs.Brush(m_compositor.CreateColorBrush(m_crosshairs_color));
|
||||
m_crosshairs_layer.Children().InsertAtTop(m_right_crosshairs);
|
||||
|
||||
m_top_crosshairs_border = m_compositor.CreateSpriteVisual();
|
||||
m_top_crosshairs_border.AnchorPoint({ 0.5f, 1.0f });
|
||||
m_top_crosshairs_border.Brush(m_compositor.CreateColorBrush(m_crosshairs_border_color));
|
||||
m_crosshairs_border_layer.Children().InsertAtTop(m_top_crosshairs_border);
|
||||
m_top_crosshairs = m_compositor.CreateSpriteVisual();
|
||||
m_top_crosshairs.AnchorPoint({ 0.5f, 1.0f });
|
||||
m_top_crosshairs.Brush(m_compositor.CreateColorBrush(m_crosshairs_color));
|
||||
m_crosshairs_layer.Children().InsertAtTop(m_top_crosshairs);
|
||||
|
||||
m_bottom_crosshairs_border = m_compositor.CreateSpriteVisual();
|
||||
m_bottom_crosshairs_border.AnchorPoint({ 0.5f, 0.0f });
|
||||
m_bottom_crosshairs_border.Brush(m_compositor.CreateColorBrush(m_crosshairs_border_color));
|
||||
m_crosshairs_border_layer.Children().InsertAtTop(m_bottom_crosshairs_border);
|
||||
m_bottom_crosshairs = m_compositor.CreateSpriteVisual();
|
||||
m_bottom_crosshairs.AnchorPoint({ 0.5f, 0.0f });
|
||||
m_bottom_crosshairs.Brush(m_compositor.CreateColorBrush(m_crosshairs_color));
|
||||
m_crosshairs_layer.Children().InsertAtTop(m_bottom_crosshairs);
|
||||
|
||||
m_crosshairs_border_layer.Children().InsertAtTop(m_crosshairs_layer);
|
||||
m_crosshairs_layer.Opacity(1.0f);
|
||||
|
||||
UpdateCrosshairsPosition();
|
||||
|
||||
return true;
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void InclusiveCrosshairs::UpdateCrosshairsPosition()
|
||||
{
|
||||
POINT ptCursor;
|
||||
|
||||
GetCursorPos(&ptCursor);
|
||||
|
||||
HMONITOR cursorMonitor = MonitorFromPoint(ptCursor, MONITOR_DEFAULTTONEAREST);
|
||||
|
||||
if (cursorMonitor == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
MONITORINFO monitorInfo;
|
||||
monitorInfo.cbSize = sizeof(monitorInfo);
|
||||
|
||||
if (!GetMonitorInfo(cursorMonitor, &monitorInfo))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
POINT ptMonitorUpperLeft;
|
||||
ptMonitorUpperLeft.x = monitorInfo.rcMonitor.left;
|
||||
ptMonitorUpperLeft.y = monitorInfo.rcMonitor.top;
|
||||
|
||||
POINT ptMonitorBottomRight;
|
||||
ptMonitorBottomRight.x = monitorInfo.rcMonitor.right;
|
||||
ptMonitorBottomRight.y = monitorInfo.rcMonitor.bottom;
|
||||
|
||||
// Convert everything to client coordinates.
|
||||
ScreenToClient(m_hwnd, &ptCursor);
|
||||
ScreenToClient(m_hwnd, &ptMonitorUpperLeft);
|
||||
ScreenToClient(m_hwnd, &ptMonitorBottomRight);
|
||||
|
||||
// Crosshair position should receive a minor adjustment for odd values to prevent anti-aliasing due to half pixels, while still looking like it's centered around the mouse pointer.
|
||||
float halfPixelAdjustment = m_crosshairs_thickness % 2 == 1 ? 0.5f : 0.0f;
|
||||
|
||||
// Position crosshairs components around the mouse pointer.
|
||||
m_left_crosshairs_border.Offset({ (float)ptCursor.x - m_crosshairs_radius + m_crosshairs_border_size, (float)ptCursor.y - halfPixelAdjustment, .0f });
|
||||
m_left_crosshairs_border.Size({ (float)ptCursor.x - (float)ptMonitorUpperLeft.x - m_crosshairs_radius + m_crosshairs_border_size, (float)m_crosshairs_thickness + m_crosshairs_border_size * 2 });
|
||||
m_left_crosshairs.Offset({ (float)ptCursor.x - m_crosshairs_radius, (float)ptCursor.y - halfPixelAdjustment, .0f });
|
||||
m_left_crosshairs.Size({ (float)ptCursor.x - (float)ptMonitorUpperLeft.x - m_crosshairs_radius, (float)m_crosshairs_thickness });
|
||||
|
||||
m_right_crosshairs_border.Offset({ (float)ptCursor.x + m_crosshairs_radius - m_crosshairs_border_size, (float)ptCursor.y - halfPixelAdjustment, .0f });
|
||||
m_right_crosshairs_border.Size({ (float)ptMonitorBottomRight.x - (float)ptCursor.x - m_crosshairs_radius + m_crosshairs_border_size, (float)m_crosshairs_thickness + m_crosshairs_border_size * 2 });
|
||||
m_right_crosshairs.Offset({ (float)ptCursor.x + m_crosshairs_radius, (float)ptCursor.y - halfPixelAdjustment, .0f });
|
||||
m_right_crosshairs.Size({ (float)ptMonitorBottomRight.x - (float)ptCursor.x - m_crosshairs_radius, (float)m_crosshairs_thickness });
|
||||
|
||||
m_top_crosshairs_border.Offset({ (float)ptCursor.x - halfPixelAdjustment, (float)ptCursor.y - m_crosshairs_radius + m_crosshairs_border_size, .0f });
|
||||
m_top_crosshairs_border.Size({ (float)m_crosshairs_thickness + m_crosshairs_border_size * 2, (float)ptCursor.y - (float)ptMonitorUpperLeft.y - m_crosshairs_radius + m_crosshairs_border_size });
|
||||
m_top_crosshairs.Offset({ (float)ptCursor.x - halfPixelAdjustment, (float)ptCursor.y - m_crosshairs_radius, .0f });
|
||||
m_top_crosshairs.Size({ (float)m_crosshairs_thickness, (float)ptCursor.y - (float)ptMonitorUpperLeft.y - m_crosshairs_radius });
|
||||
|
||||
m_bottom_crosshairs_border.Offset({ (float)ptCursor.x - halfPixelAdjustment, (float)ptCursor.y + m_crosshairs_radius - m_crosshairs_border_size, .0f });
|
||||
m_bottom_crosshairs_border.Size({ (float)m_crosshairs_thickness + m_crosshairs_border_size * 2, (float)ptMonitorBottomRight.y - (float)ptCursor.y - m_crosshairs_radius + m_crosshairs_border_size });
|
||||
m_bottom_crosshairs.Offset({ (float)ptCursor.x - halfPixelAdjustment, (float)ptCursor.y + m_crosshairs_radius, .0f });
|
||||
m_bottom_crosshairs.Size({ (float)m_crosshairs_thickness, (float)ptMonitorBottomRight.y - (float)ptCursor.y - m_crosshairs_radius });
|
||||
|
||||
}
|
||||
|
||||
LRESULT CALLBACK InclusiveCrosshairs::MouseHookProc(int nCode, WPARAM wParam, LPARAM lParam) noexcept
|
||||
{
|
||||
if (nCode >= 0)
|
||||
{
|
||||
MSLLHOOKSTRUCT* hookData = (MSLLHOOKSTRUCT*)lParam;
|
||||
if (wParam == WM_MOUSEMOVE) {
|
||||
instance->UpdateCrosshairsPosition();
|
||||
}
|
||||
}
|
||||
return CallNextHookEx(0, nCode, wParam, lParam);
|
||||
}
|
||||
|
||||
void InclusiveCrosshairs::StartDrawing()
|
||||
{
|
||||
Logger::info("Start drawing crosshairs.");
|
||||
Trace::StartDrawingCrosshairs();
|
||||
SetWindowPos(m_hwnd, HWND_TOPMOST, GetSystemMetrics(SM_XVIRTUALSCREEN), GetSystemMetrics(SM_YVIRTUALSCREEN), GetSystemMetrics(SM_CXVIRTUALSCREEN), GetSystemMetrics(SM_CYVIRTUALSCREEN), 0);
|
||||
UpdateCrosshairsPosition();
|
||||
ShowWindow(m_hwnd, SW_SHOWNOACTIVATE);
|
||||
m_visible = true;
|
||||
m_mouseHook = SetWindowsHookEx(WH_MOUSE_LL, MouseHookProc, m_hinstance, 0);
|
||||
}
|
||||
|
||||
void InclusiveCrosshairs::StopDrawing()
|
||||
{
|
||||
Logger::info("Stop drawing crosshairs.");
|
||||
m_visible = false;
|
||||
ShowWindow(m_hwnd, SW_HIDE);
|
||||
UnhookWindowsHookEx(m_mouseHook);
|
||||
m_mouseHook = NULL;
|
||||
}
|
||||
|
||||
void InclusiveCrosshairs::SwitchActivationMode()
|
||||
{
|
||||
PostMessage(m_hwnd, WM_SWITCH_ACTIVATION_MODE, 0, 0);
|
||||
}
|
||||
|
||||
void InclusiveCrosshairs::ApplySettings(InclusiveCrosshairsSettings& settings, bool applyToRunTimeObjects)
|
||||
{
|
||||
m_crosshairs_radius = settings.crosshairsRadius;
|
||||
m_crosshairs_thickness = settings.crosshairsThickness;
|
||||
m_crosshairs_color = settings.crosshairsColor;
|
||||
m_crosshairs_opacity = max(0.f, min(1.f, (float)settings.crosshairsOpacity / 100.0f));
|
||||
m_crosshairs_border_color = settings.crosshairsBorderColor;
|
||||
m_crosshairs_border_size = settings.crosshairsBorderSize;
|
||||
|
||||
if (applyToRunTimeObjects)
|
||||
{
|
||||
// Runtime objects already created. Should update in the owner thread.
|
||||
if (m_dispatcherQueueController == nullptr)
|
||||
{
|
||||
Logger::warn("Tried accessing the dispatch queue controller before it was initialized.");
|
||||
// No dispatcher Queue Controller? Means initialization still hasn't run, so settings will be applied then.
|
||||
return;
|
||||
}
|
||||
auto dispatcherQueue = m_dispatcherQueueController.DispatcherQueue();
|
||||
InclusiveCrosshairsSettings localSettings = settings;
|
||||
bool enqueueSucceeded = dispatcherQueue.TryEnqueue([=]() {
|
||||
if (!m_destroyed)
|
||||
{
|
||||
// Apply new settings to runtime composition objects.
|
||||
m_left_crosshairs.Brush().as<winrt::CompositionColorBrush>().Color(m_crosshairs_color);
|
||||
m_right_crosshairs.Brush().as<winrt::CompositionColorBrush>().Color(m_crosshairs_color);
|
||||
m_top_crosshairs.Brush().as<winrt::CompositionColorBrush>().Color(m_crosshairs_color);
|
||||
m_bottom_crosshairs.Brush().as<winrt::CompositionColorBrush>().Color(m_crosshairs_color);
|
||||
m_left_crosshairs_border.Brush().as<winrt::CompositionColorBrush>().Color(m_crosshairs_border_color);
|
||||
m_right_crosshairs_border.Brush().as<winrt::CompositionColorBrush>().Color(m_crosshairs_border_color);
|
||||
m_top_crosshairs_border.Brush().as<winrt::CompositionColorBrush>().Color(m_crosshairs_border_color);
|
||||
m_bottom_crosshairs_border.Brush().as<winrt::CompositionColorBrush>().Color(m_crosshairs_border_color);
|
||||
m_root.Opacity(m_crosshairs_opacity);
|
||||
UpdateCrosshairsPosition();
|
||||
}
|
||||
});
|
||||
if (!enqueueSucceeded)
|
||||
{
|
||||
Logger::error("Couldn't enqueue message to update the crosshairs settings.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void InclusiveCrosshairs::DestroyInclusiveCrosshairs()
|
||||
{
|
||||
StopDrawing();
|
||||
PostQuitMessage(0);
|
||||
}
|
||||
|
||||
LRESULT CALLBACK InclusiveCrosshairs::WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) noexcept
|
||||
{
|
||||
switch (message)
|
||||
{
|
||||
case WM_NCCREATE:
|
||||
instance->m_hwnd = hWnd;
|
||||
return DefWindowProc(hWnd, message, wParam, lParam);
|
||||
case WM_CREATE:
|
||||
return instance->CreateInclusiveCrosshairs() ? 0 : -1;
|
||||
case WM_NCHITTEST:
|
||||
return HTTRANSPARENT;
|
||||
case WM_SWITCH_ACTIVATION_MODE:
|
||||
if (instance->m_visible)
|
||||
{
|
||||
instance->StopDrawing();
|
||||
}
|
||||
else
|
||||
{
|
||||
instance->StartDrawing();
|
||||
}
|
||||
break;
|
||||
case WM_DESTROY:
|
||||
instance->DestroyInclusiveCrosshairs();
|
||||
break;
|
||||
default:
|
||||
return DefWindowProc(hWnd, message, wParam, lParam);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool InclusiveCrosshairs::MyRegisterClass(HINSTANCE hInstance)
|
||||
{
|
||||
WNDCLASS wc{};
|
||||
|
||||
m_hinstance = hInstance;
|
||||
|
||||
SetThreadDpiAwarenessContext(DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2);
|
||||
if (!GetClassInfoW(hInstance, m_className, &wc))
|
||||
{
|
||||
wc.lpfnWndProc = WndProc;
|
||||
wc.hInstance = hInstance;
|
||||
wc.hIcon = LoadIcon(hInstance, IDI_APPLICATION);
|
||||
wc.hCursor = LoadCursor(nullptr, IDC_ARROW);
|
||||
wc.hbrBackground = (HBRUSH)GetStockObject(NULL_BRUSH);
|
||||
wc.lpszClassName = m_className;
|
||||
|
||||
if (!RegisterClassW(&wc))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
m_hwndOwner = CreateWindow(L"static", nullptr, WS_POPUP, 0, 0, 0, 0, nullptr, nullptr, hInstance, nullptr);
|
||||
|
||||
DWORD exStyle = WS_EX_TRANSPARENT | WS_EX_LAYERED | WS_EX_NOREDIRECTIONBITMAP | WS_EX_TOOLWINDOW;
|
||||
return CreateWindowExW(exStyle, m_className, m_windowTitle, WS_POPUP, CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, m_hwndOwner, nullptr, hInstance, nullptr) != nullptr;
|
||||
}
|
||||
|
||||
void InclusiveCrosshairs::Terminate()
|
||||
{
|
||||
auto dispatcherQueue = m_dispatcherQueueController.DispatcherQueue();
|
||||
bool enqueueSucceeded = dispatcherQueue.TryEnqueue([=]() {
|
||||
m_destroyed = true;
|
||||
DestroyWindow(m_hwndOwner);
|
||||
});
|
||||
if (!enqueueSucceeded)
|
||||
{
|
||||
Logger::error("Couldn't enqueue message to destroy the window.");
|
||||
}
|
||||
}
|
||||
|
||||
#pragma region InclusiveCrosshairs_API
|
||||
|
||||
void InclusiveCrosshairsApplySettings(InclusiveCrosshairsSettings& settings)
|
||||
{
|
||||
if (InclusiveCrosshairs::instance != nullptr)
|
||||
{
|
||||
Logger::info("Applying settings.");
|
||||
InclusiveCrosshairs::instance->ApplySettings(settings, true);
|
||||
}
|
||||
}
|
||||
|
||||
void InclusiveCrosshairsSwitch()
|
||||
{
|
||||
if (InclusiveCrosshairs::instance != nullptr)
|
||||
{
|
||||
Logger::info("Switching activation mode.");
|
||||
InclusiveCrosshairs::instance->SwitchActivationMode();
|
||||
}
|
||||
}
|
||||
|
||||
void InclusiveCrosshairsDisable()
|
||||
{
|
||||
if (InclusiveCrosshairs::instance != nullptr)
|
||||
{
|
||||
Logger::info("Terminating the crosshairs instance.");
|
||||
InclusiveCrosshairs::instance->Terminate();
|
||||
}
|
||||
}
|
||||
|
||||
bool InclusiveCrosshairsIsEnabled()
|
||||
{
|
||||
return (InclusiveCrosshairs::instance != nullptr);
|
||||
}
|
||||
|
||||
int InclusiveCrosshairsMain(HINSTANCE hInstance, InclusiveCrosshairsSettings& settings)
|
||||
{
|
||||
Logger::info("Starting a crosshairs instance.");
|
||||
if (InclusiveCrosshairs::instance != nullptr)
|
||||
{
|
||||
Logger::error("A crosshairs instance was still working when trying to start a new one.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Perform application initialization:
|
||||
InclusiveCrosshairs crosshairs;
|
||||
InclusiveCrosshairs::instance = &crosshairs;
|
||||
crosshairs.ApplySettings(settings, false);
|
||||
if (!crosshairs.MyRegisterClass(hInstance))
|
||||
{
|
||||
Logger::error("Couldn't initialize a crosshairs instance.");
|
||||
InclusiveCrosshairs::instance = nullptr;
|
||||
return FALSE;
|
||||
}
|
||||
Logger::info("Initialized the crosshairs instance.");
|
||||
|
||||
MSG msg;
|
||||
|
||||
// Main message loop:
|
||||
while (GetMessage(&msg, nullptr, 0, 0))
|
||||
{
|
||||
TranslateMessage(&msg);
|
||||
DispatchMessage(&msg);
|
||||
}
|
||||
|
||||
Logger::info("Crosshairs message loop ended.");
|
||||
InclusiveCrosshairs::instance = nullptr;
|
||||
|
||||
return (int)msg.wParam;
|
||||
}
|
||||
|
||||
#pragma endregion InclusiveCrosshairs_API
|
||||
@@ -0,0 +1,25 @@
|
||||
#pragma once
|
||||
#include "pch.h"
|
||||
|
||||
constexpr int INCLUSIVE_MOUSE_DEFAULT_CROSSHAIRS_OPACITY = 75;
|
||||
const winrt::Windows::UI::Color INCLUSIVE_MOUSE_DEFAULT_CROSSHAIRS_COLOR = winrt::Windows::UI::ColorHelper::FromArgb(255, 255, 0, 0);
|
||||
const winrt::Windows::UI::Color INCLUSIVE_MOUSE_DEFAULT_CROSSHAIRS_BORDER_COLOR = winrt::Windows::UI::ColorHelper::FromArgb(255, 255, 255, 255);
|
||||
constexpr int INCLUSIVE_MOUSE_DEFAULT_CROSSHAIRS_RADIUS = 20;
|
||||
constexpr int INCLUSIVE_MOUSE_DEFAULT_CROSSHAIRS_THICKNESS = 5;
|
||||
constexpr int INCLUSIVE_MOUSE_DEFAULT_CROSSHAIRS_BORDER_SIZE = 1;
|
||||
|
||||
struct InclusiveCrosshairsSettings
|
||||
{
|
||||
winrt::Windows::UI::Color crosshairsColor = INCLUSIVE_MOUSE_DEFAULT_CROSSHAIRS_COLOR;
|
||||
winrt::Windows::UI::Color crosshairsBorderColor = INCLUSIVE_MOUSE_DEFAULT_CROSSHAIRS_BORDER_COLOR;
|
||||
int crosshairsRadius = INCLUSIVE_MOUSE_DEFAULT_CROSSHAIRS_RADIUS;
|
||||
int crosshairsThickness = INCLUSIVE_MOUSE_DEFAULT_CROSSHAIRS_THICKNESS;
|
||||
int crosshairsOpacity = INCLUSIVE_MOUSE_DEFAULT_CROSSHAIRS_OPACITY;
|
||||
int crosshairsBorderSize = INCLUSIVE_MOUSE_DEFAULT_CROSSHAIRS_BORDER_SIZE;
|
||||
};
|
||||
|
||||
int InclusiveCrosshairsMain(HINSTANCE hinst, InclusiveCrosshairsSettings& settings);
|
||||
void InclusiveCrosshairsDisable();
|
||||
bool InclusiveCrosshairsIsEnabled();
|
||||
void InclusiveCrosshairsSwitch();
|
||||
void InclusiveCrosshairsApplySettings(InclusiveCrosshairsSettings& settings);
|
||||
@@ -0,0 +1,40 @@
|
||||
#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
|
||||
@@ -0,0 +1,145 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200729.8\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200729.8\build\native\Microsoft.Windows.CppWinRT.props')" />
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<VCProjectVersion>15.0</VCProjectVersion>
|
||||
<ProjectGuid>{eae14c0e-7a6b-45da-9080-a7d8c077ba6e}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>MousePointerCrosshairs</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0.18362.0</WindowsTargetPlatformVersion>
|
||||
<ProjectName>MousePointerCrosshairs</ProjectName>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<Import Project="..\..\..\..\deps\spdlog.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="Shared">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\modules\MouseUtils\</OutDir>
|
||||
<TargetName>PowerToys.MousePointerCrosshairs</TargetName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\modules\MouseUtils\</OutDir>
|
||||
<TargetName>PowerToys.MousePointerCrosshairs</TargetName>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>_DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<LanguageStandard>stdcpplatest</LanguageStandard>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>NDEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<LanguageStandard>stdcpplatest</LanguageStandard>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup>
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)src\;$(SolutionDir)src\modules;$(SolutionDir)src\common\Telemetry;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(CIBuild)'!='true'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="InclusiveCrosshairs.h" />
|
||||
<ClInclude Include="pch.h" />
|
||||
<ClInclude Include="trace.h" />
|
||||
<ClInclude Include="resource.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="dllmain.cpp" />
|
||||
<ClCompile Include="InclusiveCrosshairs.cpp" />
|
||||
<ClCompile Include="pch.cpp">
|
||||
<PrecompiledHeader Condition="'$(CIBuild)'!='true'">Create</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="trace.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="MousePointerCrosshairs.rc" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\common\logger\logger.vcxproj">
|
||||
<Project>{d9b8fc84-322a-4f9f-bbb9-20915c47ddfd}</Project>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\common\SettingsAPI\SetttingsAPI.vcxproj">
|
||||
<Project>{6955446d-23f7-4023-9bb3-8657f904af99}</Project>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
<Import Project="..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200729.8\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200729.8\build\native\Microsoft.Windows.CppWinRT.targets')" />
|
||||
</ImportGroup>
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200729.8\build\native\Microsoft.Windows.CppWinRT.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200729.8\build\native\Microsoft.Windows.CppWinRT.props'))" />
|
||||
<Error Condition="!Exists('..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200729.8\build\native\Microsoft.Windows.CppWinRT.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200729.8\build\native\Microsoft.Windows.CppWinRT.targets'))" />
|
||||
</Target>
|
||||
</Project>
|
||||
@@ -1,52 +1,56 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hh;hpp;hxx;hm;inl;inc;ipp;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Resource Files">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="targetver.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="pch.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="resource.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="PowerRenameUWPUI.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\dll\PowerRenameExt.cpp">
|
||||
<ClCompile Include="dllmain.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="pch.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="trace.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="InclusiveCrosshairs.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Image Include="..\ui\PowerRename.ico">
|
||||
<ClInclude Include="pch.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="trace.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="resource.h">
|
||||
<Filter>Resource Files</Filter>
|
||||
</Image>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="PowerRenameUWPUI.rc">
|
||||
<Filter>Resource Files</Filter>
|
||||
</ResourceCompile>
|
||||
</ClInclude>
|
||||
<ClInclude Include="InclusiveCrosshairs.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Filter Include="Generated Files">
|
||||
<UniqueIdentifier>{890924c4-f592-4e84-b140-4b07a607a224}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{a9a2fd9b-de66-43dc-99b2-56f0d1ddecda}</UniqueIdentifier>
|
||||
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Resource Files">
|
||||
<UniqueIdentifier>{b5d0d62e-0275-439b-a910-e7c5befad045}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{5e350f4d-b07a-4bb2-8e63-b2c527358234}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;c++;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="MousePointerCrosshairs.rc">
|
||||
<Filter>Resource Files</Filter>
|
||||
</ResourceCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
312
src/modules/MouseUtils/MousePointerCrosshairs/dllmain.cpp
Normal file
312
src/modules/MouseUtils/MousePointerCrosshairs/dllmain.cpp
Normal file
@@ -0,0 +1,312 @@
|
||||
#include "pch.h"
|
||||
#include <interface/powertoy_module_interface.h>
|
||||
#include <common/SettingsAPI/settings_objects.h>
|
||||
#include "trace.h"
|
||||
#include "InclusiveCrosshairs.h"
|
||||
#include "common/utils/color.h"
|
||||
|
||||
// Non-Localizable strings
|
||||
namespace
|
||||
{
|
||||
const wchar_t JSON_KEY_PROPERTIES[] = L"properties";
|
||||
const wchar_t JSON_KEY_VALUE[] = L"value";
|
||||
const wchar_t JSON_KEY_ACTIVATION_SHORTCUT[] = L"activation_shortcut";
|
||||
const wchar_t JSON_KEY_CROSSHAIRS_COLOR[] = L"crosshairs_color";
|
||||
const wchar_t JSON_KEY_CROSSHAIRS_OPACITY[] = L"crosshairs_opacity";
|
||||
const wchar_t JSON_KEY_CROSSHAIRS_RADIUS[] = L"crosshairs_radius";
|
||||
const wchar_t JSON_KEY_CROSSHAIRS_THICKNESS[] = L"crosshairs_thickness";
|
||||
const wchar_t JSON_KEY_CROSSHAIRS_BORDER_COLOR[] = L"crosshairs_border_color";
|
||||
const wchar_t JSON_KEY_CROSSHAIRS_BORDER_SIZE[] = L"crosshairs_border_size";
|
||||
}
|
||||
|
||||
extern "C" IMAGE_DOS_HEADER __ImageBase;
|
||||
|
||||
HMODULE m_hModule;
|
||||
|
||||
BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
|
||||
{
|
||||
m_hModule = hModule;
|
||||
switch (ul_reason_for_call)
|
||||
{
|
||||
case DLL_PROCESS_ATTACH:
|
||||
Trace::RegisterProvider();
|
||||
break;
|
||||
case DLL_THREAD_ATTACH:
|
||||
case DLL_THREAD_DETACH:
|
||||
break;
|
||||
case DLL_PROCESS_DETACH:
|
||||
Trace::UnregisterProvider();
|
||||
break;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// The PowerToy name that will be shown in the settings.
|
||||
const static wchar_t* MODULE_NAME = L"MousePointerCrosshairs";
|
||||
// Add a description that will we shown in the module settings page.
|
||||
const static wchar_t* MODULE_DESC = L"<no description>";
|
||||
|
||||
// Implement the PowerToy Module Interface and all the required methods.
|
||||
class MousePointerCrosshairs : public PowertoyModuleIface
|
||||
{
|
||||
private:
|
||||
// The PowerToy state.
|
||||
bool m_enabled = false;
|
||||
|
||||
// Hotkey to invoke the module
|
||||
HotkeyEx m_hotkey;
|
||||
|
||||
// Mouse Pointer Crosshairs specific settings
|
||||
InclusiveCrosshairsSettings m_inclusiveCrosshairsSettings;
|
||||
|
||||
public:
|
||||
// Constructor
|
||||
MousePointerCrosshairs()
|
||||
{
|
||||
LoggerHelpers::init_logger(MODULE_NAME, L"ModuleInterface", LogSettings::mousePointerCrosshairsLoggerName);
|
||||
init_settings();
|
||||
};
|
||||
|
||||
// Destroy the powertoy and free memory
|
||||
virtual void destroy() override
|
||||
{
|
||||
delete this;
|
||||
}
|
||||
|
||||
// Return the localized display name of the powertoy
|
||||
virtual const wchar_t* get_name() override
|
||||
{
|
||||
return MODULE_NAME;
|
||||
}
|
||||
|
||||
// Return the non localized key of the powertoy, this will be cached by the runner
|
||||
virtual const wchar_t* get_key() override
|
||||
{
|
||||
return MODULE_NAME;
|
||||
}
|
||||
|
||||
// Return JSON with the configuration options.
|
||||
virtual bool get_config(wchar_t* buffer, int* buffer_size) override
|
||||
{
|
||||
HINSTANCE hinstance = reinterpret_cast<HINSTANCE>(&__ImageBase);
|
||||
|
||||
PowerToysSettings::Settings settings(hinstance, get_name());
|
||||
|
||||
return settings.serialize_to_buffer(buffer, buffer_size);
|
||||
}
|
||||
|
||||
// Signal from the Settings editor to call a custom action.
|
||||
// This can be used to spawn more complex editors.
|
||||
virtual void call_custom_action(const wchar_t* action) override
|
||||
{
|
||||
}
|
||||
|
||||
// Called by the runner to pass the updated settings values as a serialized JSON.
|
||||
virtual void set_config(const wchar_t* config) override
|
||||
{
|
||||
try
|
||||
{
|
||||
// Parse the input JSON string.
|
||||
PowerToysSettings::PowerToyValues values =
|
||||
PowerToysSettings::PowerToyValues::from_json_string(config, get_key());
|
||||
|
||||
parse_settings(values);
|
||||
|
||||
InclusiveCrosshairsApplySettings(m_inclusiveCrosshairsSettings);
|
||||
}
|
||||
catch (std::exception&)
|
||||
{
|
||||
Logger::error("Invalid json when trying to parse Mouse Pointer Crosshairs settings json.");
|
||||
}
|
||||
}
|
||||
|
||||
// Enable the powertoy
|
||||
virtual void enable()
|
||||
{
|
||||
m_enabled = true;
|
||||
Trace::EnableMousePointerCrosshairs(true);
|
||||
std::thread([=]() { InclusiveCrosshairsMain(m_hModule, m_inclusiveCrosshairsSettings); }).detach();
|
||||
}
|
||||
|
||||
// Disable the powertoy
|
||||
virtual void disable()
|
||||
{
|
||||
m_enabled = false;
|
||||
Trace::EnableMousePointerCrosshairs(false);
|
||||
InclusiveCrosshairsDisable();
|
||||
}
|
||||
|
||||
// Returns if the powertoys is enabled
|
||||
virtual bool is_enabled() override
|
||||
{
|
||||
return m_enabled;
|
||||
}
|
||||
|
||||
// Returns whether the PowerToys should be enabled by default
|
||||
virtual bool is_enabled_by_default() const override
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
virtual std::optional<HotkeyEx> GetHotkeyEx() override
|
||||
{
|
||||
return m_hotkey;
|
||||
}
|
||||
|
||||
virtual void OnHotkeyEx() override
|
||||
{
|
||||
InclusiveCrosshairsSwitch();
|
||||
}
|
||||
// Load the settings file.
|
||||
void init_settings()
|
||||
{
|
||||
try
|
||||
{
|
||||
// Load and parse the settings file for this PowerToy.
|
||||
PowerToysSettings::PowerToyValues settings =
|
||||
PowerToysSettings::PowerToyValues::load_from_settings_file(MousePointerCrosshairs::get_key());
|
||||
parse_settings(settings);
|
||||
}
|
||||
catch (std::exception&)
|
||||
{
|
||||
Logger::error("Invalid json when trying to load the Mouse Pointer Crosshairs settings json from file.");
|
||||
}
|
||||
}
|
||||
|
||||
void parse_settings(PowerToysSettings::PowerToyValues& settings)
|
||||
{
|
||||
// TODO: refactor to use common/utils/json.h instead
|
||||
auto settingsObject = settings.get_raw_json();
|
||||
InclusiveCrosshairsSettings inclusiveCrosshairsSettings;
|
||||
if (settingsObject.GetView().Size())
|
||||
{
|
||||
try
|
||||
{
|
||||
// Parse HotKey
|
||||
auto jsonPropertiesObject = settingsObject.GetNamedObject(JSON_KEY_PROPERTIES).GetNamedObject(JSON_KEY_ACTIVATION_SHORTCUT);
|
||||
auto hotkey = PowerToysSettings::HotkeyObject::from_json(jsonPropertiesObject);
|
||||
m_hotkey = HotkeyEx();
|
||||
if (hotkey.win_pressed())
|
||||
{
|
||||
m_hotkey.modifiersMask |= MOD_WIN;
|
||||
}
|
||||
|
||||
if (hotkey.ctrl_pressed())
|
||||
{
|
||||
m_hotkey.modifiersMask |= MOD_CONTROL;
|
||||
}
|
||||
|
||||
if (hotkey.shift_pressed())
|
||||
{
|
||||
m_hotkey.modifiersMask |= MOD_SHIFT;
|
||||
}
|
||||
|
||||
if (hotkey.alt_pressed())
|
||||
{
|
||||
m_hotkey.modifiersMask |= MOD_ALT;
|
||||
}
|
||||
|
||||
m_hotkey.vkCode = hotkey.get_code();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
Logger::warn("Failed to initialize Mouse Pointer Crosshairs activation shortcut");
|
||||
}
|
||||
try
|
||||
{
|
||||
// Parse Opacity
|
||||
auto jsonPropertiesObject = settingsObject.GetNamedObject(JSON_KEY_PROPERTIES).GetNamedObject(JSON_KEY_CROSSHAIRS_OPACITY);
|
||||
inclusiveCrosshairsSettings.crosshairsOpacity = (uint8_t)jsonPropertiesObject.GetNamedNumber(JSON_KEY_VALUE);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
Logger::warn("Failed to initialize Opacity from settings. Will use default value");
|
||||
}
|
||||
try
|
||||
{
|
||||
// Parse crosshairs color
|
||||
auto jsonPropertiesObject = settingsObject.GetNamedObject(JSON_KEY_PROPERTIES).GetNamedObject(JSON_KEY_CROSSHAIRS_COLOR);
|
||||
auto crosshairsColor = (std::wstring)jsonPropertiesObject.GetNamedString(JSON_KEY_VALUE);
|
||||
uint8_t r, g, b;
|
||||
if (!checkValidRGB(crosshairsColor, &r, &g, &b))
|
||||
{
|
||||
Logger::error("Crosshairs color RGB value is invalid. Will use default value");
|
||||
}
|
||||
else
|
||||
{
|
||||
inclusiveCrosshairsSettings.crosshairsColor = winrt::Windows::UI::ColorHelper::FromArgb(255, r, g, b);
|
||||
}
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
Logger::warn("Failed to initialize crosshairs color from settings. Will use default value");
|
||||
}
|
||||
try
|
||||
{
|
||||
// Parse Radius
|
||||
auto jsonPropertiesObject = settingsObject.GetNamedObject(JSON_KEY_PROPERTIES).GetNamedObject(JSON_KEY_CROSSHAIRS_RADIUS);
|
||||
inclusiveCrosshairsSettings.crosshairsRadius = (UINT)jsonPropertiesObject.GetNamedNumber(JSON_KEY_VALUE);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
Logger::warn("Failed to initialize Radius from settings. Will use default value");
|
||||
}
|
||||
try
|
||||
{
|
||||
// Parse Thickness
|
||||
auto jsonPropertiesObject = settingsObject.GetNamedObject(JSON_KEY_PROPERTIES).GetNamedObject(JSON_KEY_CROSSHAIRS_THICKNESS);
|
||||
inclusiveCrosshairsSettings.crosshairsThickness = (UINT)jsonPropertiesObject.GetNamedNumber(JSON_KEY_VALUE);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
Logger::warn("Failed to initialize Thickness from settings. Will use default value");
|
||||
}
|
||||
try
|
||||
{
|
||||
// Parse crosshairs border color
|
||||
auto jsonPropertiesObject = settingsObject.GetNamedObject(JSON_KEY_PROPERTIES).GetNamedObject(JSON_KEY_CROSSHAIRS_BORDER_COLOR);
|
||||
auto crosshairsBorderColor = (std::wstring)jsonPropertiesObject.GetNamedString(JSON_KEY_VALUE);
|
||||
uint8_t r, g, b;
|
||||
if (!checkValidRGB(crosshairsBorderColor, &r, &g, &b))
|
||||
{
|
||||
Logger::error("Crosshairs border color RGB value is invalid. Will use default value");
|
||||
}
|
||||
else
|
||||
{
|
||||
inclusiveCrosshairsSettings.crosshairsBorderColor = winrt::Windows::UI::ColorHelper::FromArgb(255, r, g, b);
|
||||
}
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
Logger::warn("Failed to initialize crosshairs border color from settings. Will use default value");
|
||||
}
|
||||
try
|
||||
{
|
||||
// Parse border size
|
||||
auto jsonPropertiesObject = settingsObject.GetNamedObject(JSON_KEY_PROPERTIES).GetNamedObject(JSON_KEY_CROSSHAIRS_BORDER_SIZE);
|
||||
inclusiveCrosshairsSettings.crosshairsBorderSize = (UINT)jsonPropertiesObject.GetNamedNumber(JSON_KEY_VALUE);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
Logger::warn("Failed to initialize border color from settings. Will use default value");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Logger::info("Mouse Pointer Crosshairs settings are empty");
|
||||
}
|
||||
if (!m_hotkey.modifiersMask)
|
||||
{
|
||||
Logger::info("Mouse Pointer Crosshairs is going to use default shortcut");
|
||||
m_hotkey.modifiersMask = MOD_CONTROL | MOD_ALT;
|
||||
m_hotkey.vkCode = 0x50; // P key
|
||||
}
|
||||
m_inclusiveCrosshairsSettings = inclusiveCrosshairsSettings;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
extern "C" __declspec(dllexport) PowertoyModuleIface* __cdecl powertoy_create()
|
||||
{
|
||||
return new MousePointerCrosshairs();
|
||||
}
|
||||
@@ -1,6 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="boost" version="1.72.0.0" targetFramework="native" />
|
||||
<package id="boost_regex-vc142" version="1.72.0.0" targetFramework="native" />
|
||||
<package id="Microsoft.Windows.CppWinRT" version="2.0.200729.8" targetFramework="native" />
|
||||
</packages>
|
||||
16
src/modules/MouseUtils/MousePointerCrosshairs/pch.h
Normal file
16
src/modules/MouseUtils/MousePointerCrosshairs/pch.h
Normal file
@@ -0,0 +1,16 @@
|
||||
#pragma once
|
||||
|
||||
#define COMPOSITION
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#include <windows.ui.composition.interop.h>
|
||||
#include <DispatcherQueue.h>
|
||||
#include <winrt/Windows.Foundation.h>
|
||||
#include <winrt/Windows.Foundation.Collections.h>
|
||||
#include <winrt/Windows.System.h>
|
||||
#include <winrt/Windows.UI.Composition.Desktop.h>
|
||||
#include <ProjectTelemetry.h>
|
||||
#include <thread>
|
||||
#include <common/SettingsAPI/settings_helpers.h>
|
||||
#include <common/logger/logger.h>
|
||||
#include <common/utils/logger_helper.h>
|
||||
13
src/modules/MouseUtils/MousePointerCrosshairs/resource.h
Normal file
13
src/modules/MouseUtils/MousePointerCrosshairs/resource.h
Normal file
@@ -0,0 +1,13 @@
|
||||
//{{NO_DEPENDENCIES}}
|
||||
// Microsoft Visual C++ generated include file.
|
||||
// Used by MousePointerCrosshairs.rc
|
||||
|
||||
//////////////////////////////
|
||||
// Non-localizable
|
||||
|
||||
#define FILE_DESCRIPTION "PowerToys MousePointerCrosshairs"
|
||||
#define INTERNAL_NAME "MousePointerCrosshairs"
|
||||
#define ORIGINAL_FILENAME "PowerToys.MousePointerCrosshairs.dll"
|
||||
|
||||
// Non-localizable
|
||||
//////////////////////////////
|
||||
40
src/modules/MouseUtils/MousePointerCrosshairs/trace.cpp
Normal file
40
src/modules/MouseUtils/MousePointerCrosshairs/trace.cpp
Normal file
@@ -0,0 +1,40 @@
|
||||
#include "pch.h"
|
||||
#include "trace.h"
|
||||
|
||||
TRACELOGGING_DEFINE_PROVIDER(
|
||||
g_hProvider,
|
||||
"Microsoft.PowerToys",
|
||||
// {38e8889b-9731-53f5-e901-e8a7c1753074}
|
||||
(0x38e8889b, 0x9731, 0x53f5, 0xe9, 0x01, 0xe8, 0xa7, 0xc1, 0x75, 0x30, 0x74),
|
||||
TraceLoggingOptionProjectTelemetry());
|
||||
|
||||
void Trace::RegisterProvider() noexcept
|
||||
{
|
||||
TraceLoggingRegister(g_hProvider);
|
||||
}
|
||||
|
||||
void Trace::UnregisterProvider() noexcept
|
||||
{
|
||||
TraceLoggingUnregister(g_hProvider);
|
||||
}
|
||||
|
||||
// Log if the user has MousePointerCrosshairs enabled or disabled
|
||||
void Trace::EnableMousePointerCrosshairs(const bool enabled) noexcept
|
||||
{
|
||||
TraceLoggingWrite(
|
||||
g_hProvider,
|
||||
"MousePointerCrosshairs_EnableMousePointerCrosshairs",
|
||||
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
||||
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE),
|
||||
TraceLoggingBoolean(enabled, "Enabled"));
|
||||
}
|
||||
|
||||
// Log that the user activated the module by having the crosshairs be drawn
|
||||
void Trace::StartDrawingCrosshairs() noexcept
|
||||
{
|
||||
TraceLoggingWrite(
|
||||
g_hProvider,
|
||||
"MousePointerCrosshairs_StartDrawingCrosshairs",
|
||||
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
||||
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE));
|
||||
}
|
||||
14
src/modules/MouseUtils/MousePointerCrosshairs/trace.h
Normal file
14
src/modules/MouseUtils/MousePointerCrosshairs/trace.h
Normal file
@@ -0,0 +1,14 @@
|
||||
#pragma once
|
||||
|
||||
class Trace
|
||||
{
|
||||
public:
|
||||
static void RegisterProvider() noexcept;
|
||||
static void UnregisterProvider() noexcept;
|
||||
|
||||
// Log if the user has MousePointerCrosshairs enabled or disabled
|
||||
static void EnableMousePointerCrosshairs(const bool enabled) noexcept;
|
||||
|
||||
// Log that the user activated the module by having the crosshairs be drawn
|
||||
static void StartDrawingCrosshairs() noexcept;
|
||||
};
|
||||
@@ -13,12 +13,12 @@
|
||||
<ProjectGuid>{2edb3eb4-fa92-4bff-b2d8-566584837231}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>ShortcutGuide</RootNamespace>
|
||||
<WindowsTargetPlatformMinVersion>10.0.17134.0</WindowsTargetPlatformMinVersion>
|
||||
<WindowsTargetPlatformMinVersion>10.0.18362.0</WindowsTargetPlatformMinVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<PlatformToolset Condition="'$(VisualStudioVersion)' == '15.0'">v141</PlatformToolset>
|
||||
<PlatformToolset Condition="'$(VisualStudioVersion)' == '16.0'">v142</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
|
||||
@@ -19,21 +19,21 @@
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<ProjectGuid>{2d604c07-51fc-46bb-9eb7-75aecc7f5e81}</ProjectGuid>
|
||||
<RootNamespace>ShortcutGuideModuleInterface</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0.17134.0</WindowsTargetPlatformVersion>
|
||||
<WindowsTargetPlatformVersion>10.0.18362.0</WindowsTargetPlatformVersion>
|
||||
<ProjectName>ShortcutGuideModuleInterface</ProjectName>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<SpectreMitigation>Spectre</SpectreMitigation>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<SpectreMitigation>Spectre</SpectreMitigation>
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#include <common/display/dpi_aware.h>
|
||||
#include <common/utils/game_mode.h>
|
||||
#include <common/utils/excluded_apps.h>
|
||||
#include <common/utils/resources.h>
|
||||
#include <common/utils/winapi_error.h>
|
||||
#include <common/utils/process_path.h>
|
||||
@@ -12,22 +13,7 @@
|
||||
namespace NonLocalizable
|
||||
{
|
||||
const static wchar_t* TOOL_WINDOW_CLASS_NAME = L"AlwaysOnTopWindow";
|
||||
}
|
||||
|
||||
// TODO: move to common utils
|
||||
bool find_app_name_in_path(const std::wstring& where, const std::vector<std::wstring>& what)
|
||||
{
|
||||
for (const auto& row : what)
|
||||
{
|
||||
const auto pos = where.rfind(row);
|
||||
const auto last_slash = where.rfind('\\');
|
||||
//Check that row occurs in where, and its last occurrence contains in itself the first character after the last backslash.
|
||||
if (pos != std::wstring::npos && pos <= last_slash + 1 && pos + row.length() > last_slash)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
const static wchar_t* WINDOW_IS_PINNED_PROP = L"AlwaysOnTop_Pinned";
|
||||
}
|
||||
|
||||
bool isExcluded(HWND window)
|
||||
@@ -103,7 +89,7 @@ void AlwaysOnTop::SettingsUpdate(SettingId id)
|
||||
{
|
||||
if (!iter.second)
|
||||
{
|
||||
AssignBorderTracker(iter.first);
|
||||
AssignBorder(iter.first);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -119,7 +105,7 @@ void AlwaysOnTop::SettingsUpdate(SettingId id)
|
||||
case SettingId::ExcludeApps:
|
||||
{
|
||||
std::vector<HWND> toErase{};
|
||||
for (const auto& [window, tracker] : m_topmostWindows)
|
||||
for (const auto& [window, border] : m_topmostWindows)
|
||||
{
|
||||
if (isExcluded(window))
|
||||
{
|
||||
@@ -187,14 +173,7 @@ void AlwaysOnTop::ProcessCommand(HWND window)
|
||||
if (PinTopmostWindow(window))
|
||||
{
|
||||
soundType = Sound::Type::On;
|
||||
if (AlwaysOnTopSettings::settings().enableFrame)
|
||||
{
|
||||
AssignBorderTracker(window);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_topmostWindows[window] = nullptr;
|
||||
}
|
||||
AssignBorder(window);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -234,36 +213,28 @@ void AlwaysOnTop::StartTrackingTopmostWindows()
|
||||
|
||||
for (HWND window : result)
|
||||
{
|
||||
if (IsTopmost(window))
|
||||
if (IsPinned(window))
|
||||
{
|
||||
if (AlwaysOnTopSettings::settings().enableFrame)
|
||||
{
|
||||
AssignBorderTracker(window);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_topmostWindows[window] = nullptr;
|
||||
}
|
||||
AssignBorder(window);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool AlwaysOnTop::AssignBorderTracker(HWND window)
|
||||
bool AlwaysOnTop::AssignBorder(HWND window)
|
||||
{
|
||||
auto tracker = std::make_unique<WindowBorder>(window);
|
||||
if (!tracker->Init(m_hinstance))
|
||||
if (m_virtualDesktopUtils.IsWindowOnCurrentDesktop(window) && AlwaysOnTopSettings::settings().enableFrame)
|
||||
{
|
||||
// Failed to init tracker, reset topmost
|
||||
UnpinTopmostWindow(window);
|
||||
return false;
|
||||
auto border = WindowBorder::Create(window, m_hinstance);
|
||||
if (border)
|
||||
{
|
||||
m_topmostWindows[window] = std::move(border);
|
||||
}
|
||||
}
|
||||
|
||||
if (m_virtualDesktopUtils.IsWindowOnCurrentDesktop(window))
|
||||
else
|
||||
{
|
||||
tracker->Show();
|
||||
m_topmostWindows[window] = nullptr;
|
||||
}
|
||||
|
||||
m_topmostWindows[window] = std::move(tracker);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -278,9 +249,9 @@ void AlwaysOnTop::SubscribeToEvents()
|
||||
// subscribe to windows events
|
||||
std::array<DWORD, 5> events_to_subscribe = {
|
||||
EVENT_OBJECT_LOCATIONCHANGE,
|
||||
EVENT_SYSTEM_MINIMIZESTART,
|
||||
EVENT_SYSTEM_MINIMIZEEND,
|
||||
EVENT_SYSTEM_MOVESIZEEND,
|
||||
EVENT_SYSTEM_SWITCHEND,
|
||||
EVENT_OBJECT_DESTROY,
|
||||
EVENT_OBJECT_NAMECHANGE
|
||||
};
|
||||
|
||||
@@ -300,7 +271,7 @@ void AlwaysOnTop::SubscribeToEvents()
|
||||
|
||||
void AlwaysOnTop::UnpinAll()
|
||||
{
|
||||
for (const auto& [topWindow, tracker] : m_topmostWindows)
|
||||
for (const auto& [topWindow, border] : m_topmostWindows)
|
||||
{
|
||||
if (!UnpinTopmostWindow(topWindow))
|
||||
{
|
||||
@@ -329,14 +300,38 @@ bool AlwaysOnTop::IsTopmost(HWND window) const noexcept
|
||||
return (exStyle & WS_EX_TOPMOST) == WS_EX_TOPMOST;
|
||||
}
|
||||
|
||||
bool AlwaysOnTop::IsPinned(HWND window) const noexcept
|
||||
{
|
||||
auto handle = GetProp(window, NonLocalizable::WINDOW_IS_PINNED_PROP);
|
||||
return (handle != NULL);
|
||||
}
|
||||
|
||||
bool AlwaysOnTop::PinTopmostWindow(HWND window) const noexcept
|
||||
{
|
||||
return SetWindowPos(window, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
|
||||
if (!SetProp(window, NonLocalizable::WINDOW_IS_PINNED_PROP, (HANDLE)1))
|
||||
{
|
||||
Logger::error(L"SetProp failed, {}", get_last_error_or_default(GetLastError()));
|
||||
}
|
||||
|
||||
auto res = SetWindowPos(window, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
|
||||
if (!res)
|
||||
{
|
||||
Logger::error(L"Failed to pin window, {}", get_last_error_or_default(GetLastError()));
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
bool AlwaysOnTop::UnpinTopmostWindow(HWND window) const noexcept
|
||||
{
|
||||
return SetWindowPos(window, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
|
||||
RemoveProp(window, NonLocalizable::WINDOW_IS_PINNED_PROP);
|
||||
auto res = SetWindowPos(window, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
|
||||
if (!res)
|
||||
{
|
||||
Logger::error(L"Failed to unpin window, {}", get_last_error_or_default(GetLastError()));
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
bool AlwaysOnTop::IsTracked(HWND window) const noexcept
|
||||
@@ -347,40 +342,72 @@ bool AlwaysOnTop::IsTracked(HWND window) const noexcept
|
||||
|
||||
void AlwaysOnTop::HandleWinHookEvent(WinHookEvent* data) noexcept
|
||||
{
|
||||
if (!AlwaysOnTopSettings::settings().enableFrame)
|
||||
if (!AlwaysOnTopSettings::settings().enableFrame || !data->hwnd)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// fix for the https://github.com/microsoft/PowerToys/issues/15300
|
||||
// check if the window was closed, since for some EVENT_OBJECT_DESTROY doesn't work
|
||||
std::vector<HWND> toErase{};
|
||||
for (const auto& [window, border] : m_topmostWindows)
|
||||
{
|
||||
bool visible = IsWindowVisible(window);
|
||||
if (!visible)
|
||||
{
|
||||
UnpinTopmostWindow(window);
|
||||
toErase.push_back(window);
|
||||
}
|
||||
}
|
||||
|
||||
for (const auto window : toErase)
|
||||
{
|
||||
m_topmostWindows.erase(window);
|
||||
}
|
||||
|
||||
switch (data->event)
|
||||
{
|
||||
case EVENT_OBJECT_LOCATIONCHANGE:
|
||||
{
|
||||
auto iter = m_topmostWindows.find(data->hwnd);
|
||||
if (iter != m_topmostWindows.end())
|
||||
{
|
||||
const auto& border = iter->second;
|
||||
if (border)
|
||||
{
|
||||
border->UpdateBorderPosition();
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case EVENT_SYSTEM_MINIMIZESTART:
|
||||
{
|
||||
auto iter = m_topmostWindows.find(data->hwnd);
|
||||
if (iter != m_topmostWindows.end())
|
||||
{
|
||||
m_topmostWindows[data->hwnd] = nullptr;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case EVENT_SYSTEM_MINIMIZEEND:
|
||||
{
|
||||
auto iter = m_topmostWindows.find(data->hwnd);
|
||||
if (iter != m_topmostWindows.end())
|
||||
{
|
||||
AssignBorder(data->hwnd);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case EVENT_SYSTEM_MOVESIZEEND:
|
||||
{
|
||||
auto iter = m_topmostWindows.find(data->hwnd);
|
||||
if (iter != m_topmostWindows.end())
|
||||
{
|
||||
const auto& tracker = iter->second;
|
||||
tracker->UpdateBorderPosition();
|
||||
}
|
||||
}
|
||||
break;
|
||||
case EVENT_OBJECT_DESTROY:
|
||||
{
|
||||
auto iter = m_topmostWindows.find(data->hwnd);
|
||||
if (iter != m_topmostWindows.end())
|
||||
{
|
||||
m_topmostWindows.erase(iter);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case EVENT_SYSTEM_SWITCHEND:
|
||||
{
|
||||
auto iter = m_topmostWindows.find(data->hwnd);
|
||||
if (iter != m_topmostWindows.end())
|
||||
{
|
||||
const auto& tracker = iter->second;
|
||||
tracker->Hide();
|
||||
const auto& border = iter->second;
|
||||
if (border)
|
||||
{
|
||||
border->UpdateBorderPosition();
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -401,15 +428,15 @@ void AlwaysOnTop::HandleWinHookEvent(WinHookEvent* data) noexcept
|
||||
|
||||
void AlwaysOnTop::VirtualDesktopSwitchedHandle()
|
||||
{
|
||||
for (const auto& [window, tracker] : m_topmostWindows)
|
||||
for (const auto& [window, border] : m_topmostWindows)
|
||||
{
|
||||
if (m_virtualDesktopUtils.IsWindowOnCurrentDesktop(window))
|
||||
{
|
||||
tracker->Show();
|
||||
AssignBorder(window);
|
||||
}
|
||||
else
|
||||
{
|
||||
tracker->Hide();
|
||||
m_topmostWindows[window] = nullptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -64,10 +64,11 @@ private:
|
||||
|
||||
bool IsTracked(HWND window) const noexcept;
|
||||
bool IsTopmost(HWND window) const noexcept;
|
||||
bool IsPinned(HWND window) const noexcept;
|
||||
|
||||
bool PinTopmostWindow(HWND window) const noexcept;
|
||||
bool UnpinTopmostWindow(HWND window) const noexcept;
|
||||
bool AssignBorderTracker(HWND window);
|
||||
bool AssignBorder(HWND window);
|
||||
|
||||
virtual void SettingsUpdate(SettingId type) override;
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@
|
||||
</ItemDefinitionGroup>
|
||||
<!-- Global props -->
|
||||
<PropertyGroup Label="Globals" Condition="'$(OverrideWindowsTargetPlatformVersion)'!='True'">
|
||||
<WindowsTargetPlatformVersion>10.0.17134.0</WindowsTargetPlatformVersion>
|
||||
<WindowsTargetPlatformVersion>10.0.18362.0</WindowsTargetPlatformVersion>
|
||||
<VCProjectVersion>16.0</VCProjectVersion>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<ProjectGuid>{1DC3BE92-CE89-43FB-8110-9C043A2FE7A2}</ProjectGuid>
|
||||
@@ -75,7 +75,7 @@
|
||||
<!-- Props that are constant for both Debug and Release configurations -->
|
||||
<PropertyGroup Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<IntDir>$(SolutionDir)$(Platform)\$(Configuration)\obj\$(ProjectName)\</IntDir>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<SpectreMitigation>Spectre</SpectreMitigation>
|
||||
|
||||
@@ -1,6 +1,19 @@
|
||||
#include "pch.h"
|
||||
#include "FrameDrawer.h"
|
||||
|
||||
#include <dwmapi.h>
|
||||
|
||||
namespace
|
||||
{
|
||||
size_t D2DRectUHash(D2D1_SIZE_U rect)
|
||||
{
|
||||
using pod_repr_t = uint64_t;
|
||||
static_assert(sizeof(D2D1_SIZE_U) == sizeof(pod_repr_t));
|
||||
std::hash<pod_repr_t> hasher{};
|
||||
return hasher(*reinterpret_cast<const pod_repr_t*>(&rect));
|
||||
}
|
||||
}
|
||||
|
||||
std::unique_ptr<FrameDrawer> FrameDrawer::Create(HWND window)
|
||||
{
|
||||
auto self = std::make_unique<FrameDrawer>(window);
|
||||
@@ -12,63 +25,54 @@ std::unique_ptr<FrameDrawer> FrameDrawer::Create(HWND window)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
FrameDrawer::FrameDrawer(FrameDrawer&& other) :
|
||||
m_window(other.m_window),
|
||||
m_renderTarget(std::move(other.m_renderTarget)),
|
||||
m_sceneRect(std::move(other.m_sceneRect)),
|
||||
m_renderThread(std::move(m_renderThread))
|
||||
{
|
||||
}
|
||||
|
||||
FrameDrawer::FrameDrawer(HWND window) :
|
||||
m_window(window), m_renderTarget(nullptr)
|
||||
m_window(window)
|
||||
{
|
||||
}
|
||||
|
||||
FrameDrawer::~FrameDrawer()
|
||||
bool FrameDrawer::CreateRenderTargets(const RECT& clientRect)
|
||||
{
|
||||
m_abortThread = true;
|
||||
m_renderThread.join();
|
||||
HRESULT hr;
|
||||
|
||||
if (m_renderTarget)
|
||||
constexpr float DPI = 96.f; // Always using the default in DPI-aware mode
|
||||
const auto renderTargetProperties = D2D1::RenderTargetProperties(
|
||||
D2D1_RENDER_TARGET_TYPE_DEFAULT,
|
||||
D2D1::PixelFormat(DXGI_FORMAT_UNKNOWN, D2D1_ALPHA_MODE_PREMULTIPLIED),
|
||||
DPI,
|
||||
DPI);
|
||||
|
||||
const auto renderTargetSize = D2D1::SizeU(clientRect.right - clientRect.left, clientRect.bottom - clientRect.top);
|
||||
const auto rectHash = D2DRectUHash(renderTargetSize);
|
||||
if (m_renderTarget && rectHash == m_renderTargetSizeHash)
|
||||
{
|
||||
m_renderTarget->Release();
|
||||
// Already at the desired size -> do nothing
|
||||
return true;
|
||||
}
|
||||
|
||||
m_renderTarget = nullptr;
|
||||
|
||||
const auto hwndRenderTargetProperties = D2D1::HwndRenderTargetProperties(m_window, renderTargetSize, D2D1_PRESENT_OPTIONS_NONE);
|
||||
|
||||
hr = GetD2DFactory()->CreateHwndRenderTarget(renderTargetProperties, hwndRenderTargetProperties, m_renderTarget.put());
|
||||
|
||||
if (!SUCCEEDED(hr) || !m_renderTarget)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
m_renderTargetSizeHash = rectHash;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool FrameDrawer::Init()
|
||||
{
|
||||
RECT clientRect;
|
||||
|
||||
// Obtain the size of the drawing area.
|
||||
if (!GetClientRect(m_window, &clientRect))
|
||||
if (!SUCCEEDED(DwmGetWindowAttribute(m_window, DWMWA_EXTENDED_FRAME_BOUNDS, &clientRect, sizeof(clientRect))))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
HRESULT hr;
|
||||
|
||||
// Create a Direct2D render target
|
||||
// We should always use the DPI value of 96 since we're running in DPI aware mode
|
||||
auto renderTargetProperties = D2D1::RenderTargetProperties(
|
||||
D2D1_RENDER_TARGET_TYPE_DEFAULT,
|
||||
D2D1::PixelFormat(DXGI_FORMAT_UNKNOWN, D2D1_ALPHA_MODE_PREMULTIPLIED),
|
||||
96.f,
|
||||
96.f);
|
||||
|
||||
auto renderTargetSize = D2D1::SizeU(clientRect.right - clientRect.left, clientRect.bottom - clientRect.top);
|
||||
auto hwndRenderTargetProperties = D2D1::HwndRenderTargetProperties(m_window, renderTargetSize);
|
||||
|
||||
hr = GetD2DFactory()->CreateHwndRenderTarget(renderTargetProperties, hwndRenderTargetProperties, &m_renderTarget);
|
||||
|
||||
if (!SUCCEEDED(hr))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
m_renderThread = std::thread([this]() { RenderLoop(); });
|
||||
|
||||
return true;
|
||||
return CreateRenderTargets(clientRect);
|
||||
}
|
||||
|
||||
void FrameDrawer::Hide()
|
||||
@@ -79,19 +83,63 @@ void FrameDrawer::Hide()
|
||||
void FrameDrawer::Show()
|
||||
{
|
||||
ShowWindow(m_window, SW_SHOWNA);
|
||||
Render();
|
||||
}
|
||||
|
||||
void FrameDrawer::SetBorderRect(RECT windowRect, COLORREF color, float thickness)
|
||||
void FrameDrawer::SetBorderRect(RECT windowRect, COLORREF color, int thickness)
|
||||
{
|
||||
std::unique_lock lock(m_mutex);
|
||||
|
||||
auto borderColor = ConvertColor(color);
|
||||
|
||||
m_sceneRect = DrawableRect{
|
||||
const auto newSceneRect = DrawableRect{
|
||||
.rect = ConvertRect(windowRect),
|
||||
.borderColor = borderColor,
|
||||
.borderColor = ConvertColor(color),
|
||||
.thickness = thickness
|
||||
};
|
||||
|
||||
const bool colorUpdated = std::memcmp(&m_sceneRect.borderColor, &newSceneRect.borderColor, sizeof(newSceneRect.borderColor));
|
||||
const bool thicknessUpdated = m_sceneRect.thickness != newSceneRect.thickness;
|
||||
const bool needsRedraw = colorUpdated || thicknessUpdated;
|
||||
|
||||
RECT clientRect;
|
||||
if (!SUCCEEDED(DwmGetWindowAttribute(m_window, DWMWA_EXTENDED_FRAME_BOUNDS, &clientRect, sizeof(clientRect))))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
m_sceneRect = newSceneRect;
|
||||
|
||||
const auto renderTargetSize = D2D1::SizeU(clientRect.right - clientRect.left, clientRect.bottom - clientRect.top);
|
||||
|
||||
const auto rectHash = D2DRectUHash(renderTargetSize);
|
||||
|
||||
const bool atTheDesiredSize = (rectHash == m_renderTargetSizeHash) && m_renderTarget;
|
||||
if (!atTheDesiredSize)
|
||||
{
|
||||
const bool resizeOk = m_renderTarget && SUCCEEDED(m_renderTarget->Resize(renderTargetSize));
|
||||
if (!resizeOk)
|
||||
{
|
||||
if (!CreateRenderTargets(clientRect))
|
||||
{
|
||||
Logger::error(L"Failed to create render targets");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_renderTargetSizeHash = rectHash;
|
||||
}
|
||||
}
|
||||
|
||||
if (colorUpdated)
|
||||
{
|
||||
m_borderBrush = nullptr;
|
||||
if (m_renderTarget)
|
||||
{
|
||||
m_renderTarget->CreateSolidColorBrush(m_sceneRect.borderColor, m_borderBrush.put());
|
||||
}
|
||||
}
|
||||
|
||||
if (!atTheDesiredSize || needsRedraw)
|
||||
{
|
||||
Render();
|
||||
}
|
||||
}
|
||||
|
||||
ID2D1Factory* FrameDrawer::GetD2DFactory()
|
||||
@@ -127,46 +175,19 @@ D2D1_RECT_F FrameDrawer::ConvertRect(RECT rect)
|
||||
return D2D1::RectF((float)rect.left, (float)rect.top, (float)rect.right, (float)rect.bottom);
|
||||
}
|
||||
|
||||
FrameDrawer::RenderResult FrameDrawer::Render()
|
||||
void FrameDrawer::Render()
|
||||
{
|
||||
std::unique_lock lock(m_mutex);
|
||||
|
||||
if (!m_renderTarget)
|
||||
{
|
||||
return RenderResult::Failed;
|
||||
}
|
||||
|
||||
return;
|
||||
m_renderTarget->BeginDraw();
|
||||
|
||||
// Draw backdrop
|
||||
m_renderTarget->Clear(D2D1::ColorF(0.f, 0.f, 0.f, 0.f));
|
||||
|
||||
ID2D1SolidColorBrush* borderBrush = nullptr;
|
||||
m_renderTarget->CreateSolidColorBrush(m_sceneRect.borderColor, &borderBrush);
|
||||
|
||||
if (borderBrush)
|
||||
if (m_borderBrush)
|
||||
{
|
||||
m_renderTarget->DrawRectangle(m_sceneRect.rect, borderBrush, m_sceneRect.thickness);
|
||||
borderBrush->Release();
|
||||
// The border stroke is centered on the line.
|
||||
m_renderTarget->DrawRectangle(m_sceneRect.rect, m_borderBrush.get(), static_cast<float>(m_sceneRect.thickness * 2));
|
||||
}
|
||||
|
||||
// The lock must be released here, as EndDraw() will wait for vertical sync
|
||||
lock.unlock();
|
||||
|
||||
m_renderTarget->EndDraw();
|
||||
return RenderResult::Ok;
|
||||
}
|
||||
|
||||
void FrameDrawer::RenderLoop()
|
||||
{
|
||||
while (!m_abortThread)
|
||||
{
|
||||
auto result = Render();
|
||||
if (result == RenderResult::Failed)
|
||||
{
|
||||
Logger::error("Render failed");
|
||||
Hide();
|
||||
m_abortThread = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user