Add automatic window positioning to avoid overlap and maximize spaciousness

This commit is contained in:
Stone_Red
2026-06-10 04:02:54 +02:00
parent 3a635e85df
commit fad05a3e9a
5 changed files with 124 additions and 23 deletions
+1 -9
View File
@@ -1,5 +1,3 @@
using Cosmos.Kernel.System.Graphics;
using RemSox.Processing;
using RemSox.UI.GUI.Rendering;
using RemSox.UI.GUI.Windows;
@@ -18,17 +16,11 @@ internal class DesktopProcess() : Process("Desktop Manager")
isGraphicsInitialized = true;
}
// Trigger Canvas initialization
_ = FullScreenCanvas.GetFullScreenCanvas();
// Force existing windows to redraw onto the new canvas renderer
WindowManager.InvalidateAll();
// Start the terminal process within the desktop environment
_ = ProcessManager.SpawnProcess<TerminalProcess>();
// Create a test window for new UI controls
Window testWindow = WindowManager.CreateWindow(this, "UI Controls Test", new System.Drawing.Point(500, 50), new System.Drawing.Size(200, 180));
Window testWindow = WindowManager.CreateWindow(this, "UI Controls Test", new System.Drawing.Size(200, 180));
_ = testWindow.CreateUIElement<UI.GUI.UIEelements.Controls.Button>(b =>
{
+11 -7
View File
@@ -9,7 +9,7 @@ using System.Drawing;
namespace RemSox.Processes;
public class TerminalProcess : Process
public class TerminalProcess() : Process("Terminal")
{
private Window window = null!;
private readonly List<string> history = [];
@@ -19,13 +19,9 @@ public class TerminalProcess : Process
private const int LineHeight = 30;
private Size lastSize = new(-1, -1);
public TerminalProcess() : base("Terminal")
{
}
internal override void Start(string[] args)
{
window = WindowManager.CreateWindow(this, "Terminal", new Point(50, 50), new Size(400, 300));
window = WindowManager.CreateWindow(this, "Terminal", new Size(400, 300));
PrintLine("RemSox GUI Terminal v1.0");
PrintLine("Type 'help' for commands.");
@@ -58,10 +54,18 @@ public class TerminalProcess : Process
if (!string.IsNullOrWhiteSpace(cmd))
{
if (cmd == "exit")
if (cmd.Trim() == "exit")
{
RequestStop();
}
else if (cmd.Trim() == "clear")
{
lock (textLinesLock)
{
history.Clear();
UpdateDisplay();
}
}
else
{
bool found = CommandManager.TryExecute(cmd, PrintLine);
+1 -1
View File
@@ -11,7 +11,7 @@ public class TestProcess() : Process("Test Process")
{
internal override void Start(string[] args)
{
Window window = WindowManager.CreateWindow(this, "Test Window", Point.Empty, new Size(200, 150));
Window window = WindowManager.CreateWindow(this, "Test Window", new Size(200, 150));
window.AutoFlush = true;
Circle circle = window.CreateUIElement<Circle>(rect =>