diff --git a/RemoteViewing/Vnc/VncClient.Framebuffer.cs b/RemoteViewing/Vnc/VncClient.Framebuffer.cs index a8a20e2..ce43c2f 100644 --- a/RemoteViewing/Vnc/VncClient.Framebuffer.cs +++ b/RemoteViewing/Vnc/VncClient.Framebuffer.cs @@ -65,8 +65,10 @@ private bool HandleFramebufferUpdate() { var r = this.c.ReceiveRectangle(); int x = r.X, y = r.Y, w = r.Width, h = r.Height; - VncStream.SanityCheck(w > 0 && w < 0x8000); - VncStream.SanityCheck(h > 0 && h < 0x8000); + + // we could receive 0,0 on an update rectangle with a "pseudo-encoding" + VncStream.SanityCheck(w >= 0 && w < 0x8000); + VncStream.SanityCheck(h >= 0 && h < 0x8000); int fbW = this.Framebuffer.Width, fbH = this.Framebuffer.Height, bpp = this.Framebuffer.PixelFormat.BytesPerPixel; var inRange = w <= fbW && h <= fbH && x <= fbW - w && y <= fbH - h; @@ -263,6 +265,10 @@ private bool HandleFramebufferUpdate() this.Framebuffer = new VncFramebuffer(this.Framebuffer.Name, w, h, this.Framebuffer.PixelFormat); continue; // Don't call OnFramebufferChanged for this one. + case VncEncoding.PseudoCursor: + // client requesting the Cursor pseudo-encoding + continue; + default: VncStream.Require( false, diff --git a/RemoteViewing/Vnc/VncPixelFormat.cs b/RemoteViewing/Vnc/VncPixelFormat.cs index d6b75d2..ee7dea1 100644 --- a/RemoteViewing/Vnc/VncPixelFormat.cs +++ b/RemoteViewing/Vnc/VncPixelFormat.cs @@ -74,7 +74,7 @@ public VncPixelFormat( throw new ArgumentOutOfRangeException(nameof(bitsPerPixel)); } - if (bitDepth != 6 && bitDepth != 24) + if (bitDepth != 6 && bitDepth != 24 && bitDepth != 32) { throw new ArgumentOutOfRangeException(nameof(bitDepth)); } @@ -474,6 +474,12 @@ internal static VncPixelFormat Decode(byte[] buffer, int offset) var greenShift = buffer[offset + 11]; var blueShift = buffer[offset + 12]; + // treat 32 bit depth as 24 bits + if (depth == 32) + { + depth = 24; + } + return new VncPixelFormat( bitsPerPixel, depth,