From eeeabc82c92d514fb35b5b7af7014e3add5eec47 Mon Sep 17 00:00:00 2001 From: Jaime Bernardo Date: Thu, 23 Jan 2025 23:18:13 +0000 Subject: [PATCH] [ZoomIt]Fix transparent draw after changing another setting (#37042) --- src/modules/ZoomIt/ZoomIt/Zoomit.cpp | 6 ++++++ .../ZoomItSettingsInterop/ZoomItSettings.cpp | 10 ++++++++-- .../Settings.UI.Library/ZoomItProperties.cs | 16 ---------------- 3 files changed, 14 insertions(+), 18 deletions(-) diff --git a/src/modules/ZoomIt/ZoomIt/Zoomit.cpp b/src/modules/ZoomIt/ZoomIt/Zoomit.cpp index 5515a16783..d198616bbc 100644 --- a/src/modules/ZoomIt/ZoomIt/Zoomit.cpp +++ b/src/modules/ZoomIt/ZoomIt/Zoomit.cpp @@ -6023,6 +6023,12 @@ LRESULT APIENTRY MainWndProc( // Apply tray icon setting EnableDisableTrayIcon(hWnd, g_ShowTrayIcon); + // This is also called by ZoomIt when it starts and loads the Settings. Opacity is added after loading from registry, so we use the same pattern. + if ((g_PenColor >> 24) == 0) + { + g_PenColor |= 0xFF << 24; + } + // Apply hotkey settings UnregisterAllHotkeys(hWnd); g_ToggleMod = GetKeyMod(g_ToggleKey); diff --git a/src/modules/ZoomIt/ZoomItSettingsInterop/ZoomItSettings.cpp b/src/modules/ZoomIt/ZoomItSettingsInterop/ZoomItSettings.cpp index 3a197714b7..3eb3e235da 100644 --- a/src/modules/ZoomIt/ZoomItSettingsInterop/ZoomItSettings.cpp +++ b/src/modules/ZoomIt/ZoomItSettingsInterop/ZoomItSettings.cpp @@ -105,9 +105,12 @@ namespace winrt::PowerToys::ZoomItSettingsInterop::implementation } else if (special_semantics->second == SPECIAL_SEMANTICS_COLOR) { - // PowerToys settings likes colors as #FFFFFF strings. + /* PowerToys settings likes colors as #FFFFFF strings. + But currently these Settings are internal state for ZoomIt, not something that we really need to send Settings. + Code is kept here as a reference if a future color Setting ends up being configured. hstring s = winrt::to_hstring(std::format("#{:02x}{:02x}{:02x}", value & 0xFF, (value >> 8) & 0xFF, (value >> 16) & 0xFF)); _settings.add_property(curSetting->ValueName, s); + */ } } break; @@ -211,6 +214,9 @@ namespace winrt::PowerToys::ZoomItSettingsInterop::implementation } else if (special_semantics->second == SPECIAL_SEMANTICS_COLOR) { + /* PowerToys settings likes colors as #FFFFFF strings. + But currently these Settings are internal state for ZoomIt, not something that we really need to save from Settings. + Code is kept here as a reference if a future color Setting ends up being configured. auto possibleValue = valuesFromSettings.get_string_value(curSetting->ValueName); if (possibleValue.has_value()) { @@ -219,8 +225,8 @@ namespace winrt::PowerToys::ZoomItSettingsInterop::implementation { *static_cast(curSetting->Setting) = RGB(r, g, b); } - } + */ } } break; diff --git a/src/settings-ui/Settings.UI.Library/ZoomItProperties.cs b/src/settings-ui/Settings.UI.Library/ZoomItProperties.cs index 3cd7562673..936c08689e 100644 --- a/src/settings-ui/Settings.UI.Library/ZoomItProperties.cs +++ b/src/settings-ui/Settings.UI.Library/ZoomItProperties.cs @@ -44,12 +44,6 @@ namespace Microsoft.PowerToys.Settings.UI.Library public KeyboardKeysProperty SnipToggleKey { get; set; } - public StringProperty PenColor { get; set; } - - public IntProperty PenWidth { get; set; } - - public StringProperty BreakPenColor { get; set; } - public KeyboardKeysProperty BreakTimerKey { get; set; } public StringProperty Font { get; set; } @@ -80,24 +74,14 @@ namespace Microsoft.PowerToys.Settings.UI.Library public BoolProperty BreakShowDesktop { get; set; } - public BoolProperty BreakOnSecondary { get; set; } - - public IntProperty FontScale { get; set; } - public BoolProperty ShowExpiredTime { get; set; } public BoolProperty ShowTrayIcon { get; set; } public BoolProperty AnimnateZoom { get; set; } - public BoolProperty TelescopeZoomOut { get; set; } - - public BoolProperty SnapToGrid { get; set; } - public IntProperty ZoominSliderLevel { get; set; } - public IntProperty RecordFrameRate { get; set; } - public IntProperty RecordScaling { get; set; } public BoolProperty CaptureAudio { get; set; }