When connecting via RealVNC viewer, it stays on the same frame for so long, and its very confusing. If this is a code issue, here's my code for the VNC Server.
`using RemoteViewing.Vnc;
using RemoteViewing.Vnc.Server;
using RemoteViewing.Windows.Forms;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
/// <summary>
/// Initializes a new instance of the <see cref="VncScreenFramebufferSource"/> class.
/// </summary>
/// <param name="name">The framebuffer name. Many VNC clients set their titlebar to this name.</param>
/// <param name="screen">The bounds of the screen region.</param>
public VncScreenFramebufferSource(string name, Screen screen)
{
if (screen == null)
{
throw new ArgumentNullException(nameof(screen));
}
this.name = name ?? throw new ArgumentNullException(nameof(name));
this.getScreenBounds = () => screen.Bounds;
}
/// <summary>
/// Initializes a new instance of the <see cref="VncScreenFramebufferSource"/> class.
/// Screen region bounds are determined by a callback.
/// </summary>
/// <param name="name">The framebuffer name. Many VNC clients set their titlebar to this name.</param>
/// <param name="getBoundsCallback">A callback supplying the bounds of the screen region to copy.</param>
public VncScreenFramebufferSource(string name, VncScreenFramebufferSourceGetBoundsCallback getBoundsCallback)
{
this.name = name ?? throw new ArgumentNullException(nameof(name));
this.getScreenBounds = getBoundsCallback ?? throw new ArgumentNullException(nameof(getBoundsCallback));
}
/// <inheritdoc/>
public bool SupportsResizing => false;
/// <inheritdoc/>
public ExtendedDesktopSizeStatus SetDesktopSize(int width, int height)
{
return ExtendedDesktopSizeStatus.Prohibited;
}
/// <summary>
/// Captures the screen.
/// </summary>
/// <returns>A framebuffer corresponding to the screen.</returns>
public VncFramebuffer Capture()
{
var bounds = this.getScreenBounds();
int w = bounds.Width, h = bounds.Height;
if (this.bitmap == null || this.bitmap.Width != w || this.bitmap.Height != h)
{
this.bitmap = new Bitmap(w, h);
this.framebuffer = new VncFramebuffer(this.name, w, h, new VncPixelFormat());
}
using (var g = Graphics.FromImage(this.bitmap))
{
g.CopyFromScreen(bounds.X, bounds.Y, 0, 0, bounds.Size);
lock (this.framebuffer.SyncRoot)
{
VncBitmap.CopyToFramebuffer(
this.bitmap,
new VncRectangle(0, 0, w, h),
this.framebuffer,
0,
0);
}
}
return this.framebuffer;
}
public void HandleKeyEvent(object sender, KeyChangedEventArgs e)
{
}
public void HandleTouchEvent(object sender, PointerChangedEventArgs e)
{
mouse.OnMouseUpdate(sender, e);
}
}