Add taskbar, start menu, and desktop background with gradient bands

This commit is contained in:
Stone_Red
2026-06-16 19:25:04 +02:00
parent e3ece1fb4a
commit 92cc387f2d
4 changed files with 204 additions and 127 deletions
+18 -1
View File
@@ -105,8 +105,25 @@ public sealed class CanvasRenderSource : IRenderSource
dirtyWindows.Clear();
}
// Draw desktop background
int w = (int)screenCanvas.Mode.Width;
int h = (int)screenCanvas.Mode.Height;
screenCanvas.Clear(Color.FromArgb(45, 45, 48));
// Subtle horizontal gradient effect (4 bands)
Color[] bands = [
Color.FromArgb(30, 30, 35),
Color.FromArgb(45, 45, 48),
Color.FromArgb(60, 60, 65),
Color.FromArgb(45, 45, 48),
];
int bandH = h / bands.Length;
for (int i = 0; i < bands.Length; i++)
{
screenCanvas.DrawFilledRectangle(bands[i], 0, i * bandH, w, bandH + 1);
}
// Composite all windows to screen
screenCanvas.Clear(Color.Black);
foreach (int windowId in zOrderedWindows.Values)
{
if (windowPositions.TryGetValue(windowId, out Point pos) &&
+6 -2
View File
@@ -47,6 +47,9 @@ public sealed class Window(string title, int processId, int id, IRenderSource re
/// <summary> Gets or sets whether the window can be dragged by the user. </summary>
public bool IsDraggable { get; set; } = true;
/// <summary> Gets or sets whether the window has a title bar and border. </summary>
public bool HasChrome { get; set; } = true;
/// <summary> Gets or sets the position of the window. </summary>
public Point Position { get; set; }
@@ -227,7 +230,7 @@ public sealed class Window(string title, int processId, int id, IRenderSource re
}
// --- Chrome primitives (title bar, border, background) ---
if (chromeChanged)
if (chromeChanged && HasChrome)
{
ChromePrimitives(commands);
}
@@ -560,7 +563,8 @@ public sealed class Window(string title, int processId, int id, IRenderSource re
private bool IsPointInTitleBar(Point pointerPosition)
{
return pointerPosition.X >= Position.X
return HasChrome
&& pointerPosition.X >= Position.X
&& pointerPosition.X < Position.X + Size.Width
&& pointerPosition.Y >= Position.Y
&& pointerPosition.Y < Position.Y + 18;
+14
View File
@@ -263,6 +263,20 @@ public static class WindowManager
}
}
/// <summary>
/// Returns all windows across all processes, ordered by Z-index (highest first).
/// </summary>
public static List<Window> GetAllWindows()
{
lock (windowsLock)
{
return windows.Values
.SelectMany(w => w)
.OrderBy(w => w.Id)
.ToList();
}
}
/// <summary>
/// Closes all windows belonging to the given process.
/// </summary>