mirror of
https://github.com/Stone-Red-Code/RemSox.git
synced 2026-09-04 00:56:19 +02:00
Add ScreenInfo render command for desktop size synchronization
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
|
using Cosmos.Kernel.System.Graphics;
|
||||||
using Cosmos.Kernel.System.Keyboard;
|
using Cosmos.Kernel.System.Keyboard;
|
||||||
|
|
||||||
using RemSox.Networking;
|
using RemSox.Networking;
|
||||||
@@ -38,6 +39,19 @@ internal sealed class RemoteDesktopProcess() : Process("Remote Desktop Server")
|
|||||||
|
|
||||||
server.ListenTo<string>("SyncRequest", async _ =>
|
server.ListenTo<string>("SyncRequest", async _ =>
|
||||||
{
|
{
|
||||||
|
Canvas canvas = FullScreenCanvas.GetFullScreenCanvas();
|
||||||
|
RenderCommand screenInfo = new()
|
||||||
|
{
|
||||||
|
Type = RenderCommandType.ScreenInfo,
|
||||||
|
WindowId = 0,
|
||||||
|
ElementId = 0,
|
||||||
|
Properties = new()
|
||||||
|
{
|
||||||
|
["Width"] = (int)canvas.Mode.Width,
|
||||||
|
["Height"] = (int)canvas.Mode.Height,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
networkSource?.Render([screenInfo]);
|
||||||
WindowManager.InvalidateAll();
|
WindowManager.InvalidateAll();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ public sealed class CanvasRenderSource : IRenderSource
|
|||||||
private static Point lastPointerPosition = new(-1, -1);
|
private static Point lastPointerPosition = new(-1, -1);
|
||||||
|
|
||||||
private static Point cursorPosition;
|
private static Point cursorPosition;
|
||||||
|
private static int screenWidth, screenHeight;
|
||||||
|
|
||||||
private static readonly Lock renderLock = new();
|
private static readonly Lock renderLock = new();
|
||||||
|
|
||||||
@@ -62,6 +63,12 @@ public sealed class CanvasRenderSource : IRenderSource
|
|||||||
isPositionDirty = true;
|
isPositionDirty = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case RenderCommandType.ScreenInfo:
|
||||||
|
screenWidth = Get(command.Properties, "Width", 640);
|
||||||
|
screenHeight = Get(command.Properties, "Height", 480);
|
||||||
|
isPositionDirty = true;
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
if (windowCanvases.ContainsKey(command.WindowId))
|
if (windowCanvases.ContainsKey(command.WindowId))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -95,6 +95,11 @@ public class RenderCommand
|
|||||||
WriteInt16(s, Position.X);
|
WriteInt16(s, Position.X);
|
||||||
WriteInt16(s, Position.Y);
|
WriteInt16(s, Position.Y);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case RenderCommandType.ScreenInfo:
|
||||||
|
WriteUInt16(s, GetProp("Width", 0));
|
||||||
|
WriteUInt16(s, GetProp("Height", 0));
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -163,6 +168,11 @@ public class RenderCommand
|
|||||||
case RenderCommandType.SetCursor:
|
case RenderCommandType.SetCursor:
|
||||||
pos = new Point(ReadInt16(data, ref offset), ReadInt16(data, ref offset));
|
pos = new Point(ReadInt16(data, ref offset), ReadInt16(data, ref offset));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case RenderCommandType.ScreenInfo:
|
||||||
|
props["Width"] = ReadUInt16(data, ref offset);
|
||||||
|
props["Height"] = ReadUInt16(data, ref offset);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return new RenderCommand
|
return new RenderCommand
|
||||||
|
|||||||
@@ -17,4 +17,6 @@ public enum RenderCommandType : byte
|
|||||||
RemovePrimitives = 0x20,
|
RemovePrimitives = 0x20,
|
||||||
|
|
||||||
SetCursor = 0x30,
|
SetCursor = 0x30,
|
||||||
|
|
||||||
|
ScreenInfo = 0xF0,
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user