From 045aa631e448ad214780acb7cff3c93a96cc48cc Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 18 Oct 2025 23:12:37 +0000 Subject: [PATCH 1/3] Initial plan From 55fec45b58b6c9afb49fa0ce07e36071f38cdf3f Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 18 Oct 2025 23:18:15 +0000 Subject: [PATCH 2/3] Add padding to InterfaceControl to make connection frame color visible Co-authored-by: Kvarkas <3611964+Kvarkas@users.noreply.github.com> --- mRemoteNG/Connection/InterfaceControl.cs | 19 +++++++++++++++++++ mRemoteNG/Connection/Protocol/ProtocolBase.cs | 5 ++--- mRemoteNG/Connection/Protocol/PuttyBase.cs | 15 ++++++++++----- 3 files changed, 31 insertions(+), 8 deletions(-) diff --git a/mRemoteNG/Connection/InterfaceControl.cs b/mRemoteNG/Connection/InterfaceControl.cs index 4ff3780e..934c6e7e 100644 --- a/mRemoteNG/Connection/InterfaceControl.cs +++ b/mRemoteNG/Connection/InterfaceControl.cs @@ -35,6 +35,9 @@ namespace mRemoteNG.Connection // Enable custom painting for border this.Paint += InterfaceControl_Paint; + + // Set padding to prevent content from covering the frame border + UpdatePaddingForFrameColor(); } catch (Exception ex) { @@ -66,6 +69,22 @@ namespace mRemoteNG.Connection } } + private void UpdatePaddingForFrameColor() + { + // Add padding to prevent content from covering the frame border + if (Info?.ConnectionFrameColor != null && Info.ConnectionFrameColor != ConnectionFrameColor.None) + { + int borderWidth = 4; // Must match the border width in InterfaceControl_Paint + // Add 2px margin so the border is fully visible and not covered by child controls + int padding = borderWidth / 2 + 2; + this.Padding = new Padding(padding); + } + else + { + this.Padding = new Padding(0); + } + } + private Color GetFrameColor(ConnectionFrameColor frameColor) { return frameColor switch diff --git a/mRemoteNG/Connection/Protocol/ProtocolBase.cs b/mRemoteNG/Connection/Protocol/ProtocolBase.cs index 49d0fafe..6664274a 100644 --- a/mRemoteNG/Connection/Protocol/ProtocolBase.cs +++ b/mRemoteNG/Connection/Protocol/ProtocolBase.cs @@ -116,9 +116,8 @@ namespace mRemoteNG.Connection.Protocol Control.Name = Name; - Control.Location = _interfaceControl.Location; - Control.Size = InterfaceControl.Size; - Control.Anchor = _interfaceControl.Anchor; + // Use Dock.Fill to respect padding (e.g., for connection frame color) + Control.Dock = DockStyle.Fill; _interfaceControl.Controls.Add(Control); return true; diff --git a/mRemoteNG/Connection/Protocol/PuttyBase.cs b/mRemoteNG/Connection/Protocol/PuttyBase.cs index 5bdc7163..13d33e66 100644 --- a/mRemoteNG/Connection/Protocol/PuttyBase.cs +++ b/mRemoteNG/Connection/Protocol/PuttyBase.cs @@ -338,17 +338,22 @@ namespace mRemoteNG.Connection.Protocol if (_isPuttyNg) { // PuTTYNG 0.70.0.1 and later doesn't have any window borders - NativeMethods.MoveWindow(PuttyHandle, 0, 0, InterfaceControl.Width, InterfaceControl.Height, true); + // Use ClientRectangle to account for padding (for connection frame color) + Rectangle clientRect = InterfaceControl.ClientRectangle; + NativeMethods.MoveWindow(PuttyHandle, clientRect.X, clientRect.Y, clientRect.Width, clientRect.Height, true); } else { int scaledFrameBorderHeight = _display.ScaleHeight(SystemInformation.FrameBorderSize.Height); int scaledFrameBorderWidth = _display.ScaleWidth(SystemInformation.FrameBorderSize.Width); - NativeMethods.MoveWindow(PuttyHandle, -scaledFrameBorderWidth, - -(SystemInformation.CaptionHeight + scaledFrameBorderHeight), - InterfaceControl.Width + scaledFrameBorderWidth * 2, - InterfaceControl.Height + SystemInformation.CaptionHeight + + // Use ClientRectangle to account for padding (for connection frame color) + Rectangle clientRect = InterfaceControl.ClientRectangle; + NativeMethods.MoveWindow(PuttyHandle, + clientRect.X - scaledFrameBorderWidth, + clientRect.Y - (SystemInformation.CaptionHeight + scaledFrameBorderHeight), + clientRect.Width + scaledFrameBorderWidth * 2, + clientRect.Height + SystemInformation.CaptionHeight + scaledFrameBorderHeight * 2, true); } From 12920bc6c6d1f65849e25567ba2c323e362f4184 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 18 Oct 2025 23:20:09 +0000 Subject: [PATCH 3/3] Update IntegratedProgram and PowerShell protocols to respect connection frame padding Co-authored-by: Kvarkas <3611964+Kvarkas@users.noreply.github.com> --- mRemoteNG/Connection/Protocol/IntegratedProgram.cs | 11 +++++++---- .../PowerShell/Connection.Protocol.PowerShell.cs | 11 +++++++---- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/mRemoteNG/Connection/Protocol/IntegratedProgram.cs b/mRemoteNG/Connection/Protocol/IntegratedProgram.cs index 26243bf4..d6c8f0c0 100644 --- a/mRemoteNG/Connection/Protocol/IntegratedProgram.cs +++ b/mRemoteNG/Connection/Protocol/IntegratedProgram.cs @@ -139,10 +139,13 @@ namespace mRemoteNG.Connection.Protocol try { if (InterfaceControl.Size == Size.Empty) return; - NativeMethods.MoveWindow(_handle, -SystemInformation.FrameBorderSize.Width, - -(SystemInformation.CaptionHeight + SystemInformation.FrameBorderSize.Height), - InterfaceControl.Width + SystemInformation.FrameBorderSize.Width * 2, - InterfaceControl.Height + SystemInformation.CaptionHeight + + // Use ClientRectangle to account for padding (for connection frame color) + Rectangle clientRect = InterfaceControl.ClientRectangle; + NativeMethods.MoveWindow(_handle, + clientRect.X - SystemInformation.FrameBorderSize.Width, + clientRect.Y - (SystemInformation.CaptionHeight + SystemInformation.FrameBorderSize.Height), + clientRect.Width + SystemInformation.FrameBorderSize.Width * 2, + clientRect.Height + SystemInformation.CaptionHeight + SystemInformation.FrameBorderSize.Height * 2, true); } catch (Exception ex) diff --git a/mRemoteNG/Connection/Protocol/PowerShell/Connection.Protocol.PowerShell.cs b/mRemoteNG/Connection/Protocol/PowerShell/Connection.Protocol.PowerShell.cs index 368f04c0..9e1a67cc 100644 --- a/mRemoteNG/Connection/Protocol/PowerShell/Connection.Protocol.PowerShell.cs +++ b/mRemoteNG/Connection/Protocol/PowerShell/Connection.Protocol.PowerShell.cs @@ -229,10 +229,13 @@ namespace mRemoteNG.Connection.Protocol.PowerShell try { if (InterfaceControl.Size == Size.Empty) return; - NativeMethods.MoveWindow(_handle, -SystemInformation.FrameBorderSize.Width, - -(SystemInformation.CaptionHeight + SystemInformation.FrameBorderSize.Height), - InterfaceControl.Width + SystemInformation.FrameBorderSize.Width * 2, - InterfaceControl.Height + SystemInformation.CaptionHeight + + // Use ClientRectangle to account for padding (for connection frame color) + Rectangle clientRect = InterfaceControl.ClientRectangle; + NativeMethods.MoveWindow(_handle, + clientRect.X - SystemInformation.FrameBorderSize.Width, + clientRect.Y - (SystemInformation.CaptionHeight + SystemInformation.FrameBorderSize.Height), + clientRect.Width + SystemInformation.FrameBorderSize.Width * 2, + clientRect.Height + SystemInformation.CaptionHeight + SystemInformation.FrameBorderSize.Height * 2, true); } catch (Exception ex)