mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-30 00:46:20 +01:00
Compare commits
6 Commits
dev/featur
...
stefan/opt
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
16e81439f1 | ||
|
|
c81c52dee4 | ||
|
|
f7255ab89b | ||
|
|
2373901dec | ||
|
|
7a4428acbb | ||
|
|
90e36eaf19 |
1
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
1
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
@@ -76,7 +76,6 @@ body:
|
||||
- System tray interaction
|
||||
- TextExtractor
|
||||
- Video Conference Mute
|
||||
- Workspaces
|
||||
- Welcome / PowerToys Tour window
|
||||
validations:
|
||||
required: true
|
||||
|
||||
1
.github/ISSUE_TEMPLATE/translation_issue.yml
vendored
1
.github/ISSUE_TEMPLATE/translation_issue.yml
vendored
@@ -50,7 +50,6 @@ body:
|
||||
- System tray interaction
|
||||
- TextExtractor
|
||||
- Video Conference Mute
|
||||
- Workspaces
|
||||
- Welcome / PowerToys Tour window
|
||||
validations:
|
||||
required: true
|
||||
|
||||
24
.github/actions/spell-check/expect.txt
vendored
24
.github/actions/spell-check/expect.txt
vendored
@@ -56,14 +56,11 @@ APPBARDATA
|
||||
appdata
|
||||
APPEXECLINK
|
||||
Appium
|
||||
applayout
|
||||
Applicationcan
|
||||
APPLICATIONFRAMEHOST
|
||||
appmanifest
|
||||
APPNAME
|
||||
appref
|
||||
appsettings
|
||||
appsfolder
|
||||
appwindow
|
||||
appwiz
|
||||
APSTUDIO
|
||||
@@ -203,8 +200,8 @@ CMINVOKECOMMANDINFO
|
||||
CMINVOKECOMMANDINFOEX
|
||||
CMock
|
||||
CMONITORS
|
||||
cmph
|
||||
cmpgt
|
||||
cmph
|
||||
cne
|
||||
CNF
|
||||
coclass
|
||||
@@ -244,7 +241,6 @@ CONTEXTMENUHANDLER
|
||||
CONTROLL
|
||||
CONTROLPARENT
|
||||
copiedcolorrepresentation
|
||||
COREWINDOW
|
||||
cotaskmem
|
||||
COULDNOT
|
||||
countof
|
||||
@@ -411,7 +407,6 @@ dxgi
|
||||
dxgidebug
|
||||
dxgiformat
|
||||
dxguid
|
||||
easeofaccess
|
||||
ecount
|
||||
EData
|
||||
Edid
|
||||
@@ -450,6 +445,7 @@ ETW
|
||||
EUQ
|
||||
eurochange
|
||||
eventlog
|
||||
EVENTTAG
|
||||
eventvwr
|
||||
everytime
|
||||
evt
|
||||
@@ -677,7 +673,6 @@ imageresizerinput
|
||||
imageresizersettings
|
||||
imagingdevices
|
||||
ime
|
||||
imperialounce
|
||||
inetcpl
|
||||
Infobar
|
||||
INFOEXAMPLE
|
||||
@@ -842,7 +837,6 @@ lpwcx
|
||||
lpwndpl
|
||||
LReader
|
||||
LRESULT
|
||||
LSTATUS
|
||||
lstrcmp
|
||||
lstrcmpi
|
||||
lstrlen
|
||||
@@ -1151,6 +1145,7 @@ phwnd
|
||||
pici
|
||||
pidl
|
||||
PIDLIST
|
||||
pii
|
||||
PINDIR
|
||||
pinfo
|
||||
pinvoke
|
||||
@@ -1215,8 +1210,6 @@ projectname
|
||||
PROPBAG
|
||||
PROPERTYKEY
|
||||
propkey
|
||||
propsys
|
||||
PROPVARIANT
|
||||
propvarutil
|
||||
prvpane
|
||||
psapi
|
||||
@@ -1382,7 +1375,6 @@ sddl
|
||||
SDKDDK
|
||||
sdns
|
||||
searchterm
|
||||
SEARCHUI
|
||||
secpol
|
||||
SENDCHANGE
|
||||
sendinput
|
||||
@@ -1566,9 +1558,7 @@ SYSKEYUP
|
||||
SYSLIB
|
||||
SYSMENU
|
||||
SYSTEMAPPS
|
||||
systemsettings
|
||||
SYSTEMTIME
|
||||
SYSTEMWOW
|
||||
tapp
|
||||
TApplication
|
||||
TApplied
|
||||
@@ -1680,13 +1670,10 @@ urlmon
|
||||
Usb
|
||||
USEDEFAULT
|
||||
USEFILEATTRIBUTES
|
||||
USEPOSITION
|
||||
USERDATA
|
||||
Userenv
|
||||
USESHOWWINDOW
|
||||
USESIZE
|
||||
USESTDHANDLES
|
||||
usounce
|
||||
USRDLL
|
||||
UType
|
||||
uuidv
|
||||
@@ -1725,7 +1712,6 @@ vih
|
||||
VIRTUALDESK
|
||||
visiblecolorformats
|
||||
Visibletrue
|
||||
visualeffects
|
||||
VKey
|
||||
vmovl
|
||||
vorrq
|
||||
@@ -1752,7 +1738,6 @@ vswhere
|
||||
Vtbl
|
||||
WANTPALM
|
||||
wbem
|
||||
Wbemidl
|
||||
wbemuuid
|
||||
WBounds
|
||||
Wca
|
||||
@@ -1840,9 +1825,6 @@ WNDCLASSEXW
|
||||
WNDCLASSW
|
||||
WNDPROC
|
||||
workarounds
|
||||
WORKSPACESEDITOR
|
||||
WORKSPACESLAUNCHER
|
||||
WORKSPACESSNAPSHOTTOOL
|
||||
wox
|
||||
wparam
|
||||
wpf
|
||||
|
||||
@@ -189,14 +189,6 @@
|
||||
"WinUI3Apps\\PowerToys.PowerRenameContextMenu.dll",
|
||||
"WinUI3Apps\\PowerRenameContextMenuPackage.msix",
|
||||
|
||||
"PowerToys.WorkspacesSnapshotTool.exe",
|
||||
"PowerToys.WorkspacesLauncher.exe",
|
||||
"PowerToys.WorkspacesEditor.exe",
|
||||
"PowerToys.WorkspacesEditor.dll",
|
||||
"PowerToys.WorkspacesLauncherUI.exe",
|
||||
"PowerToys.WorkspacesLauncherUI.dll",
|
||||
"PowerToys.WorkspacesModuleInterface.dll",
|
||||
|
||||
"WinUI3Apps\\PowerToys.RegistryPreviewExt.dll",
|
||||
"WinUI3Apps\\PowerToys.RegistryPreviewUILib.dll",
|
||||
"WinUI3Apps\\PowerToys.RegistryPreview.dll",
|
||||
|
||||
@@ -157,8 +157,8 @@ extends:
|
||||
inputs:
|
||||
script: |
|
||||
call nuget.exe restore -configFile .pipelines/release-nuget.config -PackagesDirectory . .pipelines/packages.config || exit /b 1
|
||||
move /Y "Microsoft.PowerToys.Telemetry.2.0.0\build\include\TraceLoggingDefines.h" "src\common\Telemetry\TraceLoggingDefines.h" || exit /b 1
|
||||
move /Y "Microsoft.PowerToys.Telemetry.2.0.0\build\include\TelemetryBase.cs" "src\common\Telemetry\TelemetryBase.cs" || exit /b 1
|
||||
move /Y "Microsoft.PowerToys.Telemetry.2.0.1\build\include\TraceLoggingDefines.h" "src\common\Telemetry\TraceLoggingDefines.h" || exit /b 1
|
||||
move /Y "Microsoft.PowerToys.Telemetry.2.0.1\build\include\TelemetryBase.cs" "src\common\Telemetry\TelemetryBase.cs" || exit /b 1
|
||||
|
||||
## ALL BUT INSTALLER BUILDING
|
||||
- task: VSBuild@1
|
||||
|
||||
@@ -41,13 +41,7 @@ Get-ChildItem $targetDir -Recurse -Filter *.deps.json -Exclude UITests-FancyZone
|
||||
$dllName = Split-Path $_.Name -leaf
|
||||
if([bool]($_.Value.PSObject.Properties.name -match 'fileVersion')) {
|
||||
$dllFileVersion = $_.Value.fileVersion
|
||||
if ([string]::IsNullOrEmpty($dllFileVersion) -and $dllName.StartsWith('PowerToys.'))` {
|
||||
# After VS 17.11 update some of PowerToys dlls have no fileVersion in deps.json even though the
|
||||
# version is correctly set. This is a workaround to skip our dlls as we are confident that all of
|
||||
# our dlls share the same version across the dependencies.
|
||||
continue
|
||||
}
|
||||
|
||||
|
||||
# Add the entry to the dictionary of dictionary of lists
|
||||
if(-Not $referencedFileVersionsPerDll.ContainsKey($dllName)) {
|
||||
$referencedFileVersionsPerDll[$dllName] = @{ $dllFileVersion = New-Object System.Collections.Generic.List[System.String] }
|
||||
|
||||
@@ -1,28 +1,27 @@
|
||||
<Project>
|
||||
<Import Project="src\Version.props" />
|
||||
|
||||
<PropertyGroup>
|
||||
<Copyright>Copyright (C) Microsoft Corporation. All rights reserved.</Copyright>
|
||||
<AssemblyCompany>Microsoft Corp.</AssemblyCompany>
|
||||
<AssemblyCopyright>Copyright (C) Microsoft Corporation. All rights reserved.</AssemblyCopyright>
|
||||
<AssemblyProduct>PowerToys</AssemblyProduct>
|
||||
<AssemblyCompany>Microsoft Corp.</AssemblyCompany>
|
||||
<Company>Microsoft Corporation</Company>
|
||||
<Authors>Microsoft Corporation</Authors>
|
||||
<Product>PowerToys</Product>
|
||||
<NeutralLanguage>en-US</NeutralLanguage>
|
||||
<Platforms>x64;ARM64</Platforms>
|
||||
<PackageTags>PowerToys</PackageTags>
|
||||
<EnableNETAnalyzers>true</EnableNETAnalyzers>
|
||||
<AnalysisMode>Recommended</AnalysisMode>
|
||||
<_SkipUpgradeNetAnalyzersNuGetWarning>true</_SkipUpgradeNetAnalyzersNuGetWarning>
|
||||
<NuGetAuditMode>direct</NuGetAuditMode>
|
||||
<IncludeSourceRevisionInInformationalVersion>false</IncludeSourceRevisionInInformationalVersion> <!-- Don't add source revision hash to the product version of binaries. -->
|
||||
<IncludeSourceRevisionInInformationalVersion>false</IncludeSourceRevisionInInformationalVersion> <!-- Don't add source revision hash to the product version of binaries. -->
|
||||
<PlatformTarget>$(Platform)</PlatformTarget>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(MSBuildProjectExtension)' == '.csproj'">
|
||||
<Version>$(Version).0</Version>
|
||||
<RepositoryUrl>https://github.com/microsoft/PowerToys</RepositoryUrl>
|
||||
<RepositoryType>GitHub</RepositoryType>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(MSBuildProjectExtension)' == '.csproj'">
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||
</PropertyGroup>
|
||||
|
||||
@@ -35,7 +34,7 @@
|
||||
<PackageReference Include="StyleCop.Analyzers">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
</PackageReference>
|
||||
<Compile Include="$(MSBuildThisFileDirectory)\src\codeAnalysis\GlobalSuppressions.cs" Link="GlobalSuppressions.cs" />
|
||||
<AdditionalFiles Include="$(MSBuildThisFileDirectory)\src\codeAnalysis\StyleCop.json" Link="StyleCop.json" />
|
||||
|
||||
@@ -86,7 +85,7 @@
|
||||
<UsePrecompiledHeaders Condition="'$(TF_BUILD)' != ''">false</UsePrecompiledHeaders>
|
||||
|
||||
<!-- Change this to bust the cache -->
|
||||
<MSBuildCacheCacheUniverse Condition="'$(MSBuildCacheCacheUniverse)' == ''">202408150737</MSBuildCacheCacheUniverse>
|
||||
<MSBuildCacheCacheUniverse Condition="'$(MSBuildCacheCacheUniverse)' == ''">202407200737</MSBuildCacheCacheUniverse>
|
||||
|
||||
<!--
|
||||
Visual Studio telemetry reads various ApplicationInsights.config files and other files after the project is finished, likely in a detached process.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<Project>
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
|
||||
</PropertyGroup>
|
||||
@@ -17,15 +17,21 @@
|
||||
<PackageVersion Include="CommunityToolkit.WinUI.UI.Controls.DataGrid" Version="7.1.2" />
|
||||
<PackageVersion Include="CommunityToolkit.WinUI.UI.Controls.Markdown" Version="7.1.2" />
|
||||
<PackageVersion Include="ControlzEx" Version="6.0.0" />
|
||||
<PackageVersion Include="DotNetSeleniumExtras.WaitHelpers" Version="3.11.0" />
|
||||
<PackageVersion Include="HelixToolkit" Version="2.24.0" />
|
||||
<PackageVersion Include="HelixToolkit.Core.Wpf" Version="2.24.0" />
|
||||
<PackageVersion Include="HtmlAgilityPack" Version="1.11.57" />
|
||||
<PackageVersion Include="hyjiacan.pinyin4net" Version="4.1.1" />
|
||||
<PackageVersion Include="System.Net.Http" Version="4.3.4" />
|
||||
<PackageVersion Include="System.Text.RegularExpressions" Version="4.3.1" />
|
||||
<PackageVersion Include="System.Private.Uri" Version="4.3.2" />
|
||||
<PackageVersion Include="Interop.Microsoft.Office.Interop.OneNote" Version="1.1.0.2" />
|
||||
<PackageVersion Include="LazyCache" Version="2.4.0" />
|
||||
<PackageVersion Include="Mages" Version="2.0.2" />
|
||||
<PackageVersion Include="Markdig.Signed" Version="0.34.0" />
|
||||
<PackageVersion Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="8.0.0" />
|
||||
<PackageVersion Include="Microsoft.Data.Sqlite" Version="8.0.7" />
|
||||
<PackageVersion Include="Microsoft.DotNet.UpgradeAssistant.Extensions.Default.Analyzers" Version="0.4.336902" />
|
||||
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
|
||||
<PackageVersion Include="Microsoft.Extensions.Logging" Version="8.0.0" />
|
||||
<PackageVersion Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.0" />
|
||||
@@ -38,8 +44,9 @@
|
||||
<PackageVersion Include="Microsoft.Windows.Compatibility" Version="8.0.7" />
|
||||
<PackageVersion Include="Microsoft.Windows.CsWin32" Version="0.2.46-beta" />
|
||||
<!-- CsWinRT version needs to be set to have a WinRT.Runtime.dll at the same version contained inside the NET SDK we're currently building on CI. -->
|
||||
<PackageVersion Include="Microsoft.Windows.CsWinRT" Version="2.0.8" />
|
||||
<PackageVersion Include="Microsoft.Windows.CsWinRT" Version="2.0.4" />
|
||||
<PackageVersion Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.22621.2428" />
|
||||
<PackageVersion Include="Microsoft.Windows.SDK.Contracts" Version="10.0.19041.1" />
|
||||
<PackageVersion Include="Microsoft.WindowsAppSDK" Version="1.5.240428000" />
|
||||
<PackageVersion Include="Microsoft.Xaml.Behaviors.WinUI.Managed" Version="2.0.9" />
|
||||
<PackageVersion Include="Microsoft.Xaml.Behaviors.Wpf" Version="1.1.39" />
|
||||
@@ -47,6 +54,7 @@
|
||||
<!-- Moq to stay below v4.20 due to behavior change. need to be sure fixed -->
|
||||
<PackageVersion Include="Moq" Version="4.18.4" />
|
||||
<PackageVersion Include="MSTest" Version="3.5.0" />
|
||||
<PackageVersion Include="Newtonsoft.Json" Version="13.0.1" />
|
||||
<PackageVersion Include="NLog" Version="5.0.4" />
|
||||
<PackageVersion Include="NLog.Extensions.Logging" Version="5.3.8" />
|
||||
<PackageVersion Include="NLog.Schema" Version="5.2.8" />
|
||||
@@ -81,6 +89,8 @@
|
||||
<PackageVersion Include="UnicodeInformation" Version="2.6.0" />
|
||||
<PackageVersion Include="UnitsNet" Version="5.50.0" />
|
||||
<PackageVersion Include="UTF.Unknown" Version="2.5.1" />
|
||||
<PackageVersion Include="Vanara.PInvoke.User32" Version="3.4.11" />
|
||||
<PackageVersion Include="Vanara.PInvoke.Shell32" Version="3.4.11" />
|
||||
<PackageVersion Include="WinUIEx" Version="2.2.0" />
|
||||
<PackageVersion Include="WPF-UI" Version="3.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
@@ -1329,8 +1329,9 @@ EXHIBIT A -Mozilla Public License.
|
||||
- Microsoft.Win32.SystemEvents 8.0.0
|
||||
- Microsoft.Windows.Compatibility 8.0.7
|
||||
- Microsoft.Windows.CsWin32 0.2.46-beta
|
||||
- Microsoft.Windows.CsWinRT 2.0.8
|
||||
- Microsoft.Windows.CsWinRT 2.0.4
|
||||
- Microsoft.Windows.SDK.BuildTools 10.0.22621.2428
|
||||
- Microsoft.Windows.SDK.Contracts 10.0.19041.1
|
||||
- Microsoft.WindowsAppSDK 1.5.240428000
|
||||
- Microsoft.Xaml.Behaviors.WinUI.Managed 2.0.9
|
||||
- Microsoft.Xaml.Behaviors.Wpf 1.1.39
|
||||
@@ -1365,5 +1366,7 @@ EXHIBIT A -Mozilla Public License.
|
||||
- UnicodeInformation 2.6.0
|
||||
- UnitsNet 5.50.0
|
||||
- UTF.Unknown 2.5.1
|
||||
- Vanara.PInvoke.Shell32 3.4.11
|
||||
- Vanara.PInvoke.User32 3.4.11
|
||||
- WinUIEx 2.2.0
|
||||
- WPF-UI 3.0.0
|
||||
|
||||
150
PowerToys.sln
150
PowerToys.sln
@@ -171,18 +171,20 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
src\.editorconfig = src\.editorconfig
|
||||
.vsconfig = .vsconfig
|
||||
src\Common.Dotnet.CsWinRT.props = src\Common.Dotnet.CsWinRT.props
|
||||
src\Common.SelfContained.props = src\Common.SelfContained.props
|
||||
Cpp.Build.props = Cpp.Build.props
|
||||
Directory.Build.props = Directory.Build.props
|
||||
Directory.Build.targets = Directory.Build.targets
|
||||
Directory.Packages.props = Directory.Packages.props
|
||||
Solution.props = Solution.props
|
||||
src\Version.props = src\Version.props
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Settings.UI.Library", "src\settings-ui\Settings.UI.Library\Settings.UI.Library.csproj", "{B1BCC8C6-46B5-4BFA-8F22-20F32D99EC6A}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PowerToys.Interop", "src\common\interop\PowerToys.Interop.vcxproj", "{F055103B-F80B-4D0C-BF48-057C55620033}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{CC6E41AC-8174-4E8A-8D22-85DD7F4851DF} = {CC6E41AC-8174-4E8A-8D22-85DD7F4851DF}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Plugin.Folder", "src\modules\launcher\Plugins\Microsoft.Plugin.Folder\Microsoft.Plugin.Folder.csproj", "{787B8AA6-CA93-4C84-96FE-DF31110AD1C4}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PowerLauncher.Telemetry", "src\modules\launcher\PowerLauncher.Telemetry\PowerLauncher.Telemetry.csproj", "{08C8C05F-0362-41BC-818C-724572DF8B06}"
|
||||
@@ -277,7 +279,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "utils", "utils", "{B39DC643
|
||||
src\common\utils\modulesRegistry.h = src\common\utils\modulesRegistry.h
|
||||
src\common\utils\MsiUtils.h = src\common\utils\MsiUtils.h
|
||||
src\common\utils\MsWindowsSettings.h = src\common\utils\MsWindowsSettings.h
|
||||
src\common\utils\OnThreadExecutor.h = src\common\utils\OnThreadExecutor.h
|
||||
src\common\utils\os-detect.h = src\common\utils\os-detect.h
|
||||
src\common\utils\package.h = src\common\utils\package.h
|
||||
src\common\utils\ProcessWaiter.h = src\common\utils\ProcessWaiter.h
|
||||
@@ -297,6 +298,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Telemetry", "Telemetry", "{
|
||||
src\common\Telemetry\ProjectTelemetry.h = src\common\Telemetry\ProjectTelemetry.h
|
||||
src\common\Telemetry\TelemetryBase.cs = src\common\Telemetry\TelemetryBase.cs
|
||||
src\common\Telemetry\TraceLoggingDefines.h = src\common\Telemetry\TraceLoggingDefines.h
|
||||
src\common\Telemetry\TraceBase.h = src\common\Telemetry\TraceBase.h
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Common.UI", "src\common\Common.UI\Common.UI.csproj", "{C3A17DCA-217B-462C-BB0C-BE086AF80081}"
|
||||
@@ -457,7 +459,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FileLocksmithExt", "src\mod
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FileLocksmithUI", "src\modules\FileLocksmith\FileLocksmithUI\FileLocksmithUI.csproj", "{E69B044A-2F8A-45AA-AD0B-256C59421807}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PowerToys.FileLocksmithLib.Interop", "src\modules\FileLocksmith\FileLocksmithLibInterop\FileLocksmithLibInterop.vcxproj", "{C604B37E-9D0E-4484-8778-E8B31B0E1B3A}"
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FileLocksmithLibInterop", "src\modules\FileLocksmith\FileLocksmithLibInterop\FileLocksmithLibInterop.vcxproj", "{C604B37E-9D0E-4484-8778-E8B31B0E1B3A}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "GPOWrapper", "src\common\GPOWrapper\GPOWrapper.vcxproj", "{E599C30B-9DC8-4E5A-BF27-93D4CCEDE788}"
|
||||
EndProject
|
||||
@@ -582,39 +584,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PowerToys.Settings.DSC.Sche
|
||||
{020A7474-3601-4160-A159-D7B70B77B15F} = {020A7474-3601-4160-A159-D7B70B77B15F}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PowerToys.Interop", "src\common\interop\PowerToys.Interop.vcxproj", "{F055103B-F80B-4D0C-BF48-057C55620033}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Workspaces", "Workspaces", "{A2221D7E-55E7-4BEA-90D1-4F162D670BBF}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "workspaces-common", "workspaces-common", "{BE126CBB-AE12-406A-9837-A05ACFCA57A7}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
src\modules\Workspaces\workspaces-common\GuidUtils.h = src\modules\Workspaces\workspaces-common\GuidUtils.h
|
||||
src\modules\Workspaces\workspaces-common\InvokePoint.h = src\modules\Workspaces\workspaces-common\InvokePoint.h
|
||||
src\modules\Workspaces\workspaces-common\MonitorEnumerator.h = src\modules\Workspaces\workspaces-common\MonitorEnumerator.h
|
||||
src\modules\Workspaces\workspaces-common\MonitorUtils.h = src\modules\Workspaces\workspaces-common\MonitorUtils.h
|
||||
src\modules\Workspaces\workspaces-common\VirtualDesktop.h = src\modules\Workspaces\workspaces-common\VirtualDesktop.h
|
||||
src\modules\Workspaces\workspaces-common\WindowEnumerator.h = src\modules\Workspaces\workspaces-common\WindowEnumerator.h
|
||||
src\modules\Workspaces\workspaces-common\WindowFilter.h = src\modules\Workspaces\workspaces-common\WindowFilter.h
|
||||
src\modules\Workspaces\workspaces-common\WindowUtils.h = src\modules\Workspaces\workspaces-common\WindowUtils.h
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "WindowProperties", "WindowProperties", "{14CB58B7-D280-4A7A-95DE-4B2DF14EA000}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
src\modules\Workspaces\WindowProperties\WorkspacesWindowPropertyUtils.h = src\modules\Workspaces\WindowProperties\WorkspacesWindowPropertyUtils.h
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WorkspacesLib", "src\modules\Workspaces\WorkspacesLib\WorkspacesLib.vcxproj", "{B31FCC55-B5A4-4EA7-B414-2DCEAE6AF332}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WorkspacesLauncherUI", "src\modules\Workspaces\WorkspacesLauncherUI\WorkspacesLauncherUI.csproj", "{9C53CC25-0623-4569-95BC-B05410675EE3}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WorkspacesModuleInterface", "src\modules\Workspaces\WorkspacesModuleInterface\WorkspacesModuleInterface.vcxproj", "{45285DF2-9742-4ECA-9AC9-58951FC26489}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WorkspacesSnapshotTool", "src\modules\Workspaces\WorkspacesSnapshotTool\WorkspacesSnapshotTool.vcxproj", "{3D63307B-9D27-44FD-B033-B26F39245B85}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WorkspacesEditor", "src\modules\Workspaces\WorkspacesEditor\WorkspacesEditor.csproj", "{367D7543-7DBA-4381-99F1-BF6142A996C4}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WorkspacesLauncher", "src\modules\Workspaces\WorkspacesLauncher\WorkspacesLauncher.vcxproj", "{2CAC093E-5FCF-4102-9C2C-AC7DD5D9EB96}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|ARM64 = Debug|ARM64
|
||||
@@ -985,6 +954,16 @@ Global
|
||||
{B1BCC8C6-46B5-4BFA-8F22-20F32D99EC6A}.Release|x64.ActiveCfg = Release|x64
|
||||
{B1BCC8C6-46B5-4BFA-8F22-20F32D99EC6A}.Release|x64.Build.0 = Release|x64
|
||||
{B1BCC8C6-46B5-4BFA-8F22-20F32D99EC6A}.Release|x86.ActiveCfg = Release|x64
|
||||
{F055103B-F80B-4D0C-BF48-057C55620033}.Debug|ARM64.ActiveCfg = Debug|ARM64
|
||||
{F055103B-F80B-4D0C-BF48-057C55620033}.Debug|ARM64.Build.0 = Debug|ARM64
|
||||
{F055103B-F80B-4D0C-BF48-057C55620033}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{F055103B-F80B-4D0C-BF48-057C55620033}.Debug|x64.Build.0 = Debug|x64
|
||||
{F055103B-F80B-4D0C-BF48-057C55620033}.Debug|x86.ActiveCfg = Debug|x64
|
||||
{F055103B-F80B-4D0C-BF48-057C55620033}.Release|ARM64.ActiveCfg = Release|ARM64
|
||||
{F055103B-F80B-4D0C-BF48-057C55620033}.Release|ARM64.Build.0 = Release|ARM64
|
||||
{F055103B-F80B-4D0C-BF48-057C55620033}.Release|x64.ActiveCfg = Release|x64
|
||||
{F055103B-F80B-4D0C-BF48-057C55620033}.Release|x64.Build.0 = Release|x64
|
||||
{F055103B-F80B-4D0C-BF48-057C55620033}.Release|x86.ActiveCfg = Release|x64
|
||||
{787B8AA6-CA93-4C84-96FE-DF31110AD1C4}.Debug|ARM64.ActiveCfg = Debug|ARM64
|
||||
{787B8AA6-CA93-4C84-96FE-DF31110AD1C4}.Debug|ARM64.Build.0 = Debug|ARM64
|
||||
{787B8AA6-CA93-4C84-96FE-DF31110AD1C4}.Debug|x64.ActiveCfg = Debug|x64
|
||||
@@ -2621,90 +2600,6 @@ Global
|
||||
{1D6893CB-BC0C-46A8-A76C-9728706CA51A}.Release|x64.Build.0 = Release|x64
|
||||
{1D6893CB-BC0C-46A8-A76C-9728706CA51A}.Release|x86.ActiveCfg = Release|x64
|
||||
{1D6893CB-BC0C-46A8-A76C-9728706CA51A}.Release|x86.Build.0 = Release|x64
|
||||
{F055103B-F80B-4D0C-BF48-057C55620033}.Debug|ARM64.ActiveCfg = Debug|ARM64
|
||||
{F055103B-F80B-4D0C-BF48-057C55620033}.Debug|ARM64.Build.0 = Debug|ARM64
|
||||
{F055103B-F80B-4D0C-BF48-057C55620033}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{F055103B-F80B-4D0C-BF48-057C55620033}.Debug|x64.Build.0 = Debug|x64
|
||||
{F055103B-F80B-4D0C-BF48-057C55620033}.Debug|x86.ActiveCfg = Debug|x64
|
||||
{F055103B-F80B-4D0C-BF48-057C55620033}.Debug|x86.Build.0 = Debug|x64
|
||||
{F055103B-F80B-4D0C-BF48-057C55620033}.Release|ARM64.ActiveCfg = Release|ARM64
|
||||
{F055103B-F80B-4D0C-BF48-057C55620033}.Release|ARM64.Build.0 = Release|ARM64
|
||||
{F055103B-F80B-4D0C-BF48-057C55620033}.Release|x64.ActiveCfg = Release|x64
|
||||
{F055103B-F80B-4D0C-BF48-057C55620033}.Release|x64.Build.0 = Release|x64
|
||||
{F055103B-F80B-4D0C-BF48-057C55620033}.Release|x86.ActiveCfg = Release|x64
|
||||
{F055103B-F80B-4D0C-BF48-057C55620033}.Release|x86.Build.0 = Release|x64
|
||||
{B31FCC55-B5A4-4EA7-B414-2DCEAE6AF332}.Debug|ARM64.ActiveCfg = Debug|ARM64
|
||||
{B31FCC55-B5A4-4EA7-B414-2DCEAE6AF332}.Debug|ARM64.Build.0 = Debug|ARM64
|
||||
{B31FCC55-B5A4-4EA7-B414-2DCEAE6AF332}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{B31FCC55-B5A4-4EA7-B414-2DCEAE6AF332}.Debug|x64.Build.0 = Debug|x64
|
||||
{B31FCC55-B5A4-4EA7-B414-2DCEAE6AF332}.Debug|x86.ActiveCfg = Debug|x64
|
||||
{B31FCC55-B5A4-4EA7-B414-2DCEAE6AF332}.Debug|x86.Build.0 = Debug|x64
|
||||
{B31FCC55-B5A4-4EA7-B414-2DCEAE6AF332}.Release|ARM64.ActiveCfg = Release|ARM64
|
||||
{B31FCC55-B5A4-4EA7-B414-2DCEAE6AF332}.Release|ARM64.Build.0 = Release|ARM64
|
||||
{B31FCC55-B5A4-4EA7-B414-2DCEAE6AF332}.Release|x64.ActiveCfg = Release|x64
|
||||
{B31FCC55-B5A4-4EA7-B414-2DCEAE6AF332}.Release|x64.Build.0 = Release|x64
|
||||
{B31FCC55-B5A4-4EA7-B414-2DCEAE6AF332}.Release|x86.ActiveCfg = Release|x64
|
||||
{B31FCC55-B5A4-4EA7-B414-2DCEAE6AF332}.Release|x86.Build.0 = Release|x64
|
||||
{9C53CC25-0623-4569-95BC-B05410675EE3}.Debug|ARM64.ActiveCfg = Debug|ARM64
|
||||
{9C53CC25-0623-4569-95BC-B05410675EE3}.Debug|ARM64.Build.0 = Debug|ARM64
|
||||
{9C53CC25-0623-4569-95BC-B05410675EE3}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{9C53CC25-0623-4569-95BC-B05410675EE3}.Debug|x64.Build.0 = Debug|x64
|
||||
{9C53CC25-0623-4569-95BC-B05410675EE3}.Debug|x86.ActiveCfg = Debug|x64
|
||||
{9C53CC25-0623-4569-95BC-B05410675EE3}.Debug|x86.Build.0 = Debug|x64
|
||||
{9C53CC25-0623-4569-95BC-B05410675EE3}.Release|ARM64.ActiveCfg = Release|ARM64
|
||||
{9C53CC25-0623-4569-95BC-B05410675EE3}.Release|ARM64.Build.0 = Release|ARM64
|
||||
{9C53CC25-0623-4569-95BC-B05410675EE3}.Release|x64.ActiveCfg = Release|x64
|
||||
{9C53CC25-0623-4569-95BC-B05410675EE3}.Release|x64.Build.0 = Release|x64
|
||||
{9C53CC25-0623-4569-95BC-B05410675EE3}.Release|x86.ActiveCfg = Release|x64
|
||||
{9C53CC25-0623-4569-95BC-B05410675EE3}.Release|x86.Build.0 = Release|x64
|
||||
{45285DF2-9742-4ECA-9AC9-58951FC26489}.Debug|ARM64.ActiveCfg = Debug|ARM64
|
||||
{45285DF2-9742-4ECA-9AC9-58951FC26489}.Debug|ARM64.Build.0 = Debug|ARM64
|
||||
{45285DF2-9742-4ECA-9AC9-58951FC26489}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{45285DF2-9742-4ECA-9AC9-58951FC26489}.Debug|x64.Build.0 = Debug|x64
|
||||
{45285DF2-9742-4ECA-9AC9-58951FC26489}.Debug|x86.ActiveCfg = Debug|x64
|
||||
{45285DF2-9742-4ECA-9AC9-58951FC26489}.Debug|x86.Build.0 = Debug|x64
|
||||
{45285DF2-9742-4ECA-9AC9-58951FC26489}.Release|ARM64.ActiveCfg = Release|ARM64
|
||||
{45285DF2-9742-4ECA-9AC9-58951FC26489}.Release|ARM64.Build.0 = Release|ARM64
|
||||
{45285DF2-9742-4ECA-9AC9-58951FC26489}.Release|x64.ActiveCfg = Release|x64
|
||||
{45285DF2-9742-4ECA-9AC9-58951FC26489}.Release|x64.Build.0 = Release|x64
|
||||
{45285DF2-9742-4ECA-9AC9-58951FC26489}.Release|x86.ActiveCfg = Release|x64
|
||||
{45285DF2-9742-4ECA-9AC9-58951FC26489}.Release|x86.Build.0 = Release|x64
|
||||
{3D63307B-9D27-44FD-B033-B26F39245B85}.Debug|ARM64.ActiveCfg = Debug|ARM64
|
||||
{3D63307B-9D27-44FD-B033-B26F39245B85}.Debug|ARM64.Build.0 = Debug|ARM64
|
||||
{3D63307B-9D27-44FD-B033-B26F39245B85}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{3D63307B-9D27-44FD-B033-B26F39245B85}.Debug|x64.Build.0 = Debug|x64
|
||||
{3D63307B-9D27-44FD-B033-B26F39245B85}.Debug|x86.ActiveCfg = Debug|x64
|
||||
{3D63307B-9D27-44FD-B033-B26F39245B85}.Debug|x86.Build.0 = Debug|x64
|
||||
{3D63307B-9D27-44FD-B033-B26F39245B85}.Release|ARM64.ActiveCfg = Release|ARM64
|
||||
{3D63307B-9D27-44FD-B033-B26F39245B85}.Release|ARM64.Build.0 = Release|ARM64
|
||||
{3D63307B-9D27-44FD-B033-B26F39245B85}.Release|x64.ActiveCfg = Release|x64
|
||||
{3D63307B-9D27-44FD-B033-B26F39245B85}.Release|x64.Build.0 = Release|x64
|
||||
{3D63307B-9D27-44FD-B033-B26F39245B85}.Release|x86.ActiveCfg = Release|x64
|
||||
{3D63307B-9D27-44FD-B033-B26F39245B85}.Release|x86.Build.0 = Release|x64
|
||||
{367D7543-7DBA-4381-99F1-BF6142A996C4}.Debug|ARM64.ActiveCfg = Debug|ARM64
|
||||
{367D7543-7DBA-4381-99F1-BF6142A996C4}.Debug|ARM64.Build.0 = Debug|ARM64
|
||||
{367D7543-7DBA-4381-99F1-BF6142A996C4}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{367D7543-7DBA-4381-99F1-BF6142A996C4}.Debug|x64.Build.0 = Debug|x64
|
||||
{367D7543-7DBA-4381-99F1-BF6142A996C4}.Debug|x86.ActiveCfg = Debug|x64
|
||||
{367D7543-7DBA-4381-99F1-BF6142A996C4}.Debug|x86.Build.0 = Debug|x64
|
||||
{367D7543-7DBA-4381-99F1-BF6142A996C4}.Release|ARM64.ActiveCfg = Release|ARM64
|
||||
{367D7543-7DBA-4381-99F1-BF6142A996C4}.Release|ARM64.Build.0 = Release|ARM64
|
||||
{367D7543-7DBA-4381-99F1-BF6142A996C4}.Release|x64.ActiveCfg = Release|x64
|
||||
{367D7543-7DBA-4381-99F1-BF6142A996C4}.Release|x64.Build.0 = Release|x64
|
||||
{367D7543-7DBA-4381-99F1-BF6142A996C4}.Release|x86.ActiveCfg = Release|x64
|
||||
{367D7543-7DBA-4381-99F1-BF6142A996C4}.Release|x86.Build.0 = Release|x64
|
||||
{2CAC093E-5FCF-4102-9C2C-AC7DD5D9EB96}.Debug|ARM64.ActiveCfg = Debug|ARM64
|
||||
{2CAC093E-5FCF-4102-9C2C-AC7DD5D9EB96}.Debug|ARM64.Build.0 = Debug|ARM64
|
||||
{2CAC093E-5FCF-4102-9C2C-AC7DD5D9EB96}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{2CAC093E-5FCF-4102-9C2C-AC7DD5D9EB96}.Debug|x64.Build.0 = Debug|x64
|
||||
{2CAC093E-5FCF-4102-9C2C-AC7DD5D9EB96}.Debug|x86.ActiveCfg = Debug|x64
|
||||
{2CAC093E-5FCF-4102-9C2C-AC7DD5D9EB96}.Debug|x86.Build.0 = Debug|x64
|
||||
{2CAC093E-5FCF-4102-9C2C-AC7DD5D9EB96}.Release|ARM64.ActiveCfg = Release|ARM64
|
||||
{2CAC093E-5FCF-4102-9C2C-AC7DD5D9EB96}.Release|ARM64.Build.0 = Release|ARM64
|
||||
{2CAC093E-5FCF-4102-9C2C-AC7DD5D9EB96}.Release|x64.ActiveCfg = Release|x64
|
||||
{2CAC093E-5FCF-4102-9C2C-AC7DD5D9EB96}.Release|x64.Build.0 = Release|x64
|
||||
{2CAC093E-5FCF-4102-9C2C-AC7DD5D9EB96}.Release|x86.ActiveCfg = Release|x64
|
||||
{2CAC093E-5FCF-4102-9C2C-AC7DD5D9EB96}.Release|x86.Build.0 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
@@ -2751,6 +2646,7 @@ Global
|
||||
{748417CA-F17E-487F-9411-CAFB6D3F4877} = {2F305555-C296-497E-AC20-5FA1B237996A}
|
||||
{217DF501-135C-4E38-BFC8-99D4821032EA} = {2F305555-C296-497E-AC20-5FA1B237996A}
|
||||
{B1BCC8C6-46B5-4BFA-8F22-20F32D99EC6A} = {C3081D9A-1586-441A-B5F4-ED815B3719C1}
|
||||
{F055103B-F80B-4D0C-BF48-057C55620033} = {5A7818A8-109C-4E1C-850D-1A654E234B0E}
|
||||
{787B8AA6-CA93-4C84-96FE-DF31110AD1C4} = {4AFC9975-2456-4C70-94A4-84073C1CED93}
|
||||
{08C8C05F-0362-41BC-818C-724572DF8B06} = {C140A3EF-6DBF-4084-9D4C-4EB5A99FEE68}
|
||||
{5D00D290-4016-4CFE-9E41-1E7C724509BA} = {1AFB6476-670D-4E80-A464-657E01DFF482}
|
||||
@@ -2920,16 +2816,6 @@ Global
|
||||
{3A9A791E-94A9-49F8-8401-C11CE288D5FB} = {D1D6BC88-09AE-4FB4-AD24-5DED46A791DD}
|
||||
{C0974915-8A1D-4BF0-977B-9587D3807AB7} = {D1D6BC88-09AE-4FB4-AD24-5DED46A791DD}
|
||||
{1D6893CB-BC0C-46A8-A76C-9728706CA51A} = {557C4636-D7E1-4838-A504-7D19B725EE95}
|
||||
{F055103B-F80B-4D0C-BF48-057C55620033} = {5A7818A8-109C-4E1C-850D-1A654E234B0E}
|
||||
{A2221D7E-55E7-4BEA-90D1-4F162D670BBF} = {4574FDD0-F61D-4376-98BF-E5A1262C11EC}
|
||||
{BE126CBB-AE12-406A-9837-A05ACFCA57A7} = {A2221D7E-55E7-4BEA-90D1-4F162D670BBF}
|
||||
{14CB58B7-D280-4A7A-95DE-4B2DF14EA000} = {A2221D7E-55E7-4BEA-90D1-4F162D670BBF}
|
||||
{B31FCC55-B5A4-4EA7-B414-2DCEAE6AF332} = {A2221D7E-55E7-4BEA-90D1-4F162D670BBF}
|
||||
{9C53CC25-0623-4569-95BC-B05410675EE3} = {A2221D7E-55E7-4BEA-90D1-4F162D670BBF}
|
||||
{45285DF2-9742-4ECA-9AC9-58951FC26489} = {A2221D7E-55E7-4BEA-90D1-4F162D670BBF}
|
||||
{3D63307B-9D27-44FD-B033-B26F39245B85} = {A2221D7E-55E7-4BEA-90D1-4F162D670BBF}
|
||||
{367D7543-7DBA-4381-99F1-BF6142A996C4} = {A2221D7E-55E7-4BEA-90D1-4F162D670BBF}
|
||||
{2CAC093E-5FCF-4102-9C2C-AC7DD5D9EB96} = {A2221D7E-55E7-4BEA-90D1-4F162D670BBF}
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {C3A2F9D1-7930-4EF4-A6FC-7EE0A99821D0}
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
- [ ] Microsoft plugin project name pattern: `Microsoft.PowerToys.Run.Plugin.{PluginName}`
|
||||
- [ ] Community plugin project name pattern: `Community.PowerToys.Run.Plugin.{PluginName}`
|
||||
- [ ] The plugin target framework should be `net8.0-windows`
|
||||
- [ ] The project file should import `Version.props` and specify `<Version>$(Version).0</Version>`
|
||||
- [ ] If the plugin uses any 3rd party dependencies the project file should import `DynamicPlugin.props`
|
||||
- [ ] The plugin has to contain a `plugin.json` file of the following format in its root folder:
|
||||
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 24 KiB |
@@ -18,7 +18,6 @@
|
||||
<?define AdvancedPasteProjectName="AdvancedPaste"?>
|
||||
<?define RegistryPreviewProjectName="RegistryPreview"?>
|
||||
<?define PeekProjectName="Peek"?>
|
||||
<?define WorkspacesProjectName="Workspaces"?>
|
||||
|
||||
<?define RepoDir="$(var.ProjectDir)..\..\" ?>
|
||||
<?if $(var.Platform) = x64?>
|
||||
|
||||
@@ -51,8 +51,8 @@
|
||||
<RegistryKey Root="$(var.RegistryScope)" Key="Software\Classes\powertoys\components">
|
||||
<RegistryValue Type="string" Name="DSCModulesReference" Value="" KeyPath="yes"/>
|
||||
</RegistryKey>
|
||||
<File Source="$(var.RepoDir)\src\dsc\Microsoft.PowerToys.Configure\Generated\Microsoft.PowerToys.Configure\$(var.Version).0\Microsoft.PowerToys.Configure.psd1" Id="PTConfReference.psd1" />
|
||||
<File Source="$(var.RepoDir)\src\dsc\Microsoft.PowerToys.Configure\Generated\Microsoft.PowerToys.Configure\$(var.Version).0\Microsoft.PowerToys.Configure.psm1" Id="PTConfReference.psm1" />
|
||||
<File Source="$(var.RepoDir)\src\dsc\Microsoft.PowerToys.Configure\Generated\Microsoft.PowerToys.Configure\$(var.Version)\Microsoft.PowerToys.Configure.psd1" Id="PTConfReference.psd1" />
|
||||
<File Source="$(var.RepoDir)\src\dsc\Microsoft.PowerToys.Configure\Generated\Microsoft.PowerToys.Configure\$(var.Version)\Microsoft.PowerToys.Configure.psm1" Id="PTConfReference.psm1" />
|
||||
</Component>
|
||||
</DirectoryRef>
|
||||
|
||||
@@ -63,11 +63,11 @@
|
||||
<Directory Id="WindowsPowerShellFolder" Name="WindowsPowerShell">
|
||||
<Directory Id="PowerShellModulesFolder" Name="Modules">
|
||||
<Directory Id="PowerToysDscFolder" Name="Microsoft.PowerToys.Configure">
|
||||
<Directory Id="PowerToysDscVerFolder" Name="$(var.Version).0">
|
||||
<Directory Id="PowerToysDscVerFolder" Name="$(var.Version)">
|
||||
<Component Id="PowerToysDSC" Win64="yes" Guid="C52AECA0-DA73-49B8-BB49-31EF6640FF1F">
|
||||
<!-- Don't fail installation because of DSC. Files are marked as not vital. -->
|
||||
<File Vital="no" Source="$(var.RepoDir)\src\dsc\Microsoft.PowerToys.Configure\Generated\Microsoft.PowerToys.Configure\$(var.Version).0\Microsoft.PowerToys.Configure.psd1" Id="PTConf.psd1" />
|
||||
<File Vital="no" Source="$(var.RepoDir)\src\dsc\Microsoft.PowerToys.Configure\Generated\Microsoft.PowerToys.Configure\$(var.Version).0\Microsoft.PowerToys.Configure.psm1" Id="PTConf.psm1" />
|
||||
<File Vital="no" Source="$(var.RepoDir)\src\dsc\Microsoft.PowerToys.Configure\Generated\Microsoft.PowerToys.Configure\$(var.Version)\Microsoft.PowerToys.Configure.psd1" Id="PTConf.psd1" />
|
||||
<File Vital="no" Source="$(var.RepoDir)\src\dsc\Microsoft.PowerToys.Configure\Generated\Microsoft.PowerToys.Configure\$(var.Version)\Microsoft.PowerToys.Configure.psm1" Id="PTConf.psm1" />
|
||||
</Component>
|
||||
</Directory>
|
||||
</Directory>
|
||||
|
||||
@@ -25,9 +25,11 @@
|
||||
<?if $(sys.BUILDARCH) = x64 ?>
|
||||
<File Source="$(var.BinDir)KeyboardManagerEditor\vcruntime140_1_app.dll" />
|
||||
<?endif ?>
|
||||
<File Source="$(var.BinDir)KeyboardManagerEditor\vcruntime140.dll" />
|
||||
<File Source="$(var.BinDir)KeyboardManagerEditor\vcruntime140_1.dll" />
|
||||
<File Source="$(var.BinDir)KeyboardManagerEditor\msvcp140.dll" />
|
||||
<!-- Latest CppWinRT upgrade made Keyboard Manager Editor depend on additional VC Runtime libraries. -->
|
||||
<!-- These are not in the Keyboard Manager Editor build output. So we copy them from the base build directory. -->
|
||||
<File Source="$(var.BinDir)vcruntime140.dll" />
|
||||
<File Source="$(var.BinDir)vcruntime140_1.dll" />
|
||||
<File Source="$(var.BinDir)msvcp140.dll" />
|
||||
</Component>
|
||||
</DirectoryRef>
|
||||
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
DefaultTargets="Build"
|
||||
InitialTargets="EnsureNuGetPackageBuildImports"
|
||||
xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="..\..\src\Version.props" Condition="Exists('..\..\src\Version.props')" />
|
||||
<Import Project="..\wix.props" Condition="Exists('..\wix.props')" />
|
||||
|
||||
<Import Project="..\wix.props"
|
||||
Condition="Exists('..\wix.props')" />
|
||||
<Import Project="..\..\src\Version.props" />
|
||||
<PropertyGroup>
|
||||
<DefineConstants>Version=$(Version)</DefineConstants>
|
||||
<Name>PowerToysBootstrapper</Name>
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" InitialTargets="EnsureNuGetPackageBuildImports"
|
||||
xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="..\..\src\Version.props" Condition="Exists('..\..\src\Version.props')" />
|
||||
<Import Project="..\wix.props" Condition="Exists('..\wix.props')" />
|
||||
|
||||
<Import Project="..\..\src\Version.props" />
|
||||
<PropertyGroup Condition="'$(Platform)' == 'x64'">
|
||||
<DefineConstants>Version=$(Version);MonacoSRCHarvestPath=$(ProjectDir)..\..\x64\$(Configuration)\Assets\Monaco\monacoSRC</DefineConstants>
|
||||
<!-- THIS IS AN INNER LOOP OPTIMIZATION
|
||||
|
||||
@@ -449,15 +449,6 @@
|
||||
</RegistryKey>
|
||||
<File Id="PowerOCR_$(var.IdSafeLanguage)_File" Source="$(var.BinDir)\$(var.Language)\PowerToys.PowerOCR.resources.dll" />
|
||||
</Component>
|
||||
<Component
|
||||
Id="WorkspacesEditor_$(var.IdSafeLanguage)_Component"
|
||||
Directory="Resource$(var.IdSafeLanguage)INSTALLFOLDER"
|
||||
Guid="$(var.CompGUIDPrefix)21">
|
||||
<RegistryKey Root="$(var.RegistryScope)" Key="Software\Classes\powertoys\components">
|
||||
<RegistryValue Type="string" Name="WorkspacesEditor_$(var.IdSafeLanguage)_Component" Value="" KeyPath="yes"/>
|
||||
</RegistryKey>
|
||||
<File Id="WorkspacesEditor_$(var.IdSafeLanguage)_File" Source="$(var.BinDir)\$(var.Language)\PowerToys.WorkspacesEditor.resources.dll" />
|
||||
</Component>
|
||||
<?undef IdSafeLanguage?>
|
||||
<?undef CompGUIDPrefix?>
|
||||
<?endforeach?>
|
||||
|
||||
@@ -38,6 +38,48 @@ const DWORD USERNAME_LEN = UNLEN + 1; // User Name + '\0'
|
||||
static const wchar_t* POWERTOYS_EXE_COMPONENT = L"{A2C66D91-3485-4D00-B04D-91844E6B345B}";
|
||||
static const wchar_t* POWERTOYS_UPGRADE_CODE = L"{42B84BF7-5FBF-473B-9C8B-049DC16F7708}";
|
||||
|
||||
constexpr inline const wchar_t* DataDiagnosticsRegKey = L"Software\\Classes\\PowerToys";
|
||||
constexpr inline const wchar_t* DataDiagnosticsRegValueName = L"AllowDataDiagnostics";
|
||||
|
||||
#define TraceLoggingWriteWrapper(provider, eventName, ...) \
|
||||
if (isDataDiagnosticEnabled()) \
|
||||
{ \
|
||||
TraceLoggingWrite(provider, eventName, __VA_ARGS__); \
|
||||
}
|
||||
|
||||
inline bool isDataDiagnosticEnabled()
|
||||
{
|
||||
HKEY key{};
|
||||
if (RegOpenKeyExW(HKEY_CURRENT_USER,
|
||||
DataDiagnosticsRegKey,
|
||||
0,
|
||||
KEY_READ,
|
||||
&key) != ERROR_SUCCESS)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool isDataDiagnosticsEnabled;
|
||||
DWORD boolSize = static_cast<DWORD>(sizeof(bool));
|
||||
|
||||
if (RegGetValueW(
|
||||
key,
|
||||
DataDiagnosticsRegValueName,
|
||||
nullptr,
|
||||
RRF_RT_REG_QWORD,
|
||||
nullptr,
|
||||
&isDataDiagnosticsEnabled,
|
||||
&boolSize) != ERROR_SUCCESS)
|
||||
{
|
||||
RegCloseKey(key);
|
||||
return false;
|
||||
}
|
||||
RegCloseKey(key);
|
||||
|
||||
return isDataDiagnosticsEnabled;
|
||||
}
|
||||
|
||||
|
||||
HRESULT getInstallFolder(MSIHANDLE hInstall, std::wstring& installationDir)
|
||||
{
|
||||
DWORD len = 0;
|
||||
@@ -357,7 +399,7 @@ UINT __stdcall InstallDSCModuleCA(MSIHANDLE hInstall)
|
||||
ExitOnFailure(hr, "Unable to determine Powershell modules path");
|
||||
}
|
||||
|
||||
const auto modulesPath = baseModulesPath / L"Microsoft.PowerToys.Configure" / (get_product_version(false) + L".0");
|
||||
const auto modulesPath = baseModulesPath / L"Microsoft.PowerToys.Configure" / get_product_version(false);
|
||||
|
||||
std::error_code errorCode;
|
||||
fs::create_directories(modulesPath, errorCode);
|
||||
@@ -411,7 +453,7 @@ UINT __stdcall UninstallDSCModuleCA(MSIHANDLE hInstall)
|
||||
}
|
||||
|
||||
const auto powerToysModulePath = baseModulesPath / L"Microsoft.PowerToys.Configure";
|
||||
const auto versionedModulePath = powerToysModulePath / (get_product_version(false) + L".0");
|
||||
const auto versionedModulePath = powerToysModulePath / get_product_version(false);
|
||||
|
||||
std::error_code errorCode;
|
||||
|
||||
@@ -793,13 +835,15 @@ UINT __stdcall TelemetryLogInstallSuccessCA(MSIHANDLE hInstall)
|
||||
hr = WcaInitialize(hInstall, "TelemetryLogInstallSuccessCA");
|
||||
ExitOnFailure(hr, "Failed to initialize");
|
||||
|
||||
TraceLoggingWrite(
|
||||
TraceLoggingWriteWrapper(
|
||||
g_hProvider,
|
||||
"Install_Success",
|
||||
TraceLoggingWideString(get_product_version().c_str(), "Version"),
|
||||
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
||||
TraceLoggingBoolean(TRUE, "UTCReplace_AppSessionGuid"),
|
||||
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE));
|
||||
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE),
|
||||
TraceLoggingEventTag(MICROSOFT_EVENTTAG_DROP_PII)
|
||||
);
|
||||
|
||||
LExit:
|
||||
er = SUCCEEDED(hr) ? ERROR_SUCCESS : ERROR_INSTALL_FAILURE;
|
||||
@@ -814,13 +858,14 @@ UINT __stdcall TelemetryLogInstallCancelCA(MSIHANDLE hInstall)
|
||||
hr = WcaInitialize(hInstall, "TelemetryLogInstallCancelCA");
|
||||
ExitOnFailure(hr, "Failed to initialize");
|
||||
|
||||
TraceLoggingWrite(
|
||||
TraceLoggingWriteWrapper(
|
||||
g_hProvider,
|
||||
"Install_Cancel",
|
||||
TraceLoggingWideString(get_product_version().c_str(), "Version"),
|
||||
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
||||
TraceLoggingBoolean(TRUE, "UTCReplace_AppSessionGuid"),
|
||||
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE));
|
||||
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE),
|
||||
TraceLoggingEventTag(MICROSOFT_EVENTTAG_DROP_PII));
|
||||
|
||||
LExit:
|
||||
er = SUCCEEDED(hr) ? ERROR_SUCCESS : ERROR_INSTALL_FAILURE;
|
||||
@@ -835,13 +880,14 @@ UINT __stdcall TelemetryLogInstallFailCA(MSIHANDLE hInstall)
|
||||
hr = WcaInitialize(hInstall, "TelemetryLogInstallFailCA");
|
||||
ExitOnFailure(hr, "Failed to initialize");
|
||||
|
||||
TraceLoggingWrite(
|
||||
TraceLoggingWriteWrapper(
|
||||
g_hProvider,
|
||||
"Install_Fail",
|
||||
TraceLoggingWideString(get_product_version().c_str(), "Version"),
|
||||
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
||||
TraceLoggingBoolean(TRUE, "UTCReplace_AppSessionGuid"),
|
||||
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE));
|
||||
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE),
|
||||
TraceLoggingEventTag(MICROSOFT_EVENTTAG_DROP_PII));
|
||||
|
||||
LExit:
|
||||
er = SUCCEEDED(hr) ? ERROR_SUCCESS : ERROR_INSTALL_FAILURE;
|
||||
@@ -856,13 +902,14 @@ UINT __stdcall TelemetryLogUninstallSuccessCA(MSIHANDLE hInstall)
|
||||
hr = WcaInitialize(hInstall, "TelemetryLogUninstallSuccessCA");
|
||||
ExitOnFailure(hr, "Failed to initialize");
|
||||
|
||||
TraceLoggingWrite(
|
||||
TraceLoggingWriteWrapper(
|
||||
g_hProvider,
|
||||
"UnInstall_Success",
|
||||
TraceLoggingWideString(get_product_version().c_str(), "Version"),
|
||||
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
||||
TraceLoggingBoolean(TRUE, "UTCReplace_AppSessionGuid"),
|
||||
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE));
|
||||
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE),
|
||||
TraceLoggingEventTag(MICROSOFT_EVENTTAG_DROP_PII));
|
||||
|
||||
LExit:
|
||||
er = SUCCEEDED(hr) ? ERROR_SUCCESS : ERROR_INSTALL_FAILURE;
|
||||
@@ -877,13 +924,14 @@ UINT __stdcall TelemetryLogUninstallCancelCA(MSIHANDLE hInstall)
|
||||
hr = WcaInitialize(hInstall, "TelemetryLogUninstallCancelCA");
|
||||
ExitOnFailure(hr, "Failed to initialize");
|
||||
|
||||
TraceLoggingWrite(
|
||||
TraceLoggingWriteWrapper(
|
||||
g_hProvider,
|
||||
"UnInstall_Cancel",
|
||||
TraceLoggingWideString(get_product_version().c_str(), "Version"),
|
||||
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
||||
TraceLoggingBoolean(TRUE, "UTCReplace_AppSessionGuid"),
|
||||
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE));
|
||||
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE),
|
||||
TraceLoggingEventTag(MICROSOFT_EVENTTAG_DROP_PII));
|
||||
|
||||
LExit:
|
||||
er = SUCCEEDED(hr) ? ERROR_SUCCESS : ERROR_INSTALL_FAILURE;
|
||||
@@ -898,13 +946,14 @@ UINT __stdcall TelemetryLogUninstallFailCA(MSIHANDLE hInstall)
|
||||
hr = WcaInitialize(hInstall, "TelemetryLogUninstallFailCA");
|
||||
ExitOnFailure(hr, "Failed to initialize");
|
||||
|
||||
TraceLoggingWrite(
|
||||
TraceLoggingWriteWrapper(
|
||||
g_hProvider,
|
||||
"UnInstall_Fail",
|
||||
TraceLoggingWideString(get_product_version().c_str(), "Version"),
|
||||
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
||||
TraceLoggingBoolean(TRUE, "UTCReplace_AppSessionGuid"),
|
||||
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE));
|
||||
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE),
|
||||
TraceLoggingEventTag(MICROSOFT_EVENTTAG_DROP_PII));
|
||||
|
||||
LExit:
|
||||
er = SUCCEEDED(hr) ? ERROR_SUCCESS : ERROR_INSTALL_FAILURE;
|
||||
@@ -919,13 +968,14 @@ UINT __stdcall TelemetryLogRepairCancelCA(MSIHANDLE hInstall)
|
||||
hr = WcaInitialize(hInstall, "TelemetryLogRepairCancelCA");
|
||||
ExitOnFailure(hr, "Failed to initialize");
|
||||
|
||||
TraceLoggingWrite(
|
||||
TraceLoggingWriteWrapper(
|
||||
g_hProvider,
|
||||
"Repair_Cancel",
|
||||
TraceLoggingWideString(get_product_version().c_str(), "Version"),
|
||||
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
||||
TraceLoggingBoolean(TRUE, "UTCReplace_AppSessionGuid"),
|
||||
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE));
|
||||
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE),
|
||||
TraceLoggingEventTag(MICROSOFT_EVENTTAG_DROP_PII));
|
||||
|
||||
LExit:
|
||||
er = SUCCEEDED(hr) ? ERROR_SUCCESS : ERROR_INSTALL_FAILURE;
|
||||
@@ -940,13 +990,14 @@ UINT __stdcall TelemetryLogRepairFailCA(MSIHANDLE hInstall)
|
||||
hr = WcaInitialize(hInstall, "TelemetryLogRepairFailCA");
|
||||
ExitOnFailure(hr, "Failed to initialize");
|
||||
|
||||
TraceLoggingWrite(
|
||||
TraceLoggingWriteWrapper(
|
||||
g_hProvider,
|
||||
"Repair_Fail",
|
||||
TraceLoggingWideString(get_product_version().c_str(), "Version"),
|
||||
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
||||
TraceLoggingBoolean(TRUE, "UTCReplace_AppSessionGuid"),
|
||||
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE));
|
||||
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE),
|
||||
TraceLoggingEventTag(MICROSOFT_EVENTTAG_DROP_PII));
|
||||
|
||||
LExit:
|
||||
er = SUCCEEDED(hr) ? ERROR_SUCCESS : ERROR_INSTALL_FAILURE;
|
||||
@@ -1223,7 +1274,7 @@ UINT __stdcall TerminateProcessesCA(MSIHANDLE hInstall)
|
||||
}
|
||||
processes.resize(bytes / sizeof(processes[0]));
|
||||
|
||||
std::array<std::wstring_view, 36> processesToTerminate = {
|
||||
std::array<std::wstring_view, 32> processesToTerminate = {
|
||||
L"PowerToys.PowerLauncher.exe",
|
||||
L"PowerToys.Settings.exe",
|
||||
L"PowerToys.AdvancedPaste.exe",
|
||||
@@ -1255,10 +1306,6 @@ UINT __stdcall TerminateProcessesCA(MSIHANDLE hInstall)
|
||||
L"PowerToys.MouseWithoutBordersService.exe",
|
||||
L"PowerToys.CropAndLock.exe",
|
||||
L"PowerToys.EnvironmentVariables.exe",
|
||||
L"PowerToys.WorkspacesSnapshotTool.exe",
|
||||
L"PowerToys.WorkspacesLauncher.exe",
|
||||
L"PowerToys.WorkspacesLauncherUI.exe",
|
||||
L"PowerToys.WorkspacesEditor.exe",
|
||||
L"PowerToys.exe",
|
||||
};
|
||||
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Some items may be set in Directory.Build.props in root -->
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0-windows10.0.20348.0</TargetFramework>
|
||||
<TargetPlatformMinVersion>10.0.19041.0</TargetPlatformMinVersion>
|
||||
<SupportedOSPlatformVersion>10.0.19041.0</SupportedOSPlatformVersion>
|
||||
<RuntimeIdentifiers>win-x64;win-arm64</RuntimeIdentifiers>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- Common from the debug / release items -->
|
||||
<PropertyGroup>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<NoWarn></NoWarn>
|
||||
<TreatWarningsAsErrors>True</TreatWarningsAsErrors>
|
||||
<WarningsNotAsErrors>CA1720</WarningsNotAsErrors>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)' == 'Debug'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)' == 'Release'">
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<DefineConstants>RELEASE;TRACE</DefineConstants>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Windows.CsWinRT" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -1,15 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Some items may be set in Directory.Build.props in root -->
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<SelfContained>true</SelfContained>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- SelfContained=true requires RuntimeIdentifier to be set -->
|
||||
<PropertyGroup Condition="'$(Platform)'=='x64'">
|
||||
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Platform)'=='ARM64'">
|
||||
<RuntimeIdentifier>win-arm64</RuntimeIdentifier>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
@@ -1,14 +1,16 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<!-- Look at Directory.Build.props in root for common stuff as well -->
|
||||
<Import Project="..\..\Common.Dotnet.CsWinRT.props" />
|
||||
|
||||
<Import Project="..\..\Version.props" />
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0-windows10.0.20348.0</TargetFramework>
|
||||
<TargetPlatformMinVersion>10.0.19041.0</TargetPlatformMinVersion>
|
||||
<SupportedOSPlatformVersion>10.0.19041.0</SupportedOSPlatformVersion>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<TargetName>PowerToys.AllExperiments</TargetName>
|
||||
<MockDirectory>.\Microsoft.VariantAssignment\</MockDirectory>
|
||||
</PropertyGroup>
|
||||
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\ManagedTelemetry\Telemetry\ManagedTelemetry.csproj" />
|
||||
<ProjectReference Include="..\..\settings-ui\Settings.UI.Library\Settings.UI.Library.csproj" />
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<!-- Look at Directory.Build.props in root for common stuff as well -->
|
||||
<Import Project="..\..\Common.Dotnet.CsWinRT.props" />
|
||||
|
||||
<Import Project="..\..\Version.props" />
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0-windows</TargetFramework>
|
||||
<RuntimeIdentifiers>win-x64;win-arm64</RuntimeIdentifiers>
|
||||
<UseWPF>true</UseWPF>
|
||||
<AssemblyName>PowerToys.Common.UI</AssemblyName>
|
||||
</PropertyGroup>
|
||||
|
||||
@@ -31,7 +31,6 @@ namespace Common.UI
|
||||
EnvironmentVariables,
|
||||
Dashboard,
|
||||
AdvancedPaste,
|
||||
Workspaces,
|
||||
}
|
||||
|
||||
private static string SettingsWindowNameToString(SettingsWindow value)
|
||||
@@ -78,8 +77,6 @@ namespace Common.UI
|
||||
return "Dashboard";
|
||||
case SettingsWindow.AdvancedPaste:
|
||||
return "AdvancedPaste";
|
||||
case SettingsWindow.Workspaces:
|
||||
return "Workspaces";
|
||||
default:
|
||||
{
|
||||
return string.Empty;
|
||||
|
||||
@@ -24,18 +24,15 @@
|
||||
<ItemDefinitionGroup>
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<AdditionalIncludeDirectories>..\..\..\;..\..\common;.\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>..\..\..\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="DisplayUtils.h" />
|
||||
<ClInclude Include="MonitorEnumerator.h" />
|
||||
<ClInclude Include="monitors.h" />
|
||||
<ClInclude Include="dpi_aware.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="DisplayUtils.cpp" />
|
||||
<ClCompile Include="monitors.cpp" />
|
||||
<ClCompile Include="dpi_aware.cpp" />
|
||||
</ItemGroup>
|
||||
|
||||
@@ -1,143 +0,0 @@
|
||||
#include "DisplayUtils.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <cwctype>
|
||||
#include <iterator>
|
||||
|
||||
#include <dpi_aware.h>
|
||||
#include <MonitorEnumerator.h>
|
||||
|
||||
#include <utils/OnThreadExecutor.h>
|
||||
|
||||
namespace DisplayUtils
|
||||
{
|
||||
std::wstring remove_non_digits(const std::wstring& input)
|
||||
{
|
||||
std::wstring result;
|
||||
std::copy_if(input.begin(), input.end(), std::back_inserter(result), [](wchar_t ch) { return std::iswdigit(ch); });
|
||||
return result;
|
||||
}
|
||||
|
||||
std::pair<std::wstring, std::wstring> SplitDisplayDeviceId(const std::wstring& str) noexcept
|
||||
{
|
||||
// format: \\?\DISPLAY#{device id}#{instance id}#{some other id}
|
||||
// example: \\?\DISPLAY#GSM1388#4&125707d6&0&UID8388688#{e6f07b5f-ee97-4a90-b076-33f57bf4eaa7}
|
||||
// output: { GSM1388, 4&125707d6&0&UID8388688 }
|
||||
|
||||
size_t nameStartPos = str.find_first_of('#');
|
||||
size_t uidStartPos = str.find('#', nameStartPos + 1);
|
||||
size_t uidEndPos = str.find('#', uidStartPos + 1);
|
||||
|
||||
if (nameStartPos == std::string::npos || uidStartPos == std::string::npos || uidEndPos == std::string::npos)
|
||||
{
|
||||
return { str, L"" };
|
||||
}
|
||||
|
||||
return { str.substr(nameStartPos + 1, uidStartPos - nameStartPos - 1), str.substr(uidStartPos + 1, uidEndPos - uidStartPos - 1) };
|
||||
}
|
||||
|
||||
std::pair<bool, std::vector<DisplayUtils::DisplayData>> GetDisplays()
|
||||
{
|
||||
bool success = true;
|
||||
std::vector<DisplayUtils::DisplayData> result{};
|
||||
auto allMonitors = MonitorEnumerator::Enumerate();
|
||||
|
||||
OnThreadExecutor dpiUnawareThread;
|
||||
dpiUnawareThread.submit(OnThreadExecutor::task_t{ [&] {
|
||||
SetThreadDpiAwarenessContext(DPI_AWARENESS_CONTEXT_UNAWARE);
|
||||
SetThreadDpiHostingBehavior(DPI_HOSTING_BEHAVIOR_MIXED);
|
||||
} }).wait();
|
||||
|
||||
for (auto& monitorData : allMonitors)
|
||||
{
|
||||
MONITORINFOEX monitorInfo = monitorData.second;
|
||||
MONITORINFOEX dpiUnawareMonitorInfo{};
|
||||
|
||||
dpiUnawareThread.submit(OnThreadExecutor::task_t{ [&] {
|
||||
dpiUnawareMonitorInfo.cbSize = sizeof(dpiUnawareMonitorInfo);
|
||||
if (!GetMonitorInfo(monitorData.first, &dpiUnawareMonitorInfo))
|
||||
{
|
||||
return;
|
||||
}
|
||||
} }).wait();
|
||||
|
||||
UINT dpi = 0;
|
||||
if (DPIAware::GetScreenDPIForMonitor(monitorData.first, dpi) != S_OK)
|
||||
{
|
||||
success = false;
|
||||
break;
|
||||
}
|
||||
|
||||
DisplayUtils::DisplayData data{
|
||||
.monitor = monitorData.first,
|
||||
.dpi = dpi,
|
||||
.monitorRectDpiAware = monitorInfo.rcMonitor,
|
||||
.monitorRectDpiUnaware = dpiUnawareMonitorInfo.rcMonitor,
|
||||
};
|
||||
|
||||
bool foundActiveMonitor = false;
|
||||
DISPLAY_DEVICE displayDevice{ .cb = sizeof(displayDevice) };
|
||||
DWORD displayDeviceIndex = 0;
|
||||
while (EnumDisplayDevicesW(monitorInfo.szDevice, displayDeviceIndex, &displayDevice, EDD_GET_DEVICE_INTERFACE_NAME))
|
||||
{
|
||||
/*
|
||||
* if (WI_IsFlagSet(displayDevice.StateFlags, DISPLAY_DEVICE_ACTIVE) &&
|
||||
WI_IsFlagClear(displayDevice.StateFlags, DISPLAY_DEVICE_MIRRORING_DRIVER))
|
||||
*/
|
||||
if (((displayDevice.StateFlags & DISPLAY_DEVICE_ACTIVE) == DISPLAY_DEVICE_ACTIVE) &&
|
||||
(displayDevice.StateFlags & DISPLAY_DEVICE_MIRRORING_DRIVER) == 0)
|
||||
{
|
||||
// Find display devices associated with the display.
|
||||
foundActiveMonitor = true;
|
||||
break;
|
||||
}
|
||||
|
||||
displayDeviceIndex++;
|
||||
}
|
||||
|
||||
if (foundActiveMonitor)
|
||||
{
|
||||
auto deviceId = SplitDisplayDeviceId(displayDevice.DeviceID);
|
||||
data.id = deviceId.first;
|
||||
data.instanceId = deviceId.second;
|
||||
try
|
||||
{
|
||||
std::wstring numberStr = displayDevice.DeviceName; // \\.\DISPLAY1\Monitor0
|
||||
numberStr = numberStr.substr(0, numberStr.find_last_of('\\')); // \\.\DISPLAY1
|
||||
numberStr = remove_non_digits(numberStr);
|
||||
data.number = std::stoi(numberStr);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
success = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
success = false;
|
||||
|
||||
// Use the display name as a fallback value when no proper device was found.
|
||||
data.id = monitorInfo.szDevice;
|
||||
data.instanceId = L"";
|
||||
|
||||
try
|
||||
{
|
||||
std::wstring numberStr = monitorInfo.szDevice; // \\.\DISPLAY1
|
||||
numberStr = remove_non_digits(numberStr);
|
||||
data.number = std::stoi(numberStr);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
success = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
result.push_back(data);
|
||||
}
|
||||
|
||||
return { success, result };
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <Windows.h>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace DisplayUtils
|
||||
{
|
||||
struct DisplayData
|
||||
{
|
||||
HMONITOR monitor{};
|
||||
std::wstring id;
|
||||
std::wstring instanceId;
|
||||
unsigned int number{};
|
||||
unsigned int dpi{};
|
||||
RECT monitorRectDpiAware{};
|
||||
RECT monitorRectDpiUnaware{};
|
||||
};
|
||||
|
||||
std::pair<bool, std::vector<DisplayData>> GetDisplays();
|
||||
};
|
||||
@@ -1,35 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <functional>
|
||||
#include <vector>
|
||||
#include <Windows.h>
|
||||
|
||||
class MonitorEnumerator
|
||||
{
|
||||
public:
|
||||
static std::vector<std::pair<HMONITOR, MONITORINFOEX>> Enumerate()
|
||||
{
|
||||
MonitorEnumerator inst;
|
||||
EnumDisplayMonitors(NULL, NULL, Callback, reinterpret_cast<LPARAM>(&inst));
|
||||
return inst.m_monitors;
|
||||
}
|
||||
|
||||
private:
|
||||
MonitorEnumerator() = default;
|
||||
~MonitorEnumerator() = default;
|
||||
|
||||
static BOOL CALLBACK Callback(HMONITOR monitor, HDC /*hdc*/, LPRECT /*pRect*/, LPARAM param)
|
||||
{
|
||||
MonitorEnumerator* inst = reinterpret_cast<MonitorEnumerator*>(param);
|
||||
MONITORINFOEX mi;
|
||||
mi.cbSize = sizeof(mi);
|
||||
if (GetMonitorInfo(monitor, &mi))
|
||||
{
|
||||
inst->m_monitors.push_back({monitor, mi});
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
std::vector<std::pair<HMONITOR, MONITORINFOEX>> m_monitors;
|
||||
};
|
||||
@@ -1,9 +1,7 @@
|
||||
#include "dpi_aware.h"
|
||||
|
||||
#include "monitors.h"
|
||||
#include <ShellScalingApi.h>
|
||||
#include <array>
|
||||
#include <cmath>
|
||||
|
||||
namespace DPIAware
|
||||
{
|
||||
@@ -62,24 +60,6 @@ namespace DPIAware
|
||||
}
|
||||
}
|
||||
|
||||
void Convert(HMONITOR monitor_handle, RECT& rect)
|
||||
{
|
||||
if (monitor_handle == NULL)
|
||||
{
|
||||
const POINT ptZero = { 0, 0 };
|
||||
monitor_handle = MonitorFromPoint(ptZero, MONITOR_DEFAULTTOPRIMARY);
|
||||
}
|
||||
|
||||
UINT dpi_x, dpi_y;
|
||||
if (GetDpiForMonitor(monitor_handle, MDT_EFFECTIVE_DPI, &dpi_x, &dpi_y) == S_OK)
|
||||
{
|
||||
rect.left = static_cast<long>(std::round(rect.left * static_cast<float>(dpi_x) / DEFAULT_DPI));
|
||||
rect.right = static_cast<long>(std::round(rect.right * static_cast<float>(dpi_x) / DEFAULT_DPI));
|
||||
rect.top = static_cast<long>(std::round(rect.top * static_cast<float>(dpi_y) / DEFAULT_DPI));
|
||||
rect.bottom = static_cast<long>(std::round(rect.bottom * static_cast<float>(dpi_y) / DEFAULT_DPI));
|
||||
}
|
||||
}
|
||||
|
||||
void ConvertByCursorPosition(float& width, float& height)
|
||||
{
|
||||
HMONITOR targetMonitor = nullptr;
|
||||
|
||||
@@ -12,7 +12,6 @@ namespace DPIAware
|
||||
HRESULT GetScreenDPIForPoint(POINT p, UINT& dpi);
|
||||
HRESULT GetScreenDPIForCursor(UINT& dpi);
|
||||
void Convert(HMONITOR monitor_handle, float& width, float& height);
|
||||
void Convert(HMONITOR monitor_handle, RECT& rect);
|
||||
void ConvertByCursorPosition(float& width, float& height);
|
||||
void InverseConvert(HMONITOR monitor_handle, float& width, float& height);
|
||||
void EnableDPIAwarenessForThisProcess();
|
||||
|
||||
@@ -1,8 +1,13 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<!-- Look at Directory.Build.props in root for common stuff as well -->
|
||||
<Import Project="..\..\Common.Dotnet.CsWinRT.props" />
|
||||
|
||||
<Import Project="..\..\Version.props" />
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0-windows</TargetFramework>
|
||||
<RuntimeIdentifiers>win-x64;win-arm64</RuntimeIdentifiers>
|
||||
<Version>$(Version).0</Version>
|
||||
<Authors>Microsoft Corporation</Authors>
|
||||
<Product>PowerToys</Product>
|
||||
<Description>PowerToys FilePreviewCommon</Description>
|
||||
<AssemblyName>PowerToys.FilePreviewCommon</AssemblyName>
|
||||
<UseWindowsForms>true</UseWindowsForms>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "pch.h"
|
||||
#include "pch.h"
|
||||
#include "GPOWrapper.h"
|
||||
#include "GPOWrapper.g.cpp"
|
||||
|
||||
@@ -176,10 +176,6 @@ namespace winrt::PowerToys::GPOWrapper::implementation
|
||||
{
|
||||
return static_cast<GpoRuleConfigured>(powertoys_gpo::getAllowedAdvancedPasteOnlineAIModelsValue());
|
||||
}
|
||||
GpoRuleConfigured GPOWrapper::GetConfiguredWorkspacesEnabledValue()
|
||||
{
|
||||
return static_cast<GpoRuleConfigured>(powertoys_gpo::getConfiguredWorkspacesEnabledValue());
|
||||
}
|
||||
GpoRuleConfigured GPOWrapper::GetConfiguredMwbClipboardSharingEnabledValue()
|
||||
{
|
||||
return static_cast<GpoRuleConfigured>(powertoys_gpo::getConfiguredMwbClipboardSharingEnabledValue());
|
||||
@@ -216,4 +212,8 @@ namespace winrt::PowerToys::GPOWrapper::implementation
|
||||
// Convert std::wstring to winrt::hstring
|
||||
return to_hstring(rules.c_str());
|
||||
}
|
||||
GpoRuleConfigured GPOWrapper::GetAllowDataDiagnosticsValue()
|
||||
{
|
||||
return static_cast<GpoRuleConfigured>(powertoys_gpo::getAllowDataDiagnosticsValue());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#pragma once
|
||||
#pragma once
|
||||
#include "GPOWrapper.g.h"
|
||||
#include <common/utils/gpo.h>
|
||||
|
||||
@@ -50,7 +50,6 @@ namespace winrt::PowerToys::GPOWrapper::implementation
|
||||
static GpoRuleConfigured GetConfiguredQoiPreviewEnabledValue();
|
||||
static GpoRuleConfigured GetConfiguredQoiThumbnailsEnabledValue();
|
||||
static GpoRuleConfigured GetAllowedAdvancedPasteOnlineAIModelsValue();
|
||||
static GpoRuleConfigured GetConfiguredWorkspacesEnabledValue();
|
||||
static GpoRuleConfigured GetConfiguredMwbClipboardSharingEnabledValue();
|
||||
static GpoRuleConfigured GetConfiguredMwbFileTransferEnabledValue();
|
||||
static GpoRuleConfigured GetConfiguredMwbUseOriginalUserInterfaceValue();
|
||||
@@ -59,6 +58,7 @@ namespace winrt::PowerToys::GPOWrapper::implementation
|
||||
static GpoRuleConfigured GetConfiguredMwbValidateRemoteIpValue();
|
||||
static GpoRuleConfigured GetConfiguredMwbDisableUserDefinedIpMappingRulesValue();
|
||||
static winrt::hstring GPOWrapper::GetConfiguredMwbPolicyDefinedIpMappingRules();
|
||||
static GpoRuleConfigured GetAllowDataDiagnosticsValue();
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -54,7 +54,6 @@ namespace PowerToys
|
||||
static GpoRuleConfigured GetConfiguredQoiPreviewEnabledValue();
|
||||
static GpoRuleConfigured GetConfiguredQoiThumbnailsEnabledValue();
|
||||
static GpoRuleConfigured GetAllowedAdvancedPasteOnlineAIModelsValue();
|
||||
static GpoRuleConfigured GetConfiguredWorkspacesEnabledValue();
|
||||
static GpoRuleConfigured GetConfiguredMwbClipboardSharingEnabledValue();
|
||||
static GpoRuleConfigured GetConfiguredMwbFileTransferEnabledValue();
|
||||
static GpoRuleConfigured GetConfiguredMwbUseOriginalUserInterfaceValue();
|
||||
@@ -63,6 +62,7 @@ namespace PowerToys
|
||||
static GpoRuleConfigured GetConfiguredMwbValidateRemoteIpValue();
|
||||
static GpoRuleConfigured GetConfiguredMwbDisableUserDefinedIpMappingRulesValue();
|
||||
static String GetConfiguredMwbPolicyDefinedIpMappingRules();
|
||||
static GpoRuleConfigured GetAllowDataDiagnosticsValue();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,10 +61,5 @@ namespace PowerToys.GPOWrapperProjection
|
||||
{
|
||||
return (GpoRuleConfigured)PowerToys.GPOWrapper.GPOWrapper.GetRunPluginEnabledValue(pluginID);
|
||||
}
|
||||
|
||||
public static GpoRuleConfigured GetConfiguredWorkspacesEnabledValue()
|
||||
{
|
||||
return (GpoRuleConfigured)PowerToys.GPOWrapper.GPOWrapper.GetConfiguredWorkspacesEnabledValue();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<!-- Look at Directory.Build.props in root for common stuff as well -->
|
||||
<Import Project="..\..\Common.Dotnet.CsWinRT.props" />
|
||||
|
||||
<Import Project="..\..\Version.props" />
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0-windows10.0.20348.0</TargetFramework>
|
||||
<TargetPlatformMinVersion>10.0.19041.0</TargetPlatformMinVersion>
|
||||
<SupportedOSPlatformVersion>10.0.19041.0</SupportedOSPlatformVersion>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<TargetName>PowerToys.GPOWrapperProjection</TargetName>
|
||||
@@ -18,7 +19,12 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\GPOWrapper\GPOWrapper.vcxproj" />
|
||||
<PackageReference Include="Microsoft.Windows.CsWinRT" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\GPOWrapper\GPOWrapper.vcxproj">
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -7,7 +7,7 @@ using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
using System.IO.Abstractions;
|
||||
using System.Reflection;
|
||||
using PowerToys.Interop;
|
||||
using interop;
|
||||
|
||||
namespace ManagedCommon
|
||||
{
|
||||
|
||||
@@ -1,22 +1,23 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<!-- Look at Directory.Build.props in root for common stuff as well -->
|
||||
<Import Project="..\..\Common.Dotnet.CsWinRT.props" />
|
||||
|
||||
<Import Project="..\..\Version.props" />
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0-windows</TargetFramework>
|
||||
<RuntimeIdentifiers>win-x64;win-arm64</RuntimeIdentifiers>
|
||||
<Version>$(Version).0</Version>
|
||||
<Authors>Microsoft Corporation</Authors>
|
||||
<Product>PowerToys</Product>
|
||||
<Description>PowerToys ManagedCommon</Description>
|
||||
<AssemblyName>PowerToys.ManagedCommon</AssemblyName>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- See https://learn.microsoft.com/windows/apps/develop/platform/csharp-winrt/net-projection-from-cppwinrt-component for more info -->
|
||||
<PropertyGroup>
|
||||
<CsWinRTIncludes>PowerToys.Interop</CsWinRTIncludes>
|
||||
<CsWinRTGeneratedFilesDir>$(OutDir)</CsWinRTGeneratedFilesDir>
|
||||
<ErrorOnDuplicatePublishOutputFiles>false</ErrorOnDuplicatePublishOutputFiles>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="System.IO.Abstractions" />
|
||||
<PackageReference Include="System.Management" />
|
||||
<PackageReference Include="System.Net.Http" />
|
||||
<PackageReference Include="System.Text.RegularExpressions" />
|
||||
<PackageReference Include="System.Private.Uri" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -30,6 +30,5 @@ namespace ManagedCommon
|
||||
MeasureTool,
|
||||
ShortcutGuide,
|
||||
PowerOCR,
|
||||
Workspaces,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,12 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<!-- Look at Directory.Build.props in root for common stuff as well -->
|
||||
<Import Project="..\..\..\Common.Dotnet.CsWinRT.props" />
|
||||
|
||||
|
||||
<Import Project="..\..\..\Version.props" />
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0-windows</TargetFramework>
|
||||
<RuntimeIdentifiers>win-x64;win-arm64</RuntimeIdentifiers>
|
||||
<Version>$(Version).0</Version>
|
||||
<Authors>Microsoft Corporation</Authors>
|
||||
<Product>PowerToys</Product>
|
||||
<Description>PowerToys Telemetry</Description>
|
||||
<AssemblyName>PowerToys.ManagedTelemetry</AssemblyName>
|
||||
</PropertyGroup>
|
||||
@@ -10,5 +14,4 @@
|
||||
<ItemGroup>
|
||||
<Compile Include="..\..\Telemetry\TelemetryBase.cs" Link="TelemetryBase.cs" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -2,8 +2,10 @@
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System;
|
||||
using System.Diagnostics.Tracing;
|
||||
using Microsoft.PowerToys.Telemetry.Events;
|
||||
using Microsoft.Win32;
|
||||
|
||||
namespace Microsoft.PowerToys.Telemetry
|
||||
{
|
||||
@@ -12,6 +14,9 @@ namespace Microsoft.PowerToys.Telemetry
|
||||
/// </summary>
|
||||
public class PowerToysTelemetry : TelemetryBase
|
||||
{
|
||||
private static readonly string DataDiagnosticsRegistryKey = @"HKEY_CURRENT_USER\Software\Classes\PowerToys\";
|
||||
private static readonly string DataDiagnosticsRegistryValueName = @"AllowDataDiagnostics";
|
||||
|
||||
/// <summary>
|
||||
/// Name for ETW event.
|
||||
/// </summary>
|
||||
@@ -30,20 +35,42 @@ namespace Microsoft.PowerToys.Telemetry
|
||||
/// </summary>
|
||||
public static PowerToysTelemetry Log { get; } = new PowerToysTelemetry();
|
||||
|
||||
private static bool IsDataDiagnosticsEnabled()
|
||||
{
|
||||
object registryValue = null;
|
||||
try
|
||||
{
|
||||
registryValue = Registry.GetValue(DataDiagnosticsRegistryKey, DataDiagnosticsRegistryValueName, false);
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
|
||||
if (registryValue is not null)
|
||||
{
|
||||
return (int)registryValue == 1 ? true : false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Publishes ETW event when an action is triggered on
|
||||
/// </summary>
|
||||
public void WriteEvent<T>(T telemetryEvent)
|
||||
where T : EventBase, IEvent
|
||||
{
|
||||
this.Write<T>(
|
||||
telemetryEvent.EventName,
|
||||
new EventSourceOptions()
|
||||
{
|
||||
Keywords = ProjectKeywordMeasure,
|
||||
Tags = ProjectTelemetryTagProductAndServicePerformance,
|
||||
},
|
||||
telemetryEvent);
|
||||
if (IsDataDiagnosticsEnabled())
|
||||
{
|
||||
this.Write<T>(
|
||||
telemetryEvent.EventName,
|
||||
new EventSourceOptions()
|
||||
{
|
||||
Keywords = ProjectKeywordMeasure,
|
||||
Tags = ProjectTelemetryTagProductAndServicePerformance,
|
||||
},
|
||||
telemetryEvent);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,8 @@ namespace PTSettingsHelper
|
||||
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";
|
||||
constexpr inline const wchar_t* DataDiagnosticsRegKey = L"Software\\Classes\\PowerToys";
|
||||
constexpr inline const wchar_t* DataDiagnosticsRegValueName = L"AllowDataDiagnostics";
|
||||
|
||||
std::wstring get_root_save_folder_location()
|
||||
{
|
||||
@@ -25,7 +27,7 @@ namespace PTSettingsHelper
|
||||
return result;
|
||||
}
|
||||
|
||||
std::wstring get_local_low_folder_location()
|
||||
std::wstring get_local_low_folder_location()
|
||||
{
|
||||
PWSTR local_app_path;
|
||||
winrt::check_hresult(SHGetKnownFolderPath(FOLDERID_LocalAppDataLow, 0, NULL, &local_app_path));
|
||||
@@ -112,7 +114,7 @@ namespace PTSettingsHelper
|
||||
bool opened = saved_settings->GetNamedBoolean(opened_at_first_launch_json_field_name, false);
|
||||
return opened;
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -124,12 +126,11 @@ namespace PTSettingsHelper
|
||||
json::JsonObject obj;
|
||||
obj.SetNamedValue(opened_at_first_launch_json_field_name, json::value(true));
|
||||
|
||||
json::to_file(oobePath.c_str(), obj);
|
||||
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))
|
||||
@@ -157,4 +158,29 @@ namespace PTSettingsHelper
|
||||
json::to_file(lastVersionRunPath.c_str(), obj);
|
||||
}
|
||||
|
||||
void save_data_diagnostics(bool enabled)
|
||||
{
|
||||
HKEY key{};
|
||||
if (RegCreateKeyExW(HKEY_CURRENT_USER,
|
||||
DataDiagnosticsRegKey,
|
||||
0,
|
||||
nullptr,
|
||||
REG_OPTION_NON_VOLATILE,
|
||||
KEY_ALL_ACCESS,
|
||||
nullptr,
|
||||
&key,
|
||||
nullptr) != ERROR_SUCCESS)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const bool value = enabled;
|
||||
const size_t buf_size = sizeof(bool);
|
||||
if (RegSetValueExW(key, DataDiagnosticsRegValueName, 0, REG_QWORD, reinterpret_cast<const BYTE*>(&value), buf_size) != ERROR_SUCCESS)
|
||||
{
|
||||
RegCloseKey(key);
|
||||
return;
|
||||
}
|
||||
RegCloseKey(key);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,4 +24,6 @@ namespace PTSettingsHelper
|
||||
void save_oobe_opened_state();
|
||||
std::wstring get_last_version_run();
|
||||
void save_last_version_run(const std::wstring& version);
|
||||
|
||||
void save_data_diagnostics(bool enabled);
|
||||
}
|
||||
|
||||
@@ -28,10 +28,15 @@ namespace Microsoft.PowerToys.Telemetry
|
||||
/// </summary>
|
||||
public class TelemetryBase : EventSource
|
||||
{
|
||||
/// <summary>
|
||||
/// The event category DropPii tag.
|
||||
/// </summary>
|
||||
public const EventTags DropPii = (EventTags)0x02000000;
|
||||
|
||||
/// <summary>
|
||||
/// The event tag for this event source.
|
||||
/// </summary>
|
||||
public const EventTags ProjectTelemetryTagProductAndServicePerformance = (EventTags)0x0u;
|
||||
public const EventTags ProjectTelemetryTagProductAndServicePerformance = (EventTags)0x0u | DropPii;
|
||||
|
||||
/// <summary>
|
||||
/// The event keyword for this event source.
|
||||
|
||||
63
src/common/Telemetry/TraceBase.h
Normal file
63
src/common/Telemetry/TraceBase.h
Normal file
@@ -0,0 +1,63 @@
|
||||
#pragma once
|
||||
|
||||
#include "ProjectTelemetry.h"
|
||||
|
||||
#define TraceLoggingWriteWrapper(provider, eventName, ...) \
|
||||
if (IsDataDiagnosticsEnabled()) \
|
||||
{ \
|
||||
TraceLoggingWrite(provider, eventName, __VA_ARGS__); \
|
||||
}
|
||||
|
||||
namespace telemetry
|
||||
{
|
||||
|
||||
constexpr inline const wchar_t* DataDiagnosticsRegKey = L"Software\\Classes\\PowerToys";
|
||||
constexpr inline const wchar_t* DataDiagnosticsRegValueName = L"AllowDataDiagnostics";
|
||||
|
||||
class TraceBase
|
||||
{
|
||||
public:
|
||||
static void RegisterProvider()
|
||||
{
|
||||
TraceLoggingRegister(g_hProvider);
|
||||
}
|
||||
|
||||
static void UnregisterProvider()
|
||||
{
|
||||
TraceLoggingUnregister(g_hProvider);
|
||||
}
|
||||
|
||||
static bool IsDataDiagnosticsEnabled()
|
||||
{
|
||||
HKEY key{};
|
||||
if (RegOpenKeyExW(HKEY_CURRENT_USER,
|
||||
DataDiagnosticsRegKey,
|
||||
0,
|
||||
KEY_READ,
|
||||
&key) != ERROR_SUCCESS)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool isDataDiagnosticsEnabled;
|
||||
DWORD boolSize = static_cast<DWORD>(sizeof(bool));
|
||||
|
||||
if (RegGetValueW(
|
||||
key,
|
||||
DataDiagnosticsRegValueName,
|
||||
nullptr,
|
||||
RRF_RT_REG_QWORD,
|
||||
nullptr,
|
||||
&isDataDiagnosticsEnabled,
|
||||
&boolSize) != ERROR_SUCCESS)
|
||||
{
|
||||
RegCloseKey(key);
|
||||
return false;
|
||||
}
|
||||
RegCloseKey(key);
|
||||
|
||||
return isDataDiagnosticsEnabled;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace telemetry
|
||||
@@ -4,3 +4,4 @@
|
||||
#define ProjectTelemetryPrivacyDataTag(tag) TraceLoggingUInt64((tag), "Ignore")
|
||||
#define ProjectTelemetryTag_ProductAndServicePerformance 0x0u
|
||||
#define PROJECT_KEYWORD_MEASURE 0x0
|
||||
#define MICROSOFT_EVENTTAG_DROP_PII 0x02000000
|
||||
@@ -1,39 +0,0 @@
|
||||
#include "pch.h"
|
||||
#include "CommonManaged.h"
|
||||
#include "CommonManaged.g.cpp"
|
||||
#include <common/version/version.h>
|
||||
#include "../../modules/videoconference/VideoConferenceShared/MicrophoneDevice.h"
|
||||
#include "../../modules/videoconference/VideoConferenceShared/VideoCaptureDeviceList.h"
|
||||
|
||||
namespace winrt::PowerToys::Interop::implementation
|
||||
{
|
||||
hstring CommonManaged::GetProductVersion()
|
||||
{
|
||||
return hstring{ get_product_version() };
|
||||
}
|
||||
winrt::Windows::Foundation::Collections::IVector<hstring> CommonManaged::GetAllActiveMicrophoneDeviceNames()
|
||||
{
|
||||
auto names = std::vector<winrt::hstring>();
|
||||
for (const auto& device : MicrophoneDevice::getAllActive())
|
||||
{
|
||||
names.push_back(device->name().data());
|
||||
}
|
||||
return winrt::multi_threaded_vector(std::move(names));
|
||||
}
|
||||
winrt::Windows::Foundation::Collections::IVector<hstring> CommonManaged::GetAllVideoCaptureDeviceNames()
|
||||
{
|
||||
auto names = std::vector<winrt::hstring>();
|
||||
VideoCaptureDeviceList vcdl;
|
||||
vcdl.EnumerateDevices();
|
||||
|
||||
for (UINT32 i = 0; i < vcdl.Count(); ++i)
|
||||
{
|
||||
auto name = vcdl.GetDeviceName(i).data();
|
||||
if (name != L"PowerToys VideoConference Mute")
|
||||
{
|
||||
names.push_back(name);
|
||||
}
|
||||
}
|
||||
return winrt::multi_threaded_vector(std::move(names));
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
#pragma once
|
||||
#include "CommonManaged.g.h"
|
||||
|
||||
namespace winrt::PowerToys::Interop::implementation
|
||||
{
|
||||
struct CommonManaged : CommonManagedT<CommonManaged>
|
||||
{
|
||||
CommonManaged() = default;
|
||||
|
||||
static hstring GetProductVersion();
|
||||
static winrt::Windows::Foundation::Collections::IVector<hstring> GetAllActiveMicrophoneDeviceNames();
|
||||
static winrt::Windows::Foundation::Collections::IVector<hstring> GetAllVideoCaptureDeviceNames();
|
||||
};
|
||||
}
|
||||
namespace winrt::PowerToys::Interop::factory_implementation
|
||||
{
|
||||
struct CommonManaged : CommonManagedT<CommonManaged, implementation::CommonManaged>
|
||||
{
|
||||
};
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
namespace PowerToys
|
||||
{
|
||||
namespace Interop
|
||||
{
|
||||
[default_interface] static runtimeclass CommonManaged {
|
||||
static String GetProductVersion();
|
||||
static Windows.Foundation.Collections.IVector<String> GetAllActiveMicrophoneDeviceNames();
|
||||
static Windows.Foundation.Collections.IVector<String> GetAllVideoCaptureDeviceNames();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,150 +0,0 @@
|
||||
#include "pch.h"
|
||||
#include "Constants.h"
|
||||
#include "Constants.g.cpp"
|
||||
#include "shared_constants.h"
|
||||
#include <ShlObj.h>
|
||||
|
||||
namespace winrt::PowerToys::Interop::implementation
|
||||
{
|
||||
uint32_t Constants::VK_WIN_BOTH()
|
||||
{
|
||||
return CommonSharedConstants::VK_WIN_BOTH;
|
||||
}
|
||||
hstring Constants::AppDataPath()
|
||||
{
|
||||
PWSTR local_app_path;
|
||||
winrt::check_hresult(SHGetKnownFolderPath(FOLDERID_LocalAppData, 0, NULL, &local_app_path));
|
||||
winrt::hstring result{ local_app_path };
|
||||
CoTaskMemFree(local_app_path);
|
||||
result = result + L"\\" + CommonSharedConstants::APPDATA_PATH;
|
||||
return result;
|
||||
}
|
||||
hstring Constants::PowerLauncherSharedEvent()
|
||||
{
|
||||
return CommonSharedConstants::POWER_LAUNCHER_SHARED_EVENT;
|
||||
}
|
||||
hstring Constants::PowerLauncherCentralizedHookSharedEvent()
|
||||
{
|
||||
return CommonSharedConstants::POWER_LAUNCHER_CENTRALIZED_HOOK_SHARED_EVENT;
|
||||
}
|
||||
hstring Constants::RunSendSettingsTelemetryEvent()
|
||||
{
|
||||
return CommonSharedConstants::RUN_SEND_SETTINGS_TELEMETRY_EVENT;
|
||||
}
|
||||
hstring Constants::RunExitEvent()
|
||||
{
|
||||
return CommonSharedConstants::RUN_EXIT_EVENT;
|
||||
}
|
||||
hstring Constants::FZEExitEvent()
|
||||
{
|
||||
return CommonSharedConstants::FZE_EXIT_EVENT;
|
||||
}
|
||||
hstring Constants::FZEToggleEvent()
|
||||
{
|
||||
return CommonSharedConstants::FANCY_ZONES_EDITOR_TOGGLE_EVENT;
|
||||
}
|
||||
hstring Constants::ColorPickerSendSettingsTelemetryEvent()
|
||||
{
|
||||
return CommonSharedConstants::COLOR_PICKER_SEND_SETTINGS_TELEMETRY_EVENT;
|
||||
}
|
||||
hstring Constants::ShowColorPickerSharedEvent()
|
||||
{
|
||||
return CommonSharedConstants::SHOW_COLOR_PICKER_SHARED_EVENT;
|
||||
}
|
||||
hstring Constants::ShowAdvancedPasteSharedEvent()
|
||||
{
|
||||
return CommonSharedConstants::SHOW_ADVANCED_PASTE_SHARED_EVENT;
|
||||
}
|
||||
hstring Constants::AdvancedPasteMarkdownEvent()
|
||||
{
|
||||
return CommonSharedConstants::ADVANCED_PASTE_MARKDOWN_EVENT;
|
||||
}
|
||||
hstring Constants::AdvancedPasteJsonEvent()
|
||||
{
|
||||
return CommonSharedConstants::ADVANCED_PASTE_JSON_EVENT;
|
||||
}
|
||||
hstring Constants::ShowPowerOCRSharedEvent()
|
||||
{
|
||||
return CommonSharedConstants::SHOW_POWEROCR_SHARED_EVENT;
|
||||
}
|
||||
hstring Constants::MouseJumpShowPreviewEvent()
|
||||
{
|
||||
return CommonSharedConstants::MOUSE_JUMP_SHOW_PREVIEW_EVENT;
|
||||
}
|
||||
hstring Constants::AwakeExitEvent()
|
||||
{
|
||||
return CommonSharedConstants::AWAKE_EXIT_EVENT;
|
||||
}
|
||||
hstring Constants::ShowPeekEvent()
|
||||
{
|
||||
return CommonSharedConstants::SHOW_PEEK_SHARED_EVENT;
|
||||
}
|
||||
hstring Constants::PowerAccentExitEvent()
|
||||
{
|
||||
return CommonSharedConstants::POWERACCENT_EXIT_EVENT;
|
||||
}
|
||||
hstring Constants::ShortcutGuideTriggerEvent()
|
||||
{
|
||||
return CommonSharedConstants::SHORTCUT_GUIDE_TRIGGER_EVENT;
|
||||
}
|
||||
hstring Constants::RegistryPreviewTriggerEvent()
|
||||
{
|
||||
return CommonSharedConstants::REGISTRY_PREVIEW_TRIGGER_EVENT;
|
||||
}
|
||||
hstring Constants::MeasureToolTriggerEvent()
|
||||
{
|
||||
return CommonSharedConstants::MEASURE_TOOL_TRIGGER_EVENT;
|
||||
}
|
||||
hstring Constants::GcodePreviewResizeEvent()
|
||||
{
|
||||
return CommonSharedConstants::GCODE_PREVIEW_RESIZE_EVENT;
|
||||
}
|
||||
hstring Constants::QoiPreviewResizeEvent()
|
||||
{
|
||||
return CommonSharedConstants::QOI_PREVIEW_RESIZE_EVENT;
|
||||
}
|
||||
hstring Constants::DevFilesPreviewResizeEvent()
|
||||
{
|
||||
return CommonSharedConstants::DEV_FILES_PREVIEW_RESIZE_EVENT;
|
||||
}
|
||||
hstring Constants::MarkdownPreviewResizeEvent()
|
||||
{
|
||||
return CommonSharedConstants::MARKDOWN_PREVIEW_RESIZE_EVENT;
|
||||
}
|
||||
hstring Constants::PdfPreviewResizeEvent()
|
||||
{
|
||||
return CommonSharedConstants::PDF_PREVIEW_RESIZE_EVENT;
|
||||
}
|
||||
hstring Constants::SvgPreviewResizeEvent()
|
||||
{
|
||||
return CommonSharedConstants::SVG_PREVIEW_RESIZE_EVENT;
|
||||
}
|
||||
hstring Constants::ShowHostsSharedEvent()
|
||||
{
|
||||
return CommonSharedConstants::SHOW_HOSTS_EVENT;
|
||||
}
|
||||
hstring Constants::ShowHostsAdminSharedEvent()
|
||||
{
|
||||
return CommonSharedConstants::SHOW_HOSTS_ADMIN_EVENT;
|
||||
}
|
||||
hstring Constants::CropAndLockThumbnailEvent()
|
||||
{
|
||||
return CommonSharedConstants::CROP_AND_LOCK_THUMBNAIL_EVENT;
|
||||
}
|
||||
hstring Constants::CropAndLockReparentEvent()
|
||||
{
|
||||
return CommonSharedConstants::CROP_AND_LOCK_REPARENT_EVENT;
|
||||
}
|
||||
hstring Constants::ShowEnvironmentVariablesSharedEvent()
|
||||
{
|
||||
return CommonSharedConstants::SHOW_ENVIRONMENT_VARIABLES_EVENT;
|
||||
}
|
||||
hstring Constants::ShowEnvironmentVariablesAdminSharedEvent()
|
||||
{
|
||||
return CommonSharedConstants::SHOW_ENVIRONMENT_VARIABLES_ADMIN_EVENT;
|
||||
}
|
||||
hstring Constants::WorkspacesLaunchEditorEvent()
|
||||
{
|
||||
return CommonSharedConstants::WORKSPACES_LAUNCH_EDITOR_EVENT;
|
||||
}
|
||||
}
|
||||
@@ -1,51 +0,0 @@
|
||||
#pragma once
|
||||
#include "Constants.g.h"
|
||||
namespace winrt::PowerToys::Interop::implementation
|
||||
{
|
||||
struct Constants : ConstantsT<Constants>
|
||||
{
|
||||
Constants() = default;
|
||||
|
||||
static uint32_t VK_WIN_BOTH();
|
||||
static hstring AppDataPath();
|
||||
static hstring PowerLauncherSharedEvent();
|
||||
static hstring PowerLauncherCentralizedHookSharedEvent();
|
||||
static hstring RunSendSettingsTelemetryEvent();
|
||||
static hstring RunExitEvent();
|
||||
static hstring FZEExitEvent();
|
||||
static hstring FZEToggleEvent();
|
||||
static hstring ColorPickerSendSettingsTelemetryEvent();
|
||||
static hstring ShowColorPickerSharedEvent();
|
||||
static hstring ShowAdvancedPasteSharedEvent();
|
||||
static hstring AdvancedPasteMarkdownEvent();
|
||||
static hstring AdvancedPasteJsonEvent();
|
||||
static hstring ShowPowerOCRSharedEvent();
|
||||
static hstring MouseJumpShowPreviewEvent();
|
||||
static hstring AwakeExitEvent();
|
||||
static hstring ShowPeekEvent();
|
||||
static hstring PowerAccentExitEvent();
|
||||
static hstring ShortcutGuideTriggerEvent();
|
||||
static hstring RegistryPreviewTriggerEvent();
|
||||
static hstring MeasureToolTriggerEvent();
|
||||
static hstring GcodePreviewResizeEvent();
|
||||
static hstring QoiPreviewResizeEvent();
|
||||
static hstring DevFilesPreviewResizeEvent();
|
||||
static hstring MarkdownPreviewResizeEvent();
|
||||
static hstring PdfPreviewResizeEvent();
|
||||
static hstring SvgPreviewResizeEvent();
|
||||
static hstring ShowHostsSharedEvent();
|
||||
static hstring ShowHostsAdminSharedEvent();
|
||||
static hstring CropAndLockThumbnailEvent();
|
||||
static hstring CropAndLockReparentEvent();
|
||||
static hstring ShowEnvironmentVariablesSharedEvent();
|
||||
static hstring ShowEnvironmentVariablesAdminSharedEvent();
|
||||
static hstring WorkspacesLaunchEditorEvent();
|
||||
};
|
||||
}
|
||||
|
||||
namespace winrt::PowerToys::Interop::factory_implementation
|
||||
{
|
||||
struct Constants : ConstantsT<Constants, implementation::Constants>
|
||||
{
|
||||
};
|
||||
}
|
||||
@@ -1,42 +0,0 @@
|
||||
namespace PowerToys
|
||||
{
|
||||
namespace Interop
|
||||
{
|
||||
[default_interface] static runtimeclass Constants {
|
||||
static UInt32 VK_WIN_BOTH {get; };
|
||||
static String AppDataPath();
|
||||
static String PowerLauncherSharedEvent();
|
||||
static String PowerLauncherCentralizedHookSharedEvent();
|
||||
static String RunSendSettingsTelemetryEvent();
|
||||
static String RunExitEvent();
|
||||
static String FZEExitEvent();
|
||||
static String FZEToggleEvent();
|
||||
static String ColorPickerSendSettingsTelemetryEvent();
|
||||
static String ShowColorPickerSharedEvent();
|
||||
static String ShowAdvancedPasteSharedEvent();
|
||||
static String AdvancedPasteMarkdownEvent();
|
||||
static String AdvancedPasteJsonEvent();
|
||||
static String ShowPowerOCRSharedEvent();
|
||||
static String MouseJumpShowPreviewEvent();
|
||||
static String AwakeExitEvent();
|
||||
static String ShowPeekEvent();
|
||||
static String PowerAccentExitEvent();
|
||||
static String ShortcutGuideTriggerEvent();
|
||||
static String RegistryPreviewTriggerEvent();
|
||||
static String MeasureToolTriggerEvent();
|
||||
static String GcodePreviewResizeEvent();
|
||||
static String QoiPreviewResizeEvent();
|
||||
static String DevFilesPreviewResizeEvent();
|
||||
static String MarkdownPreviewResizeEvent();
|
||||
static String PdfPreviewResizeEvent();
|
||||
static String SvgPreviewResizeEvent();
|
||||
static String ShowHostsSharedEvent();
|
||||
static String ShowHostsAdminSharedEvent();
|
||||
static String CropAndLockThumbnailEvent();
|
||||
static String CropAndLockReparentEvent();
|
||||
static String ShowEnvironmentVariablesSharedEvent();
|
||||
static String ShowEnvironmentVariablesAdminSharedEvent();
|
||||
static String WorkspacesLaunchEditorEvent();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,89 +1,94 @@
|
||||
#include "pch.h"
|
||||
#include "HotkeyManager.h"
|
||||
#include "HotkeyManager.g.cpp"
|
||||
|
||||
namespace winrt::PowerToys::Interop::implementation
|
||||
using namespace interop;
|
||||
|
||||
HotkeyManager::HotkeyManager()
|
||||
{
|
||||
HotkeyManager::HotkeyManager()
|
||||
keyboardEventCallback = gcnew KeyboardEventCallback(this, &HotkeyManager::KeyboardEventProc);
|
||||
isActiveCallback = gcnew IsActiveCallback(this, &HotkeyManager::IsActiveProc);
|
||||
filterKeyboardCallback = gcnew FilterKeyboardEvent(this, &HotkeyManager::FilterKeyboardProc);
|
||||
|
||||
keyboardHook = gcnew KeyboardHook(
|
||||
keyboardEventCallback,
|
||||
isActiveCallback,
|
||||
filterKeyboardCallback);
|
||||
hotkeys = gcnew Dictionary<HOTKEY_HANDLE, HotkeyCallback ^>();
|
||||
pressedKeys = gcnew Hotkey();
|
||||
keyboardHook->Start();
|
||||
}
|
||||
|
||||
HotkeyManager::~HotkeyManager()
|
||||
{
|
||||
delete keyboardHook;
|
||||
}
|
||||
|
||||
// When all Shortcut keys are pressed, fire the HotkeyCallback event.
|
||||
void HotkeyManager::KeyboardEventProc(KeyboardEvent ^ /*ev*/)
|
||||
{
|
||||
// pressedKeys always stores the latest keyboard state
|
||||
auto pressedKeysHandle = GetHotkeyHandle(pressedKeys);
|
||||
if (hotkeys->ContainsKey(pressedKeysHandle))
|
||||
{
|
||||
keyboardEventCallback = KeyboardEventCallback{ this, &HotkeyManager::KeyboardEventProc };
|
||||
isActiveCallback = IsActiveCallback{ this, &HotkeyManager::IsActiveProc };
|
||||
filterKeyboardCallback = FilterKeyboardEvent{ this, &HotkeyManager::FilterKeyboardProc };
|
||||
keyboardHook = KeyboardHook{ keyboardEventCallback, isActiveCallback, filterKeyboardCallback };
|
||||
keyboardHook.Start();
|
||||
hotkeys[pressedKeysHandle]->Invoke();
|
||||
|
||||
// After invoking the hotkey send a dummy key to prevent Start Menu from activating
|
||||
INPUT dummyEvent[1] = {};
|
||||
dummyEvent[0].type = INPUT_KEYBOARD;
|
||||
dummyEvent[0].ki.wVk = 0xFF;
|
||||
dummyEvent[0].ki.dwFlags = KEYEVENTF_KEYUP;
|
||||
SendInput(1, dummyEvent, sizeof(INPUT));
|
||||
}
|
||||
}
|
||||
|
||||
// When all Shortcut keys are pressed, fire the HotkeyCallback event.
|
||||
void HotkeyManager::KeyboardEventProc(KeyboardEvent ev)
|
||||
{
|
||||
// pressedKeys always stores the latest keyboard state
|
||||
auto pressedKeysHandle = GetHotkeyHandle(pressedKeys);
|
||||
if (hotkeys.find(pressedKeysHandle) != hotkeys.end())
|
||||
{
|
||||
hotkeys[pressedKeysHandle]();
|
||||
// Hotkeys are intended to be global, therefore they are always active no matter the
|
||||
// context in which the keypress occurs.
|
||||
bool HotkeyManager::IsActiveProc()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// After invoking the hotkey send a dummy key to prevent Start Menu from activating
|
||||
INPUT dummyEvent[1] = {};
|
||||
dummyEvent[0].type = INPUT_KEYBOARD;
|
||||
dummyEvent[0].ki.wVk = 0xFF;
|
||||
dummyEvent[0].ki.dwFlags = KEYEVENTF_KEYUP;
|
||||
SendInput(1, dummyEvent, sizeof(INPUT));
|
||||
}
|
||||
}
|
||||
// KeyboardEvent callback is only fired for relevant key events.
|
||||
bool HotkeyManager::FilterKeyboardProc(KeyboardEvent ^ ev)
|
||||
{
|
||||
// Updating the pressed keys here so we know if the keypress event should be propagated or not.
|
||||
pressedKeys->Win = (GetAsyncKeyState(VK_LWIN) & 0x8000) || (GetAsyncKeyState(VK_RWIN) & 0x8000);
|
||||
pressedKeys->Ctrl = GetAsyncKeyState(VK_CONTROL) & 0x8000;
|
||||
pressedKeys->Alt = GetAsyncKeyState(VK_MENU) & 0x8000;
|
||||
pressedKeys->Shift = GetAsyncKeyState(VK_SHIFT) & 0x8000;
|
||||
pressedKeys->Key = static_cast<unsigned char>(ev->key);
|
||||
|
||||
// Hotkeys are intended to be global, therefore they are always active no matter the
|
||||
// context in which the keypress occurs.
|
||||
bool HotkeyManager::IsActiveProc()
|
||||
// Convert to hotkey handle
|
||||
auto pressedKeysHandle = GetHotkeyHandle(pressedKeys);
|
||||
|
||||
// Check if any hotkey matches the pressed keys if the current key event is a key down event
|
||||
if ((ev->message == WM_KEYDOWN || ev->message == WM_SYSKEYDOWN) && hotkeys->ContainsKey(pressedKeysHandle))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
bool HotkeyManager::FilterKeyboardProc(KeyboardEvent ev)
|
||||
{
|
||||
// Updating the pressed keys here so we know if the keypress event should be propagated or not.
|
||||
pressedKeys.Win = (GetAsyncKeyState(VK_LWIN) & 0x8000) || (GetAsyncKeyState(VK_RWIN) & 0x8000);
|
||||
pressedKeys.Ctrl = GetAsyncKeyState(VK_CONTROL) & 0x8000;
|
||||
pressedKeys.Alt = GetAsyncKeyState(VK_MENU) & 0x8000;
|
||||
pressedKeys.Shift = GetAsyncKeyState(VK_SHIFT) & 0x8000;
|
||||
pressedKeys.Key = static_cast<unsigned char>(ev.key);
|
||||
|
||||
// Convert to hotkey handle
|
||||
auto pressedKeysHandle = GetHotkeyHandle(pressedKeys);
|
||||
|
||||
// Check if any hotkey matches the pressed keys if the current key event is a key down event
|
||||
if ((ev.message == WM_KEYDOWN || ev.message == WM_SYSKEYDOWN) && hotkeys.find(pressedKeysHandle)!=hotkeys.end())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
uint16_t HotkeyManager::RegisterHotkey(winrt::PowerToys::Interop::Hotkey const& _hotkey, winrt::PowerToys::Interop::HotkeyCallback const& _callback)
|
||||
{
|
||||
auto handle = GetHotkeyHandle(_hotkey);
|
||||
hotkeys[handle] = _callback;
|
||||
return handle;
|
||||
}
|
||||
|
||||
void HotkeyManager::UnregisterHotkey(uint16_t _handle)
|
||||
{
|
||||
auto iter = hotkeys.find(_handle);
|
||||
if (iter != hotkeys.end()) {
|
||||
hotkeys.erase(iter);
|
||||
}
|
||||
}
|
||||
|
||||
void HotkeyManager::Close()
|
||||
{
|
||||
}
|
||||
|
||||
uint16_t HotkeyManager::GetHotkeyHandle(Hotkey hotkey)
|
||||
{
|
||||
uint16_t handle = hotkey.Key;
|
||||
handle |= hotkey.Win << 8;
|
||||
handle |= hotkey.Ctrl << 9;
|
||||
handle |= hotkey.Shift << 10;
|
||||
handle |= hotkey.Alt << 11;
|
||||
return handle;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// NOTE: Replaces old hotkey if one already present.
|
||||
HOTKEY_HANDLE HotkeyManager::RegisterHotkey(Hotkey ^ hotkey, HotkeyCallback ^ callback)
|
||||
{
|
||||
auto handle = GetHotkeyHandle(hotkey);
|
||||
hotkeys[handle] = callback;
|
||||
return handle;
|
||||
}
|
||||
|
||||
void HotkeyManager::UnregisterHotkey(HOTKEY_HANDLE handle)
|
||||
{
|
||||
hotkeys->Remove(handle);
|
||||
}
|
||||
|
||||
HOTKEY_HANDLE HotkeyManager::GetHotkeyHandle(Hotkey ^ hotkey)
|
||||
{
|
||||
HOTKEY_HANDLE handle = hotkey->Key;
|
||||
handle |= hotkey->Win << 8;
|
||||
handle |= hotkey->Ctrl << 9;
|
||||
handle |= hotkey->Shift << 10;
|
||||
handle |= hotkey->Alt << 11;
|
||||
return handle;
|
||||
}
|
||||
|
||||
@@ -1,33 +1,54 @@
|
||||
#pragma once
|
||||
#include "HotkeyManager.g.h"
|
||||
#include <Windows.h>
|
||||
#include "KeyboardHook.h"
|
||||
|
||||
namespace winrt::PowerToys::Interop::implementation
|
||||
namespace interop
|
||||
{
|
||||
struct HotkeyManager : HotkeyManagerT<HotkeyManager>
|
||||
public
|
||||
ref struct Hotkey
|
||||
{
|
||||
HotkeyManager();
|
||||
bool Win;
|
||||
bool Ctrl;
|
||||
bool Shift;
|
||||
bool Alt;
|
||||
unsigned char Key;
|
||||
|
||||
uint16_t RegisterHotkey(winrt::PowerToys::Interop::Hotkey const& _hotkey, winrt::PowerToys::Interop::HotkeyCallback const& _callback);
|
||||
void UnregisterHotkey(uint16_t _handle);
|
||||
void Close();
|
||||
Hotkey()
|
||||
{
|
||||
Win = false;
|
||||
Ctrl = false;
|
||||
Shift = false;
|
||||
Alt = false;
|
||||
Key = 0;
|
||||
}
|
||||
};
|
||||
|
||||
public
|
||||
delegate void HotkeyCallback();
|
||||
|
||||
typedef unsigned short HOTKEY_HANDLE;
|
||||
|
||||
public
|
||||
ref class HotkeyManager
|
||||
{
|
||||
public:
|
||||
HotkeyManager();
|
||||
~HotkeyManager();
|
||||
|
||||
HOTKEY_HANDLE RegisterHotkey(Hotkey ^ hotkey, HotkeyCallback ^ callback);
|
||||
void UnregisterHotkey(HOTKEY_HANDLE handle);
|
||||
|
||||
private:
|
||||
KeyboardHook keyboardHook{ nullptr };
|
||||
std::map<uint16_t, HotkeyCallback> hotkeys;
|
||||
Hotkey pressedKeys{ };
|
||||
KeyboardEventCallback keyboardEventCallback;
|
||||
IsActiveCallback isActiveCallback;
|
||||
FilterKeyboardEvent filterKeyboardCallback;
|
||||
KeyboardHook ^ keyboardHook;
|
||||
Dictionary<HOTKEY_HANDLE, HotkeyCallback ^> ^ hotkeys;
|
||||
Hotkey ^ pressedKeys;
|
||||
KeyboardEventCallback ^ keyboardEventCallback;
|
||||
IsActiveCallback ^ isActiveCallback;
|
||||
FilterKeyboardEvent ^ filterKeyboardCallback;
|
||||
|
||||
void KeyboardEventProc(KeyboardEvent ev);
|
||||
void KeyboardEventProc(KeyboardEvent ^ ev);
|
||||
bool IsActiveProc();
|
||||
bool FilterKeyboardProc(KeyboardEvent ev);
|
||||
uint16_t GetHotkeyHandle(Hotkey hotkey);
|
||||
};
|
||||
}
|
||||
namespace winrt::PowerToys::Interop::factory_implementation
|
||||
{
|
||||
struct HotkeyManager : HotkeyManagerT<HotkeyManager, implementation::HotkeyManager>
|
||||
{
|
||||
bool FilterKeyboardProc(KeyboardEvent ^ ev);
|
||||
HOTKEY_HANDLE GetHotkeyHandle(Hotkey ^ hotkey);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
namespace PowerToys
|
||||
{
|
||||
namespace Interop
|
||||
{
|
||||
struct Hotkey
|
||||
{
|
||||
Boolean Win;
|
||||
Boolean Ctrl;
|
||||
Boolean Shift;
|
||||
Boolean Alt;
|
||||
UInt8 Key;
|
||||
};
|
||||
delegate void HotkeyCallback();
|
||||
|
||||
[default_interface] runtimeclass HotkeyManager : Windows.Foundation.IClosable
|
||||
{
|
||||
HotkeyManager();
|
||||
UInt16 RegisterHotkey(Hotkey _hotkey, HotkeyCallback _callback);
|
||||
void UnregisterHotkey(UInt16 _handle);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,99 +1,73 @@
|
||||
#include "pch.h"
|
||||
#include "KeyboardHook.h"
|
||||
#include "KeyboardHook.g.cpp"
|
||||
#include <exception>
|
||||
#include <msclr/marshal.h>
|
||||
#include <msclr/marshal_cppstd.h>
|
||||
#include <common/debug_control.h>
|
||||
#include <common/utils/winapi_error.h>
|
||||
|
||||
namespace winrt::PowerToys::Interop::implementation
|
||||
using namespace interop;
|
||||
using namespace System::Runtime::InteropServices;
|
||||
using namespace System;
|
||||
using namespace System::Diagnostics;
|
||||
|
||||
KeyboardHook::KeyboardHook(
|
||||
KeyboardEventCallback ^ keyboardEventCallback,
|
||||
IsActiveCallback ^ isActiveCallback,
|
||||
FilterKeyboardEvent ^ filterKeyboardEvent)
|
||||
{
|
||||
std::mutex KeyboardHook::instancesMutex;
|
||||
std::unordered_set<KeyboardHook*> KeyboardHook::instances;
|
||||
this->keyboardEventCallback = keyboardEventCallback;
|
||||
this->isActiveCallback = isActiveCallback;
|
||||
this->filterKeyboardEvent = filterKeyboardEvent;
|
||||
}
|
||||
|
||||
KeyboardHook::KeyboardHook(winrt::PowerToys::Interop::KeyboardEventCallback const& keyboardEventCallback, winrt::PowerToys::Interop::IsActiveCallback const& isActiveCallback, winrt::PowerToys::Interop::FilterKeyboardEvent const& filterKeyboardEvent)
|
||||
{
|
||||
this->keyboardEventCallback = keyboardEventCallback;
|
||||
this->isActiveCallback = isActiveCallback;
|
||||
this->filterKeyboardEvent = filterKeyboardEvent;
|
||||
}
|
||||
KeyboardHook::~KeyboardHook()
|
||||
{
|
||||
// Unregister low level hook procedure
|
||||
UnhookWindowsHookEx(hookHandle);
|
||||
}
|
||||
|
||||
void KeyboardHook::Close()
|
||||
{
|
||||
std::unique_lock lock { instancesMutex };
|
||||
auto iter = instances.find(this);
|
||||
if (iter != instances.end())
|
||||
{
|
||||
instances.erase(iter);
|
||||
}
|
||||
if (instances.size() < 1 && hookHandle != nullptr)
|
||||
{
|
||||
if (UnhookWindowsHookEx(hookHandle))
|
||||
{
|
||||
hookHandle = nullptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void KeyboardHook::Start()
|
||||
{
|
||||
void KeyboardHook::Start()
|
||||
{
|
||||
hookProc = gcnew HookProcDelegate(this, &KeyboardHook::HookProc);
|
||||
#if defined(DISABLE_LOWLEVEL_HOOKS_WHEN_DEBUGGED)
|
||||
const bool hookDisabled = IsDebuggerPresent();
|
||||
const bool hookDisabled = IsDebuggerPresent();
|
||||
#else
|
||||
const bool hookDisabled = false;
|
||||
const bool hookDisabled = false;
|
||||
#endif
|
||||
if (!hookDisabled)
|
||||
{
|
||||
std::unique_lock lock { instancesMutex };
|
||||
assert(instances.find(this) == instances.end());
|
||||
// register low level hook procedure
|
||||
instances.insert(this);
|
||||
if (hookHandle == nullptr)
|
||||
{
|
||||
hookHandle = SetWindowsHookEx(
|
||||
WH_KEYBOARD_LL,
|
||||
HookProc,
|
||||
0,
|
||||
0);
|
||||
if (hookHandle == nullptr)
|
||||
{
|
||||
DWORD errorCode = GetLastError();
|
||||
show_last_error_message(L"SetWindowsHookEx", errorCode, L"PowerToys - Interop");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
LRESULT KeyboardHook::HookProc(int nCode, WPARAM wParam, LPARAM lParam)
|
||||
if (!hookDisabled)
|
||||
{
|
||||
if (nCode == HC_ACTION)
|
||||
// register low level hook procedure
|
||||
hookHandle = SetWindowsHookEx(
|
||||
WH_KEYBOARD_LL,
|
||||
(HOOKPROC)(void*)Marshal::GetFunctionPointerForDelegate(hookProc),
|
||||
0,
|
||||
0);
|
||||
if (hookHandle == nullptr)
|
||||
{
|
||||
std::vector<KeyboardHook*> instances_copy;
|
||||
{
|
||||
/* Use a copy of instances, to iterate through the copy without needing to maintain the lock */
|
||||
std::unique_lock lock{ instancesMutex };
|
||||
instances_copy.reserve(instances.size());
|
||||
std::copy(instances.begin(), instances.end(), std::back_inserter(instances_copy));
|
||||
}
|
||||
|
||||
for (auto const& s_instance : instances_copy)
|
||||
{
|
||||
if (s_instance->isActiveCallback())
|
||||
{
|
||||
KeyboardEvent ev;
|
||||
ev.message = wParam;
|
||||
ev.key = reinterpret_cast<KBDLLHOOKSTRUCT*>(lParam)->vkCode;
|
||||
ev.dwExtraInfo = reinterpret_cast<KBDLLHOOKSTRUCT*>(lParam)->dwExtraInfo;
|
||||
|
||||
// Ignore the keyboard hook if the FilterkeyboardEvent returns false.
|
||||
if ((s_instance->filterKeyboardEvent != nullptr && !s_instance->filterKeyboardEvent(ev)))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
s_instance->keyboardEventCallback(ev);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
DWORD errorCode = GetLastError();
|
||||
show_last_error_message(L"SetWindowsHookEx", errorCode, L"PowerToys - Interop");
|
||||
}
|
||||
return CallNextHookEx(NULL, nCode, wParam, lParam);
|
||||
}
|
||||
}
|
||||
|
||||
LRESULT __clrcall KeyboardHook::HookProc(int nCode, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
if (nCode == HC_ACTION && isActiveCallback->Invoke())
|
||||
{
|
||||
KeyboardEvent ^ ev = gcnew KeyboardEvent();
|
||||
ev->message = wParam;
|
||||
ev->key = reinterpret_cast<KBDLLHOOKSTRUCT*>(lParam)->vkCode;
|
||||
ev->dwExtraInfo = reinterpret_cast<KBDLLHOOKSTRUCT*>(lParam)->dwExtraInfo;
|
||||
|
||||
// Ignore the keyboard hook if the FilterkeyboardEvent returns false.
|
||||
if ((filterKeyboardEvent != nullptr && !filterKeyboardEvent->Invoke(ev)))
|
||||
{
|
||||
return CallNextHookEx(hookHandle, nCode, wParam, lParam);
|
||||
}
|
||||
|
||||
keyboardEventCallback->Invoke(ev);
|
||||
return 1;
|
||||
}
|
||||
return CallNextHookEx(hookHandle, nCode, wParam, lParam);
|
||||
}
|
||||
@@ -1,35 +1,48 @@
|
||||
#pragma once
|
||||
#include "KeyboardHook.g.h"
|
||||
#include <mutex>
|
||||
#include <unordered_set>
|
||||
|
||||
namespace winrt::PowerToys::Interop::implementation
|
||||
#include <cinttypes>
|
||||
|
||||
using namespace System::Threading;
|
||||
using namespace System::Collections::Generic;
|
||||
|
||||
namespace interop
|
||||
{
|
||||
struct KeyboardHook : KeyboardHookT<KeyboardHook>
|
||||
public
|
||||
ref struct KeyboardEvent
|
||||
{
|
||||
// KeyboardHook() = default;
|
||||
WPARAM message;
|
||||
int key;
|
||||
uint64_t dwExtraInfo;
|
||||
};
|
||||
|
||||
public
|
||||
delegate void KeyboardEventCallback(KeyboardEvent ^ ev);
|
||||
public
|
||||
delegate bool IsActiveCallback();
|
||||
public
|
||||
delegate bool FilterKeyboardEvent(KeyboardEvent ^ ev);
|
||||
|
||||
public
|
||||
ref class KeyboardHook
|
||||
{
|
||||
public:
|
||||
KeyboardHook(
|
||||
KeyboardEventCallback ^ keyboardEventCallback,
|
||||
IsActiveCallback ^ isActiveCallback,
|
||||
FilterKeyboardEvent ^ filterKeyboardEvent);
|
||||
~KeyboardHook();
|
||||
|
||||
KeyboardHook(winrt::PowerToys::Interop::KeyboardEventCallback const& keyboardEventCallback, winrt::PowerToys::Interop::IsActiveCallback const& isActiveCallback, winrt::PowerToys::Interop::FilterKeyboardEvent const& filterKeyboardEvent);
|
||||
void Start();
|
||||
void Close();
|
||||
|
||||
private:
|
||||
winrt::PowerToys::Interop::KeyboardEventCallback keyboardEventCallback;
|
||||
winrt::PowerToys::Interop::IsActiveCallback isActiveCallback;
|
||||
winrt::PowerToys::Interop::FilterKeyboardEvent filterKeyboardEvent;
|
||||
delegate LRESULT HookProcDelegate(int nCode, WPARAM wParam, LPARAM lParam);
|
||||
KeyboardEventCallback ^ keyboardEventCallback;
|
||||
IsActiveCallback ^ isActiveCallback;
|
||||
FilterKeyboardEvent ^ filterKeyboardEvent;
|
||||
HHOOK hookHandle;
|
||||
HookProcDelegate ^ hookProc;
|
||||
|
||||
// This class used to be C++/CX, which meant it ran on .NET runtime and was able to send function pointer for delegates as hook procedures for SetWindowsHookEx which kept an object reference.
|
||||
// There doesn't seem to be a way to do this outside of the .NET runtime that allows us to get a proper C-style function.
|
||||
// The alternative when porting to C++/winrt is to keep track of every instance and use a single proc instead of one per object. This should also make it lighter.
|
||||
static std::mutex instancesMutex;
|
||||
static std::unordered_set<KeyboardHook*> instances;
|
||||
static inline HHOOK hookHandle = nullptr;
|
||||
static LRESULT CALLBACK HookProc(int nCode, WPARAM wParam, LPARAM lParam);
|
||||
};
|
||||
}
|
||||
namespace winrt::PowerToys::Interop::factory_implementation
|
||||
{
|
||||
struct KeyboardHook : KeyboardHookT<KeyboardHook, implementation::KeyboardHook>
|
||||
{
|
||||
LRESULT __clrcall HookProc(int nCode, WPARAM wParam, LPARAM lParam);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
namespace PowerToys
|
||||
{
|
||||
namespace Interop
|
||||
{
|
||||
struct KeyboardEvent
|
||||
{
|
||||
UInt64 message;
|
||||
Int32 key;
|
||||
UInt64 dwExtraInfo;
|
||||
};
|
||||
|
||||
[version(1.0), uuid(7b820173-a54a-4a38-b810-810e05c14344)] delegate void KeyboardEventCallback(KeyboardEvent ev);
|
||||
[version(1.0), uuid(e3a8bb91-0dfd-4d77-8472-75a47b7af8f8)] delegate Boolean IsActiveCallback();
|
||||
[version(1.0), uuid(94b900ee-d9e8-4630-9064-737eeb9c18ad)] delegate Boolean FilterKeyboardEvent(KeyboardEvent ev);
|
||||
|
||||
[default_interface] runtimeclass KeyboardHook: Windows.Foundation.IClosable {
|
||||
KeyboardHook(KeyboardEventCallback keyboardEventCallback, IsActiveCallback isActiveCallback, FilterKeyboardEvent filterKeyboardEvent);
|
||||
void Start();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
#include "pch.h"
|
||||
#include "LayoutMapManaged.h"
|
||||
#include "LayoutMapManaged.g.cpp"
|
||||
|
||||
namespace winrt::PowerToys::Interop::implementation
|
||||
{
|
||||
hstring LayoutMapManaged::GetKeyName(uint32_t key)
|
||||
{
|
||||
return hstring{ _map->GetKeyName(key) };
|
||||
}
|
||||
uint32_t LayoutMapManaged::GetKeyValue(hstring const& name)
|
||||
{
|
||||
return _map->GetKeyFromName(std::wstring(name));
|
||||
}
|
||||
void LayoutMapManaged::Updatelayout()
|
||||
{
|
||||
_map->UpdateLayout();
|
||||
}
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
#pragma once
|
||||
#include "LayoutMapManaged.g.h"
|
||||
#include "keyboard_layout.h"
|
||||
|
||||
namespace winrt::PowerToys::Interop::implementation
|
||||
{
|
||||
struct LayoutMapManaged : LayoutMapManagedT<LayoutMapManaged>
|
||||
{
|
||||
LayoutMapManaged() = default;
|
||||
|
||||
hstring GetKeyName(uint32_t key);
|
||||
uint32_t GetKeyValue(hstring const& name);
|
||||
void Updatelayout();
|
||||
|
||||
private:
|
||||
std::unique_ptr<LayoutMap> _map = std::make_unique<LayoutMap>();
|
||||
};
|
||||
}
|
||||
namespace winrt::PowerToys::Interop::factory_implementation
|
||||
{
|
||||
struct LayoutMapManaged : LayoutMapManagedT<LayoutMapManaged, implementation::LayoutMapManaged>
|
||||
{
|
||||
};
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
namespace PowerToys
|
||||
{
|
||||
namespace Interop
|
||||
{
|
||||
[default_interface] runtimeclass LayoutMapManaged {
|
||||
LayoutMapManaged();
|
||||
String GetKeyName(UInt32 key);
|
||||
UInt32 GetKeyValue(String name);
|
||||
void Updatelayout();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
EXPORTS
|
||||
DllCanUnloadNow = WINRT_CanUnloadNow PRIVATE
|
||||
DllGetActivationFactory = WINRT_GetActivationFactory PRIVATE
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.props')" />
|
||||
<Import Project="..\..\Version.props" />
|
||||
<PropertyGroup>
|
||||
<AssemblyTitle>PowerToys.Interop</AssemblyTitle>
|
||||
</PropertyGroup>
|
||||
@@ -25,25 +25,16 @@
|
||||
<PropertyGroup Label="Globals">
|
||||
<VCProjectVersion>16.0</VCProjectVersion>
|
||||
<ProjectGuid>{F055103B-F80B-4D0C-BF48-057C55620033}</ProjectGuid>
|
||||
<RootNamespace>PowerToys.Interop</RootNamespace>
|
||||
<TargetFramework>net8.0-windows</TargetFramework>
|
||||
<Keyword>ManagedCProj</Keyword>
|
||||
<RootNamespace>PowerToysInterop</RootNamespace>
|
||||
<ProjectName>PowerToys.Interop</ProjectName>
|
||||
<CppWinRTOptimized>true</CppWinRTOptimized>
|
||||
<CppWinRTRootNamespaceAutoMerge>true</CppWinRTRootNamespaceAutoMerge>
|
||||
<CppWinRTGenerateWindowsMetadata>true</CppWinRTGenerateWindowsMetadata>
|
||||
<MinimalCoreWin>true</MinimalCoreWin>
|
||||
<DefaultLanguage>en-US</DefaultLanguage>
|
||||
<MinimumVisualStudioVersion>14.0</MinimumVisualStudioVersion>
|
||||
<AppContainerApplication>false</AppContainerApplication>
|
||||
<AppxPackage>false</AppxPackage>
|
||||
<ApplicationType>Windows Store</ApplicationType>
|
||||
<ApplicationTypeRevision>10.0</ApplicationTypeRevision>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<CLRSupport>NetCore</CLRSupport>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<GenerateManifest>false</GenerateManifest>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
@@ -64,122 +55,93 @@
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)'=='Debug'">
|
||||
<ClCompile>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)'=='Release'">
|
||||
<ClCompile>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup>
|
||||
<ClCompile>
|
||||
<PrecompiledHeaderOutputFile>$(IntDir)pch.pch</PrecompiledHeaderOutputFile>
|
||||
<PreprocessorDefinitions>_WINRT_DLL;WINRT_LEAN_AND_MEAN;PowerToysInterop;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>PowerToysInterop;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)src\common\interop;../../;../;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalUsingDirectories>$(WindowsSDK_WindowsMetadata);$(AdditionalUsingDirectories)</AdditionalUsingDirectories>
|
||||
<OmitDefaultLibName>false</OmitDefaultLibName>
|
||||
<AdditionalOptions>%(AdditionalOptions) /bigobj /Zc:twoPhase- </AdditionalOptions>
|
||||
<AdditionalOptions>/Zc:twoPhase- </AdditionalOptions>
|
||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>WindowsApp.lib;shell32.lib;advapi32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateWindowsMetadata>false</GenerateWindowsMetadata>
|
||||
<ModuleDefinitionFile>PowerToys.Interop.def</ModuleDefinitionFile>
|
||||
<AdditionalDependencies>WindowsApp.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<AssemblyVersionFiles Include="Generated Files\AssemblyInfo.cpp" />
|
||||
</ItemGroup>
|
||||
<Target Name="GenerateAssemblyInfo" BeforeTargets="PrepareForBuild">
|
||||
<ItemGroup>
|
||||
<HeaderLines Include="#include "../pch.h"" />
|
||||
<HeaderLines Include="using namespace System%3b" />
|
||||
<HeaderLines Include="using namespace System::Reflection%3b" />
|
||||
<HeaderLines Include="using namespace System::Runtime::CompilerServices%3b" />
|
||||
<HeaderLines Include="using namespace System::Runtime::InteropServices%3b" />
|
||||
<HeaderLines Include="using namespace System::Security::Permissions%3b" />
|
||||
<HeaderLines Include="[assembly: AssemblyTitleAttribute(L"$(AssemblyTitle)")]%3b" />
|
||||
<HeaderLines Include="[assembly: AssemblyDescriptionAttribute("")]%3b" />
|
||||
<HeaderLines Include="[assembly: AssemblyConfigurationAttribute("")]%3b" />
|
||||
<HeaderLines Include="[assembly: AssemblyCompanyAttribute("$(AssemblyCompany)")]%3b" />
|
||||
<HeaderLines Include="[assembly: AssemblyCopyrightAttribute("$(AssemblyCopyright)")]%3b" />
|
||||
<HeaderLines Include="[assembly: AssemblyProductAttribute("$(AssemblyTitle)")]%3b" />
|
||||
<HeaderLines Include="[assembly: AssemblyTrademarkAttribute("")]%3b" />
|
||||
<HeaderLines Include="[assembly: AssemblyCultureAttribute("")]%3b" />
|
||||
<HeaderLines Include="[assembly: AssemblyVersionAttribute("$(Version).0")]%3b" />
|
||||
<HeaderLines Include="[assembly: ComVisible(false)]%3b" />
|
||||
<HeaderLines Include="[assembly:CLSCompliantAttribute(true)]%3b" />
|
||||
</ItemGroup>
|
||||
<WriteLinesToFile File="Generated Files\AssemblyInfo.cpp" Lines="@(HeaderLines)" Overwrite="true" Encoding="Unicode" WriteOnlyWhenDifferent="true" />
|
||||
</Target>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\..\modules\videoconference\VideoConferenceShared\MicrophoneDevice.h" />
|
||||
<ClInclude Include="..\..\modules\videoconference\VideoConferenceShared\VideoCaptureDeviceList.h" />
|
||||
<ClInclude Include="async_message_queue.h" />
|
||||
<ClInclude Include="CommonManaged.h">
|
||||
<DependentUpon>CommonManaged.idl</DependentUpon>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Constants.h">
|
||||
<DependentUpon>KeyboardListener.idl</DependentUpon>
|
||||
</ClInclude>
|
||||
<ClInclude Include="HotkeyManager.h">
|
||||
<DependentUpon>HotkeyManager.idl</DependentUpon>
|
||||
</ClInclude>
|
||||
<ClInclude Include="KeyboardHook.h">
|
||||
<DependentUpon>KeyboardHook.idl</DependentUpon>
|
||||
</ClInclude>
|
||||
<ClInclude Include="keyboard_layout.h" />
|
||||
<ClInclude Include="keyboard_layout_impl.h" />
|
||||
<ClInclude Include="LayoutMapManaged.h">
|
||||
<DependentUpon>LayoutMapManaged.idl</DependentUpon>
|
||||
</ClInclude>
|
||||
<ClInclude Include="HotkeyManager.h" />
|
||||
<ClInclude Include="KeyboardHook.h" />
|
||||
<ClInclude Include="pch.h" />
|
||||
<ClInclude Include="resource.h" />
|
||||
<ClInclude Include="shared_constants.h" />
|
||||
<ClInclude Include="TwoWayPipeMessageIPCManaged.h">
|
||||
<DependentUpon>TwoWayPipeMessageIPCManaged.idl</DependentUpon>
|
||||
</ClInclude>
|
||||
<ClInclude Include="two_way_pipe_message_ipc.h" />
|
||||
<ClInclude Include="two_way_pipe_message_ipc_impl.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\modules\videoconference\VideoConferenceShared\MicrophoneDevice.cpp" />
|
||||
<ClCompile Include="..\..\modules\videoconference\VideoConferenceShared\VideoCaptureDeviceList.cpp" />
|
||||
<ClCompile Include="CommonManaged.cpp">
|
||||
<DependentUpon>CommonManaged.idl</DependentUpon>
|
||||
<ClCompile Include="..\..\modules\videoconference\VideoConferenceShared\MicrophoneDevice.cpp">
|
||||
<CompileAsManaged>false</CompileAsManaged>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Constants.cpp">
|
||||
<DependentUpon>KeyboardListener.idl</DependentUpon>
|
||||
<ClCompile Include="..\..\modules\videoconference\VideoConferenceShared\VideoCaptureDeviceList.cpp">
|
||||
<CompileAsManaged>false</CompileAsManaged>
|
||||
</ClCompile>
|
||||
<ClCompile Include="HotkeyManager.cpp">
|
||||
<DependentUpon>HotkeyManager.idl</DependentUpon>
|
||||
<ClCompile Include="Generated Files\AssemblyInfo.cpp" />
|
||||
<ClCompile Include="HotkeyManager.cpp" />
|
||||
<ClCompile Include="interop.cpp" />
|
||||
<ClCompile Include="KeyboardHook.cpp" />
|
||||
<ClCompile Include="keyboard_layout.cpp">
|
||||
<CompileAsManaged>false</CompileAsManaged>
|
||||
</ClCompile>
|
||||
<ClCompile Include="KeyboardHook.cpp">
|
||||
<DependentUpon>KeyboardHook.idl</DependentUpon>
|
||||
<ClCompile Include="two_way_pipe_message_ipc.cpp">
|
||||
<CompileAsManaged>false</CompileAsManaged>
|
||||
</ClCompile>
|
||||
<ClCompile Include="keyboard_layout.cpp" />
|
||||
<ClCompile Include="LayoutMapManaged.cpp">
|
||||
<DependentUpon>LayoutMapManaged.idl</DependentUpon>
|
||||
</ClCompile>
|
||||
<ClCompile Include="pch.cpp">
|
||||
<PrecompiledHeader>Create</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="TwoWayPipeMessageIPCManaged.cpp">
|
||||
<DependentUpon>TwoWayPipeMessageIPCManaged.idl</DependentUpon>
|
||||
</ClCompile>
|
||||
<ClCompile Include="two_way_pipe_message_ipc.cpp" />
|
||||
<ClCompile Include="$(GeneratedFilesDir)module.g.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="interop.rc" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
<None Include="PowerToys.Interop.def" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="PropertySheet.props" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Midl Include="CommonManaged.idl" />
|
||||
<Midl Include="Constants.idl" />
|
||||
<Midl Include="HotkeyManager.idl" />
|
||||
<Midl Include="KeyboardHook.idl" />
|
||||
<Midl Include="LayoutMapManaged.idl" />
|
||||
<Midl Include="TwoWayPipeMessageIPCManaged.idl" />
|
||||
</ItemGroup>
|
||||
<ImportGroup Label="ExtensionTargets" />
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
<Import Project="..\..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.231216.1\build\native\Microsoft.Windows.ImplementationLibrary.targets" Condition="Exists('..\..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.231216.1\build\native\Microsoft.Windows.ImplementationLibrary.targets')" />
|
||||
<Import Project="..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\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.ImplementationLibrary.1.0.231216.1\build\native\Microsoft.Windows.ImplementationLibrary.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.231216.1\build\native\Microsoft.Windows.ImplementationLibrary.targets'))" />
|
||||
<Error Condition="!Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.props'))" />
|
||||
<Error Condition="!Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.targets'))" />
|
||||
</Target>
|
||||
</Project>
|
||||
@@ -18,6 +18,12 @@
|
||||
<ClInclude Include="pch.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="KeyboardHook.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="HotkeyManager.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="resource.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
@@ -30,38 +36,23 @@
|
||||
<ClInclude Include="shared_constants.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Constants.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="keyboard_layout.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="keyboard_layout_impl.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="LayoutMapManaged.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="CommonManaged.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="two_way_pipe_message_ipc.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="two_way_pipe_message_ipc_impl.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="async_message_queue.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="HotkeyManager.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Constants.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="interop.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Generated Files\AssemblyInfo.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="KeyboardHook.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="HotkeyManager.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="two_way_pipe_message_ipc.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="keyboard_layout.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
@@ -71,64 +62,16 @@
|
||||
<ClCompile Include="..\..\modules\videoconference\VideoConferenceShared\VideoCaptureDeviceList.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="pch.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Constants.cpp">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="LayoutMapManaged.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="CommonManaged.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="two_way_pipe_message_ipc.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="$(GeneratedFilesDir)module.g.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="HotkeyManager.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Constants.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="interop.rc">
|
||||
<Filter>Resource Files</Filter>
|
||||
</ResourceCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
<None Include="PowerToys.Interop.def">
|
||||
<Filter>Source Files</Filter>
|
||||
</None>
|
||||
<None Include="PropertySheet.props" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Midl Include="HotkeyManager.idl">
|
||||
<Filter>Source Files</Filter>
|
||||
</Midl>
|
||||
<Midl Include="Constants.idl">
|
||||
<Filter>Source Files</Filter>
|
||||
</Midl>
|
||||
<Midl Include="LayoutMapManaged.idl">
|
||||
<Filter>Source Files</Filter>
|
||||
</Midl>
|
||||
<Midl Include="CommonManaged.idl">
|
||||
<Filter>Source Files</Filter>
|
||||
</Midl>
|
||||
<Midl Include="KeyboardHook.idl">
|
||||
<Filter>Source Files</Filter>
|
||||
</Midl>
|
||||
<Midl Include="TwoWayPipeMessageIPCManaged.idl">
|
||||
<Filter>Source Files</Filter>
|
||||
</Midl>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Natvis Include="$(MSBuildThisFileDirectory)..\..\natvis\wil.natvis" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -1,16 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ImportGroup Label="PropertySheets" />
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<!--
|
||||
To customize common C++/WinRT project properties:
|
||||
* right-click the project node
|
||||
* expand the Common Properties item
|
||||
* select the C++/WinRT property page
|
||||
|
||||
For more advanced scenarios, and complete documentation, please see:
|
||||
https://github.com/Microsoft/cppwinrt/tree/master/nuget
|
||||
-->
|
||||
<PropertyGroup />
|
||||
<ItemDefinitionGroup />
|
||||
</Project>
|
||||
@@ -1,37 +0,0 @@
|
||||
#include "pch.h"
|
||||
#include "TwoWayPipeMessageIPCManaged.h"
|
||||
#include "TwoWayPipeMessageIPCManaged.g.cpp"
|
||||
#include "two_way_pipe_message_ipc_impl.h"
|
||||
#include <functional>
|
||||
|
||||
namespace winrt::PowerToys::Interop::implementation
|
||||
{
|
||||
TwoWayPipeMessageIPCManaged::TwoWayPipeMessageIPCManaged(hstring const& inputPipeName, hstring const& outputPipeName, winrt::PowerToys::Interop::TwoWayPipeIPCReadCallback const& _callback)
|
||||
{
|
||||
this->_callback = _callback;
|
||||
if (_callback != nullptr)
|
||||
{
|
||||
_internalReadCallback = [this](const std::wstring& msg) {
|
||||
this->_callback(msg);
|
||||
};
|
||||
}
|
||||
_pipe = new TwoWayPipeMessageIPC(std::wstring{ inputPipeName }, std::wstring{ outputPipeName }, _internalReadCallback);
|
||||
}
|
||||
|
||||
void TwoWayPipeMessageIPCManaged::Send(hstring const& msg)
|
||||
{
|
||||
_pipe->send(std::wstring{ msg });
|
||||
}
|
||||
void TwoWayPipeMessageIPCManaged::Start()
|
||||
{
|
||||
_pipe->start(nullptr);
|
||||
}
|
||||
void TwoWayPipeMessageIPCManaged::End()
|
||||
{
|
||||
_pipe->end();
|
||||
}
|
||||
void TwoWayPipeMessageIPCManaged::Close()
|
||||
{
|
||||
delete _pipe;
|
||||
}
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
#pragma once
|
||||
#include "TwoWayPipeMessageIPCManaged.g.h"
|
||||
#include "two_way_pipe_message_ipc.h"
|
||||
|
||||
namespace winrt::PowerToys::Interop::implementation
|
||||
{
|
||||
struct TwoWayPipeMessageIPCManaged : TwoWayPipeMessageIPCManagedT<TwoWayPipeMessageIPCManaged>
|
||||
{
|
||||
TwoWayPipeMessageIPCManaged() = default;
|
||||
|
||||
TwoWayPipeMessageIPCManaged(hstring const& inputPipeName, hstring const& outputPipeName, winrt::PowerToys::Interop::TwoWayPipeIPCReadCallback const& _callback);
|
||||
void Send(hstring const& msg);
|
||||
void Start();
|
||||
void End();
|
||||
void Close();
|
||||
|
||||
private:
|
||||
TwoWayPipeMessageIPC* _pipe;
|
||||
TwoWayPipeIPCReadCallback _callback;
|
||||
std::function<void(const std::wstring& msg)> _internalReadCallback;
|
||||
};
|
||||
}
|
||||
namespace winrt::PowerToys::Interop::factory_implementation
|
||||
{
|
||||
struct TwoWayPipeMessageIPCManaged : TwoWayPipeMessageIPCManagedT<TwoWayPipeMessageIPCManaged, implementation::TwoWayPipeMessageIPCManaged>
|
||||
{
|
||||
};
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
namespace PowerToys
|
||||
{
|
||||
namespace Interop
|
||||
{
|
||||
delegate void TwoWayPipeIPCReadCallback(String message);
|
||||
[default_interface] runtimeclass TwoWayPipeMessageIPCManaged : Windows.Foundation.IClosable
|
||||
{
|
||||
TwoWayPipeMessageIPCManaged(String inputPipeName, String outputPipeName, TwoWayPipeIPCReadCallback _callback);
|
||||
void Send(String msg);
|
||||
void Start();
|
||||
void End();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,8 +4,8 @@
|
||||
|
||||
using System;
|
||||
using System.Threading;
|
||||
using interop;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using PowerToys.Interop;
|
||||
|
||||
namespace Microsoft.Interop.Tests
|
||||
{
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<!-- Look at Directory.Build.props in root for common stuff as well -->
|
||||
<Import Project="..\..\..\Common.Dotnet.CsWinRT.props" />
|
||||
<Import Project="..\..\..\Version.props" />
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0-windows</TargetFramework>
|
||||
<IsPackable>false</IsPackable>
|
||||
|
||||
<RuntimeIdentifiers>win-x64;win-arm64</RuntimeIdentifiers>
|
||||
<OutputType>Library</OutputType>
|
||||
<RootNamespace>Microsoft.Interop.Tests</RootNamespace>
|
||||
<AssemblyName>Microsoft.Interop.Tests</AssemblyName>
|
||||
@@ -12,11 +14,36 @@
|
||||
<AssemblyTitle>interop-tests</AssemblyTitle>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- See https://learn.microsoft.com/windows/apps/develop/platform/csharp-winrt/net-projection-from-cppwinrt-component for more info -->
|
||||
<PropertyGroup>
|
||||
<CsWinRTIncludes>PowerToys.Interop</CsWinRTIncludes>
|
||||
<CsWinRTGeneratedFilesDir>$(OutDir)</CsWinRTGeneratedFilesDir>
|
||||
<ErrorOnDuplicatePublishOutputFiles>false</ErrorOnDuplicatePublishOutputFiles>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>bin\$(Platform)\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<DebugType>full</DebugType>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
|
||||
<OutputPath>bin\$(Platform)\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|ARM64'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>bin\$(Platform)\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<DebugType>full</DebugType>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|ARM64'">
|
||||
<OutputPath>bin\$(Platform)\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
@@ -26,4 +53,6 @@
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\PowerToys.Interop.vcxproj" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
</Project>
|
||||
|
||||
299
src/common/interop/interop.cpp
Normal file
299
src/common/interop/interop.cpp
Normal file
@@ -0,0 +1,299 @@
|
||||
#include "pch.h"
|
||||
|
||||
#include <msclr/marshal.h>
|
||||
#include <msclr/marshal_cppstd.h>
|
||||
#include <functional>
|
||||
#include "keyboard_layout.h"
|
||||
#include "two_way_pipe_message_ipc.h"
|
||||
#include "shared_constants.h"
|
||||
|
||||
// We cannot use C++/WinRT APIs when compiled with /clr (we'll get a runtime crash). os-detect API is used
|
||||
// in both native C++ and C++/CX.
|
||||
// We also cannot compile it as a library, since we use different cppruntime linkage in C++/CX and native C++.
|
||||
// Therefore the simplest way is to compile these functions as native using the pragmas below.
|
||||
#pragma managed(push, off)
|
||||
#include "../utils/os-detect.h"
|
||||
// TODO: move to a separate library in common
|
||||
#include "../../modules/videoconference/VideoConferenceShared/MicrophoneDevice.h"
|
||||
#include "../../modules/videoconference/VideoConferenceShared/VideoCaptureDeviceList.h"
|
||||
#pragma managed(pop)
|
||||
|
||||
#include <common/version/version.h>
|
||||
|
||||
using namespace System;
|
||||
using namespace System::Runtime::InteropServices;
|
||||
using System::Collections::Generic::List;
|
||||
|
||||
// https://learn.microsoft.com/cpp/dotnet/how-to-wrap-native-class-for-use-by-csharp?view=vs-2019
|
||||
namespace interop
|
||||
{
|
||||
public
|
||||
ref class LayoutMapManaged
|
||||
{
|
||||
public:
|
||||
LayoutMapManaged() :
|
||||
_map(new LayoutMap) {}
|
||||
|
||||
~LayoutMapManaged()
|
||||
{
|
||||
delete _map;
|
||||
}
|
||||
|
||||
String ^ GetKeyName(DWORD key)
|
||||
{
|
||||
return gcnew String(_map->GetKeyName(key).c_str());
|
||||
}
|
||||
|
||||
DWORD GetKeyValue(String ^ name)
|
||||
{
|
||||
return _map->GetKeyFromName(msclr::interop::marshal_as<std::wstring>(name));
|
||||
}
|
||||
|
||||
void Updatelayout()
|
||||
{
|
||||
_map->UpdateLayout();
|
||||
}
|
||||
|
||||
protected:
|
||||
!LayoutMapManaged()
|
||||
{
|
||||
delete _map;
|
||||
}
|
||||
|
||||
private:
|
||||
LayoutMap* _map;
|
||||
};
|
||||
|
||||
public
|
||||
ref class TwoWayPipeMessageIPCManaged
|
||||
{
|
||||
public:
|
||||
delegate void ReadCallback(String ^ message);
|
||||
|
||||
TwoWayPipeMessageIPCManaged(String ^ inputPipeName, String ^ outputPipeName, ReadCallback ^ callback)
|
||||
{
|
||||
_wrapperCallback = gcnew InternalReadCallback(this, &TwoWayPipeMessageIPCManaged::ReadCallbackHelper);
|
||||
_callback = callback;
|
||||
|
||||
TwoWayPipeMessageIPC::callback_function cb = nullptr;
|
||||
if (callback != nullptr)
|
||||
{
|
||||
cb = (TwoWayPipeMessageIPC::callback_function)(void*)Marshal::GetFunctionPointerForDelegate(_wrapperCallback);
|
||||
}
|
||||
_pipe = new TwoWayPipeMessageIPC(
|
||||
msclr::interop::marshal_as<std::wstring>(inputPipeName),
|
||||
msclr::interop::marshal_as<std::wstring>(outputPipeName),
|
||||
cb);
|
||||
}
|
||||
|
||||
~TwoWayPipeMessageIPCManaged()
|
||||
{
|
||||
delete _pipe;
|
||||
}
|
||||
|
||||
void Send(String ^ msg)
|
||||
{
|
||||
_pipe->send(msclr::interop::marshal_as<std::wstring>(msg));
|
||||
}
|
||||
|
||||
void Start()
|
||||
{
|
||||
_pipe->start(nullptr);
|
||||
}
|
||||
|
||||
void End()
|
||||
{
|
||||
_pipe->end();
|
||||
}
|
||||
|
||||
protected:
|
||||
!TwoWayPipeMessageIPCManaged()
|
||||
{
|
||||
delete _pipe;
|
||||
}
|
||||
|
||||
private:
|
||||
delegate void InternalReadCallback(const std::wstring& msg);
|
||||
|
||||
TwoWayPipeMessageIPC* _pipe;
|
||||
ReadCallback ^ _callback;
|
||||
InternalReadCallback ^ _wrapperCallback;
|
||||
|
||||
void ReadCallbackHelper(const std::wstring& msg)
|
||||
{
|
||||
_callback(gcnew String(msg.c_str()));
|
||||
}
|
||||
};
|
||||
|
||||
public
|
||||
ref class CommonManaged
|
||||
{
|
||||
public:
|
||||
static String ^ GetProductVersion() {
|
||||
return gcnew String(get_product_version().c_str());
|
||||
}
|
||||
|
||||
static List<String ^> ^ GetAllActiveMicrophoneDeviceNames() {
|
||||
auto names = gcnew List<String ^>();
|
||||
for (const auto& device : MicrophoneDevice::getAllActive())
|
||||
{
|
||||
names->Add(gcnew String(device->name().data()));
|
||||
}
|
||||
return names;
|
||||
}
|
||||
|
||||
static List<String ^> ^
|
||||
GetAllVideoCaptureDeviceNames() {
|
||||
auto names = gcnew List<String ^>();
|
||||
VideoCaptureDeviceList vcdl;
|
||||
vcdl.EnumerateDevices();
|
||||
|
||||
for (UINT32 i = 0; i < vcdl.Count(); ++i)
|
||||
{
|
||||
auto name = gcnew String(vcdl.GetDeviceName(i).data());
|
||||
if (name != L"PowerToys VideoConference Mute")
|
||||
{
|
||||
names->Add(name);
|
||||
}
|
||||
}
|
||||
return names;
|
||||
}
|
||||
};
|
||||
|
||||
public
|
||||
ref class Constants
|
||||
{
|
||||
public:
|
||||
literal int VK_WIN_BOTH = CommonSharedConstants::VK_WIN_BOTH;
|
||||
|
||||
static String ^ AppDataPath() {
|
||||
auto localPath = Environment::GetFolderPath(Environment::SpecialFolder::LocalApplicationData);
|
||||
auto powerToysPath = gcnew String(CommonSharedConstants::APPDATA_PATH);
|
||||
return System::IO::Path::Combine(localPath, powerToysPath);
|
||||
}
|
||||
|
||||
static String ^ PowerLauncherSharedEvent() {
|
||||
return gcnew String(CommonSharedConstants::POWER_LAUNCHER_SHARED_EVENT);
|
||||
}
|
||||
|
||||
static String ^ PowerLauncherCentralizedHookSharedEvent() {
|
||||
return gcnew String(CommonSharedConstants::POWER_LAUNCHER_CENTRALIZED_HOOK_SHARED_EVENT);
|
||||
}
|
||||
|
||||
static String ^ RunSendSettingsTelemetryEvent() {
|
||||
return gcnew String(CommonSharedConstants::RUN_SEND_SETTINGS_TELEMETRY_EVENT);
|
||||
}
|
||||
|
||||
static String ^ RunExitEvent() {
|
||||
return gcnew String(CommonSharedConstants::RUN_EXIT_EVENT);
|
||||
}
|
||||
|
||||
static String ^ FZEExitEvent() {
|
||||
return gcnew String(CommonSharedConstants::FZE_EXIT_EVENT);
|
||||
}
|
||||
|
||||
static String ^ FZEToggleEvent() {
|
||||
return gcnew String(CommonSharedConstants::FANCY_ZONES_EDITOR_TOGGLE_EVENT);
|
||||
}
|
||||
|
||||
static String ^ ColorPickerSendSettingsTelemetryEvent() {
|
||||
return gcnew String(CommonSharedConstants::COLOR_PICKER_SEND_SETTINGS_TELEMETRY_EVENT);
|
||||
}
|
||||
|
||||
static String ^ ShowColorPickerSharedEvent() {
|
||||
return gcnew String(CommonSharedConstants::SHOW_COLOR_PICKER_SHARED_EVENT);
|
||||
}
|
||||
|
||||
static String ^ ShowAdvancedPasteSharedEvent() {
|
||||
return gcnew String(CommonSharedConstants::SHOW_ADVANCED_PASTE_SHARED_EVENT);
|
||||
}
|
||||
|
||||
static String ^ AdvancedPasteMarkdownEvent() {
|
||||
return gcnew String(CommonSharedConstants::ADVANCED_PASTE_MARKDOWN_EVENT);
|
||||
}
|
||||
|
||||
static String ^ AdvancedPasteJsonEvent() {
|
||||
return gcnew String(CommonSharedConstants::ADVANCED_PASTE_JSON_EVENT);
|
||||
}
|
||||
|
||||
static String ^ ShowPowerOCRSharedEvent() {
|
||||
return gcnew String(CommonSharedConstants::SHOW_POWEROCR_SHARED_EVENT);
|
||||
}
|
||||
|
||||
static String ^ MouseJumpShowPreviewEvent() {
|
||||
return gcnew String(CommonSharedConstants::MOUSE_JUMP_SHOW_PREVIEW_EVENT);
|
||||
}
|
||||
|
||||
static String ^ AwakeExitEvent() {
|
||||
return gcnew String(CommonSharedConstants::AWAKE_EXIT_EVENT);
|
||||
}
|
||||
|
||||
static String^ ShowPeekEvent() {
|
||||
return gcnew String(CommonSharedConstants::SHOW_PEEK_SHARED_EVENT);
|
||||
}
|
||||
|
||||
static String ^ PowerAccentExitEvent() {
|
||||
return gcnew String(CommonSharedConstants::POWERACCENT_EXIT_EVENT);
|
||||
}
|
||||
|
||||
static String ^ ShortcutGuideTriggerEvent() {
|
||||
return gcnew String(CommonSharedConstants::SHORTCUT_GUIDE_TRIGGER_EVENT);
|
||||
}
|
||||
|
||||
static String ^ RegistryPreviewTriggerEvent() {
|
||||
return gcnew String(CommonSharedConstants::REGISTRY_PREVIEW_TRIGGER_EVENT);
|
||||
}
|
||||
|
||||
static String ^ MeasureToolTriggerEvent() {
|
||||
return gcnew String(CommonSharedConstants::MEASURE_TOOL_TRIGGER_EVENT);
|
||||
}
|
||||
|
||||
static String ^ GcodePreviewResizeEvent() {
|
||||
return gcnew String(CommonSharedConstants::GCODE_PREVIEW_RESIZE_EVENT);
|
||||
}
|
||||
|
||||
static String ^ QoiPreviewResizeEvent() {
|
||||
return gcnew String(CommonSharedConstants::QOI_PREVIEW_RESIZE_EVENT);
|
||||
}
|
||||
|
||||
static String ^ DevFilesPreviewResizeEvent() {
|
||||
return gcnew String(CommonSharedConstants::DEV_FILES_PREVIEW_RESIZE_EVENT);
|
||||
}
|
||||
|
||||
static String ^ MarkdownPreviewResizeEvent() {
|
||||
return gcnew String(CommonSharedConstants::MARKDOWN_PREVIEW_RESIZE_EVENT);
|
||||
}
|
||||
|
||||
static String ^ PdfPreviewResizeEvent() {
|
||||
return gcnew String(CommonSharedConstants::PDF_PREVIEW_RESIZE_EVENT);
|
||||
}
|
||||
|
||||
static String ^ SvgPreviewResizeEvent() {
|
||||
return gcnew String(CommonSharedConstants::SVG_PREVIEW_RESIZE_EVENT);
|
||||
}
|
||||
|
||||
static String ^ ShowHostsSharedEvent() {
|
||||
return gcnew String(CommonSharedConstants::SHOW_HOSTS_EVENT);
|
||||
}
|
||||
|
||||
static String ^ ShowHostsAdminSharedEvent() {
|
||||
return gcnew String(CommonSharedConstants::SHOW_HOSTS_ADMIN_EVENT);
|
||||
}
|
||||
|
||||
static String ^ CropAndLockThumbnailEvent() {
|
||||
return gcnew String(CommonSharedConstants::CROP_AND_LOCK_THUMBNAIL_EVENT);
|
||||
}
|
||||
|
||||
static String ^ CropAndLockReparentEvent() {
|
||||
return gcnew String(CommonSharedConstants::CROP_AND_LOCK_REPARENT_EVENT);
|
||||
}
|
||||
|
||||
static String ^ ShowEnvironmentVariablesSharedEvent() {
|
||||
return gcnew String(CommonSharedConstants::SHOW_ENVIRONMENT_VARIABLES_EVENT);
|
||||
}
|
||||
|
||||
static String ^ ShowEnvironmentVariablesAdminSharedEvent() {
|
||||
return gcnew String(CommonSharedConstants::SHOW_ENVIRONMENT_VARIABLES_ADMIN_EVENT);
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
#include "pch.h"
|
||||
@@ -3,12 +3,13 @@
|
||||
// This also affects IntelliSense performance, including code completion and many code browsing features.
|
||||
// However, files listed here are ALL re-compiled if any one of them is updated between builds.
|
||||
// Do not add files here that you will be updating frequently as this negates the performance advantage.
|
||||
#pragma once
|
||||
|
||||
#ifndef PCH_H
|
||||
#define PCH_H
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
// add headers that you want to pre-compile here
|
||||
#include <unknwn.h>
|
||||
#include <winrt/base.h>
|
||||
#include <winrt/Windows.Foundation.h>
|
||||
#include <winrt/Windows.Foundation.Collections.h>
|
||||
#include <Windows.h>
|
||||
#include <Endpointvolume.h>
|
||||
|
||||
#endif //PCH_H
|
||||
|
||||
@@ -41,8 +41,6 @@ namespace CommonSharedConstants
|
||||
|
||||
const wchar_t FANCY_ZONES_EDITOR_TOGGLE_EVENT[] = L"Local\\FancyZones-ToggleEditorEvent-1e174338-06a3-472b-874d-073b21c62f14";
|
||||
|
||||
const wchar_t WORKSPACES_LAUNCH_EDITOR_EVENT[] = L"Local\\Workspaces-LaunchEditorEvent-a55ff427-cf62-4994-a2cd-9f72139296bf";
|
||||
|
||||
const wchar_t SHOW_HOSTS_EVENT[] = L"Local\\Hosts-ShowHostsEvent-5a0c0aae-5ff5-40f5-95c2-20e37ed671f0";
|
||||
|
||||
const wchar_t SHOW_HOSTS_ADMIN_EVENT[] = L"Local\\Hosts-ShowHostsAdminEvent-60ff44e2-efd3-43bf-928a-f4d269f98bec";
|
||||
@@ -98,8 +96,6 @@ namespace CommonSharedConstants
|
||||
const wchar_t SHOW_ENVIRONMENT_VARIABLES_EVENT[] = L"Local\\PowerToysEnvironmentVariables-ShowEnvironmentVariablesEvent-1021f616-e951-4d64-b231-a8f972159978";
|
||||
const wchar_t SHOW_ENVIRONMENT_VARIABLES_ADMIN_EVENT[] = L"Local\\PowerToysEnvironmentVariables-EnvironmentVariablesAdminEvent-8c95d2ad-047c-49a2-9e8b-b4656326cfb2";
|
||||
|
||||
const wchar_t WORKSPACES_EXIT_EVENT[] = L"Local\\PowerToys-Workspaces-ExitEvent-29a1566f-f4f8-4d56-9435-d2a437f727c6";
|
||||
|
||||
// Max DWORD for key code to disable keys.
|
||||
const DWORD VK_DISABLED = 0x100;
|
||||
}
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
#pragma once
|
||||
#include <functional>
|
||||
class TwoWayPipeMessageIPC
|
||||
{
|
||||
public:
|
||||
typedef std::function<void(const std::wstring&)>callback_function;
|
||||
typedef void (*callback_function)(const std::wstring&);
|
||||
TwoWayPipeMessageIPC(
|
||||
std::wstring _input_pipe_name,
|
||||
std::wstring _output_pipe_name,
|
||||
|
||||
@@ -69,10 +69,6 @@ struct LogSettings
|
||||
inline const static std::string environmentVariablesLoggerName = "environment-variables";
|
||||
inline const static std::wstring cmdNotFoundLogPath = L"Logs\\cmd-not-found-log.txt";
|
||||
inline const static std::string cmdNotFoundLoggerName = "cmd-not-found";
|
||||
inline const static std::string workspacesLauncherLoggerName = "workspaces-launcher";
|
||||
inline const static std::wstring workspacesLauncherLogPath = L"workspaces-launcher-log.txt";
|
||||
inline const static std::string workspacesSnapshotToolLoggerName = "workspaces-snapshot-tool";
|
||||
inline const static std::wstring workspacesSnapshotToolLogPath = L"workspaces-snapshot-tool-log.txt";
|
||||
inline const static int retention = 30;
|
||||
std::wstring logLevel;
|
||||
LogSettings();
|
||||
|
||||
@@ -1,72 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <future>
|
||||
#include <thread>
|
||||
#include <functional>
|
||||
#include <queue>
|
||||
#include <atomic>
|
||||
|
||||
// OnThreadExecutor allows its caller to off-load some work to a persistently running background thread.
|
||||
// This might come in handy if you use the API which sets thread-wide global state and the state needs
|
||||
// to be isolated.
|
||||
|
||||
class OnThreadExecutor final
|
||||
{
|
||||
public:
|
||||
using task_t = std::packaged_task<void()>;
|
||||
|
||||
OnThreadExecutor() :
|
||||
_shutdown_request{ false },
|
||||
_worker_thread{ [this] { worker_thread(); } }
|
||||
{
|
||||
}
|
||||
|
||||
~OnThreadExecutor()
|
||||
{
|
||||
_shutdown_request = true;
|
||||
_task_cv.notify_one();
|
||||
_worker_thread.join();
|
||||
}
|
||||
|
||||
std::future<void> submit(task_t task)
|
||||
{
|
||||
auto future = task.get_future();
|
||||
std::lock_guard lock{ _task_mutex };
|
||||
_task_queue.emplace(std::move(task));
|
||||
_task_cv.notify_one();
|
||||
return future;
|
||||
}
|
||||
|
||||
void cancel()
|
||||
{
|
||||
std::lock_guard lock{ _task_mutex };
|
||||
_task_queue = {};
|
||||
_task_cv.notify_one();
|
||||
}
|
||||
|
||||
private:
|
||||
void worker_thread()
|
||||
{
|
||||
while (!_shutdown_request)
|
||||
{
|
||||
task_t task;
|
||||
{
|
||||
std::unique_lock task_lock{ _task_mutex };
|
||||
_task_cv.wait(task_lock, [this] { return !_task_queue.empty() || _shutdown_request; });
|
||||
if (_shutdown_request)
|
||||
{
|
||||
return;
|
||||
}
|
||||
task = std::move(_task_queue.front());
|
||||
_task_queue.pop();
|
||||
}
|
||||
task();
|
||||
}
|
||||
}
|
||||
|
||||
std::mutex _task_mutex;
|
||||
std::condition_variable _task_cv;
|
||||
std::atomic_bool _shutdown_request;
|
||||
std::queue<std::packaged_task<void()>> _task_queue;
|
||||
std::thread _worker_thread;
|
||||
};
|
||||
@@ -60,7 +60,6 @@ namespace powertoys_gpo {
|
||||
const std::wstring POLICY_CONFIGURE_ENABLED_ENVIRONMENT_VARIABLES = L"ConfigureEnabledUtilityEnvironmentVariables";
|
||||
const std::wstring POLICY_CONFIGURE_ENABLED_QOI_PREVIEW = L"ConfigureEnabledUtilityFileExplorerQOIPreview";
|
||||
const std::wstring POLICY_CONFIGURE_ENABLED_QOI_THUMBNAILS = L"ConfigureEnabledUtilityFileExplorerQOIThumbnails";
|
||||
const std::wstring POLICY_CONFIGURE_ENABLED_WORKSPACES = L"ConfigureEnabledUtilityWorkspaces";
|
||||
|
||||
// The registry value names for PowerToys installer and update policies.
|
||||
const std::wstring POLICY_DISABLE_PER_USER_INSTALLATION = L"PerUserInstallationDisabled";
|
||||
@@ -71,6 +70,7 @@ namespace powertoys_gpo {
|
||||
|
||||
// The registry value names for other PowerToys policies.
|
||||
const std::wstring POLICY_ALLOW_EXPERIMENTATION = L"AllowExperimentation";
|
||||
const std::wstring POLICY_ALLOW_DATA_DIAGNOSTICS = L"AllowDataDiagnostics";
|
||||
const std::wstring POLICY_CONFIGURE_ENABLED_POWER_LAUNCHER_ALL_PLUGINS = L"PowerLauncherAllPluginsEnabledState";
|
||||
const std::wstring POLICY_ALLOW_ADVANCED_PASTE_ONLINE_AI_MODELS = L"AllowPowerToysAdvancedPasteOnlineAIModels";
|
||||
const std::wstring POLICY_MWB_CLIPBOARD_SHARING_ENABLED = L"MwbClipboardSharingEnabled";
|
||||
@@ -400,11 +400,6 @@ namespace powertoys_gpo {
|
||||
return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_ADVANCED_PASTE);
|
||||
}
|
||||
|
||||
inline gpo_rule_configured_t getConfiguredWorkspacesEnabledValue()
|
||||
{
|
||||
return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_WORKSPACES);
|
||||
}
|
||||
|
||||
inline gpo_rule_configured_t getConfiguredVideoConferenceMuteEnabledValue()
|
||||
{
|
||||
return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_VIDEO_CONFERENCE_MUTE);
|
||||
@@ -460,6 +455,11 @@ namespace powertoys_gpo {
|
||||
return getConfiguredValue(POLICY_ALLOW_EXPERIMENTATION);
|
||||
}
|
||||
|
||||
inline gpo_rule_configured_t getAllowDataDiagnosticsValue()
|
||||
{
|
||||
return getConfiguredValue(POLICY_ALLOW_DATA_DIAGNOSTICS);
|
||||
}
|
||||
|
||||
inline gpo_rule_configured_t getRunPluginEnabledValue(std::string pluginID)
|
||||
{
|
||||
if (pluginID == "" || pluginID == " ")
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
|
||||
<Import Project="..\..\Version.props" />
|
||||
<Target Name="GenerateVersionData" BeforeTargets="PrepareForBuild">
|
||||
<ItemGroup>
|
||||
<HeaderLines Include="#pragma once" />
|
||||
|
||||
@@ -57,8 +57,6 @@ properties:
|
||||
EnableQoiThumbnail: false
|
||||
PowerOcr:
|
||||
Enabled: false
|
||||
Workspaces:
|
||||
Enabled: false
|
||||
ShortcutGuide:
|
||||
Enabled: false
|
||||
VideoConference:
|
||||
|
||||
@@ -57,8 +57,6 @@ properties:
|
||||
EnableQoiThumbnail: true
|
||||
PowerOcr:
|
||||
Enabled: true
|
||||
Workspaces:
|
||||
Enabled: true
|
||||
ShortcutGuide:
|
||||
Enabled: true
|
||||
VideoConference:
|
||||
|
||||
@@ -220,7 +220,7 @@ class {{module.Name}} {
|
||||
}
|
||||
|
||||
var enumsBlock = string.Join(DoubleNewLine, enumsToEmit.Select(EmitEnumDefinition));
|
||||
var version = PowerToys.Interop.CommonManaged.GetProductVersion().Replace("v", string.Empty);
|
||||
var version = interop.CommonManaged.GetProductVersion().Replace("v", string.Empty);
|
||||
var outputResult = string.Empty;
|
||||
|
||||
outputResult += $$"""
|
||||
@@ -393,7 +393,7 @@ class {{module.Name}} {
|
||||
|
||||
public static string EmitManifestFileContents()
|
||||
{
|
||||
var version = PowerToys.Interop.CommonManaged.GetProductVersion().Replace("v", string.Empty) + ".0";
|
||||
var version = interop.CommonManaged.GetProductVersion().Replace("v", string.Empty);
|
||||
var generatedDate = DateTime.Now.ToString("dd.MM.yyyy", CultureInfo.InvariantCulture);
|
||||
|
||||
return $$"""
|
||||
|
||||
@@ -1,15 +1,40 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<!-- Look at Directory.Build.props in root for common stuff as well -->
|
||||
<Import Project="..\..\Common.Dotnet.CsWinRT.props" />
|
||||
<Import Project="..\..\Common.SelfContained.props" />
|
||||
|
||||
<Import Project="..\..\Version.props" />
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net8.0-windows</TargetFramework>
|
||||
<RootNamespace>PowerToys.Settings.DSC.Schema</RootNamespace>
|
||||
<ApplicationManifest>app.manifest</ApplicationManifest>
|
||||
<RuntimeIdentifiers>win-x64;win-arm64</RuntimeIdentifiers>
|
||||
<WindowsPackageType>None</WindowsPackageType>
|
||||
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
|
||||
<AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>
|
||||
<SelfContained>true</SelfContained>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- SelfContained=true requires RuntimeIdentifier to be set -->
|
||||
<PropertyGroup Condition="'$(Platform)'=='x64'">
|
||||
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Platform)'=='ARM64'">
|
||||
<RuntimeIdentifier>win-arm64</RuntimeIdentifier>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)'=='Debug'">
|
||||
<NoWarn></NoWarn>
|
||||
<TreatWarningsAsErrors>True</TreatWarningsAsErrors>
|
||||
<WarningsNotAsErrors>CA1720</WarningsNotAsErrors>
|
||||
<Optimize>False</Optimize>
|
||||
<DebugType>full</DebugType>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)'=='Release'">
|
||||
<NoWarn></NoWarn>
|
||||
<TreatWarningsAsErrors>True</TreatWarningsAsErrors>
|
||||
<WarningsNotAsErrors>CA1720</WarningsNotAsErrors>
|
||||
<Optimize>true</Optimize>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- See https://learn.microsoft.com/windows/apps/develop/platform/csharp-winrt/net-projection-from-cppwinrt-component for more info -->
|
||||
|
||||
@@ -365,16 +365,6 @@
|
||||
<decimal value="0" />
|
||||
</disabledValue>
|
||||
</policy>
|
||||
<policy name="ConfigureEnabledUtilityWorkspaces" class="Both" displayName="$(string.ConfigureEnabledUtilityWorkspaces)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityWorkspaces">
|
||||
<parentCategory ref="PowerToys" />
|
||||
<supportedOn ref="SUPPORTED_POWERTOYS_0_84_0" />
|
||||
<enabledValue>
|
||||
<decimal value="1" />
|
||||
</enabledValue>
|
||||
<disabledValue>
|
||||
<decimal value="0" />
|
||||
</disabledValue>
|
||||
</policy>
|
||||
<policy name="ConfigureEnabledUtilityQuickAccent" class="Both" displayName="$(string.ConfigureEnabledUtilityQuickAccent)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityQuickAccent">
|
||||
<parentCategory ref="PowerToys" />
|
||||
<supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" />
|
||||
@@ -495,6 +485,16 @@
|
||||
<decimal value="0" />
|
||||
</disabledValue>
|
||||
</policy>
|
||||
<policy name="AllowDiagnosticData" class="Both" displayName="$(string.AllowDiagnosticData)" explainText="$(string.AllowDiagnosticDataDescription)" key="Software\Policies\PowerToys" valueName="AllowDataDiagnostics">
|
||||
<parentCategory ref="PowerToys" />
|
||||
<supportedOn ref="SUPPORTED_POWERTOYS_0_84_0" />
|
||||
<enabledValue>
|
||||
<decimal value="1" />
|
||||
</enabledValue>
|
||||
<disabledValue>
|
||||
<decimal value="0" />
|
||||
</disabledValue>
|
||||
</policy>
|
||||
<policy name="PowerToysRunAllPluginsEnabledState" class="Both" displayName="$(string.PowerToysRunAllPluginsEnabledState)" explainText="$(string.PowerToysRunAllPluginsEnabledStateDescription)" key="Software\Policies\PowerToys" valueName="PowerLauncherAllPluginsEnabledState">
|
||||
<parentCategory ref="PowerToysRun" />
|
||||
<supportedOn ref="SUPPORTED_POWERTOYS_0_75_0" />
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
<string id="InstallerUpdates">Installer and Updates</string>
|
||||
<string id="PowerToysRun">PowerToys Run</string>
|
||||
<string id="AdvancedPaste">Advanced Paste</string>
|
||||
<string id="Workspaces">Workspaces</string>
|
||||
<string id="MouseWithoutBorders">Mouse Without Borders</string>
|
||||
<string id="GeneralSettings">General settings</string>
|
||||
|
||||
@@ -100,6 +99,12 @@ If disabled or not configured, the user can control this in the settings of Powe
|
||||
If this setting is enabled or not configured, the user can control experimentation in the PowerToys settings menu.
|
||||
|
||||
If this setting is disabled, experimentation is not allowed.
|
||||
</string>
|
||||
<string id="AllowDiagnosticDataDescription">This policy configures whether sending of PowerToys diagnostic data is allowed. With diagnostic data sending allowed the user helps inform bug fixes, performance and improvements.
|
||||
|
||||
If this setting is enabled or not configured, the user can control diagnostic data sending in the PowerToys settings menu.
|
||||
|
||||
If this setting is disabled, diagnostic data sending is not allowed.
|
||||
</string>
|
||||
<string id="PowerToysRunAllPluginsEnabledStateDescription">This policy configures the enabled state for all PowerToys Run plugins. All plugins will have the same state.
|
||||
|
||||
@@ -112,12 +117,6 @@ If you don't configure this setting, users are able to enable or disable the plu
|
||||
You can override this policy for individual plugins using the policy "Configure enabled state for individual plugins".
|
||||
|
||||
Note: Changes require a restart of PowerToys Run.
|
||||
</string>
|
||||
<string id="ConfigureEnabledUtilityWorkspaces">This policy configures the enabled disable state for the Workspaces utility.
|
||||
|
||||
If you enable or don't configure this policy, the user takes control over the enabled state of the Workspaces utility.
|
||||
|
||||
If you disable this policy, the user won't be able to enable Enable and use the Workspaces utility.
|
||||
</string>
|
||||
<string id="PowerToysRunIndividualPluginEnabledStateDescription">With this policy you can configure an individual enabled state for each PowerToys Run plugin that you add to the list.
|
||||
|
||||
@@ -227,7 +226,6 @@ If you disable or don't configure this policy, no predefined rules are applied.
|
||||
<string id="ConfigureEnabledUtilityPeek">Peek: Configure enabled state</string>
|
||||
<string id="ConfigureEnabledUtilityPowerRename">Power Rename: Configure enabled state</string>
|
||||
<string id="ConfigureEnabledUtilityPowerLauncher">PowerToys Run: Configure enabled state</string>
|
||||
<string id="ConfigureEnabledUtilityWorkspaces">PowerToys Workspaces: Configure enabled state</string>
|
||||
<string id="ConfigureEnabledUtilityQuickAccent">Quick Accent: Configure enabled state</string>
|
||||
<string id="ConfigureEnabledUtilityRegistryPreview">Registry Preview: Configure enabled state</string>
|
||||
<string id="ConfigureEnabledUtilityScreenRuler">Screen Ruler: Configure enabled state</string>
|
||||
@@ -253,6 +251,8 @@ If you disable or don't configure this policy, no predefined rules are applied.
|
||||
<string id="MwbValidateRemoteIp">Validate remote machine IP Address</string>
|
||||
<string id="MwbDisableUserDefinedIpMappingRules">Disable user defined IP Address mapping rules</string>
|
||||
<string id="MwbPolicyDefinedIpMappingRules">Predefined IP Address mapping rules</string>
|
||||
<string id="AllowPowerToysAdvancedPasteOnlineAIModels">Advanced Paste: Allow using online AI models</string>
|
||||
<string id="AllowDiagnosticData">Allow sending diagnostic data</string>
|
||||
</stringTable>
|
||||
|
||||
<presentationTable>
|
||||
|
||||
@@ -1,20 +1,23 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<!-- Look at Directory.Build.props in root for common stuff as well -->
|
||||
<Import Project="..\..\..\Common.Dotnet.CsWinRT.props" />
|
||||
<Import Project="..\..\..\Common.SelfContained.props" />
|
||||
<Import Project="..\..\..\Version.props" />
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<TargetFramework>net8.0-windows10.0.20348.0</TargetFramework>
|
||||
<TargetPlatformMinVersion>10.0.19041.0</TargetPlatformMinVersion>
|
||||
<SupportedOSPlatformVersion>10.0.19041.0</SupportedOSPlatformVersion>
|
||||
<OutputPath>..\..\..\..\$(Platform)\$(Configuration)\WinUI3Apps</OutputPath>
|
||||
<UseWinUI>true</UseWinUI>
|
||||
<ApplicationIcon>Assets\AdvancedPaste\AdvancedPaste.ico</ApplicationIcon>
|
||||
<ApplicationManifest>app.manifest</ApplicationManifest>
|
||||
<RuntimeIdentifiers>win-x64;win-arm64</RuntimeIdentifiers>
|
||||
<GenerateSatelliteAssembliesForCore>true</GenerateSatelliteAssembliesForCore>
|
||||
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
|
||||
<AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>
|
||||
<EnablePreviewMsixTooling>true</EnablePreviewMsixTooling>
|
||||
<WindowsPackageType>None</WindowsPackageType>
|
||||
<WindowsAppSDKSelfContained>true</WindowsAppSDKSelfContained>
|
||||
<SelfContained>true</SelfContained>
|
||||
<AssemblyName>PowerToys.AdvancedPaste</AssemblyName>
|
||||
<AssemblyDescription>PowerToys AdvancedPaste</AssemblyDescription>
|
||||
<RootNamespace>AdvancedPaste</RootNamespace>
|
||||
@@ -25,6 +28,14 @@
|
||||
<DefineConstants>DISABLE_XAML_GENERATED_MAIN,TRACE</DefineConstants>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- SelfContained=true requires RuntimeIdentifier to be set -->
|
||||
<PropertyGroup Condition="'$(Platform)'=='x64'">
|
||||
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Platform)'=='ARM64'">
|
||||
<RuntimeIdentifier>win-arm64</RuntimeIdentifier>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- See https://learn.microsoft.com/windows/apps/develop/platform/csharp-winrt/net-projection-from-cppwinrt-component for more info -->
|
||||
<PropertyGroup>
|
||||
<CsWinRTIncludes>PowerToys.GPOWrapper</CsWinRTIncludes>
|
||||
@@ -57,6 +68,7 @@
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting" />
|
||||
<PackageReference Include="Microsoft.WindowsAppSDK" />
|
||||
<PackageReference Include="Microsoft.Windows.CsWin32" />
|
||||
<PackageReference Include="Microsoft.Windows.CsWinRT" />
|
||||
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" />
|
||||
<PackageReference Include="ReverseMarkdown" />
|
||||
<!-- HACK: To align Microsoft.Bcl.AsyncInterfaces.dll version with PowerToys.Settings.csproj. -->
|
||||
|
||||
@@ -88,9 +88,9 @@ namespace AdvancedPaste
|
||||
}
|
||||
}
|
||||
|
||||
NativeEventWaiter.WaitForEventLoop(PowerToys.Interop.Constants.ShowAdvancedPasteSharedEvent(), OnAdvancedPasteHotkey);
|
||||
NativeEventWaiter.WaitForEventLoop(PowerToys.Interop.Constants.AdvancedPasteMarkdownEvent(), OnAdvancedPasteMarkdownHotkey);
|
||||
NativeEventWaiter.WaitForEventLoop(PowerToys.Interop.Constants.AdvancedPasteJsonEvent(), OnAdvancedPasteJsonHotkey);
|
||||
NativeEventWaiter.WaitForEventLoop(interop.Constants.ShowAdvancedPasteSharedEvent(), OnAdvancedPasteHotkey);
|
||||
NativeEventWaiter.WaitForEventLoop(interop.Constants.AdvancedPasteMarkdownEvent(), OnAdvancedPasteMarkdownHotkey);
|
||||
NativeEventWaiter.WaitForEventLoop(interop.Constants.AdvancedPasteJsonEvent(), OnAdvancedPasteJsonHotkey);
|
||||
}
|
||||
|
||||
private void App_UnhandledException(object sender, Microsoft.UI.Xaml.UnhandledExceptionEventArgs e)
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
#include <windows.h>
|
||||
#include <winrt/Windows.Foundation.h>
|
||||
#include <winrt/Windows.Foundation.Collections.h>
|
||||
#include <ProjectTelemetry.h>
|
||||
#include <shellapi.h>
|
||||
#include <Shlwapi.h>
|
||||
#include <filesystem>
|
||||
@@ -8,46 +8,39 @@ TRACELOGGING_DEFINE_PROVIDER(
|
||||
(0x38e8889b, 0x9731, 0x53f5, 0xe9, 0x01, 0xe8, 0xa7, 0xc1, 0x75, 0x30, 0x74),
|
||||
TraceLoggingOptionProjectTelemetry());
|
||||
|
||||
void Trace::RegisterProvider()
|
||||
{
|
||||
TraceLoggingRegister(g_hProvider);
|
||||
}
|
||||
|
||||
void Trace::UnregisterProvider()
|
||||
{
|
||||
TraceLoggingUnregister(g_hProvider);
|
||||
}
|
||||
|
||||
// Log if the user has AdvancedPaste enabled or disabled
|
||||
void Trace::AdvancedPaste_Enable(const bool enabled) noexcept
|
||||
{
|
||||
TraceLoggingWrite(
|
||||
TraceLoggingWriteWrapper(
|
||||
g_hProvider,
|
||||
"AdvancedPaste_EnableAdvancedPaste",
|
||||
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
||||
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE),
|
||||
TraceLoggingEventTag(MICROSOFT_EVENTTAG_DROP_PII),
|
||||
TraceLoggingBoolean(enabled, "Enabled"));
|
||||
}
|
||||
|
||||
// Log if the user has invoked AdvancedPaste
|
||||
void Trace::AdvancedPaste_Invoked(std::wstring mode) noexcept
|
||||
{
|
||||
TraceLoggingWrite(
|
||||
TraceLoggingWriteWrapper(
|
||||
g_hProvider,
|
||||
"AdvancedPaste_InvokeAdvancedPaste",
|
||||
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
||||
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE),
|
||||
TraceLoggingEventTag(MICROSOFT_EVENTTAG_DROP_PII),
|
||||
TraceLoggingValue(mode.c_str(), "Mode"));
|
||||
}
|
||||
|
||||
// Log if an error occurs in AdvancedPaste
|
||||
void Trace::AdvancedPaste_Error(const DWORD errorCode, std::wstring errorMessage, std::wstring methodName) noexcept
|
||||
{
|
||||
TraceLoggingWrite(
|
||||
TraceLoggingWriteWrapper(
|
||||
g_hProvider,
|
||||
"AdvancedPaste_Error",
|
||||
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
||||
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE),
|
||||
TraceLoggingEventTag(MICROSOFT_EVENTTAG_DROP_PII),
|
||||
TraceLoggingValue(methodName.c_str(), "MethodName"),
|
||||
TraceLoggingValue(errorCode, "ErrorCode"),
|
||||
TraceLoggingValue(errorMessage.c_str(), "ErrorMessage"));
|
||||
@@ -88,15 +81,15 @@ void Trace::AdvancedPaste_SettingsTelemetry(const PowertoyModuleIface::Hotkey& p
|
||||
std::wstring(pasteJsonHotkey.alt ? L"Alt + " : L"") +
|
||||
std::wstring(L"VK ") + std::to_wstring(pasteJsonHotkey.key);
|
||||
|
||||
TraceLoggingWrite(
|
||||
TraceLoggingWriteWrapper(
|
||||
g_hProvider,
|
||||
"AdvancedPaste_Settings",
|
||||
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
||||
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE),
|
||||
TraceLoggingEventTag(MICROSOFT_EVENTTAG_DROP_PII),
|
||||
TraceLoggingWideString(pastePlainHotkeyStr.c_str(), "PastePlainHotkey"),
|
||||
TraceLoggingWideString(advancedPasteUIHotkeyStr.c_str(), "AdvancedPasteUIHotkey"),
|
||||
TraceLoggingWideString(pasteMarkdownHotkeyStr.c_str(), "PasteMarkdownHotkey"),
|
||||
TraceLoggingWideString(pasteJsonHotkeyStr.c_str(), "PasteJsonHotkey"),
|
||||
TraceLoggingBoolean(preview_custom_format_output, "ShowCustomPreview")
|
||||
);
|
||||
TraceLoggingBoolean(preview_custom_format_output, "ShowCustomPreview"));
|
||||
}
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
#pragma once
|
||||
#include <common/Telemetry/TraceBase.h>
|
||||
#include <interface/powertoy_module_interface.h>
|
||||
|
||||
class Trace
|
||||
class Trace : public telemetry::TraceBase
|
||||
{
|
||||
public:
|
||||
static void RegisterProvider();
|
||||
static void UnregisterProvider();
|
||||
|
||||
// Log if the user has AdvancedPaste enabled or disabled
|
||||
static void AdvancedPaste_Enable(const bool enabled) noexcept;
|
||||
|
||||
|
||||
@@ -74,7 +74,6 @@
|
||||
#include "WindowRectUtil.h"
|
||||
|
||||
// PowerToys
|
||||
#include <ProjectTelemetry.h>
|
||||
#include <common/logger/logger.h>
|
||||
|
||||
// Application resources
|
||||
|
||||
@@ -11,60 +11,55 @@ TRACELOGGING_DEFINE_PROVIDER(
|
||||
(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);
|
||||
}
|
||||
|
||||
void Trace::CropAndLock::Enable(bool enabled) noexcept
|
||||
{
|
||||
TraceLoggingWrite(
|
||||
TraceLoggingWriteWrapper(
|
||||
g_hProvider,
|
||||
"CropAndLock_EnableCropAndLock",
|
||||
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
||||
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE),
|
||||
TraceLoggingEventTag(MICROSOFT_EVENTTAG_DROP_PII),
|
||||
TraceLoggingBoolean(enabled, "Enabled"));
|
||||
}
|
||||
|
||||
void Trace::CropAndLock::ActivateReparent() noexcept
|
||||
{
|
||||
TraceLoggingWrite(
|
||||
TraceLoggingWriteWrapper(
|
||||
g_hProvider,
|
||||
"CropAndLock_ActivateReparent",
|
||||
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
||||
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE));
|
||||
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE),
|
||||
TraceLoggingEventTag(MICROSOFT_EVENTTAG_DROP_PII));
|
||||
}
|
||||
|
||||
void Trace::CropAndLock::ActivateThumbnail() noexcept
|
||||
{
|
||||
TraceLoggingWrite(
|
||||
TraceLoggingWriteWrapper(
|
||||
g_hProvider,
|
||||
"CropAndLock_ActivateThumbnail",
|
||||
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
||||
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE));
|
||||
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE),
|
||||
TraceLoggingEventTag(MICROSOFT_EVENTTAG_DROP_PII));
|
||||
}
|
||||
|
||||
void Trace::CropAndLock::CreateReparentWindow() noexcept
|
||||
{
|
||||
TraceLoggingWrite(
|
||||
TraceLoggingWriteWrapper(
|
||||
g_hProvider,
|
||||
"CropAndLock_CreateReparentWindow",
|
||||
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
||||
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE));
|
||||
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE),
|
||||
TraceLoggingEventTag(MICROSOFT_EVENTTAG_DROP_PII));
|
||||
}
|
||||
|
||||
void Trace::CropAndLock::CreateThumbnailWindow() noexcept
|
||||
{
|
||||
TraceLoggingWrite(
|
||||
TraceLoggingWriteWrapper(
|
||||
g_hProvider,
|
||||
"CropAndLock_CreateThumbnailWindow",
|
||||
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
||||
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE));
|
||||
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE),
|
||||
TraceLoggingEventTag(MICROSOFT_EVENTTAG_DROP_PII));
|
||||
}
|
||||
|
||||
// Event to send settings telemetry.
|
||||
@@ -84,12 +79,12 @@ void Trace::CropAndLock::SettingsTelemetry(PowertoyModuleIface::Hotkey& reparent
|
||||
std::wstring(thumbnailHotkey.alt ? L"Alt + " : L"") +
|
||||
std::wstring(L"VK ") + std::to_wstring(thumbnailHotkey.key);
|
||||
|
||||
TraceLoggingWrite(
|
||||
TraceLoggingWriteWrapper(
|
||||
g_hProvider,
|
||||
"CropAndLock_Settings",
|
||||
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
||||
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE),
|
||||
TraceLoggingEventTag(MICROSOFT_EVENTTAG_DROP_PII),
|
||||
TraceLoggingWideString(hotKeyStrReparent.c_str(), "ReparentHotKey"),
|
||||
TraceLoggingWideString(hotKeyStrThumbnail.c_str(), "ThumbnailHotkey")
|
||||
);
|
||||
TraceLoggingWideString(hotKeyStrThumbnail.c_str(), "ThumbnailHotkey"));
|
||||
}
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
#pragma once
|
||||
|
||||
#include <common/Telemetry/TraceBase.h>
|
||||
#include <modules/interface/powertoy_module_interface.h>
|
||||
|
||||
class Trace
|
||||
{
|
||||
public:
|
||||
static void RegisterProvider() noexcept;
|
||||
static void UnregisterProvider() noexcept;
|
||||
|
||||
class CropAndLock
|
||||
class CropAndLock : public telemetry::TraceBase
|
||||
{
|
||||
public:
|
||||
static void Enable(bool enabled) noexcept;
|
||||
|
||||
@@ -40,13 +40,13 @@ BOOL APIENTRY DllMain( HMODULE /*hModule*/,
|
||||
switch (ul_reason_for_call)
|
||||
{
|
||||
case DLL_PROCESS_ATTACH:
|
||||
Trace::RegisterProvider();
|
||||
Trace::CropAndLock::RegisterProvider();
|
||||
break;
|
||||
case DLL_THREAD_ATTACH:
|
||||
case DLL_THREAD_DETACH:
|
||||
break;
|
||||
case DLL_PROCESS_DETACH:
|
||||
Trace::UnregisterProvider();
|
||||
Trace::CropAndLock::UnregisterProvider();
|
||||
break;
|
||||
}
|
||||
return TRUE;
|
||||
|
||||
@@ -6,7 +6,5 @@
|
||||
#include <winrt/base.h>
|
||||
#include <winrt/Windows.Foundation.h>
|
||||
#include <winrt/Windows.Foundation.Collections.h>
|
||||
#include <ProjectTelemetry.h>
|
||||
#include <TraceLoggingActivity.h>
|
||||
#include <wil\common.h>
|
||||
#include <wil\result.h>
|
||||
|
||||
@@ -1,20 +1,22 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<!-- Look at Directory.Build.props in root for common stuff as well -->
|
||||
<Import Project="..\..\..\Common.Dotnet.CsWinRT.props" />
|
||||
<Import Project="..\..\..\Common.SelfContained.props" />
|
||||
|
||||
<Import Project="..\..\..\Version.props" />
|
||||
<PropertyGroup>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<TargetFramework>net8.0-windows10.0.20348.0</TargetFramework>
|
||||
<TargetPlatformMinVersion>10.0.19041.0</TargetPlatformMinVersion>
|
||||
<SupportedOSPlatformVersion>10.0.19041.0</SupportedOSPlatformVersion>
|
||||
<RootNamespace>EnvironmentVariables</RootNamespace>
|
||||
<ApplicationManifest>app.manifest</ApplicationManifest>
|
||||
<Platforms>x86;x64;ARM64</Platforms>
|
||||
<RuntimeIdentifiers>win-x64;win-arm64</RuntimeIdentifiers>
|
||||
<UseWinUI>true</UseWinUI>
|
||||
<Platforms>x64;ARM64</Platforms>
|
||||
<EnableMsixTooling>true</EnableMsixTooling>
|
||||
<EnablePreviewMsixTooling>true</EnablePreviewMsixTooling>
|
||||
<WindowsPackageType>None</WindowsPackageType>
|
||||
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
|
||||
<AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>
|
||||
<WindowsAppSDKSelfContained>true</WindowsAppSDKSelfContained>
|
||||
<SelfContained>true</SelfContained>
|
||||
<DefineConstants>DISABLE_XAML_GENERATED_MAIN,TRACE</DefineConstants>
|
||||
<OutputPath>..\..\..\..\$(Platform)\$(Configuration)\WinUI3Apps</OutputPath>
|
||||
<AssemblyName>PowerToys.EnvironmentVariables</AssemblyName>
|
||||
@@ -45,6 +47,14 @@
|
||||
<Message Text="Copied CopyPRIFileToOutputDir files" Importance="High" />
|
||||
</Target>
|
||||
|
||||
<!-- SelfContained=true requires RuntimeIdentifier to be set -->
|
||||
<PropertyGroup Condition="'$(Platform)'=='x64'">
|
||||
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Platform)'=='ARM64'">
|
||||
<RuntimeIdentifier>win-arm64</RuntimeIdentifier>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- See https://learn.microsoft.com/windows/apps/develop/platform/csharp-winrt/net-projection-from-cppwinrt-component for more info -->
|
||||
<PropertyGroup>
|
||||
<CsWinRTIncludes>PowerToys.GPOWrapper</CsWinRTIncludes>
|
||||
@@ -61,6 +71,7 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Windows.CsWinRT" />
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting" />
|
||||
<PackageReference Include="Microsoft.WindowsAppSDK" />
|
||||
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" />
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
|
||||
// Windows Header Files
|
||||
#include <windows.h>
|
||||
#include <ProjectTelemetry.h>
|
||||
|
||||
#include <optional>
|
||||
#include <string>
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
#include "pch.h"
|
||||
#include "trace.h"
|
||||
|
||||
#include <common/Telemetry/TraceBase.h>
|
||||
|
||||
TRACELOGGING_DEFINE_PROVIDER(
|
||||
g_hProvider,
|
||||
"Microsoft.PowerToys",
|
||||
@@ -8,33 +10,25 @@ TRACELOGGING_DEFINE_PROVIDER(
|
||||
(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 Environment Variables enabled or disabled
|
||||
void Trace::EnableEnvironmentVariables(const bool enabled) noexcept
|
||||
{
|
||||
TraceLoggingWrite(
|
||||
TraceLoggingWriteWrapper(
|
||||
g_hProvider,
|
||||
"EnvironmentVariables_EnableEnvironmentVariables",
|
||||
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
||||
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE),
|
||||
TraceLoggingEventTag(MICROSOFT_EVENTTAG_DROP_PII),
|
||||
TraceLoggingBoolean(enabled, "Enabled"));
|
||||
}
|
||||
|
||||
// Log that the user tried to activate the editor
|
||||
void Trace::ActivateEnvironmentVariables() noexcept
|
||||
{
|
||||
TraceLoggingWrite(
|
||||
TraceLoggingWriteWrapper(
|
||||
g_hProvider,
|
||||
"EnvironmentVariables_Activate",
|
||||
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
||||
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE));
|
||||
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE),
|
||||
TraceLoggingEventTag(MICROSOFT_EVENTTAG_DROP_PII));
|
||||
}
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
#pragma once
|
||||
|
||||
class Trace
|
||||
#include <common/Telemetry/TraceBase.h>
|
||||
|
||||
class Trace : public telemetry::TraceBase
|
||||
{
|
||||
public:
|
||||
static void RegisterProvider() noexcept;
|
||||
static void UnregisterProvider() noexcept;
|
||||
|
||||
// Log if the user has EnvironmentVariables enabled or disabled
|
||||
static void EnableEnvironmentVariables(const bool enabled) noexcept;
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<!-- Look at Directory.Build.props in root for common stuff as well -->
|
||||
<Import Project="..\..\..\Common.Dotnet.CsWinRT.props" />
|
||||
<Import Condition="exists('..\..\..\Version.props')" Project="..\..\..\Version.props" />
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Library</OutputType>
|
||||
<TargetFramework>net8.0-windows10.0.20348</TargetFramework>
|
||||
<RootNamespace>EnvironmentVariablesUILib</RootNamespace>
|
||||
<UseWinUI>true</UseWinUI>
|
||||
<EnablePreviewMsixTooling>true</EnablePreviewMsixTooling>
|
||||
@@ -19,6 +19,7 @@
|
||||
|
||||
<PropertyGroup>
|
||||
<!-- Properties for nuget package. -->
|
||||
<Authors>Microsoft Corporation</Authors>
|
||||
<Description>Implements the UI control for the PowerToys Environment Variables Utility</Description>
|
||||
<PackageLicenseExpression>MIT</PackageLicenseExpression>
|
||||
</PropertyGroup>
|
||||
@@ -37,7 +38,25 @@
|
||||
<Content Remove="Assets\**\*.ico" Pack="false" />
|
||||
</ItemGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)'=='Debug'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<DebugType>full</DebugType>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Optimize>false</Optimize>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)'=='Release'">
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Windows.CsWinRT" />
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting" />
|
||||
<PackageReference Include="Microsoft.WindowsAppSDK" />
|
||||
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" />
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user