Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
15 commits
Select commit Hold shift + click to select a range
5b5957d
fix(rdp): guard optional native exports and define WIN32_LEAN_AND_MEA…
heartacker Nov 24, 2026
2475445
perf(rdp): enable FreeRDP UDP multitransport for low-latency sessions
heartacker Nov 24, 2026
d70bf6f
feat(rdp): add manual security mode selector in session editor
heartacker Nov 24, 2026
7d2222c
feat(rdp): sync CapsLock/NumLock/ScrollLock state with remote session
heartacker Nov 24, 2026
c3cf0aa
feat(rdp): sync remote mouse pointer shape across platforms
heartacker Nov 24, 2026
d2d9e70
feat(rdp): add cross-platform image/file/rich-text clipboard, drag-an…
heartacker Nov 24, 2026
238d480
feat(rdp): add 3-mode RDP window workflow, 4-state immersive maximize…
heartacker Nov 24, 2026
aa52f1a
fix(rdp): snap multi-monitor layouts and derive framebuffer slices fr…
heartacker Nov 24, 2026
49eb7f2
fix(rdp): implement cxrdp_resize_monitors and CS_MONITOR handshake in…
heartacker Nov 24, 2026
9fe65e8
feat(rdp): 新增会话级 H.264/AVC444 图形加速选项
heartacker Nov 24, 2026
73bd3f5
perf(rdp): 支持局部脏矩形帧拷贝以降低高分辨率 CPU 占用
heartacker Nov 24, 2026
108581f
feat(rdp): 补齐原生剪贴板数据锁定(LockClipboardData)与能力开关实现
heartacker Nov 24, 2026
25258bf
feat(rdp): 统一多屏缩放比例与会话 RdpDpiPolicy 策略
heartacker Nov 24, 2026
905dfae
feat(rdp): 补齐原生剪贴板图片/文件/富文本导出与 CLIPRDR 协议实现
heartacker Nov 25, 2026
4237cb0
fix(rdp): stabilize dynamic resolution and DPI following
heartacker Nov 25, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
83 changes: 83 additions & 0 deletions Controls/RdpSliceSurface.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
using Avalonia;
using Avalonia.Controls;
using Avalonia.Media;
using Avalonia.Media.Imaging;

namespace CxShell.Controls;

/// <summary>
/// Renders a rectangular slice of a shared RDP <see cref="WriteableBitmap"/> with zero extra pixel copies.
/// </summary>
public sealed class RdpSliceSurface : Control
{
private Bitmap? _source;
private Rect _sourceRect;

public Bitmap? Source
{
get => _source;
set
{
if (ReferenceEquals(_source, value))
return;
_source = value;
InvalidateVisual();
}
}

public Rect SourceRect
{
get => _sourceRect;
set
{
if (_sourceRect == value)
return;
_sourceRect = value;
InvalidateVisual();
}
}

public override void Render(DrawingContext context)
{
base.Render(context);

if (_source == null || Bounds.Width <= 0 || Bounds.Height <= 0)
return;

var bitmapSize = _source.PixelSize;
if (bitmapSize.Width <= 0 || bitmapSize.Height <= 0)
return;

var src = _sourceRect.Width > 0 && _sourceRect.Height > 0
? _sourceRect
: new Rect(0, 0, bitmapSize.Width, bitmapSize.Height);

if (src.X >= bitmapSize.Width || src.Y >= bitmapSize.Height)
{
context.FillRectangle(Brushes.Black, new Rect(0, 0, Bounds.Width, Bounds.Height));
return;
}

var clampedX = System.Math.Clamp(src.X, 0, bitmapSize.Width - 1);
var clampedY = System.Math.Clamp(src.Y, 0, bitmapSize.Height - 1);
var clampedW = System.Math.Clamp(src.Width, 1, bitmapSize.Width - clampedX);
var clampedH = System.Math.Clamp(src.Height, 1, bitmapSize.Height - clampedY);

// Guard against bilinear edge bleeding from the adjacent monitor's right/bottom border
if (clampedX > 0 && clampedW > 2)
{
clampedX += 1;
clampedW -= 1;
}
if (clampedY > 0 && clampedH > 2)
{
clampedY += 1;
clampedH -= 1;
}

context.DrawImage(
_source,
new Rect(clampedX, clampedY, clampedW, clampedH),
new Rect(0, 0, Bounds.Width, Bounds.Height));
}
}
33 changes: 26 additions & 7 deletions Models/SessionInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -155,15 +155,15 @@ public class ProxySettings : INotifyPropertyChanged
public Guid Id { get; set; } = Guid.NewGuid();
public string Name { get; set; } = string.Empty;

