Compare commits

..

122 Commits

Author SHA1 Message Date
Andrey Nekrasov
e14ff34b37 [SVGPreview]Handle comments properly (#28863)
* [SVGPreview] Handle comments properly

* f: spelling

* f: add tolerance to the bitmap eq test

* f: remove bitmap eq testing, since it doesn't work on CI for some reason

* f: parsing issue
2023-10-02 21:42:31 +01:00
Seraphima Zykova
11f30f9d33 [FancyZones]Don't automatically snap context menus (#28956)
* check tabstop

* revert

* check popup thickframe

* Revert "check popup thickframe"

* added HasThickFrame

* popup check

* spellcheck
2023-10-02 21:31:22 +01:00
Jaime Bernardo
59fb08cdd8 [HotFix][RegistryPreview]Fix out of bonds array access error (#28803) 2023-09-27 16:35:59 +01:00
Jaime Bernardo
1f86eefed1 [HotFix][QuickAccent]Fix missing characters (#28802)
* [HotFix][QuickAccent]Fix missing characters

* Remove some duplicate characters

* Fix spellcheck
2023-09-27 16:35:43 +01:00
Jaime Bernardo
77063e0767 0.74 changelogs (#28775)
Co-authored-by: Aaron Junker <aaron.junker@outlook.com>
Co-authored-by: Jay <65828559+Jay-o-Way@users.noreply.github.com>
Co-authored-by: Davide Giacometti <davide.giacometti@outlook.it>
Co-authored-by: Heiko <61519853+htcfreek@users.noreply.github.com>
2023-09-26 14:36:50 -07:00
Jaime Bernardo
a1e0bd5161 [Peek]Fix IsDevFilePreview and white flash (#28734) 2023-09-25 16:23:30 +01:00
Jaime Bernardo
28bd0686cc [CropAndLock]Fix crash on reparent SetPosition fail (#28763) 2023-09-25 16:06:55 +01:00
Stefan Markovic
d8ffa36bc6 Escape > with &gt; and quotes with &quot; in style attribute (#28762) 2023-09-25 15:24:25 +02:00
Heiko
1964aa6cce [PTRun][Settings plugin]Fix search for updates in windows 11 (#28735) 2023-09-25 13:17:25 +01:00
Bill Dengler
2b0d50bcbd [Docs]Update for clarity and completeness (#28553)
* Improve documentation style, add a few missing points

* More updates
2023-09-22 15:01:31 +01:00
Davide Giacometti
b24ae12c5a [ColorPicker][Settings]Fix duplicate name crash and cleanup (#28713) 2023-09-22 14:57:48 +01:00
Jaime Bernardo
8d5aa9fe6c [Settings]Fix FancyZones switch windows shortcuts UI (#28712) 2023-09-22 14:34:35 +01:00
Dylan Briedis
1de6c7d19b [Registry Preview] Better preview in data grid like in Regedit (#28488)
* Fix typo

* Better data grid preview like regedit

* Fix sorting of resource strings

* Add error icons back in

* Remove comments then trim whitespace

* Better string detection
2023-09-21 08:04:02 -07:00
Jaime Bernardo
e545291461 [Deps]Upgrade Windows App SDK to 1.4.1 (#28676) 2023-09-21 15:18:22 +01:00
Jaime Bernardo
422813044d [QuickAccent]Cache computed all language characters (#28657) 2023-09-21 13:52:08 +01:00
Seraphima Zykova
890b7f4286 [FancyZones]Fix for the scenario of layout reset when opening the FZEditor (#28556)
* rename

* moved applied layouts tests

* changed work area id comparison

* changed save

* changed apply

* changed clone

* sync applied layouts

* save last used vd

* replace parent work area ids

* proper time for sync

* sync layouts considering last used virtual desktop

* use ids from work areas on editor opening

* update applied layouts tests

* sync app zone history vd

* fix test

* release build fix

* app zone history comparison

* pass last used vd to sync

* clean up unused

* dpi unaware values

* update GUID_NULL

* use registry values only

* added more tests

* fix failing scenario

* added replace condition to zone history

* sync time

* log

* spellcheck

* fix pch in project

* fixed cloning layout
2023-09-21 11:47:56 +01:00
Seraphima Zykova
8cd2b7cdc3 [FancyZones] Fix handling newly created windows on Windows 11 (#28646) 2023-09-21 10:11:51 +02:00
Heiko
59f0ccebc7 [PT Run > PluginAdditionalOptions] Refactoring and more settings types (#28601)
* refactor existing code

* fixes

* fix combo box layout

* improve layout

* add more settings types

* combined setting

* enabled state

* fix spelling

* improve settings.json handling on null values

* textbox improvements

* rework xaml code

* fix xaml style

* spell fixes

* spell fixes

* update comment
2023-09-20 18:31:40 +01:00
gokcekantarci
5ddd8d72dd [Peek]Always use default white background for HTML files(#28557)
* [Peek] A check for color of body element in html and change it based on theme is added.

* [Peek] WebView2 solution is added instead of javascript injection

* [Peek] Detailed comments are added.
2023-09-20 18:30:32 +01:00
Davide Giacometti
0a1759028d [Hosts]Fix move up/down not being disabled when filtering (#28615) 2023-09-20 11:46:36 +01:00
Seraphima Zykova
bdf9a44717 [FancyZones]Set FancyZones process and main thread priority to Normal (#28581) 2023-09-19 15:47:05 +01:00
Jaime Bernardo
e09839dd6e [PreviewHandlers]Ignore telemetry exceptions (#28612) 2023-09-19 15:41:17 +01:00
Jaime Bernardo
b471c98f7e [FileLocksmith]Avoid GDI object leak on context menu (#28611) 2023-09-19 15:40:58 +01:00
Jaime Bernardo
c31211241d [MWB]Fix thread suspend crash on process restart (#28609) 2023-09-19 15:40:41 +01:00
Pedro Lamas
4ba1d83cf5 [FileExplorerAddOns]Improves handling of Gcode Thumbnails (#27947)
* Improves handling of Gcode Thumbnails

* Remove Peek support

* Moves GcodeHelper to PreviewHandlerCommon

* Reverts minor change

* Skip unknown data on GcodeHelper.GetBestThumbnail

* Replaces QOI.Core with QoiImage

* Fixes spellchecker

* Reverts changes to NOTICE.md

* Minor QoiImage improvements

* Use custom QoiPixel struct

* Add MIT notice for the QOI reference code

* Fix spellcheck for the MIT notice

* Update NOTICE.md

tweaked notice a bit
2023-09-19 15:33:55 +01:00
ChaseKnowlden
cc454701b8 [PTRun]UI for turning on Pinyin on Settings (#24293)
* Conflict resolving Part 1

* Conflict resolving Part 2

* Conflict resolving Part 3

* Conflict resolving part 4

* fix usepinyin

* Add test and fix setting

* Fix whitespace

* Fix prefix name

* Add mention that it doesn't work for every plugin
2023-09-19 15:31:33 +01:00
Davide Giacometti
b8a83fba1b [BugReport]Fix hang when bug report is launched (#28506)
* fix hang when bug report is launched from flyout

* Normalize output dir for release
2023-09-15 07:34:17 +01:00
Davide Giacometti
51906e68a4 [Hosts]Fix content dialogs overlapping title bar (#28547)
* fix content dialogs overlapping title bar

* fix spellcheck
2023-09-15 07:23:20 +01:00
gokcekantarci
368ed68271 [PTRun][Program]Exception handling and checks at startup thumbnail generation (#28534)
* [PTRun] Exception handling and other checks are added.

* [PTRun] Revert lines
2023-09-15 06:49:23 +01:00
Niels Laute
6af6f4f43f [Deps]Upgrading to CommunityToolkit.WinUI v8.0 (#28205)
* Adding new package references

* Updating namespaces and controls

* Fixing GridSplitter

* Bump up version numbers

* Fix namespaces for Settings

* Fixing FontIcon extensions

* Use Toolkit converters

* Update notice

* Remove unused reference

* Namespace fixes

* Update MainPage.xaml

* Upgrading packages to latest

* Resolve CI issues

* Fix Hosts merge
2023-09-14 17:41:31 +01:00
Stefan Markovic
43549eba77 [RegistryPreview]Fix showing in the background on start (#28452)
* [RegistryPreview] Fix showing in the background on start

* Use existing window handle
2023-09-12 14:50:02 +01:00
Jaime Bernardo
67a2dc0d6f [PTRun][Calc]Keep leading zeroes on languages where . is not a separator (#28451)
* [PTRun][Calc]Keep leading zeroes on languages where . is not a separator

* Adapt tests
2023-09-12 11:22:34 +01:00
Davide Giacometti
3253df782a [Dev]Automatically add header to .cs files (#28427) 2023-09-12 11:21:22 +01:00
Davide Giacometti
ebd051ff61 [General]Display in titlebar/tray if running as admin (#28425)
* display in titlebar if running as admin

* show run as admin in tray tooltip
2023-09-12 11:11:26 +01:00
Stefan Markovic
63975600f1 [HostsModuleInterface]Check correct event for error (#28412) 2023-09-12 10:45:29 +01:00
Davide Giacometti
184c618398 [Hosts]Entries context menu refactoring (#28367) 2023-09-12 10:28:25 +01:00
Dustin L. Howett
76de2de123 Switch away from the WinDev agent pools (#28503)
Using our own pools like this gives us a lot of freedom in the tooling
that's installed, the OS versions it targets, and when we take on Visual
Studio updates.

As part of this effort, I've also stood up a "small" agent pool. At the
time of this PR, that pool is using D2ads-v5 SKU VMs (2 vcore 8 GiB)
versus the "large" agent pool's D8as-v5 (8 vcore 32 GiB). Smaller build
tasks can in the future be moved over to the small pool. Compilation's
the hard part, so it gets to stay on the large pool.
2023-09-11 14:33:12 -05:00
gokcekantarci
e856e05fad [PTRun][Shell]Select which shell is used (#28121)
* [PTRun] LeaveShellOpen condition added to run command

* [PTRun] Keep shell open added to shell plugin settings.

* [PTRun] Unnecessary variable deleted. Formatting.

* [PTRun] Variable name changed.

* [PTRun] Shell selection

* [PTRun] Bugfix

* [PTRun] Review comments.

* [PTRun] Revert commit

* [PTRun] An enumaration is added to PluginAdditionalOption for selection types.
2023-09-11 11:54:06 +01:00
Joseph Finney
6ee326beb4 [TextExtractor]Version 2.0 with table scan and many QOL improvements (#28358)
* Remove unsed code and organize.

* If clicking a word hide the overlay to do the OCR

Code formatting

* spelling

* Add ResultTable

* Result Table working

* Spelling Fixes

* Initial Get UX for new Overlay UX working

* Basic top buttons working and loading correctly

* use Single Line and Table Toggle buttons when doing OCR

* Code style and error and warning removal

* Dispose Wrapping Stream as much as possible

* Fix spelling catches

* Use WPF UI 3.0.0-Preview.4

* Revert changes to ColorPicker UI

* Add Settings DeepLink

* Use Accent Color where possible

* Remove redundant button styles,

fix table click event

* Fix disposing too early
2023-09-11 10:32:49 +01:00
Davide Giacometti
6c09565244 [Hosts]Improved save error handling (#28215) 2023-09-08 16:25:36 +01:00
gokcekantarci
5e353640d7 [OOBE]SetTheme function added for oobe in HandleThemeChange function. (#28345) 2023-09-07 16:44:42 +01:00
peerpalo
ef56dcacf0 [ColorPicker]Scroll color history to top after choosing new color (#28291) 2023-09-07 16:32:45 +01:00
Andrey Nekrasov
16e105106b [SVGThumbnail]Optimize CPU usage (#28286)
* [SVG Thumbnail] Optimize CPU usage

* add missing zero
2023-09-07 16:06:49 +01:00
poke30744
4d95adc6fc [FileLocksmith]Detect files opened by processes with PID > 65535 (#28265)
It is to fix the bug that FileLocksmith cannot detect a process with a PID greater than 65535.
2023-09-07 15:56:10 +01:00
Andrey Nekrasov
380895a2ca [PowerRename] Do not crash with big counter values and bound max padd… (#28249) 2023-09-07 16:33:07 +02:00
Aaron Junker
2ecf5f41c2 [QuickAccent]Add é to Norwegian and Swedish (#28225) 2023-09-07 11:34:15 +01:00
Dongle
937e7b0c00 [Deps]Upgrade to WinAppSDK 1.4 (#28310)
* Update to WASDK 1.4

* Remove redundant title bar styles.

* Update notice

* Update C++ projects as well

* Upgrade CppWinRT too

* Add exception to WASDK file version set to 1.0.0.0

---------

Co-authored-by: Jaime Bernardo <jaime@janeasystems.com>
2023-09-07 09:36:47 +01:00
Aaron Junker
0040dbd829 Update SECURITY.md from 0.0.2 to 0.0.9 (#28289) 2023-09-06 09:14:28 -07:00
Andrey Nekrasov
2aff860e3d [KBM]Display VK_SUBTRACT key as "- (Substract)" to distinguish from VK_OEM_MINUS ("-") (#28271) 2023-09-06 14:54:52 +01:00
Moritz Kertesz
6cdcaddb7a [Awake]Extend .ico with down-sampled variants (#28194)
- Move original icon 2px down and 1px left to produce sharper down-sampling results
- Create ICO-pages for 64x64, 48x48, 32x32, 24x24, 20x20 and 16x16 icon versions
2023-09-05 18:46:52 +01:00
Danny Summerlin
91f7493b8b [QuickAccent]Calculate accents for "all languages" by querying all languages (#28164)
* PowerAccent: make All collect from Lang functions rather than return from manually updated list

* I forgot the semicolon

---------

Co-authored-by: dannysummerlinjstartorg <danny.summerlin@jstart.org>
2023-09-05 14:27:01 +01:00
Laszlo Nemeth
83bb573223 [Accessibility]Turn animations off based on Windows settings (#28128)
* FindMyMouse: switch animations on/off based on global windows settings

* Fancy Zones: enable/disable animations based on global Windows settings

* Shortcut Guide: enabling/disabling animations based on global Windows settings

* spell checker

* Making MouseUtils settings dependent on global windows settings, AnimationEffects. If the global settings is disabled the MouseUtils animation settings is disabled too, description shows the reason.

* Adding error detection, log on SystemParametersInfo call.

* Adding infobar instead of changing description of the settingsbar.

* spell checker

* moving native constant into NativeMethods class
2023-09-05 14:25:24 +01:00
Davide Giacometti
298a5eba2a [Hosts]Ignore default ACME sample entries (#28163) 2023-09-05 12:13:41 +01:00
Davide Giacometti
83f0625427 [FindMyMouse]Support different activation modes (#28096)
* multiple activation modes for find my mouse

* use custom shortcut
2023-09-04 16:58:37 +01:00
Jeremy Sinclair
752c298ef3 [PTRun][System] Sort NetworkInterfaces by IPv4, then IPv6 (#28220)
Updated GetList method to sort by IPv4, then IPv6 adapter interfaces to match test logic
2023-09-04 16:16:58 +01:00
Jaime Bernardo
90e5362385 [Tests]Disallow user override of culture options while running tests (#28207)
* [Tests]Disallow user override of culture options while running tests

* Revert unintended changes to the system's plugin

* Embed utc in the date to run utc tests on other timezones
2023-09-04 16:16:26 +01:00
Stefan Markovic
2c5659d746 0.73 release notes (#28171)
Co-authored-by: Ethan Fang <117125208+ethan-fang-MS@users.noreply.github.com>
Co-authored-by: Jaime Bernardo <jaime@janeasystems.com>
Co-authored-by: Clint Rutkas <clint@rutkas.com>
2023-08-31 09:58:24 -07:00
Clint Rutkas
a2a2e4b853 /helped markdown bug fix (#28232) 2023-08-31 09:57:52 -07:00
Seraphima Zykova
25e346db92 [FancyZones Editor] Fix layout selection after deleting custom (#28219) 2023-08-30 16:24:19 +02:00
Laszlo Nemeth
657e9915ac [Registry Preview] Adding missing resource string (#28216)
* Adding missing resource string

* Modify value
2023-08-30 15:18:46 +02:00
Seraphima Zykova
742e50eed7 [FZEditor]Fix "Save and close" not updating layouts (#28201)
* keep editing model

* hotkey backup

* added restore to base model

* pass model as an arg to edit and backup

* init canvas zones

* serialization

* not needed line
2023-08-29 20:24:30 +01:00
Seraphima Zykova
2305c8e754 [FancyZones] Prevent snapping to invalid zone (#28206) 2023-08-29 18:59:02 +02:00
Jaime Bernardo
ebc181bced [Settings]Flyout disables awake even if Settings page is opened (#28198) 2023-08-29 12:23:23 +01:00
Jaime Bernardo
e2a3b7dd22 [Peek]Fix crash while loading thumbnails for small pngs (#28190) 2023-08-29 12:22:29 +01:00
Laszlo Nemeth
2e74b5dae8 Fixing json property name to match with the settings file (#28189) 2023-08-29 13:21:52 +02:00
Andrey Nekrasov
ddefc27fd7 [PowerRename] Enable enumItems by default properly (#28191) 2023-08-29 10:57:45 +02:00
Stefan Markovic
5da6f5b451 Revert "Updated Release Notes for KBM Note (#28131)" (#28170)
This reverts commit ac0677bdee.
2023-08-27 18:47:18 +02:00
Ethan Fang
ac0677bdee Updated Release Notes for KBM Note (#28131)
* Added 'Paste as Plain Text' to the GitHub Issue Template selection drop down

* Update version placeholder too

* Adds Mouse Without Borders as area option in issue templates & updates placeholder PowerToys version

* Updated Release Notes for KBM

* Update README.md

* Update README.md

---------

Co-authored-by: Jaime Bernardo <jaime@janeasystems.com>
Co-authored-by: Clint Rutkas <clint@rutkas.com>
2023-08-27 17:33:44 +02:00
Niels Laute
8d78dd99fd Adding icon (#28151) 2023-08-25 20:11:35 +02:00
Seraphima Zykova
b3532b8c91 [Always on top] Transparent border (#28127) 2023-08-25 10:31:51 +02:00
Davide Giacometti
738072f508 Fix exception throw (#28104)
* fix exception throw

* fix settings crash

* throw runtime_error
2023-08-24 14:53:48 +02:00
Davide Giacometti
83143169c6 Crop And Lock added to Run plugin (#27927) 2023-08-24 14:53:33 +02:00
Pedro Lamas
c1316fc9f8 [Peek] show thumbnail and fallback to icon on unsupported files (#27979) 2023-08-24 12:10:45 +02:00
Andrey Nekrasov
efee03eb99 [KBM] Distinguish numpad keys (#28097) 2023-08-23 18:56:40 +02:00
Seraphima Zykova
c2bb2a8c3a [FancyZones Editor] Duplicating non-selected layout applies duplicated layout fix (#28042) 2023-08-22 20:25:03 +02:00
gokcekantarci
5426759b9c Pt run] keep shell open (#28041)
* [PTRun] LeaveShellOpen condition added to run command

* [PTRun] Keep shell open added to shell plugin settings.

* [PTRun] Unnecessary variable deleted. Formatting.

* [PTRun] Variable name changed.
2023-08-22 17:16:42 +02:00
Seraphima Zykova
6acae53e2c [FancyZones] Improve code quality (part 6) (#28034) 2023-08-22 14:57:45 +02:00
Davide Giacometti
7c7f6cabf7 [Peek][Monaco Preview] Open Monaco URI in default browser (#27774)
* open Monaco URI in default browser

* added dialog when URI is opened
2023-08-21 15:51:29 +02:00
Andrey Nekrasov
a46b80c76f [PowerRename] Enable "Enumerate items" by default (#28075) 2023-08-21 15:42:28 +02:00
Stefan Markovic
75ed88f823 Add Base64DecodeRequest description in community.valuegenerator.md (#28074) 2023-08-21 13:30:25 +02:00
Aaron Junker
35285088b8 Add /helped command (#27175)
* Update resourceManagement.yml

* Update .github/policies/resourceManagement.yml

Co-authored-by: Heiko <61519853+htcfreek@users.noreply.github.com>

---------

Co-authored-by: Heiko <61519853+htcfreek@users.noreply.github.com>
2023-08-21 12:15:31 +02:00
League of Poro
d4ae13238e Added base64 decode function to the Value Generator (#27835) 2023-08-21 12:05:08 +02:00
Deepak Sangle
a8b7d4d627 Fix/peek/file size (#28051)
* [Peek] displaying file size in correct grammatical format

* Update Directory.Packages.props

* removed unnecessary file
2023-08-21 10:58:50 +02:00
Samuel Bronson
08337a9578 Update ui-architecture.md: Fix .xaml links (#28068)
* Update ui-architecture.md: Fix .xaml links

* Update doc/devdocs/settingsv2/ui-architecture.md

---------

Co-authored-by: Stefan Markovic <57057282+stefansjfw@users.noreply.github.com>
2023-08-21 10:27:11 +02:00
Jeremy Sinclair
3244ba9899 [CI] Condense NuGet Restore into MSBuild Tasks (#27028)
* Remove NuGet Restore tasks and incorporate msbuild restore target

* Add RestorePackagesConfig msbuild argument

* Add RestorePackagesConfig argument for installer

* Remove NuGet installer task

* Added Nuget Restore static graph

* Applied build and restore changes to release pipeline

* Removed NuGet Restore Static Graph

* Set NuGet Restore Graph only to main PowerToys solution

* Removed typo

* Fix path format issue

* Added release pattern

* Removed NuGet Restore Package Graph Options

* Updating NuGet authenticate task.

* Use restore switch in CI

* Use restore switch in Release

* Removed Packages Path
2023-08-16 12:31:10 -04:00
Stefan Markovic
7c5f2a5dc1 [thumbnail previewers] Release source file after reading it (#28011) 2023-08-16 15:00:04 +02:00
Stefan Markovic
88b92afe5f Use Strings/*/Resources.resw instead of Properties/ one (#27972) 2023-08-15 18:28:49 +02:00
Seraphima Zykova
3dcfd93ee8 [FancyZones Editor] Highlight the user-defined default layout when no layout applied (#27879) 2023-08-15 12:25:54 +02:00
Andrey Nekrasov
7ab2717b09 [PowerRename] Remember last window size and optimize sorting (#27978)
We don't need to sort deeper layers, because they're being enumerated using explorer API and will appear in order anyway
2023-08-14 21:43:31 +02:00
Davide Giacometti
1d35263e4a fix InvalidOperationException collection was modified (#27975) 2023-08-14 19:23:08 +02:00
Andrey Nekrasov
268614ccd9 [PowerRename] Introduce advanced counter functionality (#27895) 2023-08-14 16:53:49 +02:00
Jaime Bernardo
97d397a576 [Docs]Update core team in COMMUNITY.md (#27934)
* [Docs]Update core team in COMMUNITY.md

* Fix spellcheck
2023-08-14 07:37:49 -07:00
Davide Giacometti
bcb0942b73 don't accumulate installer (#27908) 2023-08-14 10:55:12 +02:00
Stefan Markovic
00dc4981d1 Localize renameParts combo box (#27950) 2023-08-12 13:17:21 +02:00
Shubh Sardana
5b6f04bbff Update keyboardmanagerui.md (#26077)
* Update keyboardmanagerui.md

fixed broken links in TOC

* fixed Previously acknowg words - now absent

* removed pkey

* PKEY -> pkey

* updated toc

* Update doc/devdocs/modules/keyboardmanager/keyboardmanagerui.md

* Update doc/devdocs/modules/keyboardmanager/keyboardmanagerui.md

* Update doc/devdocs/modules/keyboardmanager/keyboardmanagerui.md

* Update doc/devdocs/modules/keyboardmanager/keyboardmanagerui.md

* Update .github/actions/spell-check/expect.txt

---------

Co-authored-by: Stefan Markovic <57057282+stefansjfw@users.noreply.github.com>
2023-08-11 11:27:44 +02:00
Jaime Bernardo
24dfec624e [Settings]Fix IsEnabledTextBlock secondary style (#27928) 2023-08-11 09:54:31 +02:00
Jaime Bernardo
aedac403b4 [GitHub]Add Crop and Lock to the issues templates (#27931) 2023-08-11 07:48:19 +02:00
Laszlo Nemeth
412dfa0c48 [Runner]Adding param when restarting to detect restart loop (#27794)
* [Runner] adding param when restarting to detect restart loop

* modifying comment to be more precise

* Adding log for the restart-loop-break scenarios
2023-08-10 11:59:36 +01:00
Jaime Bernardo
7ecfc58caa [New Utility]Crop And Lock (#27832)
* [CropAndLock]Original POC code dump

* Project rename and delete solution

* Remove unused architectures

* Update cppwinrt to be in line with the solution

* Add to PowerToys solution and fix build errors

* Initial module interface empty project

* Module skeleton based on AlwaysOnTop

* Add loggers to module interface

* Add crop and lock to the runner

* Enable starts and disable kills the process

* Events reacting to hotkeys

* Main application reacting to events

* Initialize unhandled exception handling

* Singleton in line with other projects

* Also exit when PowerToys exit is detected

* Create Settings page

* React to shortcut changes in Settings

* Disable Crop and Lock through an Event

* Disable running Crop and Lock standalone

* Remove Crop and Lock tray icon

* Module Interface dll version

* Fix main app resource file to include version

* Make pch conditional on CI build

* Add to signing

* Remove settings screen opened by removed tray icon

* Fix spellcheck

* Yet another fix for spellcheck

* Fix disabling utility

* Fix solution build configurations

* Fix C++ analyzer errors

* Try to fix pre-compiled header CI errors

* Fix crash while exiting with an active reparent window

* Fix missing reference when building in release CI

* Add OOBE page

* GPO: Add admx and adml file changes

* GPO: react to changes in GPO

* Add quick access flyout menu entry

* Use Crop And Lock icon

* Use actual images for Settings and OOBE

* Module and app telemetry

* Add entry to README.md

* Add to process lists

* Additional logging

* Attribution in Settings page

* Add attribution to Community.md

* Fix spellcheck

* Fix typo in strings

* Fix crash when window handle is no longer valid

* Update COMMUNITY.md

* Fix supportedOS in manifest

* Don't show msgbox if detecting second instance

* Remove unused hotkey

* Tweak attribution

* Fix attribution spellcheck
2023-08-10 10:46:33 +01:00
Stefan Markovic
d2c5b365fa [settings] Support launching settings app directly (#27881)
* Support launching settings app directly

* Update src/settings-ui/Settings.UI/SettingsXAML/App.xaml.cs

Co-authored-by: Davide Giacometti <davide.giacometti@outlook.it>

* Update src/settings-ui/Settings.UI/SettingsXAML/App.xaml.cs

Co-authored-by: Jaime Bernardo <jaime@janeasystems.com>

---------

Co-authored-by: Davide Giacometti <davide.giacometti@outlook.it>
Co-authored-by: Jaime Bernardo <jaime@janeasystems.com>
2023-08-10 10:02:50 +02:00
Seraphima Zykova
3fe2a2459d [FancyZones] Fix canvas zones drawing (#27882) 2023-08-09 10:34:25 +02:00
Stefan Markovic
f0c30132a2 Remove CreateScheduledTask CA and handle task creation from runner code (#27819)
* Refactor to avoid code duplication

* Remove CreateScheduledTask CA

* Update installer/PowerToysSetupCustomActions/CustomAction.cpp

Co-authored-by: Andrey Nekrasov <yuyoyuppe@users.noreply.github.com>

* Update installer/PowerToysSetupCustomActions/CustomAction.cpp

Co-authored-by: Andrey Nekrasov <yuyoyuppe@users.noreply.github.com>

---------

Co-authored-by: Andrey Nekrasov <yuyoyuppe@users.noreply.github.com>
2023-08-09 10:23:54 +02:00
Heiko
433edb4790 [PTRun][Settings plugin]Update device and bluetooth results (#27823)
* update settings list json

* add strings

* fix bthprops command
2023-08-08 19:33:11 +01:00
Davide Giacometti
8e712c6f49 [MouseUtils]Auto activate setting for highlighter and crosshairs (#27826)
* auto activate for mouse highlighter and crosshairs

* revert changed encoding
2023-08-08 17:01:23 +01:00
Niels Laute
a49f806ac7 [ImageResizer] Moving from ModernWPF to WpfUI (#26858)
* Moving from ModernWPF to WpfUI

* signing fix

* Spellcheck

* Sign fix 2

* Loc tweaks

* sign fix 3

* Move titlebar

* Tweaks

* Debug

* Fix again

* Updating preview package

* Fixes

* Update notice.md

---------

Co-authored-by: Stefan Markovic <stefan@janeasystems.com>
2023-08-08 15:19:38 +02:00
Randy
f6e9b08855 [RegistryPreview][UI]Update all AppBarButtons to use an explicit Icon(#27770)
* Fix for 27766

Removes the Icon property from all AppBarButtons and adds FontFamily for all Glyph's

* Update MainWindow.xaml

Removing a "Windows 11-only" glyph to prevent UI issues.
2023-08-08 13:14:09 +01:00
Davide Giacometti
64252192fa [Run][PluginManager]Doc for 3rd party plugins (#27566)
* doc for 3rd party run plugins

* link 3rd party run plugins doc

* fix spellcheck

* remove file

* fix links

* added author

* Update doc/thirdPartyRunPlugins.md

Co-authored-by: Nathan Driver <80888259+NathanD-GDS@users.noreply.github.com>

* Update doc/thirdPartyRunPlugins.md

Co-authored-by: Nathan Driver <80888259+NathanD-GDS@users.noreply.github.com>

* Update doc/thirdPartyRunPlugins.md

Co-authored-by: Nathan Driver <80888259+NathanD-GDS@users.noreply.github.com>

* Update doc/thirdPartyRunPlugins.md

Co-authored-by: Nathan Driver <80888259+NathanD-GDS@users.noreply.github.com>

* Update doc/thirdPartyRunPlugins.md

Co-authored-by: Nathan Driver <80888259+NathanD-GDS@users.noreply.github.com>

* Update doc/thirdPartyRunPlugins.md

Co-authored-by: Nathan Driver <80888259+NathanD-GDS@users.noreply.github.com>

---------

Co-authored-by: Nathan Driver <80888259+NathanD-GDS@users.noreply.github.com>
2023-08-08 13:01:50 +01:00
Juan M. Araújo
c5ad5e613e [FileLocksmith]Icon refresh (#27664)
Previous File Locksmith icon is in RGB/A format in all its sizes/resolutions, except for the 16x16 icon, which is in 256 indexed colors. This makes the icon look "jagged" in W11 context menu when using dark mode:

![imagen](https://github.com/microsoft/PowerToys/assets/117078256/70d9f0dc-6aa3-4b47-8853-27c4a8db85e8)

This small update replaces the indexed color 16x16 icon for a RGB/A one. Here's an example of the new: ![icon-png](https://github.com/microsoft/PowerToys/assets/117078256/ecc6e974-5b6b-4e12-89da-b56995306764)
2023-08-08 12:50:49 +01:00
Jaime Bernardo
274bcce4a2 [Settings]Fix crash opening system color settings (#27797)
* [Settings]Fix crash opening system color settings

* Update src/settings-ui/Settings.UI/SettingsXAML/Views/GeneralPage.xaml.cs

Co-authored-by: Davide Giacometti <davide.giacometti@outlook.it>

---------

Co-authored-by: Davide Giacometti <davide.giacometti@outlook.it>
2023-08-06 16:48:06 +01:00
Davide Giacometti
287fce236d [Peek]Fix 0 byte size displayed (#27709)
fix 0 byte size displayed
2023-08-06 16:26:44 +01:00
Laszlo Nemeth
6948ffca53 [MouseHighlighter]Bringing to front to be on top of other topmost windows (#27062)
* [MouseHighlighter] modifying window to be 'topmost' to be visible when clicking on 'pinned to top' windows.

* Fixing window hidden when clicking on a pinned to top window.

* Moving the code which starts the bring-to-front-timer to the mouse click events.
Also adding modifications to await 5 times 10 ms after the event to have surely the desired effect as in some cases the window repositioning takes longer than 10 ms.

* Minor changes

* Add safety code to ensure timer is never started paralely. Also minor format changes.

* Add comments

* spell checker corrections
2023-08-06 16:16:56 +01:00
Davide Giacometti
c95508c8a5 [Peek]Fix empty file type for shortcuts(#27716)
fixes missing file type for shortcuts
2023-08-06 15:44:56 +01:00
Davide Giacometti
cd6178763d [Chore]Update test packages and StyleCop (#27708)
* update test packages and StyleCop

* bumped versions
2023-08-06 15:29:36 +01:00
Laszlo Nemeth
185ebad2f0 [PTRun]Fix search being abandoned while cycling results (#27409)
* [Launcher] ignoring key preses while previous key press processing is ongoing

* extending TextChangedEventArgs with Initiator, storing and using initiator for the event lifetime to avoid overwriting of the initiator when parallel events occur.

* extending code with check on event object presence
2023-08-06 15:22:33 +01:00
Stefan Markovic
159bf7455d Replace PowerRename OOBE gif (#27829) 2023-08-04 17:43:53 +02:00
ChaseKnowlden
bcaca188b4 Replace PowerRename GIF (#27499)
* Replace PowerRename GIF

* Update PowerRename GIF

* Reduce size of gif

* Reduce GIF to 700x251
2023-08-04 15:35:46 +02:00
Stefan Markovic
adbc273bcf [installer] Auto-start PowerToys as logged-in user from installer run… (#27793)
* [installer] Auto-start PowerToys as logged-in user from installer running as SYSTEM

* spellcheck

* Address feedback

* spellcheck
2023-08-04 09:59:33 +02:00
Anders
d4213c3e30 Missing CoUninitialize (#27732) 2023-08-03 19:44:17 +02:00
Anders
b54a7c3b0b [Runner] Unnecessary RegisterWindowMessage (#27728) 2023-08-03 19:43:55 +02:00
sh0ckj0ckey
be9ed7536b [Settings] Solving Hook-related problems with modifier keys appearing at ShortcutControl (#27513) 2023-08-03 12:13:35 +02:00
Jay
655a8baed3 [KBM]More specific labels to avoid confusion (#25774)
* Update strings

* add one change

* use "select" as verb
2023-08-03 10:58:31 +01:00
Jaime Bernardo
00546a03e6 0.72 changelogs (#27662)
Co-authored-by: Aaron Junker <aaron.junker@outlook.com>
Co-authored-by: Jay <65828559+Jay-o-Way@users.noreply.github.com>
2023-08-01 10:19:14 -07:00
621 changed files with 119689 additions and 63606 deletions

View File

@@ -50,6 +50,7 @@ body:
- Always on Top
- Awake
- ColorPicker
- Crop and Lock
- FancyZones
- FancyZones Editor
- File Locksmith

View File

@@ -24,6 +24,7 @@ body:
- Always on Top
- Awake
- ColorPicker
- Crop and Lock
- FancyZones
- FancyZones Editor
- File Locksmith

View File

@@ -15,6 +15,8 @@ edwinzap
Essey
Garside
Gershaft
Gokce
Guo
hallatore
Harmath
Hemmerlein
@@ -22,22 +24,28 @@ Huynh
Jaswal
jefflord
Kamra
Kantarci
Karthick
kevinguo
Krigun
Luecking
Mahalingam
Mikhayelyan
mshtang
Myrvold
naveensrinivasan
nVidia
phoboslab
Ponten
Pooja
robmen
robmikh
Schoen
skycommand
snickler
sinclairinat
streamjsonrpc
Szablewski
tilovell
TheJoeFin
Triet

View File

@@ -1,28 +1,15 @@
aaaa
AAAAEF
AAB
AABAD
AACB
AACD
AAD
AADF
abap
abcdefghjkmnpqrstuvxyz
ABE
abgr
abi
ABlocked
ABOUTBOX
Abug
ACA
accctrl
Acceleratorkeys
ACCEPTFILES
ACCESSDENIED
accessibilityinsights
ACDB
ACFC
ACFF
Acl
aclapi
AClient
@@ -40,18 +27,7 @@ adml
admx
advapi
advfirewall
AEAA
AEAD
AECC
AED
AEE
AEEB
AFAE
AFAEFC
AFDA
AFE
AFeature
AFFE
AFFINETRANSFORM
AFX
AGGREGATABLE
@@ -77,7 +53,6 @@ ansicolor
ANull
AOC
aocfnapldcnfbofgmbbllojgocaelgdd
AOT
APARTMENTTHREADED
APeriod
apidl
@@ -143,36 +118,14 @@ AValid
awakeness
AWAYMODE
AYUV
azcli
azman
azor
backtracer
BAF
bak
BBE
bbwe
BCA
BCB
BCCE
BCCEA
bck
BDB
BDBAD
BDCC
BDDF
BDFB
BEAA
BEB
BEEAADF
BEEC
BEFA
BESTEFFORT
betadele
betsegaw
BFC
BFDE
BFEB
BFF
BFFA
BGR
bgra
bhid
@@ -183,6 +136,7 @@ BITMAPFILEHEADER
bitmapimage
BITMAPINFO
BITMAPINFOHEADER
Bitmaps
bitmask
BITSPIXEL
bla
@@ -202,6 +156,7 @@ BOKMAL
bootstrapper
BOOTSTRAPPERINSTALLFOLDER
Bopomofo
bostrot
BOTTOMALIGN
BPBF
bpmf
@@ -227,48 +182,28 @@ BValue
byapp
BYPOSITION
bytearray
CABD
CALG
callbackptr
calpwstr
cameligo
Cangjie
CANRENAME
CAPTUREBLT
CAPTURECHANGED
CAtl
CBA
CBB
CBF
CCCCDE
cch
CCHDEVICENAME
CCHFORMNAME
CCom
CContext
CDAC
CDBF
CDCE
CDD
CDE
cdecl
CDeclaration
CDEF
cdpx
CEAF
CEBAC
CEBD
CECB
CElems
CENTERALIGN
ceq
certlm
certmgr
CFAADB
CFBBF
CFEE
CFFEE
CFFF
cguid
CHANGECBCHAIN
changecursor
@@ -346,7 +281,6 @@ comsupp
comsuppw
comsuppwd
comutil
concrt
CONFIGW
CONFLICTINGMODIFIERKEY
CONFLICTINGMODIFIERSHORTCUT
@@ -414,10 +348,8 @@ CYSCREEN
CYSMICON
CYVIRTUALSCREEN
cziplib
DAA
Dac
dacl
DAF
damienleroy
DARKPURPLE
DARKTEAL
@@ -429,30 +361,18 @@ dataversion
DATAW
davidegiacometti
Dayof
DBAE
DBB
DBBDA
DBDE
Dbg
Dbghelp
DBLCLKS
DBLEPSILON
DCAB
DCapture
DCBA
DCBC
DCCB
DCEFCB
DCF
DCOM
dcommon
dcomp
dcompi
DComposition
dcr
dcs
DDCDD
DDCE
DDEIf
DDevice
ddf
@@ -463,7 +383,6 @@ debugbreak
DECLAR
declspec
decryptor
DED
Dedup
DEFAULTBOOTSTRAPPERINSTALLFOLDER
DEFAULTCOLOR
@@ -485,7 +404,6 @@ DENORMAL
Deondre
depersist
deprioritized
depsfileslistspath
deref
DESKTOPABSOLUTEEDITING
DESKTOPABSOLUTEPARSING
@@ -500,9 +418,6 @@ DEVMODEW
DEVMON
devpkey
DEVSOURCE
DFAB
DFB
DFBEA
DIIRFLAG
dimm
directshow
@@ -549,13 +464,11 @@ dvr
DVSD
DVSL
DVTARGETDEVICE
DWINRT
dwl
dwm
dwmapi
DWMCOLORIZATIONCOLORCHANGED
DWMCOMPOSITIONCHANGED
dwmcorei
DWMNCRENDERINGCHANGED
Dwmp
DWMSENDICONICLIVEPREVIEWBITMAP
@@ -571,41 +484,13 @@ dxgi
dxgidebug
dxgiformat
dxguid
EAAFE
EABF
EAC
EADC
EAF
EBCF
EBD
EBE
ecl
ecount
EData
EDB
EDCCC
EDFAE
Edid
edis
EDITKEYBOARD
editkeyboardwindow
EDITSHORTCUTS
editshortcutswindow
edshift
EEA
EEB
EEBBE
EEBD
EED
EEDA
EEEE
EEF
EEFA
EFB
EFC
EFDD
EFE
EFFEFC
EFile
eip
ekus
@@ -634,7 +519,6 @@ ERRORTITLE
ESettings
esize
esrp
estructuredtext
etl
etstat
etw
@@ -672,47 +556,15 @@ EXTENDEDKEY
EXTENDEDVERBS
EXTRINSICPROPERTIES
eyetracker
FABC
FAEDDA
FAF
FAFD
fancymouse
fancyzone
FANCYZONESDRAWLAYOUTTEST
FANCYZONESEDITOR
Farbraum
FARPROC
FBB
FBC
FBDE
FBF
FCAE
FCB
FCCFF
FCD
FCDB
FCDD
FCE
FDB
FDBF
FDC
FDCD
FDE
FDEF
FDF
fdw
FECF
FEDF
FEEF
feimage
FFB
FFBCF
FFBE
FFDDD
FFEB
FFEBEF
fff
fileapi
FILEEXPLORER
FILEFLAGS
FILEFLAGSMASK
@@ -756,6 +608,7 @@ GAC
gacutil
Gaeilge
Gaidhlig
Galaxi
GBarm
Gbits
Gbps
@@ -766,6 +619,8 @@ gcode
gdi
gdiplus
GDISCALED
GEmoji
GETCLIENTAREAANIMATION
GETDESKWALLPAPER
GETDLGCODE
GETDPISCALEDSIZE
@@ -787,14 +642,12 @@ GPOCA
gpp
GPT
gpu
graphql
GSM
gtm
gui
guiddata
guiddef
guidgenerator
GUIDv
GUITHREADINFO
GValue
gwl
@@ -822,6 +675,7 @@ hcblack
HCERTSTORE
HCRYPTHASH
HCRYPTPROV
hcursor
hcwhite
hdc
hdrop
@@ -856,6 +710,7 @@ HKL
HKLM
HKPD
HKU
hlaueriksson
HLOCAL
HMD
hmenu
@@ -889,7 +744,7 @@ hstring
hsv
htcfreek
HTCLIENT
HTHUMBNAIL
hthumbnail
HTOUCHINPUT
HTTRANSPARENT
HVal
@@ -930,6 +785,7 @@ IFACEMETHODIMP
IFile
IFilter
IGraphics
IGT
iid
Iindex
IIO
@@ -1022,7 +878,6 @@ JPN
jpnime
Jsons
jsonval
julia
junja
jxr
jyuwono
@@ -1047,11 +902,9 @@ keynum
keyremaps
Keytool
keyup
Kfiles
KILLFOCUS
killrunner
Knownfolders
kotlin
KSPROPERTY
Kybd
LAlt
@@ -1079,11 +932,11 @@ LEFTSCROLLBAR
LEFTUP
lego
len
lepo
LError
Lessthan
LEVELID
LExit
lexon
lhs
lhwnd
LIBID
@@ -1162,6 +1015,7 @@ lstrlen
LTRB
LTRREADING
luid
LUMA
lusrmgr
LVal
LWA
@@ -1283,7 +1137,6 @@ msc
msclr
mscorlib
msdata
msdax
msedge
MSGFLT
MSIFASTINSTALL
@@ -1300,7 +1153,6 @@ msrc
msstore
mst
msvc
msvcp
MTND
Mul
MULTIPLEUSE
@@ -1310,7 +1162,6 @@ mwb
MWBEx
myfile
MYICON
mysql
NAMECHANGE
nameof
namespaceanddescendants
@@ -1360,7 +1211,6 @@ NIF
nint
NLD
NLog
nls
NLSTEXT
NNN
NOACTIVATE
@@ -1490,7 +1340,6 @@ PARENTRELATIVEPARSING
PArgb
parray
PARTIALCONFIRMATIONDIALOGTITLE
pascaligo
pasteplain
PATCOPY
pathcch
@@ -1532,7 +1381,6 @@ pfn
pfo
pft
pgp
pgsql
pguid
PHANDLE
phbm
@@ -1560,12 +1408,10 @@ Pnp
Popups
POPUPWINDOW
posix
postiats
poweraccent
powerlauncher
POWEROCR
powerpreview
powerquery
powerrename
POWERRENAMECONTEXTMENU
powerrenameinput
@@ -1607,9 +1453,9 @@ printmanagement
prm
proactively
PROCESSKEY
processthreadsapi
PRODEXT
PRODUCTVERSION
productwxspath
Progman
programdata
PROGRAMFILES
@@ -1637,6 +1483,7 @@ ptc
ptd
PTOKEN
PToy
ptrun
ptstr
pui
PULONG
@@ -1651,7 +1498,9 @@ qianlifeng
qit
QITAB
QITABENT
qoi
qps
Quarternary
QUERYENDSESSION
QUERYOPEN
QUEUESYNC
@@ -1681,12 +1530,13 @@ RCtrl
READMODE
READOBJECTS
READWRITE
recents
RECTDESTINATION
RECTL
rectp
rects
RECTSOURCE
redirectedfrom
redis
Redist
redistributable
reencode
@@ -1719,11 +1569,12 @@ REMAPSUCCESSFUL
REMAPUNSUCCESSFUL
Remotable
remoteip
Removedir
Removelnk
renamable
RENAMEONCOLLISION
Renamer
reparent
reparenting
reparse
reportbug
requery
@@ -1786,7 +1637,6 @@ rungameid
RUNLEVEL
runsettings
runtimeclass
runtimedepsjsonpath
runtimeobject
runtimepack
runtimes
@@ -1894,6 +1744,7 @@ SHOWNOACTIVATE
SHOWNORMAL
SHOWWINDOW
shtypes
sia
SIATTRIBFLAGS
SICHINT
sid
@@ -1913,6 +1764,7 @@ SIZENWSE
sizeread
SIZEWE
SKIPOWNPROCESS
skttl
sku
SLGP
sln
@@ -2002,6 +1854,7 @@ subquery
subresource
Superbar
sut
svchost
SVE
SVGIn
SVGIO
@@ -2028,14 +1881,12 @@ SYSMENU
SYSTEMAPPS
systemroot
SYSTEMTIME
systemverilog
sysvol
Tadele
talynone
TApp
TApplication
TApplied
Taras
targ
TARGETAPPHEADER
TARGETDIR
@@ -2047,8 +1898,8 @@ taskbar
taskkill
tasklist
taskschd
TBM
tchar
tcl
Tcollab
tcp
tcs
@@ -2122,9 +1973,7 @@ TYPESHORTCUT
UAC
UAL
uap
uby
udit
Udk
Udp
uefi
UHash
@@ -2159,6 +2008,7 @@ unregistering
unremapped
unsubscribe
unvirtualized
unwide
UOffset
UOI
Updatelayout
@@ -2169,6 +2019,7 @@ USEDEFAULT
USEFILEATTRIBUTES
USERDATA
USERDOMAIN
Userenv
userprofile
USESHOWWINDOW
USESTDHANDLES
@@ -2186,16 +2037,12 @@ valuegenerator
Vanara
variantassignment
vcamp
vccorlib
vcdl
vcgtq
VCINSTALLDIR
vcm
vcomp
Vcpkg
vcproj
VCRT
vcruntime
vcvars
VDesktop
vdi
@@ -2308,7 +2155,7 @@ WINL
winlogon
winmd
winmm
WINNT
winnt
winres
winrt
winsdk
@@ -2353,8 +2200,8 @@ workspaces
wox
wparam
wpf
wpfdepsjsonpath
wpftmp
wpfui
wpr
wprp
wql
@@ -2380,11 +2227,9 @@ WTS
wtsapi
WTSAT
Wubi
wuceffectsi
WVC
Wwan
Wwanpp
XAttribute
XAxis
xbf
Xbox
@@ -2392,7 +2237,6 @@ XBUTTON
XBUTTONDBLCLK
XBUTTONDOWN
XBUTTONUP
xcopy
XDocument
XDOWN
XElement
@@ -2409,15 +2253,17 @@ xsi
XStr
XUP
XVIRTUALSCREEN
xxxxxx
YAxis
ycv
Yeet
YIncrement
yinle
yinwang
yinyue
YOffset
Youdao
YPels
ypescript
YResolution
YStr
YUY

View File

@@ -115,12 +115,14 @@ TestCase\("[^"]+"
\\Registry
\\registry
\\reinstall
\\release
\\Resize
\\resource
\\Resources
\\restart
\\restore
\\result
\\robmikh
\\rotating
\\runner
\\runtimes

View File

@@ -192,6 +192,29 @@ configuration:
- addLabel:
label: Needs-Author-Feedback
description:
- if:
- payloadType: Issue_Comment
- commentContains:
pattern: '\/helped'
isRegex: True
- or:
- activitySenderHasAssociation:
association: Owner
- activitySenderHasAssociation:
association: Member
- activitySenderHasAssociation:
association: Collaborator
then:
- removeLabel:
label: Needs-Triage
- removeLabel:
label: Needs-Team-Response
- addLabel:
label: Resolution-Helped User
- addReply:
reply: This issue is now marked as resolved. If you have any follow-up questions, please don't hesitate to ask. You can find out more about PowerToys functionalities in our [end-user documentation](https://aka.ms/powertoy-docs).
- closeIssue
description:
- if:
- payloadType: Issue_Comment
- commentContains:

View File

@@ -14,7 +14,7 @@
"PowerToys.exe",
"PowerToys.FilePreviewCommon.dll",
"PowerToys.Interop.dll",
"BugReportTool\\PowerToys.BugReportTool.exe",
"Tools\\PowerToys.BugReportTool.exe",
"WebcamReportTool\\PowerToys.WebcamReportTool.exe",
"StylesReportTool\\PowerToys.StylesReportTool.exe",
"Telemetry.dll",
@@ -33,6 +33,9 @@
"PowerToys.ColorPickerUI.dll",
"PowerToys.ColorPickerUI.exe",
"PowerToys.CropAndLockModuleInterface.dll",
"PowerToys.CropAndLock.exe",
"PowerToys.PowerOCRModuleInterface.dll",
"PowerToys.PowerOCR.dll",
"PowerToys.PowerOCR.exe",
@@ -281,7 +284,8 @@
"WinUI3Apps\\SharpCompress.dll",
"ColorCode.Core.dll",
"ColorCode.UWP.dll",
"UnitsNet.dll"
"UnitsNet.dll",
"Wpf.Ui.dll"
],
"SigningInfo": {
"Operations": [

View File

@@ -1,7 +1,7 @@
parameters:
configuration: 'Release'
platform: ''
additionalBuildArguments: '-m'
additionalBuildArguments: '/p:RestorePackagesConfig=true -m'
jobs:
- job: Build${{ parameters.platform }}${{ parameters.configuration }}
@@ -12,11 +12,11 @@ jobs:
NUGET_RESTORE_MSBUILD_ARGS: /p:Platform=${{ parameters.platform }} # Required for nuget to work due to self contained
NODE_OPTIONS: --max_old_space_size=16384
pool:
demands: ImageOverride -equals WinDevVS17-latest
demands: ImageOverride -equals SHINE-VS17-Latest
${{ if eq(variables['System.CollectionUri'], 'https://dev.azure.com/ms/') }}:
name: WinDevPoolOSS-L
name: SHINE-OSS-L
${{ if ne(variables['System.CollectionUri'], 'https://dev.azure.com/ms/') }}:
name: WinDevPool-L
name: SHINE-INT-L
timeoutInMinutes: 120
strategy:
maxParallel: 10

View File

@@ -1,7 +1,7 @@
parameters:
configuration: 'Release'
platform: ''
additionalBuildArguments: '-m'
additionalBuildArguments: '/p:RestorePackagesConfig=true -m'
jobs:
- job: Build${{ parameters.platform }}${{ parameters.configuration }}
@@ -10,7 +10,7 @@ jobs:
BuildConfiguration: ${{ parameters.configuration }}
BuildPlatform: ${{ parameters.platform }}
pool:
name: WinDevPool-L
name: SHINE-INT-L
timeoutInMinutes: 120
strategy:
maxParallel: 10

View File

@@ -55,21 +55,9 @@ steps:
packageType: sdk
version: '7.x'
- task: NuGetToolInstaller@1
displayName: Ensure NuGet Installer
- task: VisualStudioTestPlatformInstaller@1
displayName: Ensure VSTest Platform
- task: NuGetCommand@2
displayName: Restore NuGet packages for PowerToys.sln
inputs:
command: restore
feedsToUse: config
configPath: NuGet.config
restoreSolution: PowerToys.sln
restoreDirectory: '$(Build.SourcesDirectory)\packages'
- task: VSBuild@1
displayName: 'Build PowerToys.sln'
inputs:
@@ -77,18 +65,9 @@ steps:
vsVersion: 17.0
platform: '$(BuildPlatform)'
configuration: '$(BuildConfiguration)'
msbuildArgs: ${{ parameters.additionalBuildArguments }}
msbuildArgs: -restore ${{ parameters.additionalBuildArguments }}
maximumCpuCount: true
- task: NuGetCommand@2
displayName: Restore NuGet packages for BugReportTool.sln
inputs:
command: restore
feedsToUse: config
configPath: NuGet.config
restoreSolution: tools\BugReportTool\BugReportTool.sln
restoreDirectory: '$(Build.SourcesDirectory)\tools\BugReportTool\packages'
- task: VSBuild@1
displayName: 'Build BugReportTool.sln'
inputs:
@@ -96,18 +75,9 @@ steps:
vsVersion: 17.0
platform: '$(BuildPlatform)'
configuration: '$(BuildConfiguration)'
msbuildArgs: ${{ parameters.additionalBuildArguments }}
msbuildArgs: -restore ${{ parameters.additionalBuildArguments }}
maximumCpuCount: true
- task: NuGetCommand@2
displayName: Restore NuGet packages for WebcamReportTool.sln
inputs:
command: restore
feedsToUse: config
configPath: NuGet.config
restoreSolution: tools\WebcamReportTool\WebcamReportTool.sln
restoreDirectory: '$(Build.SourcesDirectory)\tools\WebcamReportTool\packages'
- task: VSBuild@1
displayName: 'Build WebcamReportTool.sln'
inputs:
@@ -115,18 +85,9 @@ steps:
vsVersion: 17.0
platform: '$(BuildPlatform)'
configuration: '$(BuildConfiguration)'
msbuildArgs: ${{ parameters.additionalBuildArguments }}
msbuildArgs: -restore ${{ parameters.additionalBuildArguments }}
maximumCpuCount: true
- task: NuGetCommand@2
displayName: Restore NuGet packages for StylesReportTool.sln
inputs:
command: restore
feedsToUse: config
configPath: NuGet.config
restoreSolution: tools\StylesReportTool\StylesReportTool.sln
restoreDirectory: '$(Build.SourcesDirectory)\tools\StylesReportTool\packages'
- task: VSBuild@1
displayName: 'Build StylesReportTool.sln'
inputs:
@@ -134,18 +95,9 @@ steps:
vsVersion: 17.0
platform: '$(BuildPlatform)'
configuration: '$(BuildConfiguration)'
msbuildArgs: ${{ parameters.additionalBuildArguments }}
msbuildArgs: -restore ${{ parameters.additionalBuildArguments }}
maximumCpuCount: true
- task: NuGetCommand@2
displayName: Restore NuGet packages for PowerToysSetup.sln
inputs:
command: restore
feedsToUse: config
configPath: NuGet.config
restoreSolution: installer\PowerToysSetup.sln
restoreDirectory: '$(Build.SourcesDirectory)\installer\packages'
- task: PowerShell@2
displayName: Download and install WiX 3.14 development build
inputs:
@@ -159,7 +111,7 @@ steps:
vsVersion: 17.0
platform: '$(BuildPlatform)'
configuration: '$(BuildConfiguration)'
msbuildArgs: /t:PowerToysInstaller ${{ parameters.additionalBuildArguments }}
msbuildArgs: /t:PowerToysInstaller -restore ${{ parameters.additionalBuildArguments }}
maximumCpuCount: true
- task: VSBuild@1
@@ -180,15 +132,6 @@ steps:
script: git clean -xfd -e *exe -- .\installer\
pwsh: true
- task: NuGetCommand@2
displayName: Restore NuGet packages for PowerToysSetup.sln
inputs:
command: restore
feedsToUse: config
configPath: NuGet.config
restoreSolution: installer\PowerToysSetup.sln
restoreDirectory: '$(Build.SourcesDirectory)\installer\packages'
- task: VSBuild@1
displayName: 'Build PowerToys per-user MSI'
inputs:
@@ -196,7 +139,7 @@ steps:
vsVersion: 17.0
platform: '$(BuildPlatform)'
configuration: '$(BuildConfiguration)'
msbuildArgs: /t:PowerToysInstaller ${{ parameters.additionalBuildArguments }} /p:PerUser=true
msbuildArgs: /t:PowerToysInstaller -restore ${{ parameters.additionalBuildArguments }} /p:PerUser=true
maximumCpuCount: true
- task: VSBuild@1

View File

@@ -18,7 +18,7 @@ steps:
inputs:
solution: "**/installer/PowerToysSetup.sln"
vsVersion: 17.0
msbuildArgs: /p:CIBuild=true /bl:$(Build.SourcesDirectory)\msbuild.binlog /t:PowerToysSetupCustomActions /p:RunBuildEvents=true /p:PerUser=${{parameters.perUserArg}}
msbuildArgs: -restore /p:RestorePackagesConfig=true /p:RestoreConfigFile="$(Build.SourcesDirectory)\.pipelines\release-nuget.config" /p:CIBuild=true /bl:$(Build.SourcesDirectory)\msbuild.binlog /t:PowerToysSetupCustomActions /p:RunBuildEvents=true /p:PerUser=${{parameters.perUserArg}}
platform: $(BuildPlatform)
configuration: $(BuildConfiguration)
clean: true

View File

@@ -3,8 +3,8 @@ trigger: none
pr: none
pool:
name: WinDevPool-L
demands: ImageOverride -equals WinDevVS17-latest
name: SHINE-INT-L
demands: ImageOverride -equals SHINE-VS17-Latest
parameters:
- name: buildConfigurations
@@ -71,7 +71,7 @@ jobs:
packageType: sdk
version: '7.x'
- task: NuGetAuthenticate@0
- task: NuGetAuthenticate@1
- task: NuGetToolInstaller@1
displayName: Use NuGet Installer latest
@@ -82,14 +82,6 @@ jobs:
# - Webcam report tool
# - Installer
# - Bootstrapper Installer
- task: NuGetCommand@2
displayName: NuGet restore solutions dependencies
inputs:
command: restore
restoreSolution: '**/*.sln'
selectOrConfig: config
nugetConfigPath: .pipelines/release-nuget.config
- task: PowerShell@2
displayName: Download and install WiX 3.14 development build
inputs:
@@ -136,7 +128,7 @@ jobs:
inputs:
solution: '**\PowerToys.sln'
vsVersion: 17.0
msbuildArgs: /p:CIBuild=true /bl:$(Build.SourcesDirectory)\msbuild.binlog
msbuildArgs: -restore /p:RestorePackagesConfig=true /p:RestoreConfigFile="$(Build.SourcesDirectory)\.pipelines\release-nuget.config" /p:CIBuild=true /bl:$(Build.SourcesDirectory)\msbuild.binlog
platform: $(BuildPlatform)
configuration: $(BuildConfiguration)
clean: true
@@ -147,7 +139,7 @@ jobs:
inputs:
solution: '**/tools/BugReportTool/BugReportTool.sln'
vsVersion: 17.0
msbuildArgs: /p:CIBuild=true /bl:$(Build.SourcesDirectory)\msbuild.binlog
msbuildArgs: -restore /p:RestorePackagesConfig=true /p:RestoreConfigFile="$(Build.SourcesDirectory)\.pipelines\release-nuget.config" /p:CIBuild=true /bl:$(Build.SourcesDirectory)\msbuild.binlog
platform: $(BuildPlatform)
configuration: $(BuildConfiguration)
clean: true
@@ -158,7 +150,7 @@ jobs:
inputs:
solution: '**/tools/WebcamReportTool/WebcamReportTool.sln'
vsVersion: 17.0
msbuildArgs: /p:CIBuild=true /bl:$(Build.SourcesDirectory)\msbuild.binlog
msbuildArgs: -restore /p:RestorePackagesConfig=true /p:RestoreConfigFile="$(Build.SourcesDirectory)\.pipelines\release-nuget.config" /p:CIBuild=true /bl:$(Build.SourcesDirectory)\msbuild.binlog
platform: $(BuildPlatform)
configuration: $(BuildConfiguration)
clean: true
@@ -169,7 +161,7 @@ jobs:
inputs:
solution: '**/tools/StylesReportTool/StylesReportTool.sln'
vsVersion: 17.0
msbuildArgs: /p:CIBuild=true /bl:$(Build.SourcesDirectory)\msbuild.binlog
msbuildArgs: -restore /p:RestorePackagesConfig=true /p:RestoreConfigFile="$(Build.SourcesDirectory)\.pipelines\release-nuget.config" /p:CIBuild=true /bl:$(Build.SourcesDirectory)\msbuild.binlog
platform: $(BuildPlatform)
configuration: $(BuildConfiguration)
clean: true
@@ -397,14 +389,6 @@ jobs:
script: git clean -xfd -e *exe -- .\installer\
pwsh: true
- task: NuGetCommand@2
displayName: NuGet restore solutions dependencies
inputs:
command: restore
restoreSolution: 'installer/*.sln'
selectOrConfig: config
nugetConfigPath: .pipelines/release-nuget.config
- template: installer-steps.yml
parameters:
versionNumber: ${{ parameters.versionNumber }}

View File

@@ -14,6 +14,7 @@ $versionExceptions = @(
"Microsoft.Windows.ApplicationModel.WindowsAppRuntime.Projection.dll",
"Microsoft.Windows.AppLifecycle.Projection.dll",
"Microsoft.Windows.System.Power.Projection.dll",
"Microsoft.Windows.Widgets.Providers.Projection.dll",
"Microsoft.WindowsAppRuntime.Bootstrap.Net.dll",
"Microsoft.Xaml.Interactions.dll",
"Microsoft.Xaml.Interactivity.dll",

View File

@@ -107,6 +107,10 @@ Randy contributed Registry Preview and some very early conversations about keybo
Find My Mouse is based on Raymond Chen's SuperSonar.
### [@robmikh](https://github.com/robmikh) - Robert Mikhayelyan
Crop And Lock is based on the original work of Robert Mikhayelyan, with Program Manager support from [@kevinguo305](https://github.com/kevinguo305) - Kevin Guo.
### Microsoft InVEST team
This amazing team helped PowerToys develop PowerToys Run and Keyboard manager as well as update our Settings to v2. @alekhyareddy28, @arjunbalgovind, @jyuwono @laviusmotileng-ms, @ryanbodrug-microsoft, @saahmedm, @somil55, @traies, @udit3333
@@ -152,8 +156,7 @@ Other contributors:
- [@cinnamon-msft](https://github.com/cinnamon-msft) - Kayla Cinnamon - Product Manager
- [@jaimecbernardo](https://github.com/jaimecbernardo) - Jaime Bernardo - Dev lead
- [@donlaci](https://github.com/donlaci) - Laszlo Nemeth - Dev
- [@gokcekantarci](https://github.com/gokcekantarci) - Gokce Kantarci - Dev
- [@SeraphimaZykova](https://github.com/SeraphimaZykova) - Seraphima Zykova - Dev
- [@sosssego](https://github.com/sosssego) - Frederico Moron - Dev
- [@stefansjfw](https://github.com/stefansjfw) - Stefan Markovic - Dev
- [@taras-janea](https://github.com/taras-janea) - Taras Sich - Dev
- [@yuyoyuppe](https://github.com/yuyoyuppe) - Andrey Nekrasov - Dev

View File

@@ -4,11 +4,16 @@
</PropertyGroup>
<ItemGroup>
<PackageVersion Include="Appium.WebDriver" Version="4.2.1" />
<PackageVersion Include="CommunityToolkit.Labs.WinUI.SettingsControls" Version="0.0.18" />
<PackageVersion Include="CommunityToolkit.Mvvm" Version="8.2.0" />
<PackageVersion Include="CommunityToolkit.WinUI.UI" Version="7.1.2" />
<PackageVersion Include="CommunityToolkit.WinUI.UI.Animations" Version="7.1.2" />
<PackageVersion Include="CommunityToolkit.WinUI.UI.Controls" Version="7.1.2" />
<PackageVersion Include="CommunityToolkit.WinUI.Animations" Version="8.0.230907" />
<PackageVersion Include="CommunityToolkit.WinUI.Controls.Primitives" Version="8.0.230907" />
<PackageVersion Include="CommunityToolkit.WinUI.Controls.SettingsControls" Version="8.0.230907" />
<PackageVersion Include="CommunityToolkit.WinUI.Controls.Sizers" Version="8.0.230907" />
<PackageVersion Include="CommunityToolkit.WinUI.Collections " Version="8.0.230907" />
<PackageVersion Include="CommunityToolkit.WinUI.Converters" Version="8.0.230907" />
<PackageVersion Include="CommunityToolkit.WinUI.Extensions" Version="8.0.230907" />
<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="coverlet.collector" Version="1.3.0" />
<PackageVersion Include="DotNetSeleniumExtras.WaitHelpers" Version="3.11.0" />
@@ -26,22 +31,22 @@
<PackageVersion Include="Microsoft.Extensions.Logging" Version="7.0.0" />
<PackageVersion Include="Microsoft.Extensions.Hosting" Version="7.0.1" />
<PackageVersion Include="Microsoft.Extensions.Hosting.WindowsServices" Version="7.0.0" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.4.1" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.6.3" />
<PackageVersion Include="Microsoft.Toolkit.Uwp.Notifications" Version="7.1.2" />
<PackageVersion Include="Microsoft.Web.WebView2" Version="1.0.1722.45" />
<PackageVersion Include="Microsoft.Windows.Compatibility" Version="7.0.3" />
<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.3" />
<PackageVersion Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.22621.755" />
<PackageVersion Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.22621.756" />
<PackageVersion Include="Microsoft.Windows.SDK.Contracts" Version="10.0.19041.1" />
<PackageVersion Include="Microsoft.WindowsAppSDK" Version="1.3.230502000" />
<PackageVersion Include="Microsoft.WindowsAppSDK" Version="1.4.230913002" />
<PackageVersion Include="Microsoft.Xaml.Behaviors.WinUI.Managed" Version="2.0.9" />
<PackageVersion Include="Microsoft.Xaml.Behaviors.Wpf" Version="1.1.39" />
<PackageVersion Include="ModernWpfUI" Version="0.9.4" />
<PackageVersion Include="Moq" Version="4.18.3" />
<PackageVersion Include="MSTest.TestAdapter" Version="3.0.1" />
<PackageVersion Include="MSTest.TestFramework" Version="3.0.1" />
<PackageVersion Include="Moq" Version="4.18.4" />
<PackageVersion Include="MSTest.TestAdapter" Version="3.1.1" />
<PackageVersion Include="MSTest.TestFramework" Version="3.1.1" />
<PackageVersion Include="Newtonsoft.Json" Version="13.0.1" />
<PackageVersion Include="NLog" Version="5.0.4" />
<PackageVersion Include="NLog.Extensions.Logging" Version="5.0.4" />
@@ -49,7 +54,7 @@
<PackageVersion Include="ScipBe.Common.Office.OneNote" Version="3.0.1" />
<PackageVersion Include="SharpCompress" Version="0.33.0" />
<PackageVersion Include="StreamJsonRpc" Version="2.14.24" />
<PackageVersion Include="StyleCop.Analyzers" Version="1.2.0-beta.435" />
<PackageVersion Include="StyleCop.Analyzers" Version="1.2.0-beta.507" />
<PackageVersion Include="System.CommandLine" Version="2.0.0-beta4.22272.1" />
<PackageVersion Include="System.ComponentModel.Composition" Version="7.0.0" />
<PackageVersion Include="System.Configuration.ConfigurationManager" Version="6.0.0" />
@@ -66,10 +71,11 @@
<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-preview.4" />
</ItemGroup>
<ItemGroup Condition="'$(IsExperimentationLive)'!=''">
<!-- Additional dependencies used by experimentation -->
<PackageVersion Include="Microsoft.VariantAssignment.Client" Version="2.4.17140001" />
<PackageVersion Include="Microsoft.VariantAssignment.Contract" Version="3.0.16990001" />
</ItemGroup>
</Project>
</Project>

View File

@@ -67,6 +67,34 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
### The Quite OK Image Format reference decoder
**Source**: https://github.com/phoboslab/qoi
**Note**: [@pedrolamas](https://github.com/pedrolamas) translated and adapted the reference decoder code to C# that is in PowerToys from the original C++ implementation.
MIT License
Copyright (c) 2022 Dominic Szablewski
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
## Utility: ImageResizer
### Brice Lams's Image Resizer License
@@ -281,11 +309,16 @@ SOFTWARE.
## NuGet Packages used by PowerToys
- CommunityToolkit.Labs.WinUI.SettingsControls 0.0.18
- CommunityToolkit.Mvvm 8.2.0
- CommunityToolkit.WinUI.UI 7.1.2
- CommunityToolkit.WinUI.UI.Animations 7.1.2
- CommunityToolkit.WinUI.UI.Controls 7.1.2
- CommunityToolkit.WinUI.Animations 8.0.230907
- CommunityToolkit.WinUI.Collections 8.0.230907
- CommunityToolkit.WinUI.Controls.Primitives 8.0.230907
- CommunityToolkit.WinUI.Controls.SettingsControls 8.0.230907
- CommunityToolkit.WinUI.Controls.Sizers 8.0.230907
- CommunityToolkit.WinUI.Converters 8.0.230907
- CommunityToolkit.WinUI.Extensions 8.0.230907
- CommunityToolkit.WinUI.UI.Controls.DataGrid 7.1.2
- CommunityToolkit.WinUI.UI.Controls.Markdown 7.1.2
- ControlzEx 6.0.0
- HelixToolkit 2.20.2
- HelixToolkit.Core.Wpf 2.20.2
@@ -296,32 +329,31 @@ SOFTWARE.
- Markdig.Signed 0.27.0
- Microsoft.CodeAnalysis.NetAnalyzers 7.0.3
- Microsoft.Data.Sqlite 7.0.0
- Microsoft.DotNet.UpgradeAssistant.Extensions.Default.Analyzers 0.4.336902
- Microsoft.Extensions.DependencyInjection 7.0.0
- Microsoft.Extensions.Hosting 7.0.1
- Microsoft.Extensions.Hosting.WindowsServices 7.0.0
- Microsoft.Extensions.Logging 7.0.0
- Microsoft.NET.Test.Sdk 17.4.1
- Microsoft.NET.Test.Sdk 17.6.3
- Microsoft.Toolkit.Uwp.Notifications 7.1.2
- Microsoft.Web.WebView2 1.0.1722.45
- Microsoft.Windows.Compatibility 7.0.3
- Microsoft.Windows.CsWin32 0.2.46-beta
- Microsoft.Windows.CsWinRT 2.0.3
- Microsoft.Windows.SDK.BuildTools 10.0.22621.755
- Microsoft.Windows.SDK.BuildTools 10.0.22621.756
- Microsoft.Windows.SDK.Contracts 10.0.19041.1
- Microsoft.WindowsAppSDK 1.3.230502000
- Microsoft.WindowsAppSDK 1.4.230913002
- Microsoft.Xaml.Behaviors.WinUI.Managed 2.0.9
- Microsoft.Xaml.Behaviors.Wpf 1.1.39
- ModernWpfUI 0.9.4
- Moq 4.18.3
- MSTest.TestAdapter 3.0.1
- MSTest.TestFramework 3.0.1
- Moq 4.18.4
- MSTest.TestAdapter 3.1.1
- MSTest.TestFramework 3.1.1
- NLog.Extensions.Logging 5.0.4
- NLog.Schema 5.0.4
- ScipBe.Common.Office.OneNote 3.0.1
- SharpCompress 0.33.0
- StreamJsonRpc 2.14.24
- StyleCop.Analyzers 1.2.0-beta.435
- StyleCop.Analyzers 1.2.0-beta.507
- System.CommandLine 2.0.0-beta4.22272.1
- System.ComponentModel.Composition 7.0.0
- System.Configuration.ConfigurationManager 6.0.0
@@ -338,4 +370,5 @@ SOFTWARE.
- Vanara.PInvoke.Shell32 3.4.11
- Vanara.PInvoke.User32 3.4.11
- WinUIEx 2.2.0
- WPF-UI 3.0.0-preview.4

View File

@@ -281,6 +281,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "utils", "utils", "{B39DC643
src\common\utils\logger_helper.h = src\common\utils\logger_helper.h
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\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
@@ -530,6 +531,12 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Community.PowerToys.Run.Plu
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Community.PowerToys.Run.Plugin.ValueGenerator.UnitTests", "src\modules\launcher\Plugins\Community.PowerToys.Run.Plugin.ValueGenerator.UnitTests\Community.PowerToys.Run.Plugin.ValueGenerator.UnitTests.csproj", "{90F9FA90-2C20-4004-96E6-F3B78151F5A5}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "CropAndLock", "CropAndLock", "{3B227528-4BA6-4CAF-B44A-A10C78A64849}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CropAndLock", "src\modules\CropAndLock\CropAndLock\CropAndLock.vcxproj", "{F5E1146E-B7B3-4E11-85FD-270A500BD78C}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CropAndLockModuleInterface", "src\modules\CropAndLock\CropAndLockModuleInterface\CropAndLockModuleInterface.vcxproj", "{3157FA75-86CF-4EE2-8F62-C43F776493C6}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|ARM64 = Debug|ARM64
@@ -2276,6 +2283,30 @@ Global
{90F9FA90-2C20-4004-96E6-F3B78151F5A5}.Release|x64.Build.0 = Release|x64
{90F9FA90-2C20-4004-96E6-F3B78151F5A5}.Release|x86.ActiveCfg = Release|x64
{90F9FA90-2C20-4004-96E6-F3B78151F5A5}.Release|x86.Build.0 = Release|x64
{F5E1146E-B7B3-4E11-85FD-270A500BD78C}.Debug|ARM64.ActiveCfg = Debug|ARM64
{F5E1146E-B7B3-4E11-85FD-270A500BD78C}.Debug|ARM64.Build.0 = Debug|ARM64
{F5E1146E-B7B3-4E11-85FD-270A500BD78C}.Debug|x64.ActiveCfg = Debug|x64
{F5E1146E-B7B3-4E11-85FD-270A500BD78C}.Debug|x64.Build.0 = Debug|x64
{F5E1146E-B7B3-4E11-85FD-270A500BD78C}.Debug|x86.ActiveCfg = Debug|x64
{F5E1146E-B7B3-4E11-85FD-270A500BD78C}.Debug|x86.Build.0 = Debug|x64
{F5E1146E-B7B3-4E11-85FD-270A500BD78C}.Release|ARM64.ActiveCfg = Release|ARM64
{F5E1146E-B7B3-4E11-85FD-270A500BD78C}.Release|ARM64.Build.0 = Release|ARM64
{F5E1146E-B7B3-4E11-85FD-270A500BD78C}.Release|x64.ActiveCfg = Release|x64
{F5E1146E-B7B3-4E11-85FD-270A500BD78C}.Release|x64.Build.0 = Release|x64
{F5E1146E-B7B3-4E11-85FD-270A500BD78C}.Release|x86.ActiveCfg = Release|x64
{F5E1146E-B7B3-4E11-85FD-270A500BD78C}.Release|x86.Build.0 = Release|x64
{3157FA75-86CF-4EE2-8F62-C43F776493C6}.Debug|ARM64.ActiveCfg = Debug|ARM64
{3157FA75-86CF-4EE2-8F62-C43F776493C6}.Debug|ARM64.Build.0 = Debug|ARM64
{3157FA75-86CF-4EE2-8F62-C43F776493C6}.Debug|x64.ActiveCfg = Debug|x64
{3157FA75-86CF-4EE2-8F62-C43F776493C6}.Debug|x64.Build.0 = Debug|x64
{3157FA75-86CF-4EE2-8F62-C43F776493C6}.Debug|x86.ActiveCfg = Debug|x64
{3157FA75-86CF-4EE2-8F62-C43F776493C6}.Debug|x86.Build.0 = Debug|x64
{3157FA75-86CF-4EE2-8F62-C43F776493C6}.Release|ARM64.ActiveCfg = Release|ARM64
{3157FA75-86CF-4EE2-8F62-C43F776493C6}.Release|ARM64.Build.0 = Release|ARM64
{3157FA75-86CF-4EE2-8F62-C43F776493C6}.Release|x64.ActiveCfg = Release|x64
{3157FA75-86CF-4EE2-8F62-C43F776493C6}.Release|x64.Build.0 = Release|x64
{3157FA75-86CF-4EE2-8F62-C43F776493C6}.Release|x86.ActiveCfg = Release|x64
{3157FA75-86CF-4EE2-8F62-C43F776493C6}.Release|x86.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -2467,6 +2498,9 @@ Global
{500DED3E-CFB5-4ED5-ACC6-02B3D6DC336D} = {4AFC9975-2456-4C70-94A4-84073C1CED93}
{D095BE44-1F2E-463E-A494-121892A75EA2} = {4AFC9975-2456-4C70-94A4-84073C1CED93}
{90F9FA90-2C20-4004-96E6-F3B78151F5A5} = {4AFC9975-2456-4C70-94A4-84073C1CED93}
{3B227528-4BA6-4CAF-B44A-A10C78A64849} = {4574FDD0-F61D-4376-98BF-E5A1262C11EC}
{F5E1146E-B7B3-4E11-85FD-270A500BD78C} = {3B227528-4BA6-4CAF-B44A-A10C78A64849}
{3157FA75-86CF-4EE2-8F62-C43F776493C6} = {3B227528-4BA6-4CAF-B44A-A10C78A64849}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {C3A2F9D1-7930-4EF4-A6FC-7EE0A99821D0}

254
README.md
View File

@@ -18,12 +18,13 @@ Microsoft PowerToys is a set of utilities for power users to tune and streamline
| | Current utilities: | |
|--------------|--------------------|--------------|
| [Always on Top](https://aka.ms/PowerToysOverview_AoT) | [PowerToys Awake](https://aka.ms/PowerToysOverview_Awake) | [Color Picker](https://aka.ms/PowerToysOverview_ColorPicker) |
| [FancyZones](https://aka.ms/PowerToysOverview_FancyZones) | [File Explorer Add-ons](https://aka.ms/PowerToysOverview_FileExplorerAddOns) | [File Locksmith](https://aka.ms/PowerToysOverview_FileLocksmith) |
| [Hosts File Editor](https://aka.ms/PowerToysOverview_HostsFileEditor) | [Image Resizer](https://aka.ms/PowerToysOverview_ImageResizer) | [Keyboard Manager](https://aka.ms/PowerToysOverview_KeyboardManager) |
| [Mouse utilities](https://aka.ms/PowerToysOverview_MouseUtilities) | [Mouse Without Borders](https://aka.ms/PowerToysOverview_MouseWithoutBorders) | [Peek](https://aka.ms/PowerToysOverview_Peek) |
| [Paste as Plain Text](https://aka.ms/PowerToysOverview_PastePlain) | [PowerRename](https://aka.ms/PowerToysOverview_PowerRename) | [PowerToys Run](https://aka.ms/PowerToysOverview_PowerToysRun) |
| [Quick Accent](https://aka.ms/PowerToysOverview_QuickAccent) | [Registry Preview](https://aka.ms/PowerToysOverview_RegistryPreview) | [Screen Ruler](https://aka.ms/PowerToysOverview_ScreenRuler) |
| [Shortcut Guide](https://aka.ms/PowerToysOverview_ShortcutGuide) | [Text Extractor](https://aka.ms/PowerToysOverview_TextExtractor) | [Video Conference Mute](https://aka.ms/PowerToysOverview_VideoConference) |
| [Crop And Lock](https://aka.ms/PowerToysOverview_CropAndLock) | [FancyZones](https://aka.ms/PowerToysOverview_FancyZones) | [File Explorer Add-ons](https://aka.ms/PowerToysOverview_FileExplorerAddOns) |
| [File Locksmith](https://aka.ms/PowerToysOverview_FileLocksmith) | [Hosts File Editor](https://aka.ms/PowerToysOverview_HostsFileEditor) | [Image Resizer](https://aka.ms/PowerToysOverview_ImageResizer) |
| [Keyboard Manager](https://aka.ms/PowerToysOverview_KeyboardManager) | [Mouse utilities](https://aka.ms/PowerToysOverview_MouseUtilities) | [Mouse Without Borders](https://aka.ms/PowerToysOverview_MouseWithoutBorders) |
| [Peek](https://aka.ms/PowerToysOverview_Peek) | [Paste as Plain Text](https://aka.ms/PowerToysOverview_PastePlain) | [PowerRename](https://aka.ms/PowerToysOverview_PowerRename) |
| [PowerToys Run](https://aka.ms/PowerToysOverview_PowerToysRun) | [Quick Accent](https://aka.ms/PowerToysOverview_QuickAccent) | [Registry Preview](https://aka.ms/PowerToysOverview_RegistryPreview) |
| [Screen Ruler](https://aka.ms/PowerToysOverview_ScreenRuler) | [Shortcut Guide](https://aka.ms/PowerToysOverview_ShortcutGuide) | [Text Extractor](https://aka.ms/PowerToysOverview_TextExtractor) |
| [Video Conference Mute](https://aka.ms/PowerToysOverview_VideoConference) |
## Installing and running Microsoft PowerToys
@@ -35,20 +36,22 @@ Microsoft PowerToys is a set of utilities for power users to tune and streamline
### Via GitHub with EXE [Recommended]
Go to [Microsoft PowerToys GitHub releases page][github-release-link], click on `Assets` at the bottom to show the files available in the release. Please use the appropriate PowerToys installer that matches your machine's architecture and install scope. For most, it is `x64` and per-user.
Go to the [Microsoft PowerToys GitHub releases page][github-release-link] and click on `Assets` at the bottom to show the files available in the release. Please use the appropriate PowerToys installer that matches your machine's architecture and install scope. For most, it is `x64` and per-user.
[github-current-release-work]: https://github.com/microsoft/PowerToys/issues?q=issue+project%3Amicrosoft%2FPowerToys%2F44
[ptUserX64]: https://github.com/microsoft/PowerToys/releases/download/v0.71.0/PowerToysUserSetup-0.71.0-x64.exe
[ptUserArm64]: https://github.com/microsoft/PowerToys/releases/download/v0.71.0/PowerToysUserSetup-0.71.0-arm64.exe
[ptMachineX64]: https://github.com/microsoft/PowerToys/releases/download/v0.71.0/PowerToysSetup-0.71.0-x64.exe
[ptMachineArm64]: https://github.com/microsoft/PowerToys/releases/download/v0.71.0/PowerToysSetup-0.71.0-arm64.exe
<!-- items that need to be updated release to release -->
[github-next-release-work]: https://github.com/microsoft/PowerToys/issues?q=project%3Amicrosoft%2FPowerToys%2F48
[github-current-release-work]: https://github.com/microsoft/PowerToys/issues?q=project%3Amicrosoft%2FPowerToys%2F47
[ptUserX64]: https://github.com/microsoft/PowerToys/releases/download/v0.74.0/PowerToysUserSetup-0.74.0-x64.exe
[ptUserArm64]: https://github.com/microsoft/PowerToys/releases/download/v0.74.0/PowerToysUserSetup-0.74.0-arm64.exe
[ptMachineX64]: https://github.com/microsoft/PowerToys/releases/download/v0.74.0/PowerToysSetup-0.74.0-x64.exe
[ptMachineArm64]: https://github.com/microsoft/PowerToys/releases/download/v0.74.0/PowerToysSetup-0.74.0-arm64.exe
| Description | Filename | sha256 hash |
|----------------|----------|-------------|
| Per user - x64 | [PowerToysUserSetup-0.71.0-x64.exe][ptUserX64] | 4C6CCB3055E3838DA50FF529A670BAAD129570F4BFABF497B5D92259D3052794 |
| Per user - ARM64 | [PowerToysUserSetup-0.71.0-arm64.exe][ptUserArm64] | 48633758DFBB99DE34BA2D3E3F294A60EF7E01015296D29A884251068B6FE3F6 |
| Machine wide - x64 | [PowerToysSetup-0.71.0-x64.exe][ptMachineX64] | 44F092DFAC002536A27ABC701750D8C78FF30F8879768990BC4A0AFD0D5119F1 |
| Machine wide - ARM64 | [PowerToysSetup-0.71.0-arm64.exe][ptMachineArm64] | 283A67539EDA5D3AD88735C7B0150852ECB57D569BAC80396F942C60D6ACB33F |
| Per user - x64 | [PowerToysUserSetup-0.74.0-x64.exe][ptUserX64] | 1C4ECE9F11488BAFFAE6B76D2B0504FA18BFFEA11EBC38BCC87F5D86AEA87C7C |
| Per user - ARM64 | [PowerToysUserSetup-0.74.0-arm64.exe][ptUserArm64] | 4F3842FAB0839A361A15A06B7720BA8A0FE7F9AF98EA94245C08DEF37678CA4A |
| Machine wide - x64 | [PowerToysSetup-0.74.0-x64.exe][ptMachineX64] | 648992E8CEA08F3C63C7CCBD554ADDF500ECBC4560187310BC12E6CB9C2F38E3 |
| Machine wide - ARM64 | [PowerToysSetup-0.74.0-arm64.exe][ptMachineArm64] | 2B6D92F1A0EA688C7EE882050AC9B030C8B3A18765163FB6D67E5E694A4D4FE3 |
This is our preferred method.
@@ -74,13 +77,17 @@ winget install --scope machine Microsoft.PowerToys -s winget
There are [community driven install methods](./doc/unofficialInstallMethods.md) such as Chocolatey and Scoop. If these are your preferred install solutions, you can find the install instructions there.
## Third-Party Run Plugins
There is a collection of [third-party plugins](./doc/thirdPartyRunPlugins.md) created by the community that aren't distributed with PowerToys.
## Contributing
This project welcomes contributions of all types. Help spec'ing, design, documentation, finding bugs are ways everyone can help on top of coding features / bug fixes. We are excited to work with the power user community to build a set of tools for helping you get the most out of Windows.
This project welcomes contributions of all types. Besides coding features / bug fixes, other ways to assist include spec writing, design, documentation, and finding bugs. We are excited to work with the power user community to build a set of tools for helping you get the most out of Windows.
We ask that **before you start work on a feature that you would like to contribute**, please read our [Contributor's Guide](CONTRIBUTING.md). We will be happy to work with you to figure out the best approach, provide guidance and mentorship throughout feature development, and help avoid any wasted or duplicate effort.
We ask that **before you start work on a feature that you would like to contribute**, please read our [Contributor's Guide](CONTRIBUTING.md). We would be happy to work with you to figure out the best approach, provide guidance and mentorship throughout feature development, and help avoid any wasted or duplicate effort.
Most contributions require you to agree to a [Contributor License Agreement (CLA)][oss-CLA] declaring that you have the right to, and actually do, grant us the rights to use your contribution.
Most contributions require you to agree to a [Contributor License Agreement (CLA)][oss-CLA] declaring that you grant us the rights to use your contribution and that you have permission to do so.
For guidance on developing for PowerToys, please read the [developer docs](/doc/devdocs) for a detailed breakdown. This includes how to setup your computer to compile.
@@ -90,159 +97,158 @@ For guidance on developing for PowerToys, please read the [developer docs](/doc/
Our [prioritized roadmap][roadmap] of features and utilities that the core team is focusing on.
### 0.71 - June 2023 Update
### 0.74 - September 2023 Update
In this release, we focused on stability and improvements.
**Highlights**
- Support previewing archive files with Peek. Thanks [@davidegiacometti](https://github.com/davidegiacometti)!
- Fixed PT Run crash caused by missing App.Dark.png file.
- Added setting to set Registry Preview as default app for opening .reg files. Thanks [@randyrants](https://github.com/randyrants)!
- Modernized Settings app title bar and styling (Mica background material) to be inline with Windows 11 guidelines. Thanks [@niels9001](https://github.com/niels9001)!
- Upgraded to Windows App SDK 1.4.1, increasing stability of WinUI3 utilities. Thanks [@dongle-the-gadget](https://github.com/dongle-the-gadget) for starting the upgrade!
- Text Extractor was upgraded to its version 2.0, with a new overlay, table mode and more Quality of Life improvements. Thanks [@TheJoeFin](https://github.com/TheJoeFin)!
- Improved FancyZones stability, fixing some layout resets and improving handling of newly created windows on Windows 11.
- Fixed many silent crashes that were reported to Watson and the user's event viewer.
### General
- Fixed infinite loop issue caused by global event not being reset. (This was a hotfix for 0.70)
- Bump CommunityToolkit.Mvvm package version to 8.2.0. Thanks [@davidegiacometti](https://github.com/davidegiacometti)!
- Fixed issue causing runner lag by moving check for updates and running bug report logic to the background thread.
- Bump WinUIEx package version to 2.2. Thanks [@niels9001](https://github.com/niels9001)!
- Fixed issue causing Settings app crash when launching a second app process. Thanks [@BLM16](https://github.com/BLM16)!
- Fixed network errors when checking for updates on virtual machines.
- Bump Microsoft.CodeAnalysis.NetAnalyzers package version to 7.0.3. Thanks [@davidegiacometti](https://github.com/davidegiacometti)!
- Bump Microsoft.Windows.Compatibility package version to 7.0.3.
- Bump System.Management package version to 7.0.2.
- Fixed issue causing PowerToys to start with Below Normal priority on startup.
- Turning animations off in Windows Settings will now also turn them off in PowerToys.
- Upgraded the Windows App SDK dependency to 1.4.1. Thanks [@dongle-the-gadget](https://github.com/dongle-the-gadget) for the original 1.4.0 upgrade!
- Show in the thumbnail label and application titles when running as administrator. Thanks [@davidegiacometti](https://github.com/davidegiacometti)!
- Upgraded the Win UI Community Toolkit dependency to 8.0. Thanks [@niels9001](https://github.com/niels9001)!
### ColorPicker
### Awake
- Store color history in a separated file.
- Added down-sampled variants to the application's icon. Thanks [@morriscurtis](https://github.com/morriscurtis)!
### Color Picker
- After adding a new color in the editor, the history will scroll the new color into view. Thanks [@peerpalo](https://github.com/peerpalo)!
### Crop and Lock
- Fixed a Crop and Lock crash that would occur when trying to reparent a window crashes the target application. An error message is shown instead.
### FancyZones
- Added feature to use middle click to toggle multiple zones spanning. Thanks [@BasitAli](https://github.com/BasitAli)!
- Fixed issue causing zoning not to happen until the cursor is moved.
- Improved monitor identification logic to mitigate issues causing layout reset.
- Fixed issue where default layout was applied instead of blank layout.
### File Locksmith
- Added setting to show only in extended context menu.
- Set the process and main thread priority to normal.
- Fixed handling newly created windows on Windows 11.
- Fixed scenarios where opening the FancyZones Editor would reset the layouts.
### File Explorer add-ons
- Developer files preview support for .vsconfig, .sln, .vcproj, .vbproj, .fsproj and .vcxproj files. (This was a hotfix for 0.70)
- Developer files preview support .vbs, .inf, .gitconfig, .gitattributes and .editorconfig files. (This was a hotfix for 0.70) Thanks [@Aaron-Junker](https://github.com/Aaron-Junker)!
- Changed order of developer files preview` context menu items. Thanks [@Aaron-Junker](https://github.com/Aaron-Junker)!
- Developer files preview support for .gitignore files. (This was a hotfix for 0.70) Thanks [@Aaron-Junker](https://github.com/Aaron-Junker)!
- Fixed issue causing preview pane flickering on file selection and resizing. Thanks [@tanchekwei](https://github.com/tanchekwei)!
- Optimized CPU usage for generating SVG thumbnails.
- Improved handling of Gcode Thumbnails, including JPG and QOI formats. Thanks [@pedrolamas](https://github.com/pedrolamas)!
- Better handled errors when sending telemetry, which were causing reported crashes.
- Fixed some thumbnails not being shown centered like before the optimization.
### Hosts
### File Locksmith
- Improved UX by adding keyboard shortcuts. Thanks [@davidegiacometti](https://github.com/davidegiacometti)!
- Added setting to select the file encoding. Thanks [@davidegiacometti](https://github.com/davidegiacometti)!
- Fixed parsing of commented lines with an address and host in the middle of the comment. Thanks [@davidegiacometti](https://github.com/davidegiacometti)!
- Fixed issue on adding first entry and improve empty hosts list UI. Thanks [@davidegiacometti](https://github.com/davidegiacometti)!
- Added logic to handle more than 9 hosts per entry (Windows limitation) by splitting them into separate entries. Thanks [@davidegiacometti](https://github.com/davidegiacometti)!
- Shows files opened by processes with PID greater than 65535. Thanks [@poke30744](https://github.com/poke30744)!
- Fixed a GDI object leak in the context menu which would crash Explorer.
### Find My Mouse
### ImageResizer
- Added new activation methods, including by hotkey. Thanks [@davidegiacometti](https://github.com/davidegiacometti)!
- Added Enter key event handler when setting width/height of the new custom size.
### Hosts File Editor
### Installer
- Ignore the default ACME sample entries in the hosts file. Thanks [@davidegiacometti](https://github.com/davidegiacometti)!
- Improved save error handling and added better error messages. Thanks [@davidegiacometti](https://github.com/davidegiacometti)!
- Corrected a check for an error when signaling the application to start as administrator.
- Refactored the context menu. Thanks [@davidegiacometti](https://github.com/davidegiacometti)!
- Fixed dialogs overlapping the title bar after the upgrade to Windows App SDK 1.4. Thanks [@davidegiacometti](https://github.com/davidegiacometti)!
- Fixed PowerToys Plugin installation. (This was a hotfix for 0.70) Thanks [@davidegiacometti](https://github.com/davidegiacometti)!
- Fixed issue causing missing Mouse Without Borders service after upgrade. (This was a hotfix for 0.70)
- Removed unneeded PT Run registry entries.
### Keyboard Manager
- Distinguish between the regular minus key and the numpad minus key.
### Mouse Without Borders
- Added Name2IP setting. (This was a hotfix for 0.70)
- Fixed device layout issues. (This was a hotfix for 0.70)
- Fixed hiding cursor at the top of the screen when "Hide mouse at the screen edge" is enabled. (This was a hotfix for 0.70)
- Fixed issue that was preventing OS going to sleep mode. (This was a hotfix for 0.70)
- Remove shortcut for deprecated VKMap functionality. (This was a hotfix for 0.70) Thanks [@dtaylor84](https://github.com/dtaylor84)!
- Make MWB work without service if service doesn't start properly. (This was a hotfix for 0.70)
- Fixed focus issue causing "Hide mouse at the screen edge" not to work properly. (This was a hotfix for 0.70)
- Fixed issue causing app to hijack shortcut keys if they are only partially matched.
- Fixed a crash when trying to restart the application.
### Peek
- Consume Ctrl+Space shortcut only if Desktop or Shell are in the foreground. (This was a hotfix for 0.70)
- Added feature to hide window with Esc key. (This was a hotfix for 0.70) Thanks [@davidegiacometti](https://github.com/davidegiacometti)!
- Added a setting to always run not-elevated (enabled by default). (This was a hotfix for 0.70)
- Support .vsconfig, .sln, .vcproj, .vbproj, .fsproj and .vcxproj files. (This was a hotfix for 0.70)
- Fixed blinking issue while loading developer files. (This was a hotfix for 0.70)
- Reset preview Source on Peek window close. (This was a hotfix for 0.70)
- Center Peek window on File Explorer activated monitor. (This was a hotfix for 0.70) Thanks [@SamChaps](https://github.com/SamChaps)!
- Fix previewing unsupported file types by using effective pixels. (This was a hotfix for 0.70) Thanks [@SamChaps](https://github.com/SamChaps)!
- Support .vbs, .inf, .gitconfig, .gitattributes and .editorconfig files. (This was a hotfix for 0.70) Thanks [@Aaron-Junker](https://github.com/Aaron-Junker)!
- Fixed memory leak by clearing generated thumbnails. (This was a hotfix for 0.70)
- Added setting to close on focus lost. (This was a hotfix for 0.70)
- Fixed crash when triggering Peek with no files being selected. (This was a hotfix for 0.70)
- Fixed setting Peek window as a foreground window. (This was a hotfix for 0.70)
- Fixed race condition causing low quality preview to be displayed even if high quality preview is present. (This was a hotfix for 0.70)
- Added support for .htm files.
- Fixed issue where title bar button colors were not update on Windows theme change.
- Added up/down arrow key item navigation. Thanks [@DanWiseProgramming](https://github.com/DanWiseProgramming)!
- Improved UX by defining minimum window size and adding tooltips for shown text. Thanks [@htcfreek](https://github.com/htcfreek)!
- Fixed crash on previewing internet shortcuts files.
- Support previewing archive files. Thanks [@davidegiacometti](https://github.com/davidegiacometti)!
- Using Peek on HTML files will show a white background by default, similar to a browser's default behavior.
- Fix a white flash on Dark theme when switching file and improved the development file preview detection and adjustments.
### PowerRename
- Fixed a crash caused by big counter values on the new enumeration method.
### PowerToys Run
- Fixed crash caused by non thread-safe Results update.
- Fixed crash caused by missing App.Dark.png
- Code cleanup and fixed possible crash caused by missing VS Code instance in VS Code plugin. Thanks [@davidegiacometti](https://github.com/davidegiacometti)!
- Fix environment helper for nested environment variables. Thanks [@htcfreek](https://github.com/htcfreek)!
- It's now possible to select which shell is used by the Shell plugin.
- A combobox option type was added to the plugin options.
- Fixed a bug in the Calculator plugin that was causing decimal numbers to be misinterpreted on locales where the dot (`.`) character isn't used as a decimal or digit separator.
- Improved the Program plugin stability when it fails to load a program's thumbnail at startup.
- The use of Pinyin for querying some plugins can now be turned on in Settings. Thanks [@ChaseKnowlden](https://github.com/ChaseKnowlden)!
- Refactored option types for plugin and added number, string and composite types to be used in the future. Thanks [@htcfreek](https://github.com/htcfreek)!
- Fixed the entry for searching for Windows updates in the Settings plugin. Thanks [@htcfreek](https://github.com/htcfreek)!
### Quick Accent
- Added multiplication and division signs. Thanks [@ailintom](https://github.com/ailintom)!
- Added opening exclamation mark to Catalan and Spanish language. Thanks [@Aaron-Junker](https://github.com/Aaron-Junker)!
- Added the section sign ("§", U+00A7). Thanks [@EikeJoo](https://github.com/EikeJoo)!
- Added accent units and more additional signs. Thanks [@WilkoLu](https://github.com/WilkoLu)!
- The "All languages" character set is now calculated by programmatically querying the characters for every available language. Thanks [@dannysummerlin](https://github.com/dannysummerlin)!
- Added é to the Norwegian and Swedish languages. Thanks [@Aaron-Junker](https://github.com/Aaron-Junker)!
- Added a runtime cache to the "All languages" character set, to only calculate accents once per key.
### Registry Preview
- Added setting to set the app as default app for opening .reg files. Thanks [@randyrants](https://github.com/randyrants)!
- Merge settings to single folder.
- Fixed issue of saving files without truncation. Thanks [@qwerty472123](https://github.com/qwerty472123)!
- Fixed focusing issues at startup.
- Improved the data visualization to show data in a similar way to the Windows Registry Editor. Thanks [@dillydylann](https://github.com/dillydylann)!
### Text Extractor
### Runner
- Various improvements and fixes. Thanks [@TheJoeFin](https://github.com/TheJoeFin)!
- Fixed hanging when a bug report was generated from the flyout. Thanks [@davidegiacometti](https://github.com/davidegiacometti)!
### Settings
- Styling fixes for Peek and Mouse Without Borders pages. (This was a hotfix for 0.70) Thanks [@niels9001](https://github.com/niels9001)!
- Fixed Mouse Without Borders machine connection status styling. (This was a hotfix for 0.70)
- Improved Mouse Without Border page Uninstall service UX when it is inaccessible. (This was a hotfix for 0.70)
- Updated File Explorer module screenshots and instructions to reflect the Windows 11 File Explorer. Thanks [@infinitepower18](https://github.com/infinitepower18)!
- Modernized the app title bar and styling (Mica background material) to be inline with Windows11 guidelines. Thanks [@niels9001](https://github.com/niels9001)!
- Improved error handling on settings backup failure.
- Added Reset button to shortcut control to reset activation shortcut to default value. Thanks [@Svenlaa](https://github.com/Svenlaa)!
- Improved Exclude apps setting for all modules to also detect apps by title.
- Improved the way the OOBE window reacts to Windows theme change.
- Fixed an issue that made it impossible to change the "Switch between windows in the current zone" "Next window" shortcut for FancyZones.
- Fixed a crash when entering a duplicate name for a color in the Color Picker page and improved clean up when cancelling a color edit. Thanks [@davidegiacometti](https://github.com/davidegiacometti)!
### Text Extractor
- Text Extractor 2.0, with a new overlay, table mode and more Quality of Life improvements. Thanks [@TheJoeFin](https://github.com/TheJoeFin)!
### Documentation
- SECURITY.md was updated from 0.0.2 to 0.0.9. Thanks [@Aaron-Junker](https://github.com/Aaron-Junker)!
- Improved the README and main development document for clarity and completeness. Thanks [@codeofdusk](https://github.com/codeofdusk) and [@aprilbbrockhoeft](https://github.com/aprilbbrockhoeft)!
### Development
- Added Peek and Mouse Without Borders to GitHub templates. (This was a hotfix for 0.70)
- Fixed the CI release pipelines winget package submission. (This was a hotfix for 0.70)
- Fixed process report and termination lists for Peek and Mouse Without Borders. (This was a hotfix for 0.70)
- Added Winget configuration file. (This was a hotfix for 0.70) Thanks [@ryfu-msft](https://github.com/ryfu-msft)!
- Fixed tests localization issues.
- Added Microsoft.VisualStudio.Component.VC.ATL library to .vsconfig.
- Onboarding to GitOps.ResourceManagement.
- Fixed PowerToys Run DateTime plugin tests that were failing depending on locale, so that they can be run correctly on all dev machines.
- Fixed PowerToys Run System plugin tests that were failing for certain network interfaces, so that they can be run correctly on all dev machines. Thanks [@snickler](https://github.com/snickler)!
- Fixed a markdown bug on the GitHub /helped command.
- Switched build pipelines to a new agent pool. Thanks [@DHowett](https://github.com/DHowett)!
- New .cs files created in Visual Studio get the header added automatically. Thanks [@davidegiacometti](https://github.com/davidegiacometti)!
#### What is being planned for version 0.72
#### What is being planned for version 0.75
For [v0.72][github-next-release-work], we'll work on below:
For [v0.75][github-next-release-work], we'll work on the items below:
- Adjustments on feedback / stability / bug fixes
- Modernize and refresh UX of PowerToys based on WPF
- Language selection
- .NET 8 upgrade
- Policy support for managing PowerToys Run plugins.
*Attention*: A breaking change is planned (for 0.75), in which each plugin has to declare its identifier programmatically so that it can be controlled through GPO. For third-party plugin developers, please check https://github.com/microsoft/PowerToys/pull/27468 for more details.
- New utility: Environment Variables Editor. Here's a Work in Progress preview:
![Environment Variables Editor WIP](https://github.com/microsoft/PowerToys/assets/26118718/f99532a8-5aae-481b-a662-19a95f4aa03d)
- New Settings homepage. Here's a Work in Progress preview:
![PowerToys Settings Dashboard WIP](https://github.com/microsoft/PowerToys/assets/26118718/938a5715-0a9b-4fe9-9e15-adfec92da694)
- Modernize and refresh the UX of PowerToys based on WPF. Here's Work in Progress previews for the modules "PowerToys Run" and "Color Picker":
![PowerToys Run UI refresh WIP](https://github.com/microsoft/PowerToys/assets/9866362/16903bcb-c18e-49fb-93ca-738b81957055)
![ColorPicker UI refresh WIP](https://github.com/microsoft/PowerToys/assets/9866362/ceebe54b-de63-4ce7-afcb-2cd4280bf4d1)
- Stability / bug fixes
## PowerToys Community
The PowerToys team is extremely grateful to have the [support of an amazing active community][community-link]. The work you do is incredibly important. PowerToys wouldnt be nearly what it is today without your help filing bugs, updating documentation, guiding the design, or writing features. We want to say thank you and take time to recognize your work. Month over month, you directly help make PowerToys a better piece of software.
The PowerToys team is extremely grateful to have the [support of an amazing active community][community-link]. The work you do is incredibly important. PowerToys wouldnt be nearly what it is today without your help filing bugs, updating documentation, guiding the design, or writing features. We want to say thank you and take time to recognize your work. Month by month, you directly help make PowerToys a better piece of software.
## Code of Conduct
@@ -263,7 +269,3 @@ The application logs basic telemetry. Our Telemetry Data page (Coming Soon) has
[vidConfOverview]: https://aka.ms/PowerToysOverview_VideoConference
[loc-bug]: https://github.com/microsoft/PowerToys/issues/new?assignees=&labels=&template=translation_issue.md&title=
[usingPowerToys-docs-link]: https://aka.ms/powertoys-docs
<!-- items that need to be updated release to release -->
[github-next-release-work]: https://github.com/microsoft/PowerToys/issues?q=is%3Aopen+is%3Aissue+project%3Amicrosoft%2FPowerToys%2F45
[github-current-release-work]: https://github.com/microsoft/PowerToys/issues?q=is%3Aopen+is%3Aissue+project%3Amicrosoft%2FPowerToys%2F44

View File

@@ -1,18 +1,18 @@
<!-- BEGIN MICROSOFT SECURITY.MD V0.0.2 BLOCK -->
<!-- BEGIN MICROSOFT SECURITY.MD V0.0.9 BLOCK -->
## Security
Microsoft takes the security of our software products and services seriously, which includes all source code repositories managed through our GitHub organizations, which include [Microsoft](https://github.com/Microsoft), [Azure](https://github.com/Azure), [DotNet](https://github.com/dotnet), [AspNet](https://github.com/aspnet), [Xamarin](https://github.com/xamarin), and [many more](https://opensource.microsoft.com/).
Microsoft takes the security of our software products and services seriously, which includes all source code repositories managed through our GitHub organizations, which include [Microsoft](https://github.com/Microsoft), [Azure](https://github.com/Azure), [DotNet](https://github.com/dotnet), [AspNet](https://github.com/aspnet) and [Xamarin](https://github.com/xamarin).
If you believe you have found a security vulnerability in any Microsoft-owned repository that meets Microsoft's [definition](https://docs.microsoft.com/en-us/previous-versions/tn-archive/cc751383(v=technet.10)) of a security vulnerability, please report it to us as described below.
If you believe you have found a security vulnerability in any Microsoft-owned repository that meets [Microsoft's definition of a security vulnerability](https://aka.ms/security.md/definition), please report it to us as described below.
## Reporting Security Issues
**Please do not report security vulnerabilities through public GitHub issues.**
Instead, please report them to the Microsoft Security Response Center (MSRC) at [https://msrc.microsoft.com/create-report](https://msrc.microsoft.com/create-report).
Instead, please report them to the Microsoft Security Response Center (MSRC) at [https://msrc.microsoft.com/create-report](https://aka.ms/security.md/msrc/create-report).
If you prefer to submit without logging in, send email to [secure@microsoft.com](mailto:secure@microsoft.com). If possible, encrypt your message with our PGP key; please download it from the [Microsoft Security Response Center PGP Key page](https://www.microsoft.com/en-us/msrc/pgp-key-msrc).
If you prefer to submit without logging in, send email to [secure@microsoft.com](mailto:secure@microsoft.com). If possible, encrypt your message with our PGP key; please download it from the [Microsoft Security Response Center PGP Key page](https://aka.ms/security.md/msrc/pgp).
You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Additional information can be found at [microsoft.com/msrc](https://www.microsoft.com/msrc).
@@ -28,7 +28,7 @@ Please include the requested information listed below (as much as you can provid
This information will help us triage your report more quickly.
If you are reporting for a bug bounty, more complete reports can contribute to a higher bounty award. Please visit our [Microsoft Bug Bounty Program](https://microsoft.com/msrc/bounty) page for more details about our active programs.
If you are reporting for a bug bounty, more complete reports can contribute to a higher bounty award. Please visit our [Microsoft Bug Bounty Program](https://aka.ms/security.md/msrc/bounty) page for more details about our active programs.
## Preferred Languages
@@ -36,6 +36,6 @@ We prefer all communications to be in English.
## Policy
Microsoft follows the principle of [Coordinated Vulnerability Disclosure](https://www.microsoft.com/en-us/msrc/cvd).
Microsoft follows the principle of [Coordinated Vulnerability Disclosure](https://aka.ms/security.md/cvd).
<!-- END MICROSOFT SECURITY.MD BLOCK -->

View File

@@ -1,12 +1,12 @@
# Keyboard Manager UI
## Table of Contents:
1. [C++ XAML Islands](#c---xaml-islands)
1. [C++ XAML Islands](#c-xaml-islands)
1. [Debugging exceptions in XAML Islands](#debugging-exceptions-in-xaml-islands)
2. [Build times](#build-times)
3. [Setting custom backgrounds for Xaml Controls using brushes](#setting-custom-backgrounds-for-xaml-controls-using-brushes)
2. [UI Structure](#ui-structure)
3. [EditKeyboardWindow/EditShortcutsWindow](#editkeyboardwindow-editshortcutswindow)
3. [EditKeyboardWindow / EditShortcutsWindow](#editkeyboardwindow--editshortcutswindow)
1. [OK and Cancel button](#ok-and-cancel-button)
2. [Delete button](#delete-button)
3. [Handling common modifiers in EditKeyboardWindow](#handling-common-modifiers-in-editkeyboardwindow)
@@ -51,7 +51,7 @@ Since ComboBoxes are added dynamically, handlers have been added which [update t
When the `EditKeyboardWindow`/`EditShortcutsWindow` is created, [we iterate through the remappings](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/ui/EditKeyboardWindow.cpp#L254-L262) stored in `KeyboardManagerState` and add rows to the UI Grid. For both the windows we have `static` buffers [`singleKeyRemapBuffer`](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/ui/SingleKeyRemapControl.h#L39-L40) and [`shortcutRemapBuffer`](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/ui/ShortcutControl.h#L42-L43) which store the corresponding key/shortcuts as per the selections in the UI if they are valid with no warnings.
## EditKeyboardWindow/EditShortcutsWindow
## EditKeyboardWindow / EditShortcutsWindow
### OK and Cancel button
[On pressing the OK button](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/ui/EditKeyboardWindow.cpp#L66-L89) in `EditKeyboardWindow`, first the [`CheckIfRemappingsAreValid` method](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/ui/LoadingAndSavingRemappingHelper.cpp#L10-L44) is executed which performs basic validity checks on the current remappings in the remap buffer (`static SingleKeyRemapControl::singleKeyRemapBuffer`), such as if there are no NULL columns and none of the source keys are repeated. All other validity checks are assumed to happen while the user adds the remapping. If this is found to be invalid a ContentDialog is displayed which shows that some remappings are invalid and if the user proceeds only the valid ones will be applied. If it is valid [`GetOrphanedKeys`](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/ui/LoadingAndSavingRemappingHelper.cpp#L46-L75) is executed which checks if any keys are orphaned (i.e. the key has been remapped and no other key has been remapped to it, so there is no way to send that key code), and a dialog is shown for notifying the user with a list of orphaned keys. After this the settings are [applied by adding it to the `KeyboardManagerState.singleKeyReMap` member](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/ui/LoadingAndSavingRemappingHelper.cpp#L102-L164) and they are saved to the JSON file. `EditShortcutsWindow` differs slightly from this, as there is no orphaned keys check, and [on pressing OK](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/ui/EditShortcutsWindow.cpp#L32-L47) both the global and app-specific shortcuts are validated and [updated](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/ui/LoadingAndSavingRemappingHelper.cpp#L166-L223).

View File

@@ -24,6 +24,10 @@ The Value Generator plugin is used to generate hashes for strings, to calculate
- Implements IComputeRequest
- `Compute()` will populate `Result` with the base64 encoding of the byte array passed in the constructor
### [`Base64DecodeRequest`](/src/modules/launcher/Plugins/Community.PowerToys.Run.Plugin.ValueGenerator/Base64/Base64DecodeRequest.cs)
- Implements IComputeRequest
- `Compute()` will populate `Result` with the decoded byte array of the base64 string passed in the constructor
### [`GUIDRequest`](/src/modules/launcher/Plugins/Community.PowerToys.Run.Plugin.ValueGenerator/GUID/GUIDRequest.cs)
- Implements IComputeRequest
- Uses the [`GUIDGenerator`](#guidgenerator) class to generate or compute the requested GUID

View File

@@ -2,35 +2,36 @@
## Fork, Clone, Branch and Create your PR
Once you've discussed your proposed feature/fix/etc. with a team member, and you've agreed an approach or a spec has been written and approved, it's time to start development:
Once you've discussed your proposed feature/fix/etc. with a team member, and an approach or a spec has been written and approved, it's time to start development:
1. Fork the repo if you haven't already
1. Fork the repo on GitHub if you haven't already
1. Clone your fork locally
1. Create & push a feature branch
1. Create a [Draft Pull Request (PR)](https://github.blog/2019-02-14-introducing-draft-pull-requests/)
1. Create a feature branch
1. Work on your changes
1. Create a [Draft Pull Request (PR)](https://github.blog/2019-02-14-introducing-draft-pull-requests/)
1. When ready, mark your PR as "ready for review".
## Rules
- **Follow the pattern of what you already see in the code.**
- [Coding style](style.md).
- Try to package new ideas/components into libraries that have nicely defined interfaces.
- Package new ideas into classes or refactor existing ideas into a class as you extend.
- When adding new classes/methods/changing existing code: add new unit tests or update the existing tests.
- Try to package new functionality/components into libraries that have nicely defined interfaces.
- Package new functionality into classes or refactor existing functionality into a class as you extend the code.
- When adding new classes/methods/changing existing code, add new unit tests or update the existing tests.
## GitHub Workflow
- Before starting to work on a fix/feature, make sure there is an open issue to track the work.
- Add the `In progress` label to the issue, if not already present also add a `Cost-Small/Medium/Large` estimate and make sure all appropriate labels are set.
- If you are a community contributor, you will not be able to add labels to the issue, in that case just add a comment saying that you started to work on the issue and try to give an estimate for the delivery date.
- Add the `In progress` label to the issue, if not already present. Also add a `Cost-Small/Medium/Large` estimate and make sure all appropriate labels are set.
- If you are a community contributor, you will not be able to add labels to the issue; in that case just add a comment saying that you have started work on the issue and try to give an estimate for the delivery date.
- If the work item has a medium/large cost, using the markdown task list, list each sub item and update the list with a check mark after completing each sub item.
- When opening a PR, follow the PR template.
- When you'd like the team to take a look, (even if the work is not yet fully-complete), mark the PR as 'Ready For Review' so that the team can review your work and provide comments, suggestions, and request changes. It may take several cycles, but the end result will be solid, testable, conformant code that is safe for us to merge.
- When the PR is approved, let the owner of the PR merge it. For community contributions the reviewer that approved the PR can also merge it.
- Use the `Squash and merge` option to merge a PR, if you don't want to squash it because there are logically different commits, use `Rebase and merge`.
- When you'd like the team to take a look (even if the work is not yet fully complete) mark the PR as 'Ready For Review' so that the team can review your work and provide comments, suggestions, and request changes. It may take several cycles, but the end result will be solid, testable, conformant code that is safe for us to merge.
- When the PR is approved, let the owner of the PR merge it. For community contributions, the reviewer who approved the PR can also merge it.
- Use the `Squash and merge` option to merge a PR. If you don't want to squash it because there are logically different commits, use `Rebase and merge`.
- We don't close issues automatically when referenced in a PR, so after the PR is merged:
- mark the issue(s), that the PR solved, with the `Resolution-Fix-Committed` label, remove the `In progress` label and if the issue is assigned to a project, move the item to the `Done` status.
- don't close the issue if it's a bug in the current released version since users tend to not search for closed issues, we will close the resolved issues when a new version is released.
- mark the issue(s) that the PR solved with the `Resolution-Fix-Committed` label, remove the `In progress` label and if the issue is assigned to a project, move the item to the `Done` status.
- don't close the issue if it's a bug in the current released version; since users tend to not search for closed issues, we will close the resolved issues when a new version is released.
- if it's not a code fix that effects the end user, the issue can be closed (for example a fix in the build or a code refactoring and so on).
## Compiling PowerToys
@@ -39,12 +40,16 @@ Once you've discussed your proposed feature/fix/etc. with a team member, and you
1. Windows 10 April 2018 Update (version 1803) or newer
1. Visual Studio Community/Professional/Enterprise 2022 17.4 or newer
1. Git clone PowerToys repository
1. A local clone of the PowerToys repository
### Install Visual Studio dependencies
1. Open the `PowerToys.sln` file.
1. If you see a dialog that says `install extra components` in the solution explorer pane, click `install`
### Get Submodules to compile
We have submodules that need to be initialized before you can compile most parts of PowerToys. This should be a one time step.
We have submodules that need to be initialized before you can compile most parts of PowerToys. This should be a one-time step.
1. Open a terminal
1. Navigate to the folder you cloned PowerToys to.
@@ -52,9 +57,11 @@ We have submodules that need to be initialized before you can compile most parts
### Compiling Source Code
- Open `PowerToys.sln` in Visual Studio, in the `Solutions Configuration` drop-down menu select `Release` or `Debug`, from the `Build` menu choose `Build Solution`.
- The PowerToys binaries will be in your repo under `x64\Release\`.
- You can run `x64\Release\PowerToys.exe` directly without installing PowerToys, but some modules (i.e. PowerRename, ImageResizer, File Explorer extension etc.) will not be available unless you also build the installer and install PowerToys.
- Open `PowerToys.sln` in Visual Studio.
- In the `Solutions Configuration` drop-down menu select `Release` or `Debug`.
- From the `Build` menu choose `Build Solution`, or press <kbd>Control</kbd>+<kbd>Shift</kbd>+<kbd>b</kbd> on your keyboard.
- The build process may take several minutes depending on your computer's performance. Once it completes, the PowerToys binaries will be in your repo under `x64\Release\`.
- You can run `x64\Release\PowerToys.exe` directly without installing PowerToys, but some modules (i.e. PowerRename, ImageResizer, File Explorer extension etc.) will not be available unless you also build the installer and install PowerToys.
## Compile the installer
@@ -62,7 +69,7 @@ Our installer is two parts, an EXE and an MSI. The EXE (Bootstrapper) contains
- The EXE installs all prerequisites and installs PowerToys via the MSI. It has additional features such as the installation flags (see below).
- The MSI installs the PowerToys binaries.
The installer can only be compiled in `Release` mode, step 1 and 2 must be done before the MSI will be able to be compiled.
The installer can only be compiled in `Release` mode; steps 1 and 2 must be performed before the MSI can be compiled.
1. Compile `PowerToys.sln`. Instructions are listed above.
1. Compile `BugReportTool.sln` tool. Path from root: `tools\BugReportTool\BugReportTool.sln` (details listed below)
@@ -76,9 +83,11 @@ The installer can only be compiled in `Release` mode, step 1 and 2 must be done
1. Install the [WiX Toolset build tools](https://wixtoolset.org/docs/v3/releases/v3-14-0-6526/). (installer [direct link](https://wixtoolset.org/downloads/v3.14.0.6526/wix314.exe))
1. Download [WiX binaries](https://wixtoolset.org/downloads/v3.14.0.6526/wix314-binaries.zip) and extract `wix.targets` to `C:\Program Files (x86)\WiX Toolset v3.14`.
### Locally building the installer prerequisite projects all at once from the command-line
### Building prerequisite projects
1. Open a `Developer Command Prompt for VS 2022`
#### From the command line
1. From the start menu, open a `Developer Command Prompt for VS 2022`
1. Ensure `nuget.exe` is in your `%path%`
1. In the repo root, run these commands:
@@ -93,20 +102,16 @@ nuget restore .\tools\StylesReportTool\StylesReportTool.sln
msbuild -p:Platform=x64 -p:Configuration=Release .\tools\StylesReportTool\StylesReportTool.sln
```
### Locally compiling the Bug reporting tool
#### From Visual Studio
If you prefer, you can alternatively build prerequisite projects for the installer using the Visual Studio UI.
1. Open `tools\BugReportTool\BugReportTool.sln`
1. In Visual Studio, in the `Solutions Configuration` drop-down menu select `Release`
1. From the `Build` menu, choose `Build Solution`.
### Locally compiling the Webcam reporting tool
1. Open `tools\WebcamReportTool\WebcamReportTool.sln`
1. In Visual Studio, in the `Solutions Configuration` drop-down menu select `Release`
1. From the `Build` menu, choose `Build Solution`.
### Locally compiling the Window styles reporting tool
1. Open `tools\StylesReportTool\StylesReportTool.sln`
1. In Visual Studio, in the `Solutions Configuration` drop-down menu select `Release`
1. From the `Build` menu, choose `Build Solution`.
@@ -125,14 +130,14 @@ Head over to the wiki to see the [full list of supported installer arguments][in
## Debugging
The following configuration issue only applies if the user is a member of the Administrators group.
To debug the PowerToys application in Visual Studio, set the `runner` project as your start-up project, then start the debugger.
Some PowerToys modules require being run with the highest permission level if the current user is a member of the Administrators group. The highest permission level is required to be able to perform some actions when an elevated application (e.g. Task Manager) is in the foreground or is the target of an action. Without elevated privileges some PowerToys modules will still work but with some limitations:
Some PowerToys modules must be run with the highest permission level if the current user is a member of the Administrators group. The highest permission level is required to be able to perform some actions when an elevated application (e.g. Task Manager) is in the foreground or is the target of an action. Without elevated privileges some PowerToys modules will still work but with some limitations:
- The `FancyZones` module will be not be able to move an elevated window to a zone.
- The `FancyZones` module will not be able to move an elevated window to a zone.
- The `Shortcut Guide` module will not appear if the foreground window belongs to an elevated application.
To run and debug PowerToys from Visual Studio when the user is a member of the Administrators group, Visual Studio has to be started with elevated privileges. If you want to avoid running Visual Studio with elevated privileges and don't mind the limitations described above, you can do the following: open the `runner` project properties and navigate to the `Linker -> Manifest File` settings, edit the `UAC Execution Level` property and change it from `highestAvailable (level='highestAvailable')` to `asInvoker (/level='asInvoker')`, save the changes.
Therefore, it is recommended to run Visual Studio with elevated privileges when debugging these scenarios. If you want to avoid running Visual Studio with elevated privileges and don't mind the limitations described above, you can do the following: open the `runner` project properties and navigate to the `Linker -> Manifest File` settings, edit the `UAC Execution Level` property and change it from `highestAvailable (level='highestAvailable')` to `asInvoker (/level='asInvoker').
## How to create new PowerToys
@@ -155,7 +160,7 @@ It's responsible for:
### [`Interface`](modules/interface.md)
Definition of the interface used by the [`runner`](/src/runner) to manage the PowerToys. All PowerToys must implement this interface.
The definition of the interface used by the [`runner`](/src/runner) to manage the PowerToys. All PowerToys must implement this interface.
### [`Common`](common.md)
@@ -163,4 +168,4 @@ The common lib, as the name suggests, contains code shared by multiple PowerToys
### [`Settings`](settingsv2/)
Settings v2 is our current settings implementation. Please head over to the dev docs that goes into the current settings system.
Settings v2 is our current settings implementation. Please head over to the dev docs that describe the current settings system.

View File

@@ -1,7 +1,7 @@
# UI Architecture
The UI code is distributed between two projects: [`PowerToys.Settings`](/src/settings-ui/Settings.UI) and [`Settings.UI`](/src/settings-ui/Settings.UI.Library). [`PowerToys.Settings`](/src/settings-ui/Settings.UI) is a Windows App Sdk .net Unpackaged application. It contains the views for base navigation and modules. Parent display window and corresponding code is present in [`MainWindow.xaml.`](/src/settings-ui/Settings.UI/MainWindow.xaml). Fig 1 provides a description of the UI controls hierarchy and each of the controls have been summarized below :
- [`ShellPage.xaml`](/src/settings-ui/Settings.UI/Views/ShellPage.xaml) is a WinUI control, consisting of a side navigation panel with an icon for each module. Clicking on a module icon loads the corresponding `setting.json` file and displays the data in the UI.
The UI code is distributed between two projects: [`PowerToys.Settings`](/src/settings-ui/Settings.UI) and [`Settings.UI`](/src/settings-ui/Settings.UI.Library). [`PowerToys.Settings`](/src/settings-ui/Settings.UI) is a Windows App Sdk .net Unpackaged application. It contains the views for base navigation and modules. Parent display window and corresponding code is present in [`MainWindow.xaml`](/src/settings-ui/Settings.UI/SettingsXAML/MainWindow.xaml). Fig 1 provides a description of the UI controls hierarchy and each of the controls have been summarized below :
- [`ShellPage.xaml`](/src/settings-ui/Settings.UI/SettingsXAML/Views/ShellPage.xaml) is a WinUI control, consisting of a side navigation panel with an icon for each module. Clicking on a module icon loads the corresponding `setting.json` file and displays the data in the UI.
![Settings UI architecture](/doc/images/settingsv2/ui-architecture.png)
**Fig 1: UI Architecture for settingsv2**

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

View File

@@ -0,0 +1,35 @@
# Third-Party plugins for PowerToy Run
This is a collection of third-party plugins for PowerToys Run created by the community.
## Installing and upgrading third-party PowerToys Run plugins
The recommended path for the plugins is `%LOCALAPPDATA%\Microsoft\PowerToys\PowerToys Run\Plugins`.
1. Close PowerToys.
1. Copy the plugin folder to `%LOCALAPPDATA%\Microsoft\PowerToys\PowerToys Run\Plugins`.
1. If you're upgrading a plugin, delete the previous version.
1. Open PowerToys.
Refer to plugin instruction for more details.
## Disclaimer
The following plugins are created and maintained by third-party and not officially supported or recognized by Microsoft.
Users install and use these plugins at their own risk, and Microsoft takes no responsibility for their functionality or any potential issues they may cause.
Contact the developers of a plugin directly for assistance with a specific plugin.
## Plugins
| Plugin | Author | Description |
| ------ | ------ | ----------- |
| [BrowserSearch](https://github.com/TBM13/BrowserSearch) | [TBM13](https://github.com/TBM13) | Search your browser history |
| [Edge Favorite](https://github.com/davidegiacometti/PowerToys-Run-EdgeFavorite) | [davidegiacometti](https://github.com/davidegiacometti) | Open Microsoft Edge favorites |
| [Everything](https://github.com/lin-ycv/EverythingPowerToys) | [Yu Chieh (Victor) Lin](https://github.com/Lin-ycv) | Get search results from Everything |
| [GitHub Emoji](https://github.com/hlaueriksson/GEmojiSharp) | [hlaueriksson](https://github.com/hlaueriksson) | Search GitHub Emoji |
| [GitKraken](https://github.com/davidegiacometti/PowerToys-Run-GitKraken) | [davidegiacometti](https://github.com/davidegiacometti) | Open GitKraken repositories |
| [Guid](https://github.com/skttl/ptrun-guid) | [skttl](https://github.com/skttl) | Guid generator |
| [PowerTranslator](https://github.com/N0I0C0K/PowerTranslator) | [N0I0C0K](https://github.com/N0I0C0K) | Text translator based on Youdao |
| [Quick Lookup](https://github.com/GTGalaxi/quick-lookup-ptrun) | [gtgalaxi](https://github.com/GTGalaxi) | Search across multiple cyber security tools |
| [Visual Studio](https://github.com/davidegiacometti/PowerToys-Run-VisualStudio) | [davidegiacometti](https://github.com/davidegiacometti) | Open Visual Studio recents |
| [WinGet](https://github.com/bostrot/PowerToysRunPluginWinget) | [bostrot](https://github.com/bostrot) | Search and install packages from WinGet |

View File

@@ -112,7 +112,6 @@
<WixVariable Id="WixUIDialogBmp" Value="$(var.ProjectDir)\Images\dialog.png" />
<WixVariable Id="WixUILicenseRtf" Value="$(var.RepoDir)\installer\License.rtf" />
<Property Id="INSTALLSTARTMENUSHORTCUT" Value="1"/>
<Property Id="CREATESCHEDULEDTASK" Value="1"/>
<Property Id="WixShellExecTarget" Value="[#PowerToys_ActionRunner.exe]" />
<SetProperty Action="SetDEFAULTBOOTSTRAPPERINSTALLFOLDER" Id="DEFAULTBOOTSTRAPPERINSTALLFOLDER" Value="[$(var.DefaultInstallDir)]PowerToys" Before="SetBOOTSTRAPPERINSTALLFOLDER" Sequence="execute"></SetProperty>
@@ -132,12 +131,9 @@
<SetProperty Id="InstallScope" Value="$(var.InstallScope)" Before="DetectPrevInstallPath" Sequence="execute"></SetProperty>
<InstallExecuteSequence>
<Custom Action="DetectPrevInstallPath" After="AppSearch" />
<Custom Action="SetRegisterPowerToysSchTaskParam" Before="RegisterPowerToysSchTask" />
<Custom Action="SetLaunchPowerToysParam" Before="LaunchPowerToys" />
<Custom Action="SetApplyModulesRegistryChangeSetsParam" Before="ApplyModulesRegistryChangeSets" />
<Custom Action="SetUnApplyModulesRegistryChangeSetsParam" Before="UnApplyModulesRegistryChangeSets" />
<Custom Action="RegisterPowerToysSchTask" After="InstallFiles">
NOT Installed and CREATESCHEDULEDTASK = 1
</Custom>
<Custom Action="CheckGPO" After="InstallInitialize">
NOT Installed
</Custom>
@@ -171,17 +167,22 @@
</Custom>-->
<Custom Action="TerminateProcesses" Before="InstallValidate" />
<Custom Action="LaunchPowerToys" After="InstallFinalize">NOT Installed</Custom>
<Custom Action="LaunchPowerToys" Before="InstallFinalize">NOT Installed</Custom>
</InstallExecuteSequence>
<CustomAction Id="SetLaunchPowerToysParam"
Property="LaunchPowerToys"
Value="[INSTALLFOLDER]" />
<CustomAction
Id="LaunchPowerToys"
Execute="immediate"
Return="ignore"
Impersonate="yes"
Return="asyncNoWait"
FileKey="PowerToys.exe"
ExeCommand="--dont-elevate" />
Execute="deferred"
BinaryKey="PTCustomActions"
DllEntry="LaunchPowerToysCA"
/>
<CustomAction
Id="TerminateProcesses"
@@ -190,10 +191,6 @@
BinaryKey="PTCustomActions"
DllEntry="TerminateProcessesCA" />
<CustomAction Id="SetRegisterPowerToysSchTaskParam"
Property="RegisterPowerToysSchTask"
Value="[INSTALLFOLDER]PowerToys.exe" />
<CustomAction Id="SetApplyModulesRegistryChangeSetsParam"
Property="ApplyModulesRegistryChangeSets"
Value="[INSTALLFOLDER]" />
@@ -226,15 +223,6 @@
Property="DeleteDotnetRuntimeHardlinks"
Value="[INSTALLFOLDER]" />
<!-- Needs to Impersonate="no" and Execute="deferred" in order to run elevated. -->
<CustomAction Id="RegisterPowerToysSchTask"
Return="ignore"
Impersonate="no"
Execute="deferred"
BinaryKey="PTCustomActions"
DllEntry="CreateScheduledTaskCA"
/>
<CustomAction Id="RemovePowerToysSchTasks"
Return="ignore"
Impersonate="no"

View File

@@ -10,7 +10,7 @@
<RegistryKey Root="$(var.RegistryScope)" Key="Software\Classes\powertoys\components">
<RegistryValue Type="string" Name="BugReportTool_exe" Value="" KeyPath="yes"/>
</RegistryKey>
<File Source="$(var.BinDir)BugReportTool\PowerToys.BugReportTool.exe" Id="BugReportTool.exe" Checksum="yes" />
<File Source="$(var.BinDir)Tools\PowerToys.BugReportTool.exe" Id="BugReportTool.exe" Checksum="yes" />
</Component>
<Component Id="WebcamReportTool_exe" Win64="yes" Guid="41D5209F-7A9A-4DF2-A22A-9F0A9CF5AA63">
<RegistryKey Root="$(var.RegistryScope)" Key="Software\Classes\powertoys\components">

View File

@@ -2,7 +2,6 @@
#include "resource.h"
#include "RcResource.h"
#include <ProjectTelemetry.h>
#include <spdlog/sinks/base_sink.h>
#include "../../src/common/logger/logger.h"
@@ -16,6 +15,11 @@
#include <winrt/Windows.Foundation.h>
#include <winrt/Windows.Management.Deployment.h>
#include <wtsapi32.h>
#include <processthreadsapi.h>
#include <UserEnv.h>
#include <winnt.h>
using namespace std;
HINSTANCE DLL_HANDLE = nullptr;
@@ -50,6 +54,188 @@ LExit:
return hr;
}
BOOL IsLocalSystem()
{
HANDLE hToken;
UCHAR bTokenUser[sizeof(TOKEN_USER) + 8 + 4 * SID_MAX_SUB_AUTHORITIES];
PTOKEN_USER pTokenUser = (PTOKEN_USER)bTokenUser;
ULONG cbTokenUser;
SID_IDENTIFIER_AUTHORITY siaNT = SECURITY_NT_AUTHORITY;
PSID pSystemSid;
BOOL bSystem;
// open process token
if (!OpenProcessToken(GetCurrentProcess(),
TOKEN_QUERY,
&hToken))
return FALSE;
// retrieve user SID
if (!GetTokenInformation(hToken, TokenUser, pTokenUser,
sizeof(bTokenUser), &cbTokenUser))
{
CloseHandle(hToken);
return FALSE;
}
CloseHandle(hToken);
// allocate LocalSystem well-known SID
if (!AllocateAndInitializeSid(&siaNT, 1, SECURITY_LOCAL_SYSTEM_RID,
0, 0, 0, 0, 0, 0, 0, &pSystemSid))
return FALSE;
// compare the user SID from the token with the LocalSystem SID
bSystem = EqualSid(pTokenUser->User.Sid, pSystemSid);
FreeSid(pSystemSid);
return bSystem;
}
BOOL ImpersonateLoggedInUserAndDoSomething(std::function<bool(HANDLE userToken)> action)
{
HRESULT hr = S_OK;
HANDLE hUserToken = NULL;
DWORD dwSessionId;
ProcessIdToSessionId(GetCurrentProcessId(), &dwSessionId);
auto rv = WTSQueryUserToken(dwSessionId, &hUserToken);
if (rv == 0)
{
hr = E_ABORT;
ExitOnFailure(hr, "Failed to query user token");
}
HANDLE hUserTokenDup;
if (DuplicateTokenEx(hUserToken, TOKEN_ALL_ACCESS, NULL, SECURITY_IMPERSONATION_LEVEL::SecurityImpersonation, TOKEN_TYPE::TokenPrimary, &hUserTokenDup) == 0)
{
CloseHandle(hUserToken);
CloseHandle(hUserTokenDup);
hr = E_ABORT;
ExitOnFailure(hr, "Failed to duplicate user token");
}
if (ImpersonateLoggedOnUser(hUserTokenDup))
{
if (!action(hUserTokenDup))
{
hr = E_ABORT;
ExitOnFailure(hr, "Failed to execute action");
}
RevertToSelf();
CloseHandle(hUserToken);
CloseHandle(hUserTokenDup);
}
else
{
hr = E_ABORT;
ExitOnFailure(hr, "Failed to duplicate user token");
}
LExit:
return SUCCEEDED(hr);
}
UINT __stdcall LaunchPowerToysCA(MSIHANDLE hInstall)
{
HRESULT hr = S_OK;
UINT er = ERROR_SUCCESS;
std::wstring installationFolder, path, args;
std::wstring commandLine;
hr = WcaInitialize(hInstall, "LaunchPowerToys");
ExitOnFailure(hr, "Failed to initialize");
hr = getInstallFolder(hInstall, installationFolder);
ExitOnFailure(hr, "Failed to get installFolder.");
path = installationFolder;
path += L"\\PowerToys.exe";
args = L"--dont-elevate";
commandLine = L"\"" + path + L"\" ";
commandLine += args;
BOOL isSystemUser = IsLocalSystem();
if (isSystemUser) {
auto action = [&commandLine](HANDLE userToken) {
STARTUPINFO startupInfo{ .cb = sizeof(STARTUPINFO), .wShowWindow = SW_SHOWNORMAL };
PROCESS_INFORMATION processInformation;
PVOID lpEnvironment = NULL;
CreateEnvironmentBlock(&lpEnvironment, userToken, FALSE);
CreateProcessAsUser(
userToken,
NULL,
commandLine.data(),
NULL,
NULL,
FALSE,
CREATE_DEFAULT_ERROR_MODE | CREATE_UNICODE_ENVIRONMENT,
lpEnvironment,
NULL,
&startupInfo,
&processInformation);
if (!CloseHandle(processInformation.hProcess))
{
return false;
}
if (!CloseHandle(processInformation.hThread))
{
return false;
}
return true;
};
if (!ImpersonateLoggedInUserAndDoSomething(action))
{
hr = E_ABORT;
ExitOnFailure(hr, "ImpersonateLoggedInUserAndDoSomething failed");
}
}
else
{
STARTUPINFO startupInfo{ .cb = sizeof(STARTUPINFO), .wShowWindow = SW_SHOWNORMAL };
PROCESS_INFORMATION processInformation;
// Start the resizer
CreateProcess(
NULL,
commandLine.data(),
NULL,
NULL,
TRUE,
0,
NULL,
NULL,
&startupInfo,
&processInformation);
if (!CloseHandle(processInformation.hProcess))
{
hr = E_ABORT;
ExitOnFailure(hr, "Failed to close process handle");
}
if (!CloseHandle(processInformation.hThread))
{
hr = E_ABORT;
ExitOnFailure(hr, "Failed to close thread handle");
}
}
LExit:
er = SUCCEEDED(hr) ? ERROR_SUCCESS : ERROR_INSTALL_FAILURE;
return WcaFinalize(er);
}
UINT __stdcall CheckGPOCA(MSIHANDLE hInstall)
{
HRESULT hr = S_OK;
@@ -253,7 +439,7 @@ UINT __stdcall UninstallServicesCA(MSIHANDLE hInstall)
{
HRESULT hr = S_OK;
UINT er = ERROR_SUCCESS;
hr = WcaInitialize(hInstall, "CreateScheduledTaskCA");
hr = WcaInitialize(hInstall, "UninstallServicesCA");
ExitOnFailure(hr, "Failed to initialize");
@@ -264,278 +450,6 @@ LExit:
return WcaFinalize(er);
}
// Creates a Scheduled Task to run at logon for the current user.
// The path of the executable to run should be passed as the CustomActionData (Value).
// Based on the Task Scheduler Logon Trigger Example:
// https://learn.microsoft.com/windows/win32/taskschd/logon-trigger-example--c---/
UINT __stdcall CreateScheduledTaskCA(MSIHANDLE hInstall)
{
HRESULT hr = S_OK;
UINT er = ERROR_SUCCESS;
TCHAR username_domain[USERNAME_DOMAIN_LEN];
TCHAR username[USERNAME_LEN];
std::wstring wstrTaskName;
ITaskService* pService = nullptr;
ITaskFolder* pTaskFolder = nullptr;
ITaskDefinition* pTask = nullptr;
IRegistrationInfo* pRegInfo = nullptr;
ITaskSettings* pSettings = nullptr;
ITriggerCollection* pTriggerCollection = nullptr;
IRegisteredTask* pRegisteredTask = nullptr;
IPrincipal* pPrincipal = nullptr;
ITrigger* pTrigger = nullptr;
ILogonTrigger* pLogonTrigger = nullptr;
IAction* pAction = nullptr;
IActionCollection* pActionCollection = nullptr;
IExecAction* pExecAction = nullptr;
LPWSTR wszExecutablePath = nullptr;
hr = WcaInitialize(hInstall, "CreateScheduledTaskCA");
ExitOnFailure(hr, "Failed to initialize");
Logger::info(L"CreateScheduledTaskCA Initialized.");
// ------------------------------------------------------
// Get the Domain/Username for the trigger.
//
// This action needs to run as the system to get elevated privileges from the installation,
// so GetUserNameEx can't be used to get the current user details.
// The USERNAME and USERDOMAIN environment variables are used instead.
if (!GetEnvironmentVariable(L"USERNAME", username, USERNAME_LEN))
{
ExitWithLastError(hr, "Getting username failed: %x", hr);
}
if (!GetEnvironmentVariable(L"USERDOMAIN", username_domain, USERNAME_DOMAIN_LEN))
{
ExitWithLastError(hr, "Getting the user's domain failed: %x", hr);
}
wcscat_s(username_domain, L"\\");
wcscat_s(username_domain, username);
Logger::info(L"Current user detected: {}", username_domain);
// Task Name.
wstrTaskName = L"Autorun for ";
wstrTaskName += username;
// Get the executable path passed to the custom action.
hr = WcaGetProperty(L"CustomActionData", &wszExecutablePath);
ExitOnFailure(hr, "Failed to get the executable path from CustomActionData.");
// COM and Security Initialization is expected to have been done by the MSI.
// It couldn't be done in the DLL, anyway.
// ------------------------------------------------------
// Create an instance of the Task Service.
hr = CoCreateInstance(CLSID_TaskScheduler,
nullptr,
CLSCTX_INPROC_SERVER,
IID_ITaskService,
reinterpret_cast<void**>(&pService));
ExitOnFailure(hr, "Failed to create an instance of ITaskService: %x", hr);
// Connect to the task service.
hr = pService->Connect(_variant_t(), _variant_t(), _variant_t(), _variant_t());
ExitOnFailure(hr, "ITaskService::Connect failed: %x", hr);
// ------------------------------------------------------
// Get the PowerToys task folder. Creates it if it doesn't exist.
hr = pService->GetFolder(_bstr_t(L"\\PowerToys"), &pTaskFolder);
if (FAILED(hr))
{
// Folder doesn't exist. Get the Root folder and create the PowerToys subfolder.
ITaskFolder* pRootFolder = nullptr;
hr = pService->GetFolder(_bstr_t(L"\\"), &pRootFolder);
ExitOnFailure(hr, "Cannot get Root Folder pointer: %x", hr);
hr = pRootFolder->CreateFolder(_bstr_t(L"\\PowerToys"), _variant_t(L""), &pTaskFolder);
if (FAILED(hr))
{
pRootFolder->Release();
ExitOnFailure(hr, "Cannot create PowerToys task folder: %x", hr);
}
Logger::info(L"PowerToys task folder created.");
}
// If the same task exists, remove it.
pTaskFolder->DeleteTask(_bstr_t(wstrTaskName.c_str()), 0);
// Create the task builder object to create the task.
hr = pService->NewTask(0, &pTask);
ExitOnFailure(hr, "Failed to create a task definition: %x", hr);
// ------------------------------------------------------
// Get the registration info for setting the identification.
hr = pTask->get_RegistrationInfo(&pRegInfo);
ExitOnFailure(hr, "Cannot get identification pointer: %x", hr);
hr = pRegInfo->put_Author(_bstr_t(username_domain));
ExitOnFailure(hr, "Cannot put identification info: %x", hr);
// ------------------------------------------------------
// Create the settings for the task
hr = pTask->get_Settings(&pSettings);
ExitOnFailure(hr, "Cannot get settings pointer: %x", hr);
hr = pSettings->put_StartWhenAvailable(VARIANT_FALSE);
ExitOnFailure(hr, "Cannot put_StartWhenAvailable setting info: %x", hr);
hr = pSettings->put_StopIfGoingOnBatteries(VARIANT_FALSE);
ExitOnFailure(hr, "Cannot put_StopIfGoingOnBatteries setting info: %x", hr);
hr = pSettings->put_ExecutionTimeLimit(_bstr_t(L"PT0S")); //Unlimited
ExitOnFailure(hr, "Cannot put_ExecutionTimeLimit setting info: %x", hr);
hr = pSettings->put_DisallowStartIfOnBatteries(VARIANT_FALSE);
ExitOnFailure(hr, "Cannot put_DisallowStartIfOnBatteries setting info: %x", hr);
hr = pSettings->put_Priority(4);
ExitOnFailure(hr, "Cannot put_Priority setting info : %x", hr);
// ------------------------------------------------------
// Get the trigger collection to insert the logon trigger.
hr = pTask->get_Triggers(&pTriggerCollection);
ExitOnFailure(hr, "Cannot get trigger collection: %x", hr);
// Add the logon trigger to the task.
hr = pTriggerCollection->Create(TASK_TRIGGER_LOGON, &pTrigger);
ExitOnFailure(hr, "Cannot create the trigger: %x", hr);
hr = pTrigger->QueryInterface(
IID_ILogonTrigger, (void**)&pLogonTrigger);
pTrigger->Release();
ExitOnFailure(hr, "QueryInterface call failed for ILogonTrigger: %x", hr);
hr = pLogonTrigger->put_Id(_bstr_t(L"Trigger1"));
if (FAILED(hr))
{
Logger::error(L"Cannot put the trigger ID: {}", hr);
}
// Timing issues may make explorer not be started when the task runs.
// Add a little delay to mitigate this.
hr = pLogonTrigger->put_Delay(_bstr_t(L"PT03S"));
if (FAILED(hr))
{
Logger::error(L"Cannot put the trigger delay: {}", hr);
}
// Define the user. The task will execute when the user logs on.
// The specified user must be a user on this computer.
hr = pLogonTrigger->put_UserId(_bstr_t(username_domain));
pLogonTrigger->Release();
ExitOnFailure(hr, "Cannot add user ID to logon trigger: %x", hr);
// ------------------------------------------------------
// Add an Action to the task. This task will execute the path passed to this custom action.
// Get the task action collection pointer.
hr = pTask->get_Actions(&pActionCollection);
ExitOnFailure(hr, "Cannot get Task collection pointer: %x", hr);
// Create the action, specifying that it is an executable action.
hr = pActionCollection->Create(TASK_ACTION_EXEC, &pAction);
pActionCollection->Release();
ExitOnFailure(hr, "Cannot create the action: %x", hr);
// QI for the executable task pointer.
hr = pAction->QueryInterface(
IID_IExecAction, (void**)&pExecAction);
pAction->Release();
ExitOnFailure(hr, "QueryInterface call failed for IExecAction: %x", hr);
// Set the path of the executable to PowerToys (passed as CustomActionData).
hr = pExecAction->put_Path(_bstr_t(wszExecutablePath));
pExecAction->Release();
ExitOnFailure(hr, "Cannot set path of executable: %x", hr);
// ------------------------------------------------------
// Create the principal for the task
hr = pTask->get_Principal(&pPrincipal);
ExitOnFailure(hr, "Cannot get principal pointer: %x", hr);
// Set up principal information:
hr = pPrincipal->put_Id(_bstr_t(L"Principal1"));
if (FAILED(hr))
{
Logger::error(L"Cannot put the principal ID: {}", hr);
}
hr = pPrincipal->put_UserId(_bstr_t(username_domain));
if (FAILED(hr))
{
Logger::error(L"Cannot put principal user Id: {}", hr);
}
hr = pPrincipal->put_LogonType(TASK_LOGON_INTERACTIVE_TOKEN);
if (FAILED(hr))
{
Logger::error(L"Cannot put principal logon type: {}", hr);
}
// Run the task with the highest available privileges.
hr = pPrincipal->put_RunLevel(TASK_RUNLEVEL_LUA);
pPrincipal->Release();
ExitOnFailure(hr, "Cannot put principal run level: %x", hr);
// ------------------------------------------------------
// Save the task in the PowerToys folder.
{
_variant_t SDDL_FULL_ACCESS_FOR_EVERYONE = L"D:(A;;FA;;;WD)";
hr = pTaskFolder->RegisterTaskDefinition(
_bstr_t(wstrTaskName.c_str()),
pTask,
TASK_CREATE_OR_UPDATE,
_variant_t(username_domain),
_variant_t(),
TASK_LOGON_INTERACTIVE_TOKEN,
SDDL_FULL_ACCESS_FOR_EVERYONE,
&pRegisteredTask);
ExitOnFailure(hr, "Error saving the Task : %x", hr);
}
Logger::info(L"Scheduled task created for the current user.");
LExit:
ReleaseStr(wszExecutablePath);
if (pService)
{
pService->Release();
}
if (pTaskFolder)
{
pTaskFolder->Release();
}
if (pTask)
{
pTask->Release();
}
if (pRegInfo)
{
pRegInfo->Release();
}
if (pSettings)
{
pSettings->Release();
}
if (pTriggerCollection)
{
pTriggerCollection->Release();
}
if (pRegisteredTask)
{
pRegisteredTask->Release();
}
if (!SUCCEEDED(hr))
{
PMSIHANDLE hRecord = MsiCreateRecord(0);
MsiRecordSetString(hRecord, 0, TEXT("Failed to create a scheduled task to start PowerToys at user login. You can re-try to create the scheduled task using the PowerToys settings."));
MsiProcessMessage(hInstall, static_cast<INSTALLMESSAGE>(INSTALLMESSAGE_WARNING + MB_OK), hRecord);
}
er = SUCCEEDED(hr) ? ERROR_SUCCESS : ERROR_INSTALL_FAILURE;
return WcaFinalize(er);
}
// Removes all Scheduled Tasks in the PowerToys folder and deletes the folder afterwards.
// Based on the Task Scheduler Displaying Task Names and State example:
// https://learn.microsoft.com/windows/desktop/TaskSchd/displaying-task-names-and-state--c---/
@@ -1091,7 +1005,7 @@ UINT __stdcall TerminateProcessesCA(MSIHANDLE hInstall)
}
processes.resize(bytes / sizeof(processes[0]));
std::array<std::wstring_view, 27> processesToTerminate = {
std::array<std::wstring_view, 28> processesToTerminate = {
L"PowerToys.PowerLauncher.exe",
L"PowerToys.Settings.exe",
L"PowerToys.Awake.exe",
@@ -1118,6 +1032,7 @@ UINT __stdcall TerminateProcessesCA(MSIHANDLE hInstall)
L"PowerToys.MouseWithoutBorders.exe",
L"PowerToys.MouseWithoutBordersHelper.exe",
L"PowerToys.MouseWithoutBordersService.exe",
L"PowerToys.CropAndLock.exe",
L"PowerToys.exe",
};

View File

@@ -1,9 +1,9 @@
LIBRARY "PowerToysSetupCustomActions"
EXPORTS
LaunchPowerToysCA
CheckGPOCA
ApplyModulesRegistryChangeSetsCA
CreateScheduledTaskCA
DetectPrevInstallPathCA
RemoveScheduledTasksCA
TelemetryLogInstallSuccessCA

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\Microsoft.Windows.CppWinRT.2.0.220929.3\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('..\packages\Microsoft.Windows.CppWinRT.2.0.220929.3\build\native\Microsoft.Windows.CppWinRT.props')" />
<Import Project="..\packages\Microsoft.Windows.CppWinRT.2.0.221104.6\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('..\packages\Microsoft.Windows.CppWinRT.2.0.221104.6\build\native\Microsoft.Windows.CppWinRT.props')" />
<Import Project="..\wix.props" Condition="Exists('..\wix.props')" />
<PropertyGroup Label="Globals">
<ProjectGuid>{32f3882b-f2d6-4586-b5ed-11e39e522bd3}</ProjectGuid>
@@ -88,7 +88,7 @@
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile>
<Link>
<AdditionalDependencies>WindowsApp.lib;Newdev.lib;Crypt32.lib;msi.lib;wcautil.lib;Psapi.lib;Pathcch.lib;comsupp.lib;taskschd.lib;Secur32.lib;msi.lib;dutil.lib;wcautil.lib;Version.lib;Shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>Userenv.lib;Wtsapi32.lib;WindowsApp.lib;Newdev.lib;Crypt32.lib;msi.lib;wcautil.lib;Psapi.lib;Pathcch.lib;comsupp.lib;taskschd.lib;Secur32.lib;msi.lib;dutil.lib;wcautil.lib;Version.lib;Shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
<ModuleDefinitionFile>CustomAction.def</ModuleDefinitionFile>
</Link>
</ItemDefinitionGroup>
@@ -163,13 +163,13 @@
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
<Import Project="..\packages\Microsoft.Windows.CppWinRT.2.0.220929.3\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('..\packages\Microsoft.Windows.CppWinRT.2.0.220929.3\build\native\Microsoft.Windows.CppWinRT.targets')" />
<Import Project="..\packages\Microsoft.Windows.CppWinRT.2.0.221104.6\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('..\packages\Microsoft.Windows.CppWinRT.2.0.221104.6\build\native\Microsoft.Windows.CppWinRT.targets')" />
</ImportGroup>
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\Microsoft.Windows.CppWinRT.2.0.220929.3\build\native\Microsoft.Windows.CppWinRT.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Windows.CppWinRT.2.0.220929.3\build\native\Microsoft.Windows.CppWinRT.props'))" />
<Error Condition="!Exists('..\packages\Microsoft.Windows.CppWinRT.2.0.220929.3\build\native\Microsoft.Windows.CppWinRT.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Windows.CppWinRT.2.0.220929.3\build\native\Microsoft.Windows.CppWinRT.targets'))" />
<Error Condition="!Exists('..\packages\Microsoft.Windows.CppWinRT.2.0.221104.6\build\native\Microsoft.Windows.CppWinRT.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Windows.CppWinRT.2.0.221104.6\build\native\Microsoft.Windows.CppWinRT.props'))" />
<Error Condition="!Exists('..\packages\Microsoft.Windows.CppWinRT.2.0.221104.6\build\native\Microsoft.Windows.CppWinRT.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Windows.CppWinRT.2.0.221104.6\build\native\Microsoft.Windows.CppWinRT.targets'))" />
</Target>
</Project>

View File

@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Windows.CppWinRT" version="2.0.220929.3" targetFramework="native" />
<package id="Microsoft.Windows.CppWinRT" version="2.0.221104.6" targetFramework="native" />
</packages>

View File

@@ -1,5 +1,7 @@
[*.cs]
file_header_template = Copyright (c) Microsoft Corporation\r\nThe Microsoft Corporation licenses this file to you under the MIT license.\r\nSee the LICENSE file in the project root for more information.
# SA1201: Elements should appear in the correct order
dotnet_diagnostic.SA1201.severity = none

View File

@@ -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.220929.3\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('..\..\packages\Microsoft.Windows.CppWinRT.2.0.220929.3\build\native\Microsoft.Windows.CppWinRT.props')" />
<Import Project="..\..\packages\Microsoft.Windows.CppWinRT.2.0.221104.6\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('..\..\packages\Microsoft.Windows.CppWinRT.2.0.221104.6\build\native\Microsoft.Windows.CppWinRT.props')" />
<Target Name="GenerateResourceFiles" BeforeTargets="PrepareForBuild">
<Exec Command="powershell -NonInteractive -executionpolicy Unrestricted $(SolutionDir)tools\build\convert-resx-to-rc.ps1 $(MSBuildThisFileDirectory) resource.base.h resource.h actionRunner.base.rc actionRunner.rc" />
</Target>
@@ -61,15 +61,15 @@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<Import Project="..\..\deps\spdlog.props" />
<ImportGroup Label="ExtensionTargets">
<Import Project="..\..\packages\Microsoft.Windows.CppWinRT.2.0.220929.3\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('..\..\packages\Microsoft.Windows.CppWinRT.2.0.220929.3\build\native\Microsoft.Windows.CppWinRT.targets')" />
<Import Project="..\..\packages\Microsoft.Windows.CppWinRT.2.0.221104.6\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('..\..\packages\Microsoft.Windows.CppWinRT.2.0.221104.6\build\native\Microsoft.Windows.CppWinRT.targets')" />
<Import Project="..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.220914.1\build\native\Microsoft.Windows.ImplementationLibrary.targets" Condition="Exists('..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.220914.1\build\native\Microsoft.Windows.ImplementationLibrary.targets')" />
</ImportGroup>
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\..\packages\Microsoft.Windows.CppWinRT.2.0.220929.3\build\native\Microsoft.Windows.CppWinRT.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Microsoft.Windows.CppWinRT.2.0.220929.3\build\native\Microsoft.Windows.CppWinRT.props'))" />
<Error Condition="!Exists('..\..\packages\Microsoft.Windows.CppWinRT.2.0.220929.3\build\native\Microsoft.Windows.CppWinRT.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Microsoft.Windows.CppWinRT.2.0.220929.3\build\native\Microsoft.Windows.CppWinRT.targets'))" />
<Error Condition="!Exists('..\..\packages\Microsoft.Windows.CppWinRT.2.0.221104.6\build\native\Microsoft.Windows.CppWinRT.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Microsoft.Windows.CppWinRT.2.0.221104.6\build\native\Microsoft.Windows.CppWinRT.props'))" />
<Error Condition="!Exists('..\..\packages\Microsoft.Windows.CppWinRT.2.0.221104.6\build\native\Microsoft.Windows.CppWinRT.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Microsoft.Windows.CppWinRT.2.0.221104.6\build\native\Microsoft.Windows.CppWinRT.targets'))" />
<Error Condition="!Exists('..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.220914.1\build\native\Microsoft.Windows.ImplementationLibrary.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.220914.1\build\native\Microsoft.Windows.ImplementationLibrary.targets'))" />
</Target>
</Project>

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Windows.CppWinRT" version="2.0.220929.3" targetFramework="native" />
<package id="Microsoft.Windows.CppWinRT" version="2.0.221104.6" targetFramework="native" />
<package id="Microsoft.Windows.ImplementationLibrary" version="1.0.220914.1" targetFramework="native" />
</packages>

View File

@@ -73,6 +73,9 @@ std::optional<fs::path> ObtainInstaller(bool& isUpToDate)
return std::nullopt;
}
// Cleanup old updates before downloading the latest
updating::cleanup_updates();
auto downloaded_installer = download_new_version(std::get<new_version_download_info>(*new_version_info)).get();
if (!downloaded_installer)
{

View File

@@ -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.220929.3\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('..\..\packages\Microsoft.Windows.CppWinRT.2.0.220929.3\build\native\Microsoft.Windows.CppWinRT.props')" />
<Import Project="..\..\packages\Microsoft.Windows.CppWinRT.2.0.221104.6\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('..\..\packages\Microsoft.Windows.CppWinRT.2.0.221104.6\build\native\Microsoft.Windows.CppWinRT.props')" />
<Target Name="GenerateResourceFiles" BeforeTargets="PrepareForBuild">
<Exec Command="powershell -NonInteractive -executionpolicy Unrestricted $(SolutionDir)tools\build\convert-resx-to-rc.ps1 $(MSBuildThisFileDirectory) resource.base.h resource.h PowerToys.Update.base.rc PowerToys.Update.rc" />
</Target>
@@ -67,15 +67,15 @@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<Import Project="..\..\deps\spdlog.props" />
<ImportGroup Label="ExtensionTargets">
<Import Project="..\..\packages\Microsoft.Windows.CppWinRT.2.0.220929.3\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('..\..\packages\Microsoft.Windows.CppWinRT.2.0.220929.3\build\native\Microsoft.Windows.CppWinRT.targets')" />
<Import Project="..\..\packages\Microsoft.Windows.CppWinRT.2.0.221104.6\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('..\..\packages\Microsoft.Windows.CppWinRT.2.0.221104.6\build\native\Microsoft.Windows.CppWinRT.targets')" />
<Import Project="..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.220914.1\build\native\Microsoft.Windows.ImplementationLibrary.targets" Condition="Exists('..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.220914.1\build\native\Microsoft.Windows.ImplementationLibrary.targets')" />
</ImportGroup>
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\..\packages\Microsoft.Windows.CppWinRT.2.0.220929.3\build\native\Microsoft.Windows.CppWinRT.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Microsoft.Windows.CppWinRT.2.0.220929.3\build\native\Microsoft.Windows.CppWinRT.props'))" />
<Error Condition="!Exists('..\..\packages\Microsoft.Windows.CppWinRT.2.0.220929.3\build\native\Microsoft.Windows.CppWinRT.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Microsoft.Windows.CppWinRT.2.0.220929.3\build\native\Microsoft.Windows.CppWinRT.targets'))" />
<Error Condition="!Exists('..\..\packages\Microsoft.Windows.CppWinRT.2.0.221104.6\build\native\Microsoft.Windows.CppWinRT.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Microsoft.Windows.CppWinRT.2.0.221104.6\build\native\Microsoft.Windows.CppWinRT.props'))" />
<Error Condition="!Exists('..\..\packages\Microsoft.Windows.CppWinRT.2.0.221104.6\build\native\Microsoft.Windows.CppWinRT.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Microsoft.Windows.CppWinRT.2.0.221104.6\build\native\Microsoft.Windows.CppWinRT.targets'))" />
<Error Condition="!Exists('..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.220914.1\build\native\Microsoft.Windows.ImplementationLibrary.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.220914.1\build\native\Microsoft.Windows.ImplementationLibrary.targets'))" />
</Target>
</Project>

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Windows.CppWinRT" version="2.0.220929.3" targetFramework="native" />
<package id="Microsoft.Windows.CppWinRT" version="2.0.221104.6" targetFramework="native" />
<package id="Microsoft.Windows.ImplementationLibrary" version="1.0.220914.1" targetFramework="native" />
</packages>

View File

@@ -27,6 +27,7 @@ namespace Common.UI
MeasureTool,
PowerOCR,
RegistryPreview,
CropAndLock,
}
private static string SettingsWindowNameToString(SettingsWindow value)
@@ -65,6 +66,8 @@ namespace Common.UI
return "PowerOCR";
case SettingsWindow.RegistryPreview:
return "RegistryPreview";
case SettingsWindow.CropAndLock:
return "CropAndLock";
default:
{
return string.Empty;

View File

@@ -16,6 +16,10 @@ namespace winrt::PowerToys::GPOWrapper::implementation
{
return static_cast<GpoRuleConfigured>(powertoys_gpo::getConfiguredColorPickerEnabledValue());
}
GpoRuleConfigured GPOWrapper::GetConfiguredCropAndLockEnabledValue()
{
return static_cast<GpoRuleConfigured>(powertoys_gpo::getConfiguredCropAndLockEnabledValue());
}
GpoRuleConfigured GPOWrapper::GetConfiguredFancyZonesEnabledValue()
{
return static_cast<GpoRuleConfigured>(powertoys_gpo::getConfiguredFancyZonesEnabledValue());

View File

@@ -10,6 +10,7 @@ namespace winrt::PowerToys::GPOWrapper::implementation
static GpoRuleConfigured GetConfiguredAlwaysOnTopEnabledValue();
static GpoRuleConfigured GetConfiguredAwakeEnabledValue();
static GpoRuleConfigured GetConfiguredColorPickerEnabledValue();
static GpoRuleConfigured GetConfiguredCropAndLockEnabledValue();
static GpoRuleConfigured GetConfiguredFancyZonesEnabledValue();
static GpoRuleConfigured GetConfiguredFileLocksmithEnabledValue();
static GpoRuleConfigured GetConfiguredSvgPreviewEnabledValue();

View File

@@ -14,6 +14,7 @@ namespace PowerToys
static GpoRuleConfigured GetConfiguredAlwaysOnTopEnabledValue();
static GpoRuleConfigured GetConfiguredAwakeEnabledValue();
static GpoRuleConfigured GetConfiguredColorPickerEnabledValue();
static GpoRuleConfigured GetConfiguredCropAndLockEnabledValue();
static GpoRuleConfigured GetConfiguredFancyZonesEnabledValue();
static GpoRuleConfigured GetConfiguredFileLocksmithEnabledValue();
static GpoRuleConfigured GetConfiguredSvgPreviewEnabledValue();

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.220929.3\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.220929.3\build\native\Microsoft.Windows.CppWinRT.props')" />
<Import Project="..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.221104.6\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.221104.6\build\native\Microsoft.Windows.CppWinRT.props')" />
<PropertyGroup Label="Globals">
<CppWinRTOptimized>true</CppWinRTOptimized>
<CppWinRTRootNamespaceAutoMerge>true</CppWinRTRootNamespaceAutoMerge>
@@ -113,13 +113,13 @@
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
<Import Project="..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.220929.3\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.220929.3\build\native\Microsoft.Windows.CppWinRT.targets')" />
<Import Project="..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.221104.6\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.221104.6\build\native\Microsoft.Windows.CppWinRT.targets')" />
</ImportGroup>
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.220929.3\build\native\Microsoft.Windows.CppWinRT.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.220929.3\build\native\Microsoft.Windows.CppWinRT.props'))" />
<Error Condition="!Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.220929.3\build\native\Microsoft.Windows.CppWinRT.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.220929.3\build\native\Microsoft.Windows.CppWinRT.targets'))" />
<Error Condition="!Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.221104.6\build\native\Microsoft.Windows.CppWinRT.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.221104.6\build\native\Microsoft.Windows.CppWinRT.props'))" />
<Error Condition="!Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.221104.6\build\native\Microsoft.Windows.CppWinRT.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.221104.6\build\native\Microsoft.Windows.CppWinRT.targets'))" />
</Target>
</Project>

View File

@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Windows.CppWinRT" version="2.0.220929.3" targetFramework="native" />
<package id="Microsoft.Windows.CppWinRT" version="2.0.221104.6" targetFramework="native" />
</packages>

View File

@@ -26,5 +26,17 @@ namespace ManagedCommon
[DllImport("kernel32.dll", SetLastError = true)]
internal static extern bool CloseHandle(IntPtr hObject);
[DllImport("user32.dll", SetLastError = true)]
internal static extern IntPtr SetForegroundWindow(IntPtr hWnd);
[DllImport("user32.dll")]
internal static extern IntPtr GetForegroundWindow();
[DllImport("user32.dll")]
internal static extern uint GetWindowThreadProcessId(IntPtr hWnd, IntPtr processId);
[DllImport("user32.dll")]
internal static extern bool AttachThreadInput(uint idAttach, uint idAttachTo, bool fAttach);
}
}

View File

@@ -0,0 +1,30 @@
// Copyright (c) Microsoft Corporation
// 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;
namespace ManagedCommon
{
public class WindowHelpers
{
public static void BringToForeground(IntPtr handle)
{
var fgHandle = NativeMethods.GetForegroundWindow();
var threadId1 = NativeMethods.GetWindowThreadProcessId(handle, System.IntPtr.Zero);
var threadId2 = NativeMethods.GetWindowThreadProcessId(fgHandle, System.IntPtr.Zero);
if (threadId1 != threadId2)
{
NativeMethods.AttachThreadInput(threadId1, threadId2, true);
NativeMethods.SetForegroundWindow(handle);
NativeMethods.AttachThreadInput(threadId1, threadId2, false);
}
else
{
NativeMethods.SetForegroundWindow(handle);
}
}
}
}

View File

@@ -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.220929.3\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.220929.3\build\native\Microsoft.Windows.CppWinRT.props')" />
<Import Project="..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.221104.6\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.221104.6\build\native\Microsoft.Windows.CppWinRT.props')" />
<PropertyGroup Label="Globals">
<VCProjectVersion>16.0</VCProjectVersion>
@@ -45,13 +45,13 @@
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
<Import Project="..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.220929.3\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.220929.3\build\native\Microsoft.Windows.CppWinRT.targets')" />
<Import Project="..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.221104.6\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.221104.6\build\native\Microsoft.Windows.CppWinRT.targets')" />
</ImportGroup>
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.220929.3\build\native\Microsoft.Windows.CppWinRT.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.220929.3\build\native\Microsoft.Windows.CppWinRT.props'))" />
<Error Condition="!Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.220929.3\build\native\Microsoft.Windows.CppWinRT.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.220929.3\build\native\Microsoft.Windows.CppWinRT.targets'))" />
<Error Condition="!Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.221104.6\build\native\Microsoft.Windows.CppWinRT.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.221104.6\build\native\Microsoft.Windows.CppWinRT.props'))" />
<Error Condition="!Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.221104.6\build\native\Microsoft.Windows.CppWinRT.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.221104.6\build\native\Microsoft.Windows.CppWinRT.targets'))" />
</Target>
</Project>

View File

@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Windows.CppWinRT" version="2.0.220929.3" targetFramework="native" />
<package id="Microsoft.Windows.CppWinRT" version="2.0.221104.6" targetFramework="native" />
</packages>

View File

@@ -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.220929.3\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.220929.3\build\native\Microsoft.Windows.CppWinRT.props')" />
<Import Project="..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.221104.6\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.221104.6\build\native\Microsoft.Windows.CppWinRT.props')" />
<PropertyGroup Label="Globals">
<VCProjectVersion>16.0</VCProjectVersion>
<ProjectGuid>{98537082-0FDB-40DE-ABD8-0DC5A4269BAB}</ProjectGuid>
@@ -46,13 +46,13 @@
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
<Import Project="..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.220929.3\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.220929.3\build\native\Microsoft.Windows.CppWinRT.targets')" />
<Import Project="..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.221104.6\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.221104.6\build\native\Microsoft.Windows.CppWinRT.targets')" />
</ImportGroup>
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.220929.3\build\native\Microsoft.Windows.CppWinRT.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.220929.3\build\native\Microsoft.Windows.CppWinRT.props'))" />
<Error Condition="!Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.220929.3\build\native\Microsoft.Windows.CppWinRT.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.220929.3\build\native\Microsoft.Windows.CppWinRT.targets'))" />
<Error Condition="!Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.221104.6\build\native\Microsoft.Windows.CppWinRT.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.221104.6\build\native\Microsoft.Windows.CppWinRT.props'))" />
<Error Condition="!Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.221104.6\build\native\Microsoft.Windows.CppWinRT.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.221104.6\build\native\Microsoft.Windows.CppWinRT.targets'))" />
</Target>
</Project>

View File

@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Windows.CppWinRT" version="2.0.220929.3" targetFramework="native" />
<package id="Microsoft.Windows.CppWinRT" version="2.0.221104.6" targetFramework="native" />
</packages>

View File

@@ -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.220929.3\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.220929.3\build\native\Microsoft.Windows.CppWinRT.props')" />
<Import Project="..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.221104.6\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.221104.6\build\native\Microsoft.Windows.CppWinRT.props')" />
<PropertyGroup Label="Globals">
<VCProjectVersion>16.0</VCProjectVersion>
<ProjectGuid>{1A066C63-64B3-45F8-92FE-664E1CCE8077}</ProjectGuid>
@@ -60,13 +60,13 @@
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
<Import Project="..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.220929.3\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.220929.3\build\native\Microsoft.Windows.CppWinRT.targets')" />
<Import Project="..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.221104.6\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.221104.6\build\native\Microsoft.Windows.CppWinRT.targets')" />
</ImportGroup>
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.220929.3\build\native\Microsoft.Windows.CppWinRT.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.220929.3\build\native\Microsoft.Windows.CppWinRT.props'))" />
<Error Condition="!Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.220929.3\build\native\Microsoft.Windows.CppWinRT.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.220929.3\build\native\Microsoft.Windows.CppWinRT.targets'))" />
<Error Condition="!Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.221104.6\build\native\Microsoft.Windows.CppWinRT.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.221104.6\build\native\Microsoft.Windows.CppWinRT.props'))" />
<Error Condition="!Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.221104.6\build\native\Microsoft.Windows.CppWinRT.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.221104.6\build\native\Microsoft.Windows.CppWinRT.targets'))" />
</Target>
</Project>

View File

@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Windows.CppWinRT" version="2.0.220929.3" targetFramework="native" />
<package id="Microsoft.Windows.CppWinRT" version="2.0.221104.6" targetFramework="native" />
</packages>

View File

@@ -254,5 +254,13 @@ public
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);
}
};
}

View File

@@ -5,6 +5,8 @@
#include "keyboard_layout_impl.h"
#include "shared_constants.h"
constexpr DWORD numpadOriginBit = 1ull << 31;
LayoutMap::LayoutMap() :
impl(new LayoutMap::LayoutMapImpl())
{
@@ -110,7 +112,6 @@ void LayoutMap::LayoutMapImpl::UpdateLayout()
keyboardLayoutMap[VK_BACK] = L"Backspace";
keyboardLayoutMap[VK_TAB] = L"Tab";
keyboardLayoutMap[VK_CLEAR] = L"Clear";
keyboardLayoutMap[VK_RETURN] = L"Enter";
keyboardLayoutMap[VK_SHIFT] = L"Shift";
keyboardLayoutMap[VK_CONTROL] = L"Ctrl";
keyboardLayoutMap[VK_MENU] = L"Alt";
@@ -118,20 +119,37 @@ void LayoutMap::LayoutMapImpl::UpdateLayout()
keyboardLayoutMap[VK_CAPITAL] = L"Caps Lock";
keyboardLayoutMap[VK_ESCAPE] = L"Esc";
keyboardLayoutMap[VK_SPACE] = L"Space";
keyboardLayoutMap[VK_LEFT] = L"Left";
keyboardLayoutMap[VK_RIGHT] = L"Right";
keyboardLayoutMap[VK_UP] = L"Up";
keyboardLayoutMap[VK_DOWN] = L"Down";
keyboardLayoutMap[VK_INSERT] = L"Insert";
keyboardLayoutMap[VK_DELETE] = L"Delete";
keyboardLayoutMap[VK_PRIOR] = L"PgUp";
keyboardLayoutMap[VK_NEXT] = L"PgDn";
keyboardLayoutMap[VK_END] = L"End";
keyboardLayoutMap[VK_HOME] = L"Home";
keyboardLayoutMap[VK_LEFT] = L"Left";
keyboardLayoutMap[VK_UP] = L"Up";
keyboardLayoutMap[VK_RIGHT] = L"Right";
keyboardLayoutMap[VK_DOWN] = L"Down";
keyboardLayoutMap[VK_END] = L"End";
keyboardLayoutMap[VK_RETURN] = L"Enter";
keyboardLayoutMap[VK_LEFT | numpadOriginBit] = L"Left (Numpad)";
keyboardLayoutMap[VK_RIGHT | numpadOriginBit] = L"Right (Numpad)";
keyboardLayoutMap[VK_UP | numpadOriginBit] = L"Up (Numpad)";
keyboardLayoutMap[VK_DOWN | numpadOriginBit] = L"Down (Numpad)";
keyboardLayoutMap[VK_INSERT | numpadOriginBit] = L"Insert (Numpad)";
keyboardLayoutMap[VK_DELETE | numpadOriginBit] = L"Delete (Numpad)";
keyboardLayoutMap[VK_PRIOR | numpadOriginBit] = L"PgUp (Numpad)";
keyboardLayoutMap[VK_NEXT | numpadOriginBit] = L"PgDn (Numpad)";
keyboardLayoutMap[VK_HOME | numpadOriginBit] = L"Home (Numpad)";
keyboardLayoutMap[VK_END | numpadOriginBit] = L"End (Numpad)";
keyboardLayoutMap[VK_RETURN | numpadOriginBit] = L"Enter (Numpad)";
keyboardLayoutMap[VK_DIVIDE | numpadOriginBit] = L"/ (Numpad)";
keyboardLayoutMap[VK_SUBTRACT] = L"- (Substract)";
keyboardLayoutMap[VK_SELECT] = L"Select";
keyboardLayoutMap[VK_PRINT] = L"Print";
keyboardLayoutMap[VK_EXECUTE] = L"Execute";
keyboardLayoutMap[VK_SNAPSHOT] = L"Print Screen";
keyboardLayoutMap[VK_INSERT] = L"Insert";
keyboardLayoutMap[VK_DELETE] = L"Delete";
keyboardLayoutMap[VK_HELP] = L"Help";
keyboardLayoutMap[VK_LWIN] = L"Win (Left)";
keyboardLayoutMap[VK_RWIN] = L"Win (Right)";
@@ -275,6 +293,12 @@ std::vector<DWORD> LayoutMap::LayoutMapImpl::GetKeyCodeList(const bool isShortcu
}
}
// Add numpad keys
for (auto it = keyboardLayoutMap.rbegin(); it->first & numpadOriginBit; ++it)
{
keyCodes.push_back(it->first);
}
// Sort the special keys in alphabetical order
std::sort(specialKeys.begin(), specialKeys.end(), [&](const DWORD& lhs, const DWORD& rhs) {
return keyboardLayoutMap[lhs] < keyboardLayoutMap[rhs];

View File

@@ -74,6 +74,11 @@ namespace CommonSharedConstants
// Path to the event used to show Peek
const wchar_t SHOW_PEEK_SHARED_EVENT[] = L"Local\\ShowPeekEvent";
// Path to the events used by CropAndLock
const wchar_t CROP_AND_LOCK_REPARENT_EVENT[] = L"Local\\PowerToysCropAndLockReparentEvent-6060860a-76a1-44e8-8d0e-6355785e9c36";
const wchar_t CROP_AND_LOCK_THUMBNAIL_EVENT[] = L"Local\\PowerToysCropAndLockThumbnailEvent-1637be50-da72-46b2-9220-b32b206b2434";
const wchar_t CROP_AND_LOCK_EXIT_EVENT[] = L"Local\\PowerToysCropAndLockExitEvent-d995d409-7b70-482b-bad6-e7c8666f375a";
// Max DWORD for key code to disable keys.
const DWORD VK_DISABLED = 0x100;
}

View File

@@ -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.220929.3\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.220929.3\build\native\Microsoft.Windows.CppWinRT.props')" />
<Import Project="..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.221104.6\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.221104.6\build\native\Microsoft.Windows.CppWinRT.props')" />
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
@@ -80,13 +80,13 @@
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
<Import Project="..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.220929.3\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.220929.3\build\native\Microsoft.Windows.CppWinRT.targets')" />
<Import Project="..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.221104.6\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.221104.6\build\native\Microsoft.Windows.CppWinRT.targets')" />
</ImportGroup>
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.220929.3\build\native\Microsoft.Windows.CppWinRT.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.220929.3\build\native\Microsoft.Windows.CppWinRT.props'))" />
<Error Condition="!Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.220929.3\build\native\Microsoft.Windows.CppWinRT.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.220929.3\build\native\Microsoft.Windows.CppWinRT.targets'))" />
<Error Condition="!Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.221104.6\build\native\Microsoft.Windows.CppWinRT.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.221104.6\build\native\Microsoft.Windows.CppWinRT.props'))" />
<Error Condition="!Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.221104.6\build\native\Microsoft.Windows.CppWinRT.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.221104.6\build\native\Microsoft.Windows.CppWinRT.targets'))" />
</Target>
</Project>

View File

@@ -59,7 +59,8 @@ struct LogSettings
inline const static std::wstring alwaysOnTopLogPath = L"always-on-top-log.txt";
inline const static std::string hostsLoggerName = "hosts";
inline const static std::wstring hostsLogPath = L"Logs\\hosts-log.txt";
inline const static std::string registryPreviewLoggerName = "registrypreview";
inline const static std::string registryPreviewLoggerName = "registrypreview";
inline const static std::string cropAndLockLoggerName = "crop-and-lock";
inline const static std::wstring registryPreviewLogPath = L"Logs\\registryPreview-log.txt";
inline const static int retention = 30;
std::wstring logLevel;

View File

@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Windows.CppWinRT" version="2.0.220929.3" targetFramework="native" />
<package id="Microsoft.Windows.CppWinRT" version="2.0.221104.6" targetFramework="native" />
</packages>

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.220929.3\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.220929.3\build\native\Microsoft.Windows.CppWinRT.props')" />
<Import Project="..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.221104.6\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.221104.6\build\native\Microsoft.Windows.CppWinRT.props')" />
<PropertyGroup Label="Globals">
<CppWinRTOptimized>true</CppWinRTOptimized>
<CppWinRTRootNamespaceAutoMerge>true</CppWinRTRootNamespaceAutoMerge>
@@ -96,13 +96,13 @@
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
<Import Project="..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.220929.3\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.220929.3\build\native\Microsoft.Windows.CppWinRT.targets')" />
<Import Project="..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.221104.6\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.221104.6\build\native\Microsoft.Windows.CppWinRT.targets')" />
</ImportGroup>
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.220929.3\build\native\Microsoft.Windows.CppWinRT.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.220929.3\build\native\Microsoft.Windows.CppWinRT.props'))" />
<Error Condition="!Exists('..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.220929.3\build\native\Microsoft.Windows.CppWinRT.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.220929.3\build\native\Microsoft.Windows.CppWinRT.targets'))" />
<Error Condition="!Exists('..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.221104.6\build\native\Microsoft.Windows.CppWinRT.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.221104.6\build\native\Microsoft.Windows.CppWinRT.props'))" />
<Error Condition="!Exists('..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.221104.6\build\native\Microsoft.Windows.CppWinRT.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.221104.6\build\native\Microsoft.Windows.CppWinRT.targets'))" />
</Target>
</Project>

View File

@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Windows.CppWinRT" version="2.0.220929.3" targetFramework="native" />
<package id="Microsoft.Windows.CppWinRT" version="2.0.221104.6" targetFramework="native" />
</packages>

View File

@@ -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.220929.3\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.220929.3\build\native\Microsoft.Windows.CppWinRT.props')" />
<Import Project="..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.221104.6\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.221104.6\build\native\Microsoft.Windows.CppWinRT.props')" />
<PropertyGroup Label="Globals">
<VCProjectVersion>16.0</VCProjectVersion>
<ProjectGuid>{031AC72E-FA28-4AB7-B690-6F7B9C28AA73}</ProjectGuid>
@@ -64,7 +64,7 @@
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
<Import Project="..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.220929.3\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.220929.3\build\native\Microsoft.Windows.CppWinRT.targets')" />
<Import Project="..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.221104.6\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.221104.6\build\native\Microsoft.Windows.CppWinRT.targets')" />
</ImportGroup>
<ItemGroup>
<ProjectReference Include="..\BackgroundActivator\BackgroundActivator.vcxproj">
@@ -78,7 +78,7 @@
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.220929.3\build\native\Microsoft.Windows.CppWinRT.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.220929.3\build\native\Microsoft.Windows.CppWinRT.props'))" />
<Error Condition="!Exists('..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.220929.3\build\native\Microsoft.Windows.CppWinRT.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.220929.3\build\native\Microsoft.Windows.CppWinRT.targets'))" />
<Error Condition="!Exists('..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.221104.6\build\native\Microsoft.Windows.CppWinRT.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.221104.6\build\native\Microsoft.Windows.CppWinRT.props'))" />
<Error Condition="!Exists('..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.221104.6\build\native\Microsoft.Windows.CppWinRT.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.221104.6\build\native\Microsoft.Windows.CppWinRT.targets'))" />
</Target>
</Project>

View File

@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Windows.CppWinRT" version="2.0.220929.3" targetFramework="native" />
<package id="Microsoft.Windows.CppWinRT" version="2.0.221104.6" targetFramework="native" />
</packages>

View File

@@ -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.220929.3\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.220929.3\build\native\Microsoft.Windows.CppWinRT.props')" />
<Import Project="..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.221104.6\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.221104.6\build\native\Microsoft.Windows.CppWinRT.props')" />
<PropertyGroup Label="Globals">
<VCProjectVersion>16.0</VCProjectVersion>
<ProjectGuid>{1D5BE09D-78C0-4FD7-AF00-AE7C1AF7C525}</ProjectGuid>
@@ -42,15 +42,15 @@
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
<Import Project="..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.220929.3\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.220929.3\build\native\Microsoft.Windows.CppWinRT.targets')" />
<Import Project="..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.221104.6\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.221104.6\build\native\Microsoft.Windows.CppWinRT.targets')" />
<Import Project="..\..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.220914.1\build\native\Microsoft.Windows.ImplementationLibrary.targets" Condition="Exists('..\..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.220914.1\build\native\Microsoft.Windows.ImplementationLibrary.targets')" />
</ImportGroup>
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.220929.3\build\native\Microsoft.Windows.CppWinRT.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.220929.3\build\native\Microsoft.Windows.CppWinRT.props'))" />
<Error Condition="!Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.220929.3\build\native\Microsoft.Windows.CppWinRT.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.220929.3\build\native\Microsoft.Windows.CppWinRT.targets'))" />
<Error Condition="!Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.221104.6\build\native\Microsoft.Windows.CppWinRT.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.221104.6\build\native\Microsoft.Windows.CppWinRT.props'))" />
<Error Condition="!Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.221104.6\build\native\Microsoft.Windows.CppWinRT.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.221104.6\build\native\Microsoft.Windows.CppWinRT.targets'))" />
<Error Condition="!Exists('..\..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.220914.1\build\native\Microsoft.Windows.ImplementationLibrary.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.220914.1\build\native\Microsoft.Windows.ImplementationLibrary.targets'))" />
</Target>
</Project>

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Windows.CppWinRT" version="2.0.220929.3" targetFramework="native" />
<package id="Microsoft.Windows.CppWinRT" version="2.0.221104.6" targetFramework="native" />
<package id="Microsoft.Windows.ImplementationLibrary" version="1.0.220914.1" targetFramework="native" />
</packages>

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Windows.CppWinRT" version="2.0.220929.3" targetFramework="native" />
<package id="Microsoft.Windows.CppWinRT" version="2.0.221104.6" targetFramework="native" />
<package id="Microsoft.Windows.ImplementationLibrary" version="1.0.220914.1" targetFramework="native" />
</packages>

View File

@@ -1,6 +1,7 @@
#include "pch.h"
#include <common/utils/HttpClient.h>
#include <common/utils/string_utils.h>
#include <common/version/version.h>
#include <common/version/helper.h>
@@ -185,4 +186,48 @@ namespace updating
co_return download_success ? installer_download_path : std::nullopt;
}
void cleanup_updates()
{
auto update_dir = updating::get_pending_updates_path();
if (std::filesystem::exists(update_dir))
{
// Msi and exe files
for (const auto& entry : std::filesystem::directory_iterator(update_dir))
{
auto entryPath = entry.path().wstring();
std::transform(entryPath.begin(), entryPath.end(), entryPath.begin(), ::towlower);
if (entryPath.ends_with(L".msi") || entryPath.ends_with(L".exe"))
{
std::error_code err;
std::filesystem::remove(entry, err);
if (err.value())
{
Logger::warn("Failed to delete installer file {}. {}", entry.path().string(), err.message());
}
}
}
}
// Log files
auto rootPath{ PTSettingsHelper::get_root_save_folder_location() };
auto currentVersion = left_trim<wchar_t>(get_product_version(), L"v");
if (std::filesystem::exists(rootPath))
{
for (const auto& entry : std::filesystem::directory_iterator(rootPath))
{
auto entryPath = entry.path().wstring();
std::transform(entryPath.begin(), entryPath.end(), entryPath.begin(), ::towlower);
if (entry.is_regular_file() && entryPath.ends_with(L".log") && entryPath.find(currentVersion) == std::string::npos)
{
std::error_code err;
std::filesystem::remove(entry, err);
if (err.value())
{
Logger::warn("Failed to delete log file {}. {}", entry.path().string(), err.message());
}
}
}
}
}
}

View File

@@ -28,6 +28,7 @@ namespace updating
std::future<std::optional<std::filesystem::path>> download_new_version(const new_version_download_info& new_version);
std::filesystem::path get_pending_updates_path();
std::future<nonstd::expected<github_version_info, std::wstring>> get_github_version_info_async(const bool prerelease = false);
void cleanup_updates();
// non-localized
constexpr inline std::wstring_view INSTALLER_FILENAME_PATTERN = L"powertoyssetup";

View File

@@ -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.220929.3\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.220929.3\build\native\Microsoft.Windows.CppWinRT.props')" />
<Import Project="..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.221104.6\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.221104.6\build\native\Microsoft.Windows.CppWinRT.props')" />
<PropertyGroup Label="Globals">
<VCProjectVersion>16.0</VCProjectVersion>
<ProjectGuid>{17DA04DF-E393-4397-9CF0-84DABE11032E}</ProjectGuid>
@@ -60,15 +60,15 @@
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
<Import Project="..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.220929.3\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.220929.3\build\native\Microsoft.Windows.CppWinRT.targets')" />
<Import Project="..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.221104.6\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.221104.6\build\native\Microsoft.Windows.CppWinRT.targets')" />
<Import Project="..\..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.220914.1\build\native\Microsoft.Windows.ImplementationLibrary.targets" Condition="Exists('..\..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.220914.1\build\native\Microsoft.Windows.ImplementationLibrary.targets')" />
</ImportGroup>
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.220929.3\build\native\Microsoft.Windows.CppWinRT.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.220929.3\build\native\Microsoft.Windows.CppWinRT.props'))" />
<Error Condition="!Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.220929.3\build\native\Microsoft.Windows.CppWinRT.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.220929.3\build\native\Microsoft.Windows.CppWinRT.targets'))" />
<Error Condition="!Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.221104.6\build\native\Microsoft.Windows.CppWinRT.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.221104.6\build\native\Microsoft.Windows.CppWinRT.props'))" />
<Error Condition="!Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.221104.6\build\native\Microsoft.Windows.CppWinRT.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.221104.6\build\native\Microsoft.Windows.CppWinRT.targets'))" />
<Error Condition="!Exists('..\..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.220914.1\build\native\Microsoft.Windows.ImplementationLibrary.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.220914.1\build\native\Microsoft.Windows.ImplementationLibrary.targets'))" />
</Target>
</Project>

View File

@@ -0,0 +1,13 @@
#pragma once
inline bool GetAnimationsEnabled()
{
BOOL enabled = 0;
BOOL fResult;
fResult = SystemParametersInfo(SPI_GETCLIENTAREAANIMATION, 0, &enabled, 0);
if (!fResult)
{
Logger::error("SystemParametersInfo SPI_GETCLIENTAREAANIMATION failed.");
}
return enabled;
}

View File

@@ -331,20 +331,19 @@ inline bool run_non_elevated(const std::wstring& file, const std::wstring& param
inline bool RunNonElevatedEx(const std::wstring& file, const std::wstring& params, const std::wstring& working_dir)
{
bool success = false;
HRESULT co_init = E_FAIL;
try
{
CoInitialize(nullptr);
if (!ShellExecuteFromExplorer(file.c_str(), params.c_str(), working_dir.c_str()))
{
return false;
}
co_init = CoInitialize(nullptr);
success = ShellExecuteFromExplorer(file.c_str(), params.c_str(), working_dir.c_str());
}
catch (...)
{
return false;
}
if (SUCCEEDED(co_init)) CoUninitialize();
return true;
return success;
}
struct ProcessInfo
@@ -494,4 +493,4 @@ inline bool check_user_is_admin()
freeMemory(pSID, pGroupInfo);
return false;
}
}

View File

@@ -22,6 +22,7 @@ namespace powertoys_gpo {
const std::wstring POLICY_CONFIGURE_ENABLED_ALWAYS_ON_TOP = L"ConfigureEnabledUtilityAlwaysOnTop";
const std::wstring POLICY_CONFIGURE_ENABLED_AWAKE = L"ConfigureEnabledUtilityAwake";
const std::wstring POLICY_CONFIGURE_ENABLED_COLOR_PICKER = L"ConfigureEnabledUtilityColorPicker";
const std::wstring POLICY_CONFIGURE_ENABLED_CROP_AND_LOCK = L"ConfigureEnabledUtilityCropAndLock";
const std::wstring POLICY_CONFIGURE_ENABLED_FANCYZONES = L"ConfigureEnabledUtilityFancyZones";
const std::wstring POLICY_CONFIGURE_ENABLED_FILE_LOCKSMITH = L"ConfigureEnabledUtilityFileLocksmith";
const std::wstring POLICY_CONFIGURE_ENABLED_SVG_PREVIEW = L"ConfigureEnabledUtilityFileExplorerSVGPreview";
@@ -129,6 +130,11 @@ namespace powertoys_gpo {
return getConfiguredValue(POLICY_CONFIGURE_ENABLED_COLOR_PICKER);
}
inline gpo_rule_configured_t getConfiguredCropAndLockEnabledValue()
{
return getConfiguredValue(POLICY_CONFIGURE_ENABLED_CROP_AND_LOCK);
}
inline gpo_rule_configured_t getConfiguredFancyZonesEnabledValue()
{
return getConfiguredValue(POLICY_CONFIGURE_ENABLED_FANCYZONES);

View File

@@ -54,3 +54,12 @@ inline void replace_chars(std::basic_string<CharT>& s,
std::replace(begin(s), end(s), c, replacement_char);
}
}
inline std::string unwide(const std::wstring& wide)
{
std::string result(wide.length(), 0);
std::transform(begin(wide), end(wide), result.begin(), [](const wchar_t c) {
return static_cast<char>(c);
});
return result;
}

View File

@@ -1,17 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) Microsoft Corporation.
Licensed under the MIT License. -->
<policyDefinitions xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" revision="1.2" schemaVersion="1.0" xmlns="http://schemas.microsoft.com/GroupPolicy/2006/07/PolicyDefinitions">
<policyDefinitions xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" revision="1.3" schemaVersion="1.0" xmlns="http://schemas.microsoft.com/GroupPolicy/2006/07/PolicyDefinitions">
<policyNamespaces>
<target prefix="powertoys" namespace="Microsoft.Policies.PowerToys" />
</policyNamespaces>
<resources minRequiredRevision="1.2"/><!-- Last changed with PowerToys v0.70.0 -->
<resources minRequiredRevision="1.3"/><!-- Last changed with PowerToys v0.73.0 -->
<supportedOn>
<definitions>
<definition name="SUPPORTED_POWERTOYS_0_64_0" displayName="$(string.SUPPORTED_POWERTOYS_0_64_0)"/>
<definition name="SUPPORTED_POWERTOYS_0_68_0" displayName="$(string.SUPPORTED_POWERTOYS_0_68_0)"/>
<definition name="SUPPORTED_POWERTOYS_0_69_0" displayName="$(string.SUPPORTED_POWERTOYS_0_69_0)"/>
<definition name="SUPPORTED_POWERTOYS_0_70_0" displayName="$(string.SUPPORTED_POWERTOYS_0_70_0)"/>
<definition name="SUPPORTED_POWERTOYS_0_73_0" displayName="$(string.SUPPORTED_POWERTOYS_0_73_0)"/>
</definitions>
</supportedOn>
<categories>
@@ -51,6 +52,16 @@
<decimal value="0" />
</disabledValue>
</policy>
<policy name="ConfigureEnabledUtilityCropAndLock" class="Both" displayName="$(string.ConfigureEnabledUtilityCropAndLock)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityCropAndLock">
<parentCategory ref="PowerToys" />
<supportedOn ref="SUPPORTED_POWERTOYS_0_73_0" />
<enabledValue>
<decimal value="1" />
</enabledValue>
<disabledValue>
<decimal value="0" />
</disabledValue>
</policy>
<policy name="ConfigureEnabledUtilityFancyZones" class="Both" displayName="$(string.ConfigureEnabledUtilityFancyZones)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityFancyZones">
<parentCategory ref="PowerToys" />
<supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" />

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) Microsoft Corporation.
Licensed under the MIT License. -->
<policyDefinitionResources xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" revision="1.2" schemaVersion="1.0" xmlns="http://schemas.microsoft.com/GroupPolicy/2006/07/PolicyDefinitions">
<policyDefinitionResources xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" revision="1.3" schemaVersion="1.0" xmlns="http://schemas.microsoft.com/GroupPolicy/2006/07/PolicyDefinitions">
<displayName>PowerToys</displayName>
<description>PowerToys</description>
<resources>
@@ -13,6 +13,7 @@
<string id="SUPPORTED_POWERTOYS_0_68_0">PowerToys version 0.68.0 or later</string>
<string id="SUPPORTED_POWERTOYS_0_69_0">PowerToys version 0.69.0 or later</string>
<string id="SUPPORTED_POWERTOYS_0_70_0">PowerToys version 0.70.0 or later</string>
<string id="SUPPORTED_POWERTOYS_0_73_0">PowerToys version 0.73.0 or later</string>
<string id="ConfigureEnabledUtilityDescription">This policy configures the enabled state for a PowerToys utility.
@@ -67,6 +68,7 @@ If this setting is disabled, experimentation is not allowed.
<string id="ConfigureEnabledUtilityAlwaysOnTop">Always On Top: Configure enabled state</string>
<string id="ConfigureEnabledUtilityAwake">Awake: Configure enabled state</string>
<string id="ConfigureEnabledUtilityColorPicker">Color Picker: Configure enabled state</string>
<string id="ConfigureEnabledUtilityCropAndLock">Crop And Lock: Configure enabled state</string>
<string id="ConfigureEnabledUtilityFancyZones">FancyZones: Configure enabled state</string>
<string id="ConfigureEnabledUtilityFileLocksmith">File Locksmith: Configure enabled state</string>
<string id="ConfigureEnabledUtilityFileExplorerSVGPreview">SVG file preview: Configure enabled state</string>

View File

@@ -0,0 +1,56 @@
#include "pch.h"
#include "ChildWindow.h"
namespace util
{
using namespace robmikh::common::desktop;
using namespace robmikh::common::desktop::controls;
}
const std::wstring ChildWindow::ClassName = L"CropAndLock.ChildWindow";
std::once_flag ChildWindowClassRegistration;
void ChildWindow::RegisterWindowClass()
{
auto instance = winrt::check_pointer(GetModuleHandleW(nullptr));
WNDCLASSEXW wcex = {};
wcex.cbSize = sizeof(wcex);
wcex.style = CS_HREDRAW | CS_VREDRAW;
wcex.lpfnWndProc = WndProc;
wcex.hInstance = instance;
wcex.hIcon = LoadIconW(instance, IDI_APPLICATION);
wcex.hCursor = LoadCursorW(nullptr, IDC_ARROW);
wcex.hbrBackground = reinterpret_cast<HBRUSH>(COLOR_WINDOW + 1);
wcex.lpszClassName = ClassName.c_str();
wcex.hIconSm = LoadIconW(wcex.hInstance, IDI_APPLICATION);
winrt::check_bool(RegisterClassExW(&wcex));
}
ChildWindow::ChildWindow(int width, int height, HWND parent)
{
auto instance = winrt::check_pointer(GetModuleHandleW(nullptr));
std::call_once(ChildWindowClassRegistration, []() { RegisterWindowClass(); });
auto exStyle = 0;
auto style = WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS;
winrt::check_bool(CreateWindowExW(exStyle, ClassName.c_str(), L"", style,
0, 0, width, height, parent, nullptr, instance, this));
WINRT_ASSERT(m_window);
ShowWindow(m_window, SW_SHOW);
UpdateWindow(m_window);
}
LRESULT ChildWindow::MessageHandler(UINT const message, WPARAM const wparam, LPARAM const lparam)
{
switch (message)
{
case WM_DESTROY:
break;
default:
return base_type::MessageHandler(message, wparam, lparam);
}
return 0;
}

View File

@@ -0,0 +1,11 @@
#pragma once
#include <robmikh.common/DesktopWindow.h>
struct ChildWindow : robmikh::common::desktop::DesktopWindow<ChildWindow>
{
static const std::wstring ClassName;
ChildWindow(int width, int height, HWND parent);
LRESULT MessageHandler(UINT const message, WPARAM const wparam, LPARAM const lparam);
private:
static void RegisterWindowClass();
};

View File

@@ -0,0 +1,105 @@
// Microsoft Visual C++ generated resource script.
//
#include "resource.h"
#include "../../../common/version/version.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "winres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
1 VERSIONINFO
FILEVERSION FILE_VERSION
PRODUCTVERSION PRODUCT_VERSION
FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
#ifdef _DEBUG
FILEFLAGS VS_FF_DEBUG
#else
FILEFLAGS 0x0L
#endif
FILEOS VOS_NT_WINDOWS32
FILETYPE VFT_DLL
FILESUBTYPE VFT2_UNKNOWN
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0" // US English (0x0409), Unicode (0x04B0) charset
BEGIN
VALUE "CompanyName", COMPANY_NAME
VALUE "FileDescription", FILE_DESCRIPTION
VALUE "FileVersion", FILE_VERSION_STRING
VALUE "InternalName", INTERNAL_NAME
VALUE "LegalCopyright", COPYRIGHT_NOTE
VALUE "OriginalFilename", ORIGINAL_FILENAME
VALUE "ProductName", PRODUCT_NAME
VALUE "ProductVersion", PRODUCT_VERSION_STRING
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200 // US English (0x0409), Unicode (1200) charset
END
END
/////////////////////////////////////////////////////////////////////////////
// English (United States) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE
BEGIN
"#include ""winres.h""\r\n"
"\0"
END
3 TEXTINCLUDE
BEGIN
"\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Icon
//
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDI_ICON1 ICON "icon1.ico"
#endif // English (United States) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

View File

@@ -0,0 +1,170 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.221104.6\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.221104.6\build\native\Microsoft.Windows.CppWinRT.props')" />
<PropertyGroup Label="Globals">
<CppWinRTOptimized>true</CppWinRTOptimized>
<CppWinRTRootNamespaceAutoMerge>true</CppWinRTRootNamespaceAutoMerge>
<CppWinRTGenerateWindowsMetadata>true</CppWinRTGenerateWindowsMetadata>
<MinimalCoreWin>true</MinimalCoreWin>
<VCProjectVersion>15.0</VCProjectVersion>
<ProjectGuid>{f5e1146e-b7b3-4e11-85fd-270a500bd78c}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>CropAndLock</RootNamespace>
<WindowsTargetPlatformVersion Condition=" '$(WindowsTargetPlatformVersion)' == '' ">10.0.20348.0</WindowsTargetPlatformVersion>
<WindowsTargetPlatformMinVersion>10.0.19041.0</WindowsTargetPlatformMinVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|ARM64">
<Configuration>Debug</Configuration>
<Platform>ARM64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|ARM64">
<Configuration>Release</Configuration>
<Platform>ARM64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PlatformToolset>v143</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '16.0'">v142</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '17.0'">v143</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '18.0'">v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
<SpectreMitigation>Spectre</SpectreMitigation>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)'=='Debug'" Label="Configuration">
<UseDebugLibraries>true</UseDebugLibraries>
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)'=='Release'" Label="Configuration">
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets">
<Import Project="PropertySheet.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<TargetName>PowerToys.$(MSBuildProjectName)</TargetName>
<OutDir>..\..\..\..\$(Platform)\$(Configuration)\</OutDir>
</PropertyGroup>
<ItemDefinitionGroup>
<ClCompile>
<PreprocessorDefinitions>_CONSOLE;WINRT_LEAN_AND_MEAN;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<WarningLevel>Level4</WarningLevel>
<AdditionalOptions>%(AdditionalOptions) /bigobj</AdditionalOptions>
<AdditionalIncludeDirectories>$(SolutionDir)src\common\Telemetry;$(SolutionDir)src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<AdditionalDependencies>shell32.lib;dwmapi.lib;DbgHelp.lib;gdi32.lib;Shcore.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)'=='Debug'">
<ClCompile>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">MultiThreadedDebug</RuntimeLibrary>
<RuntimeLibrary Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">MultiThreadedDebug</RuntimeLibrary>
</ClCompile>
<Link>
<GenerateWindowsMetadata>false</GenerateWindowsMetadata>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)'=='Release'">
<ClCompile>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">MultiThreaded</RuntimeLibrary>
<RuntimeLibrary Condition="'$(Configuration)|$(Platform)'=='Release|x64'">MultiThreaded</RuntimeLibrary>
</ClCompile>
<Link>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateWindowsMetadata>false</GenerateWindowsMetadata>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<None Include="packages.config" />
<None Include="PropertySheet.props" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="ChildWindow.cpp" />
<ClCompile Include="main.cpp" />
<ClCompile Include="ReparentCropAndLockWindow.cpp" />
<ClCompile Include="ThumbnailCropAndLockWindow.cpp" />
<ClCompile Include="OverlayWindow.cpp" />
<ClCompile Include="pch.cpp">
<PrecompiledHeader Condition="'$(CIBuild)'!='true'">Create</PrecompiledHeader>
</ClCompile>
<ClCompile Include="trace.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="ChildWindow.h" />
<ClInclude Include="CropAndLockWindow.h" />
<ClInclude Include="DisplaysUtil.h" />
<ClInclude Include="ModuleConstants.h" />
<ClInclude Include="ReparentCropAndLockWindow.h" />
<ClInclude Include="ThumbnailCropAndLockWindow.h" />
<ClInclude Include="SettingsWindow.h" />
<ClInclude Include="OverlayWindow.h" />
<ClInclude Include="pch.h" />
<ClInclude Include="resource.h" />
<ClInclude Include="ThumbnailUtil.h" />
<ClInclude Include="trace.h" />
<ClInclude Include="WindowRectUtil.h" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="CropAndLock.rc" />
</ItemGroup>
<ItemGroup>
<Image Include="icon1.ico" />
</ItemGroup>
<ItemGroup>
<Manifest Include="app.manifest" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\common\logger\logger.vcxproj">
<Project>{d9b8fc84-322a-4f9f-bbb9-20915c47ddfd}</Project>
</ProjectReference>
<ProjectReference Include="..\..\..\common\SettingsAPI\SettingsAPI.vcxproj">
<Project>{6955446d-23f7-4023-9bb3-8657f904af99}</Project>
</ProjectReference>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<Import Project="..\..\..\..\deps\spdlog.props" />
<ImportGroup Label="ExtensionTargets">
<Import Project="..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.221104.6\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.221104.6\build\native\Microsoft.Windows.CppWinRT.targets')" />
<Import Project="..\..\..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.220914.1\build\native\Microsoft.Windows.ImplementationLibrary.targets" Condition="Exists('..\..\..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.220914.1\build\native\Microsoft.Windows.ImplementationLibrary.targets')" />
<Import Project="..\..\..\..\packages\robmikh.common.0.0.22-beta\build\native\robmikh.common.targets" Condition="Exists('..\..\..\..\packages\robmikh.common.0.0.22-beta\build\native\robmikh.common.targets')" />
</ImportGroup>
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.221104.6\build\native\Microsoft.Windows.CppWinRT.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.221104.6\build\native\Microsoft.Windows.CppWinRT.props'))" />
<Error Condition="!Exists('..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.221104.6\build\native\Microsoft.Windows.CppWinRT.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.221104.6\build\native\Microsoft.Windows.CppWinRT.targets'))" />
<Error Condition="!Exists('..\..\..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.220914.1\build\native\Microsoft.Windows.ImplementationLibrary.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.220914.1\build\native\Microsoft.Windows.ImplementationLibrary.targets'))" />
<Error Condition="!Exists('..\..\..\..\packages\robmikh.common.0.0.22-beta\build\native\robmikh.common.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\packages\robmikh.common.0.0.22-beta\build\native\robmikh.common.targets'))" />
</Target>
</Project>

View File

@@ -0,0 +1,43 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<None Include="PropertySheet.props" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="main.cpp" />
<ClCompile Include="pch.cpp" />
<ClCompile Include="ThumbnailCropAndLockWindow.cpp" />
<ClCompile Include="OverlayWindow.cpp" />
<ClCompile Include="ReparentCropAndLockWindow.cpp" />
<ClCompile Include="ChildWindow.cpp" />
<ClCompile Include="trace.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="pch.h" />
<ClInclude Include="ThumbnailCropAndLockWindow.h" />
<ClInclude Include="resource.h" />
<ClInclude Include="SettingsWindow.h" />
<ClInclude Include="OverlayWindow.h" />
<ClInclude Include="DisplaysUtil.h" />
<ClInclude Include="ThumbnailUtil.h" />
<ClInclude Include="WindowRectUtil.h" />
<ClInclude Include="CropAndLockWindow.h" />
<ClInclude Include="ReparentCropAndLockWindow.h" />
<ClInclude Include="ChildWindow.h" />
<ClInclude Include="trace.h" />
<ClInclude Include="ModuleConstants.h" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="CropAndLock.rc" />
</ItemGroup>
<ItemGroup>
<Image Include="icon1.ico" />
</ItemGroup>
<ItemGroup>
<Manifest Include="app.manifest" />
</ItemGroup>
<ItemGroup>
<Natvis Include="$(MSBuildThisFileDirectory)..\..\natvis\wil.natvis" />
</ItemGroup>
</Project>

View File

@@ -0,0 +1,10 @@
#pragma once
struct CropAndLockWindow
{
virtual ~CropAndLockWindow() {}
virtual HWND Handle() = 0;
virtual void CropAndLock(HWND windowToCrop, RECT cropRect) = 0;
virtual void OnClosed(std::function<void(HWND)> callback) = 0;
};

View File

@@ -0,0 +1,25 @@
#pragma once
inline RECT ComputeAllDisplaysUnion(std::vector<robmikh::common::desktop::DisplayInfo> const& infos)
{
RECT result = {};
result.left = LONG_MAX;
result.top = LONG_MAX;
result.right = LONG_MIN;
result.bottom = LONG_MIN;
for (auto&& info : infos)
{
auto rect = info.Rect();
result.left = std::min(result.left, rect.left);
result.top = std::min(result.top, rect.top);
result.right = std::max(result.right, rect.right);
result.bottom = std::max(result.bottom, rect.bottom);
}
return result;
}
inline RECT ComputeAllDisplaysUnion()
{
auto infos = robmikh::common::desktop::DisplayInfo::GetAllDisplays();
return ComputeAllDisplaysUnion(infos);
}

View File

@@ -0,0 +1,6 @@
#pragma once
namespace NonLocalizable
{
const inline wchar_t ModuleKey[] = L"CropAndLock";
}

View File

@@ -0,0 +1,356 @@
#include "pch.h"
#include "OverlayWindow.h"
namespace winrt
{
using namespace Windows::UI;
using namespace Windows::UI::Composition;
}
namespace util
{
using namespace robmikh::common::desktop;
}
const std::wstring OverlayWindow::ClassName = L"CropAndLock.OverlayWindow";
const float OverlayWindow::BorderThickness = 5;
std::once_flag OverlayWindowClassRegistration;
bool IsPointWithinRect(POINT const& point, RECT const& rect)
{
return point.x >= rect.left && point.x <= rect.right && point.y >= rect.top && point.y <= rect.bottom;
}
void OverlayWindow::RegisterWindowClass()
{
auto instance = winrt::check_pointer(GetModuleHandleW(nullptr));
WNDCLASSEXW wcex = {};
wcex.cbSize = sizeof(wcex);
wcex.lpfnWndProc = WndProc;
wcex.hInstance = instance;
wcex.hIcon = LoadIconW(instance, IDI_APPLICATION);
wcex.hCursor = LoadCursorW(nullptr, IDC_ARROW);
wcex.lpszClassName = ClassName.c_str();
wcex.hIconSm = LoadIconW(instance, IDI_APPLICATION);
winrt::check_bool(RegisterClassExW(&wcex));
}
OverlayWindow::OverlayWindow(
winrt::Compositor const& compositor,
HWND windowToCrop,
std::function<void(HWND, RECT)> windowCropped)
{
auto instance = winrt::check_pointer(GetModuleHandleW(nullptr));
std::call_once(OverlayWindowClassRegistration, []() { RegisterWindowClass(); });
auto exStyle = WS_EX_NOREDIRECTIONBITMAP | WS_EX_TOOLWINDOW | WS_EX_LAYERED | WS_EX_TOPMOST;
auto style = WS_POPUP;
// Get the union of all displays
auto displaysRect = ComputeAllDisplaysUnion();
// Create our window
winrt::check_bool(CreateWindowExW(exStyle, ClassName.c_str(), L"", style,
displaysRect.left, displaysRect.top, displaysRect.right - displaysRect.left, displaysRect.bottom - displaysRect.top, nullptr, nullptr, instance, this));
WINRT_ASSERT(m_window);
// Load cursors
m_standardCursor.reset(winrt::check_pointer(LoadCursorW(nullptr, IDC_ARROW)));
m_crosshairCursor.reset(winrt::check_pointer(LoadCursorW(nullptr, IDC_CROSS)));
m_cursorType = CursorType::Standard;
// Setup the visual tree
m_compositor = compositor;
m_target = CreateWindowTarget(m_compositor);
m_rootVisual = m_compositor.CreateContainerVisual();
m_shadeVisual = m_compositor.CreateSpriteVisual();
m_windowAreaVisual = m_compositor.CreateContainerVisual();
m_selectionVisual = m_compositor.CreateSpriteVisual();
m_target.Root(m_rootVisual);
auto children = m_rootVisual.Children();
children.InsertAtBottom(m_shadeVisual);
children.InsertAtTop(m_windowAreaVisual);
m_windowAreaVisual.Children().InsertAtTop(m_selectionVisual);
m_rootVisual.RelativeSizeAdjustment({ 1, 1 });
m_shadeBrush = m_compositor.CreateNineGridBrush();
m_shadeBrush.IsCenterHollow(true);
m_shadeBrush.Source(m_compositor.CreateColorBrush(winrt::Color{ 255, 0, 0, 0 }));
m_shadeVisual.Brush(m_shadeBrush);
m_shadeVisual.Opacity(0.6f);
m_shadeVisual.RelativeSizeAdjustment({ 1, 1 });
auto selectionBrush = m_compositor.CreateNineGridBrush();
selectionBrush.SetInsets(BorderThickness);
selectionBrush.IsCenterHollow(true);
selectionBrush.Source(m_compositor.CreateColorBrush(winrt::Color{ 255, 255, 0, 0 }));
m_selectionVisual.Brush(selectionBrush);
WINRT_VERIFY(windowToCrop != nullptr);
m_currentWindow = windowToCrop;
SetupOverlay();
m_windowCropped = windowCropped;
ShowWindow(m_window, SW_SHOW);
UpdateWindow(m_window);
SetForegroundWindow(m_window);
}
void OverlayWindow::SetupOverlay()
{
ResetCrop();
// Get the client bounds of the target window
auto windowBounds = ClientAreaInScreenSpace(m_currentWindow);
// Get the union of all displays
auto displaysRect = ComputeAllDisplaysUnion();
// Before we can use the window bounds, we need to
// shift the origin to the top-left most point.
m_currentWindowAreaBounds.left = windowBounds.left - displaysRect.left;
m_currentWindowAreaBounds.top = windowBounds.top - displaysRect.top;
m_currentWindowAreaBounds.right = m_currentWindowAreaBounds.left + (windowBounds.right - windowBounds.left);
m_currentWindowAreaBounds.bottom = m_currentWindowAreaBounds.top + (windowBounds.bottom - windowBounds.top);
auto windowLeft = static_cast<float>(m_currentWindowAreaBounds.left);
auto windowTop = static_cast<float>(m_currentWindowAreaBounds.top);
auto windowWidth = static_cast<float>(windowBounds.right - windowBounds.left);
auto windowHeight = static_cast<float>(windowBounds.bottom - windowBounds.top);
// Change the shade brush to match the window bounds
// We need to make sure the values are non-negative, as they are invalid insets. We
// can sometimes get negative values for the left and top when windows are maximized.
m_shadeBrush.LeftInset(std::max(windowLeft, 0.0f));
m_shadeBrush.TopInset(std::max(windowTop, 0.0f));
m_shadeBrush.RightInset(std::max(static_cast<float>(displaysRect.right - windowBounds.right), 0.0f));
m_shadeBrush.BottomInset(std::max(static_cast<float>(displaysRect.bottom - windowBounds.bottom), 0.0f));
// Change the window area visual to match the window bounds
m_windowAreaVisual.Offset({ windowLeft, windowTop, 0 });
m_windowAreaVisual.Size({ windowWidth, windowHeight });
// Reset the selection visual
m_selectionVisual.Offset({ 0, 0, 0 });
m_selectionVisual.Size({ 0, 0 });
}
LRESULT OverlayWindow::MessageHandler(UINT const message, WPARAM const wparam, LPARAM const lparam)
{
switch (message)
{
case WM_DESTROY:
break;
case WM_SETCURSOR:
return OnSetCursor();
case WM_KEYUP:
{
auto key = static_cast<uint32_t>(wparam);
if (key == VK_ESCAPE)
{
DestroyWindow(m_window);
}
}
break;
case WM_LBUTTONDOWN:
{
auto xPos = GET_X_LPARAM(lparam);
auto yPos = GET_Y_LPARAM(lparam);
OnLeftButtonDown(xPos, yPos);
}
break;
case WM_LBUTTONUP:
{
auto xPos = GET_X_LPARAM(lparam);
auto yPos = GET_Y_LPARAM(lparam);
OnLeftButtonUp(xPos, yPos);
}
break;
case WM_MOUSEMOVE:
{
auto xPos = GET_X_LPARAM(lparam);
auto yPos = GET_Y_LPARAM(lparam);
OnMouseMove(xPos, yPos);
}
break;
default:
return base_type::MessageHandler(message, wparam, lparam);
}
return 0;
}
void OverlayWindow::ResetCrop()
{
m_cropStatus = CropStatus::None;
m_startPosition = {};
m_cropRect = {};
}
bool OverlayWindow::OnSetCursor()
{
switch (m_cursorType)
{
case CursorType::Standard:
SetCursor(m_standardCursor.get());
return true;
case CursorType::Crosshair:
SetCursor(m_crosshairCursor.get());
return true;
default:
return false;
}
}
void OverlayWindow::OnLeftButtonDown(int x, int y)
{
if (m_cropStatus == CropStatus::None)
{
if (!IsPointWithinRect({ x, y }, m_currentWindowAreaBounds))
{
DestroyWindow(m_window);
return;
}
m_cropStatus = CropStatus::Ongoing;
x -= m_currentWindowAreaBounds.left;
y -= m_currentWindowAreaBounds.top;
m_selectionVisual.Offset({ x - BorderThickness, y - BorderThickness, 0 });
m_startPosition = { x, y };
}
}
void OverlayWindow::OnLeftButtonUp(int x, int y)
{
if (m_cropStatus == CropStatus::Ongoing)
{
m_cropStatus = CropStatus::Completed;
m_cursorType = CursorType::Standard;
// For debugging, it's easier if the window doesn't block the screen after this point
ShowWindow(m_window, SW_HIDE);
if (x < m_currentWindowAreaBounds.left)
{
x = m_currentWindowAreaBounds.left;
}
else if (x > m_currentWindowAreaBounds.right)
{
x = m_currentWindowAreaBounds.right;
}
if (y < m_currentWindowAreaBounds.top)
{
y = m_currentWindowAreaBounds.top;
}
else if (y > m_currentWindowAreaBounds.bottom)
{
y = m_currentWindowAreaBounds.bottom;
}
x -= m_currentWindowAreaBounds.left;
y -= m_currentWindowAreaBounds.top;
// Compute our crop rect
if (x < m_startPosition.x)
{
m_cropRect.left = x;
m_cropRect.right = m_startPosition.x;
}
else
{
m_cropRect.left = m_startPosition.x;
m_cropRect.right = x;
}
if (y < m_startPosition.y)
{
m_cropRect.top = y;
m_cropRect.bottom = m_startPosition.y;
}
else
{
m_cropRect.top = m_startPosition.y;
m_cropRect.bottom = y;
}
// Exit if the rect is empty
if (m_cropRect.right - m_cropRect.left == 0 || m_cropRect.bottom - m_cropRect.top == 0)
{
DestroyWindow(m_window);
return;
}
// Fire the callback
if (m_windowCropped != nullptr)
{
m_windowCropped(m_currentWindow, m_cropRect);
}
DestroyWindow(m_window);
}
}
void OverlayWindow::OnMouseMove(int x, int y)
{
if (m_cropStatus == CropStatus::None)
{
if (IsPointWithinRect({ x, y }, m_currentWindowAreaBounds))
{
m_cursorType = CursorType::Crosshair;
}
else
{
m_cursorType = CursorType::Standard;
}
}
else if (m_cropStatus == CropStatus::Ongoing)
{
if (x < m_currentWindowAreaBounds.left)
{
x = m_currentWindowAreaBounds.left;
}
else if (x > m_currentWindowAreaBounds.right)
{
x = m_currentWindowAreaBounds.right;
}
if (y < m_currentWindowAreaBounds.top)
{
y = m_currentWindowAreaBounds.top;
}
else if (y > m_currentWindowAreaBounds.bottom)
{
y = m_currentWindowAreaBounds.bottom;
}
x -= m_currentWindowAreaBounds.left;
y -= m_currentWindowAreaBounds.top;
auto offset = m_selectionVisual.Offset();
auto size = m_selectionVisual.Size();
if (x < m_startPosition.x)
{
offset.x = x - BorderThickness;
size.x = (m_startPosition.x - x) + (2 * BorderThickness);
}
else
{
size.x = (x - m_startPosition.x) + (2 * BorderThickness);
}
if (y < m_startPosition.y)
{
offset.y = y - BorderThickness;
size.y = (m_startPosition.y - y) + (2 * BorderThickness);
}
else
{
size.y = (y - m_startPosition.y) + (2 * BorderThickness);
}
m_selectionVisual.Offset(offset);
m_selectionVisual.Size(size);
}
}

View File

@@ -0,0 +1,58 @@
#pragma once
#include <robmikh.common/DesktopWindow.h>
struct OverlayWindow : robmikh::common::desktop::DesktopWindow<OverlayWindow>
{
static const std::wstring ClassName;
OverlayWindow(
winrt::Windows::UI::Composition::Compositor const& compositor,
HWND windowToCrop,
std::function<void(HWND, RECT)> windowCropped);
~OverlayWindow() { m_windowCropped = nullptr; DestroyWindow(m_window); }
LRESULT MessageHandler(UINT const message, WPARAM const wparam, LPARAM const lparam);
private:
enum class CursorType
{
Standard,
Crosshair,
};
enum class CropStatus
{
None,
Ongoing,
Completed,
};
static const float BorderThickness;
static void RegisterWindowClass();
void SetupOverlay();
void ResetCrop();
bool OnSetCursor();
void OnLeftButtonDown(int x, int y);
void OnLeftButtonUp(int x, int y);
void OnMouseMove(int x, int y);
private:
std::function<void(HWND, RECT)> m_windowCropped;
winrt::Windows::UI::Composition::Compositor m_compositor{ nullptr };
winrt::Windows::UI::Composition::CompositionTarget m_target{ nullptr };
winrt::Windows::UI::Composition::ContainerVisual m_rootVisual{ nullptr };
winrt::Windows::UI::Composition::SpriteVisual m_shadeVisual{ nullptr };
winrt::Windows::UI::Composition::ContainerVisual m_windowAreaVisual{ nullptr };
winrt::Windows::UI::Composition::SpriteVisual m_selectionVisual{ nullptr };
winrt::Windows::UI::Composition::CompositionNineGridBrush m_shadeBrush{ nullptr };
HWND m_currentWindow = nullptr;
RECT m_currentWindowAreaBounds = {};
CropStatus m_cropStatus = CropStatus::None;
POINT m_startPosition = {};
RECT m_cropRect = {};
CursorType m_cursorType = CursorType::Standard;
wil::unique_hcursor m_standardCursor;
wil::unique_hcursor m_crosshairCursor;
};

View File

@@ -0,0 +1,16 @@
<?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>

View File

@@ -0,0 +1,163 @@
#include "pch.h"
#include "ReparentCropAndLockWindow.h"
const std::wstring ReparentCropAndLockWindow::ClassName = L"CropAndLock.ReparentCropAndLockWindow";
std::once_flag ReparentCropAndLockWindowClassRegistration;
void ReparentCropAndLockWindow::RegisterWindowClass()
{
auto instance = winrt::check_pointer(GetModuleHandleW(nullptr));
WNDCLASSEXW wcex = {};
wcex.cbSize = sizeof(wcex);
wcex.style = CS_HREDRAW | CS_VREDRAW;
wcex.lpfnWndProc = WndProc;
wcex.hInstance = instance;
wcex.hIcon = LoadIconW(instance, IDI_APPLICATION);
wcex.hCursor = LoadCursorW(nullptr, IDC_ARROW);
wcex.hbrBackground = reinterpret_cast<HBRUSH>(COLOR_WINDOW + 1);
wcex.lpszClassName = ClassName.c_str();
wcex.hIconSm = LoadIconW(wcex.hInstance, IDI_APPLICATION);
winrt::check_bool(RegisterClassExW(&wcex));
}
ReparentCropAndLockWindow::ReparentCropAndLockWindow(std::wstring const& titleString, int width, int height)
{
auto instance = winrt::check_pointer(GetModuleHandleW(nullptr));
std::call_once(ReparentCropAndLockWindowClassRegistration, []() { RegisterWindowClass(); });
auto exStyle = 0;
auto style = WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN;
style &= ~(WS_MAXIMIZEBOX | WS_THICKFRAME);
RECT rect = { 0, 0, width, height};
winrt::check_bool(AdjustWindowRectEx(&rect, style, false, exStyle));
auto adjustedWidth = rect.right - rect.left;
auto adjustedHeight = rect.bottom - rect.top;
winrt::check_bool(CreateWindowExW(exStyle, ClassName.c_str(), titleString.c_str(), style,
CW_USEDEFAULT, CW_USEDEFAULT, adjustedWidth, adjustedHeight, nullptr, nullptr, instance, this));
WINRT_ASSERT(m_window);
m_childWindow = std::make_unique<ChildWindow>(width, height, m_window);
}
ReparentCropAndLockWindow::~ReparentCropAndLockWindow()
{
DisconnectTarget();
DestroyWindow(m_window);
}
LRESULT ReparentCropAndLockWindow::MessageHandler(UINT const message, WPARAM const wparam, LPARAM const lparam)
{
switch (message)
{
case WM_DESTROY:
if (m_closedCallback != nullptr && !m_destroyed)
{
m_destroyed = true;
m_closedCallback(m_window);
}
break;
case WM_MOUSEACTIVATE:
if (m_currentTarget != nullptr && GetForegroundWindow() != m_currentTarget)
{
SetForegroundWindow(m_currentTarget);
}
return MA_NOACTIVATE;
case WM_ACTIVATE:
if (static_cast<DWORD>(wparam) == WA_ACTIVE)
{
if (m_currentTarget != nullptr)
{
SetForegroundWindow(m_currentTarget);
}
}
break;
case WM_DPICHANGED:
break;
default:
return base_type::MessageHandler(message, wparam, lparam);
}
return 0;
}
void ReparentCropAndLockWindow::CropAndLock(HWND windowToCrop, RECT cropRect)
{
DisconnectTarget();
m_currentTarget = windowToCrop;
// Adjust the crop rect to be in the window space as reported by win32k
RECT windowRect = {};
winrt::check_bool(GetWindowRect(m_currentTarget, &windowRect));
auto clientRect = ClientAreaInScreenSpace(m_currentTarget);
auto diffX = clientRect.left - windowRect.left;
auto diffY = clientRect.top - windowRect.top;
auto adjustedCropRect = cropRect;
adjustedCropRect.left += diffX;
adjustedCropRect.top += diffY;
adjustedCropRect.right += diffX;
adjustedCropRect.bottom += diffY;
cropRect = adjustedCropRect;
// Save the previous position of the target so that we can restore it.
m_previousPosition = { windowRect.left, windowRect.top };
auto newX = adjustedCropRect.left + windowRect.left;
auto newY = adjustedCropRect.top + windowRect.top;
auto monitor = winrt::check_pointer(MonitorFromWindow(m_currentTarget, MONITOR_DEFAULTTONULL));
uint32_t dpiX = 0;
uint32_t dpiY = 0;
winrt::check_hresult(GetDpiForMonitor(monitor, MDT_EFFECTIVE_DPI, &dpiX, &dpiY));
uint32_t dpi = dpiX > dpiY ? dpiX : dpiY;
// Reconfigure our window
auto width = cropRect.right - cropRect.left;
auto height = cropRect.bottom - cropRect.top;
windowRect = { newX, newY, newX + width, newY + height };
auto exStyle = static_cast<DWORD>(GetWindowLongPtrW(m_window, GWL_EXSTYLE));
auto style = static_cast<DWORD>(GetWindowLongPtrW(m_window, GWL_STYLE));
winrt::check_bool(AdjustWindowRectExForDpi(&windowRect, style, false, exStyle, dpi));
auto adjustedWidth = windowRect.right - windowRect.left;
auto adjustedHeight = windowRect.bottom - windowRect.top;
winrt::check_bool(SetWindowPos(m_window, HWND_TOPMOST, windowRect.left, windowRect.top, adjustedWidth, adjustedHeight, SWP_SHOWWINDOW | SWP_NOACTIVATE));
winrt::check_bool(SetWindowPos(m_childWindow->m_window, nullptr, 0, 0, width, height, SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE));
// Reparent the target window
SetParent(m_currentTarget, m_childWindow->m_window);
auto targetStyle = GetWindowLongPtrW(m_currentTarget, GWL_STYLE);
targetStyle |= WS_CHILD;
SetWindowLongPtrW(m_currentTarget, GWL_STYLE, targetStyle);
auto x = -cropRect.left;
auto y = -cropRect.top;
if (0 == SetWindowPos(m_currentTarget, nullptr, x, y, 0, 0, SWP_NOSIZE | SWP_FRAMECHANGED | SWP_NOZORDER))
{
MessageBoxW(nullptr, L"CropAndLock couldn't properly reparent the target window. It might not handle reparenting well.", L"CropAndLock", MB_ICONERROR);
}
}
void ReparentCropAndLockWindow::Hide()
{
DisconnectTarget();
ShowWindow(m_window, SW_HIDE);
}
void ReparentCropAndLockWindow::DisconnectTarget()
{
if (m_currentTarget != nullptr)
{
if (!IsWindow(m_currentTarget))
{
// The child window was closed by other means?
m_currentTarget = nullptr;
return;
}
winrt::check_bool(SetWindowPos(m_currentTarget, nullptr, m_previousPosition.x, m_previousPosition.y, 0, 0, SWP_NOSIZE | SWP_NOACTIVATE | SWP_FRAMECHANGED));
SetParent(m_currentTarget, nullptr);
auto targetStyle = static_cast<DWORD>(GetWindowLongPtrW(m_currentTarget, GWL_STYLE));
targetStyle &= ~WS_CHILD;
SetWindowLongPtrW(m_currentTarget, GWL_STYLE, targetStyle);
m_currentTarget = nullptr;
}
}

View File

@@ -0,0 +1,29 @@
#pragma once
#include <robmikh.common/DesktopWindow.h>
#include "CropAndLockWindow.h"
#include "ChildWindow.h"
struct ReparentCropAndLockWindow : robmikh::common::desktop::DesktopWindow<ReparentCropAndLockWindow>, CropAndLockWindow
{
static const std::wstring ClassName;
ReparentCropAndLockWindow(std::wstring const& titleString, int width, int height);
~ReparentCropAndLockWindow() override;
LRESULT MessageHandler(UINT const message, WPARAM const wparam, LPARAM const lparam);
HWND Handle() override { return m_window; }
void CropAndLock(HWND windowToCrop, RECT cropRect) override;
void OnClosed(std::function<void(HWND)> callback) override { m_closedCallback = callback; }
private:
static void RegisterWindowClass();
void Hide();
void DisconnectTarget();
private:
HWND m_currentTarget = nullptr;
POINT m_previousPosition = {};
std::unique_ptr<ChildWindow> m_childWindow;
bool m_destroyed = false;
std::function<void(HWND)> m_closedCallback;
};

View File

@@ -0,0 +1,7 @@
#pragma once
enum class CropAndLockType
{
Reparent,
Thumbnail,
};

View File

@@ -0,0 +1,181 @@
#include "pch.h"
#include "ThumbnailCropAndLockWindow.h"
const std::wstring ThumbnailCropAndLockWindow::ClassName = L"CropAndLock.ThumbnailCropAndLockWindow";
std::once_flag ThumbnailCropAndLockWindowClassRegistration;
float ComputeScaleFactor(RECT const& windowRect, RECT const& contentRect)
{
auto windowWidth = static_cast<float>(windowRect.right - windowRect.left);
auto windowHeight = static_cast<float>(windowRect.bottom - windowRect.top);
auto contentWidth = static_cast<float>(contentRect.right - contentRect.left);
auto contentHeight = static_cast<float>(contentRect.bottom - contentRect.top);
auto windowRatio = windowWidth / windowHeight;
auto contentRatio = contentWidth / contentHeight;
auto scaleFactor = windowWidth / contentWidth;
if (windowRatio > contentRatio)
{
scaleFactor = windowHeight / contentHeight;
}
return scaleFactor;
}
RECT ComputeDestRect(RECT const& windowRect, RECT const& contentRect)
{
auto scaleFactor = ComputeScaleFactor(windowRect, contentRect);
auto windowWidth = static_cast<float>(windowRect.right - windowRect.left);
auto windowHeight = static_cast<float>(windowRect.bottom - windowRect.top);
auto contentWidth = static_cast<float>(contentRect.right - contentRect.left) * scaleFactor;
auto contentHeight = static_cast<float>(contentRect.bottom - contentRect.top) * scaleFactor;
auto remainingWidth = windowWidth - contentWidth;
auto remainingHeight = windowHeight - contentHeight;
auto left = static_cast<LONG>(remainingWidth / 2.0f);
auto top = static_cast<LONG>(remainingHeight / 2.0f);
auto right = left + static_cast<LONG>(contentWidth);
auto bottom = top + static_cast<LONG>(contentHeight);
return RECT{ left, top, right, bottom };
}
void ThumbnailCropAndLockWindow::RegisterWindowClass()
{
auto instance = winrt::check_pointer(GetModuleHandleW(nullptr));
WNDCLASSEXW wcex = {};
wcex.cbSize = sizeof(wcex);
wcex.style = CS_HREDRAW | CS_VREDRAW;
wcex.lpfnWndProc = WndProc;
wcex.hInstance = instance;
wcex.hIcon = LoadIconW(instance, IDI_APPLICATION);
wcex.hCursor = LoadCursorW(nullptr, IDC_ARROW);
wcex.hbrBackground = static_cast<HBRUSH>(GetStockObject(BLACK_BRUSH));
wcex.lpszClassName = ClassName.c_str();
wcex.hIconSm = LoadIconW(wcex.hInstance, IDI_APPLICATION);
winrt::check_bool(RegisterClassExW(&wcex));
}
ThumbnailCropAndLockWindow::ThumbnailCropAndLockWindow(std::wstring const& titleString, int width, int height)
{
auto instance = winrt::check_pointer(GetModuleHandleW(nullptr));
std::call_once(ThumbnailCropAndLockWindowClassRegistration, []() { RegisterWindowClass(); });
auto exStyle = 0;
auto style = WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN;
RECT rect = { 0, 0, width, height};
winrt::check_bool(AdjustWindowRectEx(&rect, style, false, exStyle));
auto adjustedWidth = rect.right - rect.left;
auto adjustedHeight = rect.bottom - rect.top;
winrt::check_bool(CreateWindowExW(exStyle, ClassName.c_str(), titleString.c_str(), style,
CW_USEDEFAULT, CW_USEDEFAULT, adjustedWidth, adjustedHeight, nullptr, nullptr, instance, this));
WINRT_ASSERT(m_window);
}
ThumbnailCropAndLockWindow::~ThumbnailCropAndLockWindow()
{
DisconnectTarget();
DestroyWindow(m_window);
}
LRESULT ThumbnailCropAndLockWindow::MessageHandler(UINT const message, WPARAM const wparam, LPARAM const lparam)
{
switch (message)
{
case WM_DESTROY:
if (m_closedCallback != nullptr && !m_destroyed)
{
m_destroyed = true;
m_closedCallback(m_window);
}
break;
case WM_SIZE:
case WM_SIZING:
{
if (m_thumbnail != nullptr)
{
RECT clientRect = {};
winrt::check_bool(GetClientRect(m_window, &clientRect));
m_destRect = ComputeDestRect(clientRect, m_sourceRect);
DWM_THUMBNAIL_PROPERTIES properties = {};
properties.dwFlags = DWM_TNP_RECTDESTINATION;
properties.rcDestination = m_destRect;
winrt::check_hresult(DwmUpdateThumbnailProperties(m_thumbnail.get(), &properties));
}
}
break;
default:
return base_type::MessageHandler(message, wparam, lparam);
}
return 0;
}
void ThumbnailCropAndLockWindow::CropAndLock(HWND windowToCrop, RECT cropRect)
{
DisconnectTarget();
m_currentTarget = windowToCrop;
// Adjust the crop rect to be in the window space as reported by the DWM
RECT windowRect = {};
winrt::check_hresult(DwmGetWindowAttribute(m_currentTarget, DWMWA_EXTENDED_FRAME_BOUNDS, reinterpret_cast<void*>(&windowRect), sizeof(windowRect)));
auto clientRect = ClientAreaInScreenSpace(m_currentTarget);
auto diffX = clientRect.left - windowRect.left;
auto diffY = clientRect.top - windowRect.top;
auto adjustedCropRect = cropRect;
adjustedCropRect.left += diffX;
adjustedCropRect.top += diffY;
adjustedCropRect.right += diffX;
adjustedCropRect.bottom += diffY;
cropRect = adjustedCropRect;
// Resize our window
auto width = cropRect.right - cropRect.left;
auto height = cropRect.bottom - cropRect.top;
windowRect = { 0, 0, width, height };
auto exStyle = static_cast<DWORD>(GetWindowLongPtrW(m_window, GWL_EXSTYLE));
auto style = static_cast<DWORD>(GetWindowLongPtrW(m_window, GWL_STYLE));
winrt::check_bool(AdjustWindowRectEx(&windowRect, style, false, exStyle));
auto adjustedWidth = windowRect.right - windowRect.left;
auto adjustedHeight = windowRect.bottom - windowRect.top;
winrt::check_bool(SetWindowPos(m_window, HWND_TOPMOST, 0, 0, adjustedWidth, adjustedHeight, SWP_NOMOVE | SWP_SHOWWINDOW));
// Setup the thumbnail
winrt::check_hresult(DwmRegisterThumbnail(m_window, m_currentTarget, m_thumbnail.addressof()));
clientRect = {};
winrt::check_bool(GetClientRect(m_window, &clientRect));
m_destRect = clientRect;
m_sourceRect = cropRect;
DWM_THUMBNAIL_PROPERTIES properties = {};
properties.dwFlags = DWM_TNP_SOURCECLIENTAREAONLY | DWM_TNP_VISIBLE | DWM_TNP_OPACITY | DWM_TNP_RECTDESTINATION | DWM_TNP_RECTSOURCE;
properties.fSourceClientAreaOnly = false;
properties.fVisible = true;
properties.opacity = 255;
properties.rcDestination = m_destRect;
properties.rcSource = m_sourceRect;
winrt::check_hresult(DwmUpdateThumbnailProperties(m_thumbnail.get(), &properties));
}
void ThumbnailCropAndLockWindow::Hide()
{
DisconnectTarget();
ShowWindow(m_window, SW_HIDE);
}
void ThumbnailCropAndLockWindow::DisconnectTarget()
{
if (m_currentTarget != nullptr)
{
m_thumbnail.reset();
m_currentTarget = nullptr;
}
}

View File

@@ -0,0 +1,32 @@
#pragma once
#include <robmikh.common/DesktopWindow.h>
#include "CropAndLockWindow.h"
struct ThumbnailCropAndLockWindow : robmikh::common::desktop::DesktopWindow<ThumbnailCropAndLockWindow>, CropAndLockWindow
{
static const std::wstring ClassName;
ThumbnailCropAndLockWindow(std::wstring const& titleString, int width, int height);
~ThumbnailCropAndLockWindow() override;
LRESULT MessageHandler(UINT const message, WPARAM const wparam, LPARAM const lparam);
HWND Handle() override { return m_window; }
void CropAndLock(HWND windowToCrop, RECT cropRect) override;
void OnClosed(std::function<void(HWND)> callback) override { m_closedCallback = callback; }
private:
static void RegisterWindowClass();
void Hide();
void DisconnectTarget();
private:
HWND m_currentTarget = nullptr;
POINT m_previousPosition = {};
unique_hthumbnail m_thumbnail;
RECT m_destRect = {};
RECT m_sourceRect = {};
bool m_destroyed = false;
std::function<void(HWND)> m_closedCallback;
};

View File

@@ -0,0 +1,3 @@
#pragma once
typedef wil::unique_any<HTHUMBNAIL, decltype(&::DwmUnregisterThumbnail), ::DwmUnregisterThumbnail> unique_hthumbnail;

View File

@@ -0,0 +1,14 @@
#pragma once
inline RECT ClientAreaInScreenSpace(HWND window)
{
POINT clientOrigin = { 0, 0 };
winrt::check_bool(ClientToScreen(window, &clientOrigin));
RECT windowBounds = {};
winrt::check_bool(GetClientRect(window, &windowBounds));
windowBounds.left += clientOrigin.x;
windowBounds.top += clientOrigin.y;
windowBounds.right += clientOrigin.x;
windowBounds.bottom += clientOrigin.y;
return windowBounds;
}

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<!-- Windows 10 -->
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />
</application>
</compatibility>
</assembly>

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

View File

@@ -0,0 +1,270 @@
#include "pch.h"
#include "SettingsWindow.h"
#include "OverlayWindow.h"
#include "CropAndLockWindow.h"
#include "ThumbnailCropAndLockWindow.h"
#include "ReparentCropAndLockWindow.h"
#include <common/interop/shared_constants.h>
#include <common/utils/winapi_error.h>
#include <common/utils/logger_helper.h>
#include <common/utils/UnhandledExceptionHandler.h>
#include <common/utils/gpo.h>
#include "ModuleConstants.h"
#include <common/utils/ProcessWaiter.h>
#include "trace.h"
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
namespace winrt
{
using namespace Windows::Foundation;
using namespace Windows::Foundation::Numerics;
using namespace Windows::UI;
using namespace Windows::UI::Composition;
}
namespace util
{
using namespace robmikh::common::desktop;
}
const std::wstring instanceMutexName = L"Local\\PowerToys_CropAndLock_InstanceMutex";
bool m_running = true;
int WINAPI wWinMain(_In_ HINSTANCE, _In_opt_ HINSTANCE, _In_ PWSTR lpCmdLine, _In_ int)
{
// Initialize COM
winrt::init_apartment(winrt::apartment_type::single_threaded);
// Initialize logger automatic logging of exceptions.
LoggerHelpers::init_logger(NonLocalizable::ModuleKey, L"", LogSettings::cropAndLockLoggerName);
InitUnhandledExceptionHandler();
if (powertoys_gpo::getConfiguredCropAndLockEnabledValue() == powertoys_gpo::gpo_rule_configured_disabled)
{
Logger::warn(L"Tried to start with a GPO policy setting the utility to always be disabled. Please contact your systems administrator.");
return 0;
}
// Before we do anything, check to see if we're already running. If we are,
// the hotkey won't register and we'll fail. Instead, we should tell the user
// to kill the other instance and exit this one.
auto mutex = CreateMutex(nullptr, true, instanceMutexName.c_str());
if (mutex == nullptr)
{
Logger::error(L"Failed to create mutex. {}", get_last_error_or_default(GetLastError()));
}
if (GetLastError() == ERROR_ALREADY_EXISTS)
{
// CropAndLock is already open.
return 1;
}
std::wstring pid = std::wstring(lpCmdLine);
if (pid.empty())
{
Logger::warn(L"Tried to run Crop And Lock as a standalone.");
MessageBoxW(nullptr, L"CropAndLock can't run as a standalone. Start it from PowerToys.", L"CropAndLock", MB_ICONERROR);
return 1;
}
auto mainThreadId = GetCurrentThreadId();
ProcessWaiter::OnProcessTerminate(pid, [mainThreadId](int err) {
if (err != ERROR_SUCCESS)
{
Logger::error(L"Failed to wait for parent process exit. {}", get_last_error_or_default(err));
}
else
{
Logger::trace(L"PowerToys runner exited.");
}
Logger::trace(L"Exiting CropAndLock");
PostThreadMessage(mainThreadId, WM_QUIT, 0, 0);
});
// NOTE: reparenting a window with a different DPI context has consequences.
// See https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-setparent#remarks
// for more info.
winrt::check_bool(SetProcessDpiAwarenessContext(DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2));
// Create the DispatcherQueue that the compositor needs to run
auto controller = util::CreateDispatcherQueueControllerForCurrentThread();
// Setup Composition
auto compositor = winrt::Compositor();
// Create our overlay window
std::unique_ptr<OverlayWindow> overlayWindow;
// Keep a list of our cropped windows
std::vector<std::shared_ptr<CropAndLockWindow>> croppedWindows;
// Handles and thread for the events sent from runner
HANDLE m_reparent_event_handle;
HANDLE m_thumbnail_event_handle;
HANDLE m_exit_event_handle;
std::thread m_event_triggers_thread;
std::function<void(HWND)> removeWindowCallback = [&](HWND windowHandle)
{
if (!m_running)
{
// If we're not running, the reference to croppedWindows might no longer be valid and cause a crash at exit time, due to being called by destructors after wWinMain returns.
return;
}
auto pos = std::find_if(croppedWindows.begin(), croppedWindows.end(), [windowHandle](auto window) { return window->Handle() == windowHandle; });
if (pos != croppedWindows.end())
{
croppedWindows.erase(pos);
}
};
std::function<void(CropAndLockType)> ProcessCommand = [&](CropAndLockType mode)
{
std::function<void(HWND, RECT)> windowCroppedCallback = [&, mode](HWND targetWindow, RECT cropRect) {
auto targetInfo = util::WindowInfo(targetWindow);
// TODO: Fix WindowInfo.h to not contain the null char at the end.
auto nullCharIndex = std::wstring::npos;
do
{
nullCharIndex = targetInfo.Title.rfind(L'\0');
if (nullCharIndex != std::wstring::npos)
{
targetInfo.Title.erase(nullCharIndex);
}
} while (nullCharIndex != std::wstring::npos);
std::wstringstream titleStream;
titleStream << targetInfo.Title << L" (Cropped)";
auto title = titleStream.str();
std::shared_ptr<CropAndLockWindow> croppedWindow;
switch (mode)
{
case CropAndLockType::Reparent:
croppedWindow = std::make_shared<ReparentCropAndLockWindow>(title, 800, 600);
Logger::trace(L"Creating a reparent window");
Trace::CropAndLock::CreateReparentWindow();
break;
case CropAndLockType::Thumbnail:
croppedWindow = std::make_shared<ThumbnailCropAndLockWindow>(title, 800, 600);
Logger::trace(L"Creating a thumbnail window");
Trace::CropAndLock::CreateThumbnailWindow();
break;
default:
return;
}
croppedWindow->CropAndLock(targetWindow, cropRect);
croppedWindow->OnClosed(removeWindowCallback);
croppedWindows.push_back(croppedWindow);
};
overlayWindow.reset();
// Get the current window with focus
auto foregroundWindow = GetForegroundWindow();
if (foregroundWindow != nullptr)
{
bool match = false;
for (auto&& croppedWindow : croppedWindows)
{
if (foregroundWindow == croppedWindow->Handle())
{
match = true;
break;
}
}
if (!match)
{
overlayWindow = std::make_unique<OverlayWindow>(compositor, foregroundWindow, windowCroppedCallback);
}
}
};
// Start a thread to listen on the events.
m_reparent_event_handle = CreateEventW(nullptr, false, false, CommonSharedConstants::CROP_AND_LOCK_REPARENT_EVENT);
m_thumbnail_event_handle = CreateEventW(nullptr, false, false, CommonSharedConstants::CROP_AND_LOCK_THUMBNAIL_EVENT);
m_exit_event_handle = CreateEventW(nullptr, false, false, CommonSharedConstants::CROP_AND_LOCK_EXIT_EVENT);
if (!m_reparent_event_handle || !m_reparent_event_handle || !m_exit_event_handle)
{
Logger::warn(L"Failed to create events. {}", get_last_error_or_default(GetLastError()));
return 1;
}
m_event_triggers_thread = std::thread([&]() {
MSG msg;
HANDLE event_handles[3] = {m_reparent_event_handle, m_thumbnail_event_handle, m_exit_event_handle};
while (m_running)
{
DWORD dwEvt = MsgWaitForMultipleObjects(3, event_handles, false, INFINITE, QS_ALLINPUT);
if (!m_running)
{
break;
}
switch (dwEvt)
{
case WAIT_OBJECT_0:
{
// Reparent Event
bool enqueueSucceeded = controller.DispatcherQueue().TryEnqueue([&]() {
ProcessCommand(CropAndLockType::Reparent);
});
if (!enqueueSucceeded)
{
Logger::error("Couldn't enqueue message to reparent a window.");
}
break;
}
case WAIT_OBJECT_0 + 1:
{
// Thumbnail Event
bool enqueueSucceeded = controller.DispatcherQueue().TryEnqueue([&]() {
ProcessCommand(CropAndLockType::Thumbnail);
});
if (!enqueueSucceeded)
{
Logger::error("Couldn't enqueue message to thumbnail a window.");
}
break;
}
case WAIT_OBJECT_0 + 2:
{
// Exit Event
Logger::trace(L"Received an exit event.");
PostThreadMessage(mainThreadId, WM_QUIT, 0, 0);
break;
}
case WAIT_OBJECT_0 + 3:
if (PeekMessageW(&msg, nullptr, 0, 0, PM_REMOVE))
{
TranslateMessage(&msg);
DispatchMessageW(&msg);
}
break;
default:
break;
}
}
});
// Message pump
MSG msg = {};
while (GetMessageW(&msg, nullptr, 0, 0))
{
TranslateMessage(&msg);
DispatchMessageW(&msg);
}
m_running = false;
// Needed to unblock MsgWaitForMultipleObjects one last time
SetEvent(m_reparent_event_handle);
CloseHandle(m_reparent_event_handle);
CloseHandle(m_thumbnail_event_handle);
CloseHandle(m_exit_event_handle);
m_event_triggers_thread.join();
return util::ShutdownDispatcherQueueControllerAndWait(controller, static_cast<int>(msg.wParam));
}

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Windows.CppWinRT" version="2.0.221104.6" targetFramework="native" />
<package id="Microsoft.Windows.ImplementationLibrary" version="1.0.220914.1" targetFramework="native" />
<package id="robmikh.common" version="0.0.22-beta" targetFramework="native" />
</packages>

View File

@@ -0,0 +1 @@
#include "pch.h"

View File

@@ -0,0 +1,78 @@
#pragma once
// Collision from minWinDef min/max and std
#define NOMINMAX
#define WIN32_LEAN_AND_MEAN
// Windows
#include <windows.h>
#include <windowsx.h>
// Must come before C++/WinRT
#include <wil/cppwinrt.h>
// WinRT
#include <winrt/Windows.Foundation.h>
#include <winrt/Windows.Foundation.Collections.h>
#include <winrt/Windows.Foundation.Numerics.h>
#include <winrt/Windows.System.h>
#include <winrt/Windows.UI.h>
#include <winrt/Windows.UI.Composition.h>
#include <winrt/Windows.UI.Composition.Desktop.h>
#include <winrt/Windows.UI.Popups.h>
#include <winrt/Windows.Graphics.Capture.h>
#include <winrt/Windows.Graphics.DirectX.h>
#include <winrt/Windows.Graphics.DirectX.Direct3d11.h>
// WIL
#include <wil/resource.h>
// DirectX
#include <d3d11_4.h>
#include <dxgi1_6.h>
#include <d2d1_3.h>
#include <wincodec.h>
// DWM
#include <dwmapi.h>
// Shell
#include <shellscalingapi.h>
// STL
#include <vector>
#include <string>
#include <atomic>
#include <memory>
#include <algorithm>
#include <mutex>
#include <sstream>
// robmikh.common
#include <robmikh.common/composition.interop.h>
#include <robmikh.common/direct3d11.interop.h>
#include <robmikh.common/d3dHelpers.h>
#include <robmikh.common/graphics.interop.h>
#include <robmikh.common/dispatcherQueue.desktop.interop.h>
#include <robmikh.common/d3dHelpers.desktop.h>
#include <robmikh.common/composition.desktop.interop.h>
#include <robmikh.common/hwnd.interop.h>
#include <robmikh.common/capture.desktop.interop.h>
#include <robmikh.common/DesktopWindow.h>
#include <robmikh.common/DisplayInfo.h>
#include <robmikh.common/shellHelpers.desktop.h>
#include <robmikh.common/ControlsHelper.h>
#include <robmikh.common/WindowInfo.h>
// Helpers
#include "DisplaysUtil.h"
#include "ThumbnailUtil.h"
#include "WindowRectUtil.h"
// PowerToys
#include <ProjectTelemetry.h>
#include <common/logger/logger.h>
// Application resources
#include "resource.h"
#define MAIN_ICON MAKEINTRESOURCEW(IDI_ICON1)

View File

@@ -0,0 +1,26 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by CropAndLock.rc
//
#define IDI_ICON1 101
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 102
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1001
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
//////////////////////////////
// Non-localizable
#define FILE_DESCRIPTION "PowerToys CropAndLock"
#define INTERNAL_NAME "PowerToys.CropAndLock"
#define ORIGINAL_FILENAME "PowerToys.CropAndLock.exe"
// Non-localizable
//////////////////////////////

View File

@@ -0,0 +1,95 @@
#include "pch.h"
#include "trace.h"
// Telemetry strings should not be localized.
#define LoggingProviderKey "Microsoft.PowerToys"
TRACELOGGING_DEFINE_PROVIDER(
g_hProvider,
LoggingProviderKey,
// {38e8889b-9731-53f5-e901-e8a7c1753074}
(0x38e8889b, 0x9731, 0x53f5, 0xe9, 0x01, 0xe8, 0xa7, 0xc1, 0x75, 0x30, 0x74),
TraceLoggingOptionProjectTelemetry());
void Trace::RegisterProvider() noexcept
{
TraceLoggingRegister(g_hProvider);
}
void Trace::UnregisterProvider() noexcept
{
TraceLoggingUnregister(g_hProvider);
}
void Trace::CropAndLock::Enable(bool enabled) noexcept
{
TraceLoggingWrite(
g_hProvider,
"CropAndLock_EnableCropAndLock",
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE),
TraceLoggingBoolean(enabled, "Enabled"));
}
void Trace::CropAndLock::ActivateReparent() noexcept
{
TraceLoggingWrite(
g_hProvider,
"CropAndLock_ActivateReparent",
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE));
}
void Trace::CropAndLock::ActivateThumbnail() noexcept
{
TraceLoggingWrite(
g_hProvider,
"CropAndLock_ActivateThumbnail",
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE));
}
void Trace::CropAndLock::CreateReparentWindow() noexcept
{
TraceLoggingWrite(
g_hProvider,
"CropAndLock_CreateReparentWindow",
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE));
}
void Trace::CropAndLock::CreateThumbnailWindow() noexcept
{
TraceLoggingWrite(
g_hProvider,
"CropAndLock_CreateThumbnailWindow",
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE));
}
// Event to send settings telemetry.
void Trace::CropAndLock::SettingsTelemetry(PowertoyModuleIface::Hotkey& reparentHotkey, PowertoyModuleIface::Hotkey& thumbnailHotkey) noexcept
{
std::wstring hotKeyStrReparent =
std::wstring(reparentHotkey.win ? L"Win + " : L"") +
std::wstring(reparentHotkey.ctrl ? L"Ctrl + " : L"") +
std::wstring(reparentHotkey.shift ? L"Shift + " : L"") +
std::wstring(reparentHotkey.alt ? L"Alt + " : L"") +
std::wstring(L"VK ") + std::to_wstring(reparentHotkey.key);
std::wstring hotKeyStrThumbnail =
std::wstring(thumbnailHotkey.win ? L"Win + " : L"") +
std::wstring(thumbnailHotkey.ctrl ? L"Ctrl + " : L"") +
std::wstring(thumbnailHotkey.shift ? L"Shift + " : L"") +
std::wstring(thumbnailHotkey.alt ? L"Alt + " : L"") +
std::wstring(L"VK ") + std::to_wstring(thumbnailHotkey.key);
TraceLoggingWrite(
g_hProvider,
"CropAndLock_Settings",
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE),
TraceLoggingWideString(hotKeyStrReparent.c_str(), "ReparentHotKey"),
TraceLoggingWideString(hotKeyStrThumbnail.c_str(), "ThumbnailHotkey")
);
}

View File

@@ -0,0 +1,20 @@
#pragma once
#include <modules/interface/powertoy_module_interface.h>
class Trace
{
public:
static void RegisterProvider() noexcept;
static void UnregisterProvider() noexcept;
class CropAndLock
{
public:
static void Enable(bool enabled) noexcept;
static void ActivateReparent() noexcept;
static void ActivateThumbnail() noexcept;
static void CreateReparentWindow() noexcept;
static void CreateThumbnailWindow() noexcept;
static void SettingsTelemetry(PowertoyModuleIface::Hotkey&, PowertoyModuleIface::Hotkey&) noexcept;
};
};

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