From 218ec195591bfc7ea9e719b665fe9c1f83dc2c1e Mon Sep 17 00:00:00 2001 From: Leonmmcoset Date: Sat, 4 Apr 2026 14:27:37 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=B2=89=E8=89=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BuildTime.txt | 2 +- GitCommit.txt | 2 +- Gui/UILib/Dropdown.cs | 15 ++++++++++++++- Gui/UILib/UITheme.cs | 24 +++++++++++++++++++++++- Gui/WindowManager.cs | 4 ++++ 5 files changed, 43 insertions(+), 4 deletions(-) diff --git a/BuildTime.txt b/BuildTime.txt index 4ee61fb..ff38f66 100644 --- a/BuildTime.txt +++ b/BuildTime.txt @@ -1 +1 @@ -2026-04-04 13:54:37 \ No newline at end of file +2026-04-04 14:22:16 \ No newline at end of file diff --git a/GitCommit.txt b/GitCommit.txt index 6b2193e..80cc331 100644 --- a/GitCommit.txt +++ b/GitCommit.txt @@ -1 +1 @@ -2f9df41 \ No newline at end of file +121d30f \ No newline at end of file diff --git a/Gui/UILib/Dropdown.cs b/Gui/UILib/Dropdown.cs index 46cf130..902ea38 100644 --- a/Gui/UILib/Dropdown.cs +++ b/Gui/UILib/Dropdown.cs @@ -11,7 +11,7 @@ namespace CMLeonOS.Gui.UILib { hostWindow = parent; OnClick = (_, _) => ToggleExpanded(); - OnUnfocused = Collapse; + OnUnfocused = HandleUnfocused; } private readonly Window hostWindow; @@ -149,6 +149,17 @@ namespace CMLeonOS.Gui.UILib Render(); } + private void HandleUnfocused() + { + Window nextFocus = WM.PendingFocusTarget; + if (nextFocus == popupTable || nextFocus == popupWindow) + { + return; + } + + Collapse(); + } + private void ToggleExpanded() { if (Expanded) @@ -288,6 +299,8 @@ namespace CMLeonOS.Gui.UILib popupTable.SelectedBorder = Highlight; popupTable.SelectedForeground = Foreground; popupTable.TableCellSelected = PopupSelected; + popupTable.OnUnfocused = Collapse; + popupWindow.OnUnfocused = Collapse; for (int i = 0; i < Items.Count; i++) { diff --git a/Gui/UILib/UITheme.cs b/Gui/UILib/UITheme.cs index fce1f76..59e3c7a 100644 --- a/Gui/UILib/UITheme.cs +++ b/Gui/UILib/UITheme.cs @@ -43,7 +43,7 @@ namespace CMLeonOS.Gui.UILib internal static string[] GetThemeNames() { - return new string[] { "Default", "Graphite", "Forest", "Sunset", "Rose", "Terminal" }; + return new string[] { "Default", "Graphite", "Forest", "Sunset", "Rose", "Pink", "Terminal" }; } internal static void ApplyTheme(string themeName) @@ -140,6 +140,28 @@ namespace CMLeonOS.Gui.UILib CurrentThemeName = "Rose"; break; + case "Pink": + WindowTitleBackground = Color.FromArgb(106, 34, 82); + WindowTitleTopHighlight = Color.FromArgb(156, 74, 128); + WindowTitleBottomBorder = Color.FromArgb(58, 17, 44); + WindowTitleText = Color.FromArgb(255, 242, 250); + WindowButtonBackground = Color.FromArgb(132, 52, 104); + + Surface = Color.FromArgb(255, 244, 250); + SurfaceMuted = Color.FromArgb(246, 226, 238); + SurfaceBorder = Color.FromArgb(198, 154, 178); + TextPrimary = Color.FromArgb(84, 32, 64); + TextSecondary = Color.FromArgb(136, 92, 116); + + Accent = Color.FromArgb(232, 84, 164); + AccentDark = Color.FromArgb(191, 56, 129); + AccentLight = Color.FromArgb(255, 212, 236); + + Success = Color.FromArgb(72, 161, 118); + Warning = Color.FromArgb(216, 142, 65); + CurrentThemeName = "Pink"; + break; + case "Terminal": WindowTitleBackground = Color.FromArgb(14, 22, 14); WindowTitleTopHighlight = Color.FromArgb(33, 60, 33); diff --git a/Gui/WindowManager.cs b/Gui/WindowManager.cs index 726d880..f3af3f2 100644 --- a/Gui/WindowManager.cs +++ b/Gui/WindowManager.cs @@ -59,6 +59,7 @@ namespace CMLeonOS.Gui internal uint ScreenHeight { get; private set; } internal Window Focus { get; set; } + internal Window PendingFocusTarget { get; private set; } private uint bytesPerPixel { get; set; } @@ -233,6 +234,8 @@ namespace CMLeonOS.Gui return; } + PendingFocusTarget = window; + if (Focus != null && Focus != window) { Focus.OnUnfocused?.Invoke(); @@ -240,6 +243,7 @@ namespace CMLeonOS.Gui Focus = window; window.OnFocused?.Invoke(); + PendingFocusTarget = null; if (updateDock) {