[JsonConverter(typeof(JsonStringEnumConverter))]
[JsonConverter(typeof(JsonStringEnumConverter<ProxyProtocol>))]
public ProxyProtocol Protocol { get; set; } = ProxyProtocol.None;

public string Host { get; set; } = string.Empty;
public int Port { get; set; }
public string Username { get; set; } = string.Empty;
public string Password { get; set; } = string.Empty;

[JsonConverter(typeof(JsonStringEnumConverter))]
[JsonConverter(typeof(JsonStringEnumConverter<AuthMethod>))]
public AuthMethod AuthMethod { get; set; } = AuthMethod.Password;

public string PrivateKeyPath { get; set; } = string.Empty;
Expand Down Expand Up @@ -228,7 +228,7 @@ public class SshTunnelRule
{
public Guid Id { get; set; } = Guid.NewGuid();

[JsonConverter(typeof(JsonStringEnumConverter))]
[JsonConverter(typeof(JsonStringEnumConverter<SshTunnelRuleType>))]
public SshTunnelRuleType Type { get; set; } = SshTunnelRuleType.Local;

public string SourceHost { get; set; } = "localhost";
Expand Down Expand Up @@ -379,7 +379,7 @@ public class SessionInfo
public List<ProxySettings> ProxyServers { get; set; } = new();
public Guid? SelectedProxyId { get; set; }

[JsonConverter(typeof(JsonStringEnumConverter))]
[JsonConverter(typeof(JsonStringEnumConverter<SessionProtocol>))]
public SessionProtocol Protocol { get; set; } = SessionProtocol.SSH;

/// <summary>
Expand All @@ -389,7 +389,7 @@ public class SessionInfo
[JsonIgnore]
public LocalTerminalProfile? LocalTerminalProfile { get; set; }

[JsonConverter(typeof(JsonStringEnumConverter))]
[JsonConverter(typeof(JsonStringEnumConverter<AuthMethod>))]
public AuthMethod AuthMethod { get; set; } = AuthMethod.Password;

public string Password { get; set; } = string.Empty;
Expand Down Expand Up @@ -522,9 +522,9 @@ public class SessionInfo
public bool RunLoginScriptFile { get; set; }
public string LoginScriptFilePath { get; set; } = string.Empty;
public string LoginScriptParameters { get; set; } = string.Empty;
[JsonConverter(typeof(JsonStringEnumConverter))]
[JsonConverter(typeof(JsonStringEnumConverter<LoginScriptExecutionMode>))]
public LoginScriptExecutionMode LoginScriptExecutionMode { get; set; } = LoginScriptExecutionMode.SendText;
[JsonConverter(typeof(JsonStringEnumConverter))]
[JsonConverter(typeof(JsonStringEnumConverter<LoginScriptExecutionTarget>))]
public LoginScriptExecutionTarget LoginScriptExecutionTarget { get; set; } = LoginScriptExecutionTarget.Remote;
public string LoginScriptInterpreter { get; set; } = string.Empty;
public string SshRemoteCommand { get; set; } = string.Empty;
Expand Down Expand Up @@ -597,7 +597,25 @@ public int SshMonitorRefreshIntervalSeconds
/// <summary>Frame presentation strategy: Auto, Coalesce, FrameMarker or Legacy.</summary>
public string RdpFrameStrategy { get; set; } = "Auto";
public string RdpColorQuality { get; set; } = "32";
/// <summary>Preferred RDP security mode: Auto, Negotiate, NLA, TLS or RDP.</summary>
public string RdpSecurityMode { get; set; } = "Auto";
/// <summary>RDP window mode: Default (main window tab), MultiTab (standalone multi-tab RDP window), or Standalone (detached single-session window with multi-monitor support).</summary>
public string RdpWindowMode { get; set; } = "Default";
public bool RdpOpenInStandaloneWindow { get; set; }

public string ResolveEffectiveRdpWindowMode()
{
if (string.Equals(RdpWindowMode, "MultiTab", StringComparison.OrdinalIgnoreCase))
return "MultiTab";
if (string.Equals(RdpWindowMode, "Standalone", StringComparison.OrdinalIgnoreCase))
return "Standalone";
if (string.Equals(RdpWindowMode, "Default", StringComparison.OrdinalIgnoreCase) && RdpOpenInStandaloneWindow)
return "MultiTab";
return RdpOpenInStandaloneWindow ? "MultiTab" : "Default";
}
public bool RdpApplyKeyCombinations { get; set; } = true;
public bool RdpSyncLockKeys { get; set; } = true;
public bool RdpEnableClipboardLock { get; set; } = true;
public bool RdpClipboardEnabled { get; set; } = true;
/// <summary>Send PERF_DISABLE_WALLPAPER so the server skips the desktop wallpaper.</summary>
public bool RdpDisableWallpaper { get; set; } = true;
Expand All @@ -609,6 +627,7 @@ public int SshMonitorRefreshIntervalSeconds
/// the pipeline still connect - the bridge retries once without EGFX.
/// </summary>
public bool RdpGraphicsPipelineEnabled { get; set; } = true;
public bool RdpH264Enabled { get; set; }
public bool RdpRedirectDrives { get; set; }
public string RdpDriveName { get; set; } = "CxShell";
public string RdpDrivePath { get; set; } = string.Empty;
Expand Down
48 changes: 46 additions & 2 deletions Services/LocalizationService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,8 @@ public sealed class LocalizationService : INotifyPropertyChanged
["FullScreenBar.Pin"] = "Pin the connection bar",
["FullScreenBar.Unpin"] = "Unpin the connection bar (auto hide)",
["FullScreenBar.Minimize"] = "Minimize",
["FullScreenBar.Restore"] = "Exit full screen",
["FullScreenBar.Restore"] = "Restore window",
["FullScreenBar.ToggleFullScreen"] = "Toggle full screen (F11)",
["FullScreenBar.Close"] = "Close this session",
["FullScreenBar.Quality"] = "Link quality",
["FullScreenBar.QualityGood"] = "Good",
Expand All @@ -184,6 +185,8 @@ public sealed class LocalizationService : INotifyPropertyChanged
["SessionEdit.RdpDisableWallpaperHint"] = "Sends the RDP performance flag PERF_DISABLE_WALLPAPER. Skipping the wallpaper reduces first-screen paint work and bandwidth on slow links. Turn this off to keep the remote wallpaper.",
["SessionEdit.RdpGraphicsPipeline"] = "EGFX graphics pipeline",
["SessionEdit.RdpGraphicsPipelineHint"] = "Negotiates MS-RDPEGFX so the server sends complete START_FRAME/END_FRAME logical frames, like MSTSC: the desktop appears at once instead of being painted strip by strip. On by default. If the server rejects the pipeline the session still connects on the legacy path automatically.",
["SessionEdit.RdpH264"] = "H.264 / AVC444 acceleration",
["SessionEdit.RdpH264Hint"] = "Requests H.264 and AVC444 video codecs over EGFX for smoother video and scrolling on high-latency links. Requires EGFX graphics pipeline and server/decoder support.",
["SessionEdit.SshHost"] = "SSH Host",
["SessionEdit.SshPort"] = "SSH Port",
["SessionEdit.SshUsername"] = "SSH Username",
Expand Down Expand Up @@ -517,7 +520,8 @@ public sealed class LocalizationService : INotifyPropertyChanged
["FullScreenBar.Pin"] = "固定连接栏",
["FullScreenBar.Unpin"] = "取消固定(自动隐藏)",
["FullScreenBar.Minimize"] = "最小化",
["FullScreenBar.Restore"] = "退出全屏",
["FullScreenBar.Restore"] = "还原窗口",
["FullScreenBar.ToggleFullScreen"] = "切换全屏 (F11)",
["FullScreenBar.Close"] = "关闭当前会话",
["FullScreenBar.Quality"] = "网络质量",
["FullScreenBar.QualityGood"] = "良好",
Expand All @@ -530,6 +534,8 @@ public sealed class LocalizationService : INotifyPropertyChanged
["SessionEdit.RdpDisableWallpaperHint"] = "向服务端发送 RDP 性能标志 PERF_DISABLE_WALLPAPER,跳过壁纸绘制,可减少首屏数据量与带宽占用;关闭后保留远程壁纸。",
["SessionEdit.RdpGraphicsPipeline"] = "EGFX 图形管道",
["SessionEdit.RdpGraphicsPipelineHint"] = "协商 MS-RDPEGFX,让服务端以 START_FRAME/END_FRAME 发送完整逻辑帧(与 MSTSC 一致):桌面一次成型,不再从上往下逐块刷出。默认开启;若服务端拒绝该管道,连接会自动退回 legacy 路径,不影响连上。",
["SessionEdit.RdpH264"] = "启用 H.264 / AVC444 视频加速",
["SessionEdit.RdpH264Hint"] = "在 EGFX 图形管道上请求 H.264 与 AVC444 编码,以提升高延迟或视频/滚动场景流畅度。需同时开启 EGFX 图形管道且服务端与本地解码器支持。",
["SessionEdit.SshHost"] = "SSH 主机",
["SessionEdit.SshPort"] = "SSH 端口",
["SessionEdit.SshUsername"] = "SSH 用户",
Expand Down Expand Up @@ -2137,6 +2143,25 @@ private static void AddGeneratedTexts(Dictionary<string, string> english, Dictio
english["UiText.087"] = "Window size (W):";
english["UiText.088"] = "Resize screen (C):";
english["UiText.089"] = "Color quality (Q):";
english["SessionEdit.RdpSecurityMode"] = "Security mode:";
english["SessionEdit.RdpWindowModeSection"] = "Window Mode";
english["SessionEdit.RdpWindowModeLabel"] = "Open Mode:";
english["SessionEdit.RdpWindowMode.Default"] = "Default (Main window tab)";
english["SessionEdit.RdpWindowMode.MultiTab"] = "Multi-tab window";
english["SessionEdit.RdpWindowMode.Standalone"] = "Standalone window (Multi-monitor)";
english["SessionEdit.RdpOpenInStandaloneWindow"] = "Open in standalone RDP multi-tab window";
english["SessionEdit.RdpSyncLockKeys"] = "Sync CapsLock / NumLock / ScrollLock state";
english["SessionEdit.RdpSyncLockKeysHint"] = "Automatically synchronize local lock key states to the remote session on connect or focus.";
english["SessionEdit.RdpEnableClipboardLock"] = "Enable clipboard large file locking (LockClipboardData)";
english["SessionEdit.RdpEnableClipboardLockHint"] = "Lock clipboard file snapshots during large file transfers so copying other content does not abort transfers.";
english["Rdp.MultiMonitor"] = "Multi-Monitor";
english["Rdp.MultiMonitorTip"] = "Multi-monitor / Virtual screen settings";
english["Rdp.MoveToWorkspace"] = "Move to multi-tab RDP window (single monitor)";
english["Rdp.OpenInWorkspace"] = "Open in multi-tab RDP window";
english["Rdp.OpenInDetachedWindow"] = "Open in standalone window (multi-monitor)";
english["Rdp.CloseTab"] = "Close tab";
english["Rdp.CloseOtherTabs"] = "Close other tabs";
english["Rdp.KeepTaskbar"] = "Keep taskbar";
english["UiText.090"] = "Devices";
english["UiText.091"] = "Apply key combinations on the remote computer";
english["UiText.092"] = "Share this computer's drives with the remote computer";
Expand Down Expand Up @@ -2403,6 +2428,25 @@ private static void AddGeneratedTexts(Dictionary<string, string> english, Dictio
chinese["UiText.087"] = "窗口大小(W):";
chinese["UiText.088"] = "改变屏幕大小(C):";
chinese["UiText.089"] = "颜色质量(Q):";
chinese["SessionEdit.RdpSecurityMode"] = "安全模式:";
chinese["SessionEdit.RdpWindowModeSection"] = "窗口模式";
chinese["SessionEdit.RdpWindowModeLabel"] = "打开方式:";
chinese["SessionEdit.RdpWindowMode.Default"] = "默认(主窗口标签页)";
chinese["SessionEdit.RdpWindowMode.MultiTab"] = "多标签";
chinese["SessionEdit.RdpWindowMode.Standalone"] = "独立窗体(支持多屏)";
chinese["SessionEdit.RdpOpenInStandaloneWindow"] = "在独立的 RDP 多标签窗口中打开";
chinese["SessionEdit.RdpSyncLockKeys"] = "同步 CapsLock / NumLock / ScrollLock 锁定键状态";
chinese["SessionEdit.RdpSyncLockKeysHint"] = "连接或切入 RDP 窗口时自动将本地大小写与小键盘锁定状态同步到远端。";
chinese["SessionEdit.RdpEnableClipboardLock"] = "启用剪贴板大文件锁定 (LockClipboardData)";
chinese["SessionEdit.RdpEnableClipboardLockHint"] = "通过剪贴板传输大文件时锁定快照,防止中途复制其他内容导致传输中断。";
chinese["Rdp.MultiMonitor"] = "多显示器";
chinese["Rdp.MultiMonitorTip"] = "多显示器 / 虚拟屏幕设置";
chinese["Rdp.MoveToWorkspace"] = "移入多标签 RDP 窗口(自动收敛为单屏)";
chinese["Rdp.OpenInWorkspace"] = "在独立多标签窗口打开";
chinese["Rdp.OpenInDetachedWindow"] = "在独立窗体打开(支持多屏)";
chinese["Rdp.CloseTab"] = "关闭标签页";
chinese["Rdp.CloseOtherTabs"] = "关闭其他标签页";
chinese["Rdp.KeepTaskbar"] = "保留任务栏";
chinese["UiText.090"] = "设备";
chinese["UiText.091"] = "在远程计算机上应用密钥组合";
chinese["UiText.092"] = "与远程计算机分享该计算机的驱动器";
Expand Down
Loading