Commit Graph

194 Commits

Author SHA1 Message Date
yuyoyuppe
60fa6071b9 FZ: warn w/ a toast if an elevated window cannot be dragged and offer learning more 2020-03-27 13:23:37 +03:00
PrzemyslawTusinski
c247e49c2a
Fancy zones on all monitors - when dragging window to another monitor sometimes zone stays marked as active on previous FIX (#1709) 2020-03-26 17:48:01 +01:00
Seraphima Zykova
f72dd7fdb6
added telemetry for editor launch event (#1705) 2020-03-26 13:54:12 +03:00
vldmr11080
e85427f1da
Disable Win+Ctrl+Number feature for 0.16 release (#1689) 2020-03-25 18:32:33 +01:00
PrzemyslawTusinski
f8f7fe4f33
Fancy zones ui update( zone numbering as numbers, dragged window transaprency option, zone coloring customization) (#1666)
* Fancy zones ui update (#4)

* Draft of numeric fancyzones with numbers

* Added support for zone color configuration, improved zone number display

* Changed order of settings to more logical

* Added option to edit zone border color

* Trancparency of dragged window, transparency of displayed zones, changed font of zone numbers

* Fix for compilation

* Some refactor

* Introduced gdiplus to draw zone and zone index

* Fix for dissappering windows

* Some fixes

* another merge fix

* another merge fix

* Unit test merge fix

* Transparency with show zones on all fix

* indentation fix

* Fix for failing test

* Changed order of color pickers

* "Zone Opacity"

* Zone opacity (%)

* Added option to turn off dragged window transparency, changed default zones color values
2020-03-25 15:38:44 +01:00
vldmr11080
9e8facaa6f
Windows snap hotkeys to move windows between screens (#1603)
* When moving window into zones using arrow keys, support multi-monitor scenario

* Minor coding style adjustments

* Split implementation into separate functions because of readability

* Rename certain arguments

* Modify unit tests after API changes

* Address PR comments and add unit tests

* Return true from MoveWindowIntoZoneByDirection only if window is successfully added to new zone

* Improved monitor ordering (#1)

* Implemented improved monitor ordering v1

* Fixed some embarrassing bugs, added some tests

* Added one more test

* Extracted a value to a variable

* ASCII art in unit test comments describing monitor layouts

* Removed empty line for consistency

* Update comment to match the code

* Refactored tests, added tests for X,Y offsets

Co-authored-by: Ivan Stošić <ivan100sic@gmail.com>
2020-03-24 18:50:26 +01:00
Andrey Nekrasov
e52c5d38d3
Cleanup project output/intermediate dirs (#1640)
* sln: set output dir prefix to "modules\" for all modules

* sln: CopyToOutputDirectory only when necessary

* sln: intermediate dir for csprojs

* sln: intermediate dir for vcxprojs

* sln: add PT as runner project deps + remove nonexisting project confs

* sln: remove AnyCPU for win-app-driver project
2020-03-20 21:41:48 +03:00
vldmr11080
49868d8f7c
Fix migration of rows and columns percents from registry (#1641) 2020-03-20 13:48:24 +01:00
stefansjfw
98ed178d7b
Double-qoute the paths when passing them as cmd args (#1604) 2020-03-17 18:12:32 +01:00
Seraphima Zykova
f49727e0b6
Invalid json test cases + strings validation (#1558)
* added tests for invalid json types
* guid strings validation
* device id validation
2020-03-17 00:29:13 +03:00
Ivan Stošić
2cc6d2ef11
Fixed some compiler warnings (#1577)
* Fixed some compiler warnings

* Changed long to int
2020-03-16 17:54:30 +01:00
Yevhenii Holovachov
02857d1b7f
Some refactoring of FancyZones::IsInterestingWindow and added Unit Tests (#1521)
* Some refactoring of FancyZones::IsInterestingWindow and added UnitTests
2020-03-16 14:25:30 +02:00
Enrico Giordani
969d71b264
Fix for build break (#1573) 2020-03-13 19:40:28 +01:00
PrzemyslawTusinski
0af6348913
Fancy zones: show active layouts on all monitors (#1553)
Added option to show fancy zones on all monitors with layouts simultaneously
Co-authored-by: Ivan Stošić <ivan100sic@gmail.com>
2020-03-13 15:56:23 +01:00
Andrey Nekrasov
0ac6c01d65
runner: simplify powertoy_module interface (#1560) 2020-03-13 12:55:15 +03:00
vldmr11080
013a58e634
Move window to last known zone. Support movement in multi-monitor scenario (#1511) 2020-03-10 09:59:34 +01:00
stefansjfw
7ac378dcd3
Fix compiler warning (#1492) 2020-03-09 23:21:33 +01:00
vldmr11080
7653d5fec9
Document fancy zones (#1496) 2020-03-09 19:22:53 +01:00
PrzemyslawTusinski
7e1f7bd7fd
Ui rename Zone highlight Opacity (%) - > Zone Opacity (#1504) 2020-03-09 12:27:35 +01:00
stefansjfw
1cf8634152
Move ZoneSetPersistedDataOLD to JsonHelpers (#1405) 2020-03-07 10:59:00 +01:00
Ivan Stošić
2b91903129
Fixed one mishandled case when computing zones (#1470) 2020-03-05 21:51:58 +01:00
Ivan Stošić
9860e2bc75
Fixed an issue where zones do not fill up the whole screen (#1458)
* Fixed an issue where zones do not fill up the whole screen
* Fixup: Added comments, removed extra semicolons
2020-03-05 15:54:06 +01:00
Ivan Stošić
8a22da0acb
Fix too many zones crashing (#1337)
Fix for an issue where creating too many zones causes a crash
2020-03-05 14:59:47 +01:00
Ivan Stošić
92f64188d5
Fixed multi-monitor scaling bug (#1293)
Fixed an issue (#365) where a window gets resized after it gets dropped into a zone.
2020-03-05 10:57:45 +01:00
vldmr11080
39cac396f5
Swallow shift keyboard event when dragging window (#1423) 2020-03-05 08:01:58 +01:00
stefansjfw
121be772df
Fix migrating never applied custom zonesets (#1427) 2020-03-03 21:48:22 +01:00
vldmr11080
6556e1b4a2
Skip cloning device information from parent virtual desktop if it is deleted. (#1415) 2020-03-02 18:52:38 +01:00
vldmr11080
66892aea60
Secure acces from multiple threads to JSONHelpers (add missing lock) (#1375) 2020-02-27 09:52:14 +01:00
vldmr11080
1f8f9aaf81
Revert "Swallow shift keyboard event when dragging window (#1362)" (#1363)
This reverts commit 2f9b753c5b.
2020-02-26 08:11:39 +01:00
vldmr11080
2f9b753c5b
Swallow shift keyboard event when dragging window (#1362) 2020-02-25 21:03:14 +01:00
vldmr11080
733613ad28
Introduce handling of new/old work areas (#1296)
* Introduce handling of new/old work areas (defined by virtual desktop id and monitor)

* Save data to JSON storage only once after we register all deleted virtual desktops

* Update saving mechanism

* Remove resolution from unique identifier

* Update comments related to new unique identifier

* Don't handle NULL GUID as it is default one

* Revert "Remove resolution from unique identifier"

This reverts commit 5a36651217.

* Revert "Update comments related to new unique identifier"

This reverts commit 8e89802549.

* removed MigrateDeviceInfoFromRegistry

Co-authored-by: Seraphima Zykova <zykovas91@gmail.com>
2020-02-18 11:55:08 +01:00
Seraphima Zykova
604070763d
Add telemetry event for FZ editor (#1294)
* trace zones settings changes
2020-02-17 19:40:02 +03:00
Andrey Nekrasov
1e6936a8c3
Thread safety for FanncyZonesData (#1281)
* FancyZones: make FancyZonesData thread-safe

* fixup: format affected sources

* fixup: clang-format case-style and format FancyZones.cpp

* fixup! add missing lock
2020-02-17 18:28:49 +03:00
Seraphima
8c86c3dc1b
Update FancyZones telemetry event for settings changed (#1268) 2020-02-12 13:08:11 +03:00
Seraphima
79c625d737
Persist app zone history in real time (#1257)
* save settings every time changes are performed
* settings are not saved on app exit
2020-02-11 14:34:37 +03:00
vldmr11080
bde0f2f0ba
Fix crash when saving any module settings while module being disabled (#1259) 2020-02-11 07:57:11 +01:00
stefansjfw
53f830bb38
Migrate FancyZones data persisting from Registry to JSON file (#1194)
* Migrate FancyZones data persisting from Registry to JSON file

* Address PR comment: Remove redundant check

* Addres PR comment: Remove unused Dpi and add CmdArgs enum

* Address PR comment: Make methods const and inline

* Address PR comments: Expose GenerateUniqueId function and use const ref instead of passing wstring by value

* Address PR comment: Use lamdba as callback

* Address PR comment: Move GenerateUniqueId to ZoneWindowUtils namespace

* Address PR comment: Use regular comparison instead of std::wstring::compare

* Address PR comment: Use std::wstring_view for tmp file paths

* Address PR comment: Use scoped lock when accessing member data

* Address PR comment: Remove typedefs to increase code readability

* Address PR comment: removed nullptr checks with corresponding tests

* Address PR comment: Move ZoneSet object instead of copying

* Address PR comment: Make FancyZonesData instance const where possible

* Remove unnecessary gutter variable during calculating zone coordinates

* Remove uneeded subclass

* Avoid unnecessary copying and reserve space for vector if possible

* Save FancyZones data after exiting editor

* App zone history (#18)

* added window and zone set ids to app zone history

* Rename JSON file

* Remove AppZoneHistory migration

* Move parsing of ZoneWindow independent temp files outside of it

* Unit tests update (#19)

* check device existence in map
* updated ZoneSet tests
* updated JsonHelpers tests

* Use single zone count information

* Remove uneeded tests

* Remove one more test

* Remove uneeded line

* Address PR comments - Missing whitespace

* Update zoneset data for new virtual desktops (#21)

* update active zone set with actual data

* Introduce Blank zone set (used to indicate that no layout applied yet). Move parsing completely outside of ZoneWindow.

* Fix unit tests to match modifications in implementation

* Fix applying layouts on startup (second monitor)

Co-authored-by: vldmr11080 <57061786+vldmr11080@users.noreply.github.com>
Co-authored-by: Seraphima <zykovas91@gmail.com>
2020-02-10 14:59:51 +01:00
Bartosz Sosnowski
0fdc1d0a1f
ShortcutGuide, FancyZones: split window filtering (#1225)
Splits the code use to filter windows for FancyZones and the
"active window" for the ShortcutGuide. The FancyZones logic is preserved
and merged into a single function. We keep it in common.h, as it might
be also used in other PowerToys, like maximized to new desktop. We do
however change the return type to be more descriptive. It also returns
a separate flag for if the window has a visible owner. This can be used
to implement the approved apps list.

For the ShortcutGuide, the logic is relaxed to include more windows. One
example are Explorer properties windows. Those are (and should) filtered
by the FancyZones, but should appear in the window preview in the SCG.

The new return type also includes information if the window will react
to the default Windows Snap. This is not ideal though. Currently, SCG
can only disable the entire "Windows Controls" group. OTOH windows like
"Save As..." dialogs can be snapped to corners etc., but cannot be
minimized nor maximized. Until SCG can separately disable those buttons
we will display the buttons in the enabled state only if the window
supports all settings. In the future, we should integrate FancyZones
snap override here too.
2020-02-07 15:53:57 +01:00
Bartosz Sosnowski
5d8e894802
FancyZones: if window is not interesting, allow Windows snap (#1186)
Do not swallow WinKey+Arrow events for non-interesting windows. This makes apps that are in the "excluded apps" list behave as if "Override windows snap keys" is disabled - they will react to the Windows default snap.
2020-02-06 13:12:59 +01:00
Bartosz Sosnowski
ed35a143ec
FancyZones: allow windows with invisible or zero-sized owner to be zonable (#1216) 2020-02-05 12:27:51 +01:00
Bartosz Sosnowski
25e882eb78
Fancyzones: unify window filtering (#1184)
Makes FancyZone use the same code for filtering windows when windows are
being dragged and when moved by WinKey + arrows.
2020-02-03 09:32:38 +01:00
Alekhya
925b6694ac
Localize C++ Projects of FancyZones (#1130)
* localized dllmain.cpp  of fancyzones project

* localized FancyZones.cpp

* format fancyzones.rc file

* Moved SuperFancyZones back to being a string instead of having it in the resource file as it is the window class name

* reverted changes for window name

* Formatted fancyzones rc file
2020-01-22 10:24:00 -08:00
Bartosz Sosnowski
62da7c7be4
FancyZones: remove dialog boxes filtering (#1076)
* FancyZones: remove dialog boxes filtering

* FancyZones: add the "no owner window" filter to the WinKey + arrow zone snapping
2020-01-20 11:02:12 +01:00
vldmr11080
5dc60b9f35
Fix reversed order of zones in layout (#1071) 2020-01-15 20:20:10 +01:00
Yosef Durr
a2a683d31e adding fancy zone opacity setting, enhancement #631 (#1008)
* adding fancy zone opacity setting, enhancement #631

* applying zone opacity setting to all zones during zone selection

* changing opacity setting to percentage
2020-01-06 09:59:18 -08:00
Clint Rutkas
b753f920e1 #768 2019-12-26 11:06:59 -08:00
Bartosz Sosnowski
47bcb117b4
FancyZones: do not zone windows on startup (#982) 2019-12-24 15:47:28 +01:00
Bartosz Sosnowski
6ee848b279
FancyZones: handle minimized windows correctly (#986) 2019-12-19 16:36:24 +01:00
Bartosz Sosnowski
db5f1622bd
FancyZones: do not zone invisible windows (#983) 2019-12-19 16:02:24 +01:00
yuyoyuppe
48b89609e2 fancyzones: restrict dpi unaware windows horizontally to the current display to avoid unwanted resize 2019-12-17 15:37:10 +03:00
yuyoyuppe
303d1fef6b
PCH: remove headers which are actually could be changed (#950) 2019-12-17 11:21:46 +03:00
vldmr11080
d284ecdab4 Fix outstanding warning messages (#924) 2019-12-13 18:55:30 +01:00
vldmr11080
c31262b97e Flash zones only when new virtual desktop is created (#818) 2019-12-12 10:10:55 +01:00
vldmr11080
014c2c5249 Use same zone set initially for new virtual desktops of same monitor (#815) 2019-12-06 15:09:27 +01:00
Kevin Horecka
add63d2dde FancyZones: Added ability to use mouse only for interactions with zones (#729) 2019-12-06 12:32:43 +01:00
yuyoyuppe
7357e40d3f
Use WinRT JSON parser instead of custom cpprestsdk solution (#822) 2019-12-06 11:40:23 +03:00
vldmr11080
3a65d5ce23 Revert: Keep window in their zone after layout changes (#852) 2019-12-04 01:55:12 +01:00
vldmr11080
57845a2739 Don't flash current zone setup when focused window is in full screen (#796) 2019-11-30 14:38:27 +01:00
vldmr11080
9a8ab29330 Reverse logic for keep windows in their zones when fancyzone layout changes (#812) 2019-11-30 12:15:16 +01:00
Bartosz Sosnowski
ee1a1fd614
Prevent number being swallow while dragging. (#788) 2019-11-27 10:32:09 +01:00
Enrico Giordani
4be84e035f
revert overrideSnapHotkeys logic after regression (#756) 2019-11-22 10:56:11 +01:00
Bartosz Sosnowski
254474d12d Make the hotkey control display correct key
Credit to @doterik for the idea in https://github.com/microsoft/PowerToys/issues/700#issuecomment-554329895

RApplies to https://github.com/microsoft/PowerToys/issues/700
2019-11-20 10:00:53 +01:00
Bret
28d7835327
User/bretan/fz remove legacy editor (#1)
* Removed and runs
Still needs some extra cleanup and addressing open issues

* Removed and runs
Still needs some extra cleanup and addressing open issues

* Clean

* Update
2019-11-18 15:29:42 -08:00
Bartosz Sosnowski
03438f9192
FancyZones: improve windows and apps filtering (#673)
Unifies the way windows are considered "interesting" by FancyZone.
Berfore the change WinKey + arrows would use different method than
dragging. This PR makes both use the WinKey + arrows method.

Cleans up FancyZones Settings.cpp by removing m_configStrings variable.
Contrary to its name it was used to create color picker control.

Adds a multiline option to the text input to settings. Uses this to
provide the user with a way to exclude certain apps from snapping to
zones.
2019-11-18 10:29:56 +01:00
yuyoyuppe
e8edbd5394
clear FancyZones::m_zoneWindowMap on Destroy, since it stores 'this', causing a leak (#664) 2019-11-07 22:05:12 +03:00
yuyoyuppe
f3e25ae3e6
Fix for different per-monitor scaling (#657)
* Use DPIAware::DEFAULT_DPI

* Make runner DPI-unaware, since it doesn't need to use a Per Monitor V2 DPI.

* Programmatically enable "Per Monitor V2 DPI" for the runner proccess and use a separate DPI-unaware thread for the corresponding API calls

* Increase PCH memory limit for settings project

* Address review issues

* Draw zoneWindows properly scaled
2019-11-07 21:56:32 +03:00
yuyoyuppe
a9518c2e55 Wrap around colorIndex in a colors array (#669) 2019-11-07 17:50:04 +01:00
Enrico Giordani
dc34379344 Fix telemetry event names
add setting changed event for ShortcutGuide
2019-10-28 19:07:32 +01:00
Bartosz Sosnowski
8f8f4506ff
Make sure m_callback is not null before using it (#541) 2019-10-23 18:42:40 +02:00
Bartosz Sosnowski
e4c7ed9c3e fixup: move the test to IsWindowVisible 2019-10-22 09:46:15 +02:00
Bartosz Sosnowski
b17106e88d Don't zone hidden windows 2019-10-22 09:46:15 +02:00
Enrico Giordani
a07a42624b
Telemetry events
* Don't trace event on exit
change 'PowertoyModuleDeleter' to not call 'module->disable();' before 'module->destroy();' so the module can distinguish between being turned off and PowerToys exiting.
Code formatting.

* uppercase for event name

* Trace on/off event for ShortcutGuide module

* Trace the 'hide' event only if the guide was visible
'on_hide()' is invoked when the module is turned off, in that case don't trace the hide event.

* Remove spaces in data field names
Remove 'ShowGuide' event since it's not providing any useful data.

* Include build number in version number
2019-10-22 08:11:23 +02:00
Bret
6d3ce4e3cd
Merge pull request #504 from TheMrJukes/master
Fix rcNormalPosition in SetWindowPlacement
2019-10-16 09:54:08 -07:00
Bartosz Sosnowski
41842048a3 Save the zone when window is moved by hotkeys 2019-10-16 10:23:22 +02:00
Bret Anderson
03cb04823c Fix rcNormalPosition in SetWindowPlacement 2019-10-14 12:17:55 -07:00
Enrico Giordani
f9be71eca5
Add version number to telemetry event
use defines from version.h in .rc files and other places.
2019-10-14 19:22:14 +02:00
Bartosz Sosnowski
5f8c4ea143
Improve window filter to include start menu and Cortana search box. (#474)
Also moves GetProcessPath* functions to common, renaming both to
get_process_path.
2019-10-07 11:12:44 +02:00
Bartosz Sosnowski
64f606daaa
Add a hotkey settings control and use it in FancyZones (#450)
Add a hotkey settings control and use it in FancyZones
2019-10-02 17:18:55 +02:00
cedi
faf1fae873 Modifying the startup behaviour of the FancyZones Layout Editor
Add setting to allow to choose if the FZ editor opens in the screen where mouse cursor is or where the active windows is.
2019-09-28 16:29:29 +02:00
ebbyd3
a8f0d3298f Fixed some minor code styling issues. Removed some minor redundant calculations for a small performance enhancement with zone detection. 2019-09-26 23:23:09 +02:00
ebbyd3
af67f7782c Added more in-depth check for zone determination when dragging around
the screen. Previously, it would iterate through the zones in the order
they were added and find the first one that fit the description. While
this works in most cases, if a user wants to have overlapping zones, it
is better to iterate through all of them and find the zone that the user
expects. There are cases where a zone is completely inaccessible on drag
because of the current code. To resolve this, the zone search will look
for the smallest zone possible. The reason I chose this solution is
because this guarantees that zones are at least reachable since if a
zone was bigger than another zone, then there must be a part of it
that is exposed, therefore reachable itself. Note: this solution is for
the scenario between two zones. More than that is not guaranteed. But I
feel like this covers enough scenarios to warrant its addition.

Example:
  ----------------
  - Zone1        -
  -  ----------  -
  -  - Zone2  -  -
  -  -        -  -
  -  ----------  -
  ----------------

Previously, zone2 was inaccessible since it would iterate through 1 then
2. But 1 would always be seen first when dragging a window. With this
fix it zone2 will be accessible.
2019-09-26 23:23:09 +02:00
Bartosz Sosnowski
0b86941a3b Make FancyZone distinguish different modern apps. 2019-09-26 08:54:00 +02:00
Bartosz Sosnowski
b85f722e09 When moving window to a zone, ensure it does not remain in maximized state. 2019-09-18 10:41:51 +02:00
Bartosz Sosnowski
1a400bd7fd Filter windows moved by keyboard in FancyZones 2019-09-18 10:41:16 +02:00
Bret
a54e4299aa
Merge pull request #391 from microsoft/user/bretan/fz-multimon
Fix for #195 - Fancy Zones new editor needs to support multiple monitors
Fix for #292 - Zone Editor opens behind PowerToys Window
2019-09-17 17:58:53 -07:00
Bret Anderson
2c3c4e7519 Need to adjust x/y by scaled diff between monitor and work area rect 2019-09-16 12:48:55 -07:00
Bret Anderson
c0cdf7aaa6 Everything is working. 2019-09-15 13:34:00 -07:00
Enrico Giordani
8221f5e641
activate zones for windows with custom titlebar
fixes https://github.com/microsoft/PowerToys/issues/209
2019-09-11 21:12:39 +02:00
Enrico Giordani
1430332b98
default 'flashZones' to false 2019-09-11 21:11:55 +02:00
Bartosz Sosnowski
8ac6db8b5a
Fix cppcheck reported issues (#333)
Fixes: https://github.com/microsoft/PowerToys/issues/266
2019-09-11 12:38:20 +02:00
Bret Anderson
d4c8c84445 Pass DPI through to editor. It is more reliable. 2019-09-08 23:53:30 -07:00
Bret Anderson
3836aaa9d1 Almost working. Doesn't apply on my small monitor running at 150% scaling. 2019-09-08 14:54:44 -07:00
Bret Anderson
e562b29ecd Editor should come up on the monitor with the foreground window. Defaults to primary monitor if there is no foreground window. 2019-09-08 01:47:12 -07:00
Bartosz Sosnowski
8431b80e48 FancyZones and Shortcut Guide initial commit
Co-authored-by: Alexis Campailla <alexis@janeasystems.com>
Co-authored-by: Bret Anderson <bretan@microsoft.com>
Co-authored-by: Enrico Giordani <enrico.giordani@gmail.com>
Co-authored-by: Jaime Bernardo <jaime@janeasystems.com>
Co-authored-by: Jeff Bogdan <jeffbog@microsoft.com>
Co-authored-by: March Rogers <marchr@microsoft.com>
Co-authored-by: Mike Harsh <mharsh@microsoft.com>
Co-authored-by: Nachum Bundak <Nachum.Bundak@microsoft.com>
Co-authored-by: Oliver Jones <ojones@microsoft.com>
Co-authored-by: Patrick Little <plittle@microsoft.com>
2019-09-05 18:12:40 +02:00