Add ScreenInfo render command for desktop size synchronization

This commit is contained in:
Stone_Red
2026-06-17 01:22:15 +02:00
parent 633ded2d62
commit 5cd1f6654b
4 changed files with 33 additions and 0 deletions
+7
View File
@@ -26,6 +26,7 @@ public sealed class CanvasRenderSource : IRenderSource
private static Point lastPointerPosition = new(-1, -1);
private static Point cursorPosition;
private static int screenWidth, screenHeight;
private static readonly Lock renderLock = new();
@@ -62,6 +63,12 @@ public sealed class CanvasRenderSource : IRenderSource
isPositionDirty = true;
break;
case RenderCommandType.ScreenInfo:
screenWidth = Get(command.Properties, "Width", 640);
screenHeight = Get(command.Properties, "Height", 480);
isPositionDirty = true;
break;
default:
if (windowCanvases.ContainsKey(command.WindowId))
{
+10
View File
@@ -95,6 +95,11 @@ public class RenderCommand
WriteInt16(s, Position.X);
WriteInt16(s, Position.Y);
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:
pos = new Point(ReadInt16(data, ref offset), ReadInt16(data, ref offset));
break;
case RenderCommandType.ScreenInfo:
props["Width"] = ReadUInt16(data, ref offset);
props["Height"] = ReadUInt16(data, ref offset);
break;
}
return new RenderCommand
+2
View File
@@ -17,4 +17,6 @@ public enum RenderCommandType : byte
RemovePrimitives = 0x20,
SetCursor = 0x30,
ScreenInfo = 0xF0,
}