mirror of
https://github.com/xcp-ng/xenadmin.git
synced 2025-01-20 15:29:26 +01:00
CA-249856: Fix console position and focus rectangle drawing on resize
Also ensuring that if the UpdateSessionDisplaySettings function (which we use for resize) is not supported, then we display the console centered in the parent window and with scrollbars if needed Signed-off-by: Mihaela Stoica <mihaela.stoica@citrix.com>
This commit is contained in:
parent
3ea6d56983
commit
42df02734a
@ -97,9 +97,9 @@ namespace XenAdmin.ConsoleView
|
||||
private void RDPConfigure(Size currentConsoleSize)
|
||||
{
|
||||
rdpControl.BeginInit();
|
||||
rdpLocationOffset = new Point(2, 2); //small offset to accomodate focus rectangle
|
||||
rdpLocationOffset = new Point(3, 3); //small offset to accomodate focus rectangle
|
||||
rdpControl.Dock = DockStyle.None;
|
||||
rdpControl.Anchor = (AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Bottom | AnchorStyles.Right);
|
||||
rdpControl.Anchor = AnchorStyles.None;
|
||||
rdpControl.Size = currentConsoleSize;
|
||||
RDPAddOnDisconnected();
|
||||
rdpControl.Enter += RdpEnter;
|
||||
@ -179,24 +179,27 @@ namespace XenAdmin.ConsoleView
|
||||
}
|
||||
}
|
||||
|
||||
public void UpdateDisplay( int width, int height)
|
||||
public void UpdateDisplay(int width, int height, Point locationOffset)
|
||||
{
|
||||
if (rdpControl == null)
|
||||
return;
|
||||
|
||||
Log.DebugFormat("Updating display settings using width '{0}' and height '{1}'", width, height);
|
||||
if (Connected && rdpClient9 != null && allowDisplayUpdate)
|
||||
{
|
||||
rdpClient9.Size = new Size(width, height);
|
||||
try
|
||||
{
|
||||
Log.DebugFormat("Updating display settings using width '{0}' and height '{1}'", width, height);
|
||||
rdpClient9.UpdateSessionDisplaySettings((uint)width, (uint)height, (uint)width, (uint)height, 1, 1, 1);
|
||||
rdpClient9.Size = new Size(width, height);
|
||||
rdpLocationOffset = locationOffset;
|
||||
parent.AutoScroll = false;
|
||||
}
|
||||
catch
|
||||
{
|
||||
allowDisplayUpdate = false;
|
||||
parent.AutoScroll = true;
|
||||
parent.AutoScrollMinSize = rdpClient9.Size;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -230,8 +233,11 @@ namespace XenAdmin.ConsoleView
|
||||
{
|
||||
Program.AssertOnEventThread();
|
||||
|
||||
if(parent != null)
|
||||
parent.Refresh();
|
||||
if (rdpControl == null || parent == null)
|
||||
return;
|
||||
|
||||
rdpControl.Size = DesktopSize;
|
||||
parent.Refresh();
|
||||
}
|
||||
|
||||
public void Connect(string rdpIP)
|
||||
|
@ -1050,7 +1050,7 @@ namespace XenAdmin.ConsoleView
|
||||
fullscreenForm.Hide();
|
||||
fullscreenForm.Dispose();
|
||||
fullscreenForm = null;
|
||||
UpdateRDPResolution(true);
|
||||
UpdateRDPResolution(false);
|
||||
}
|
||||
|
||||
//Everytime we toggle full screen I'm going to force an unpause to make sure we don't acidentally undock / dock a pause VNC
|
||||
|
@ -522,7 +522,7 @@ namespace XenAdmin.ConsoleView
|
||||
bool wasFocused = false;
|
||||
this.Controls.Clear();
|
||||
//console size with some offset to accomodate focus rectangle
|
||||
Size currentConsoleSize = new Size(this.Size.Width - CONSOLE_SIZE_OFFSET, this.Size.Height - CONSOLE_SIZE_OFFSET); ;
|
||||
Size currentConsoleSize = new Size(this.Size.Width - CONSOLE_SIZE_OFFSET, this.Size.Height - CONSOLE_SIZE_OFFSET);
|
||||
|
||||
// Kill the old client.
|
||||
if (RemoteConsole != null)
|
||||
@ -556,6 +556,8 @@ namespace XenAdmin.ConsoleView
|
||||
{
|
||||
if (this.ParentForm is FullScreenForm)
|
||||
currentConsoleSize = ((FullScreenForm)ParentForm).GetContentSize();
|
||||
this.AutoScroll = true;
|
||||
this.AutoScrollMinSize = oldSize;
|
||||
rdpClient = new RdpClient(this, currentConsoleSize, ResizeHandler);
|
||||
|
||||
rdpClient.OnDisconnected += new EventHandler(parentVNCTabView.RdpDisconnectedHandler);
|
||||
@ -1387,23 +1389,16 @@ namespace XenAdmin.ConsoleView
|
||||
private Size oldSize;
|
||||
public void UpdateRDPResolution(bool fullscreen = false)
|
||||
{
|
||||
if (rdpClient == null)
|
||||
if (rdpClient == null || oldSize.Equals(this.Size))
|
||||
return;
|
||||
|
||||
//no offsets in fullscreen mode because there is no need to accomodate focus border
|
||||
if (fullscreen)
|
||||
{
|
||||
rdpClient.rdpLocationOffset = new Point(0, 0);
|
||||
rdpClient.UpdateDisplay(this.Size.Width, this.Size.Height);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (oldSize.Equals(this.Size))
|
||||
return;
|
||||
rdpClient.rdpLocationOffset = new Point(2, 2);
|
||||
rdpClient.UpdateDisplay(this.Size.Width - CONSOLE_SIZE_OFFSET, this.Size.Height - CONSOLE_SIZE_OFFSET);
|
||||
oldSize = new Size(this.Size.Width, this.Size.Height);
|
||||
}
|
||||
rdpClient.UpdateDisplay(this.Size.Width, this.Size.Height, new Point(0,0));
|
||||
else
|
||||
rdpClient.UpdateDisplay(this.Size.Width - CONSOLE_SIZE_OFFSET, this.Size.Height - CONSOLE_SIZE_OFFSET, new Point(3,3));
|
||||
oldSize = new Size(this.Size.Width, this.Size.Height);
|
||||
Refresh();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user