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] 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 26243bf47..d6c8f0c0e 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 368f04c0b..9e1a67cc3 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)