Skip to content

Commit e5a5da4

Browse files
author
Isaiah Becker-Mayer
committed
Ignores resizes when a desktop has screen_size set
`screen_size` is meant to be a static override of the screen size, however this property was mistakenly lost when #39819 was merged. This commit restores the behavior of `screen_size` by ignoring resizes when it is set.
1 parent df39993 commit e5a5da4

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

lib/srv/desktop/rdp/rdpclient/client.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ func (c *Client) readClientSize() error {
239239
continue
240240
}
241241

242-
if c.cfg.Width != 0 && c.cfg.Height != 0 {
242+
if c.cfg.hasOverrideSize() {
243243
// Some desktops have a screen size in their resource definition.
244244
// If non-zero then we always request this screen size.
245245
c.cfg.Logger.DebugContext(context.Background(), "Forcing a fixed screen size", "width", c.cfg.Width, "height", c.cfg.Height)
@@ -394,6 +394,12 @@ func (c *Client) startInputStreaming(stopCh chan struct{}) error {
394394

395395
switch m := msg.(type) {
396396
case tdp.ClientScreenSpec:
397+
// If the client has specified a fixed screen size, we don't
398+
// need to send a screen resize event.
399+
if c.cfg.hasOverrideSize() {
400+
continue
401+
}
402+
397403
c.cfg.Logger.DebugContext(context.Background(), "Client changed screen size", "width", m.Width, "height", m.Height)
398404
if errCode := C.client_write_screen_resize(
399405
C.ulong(c.handle),

lib/srv/desktop/rdp/rdpclient/client_common.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,3 +94,10 @@ func (c *Config) checkAndSetDefaults() error {
9494
c.Logger = c.Logger.With("rdp-addr", c.Addr)
9595
return nil
9696
}
97+
98+
// hasOverrideSize returns true if the width and height have been set.
99+
// This will be true when a user has specified a fixed `screen_size` for
100+
// a given desktop.
101+
func (c *Config) hasOverrideSize() bool {
102+
return c.Width != 0 && c.Height != 0
103+
}

web/packages/teleport/src/DesktopSession/useTdpClientCanvas.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,6 @@ export default function useTdpClientCanvas(props: Props) {
126126
) => {
127127
// The first image fragment we see signals a successful TDP connection.
128128
if (!initialTdpConnectionSucceeded.current) {
129-
syncCanvas(ctx.canvas, getDisplaySize());
130129
setTdpConnection({ status: 'success' });
131130
initialTdpConnectionSucceeded.current = true;
132131
}

0 commit comments

Comments
 (0)