mirror of
https://github.com/microsoft/PowerToys.git
synced 2024-11-24 04:12:32 +08:00
Sync dev/imageResizer with master (#1105)
* tweaking language
* adjusting elevated permission verbiage to match Windows
* npm audit fix to update stuff
* slight bump for fabric ui
* Remove unwanted files (#1037)
Add temp build files to gitignore
* Ensure previous search and replace texts are evaluated and updated in the UI at startup (#1043)
Ensure stored settings get evaluated after initial enumeration
There was a bug where the list view was not getting updated with the results of the search and replace on launch when we are using a stored search or replace text from a previous session.
* 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
* runner: show message box when restarting with different elevation fails (#1061)
Also make the message box appear on top of the settings window.
* Fix misaligned display of zones in layout priview and grid editor (#1010)
Fix misaligned display of zones in layout preview and grid editor
* MSIX: Extract MSIX building functionality from msix_reinstall.ps1 to a separate script (#1068)
* MSIX: label PowerToys as Preview (#1090)
* MSIX: Code sign msixbundle (#1093)
* Update to MSIX README.md (#1095)
* Update README.md
few adjustments
* Update README.md
* Update README.md
* adding in privacy statement, removing About in dialog (#1087)
* adding in privacy statement, removing About in dialog
* added Preview
* Revert "Fix misaligned display of zones in layout priview and grid editor (#1010)" (#1097)
This reverts commit d03690cffd
.
* Fix reversed order of zones in layout (#1071)
* Shifted three functions to common (#1101)
Co-authored-by: Clint Rutkas <clint@rutkas.com>
Co-authored-by: Enrico Giordani <enricogior@users.noreply.github.com>
Co-authored-by: Chris Davis <chrisdavis@outlook.com>
Co-authored-by: Yosef Durr <yodurr@microsoft.com>
Co-authored-by: Bartosz Sosnowski <bzoz@users.noreply.github.com>
Co-authored-by: vldmr11080 <57061786+vldmr11080@users.noreply.github.com>
Co-authored-by: yuyoyuppe <yuyoyuppe@users.noreply.github.com>
This commit is contained in:
parent
f65b9fd2a7
commit
db7f15541f
4
.gitignore
vendored
4
.gitignore
vendored
@ -330,3 +330,7 @@ ASALocalRun/
|
|||||||
|
|
||||||
# MFractors (Xamarin productivity tool) working folder
|
# MFractors (Xamarin productivity tool) working folder
|
||||||
.mfractor/
|
.mfractor/
|
||||||
|
|
||||||
|
# Temp build files
|
||||||
|
src/settings/settings-html/200.html
|
||||||
|
src/settings/settings-html/404.html
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
</Capabilities>
|
</Capabilities>
|
||||||
<Applications>
|
<Applications>
|
||||||
<Application Id="PowerToys" Executable="PowerToys.exe" EntryPoint="Windows.FullTrustApplication">
|
<Application Id="PowerToys" Executable="PowerToys.exe" EntryPoint="Windows.FullTrustApplication">
|
||||||
<uap:VisualElements DisplayName="PowerToys" Description="Windows system utilities to maximize productivity" Square150x150Logo="Images\logo150.png" Square44x44Logo="Images\logo44.png" BackgroundColor="transparent" />
|
<uap:VisualElements DisplayName="PowerToys (Preview)" Description="Windows system utilities to maximize productivity" Square150x150Logo="Images\logo150.png" Square44x44Logo="Images\logo44.png" BackgroundColor="transparent" />
|
||||||
<Extensions>
|
<Extensions>
|
||||||
<uap5:Extension Category="windows.startupTask" Executable="PowerToys.exe" EntryPoint="Windows.FullTrustApplication">
|
<uap5:Extension Category="windows.startupTask" Executable="PowerToys.exe" EntryPoint="Windows.FullTrustApplication">
|
||||||
<uap5:StartupTask TaskId="PowerToysStartupTaskID" Enabled="true" DisplayName="PowerToys" />
|
<uap5:StartupTask TaskId="PowerToysStartupTaskID" Enabled="true" DisplayName="PowerToys" />
|
||||||
|
1
installer/MSIX/build_msix.ps1
Normal file
1
installer/MSIX/build_msix.ps1
Normal file
@ -0,0 +1 @@
|
|||||||
|
makeappx build /v /overwrite /f PackagingLayout.xml /id "PowerToys-x64" /op bin\
|
@ -1,6 +1,11 @@
|
|||||||
taskkill /f /im explorer.exe
|
taskkill /f /im explorer.exe
|
||||||
|
|
||||||
Get-AppxPackage -Name 'PowerToys' | select -ExpandProperty "PackageFullName" | Remove-AppxPackage
|
Get-AppxPackage -Name 'PowerToys' | select -ExpandProperty "PackageFullName" | Remove-AppxPackage
|
||||||
makeappx build /v /overwrite /f PackagingLayout.xml /id "PowerToys-x64" /op bin\
|
|
||||||
|
.\build_msix.ps1
|
||||||
signtool sign /debug /a /fd SHA256 /f PowerToys_TemporaryKey.pfx /p 12345 bin\PowerToys-x64.msix
|
signtool sign /debug /a /fd SHA256 /f PowerToys_TemporaryKey.pfx /p 12345 bin\PowerToys-x64.msix
|
||||||
|
signtool sign /debug /a /fd SHA256 /f PowerToys_TemporaryKey.pfx /p 12345 bin\PowerToys.msixbundle
|
||||||
|
|
||||||
Add-AppxPackage .\bin\PowerToys-x64.msix
|
Add-AppxPackage .\bin\PowerToys-x64.msix
|
||||||
|
|
||||||
start $Env:windir\explorer.exe
|
start $Env:windir\explorer.exe
|
@ -7,14 +7,21 @@
|
|||||||
* The resulting installer will be built to `PowerToysSetup\bin\Release\PowerToysSetup.msi`.
|
* The resulting installer will be built to `PowerToysSetup\bin\Release\PowerToysSetup.msi`.
|
||||||
|
|
||||||
## Building and installing self-signed PowerToys MSIX package
|
## Building and installing self-signed PowerToys MSIX package
|
||||||
For the first-time installation, you should generate a self-signed certificate and add it to the [TRCA store](https://docs.microsoft.com/en-us/windows-hardware/drivers/install/trusted-root-certification-authorities-certificate-store). That could be done by simply running `
|
For the first-time installation, you'll need to generate a self-signed certificate. The script below will generate and add a cert to your [TRCA store](https://docs.microsoft.com/en-us/windows-hardware/drivers/install/trusted-root-certification-authorities-certificate-store).
|
||||||
generate_self_sign_cert.ps1` from a powershell admin. After that:
|
1. Open `Developer PowerShell for VS` as an Admin
|
||||||
|
2. Navigate to your repo's `installer\MSIX`
|
||||||
|
3. Run `.\generate_self_sign_cert.ps1`
|
||||||
|
|
||||||
* Make sure you've built the `Release` configuration of `powertoys.sln`
|
## To Build
|
||||||
* Launch `msix_reinstall.ps1` from the devenv powershell
|
1. Make sure you've built the `Release` configuration of `powertoys.sln`
|
||||||
|
2. Open `Developer PowerShell for VS`
|
||||||
|
3. Navigate to your repo's `installer\MSIX`
|
||||||
|
4. Run `.\msix_reinstall.ps1` from the devenv powershell
|
||||||
|
|
||||||
|
### What msix_reinstall.ps1 does
|
||||||
`msix_reinstall.ps1` removes the current PowerToys installation, restarts explorer.exe (to update PowerRename shell extension), builds `PowerToys-x64.msix` package, signs it with a PowerToys_TemporaryKey.pfx, and finally installs it.
|
`msix_reinstall.ps1` removes the current PowerToys installation, restarts explorer.exe (to update PowerRename shell extension), builds `PowerToys-x64.msix` package, signs it with a PowerToys_TemporaryKey.pfx, and finally installs it.
|
||||||
## Removing all .msi/.msix PowerToys installations
|
|
||||||
|
#### Removing all .msi/.msix PowerToys installations
|
||||||
```ps
|
```ps
|
||||||
$name='PowerToys'
|
$name='PowerToys'
|
||||||
Get-AppxPackage -Name $name | select -ExpandProperty "PackageFullName" | Remove-AppxPackage
|
Get-AppxPackage -Name $name | select -ExpandProperty "PackageFullName" | Remove-AppxPackage
|
||||||
|
@ -310,6 +310,33 @@ bool run_non_elevated(const std::wstring& file, const std::wstring& params) {
|
|||||||
return succedded;
|
return succedded;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool run_same_elevation(const std::wstring& file, const std::wstring& params) {
|
||||||
|
auto executable_args = file;
|
||||||
|
if (!params.empty()) {
|
||||||
|
executable_args += L" " + params;
|
||||||
|
}
|
||||||
|
STARTUPINFO si = { 0 };
|
||||||
|
PROCESS_INFORMATION pi = { 0 };
|
||||||
|
auto succedded = CreateProcessW(file.c_str(),
|
||||||
|
const_cast<LPWSTR>(executable_args.c_str()),
|
||||||
|
nullptr,
|
||||||
|
nullptr,
|
||||||
|
FALSE,
|
||||||
|
0,
|
||||||
|
nullptr,
|
||||||
|
nullptr,
|
||||||
|
&si,
|
||||||
|
&pi);
|
||||||
|
if (pi.hProcess) {
|
||||||
|
CloseHandle(pi.hProcess);
|
||||||
|
}
|
||||||
|
if (pi.hThread) {
|
||||||
|
CloseHandle(pi.hThread);
|
||||||
|
}
|
||||||
|
return succedded;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
std::wstring get_process_path(HWND window) noexcept {
|
std::wstring get_process_path(HWND window) noexcept {
|
||||||
const static std::wstring app_frame_host = L"ApplicationFrameHost.exe";
|
const static std::wstring app_frame_host = L"ApplicationFrameHost.exe";
|
||||||
DWORD pid{};
|
DWORD pid{};
|
||||||
|
@ -58,6 +58,9 @@ bool run_elevated(const std::wstring& file, const std::wstring& params);
|
|||||||
// Run command as non-elevated user, returns true if succeeded
|
// Run command as non-elevated user, returns true if succeeded
|
||||||
bool run_non_elevated(const std::wstring& file, const std::wstring& params);
|
bool run_non_elevated(const std::wstring& file, const std::wstring& params);
|
||||||
|
|
||||||
|
// Run command with the same elevation, returns true if succedded
|
||||||
|
bool run_same_elevation(const std::wstring& file, const std::wstring& params);
|
||||||
|
|
||||||
// Get the executable path or module name for modern apps
|
// Get the executable path or module name for modern apps
|
||||||
std::wstring get_process_path(DWORD pid) noexcept;
|
std::wstring get_process_path(DWORD pid) noexcept;
|
||||||
// Get the executable path or module name for modern apps
|
// Get the executable path or module name for modern apps
|
||||||
|
@ -97,6 +97,8 @@
|
|||||||
<ClInclude Include="d2d_text.h" />
|
<ClInclude Include="d2d_text.h" />
|
||||||
<ClInclude Include="d2d_window.h" />
|
<ClInclude Include="d2d_window.h" />
|
||||||
<ClInclude Include="dpi_aware.h" />
|
<ClInclude Include="dpi_aware.h" />
|
||||||
|
<ClInclude Include="window_helpers.h" />
|
||||||
|
<ClInclude Include="icon_helpers.h" />
|
||||||
<ClInclude Include="hwnd_data_cache.h" />
|
<ClInclude Include="hwnd_data_cache.h" />
|
||||||
<ClInclude Include="json.h" />
|
<ClInclude Include="json.h" />
|
||||||
<ClInclude Include="monitors.h" />
|
<ClInclude Include="monitors.h" />
|
||||||
@ -130,10 +132,12 @@
|
|||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="settings_helpers.cpp" />
|
<ClCompile Include="settings_helpers.cpp" />
|
||||||
<ClCompile Include="settings_objects.cpp" />
|
<ClCompile Include="settings_objects.cpp" />
|
||||||
|
<ClCompile Include="icon_helpers.cpp" />
|
||||||
<ClCompile Include="start_visible.cpp" />
|
<ClCompile Include="start_visible.cpp" />
|
||||||
<ClCompile Include="tasklist_positions.cpp" />
|
<ClCompile Include="tasklist_positions.cpp" />
|
||||||
<ClCompile Include="common.cpp" />
|
<ClCompile Include="common.cpp" />
|
||||||
<ClCompile Include="windows_colors.cpp" />
|
<ClCompile Include="windows_colors.cpp" />
|
||||||
|
<ClCompile Include="window_helpers.cpp" />
|
||||||
<ClCompile Include="winstore.cpp" />
|
<ClCompile Include="winstore.cpp" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
|
@ -81,6 +81,12 @@
|
|||||||
<ClInclude Include="winstore.h">
|
<ClInclude Include="winstore.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="icon_helpers.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="window_helpers.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="d2d_svg.cpp">
|
<ClCompile Include="d2d_svg.cpp">
|
||||||
@ -132,5 +138,11 @@
|
|||||||
<ClCompile Include="winstore.cpp">
|
<ClCompile Include="winstore.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="icon_helpers.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="window_helpers.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
90
src/common/icon_helpers.cpp
Normal file
90
src/common/icon_helpers.cpp
Normal file
@ -0,0 +1,90 @@
|
|||||||
|
#include "icon_helpers.h"
|
||||||
|
#include "pch.h"
|
||||||
|
|
||||||
|
HRESULT GetIconIndexFromPath(_In_ PCWSTR path, _Out_ int* index)
|
||||||
|
{
|
||||||
|
*index = 0;
|
||||||
|
|
||||||
|
HRESULT hr = E_FAIL;
|
||||||
|
|
||||||
|
SHFILEINFO shFileInfo = { 0 };
|
||||||
|
|
||||||
|
if (!PathIsRelative(path))
|
||||||
|
{
|
||||||
|
DWORD attrib = GetFileAttributes(path);
|
||||||
|
HIMAGELIST himl = (HIMAGELIST)SHGetFileInfo(path, attrib, &shFileInfo, sizeof(shFileInfo), (SHGFI_SYSICONINDEX | SHGFI_SMALLICON | SHGFI_USEFILEATTRIBUTES));
|
||||||
|
if (himl)
|
||||||
|
{
|
||||||
|
*index = shFileInfo.iIcon;
|
||||||
|
// We shouldn't free the HIMAGELIST.
|
||||||
|
hr = S_OK;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return hr;
|
||||||
|
}
|
||||||
|
|
||||||
|
HBITMAP CreateBitmapFromIcon(_In_ HICON hIcon, _In_opt_ UINT width, _In_opt_ UINT height)
|
||||||
|
{
|
||||||
|
HBITMAP hBitmapResult = NULL;
|
||||||
|
|
||||||
|
// Create compatible DC
|
||||||
|
HDC hDC = CreateCompatibleDC(NULL);
|
||||||
|
if (hDC != NULL)
|
||||||
|
{
|
||||||
|
// Get bitmap rectangle size
|
||||||
|
RECT rc = { 0 };
|
||||||
|
rc.left = 0;
|
||||||
|
rc.right = (width != 0) ? width : GetSystemMetrics(SM_CXSMICON);
|
||||||
|
rc.top = 0;
|
||||||
|
rc.bottom = (height != 0) ? height : GetSystemMetrics(SM_CYSMICON);
|
||||||
|
|
||||||
|
// Create bitmap compatible with DC
|
||||||
|
BITMAPINFO BitmapInfo;
|
||||||
|
ZeroMemory(&BitmapInfo, sizeof(BITMAPINFO));
|
||||||
|
|
||||||
|
BitmapInfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
|
||||||
|
BitmapInfo.bmiHeader.biWidth = rc.right;
|
||||||
|
BitmapInfo.bmiHeader.biHeight = rc.bottom;
|
||||||
|
BitmapInfo.bmiHeader.biPlanes = 1;
|
||||||
|
BitmapInfo.bmiHeader.biBitCount = 32;
|
||||||
|
BitmapInfo.bmiHeader.biCompression = BI_RGB;
|
||||||
|
|
||||||
|
HDC hDCBitmap = GetDC(NULL);
|
||||||
|
|
||||||
|
HBITMAP hBitmap = CreateDIBSection(hDCBitmap, &BitmapInfo, DIB_RGB_COLORS, NULL, NULL, 0);
|
||||||
|
|
||||||
|
ReleaseDC(NULL, hDCBitmap);
|
||||||
|
|
||||||
|
if (hBitmap != NULL)
|
||||||
|
{
|
||||||
|
// Select bitmap into DC
|
||||||
|
HBITMAP hBitmapOld = (HBITMAP)SelectObject(hDC, hBitmap);
|
||||||
|
if (hBitmapOld != NULL)
|
||||||
|
{
|
||||||
|
// Draw icon into DC
|
||||||
|
if (DrawIconEx(hDC, 0, 0, hIcon, rc.right, rc.bottom, 0, NULL, DI_NORMAL))
|
||||||
|
{
|
||||||
|
// Restore original bitmap in DC
|
||||||
|
hBitmapResult = (HBITMAP)SelectObject(hDC, hBitmapOld);
|
||||||
|
hBitmapOld = NULL;
|
||||||
|
hBitmap = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hBitmapOld != NULL)
|
||||||
|
{
|
||||||
|
SelectObject(hDC, hBitmapOld);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hBitmap != NULL)
|
||||||
|
{
|
||||||
|
DeleteObject(hBitmap);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
DeleteDC(hDC);
|
||||||
|
}
|
||||||
|
|
||||||
|
return hBitmapResult;
|
||||||
|
}
|
5
src/common/icon_helpers.h
Normal file
5
src/common/icon_helpers.h
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
#pragma once
|
||||||
|
#include "common.h"
|
||||||
|
|
||||||
|
HRESULT GetIconIndexFromPath(_In_ PCWSTR path, _Out_ int* index);
|
||||||
|
HBITMAP CreateBitmapFromIcon(_In_ HICON hIcon, _In_opt_ UINT width = 0, _In_opt_ UINT height = 0);
|
30
src/common/window_helpers.cpp
Normal file
30
src/common/window_helpers.cpp
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
#include "window_helpers.h"
|
||||||
|
#include "pch.h"
|
||||||
|
|
||||||
|
HWND CreateMsgWindow(_In_ HINSTANCE hInst, _In_ WNDPROC pfnWndProc, _In_ void* p)
|
||||||
|
{
|
||||||
|
WNDCLASS wc = { 0 };
|
||||||
|
|
||||||
|
PCWSTR wndClassName = L"MsgWindow";
|
||||||
|
|
||||||
|
wc.lpfnWndProc = DefWindowProc;
|
||||||
|
wc.cbWndExtra = sizeof(void*);
|
||||||
|
wc.hInstance = hInst;
|
||||||
|
wc.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1);
|
||||||
|
wc.lpszClassName = wndClassName;
|
||||||
|
|
||||||
|
RegisterClass(&wc);
|
||||||
|
|
||||||
|
HWND hwnd = CreateWindowEx(
|
||||||
|
0, wndClassName, nullptr, 0, 0, 0, 0, 0, HWND_MESSAGE, 0, hInst, nullptr);
|
||||||
|
if (hwnd)
|
||||||
|
{
|
||||||
|
SetWindowLongPtr(hwnd, 0, (LONG_PTR)p);
|
||||||
|
if (pfnWndProc)
|
||||||
|
{
|
||||||
|
SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR)pfnWndProc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return hwnd;
|
||||||
|
}
|
4
src/common/window_helpers.h
Normal file
4
src/common/window_helpers.h
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
#pragma once
|
||||||
|
#include "common.h"
|
||||||
|
|
||||||
|
HWND CreateMsgWindow(_In_ HINSTANCE hInst, _In_ WNDPROC pfnWndProc, _In_ void* p);
|
@ -68,6 +68,10 @@ public:
|
|||||||
}
|
}
|
||||||
return GUID_NULL;
|
return GUID_NULL;
|
||||||
}
|
}
|
||||||
|
IFACEMETHODIMP_(int) GetZoneHighlightOpacity() noexcept
|
||||||
|
{
|
||||||
|
return m_settings->GetSettings().zoneHighlightOpacity;
|
||||||
|
}
|
||||||
|
|
||||||
LRESULT WndProc(HWND, UINT, WPARAM, LPARAM) noexcept;
|
LRESULT WndProc(HWND, UINT, WPARAM, LPARAM) noexcept;
|
||||||
void OnDisplayChange(DisplayChangeType changeType) noexcept;
|
void OnDisplayChange(DisplayChangeType changeType) noexcept;
|
||||||
@ -321,7 +325,6 @@ void FancyZones::ToggleEditor() noexcept
|
|||||||
monitor = MonitorFromWindow(foregroundWindow, MONITOR_DEFAULTTOPRIMARY);
|
monitor = MonitorFromWindow(foregroundWindow, MONITOR_DEFAULTTOPRIMARY);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (!monitor)
|
if (!monitor)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
@ -352,7 +355,7 @@ void FancyZones::ToggleEditor() noexcept
|
|||||||
|
|
||||||
const auto taskbar_x_offset = MulDiv(mi.rcWork.left - mi.rcMonitor.left, DPIAware::DEFAULT_DPI, dpi_x);
|
const auto taskbar_x_offset = MulDiv(mi.rcWork.left - mi.rcMonitor.left, DPIAware::DEFAULT_DPI, dpi_x);
|
||||||
const auto taskbar_y_offset = MulDiv(mi.rcWork.top - mi.rcMonitor.top, DPIAware::DEFAULT_DPI, dpi_y);
|
const auto taskbar_y_offset = MulDiv(mi.rcWork.top - mi.rcMonitor.top, DPIAware::DEFAULT_DPI, dpi_y);
|
||||||
|
|
||||||
// Do not scale window params by the dpi, that will be done in the editor - see LayoutModel.Apply
|
// Do not scale window params by the dpi, that will be done in the editor - see LayoutModel.Apply
|
||||||
const auto x = mi.rcMonitor.left + taskbar_x_offset;
|
const auto x = mi.rcMonitor.left + taskbar_x_offset;
|
||||||
const auto y = mi.rcMonitor.top + taskbar_y_offset;
|
const auto y = mi.rcMonitor.top + taskbar_y_offset;
|
||||||
|
@ -36,6 +36,7 @@ interface __declspec(uuid("{5C8D99D6-34B2-4F4A-A8E5-7483F6869775}")) IZoneWindow
|
|||||||
IFACEMETHOD_(void, MoveWindowsOnActiveZoneSetChange)() = 0;
|
IFACEMETHOD_(void, MoveWindowsOnActiveZoneSetChange)() = 0;
|
||||||
IFACEMETHOD_(COLORREF, GetZoneHighlightColor)() = 0;
|
IFACEMETHOD_(COLORREF, GetZoneHighlightColor)() = 0;
|
||||||
IFACEMETHOD_(GUID, GetCurrentMonitorZoneSetId)(HMONITOR monitor) = 0;
|
IFACEMETHOD_(GUID, GetCurrentMonitorZoneSetId)(HMONITOR monitor) = 0;
|
||||||
|
IFACEMETHOD_(int, GetZoneHighlightOpacity)() = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
winrt::com_ptr<IFancyZones> MakeFancyZones(HINSTANCE hinstance, IFancyZonesSettings* settings) noexcept;
|
winrt::com_ptr<IFancyZones> MakeFancyZones(HINSTANCE hinstance, IFancyZonesSettings* settings) noexcept;
|
||||||
|
@ -49,6 +49,7 @@ private:
|
|||||||
const std::wstring m_zoneHiglightName = L"fancyzones_zoneHighlightColor";
|
const std::wstring m_zoneHiglightName = L"fancyzones_zoneHighlightColor";
|
||||||
const std::wstring m_editorHotkeyName = L"fancyzones_editor_hotkey";
|
const std::wstring m_editorHotkeyName = L"fancyzones_editor_hotkey";
|
||||||
const std::wstring m_excludedAppsName = L"fancyzones_excluded_apps";
|
const std::wstring m_excludedAppsName = L"fancyzones_excluded_apps";
|
||||||
|
const std::wstring m_zoneHighlightOpacity = L"fancyzones_highlight_opacity";
|
||||||
};
|
};
|
||||||
|
|
||||||
IFACEMETHODIMP_(bool) FancyZonesSettings::GetConfig(_Out_ PWSTR buffer, _Out_ int *buffer_size) noexcept
|
IFACEMETHODIMP_(bool) FancyZonesSettings::GetConfig(_Out_ PWSTR buffer, _Out_ int *buffer_size) noexcept
|
||||||
@ -76,6 +77,7 @@ IFACEMETHODIMP_(bool) FancyZonesSettings::GetConfig(_Out_ PWSTR buffer, _Out_ in
|
|||||||
settings.add_bool_toogle(setting.name, setting.resourceId, *setting.value);
|
settings.add_bool_toogle(setting.name, setting.resourceId, *setting.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
settings.add_int_spinner(m_zoneHighlightOpacity, IDS_SETTINGS_HIGHLIGHT_OPACITY, m_settings.zoneHighlightOpacity, 0, 100, 1);
|
||||||
settings.add_color_picker(m_zoneHiglightName, IDS_SETTING_DESCRIPTION_ZONEHIGHLIGHTCOLOR, m_settings.zoneHightlightColor);
|
settings.add_color_picker(m_zoneHiglightName, IDS_SETTING_DESCRIPTION_ZONEHIGHLIGHTCOLOR, m_settings.zoneHightlightColor);
|
||||||
settings.add_multiline_string(m_excludedAppsName, IDS_SETTING_EXCLCUDED_APPS_DESCRIPTION, m_settings.excludedApps);
|
settings.add_multiline_string(m_excludedAppsName, IDS_SETTING_EXCLCUDED_APPS_DESCRIPTION, m_settings.excludedApps);
|
||||||
|
|
||||||
@ -153,6 +155,11 @@ void FancyZonesSettings::LoadSettings(PCWSTR config, bool fromFile) noexcept try
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (auto val = values.get_int_value(m_zoneHighlightOpacity))
|
||||||
|
{
|
||||||
|
m_settings.zoneHighlightOpacity = *val;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
CATCH_LOG();
|
CATCH_LOG();
|
||||||
|
|
||||||
@ -166,6 +173,7 @@ void FancyZonesSettings::SaveSettings() noexcept try
|
|||||||
}
|
}
|
||||||
|
|
||||||
values.add_property(m_zoneHiglightName, m_settings.zoneHightlightColor);
|
values.add_property(m_zoneHiglightName, m_settings.zoneHightlightColor);
|
||||||
|
values.add_property(m_zoneHighlightOpacity, m_settings.zoneHighlightOpacity);
|
||||||
values.add_property(m_editorHotkeyName, m_settings.editorHotkey.get_json());
|
values.add_property(m_editorHotkeyName, m_settings.editorHotkey.get_json());
|
||||||
values.add_property(m_excludedAppsName, m_settings.excludedApps);
|
values.add_property(m_excludedAppsName, m_settings.excludedApps);
|
||||||
|
|
||||||
|
@ -15,6 +15,7 @@ struct Settings
|
|||||||
bool appLastZone_moveWindows = false;
|
bool appLastZone_moveWindows = false;
|
||||||
bool use_cursorpos_editor_startupscreen = true;
|
bool use_cursorpos_editor_startupscreen = true;
|
||||||
std::wstring zoneHightlightColor = L"#0078D7";
|
std::wstring zoneHightlightColor = L"#0078D7";
|
||||||
|
int zoneHighlightOpacity = 90;
|
||||||
PowerToysSettings::HotkeyObject editorHotkey = PowerToysSettings::HotkeyObject::from_settings(true, false, false, false, VK_OEM_3);
|
PowerToysSettings::HotkeyObject editorHotkey = PowerToysSettings::HotkeyObject::from_settings(true, false, false, false, VK_OEM_3);
|
||||||
std::wstring excludedApps = L"";
|
std::wstring excludedApps = L"";
|
||||||
std::vector<std::wstring> excludedAppsArray;
|
std::vector<std::wstring> excludedAppsArray;
|
||||||
|
@ -49,7 +49,7 @@ IFACEMETHODIMP_(winrt::com_ptr<IZone>) ZoneSet::ZoneFromPoint(POINT pt) noexcept
|
|||||||
winrt::com_ptr<IZone> smallestKnownZone = nullptr;
|
winrt::com_ptr<IZone> smallestKnownZone = nullptr;
|
||||||
// To reduce redundant calculations, we will store the last known zones area.
|
// To reduce redundant calculations, we will store the last known zones area.
|
||||||
int smallestKnownZoneArea = INT32_MAX;
|
int smallestKnownZoneArea = INT32_MAX;
|
||||||
for (auto iter = m_zones.begin(); iter != m_zones.end(); iter++)
|
for (auto iter = m_zones.rbegin(); iter != m_zones.rend(); iter++)
|
||||||
{
|
{
|
||||||
if (winrt::com_ptr<IZone> zone = iter->try_as<IZone>())
|
if (winrt::com_ptr<IZone> zone = iter->try_as<IZone>())
|
||||||
{
|
{
|
||||||
|
@ -546,14 +546,14 @@ void ZoneWindow::DrawActiveZoneSet(wil::unique_hdc& hdc, RECT const& clientRect)
|
|||||||
|
|
||||||
// { fillAlpha, fill, borderAlpha, border, thickness }
|
// { fillAlpha, fill, borderAlpha, border, thickness }
|
||||||
ColorSetting const colorHints { 225, RGB(81, 92, 107), 255, RGB(104, 118, 138), -2 };
|
ColorSetting const colorHints { 225, RGB(81, 92, 107), 255, RGB(104, 118, 138), -2 };
|
||||||
ColorSetting colorViewer { 225, 0, 255, RGB(40, 50, 60), -2 };
|
ColorSetting colorViewer { OpacitySettingToAlpha(m_host->GetZoneHighlightOpacity()), 0, 255, RGB(40, 50, 60), -2 };
|
||||||
ColorSetting colorHighlight { 225, 0, 255, 0, -2 };
|
ColorSetting colorHighlight { OpacitySettingToAlpha(m_host->GetZoneHighlightOpacity()), 0, 255, 0, -2 };
|
||||||
ColorSetting const colorFlash { 200, RGB(81, 92, 107), 200, RGB(104, 118, 138), -2 };
|
ColorSetting const colorFlash { 200, RGB(81, 92, 107), 200, RGB(104, 118, 138), -2 };
|
||||||
|
|
||||||
auto zones = m_activeZoneSet->GetZones();
|
auto zones = m_activeZoneSet->GetZones();
|
||||||
const size_t maxColorIndex = min(size(zones) - 1, size(colors) - 1);
|
const size_t maxColorIndex = min(size(zones) - 1, size(colors) - 1);
|
||||||
size_t colorIndex = maxColorIndex;
|
size_t colorIndex = maxColorIndex;
|
||||||
for (auto iter = zones.rbegin(); iter != zones.rend(); iter++)
|
for (auto iter = zones.begin(); iter != zones.end(); iter++)
|
||||||
{
|
{
|
||||||
winrt::com_ptr<IZone> zone = iter->try_as<IZone>();
|
winrt::com_ptr<IZone> zone = iter->try_as<IZone>();
|
||||||
if (!zone)
|
if (!zone)
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
|