Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ignores resizes when a desktop has screen_size set #41198

Merged
merged 2 commits into from
May 6, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
8 changes: 7 additions & 1 deletion lib/srv/desktop/rdp/rdpclient/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ func (c *Client) readClientSize() error {
continue
}

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

switch m := msg.(type) {
case tdp.ClientScreenSpec:
// If the client has specified a fixed screen size, we don't
// need to send a screen resize event.
if c.cfg.hasOverrideSize() {
continue
}

c.cfg.Logger.DebugContext(context.Background(), "Client changed screen size", "width", m.Width, "height", m.Height)
if errCode := C.client_write_screen_resize(
C.ulong(c.handle),
Expand Down
7 changes: 7 additions & 0 deletions lib/srv/desktop/rdp/rdpclient/client_common.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,3 +94,10 @@
c.Logger = c.Logger.With("rdp-addr", c.Addr)
return nil
}

// hasOverrideSize returns true if the width and height have been set.
// This will be true when a user has specified a fixed `screen_size` for
// a given desktop.
func (c *Config) hasOverrideSize() bool {

Check failure on line 101 in lib/srv/desktop/rdp/rdpclient/client_common.go

View workflow job for this annotation

GitHub Actions / Lint (Go)

func `(*Config).hasOverrideSize` is unused (unused)
ibeckermayer marked this conversation as resolved.
Show resolved Hide resolved
ibeckermayer marked this conversation as resolved.
Show resolved Hide resolved
return c.Width != 0 && c.Height != 0
}
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,6 @@ export default function useTdpClientCanvas(props: Props) {
) => {
// The first image fragment we see signals a successful TDP connection.
if (!initialTdpConnectionSucceeded.current) {
syncCanvas(ctx.canvas, getDisplaySize());
ibeckermayer marked this conversation as resolved.
Show resolved Hide resolved
setTdpConnection({ status: 'success' });
initialTdpConnectionSucceeded.current = true;
}
Expand Down
Loading