[Windows] After switching to fullscreen and back to windowed mode, both the client window's width and height increase by 1 pixel #3194

Closed
opened 2026-02-20 19:17:36 -05:00 by deekerman · 8 comments
Owner

Originally created by @Prcuvu on GitHub (Oct 16, 2024).

Bug Description

I am using Windows client.

Every time I enter and exit fullscreen mode, both the client window's width and height increase by 1 pixel. The client window silently becomes larger and larger over time, ultimately its bottom edge goes under my local side desktop's taskbar, causing the remote side's taskbar becoming covered, and making it impossible to drag the bottom edge (because it is covered by my local side taskbar) to resize the client window.

This can be extremely annoying.

How to Reproduce

  1. Open a connection to a remote client to bring up client window.
  2. Print Screen to record the original client window size if necessary.
  3. Click "Fullscreen" button in the toolbar to switch to fullscreen mode.
  4. Click "Exit Fullscreen" button in the toolbar to switch back to windowed mode.
  5. Print Screen to record the new client window size if necessary.
  6. Compare the two window sizes. Both the client window's width and height should have increased by 1 pixel.

Expected Behavior

The client window should remain the same size by toggling between fullscreen mode and windowed mode.

Operating system(s) on local side and remote side

Windows 10 -> Windows 10

RustDesk Version(s) on local side and remote side

1.3.1 -> 1.2.3-2

Screenshots

The description should be self-explanatory enough.

Additional Context

Both my local side and remote side use 1920 × 1080 resolution.

The problem can be observed on every Windows client from version 1.2.2 to 1.3.1.

Originally created by @Prcuvu on GitHub (Oct 16, 2024). ### Bug Description I am using Windows client. Every time I enter and exit fullscreen mode, both the client window's width and height increase by 1 pixel. The client window silently becomes larger and larger over time, ultimately its bottom edge goes under my local side desktop's taskbar, causing the remote side's taskbar becoming covered, and making it impossible to drag the bottom edge (because it is covered by my local side taskbar) to resize the client window. This can be extremely annoying. ### How to Reproduce 1. Open a connection to a remote client to bring up client window. 2. <kbd>Print Screen</kbd> to record the original client window size if necessary. 3. Click "Fullscreen" button in the toolbar to switch to fullscreen mode. 4. Click "Exit Fullscreen" button in the toolbar to switch back to windowed mode. 5. <kbd>Print Screen</kbd> to record the new client window size if necessary. 6. Compare the two window sizes. Both the client window's width and height should have increased by 1 pixel. ### Expected Behavior The client window should remain the same size by toggling between fullscreen mode and windowed mode. ### Operating system(s) on local side and remote side Windows 10 -> Windows 10 ### RustDesk Version(s) on local side and remote side 1.3.1 -> 1.2.3-2 ### Screenshots The description should be self-explanatory enough. ### Additional Context Both my local side and remote side use 1920 × 1080 resolution. The problem can be observed on every Windows client from version 1.2.2 to 1.3.1.
deekerman 2026-02-20 19:17:36 -05:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@rustdesk commented on GitHub (Oct 16, 2024):

@fufesou high priority. might be related to number round.

@rustdesk commented on GitHub (Oct 16, 2024): @fufesou high priority. might be related to number round.
Author
Owner
@rustdesk commented on GitHub (Oct 16, 2024): https://github.com/leanflutter/window_manager/issues/131#issuecomment-1111587982
Author
Owner

@Prcuvu commented on GitHub (Oct 17, 2024):

The relevant change is from #2200:

github.com/rustdesk/rustdesk@5e920f0fd0/flutter/lib/models/state_model.dart (L104-L112)

Why resize the window? If it is necessary to force a window redraw, I believe Windows API call RedrawWindow(hWnd, NULL, NULL, RDW_ERASE | RDW_INVALIDATE | RDW_UPDATENOW) should do the job.

@Prcuvu commented on GitHub (Oct 17, 2024): The relevant change is from #2200: https://github.com/rustdesk/rustdesk/blob/5e920f0fd048e7e49046a17f833657a26d4c001a/flutter/lib/models/state_model.dart#L104-L112 Why resize the window? If it is necessary to force a window redraw, I believe Windows API call `RedrawWindow(hWnd, NULL, NULL, RDW_ERASE | RDW_INVALIDATE | RDW_UPDATENOW)` should do the job.
Author
Owner

@fufesou commented on GitHub (Oct 17, 2024):

If it is necessary to force a window redraw, I believe Windows API call RedrawWindow(hWnd, NULL, NULL, RDW_ERASE | RDW_INVALIDATE | RDW_UPDATENOW) should do the job.

The problem is I can't reproduce that issue now. I'm not sure if this call or the resize are required.

@fufesou commented on GitHub (Oct 17, 2024): > If it is necessary to force a window redraw, I believe Windows API call `RedrawWindow(hWnd, NULL, NULL, RDW_ERASE | RDW_INVALIDATE | RDW_UPDATENOW)` should do the job. The problem is I can't reproduce that issue now. I'm not sure if this call or the resize are required.
Author
Owner

@Prcuvu commented on GitHub (Oct 17, 2024):

The problem is I can't reproduce that issue now.

It seems to be Windows-specific. Can't you reproduce it using Windows client?

@Prcuvu commented on GitHub (Oct 17, 2024): > The problem is I can't reproduce that issue now. It seems to be Windows-specific. Can't you reproduce it using Windows client?
Author
Owner

@fufesou commented on GitHub (Oct 17, 2024):

Can't you reproduce it using Windows client?

Yes. I've tried Win10 and Win11.

@fufesou commented on GitHub (Oct 17, 2024): > Can't you reproduce it using Windows client? Yes. I've tried Win10 and Win11.
Author
Owner

@Prcuvu commented on GitHub (Oct 17, 2024):

I am not sure if it works, apparently a quick fix would be something like:

        // https://github.com/leanflutter/window_manager/issues/131#issuecomment-1111587982
        if (isWindows && _fullscreen.isFalse) {
          Future.delayed(Duration.zero, () async {
            final frame = await wc.getFrame();
            final newRect = Rect.fromLTWH(
                frame.left, frame.top, frame.width + 1, frame.height + 1);
            await wc.setFrame(newRect);
            // Resize twice as in leanflutter/window_manager
            await wc.setFrame(frame);
          });
        }
@Prcuvu commented on GitHub (Oct 17, 2024): I am not sure if it works, apparently a quick fix would be something like: ```dart // https://github.com/leanflutter/window_manager/issues/131#issuecomment-1111587982 if (isWindows && _fullscreen.isFalse) { Future.delayed(Duration.zero, () async { final frame = await wc.getFrame(); final newRect = Rect.fromLTWH( frame.left, frame.top, frame.width + 1, frame.height + 1); await wc.setFrame(newRect); // Resize twice as in leanflutter/window_manager await wc.setFrame(frame); }); } ```
Author
Owner

@rustdesk commented on GitHub (Oct 17, 2024):

We have considered this. This will make the window refresh twice, and you will see a flash. We want to remove the +1, but we are unsure if there will be any adverse effects, although we cannot see any for now, we are not 100% certain.

@rustdesk commented on GitHub (Oct 17, 2024): We have considered this. This will make the window refresh twice, and you will see a flash. We want to remove the +1, but we are unsure if there will be any adverse effects, although we cannot see any for now, we are not 100% certain.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/rustdesk#3194
No description provided.