Add unified input event queue and cursor support for window manager

This commit is contained in:
Stone_Red
2026-06-17 00:50:05 +02:00
parent 8d1cd6d369
commit 633ded2d62
7 changed files with 253 additions and 27 deletions
+8 -2
View File
@@ -1,6 +1,5 @@
using Cosmos.Kernel.System.Graphics;
using Cosmos.Kernel.System.Graphics.Fonts;
using Cosmos.Kernel.System.Mouse;
using RemSox.UI.GUI.UIEelements;
using RemSox.Utils;
@@ -26,6 +25,8 @@ public sealed class CanvasRenderSource : IRenderSource
private static bool isPositionDirty = true;
private static Point lastPointerPosition = new(-1, -1);
private static Point cursorPosition;
private static readonly Lock renderLock = new();
public void Render(IEnumerable<RenderCommand> commands)
@@ -56,6 +57,11 @@ public sealed class CanvasRenderSource : IRenderSource
RemovePrimitives(command.WindowId, command.ElementId);
break;
case RenderCommandType.SetCursor:
cursorPosition = command.Position;
isPositionDirty = true;
break;
default:
if (windowCanvases.ContainsKey(command.WindowId))
{
@@ -70,7 +76,7 @@ public sealed class CanvasRenderSource : IRenderSource
public void Composite()
{
Canvas screenCanvas = FullScreenCanvas.GetFullScreenCanvas();
Point pointerPosition = new(MouseManager.X, MouseManager.Y);
Point pointerPosition = cursorPosition;
lock (renderLock)
{