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

Remembering previous size and position wrong in mixed DPI situation #5898

Open
lePoMo opened this issue Sep 25, 2022 · 6 comments
Open

Remembering previous size and position wrong in mixed DPI situation #5898

lePoMo opened this issue Sep 25, 2022 · 6 comments
Labels
bug A bug (error) in the software client ui

Comments

@lePoMo
Copy link

lePoMo commented Sep 25, 2022

Description

I have two screens at different DPI scaling on Windows 10.

  • primary screen, to the left = 150% display scaling (4K display)
  • secondary screen, to the right = 100% display scaling (1280x1024 in portrait)

Mumble client resides on secondary screen. (not fullscreen).

When closing and reopening mumble, it will open at a much smaller size, and at a position slightly more to the top left.
Screenshots attached below.

Quickly comparing the window size, it is in fact smaller at a factor of 150%.
(682 pixels wide to 454 pixels wide, 682/454 = 1.502..)

Steps to reproduce

  1. move window to secondary screen which is at a different DPI than primary screen
  2. close window
  3. reopen window - size will be different (much smaller in my case), position will be slightly different

Mumble version

1.4.287

Mumble component

Client

OS

Windows

Reproducible?

Yes

Additional information

  • works as expected when closing and re-opening on primary screen: reopens at the same size and position (note: I did not measure pixels)

  • bug also happens when mumble window does not touch the border of the screen (tested at the center of the secondary screen) : So not related to it almost touching the primary screen, which with the position bug could have had it pick dpi from wrong screen.

  • this problem is not new. I can't say how old, because I only have a second screen since <1 year.

  • this bug may go back to at least 2017, seeing issue Bad Window default sizes on high-DPI system #3248 sounding similar (only open issue I found that sounds similar). I did a new issue because two much may have changed since, and that issue is not very detailed.

  • I am currently working around this by using PowerToys FancyZones with the option the restore the window at its previous zone. Note this is not ideal because it rarely triggers what is maybe an other bug: mumble window contents did once not resize to the bigger window, but this may even be a qt problem. (I only set this up now, so only 5 tries so far). If I encouter this more often, I will do a separate bug report.

Relevant log output

No response

Screenshots

Size as set by me:
2022-09-25 mumble 1 4 287 - window size - 1 - size set by me

Size after closing and reopening:
2022-09-25 mumble 1 4 287 - window size - 2 - size after closing + reopening once

Size after closing and reopening a second time:
2022-09-25 mumble 1 4 287 - window size - 3 - size after closing + reopening second time

Position and size as set by me:
2022-09-25 mumble 1 4 287 - window size and position on screens - 1 - size+pos as set by me

Position and size after closing and reopening:
2022-09-25 mumble 1 4 287 - window size and position on screens - 2 - size+pos after reopening

Position and size after closing and reopening a second time:
2022-09-25 mumble 1 4 287 - window size and position on screens - 3 - size+pos after reopening second time

@lePoMo lePoMo added bug A bug (error) in the software triage This issue is waiting to be triaged by one of the project members labels Sep 25, 2022
@Krzmbrzl
Copy link
Member

Does the issue also occur, when you

  • use both screens at 100% display scaling
  • use both screens at 150% display scaling

I think this is probably somehow related to the way we save and restore the window's geometry and position (by means of save/restoreGeometry. E.g.

if (Global::get().s.bMinimalView && !Global::get().s.qbaMinimalViewGeometry.isNull())
restoreGeometry(Global::get().s.qbaMinimalViewGeometry);
else if (!Global::get().s.bMinimalView && !Global::get().s.qbaMainWindowGeometry.isNull())
restoreGeometry(Global::get().s.qbaMainWindowGeometry);

@Krzmbrzl Krzmbrzl added client ui needs-more-input and removed triage This issue is waiting to be triaged by one of the project members labels Sep 26, 2022
@lePoMo
Copy link
Author

lePoMo commented Sep 27, 2022

I now did those two tests. Both worked perfectly, The window reopened exactly where it was closed, and at exactly the same dimensions (both to the pixel).

I did more tests:

NewTest1

  1. primary screen at 150%, secondary screen at 100%, Mumble client on secondary screen. Close window.
  2. switch primary screen to 100%
  3. reopen Mumble client

Effect: it opens at the same dimensions as when closed.

NewTest2

  1. primary screen at 100%, secondary screen at 100%, Mumble client on secondary screen. Close window.
  2. switch primary screen to 150%
  3. reopen Mumble client

Effect: it opens too small (like in my first post)

NewTest3 - the inverse of my initial bug report

  1. primary screen at 100%, secondary screen at 150%, Mumble client on secondary screen. Close window.
  2. no change to screens
  3. reopen Mumble client

Effect: it opens too big and position moves slightly down and to the right. (This seems coherent with my initial report, where it got smaller and slightly moved to the top left when primary at 150% and secondary at 100%)

My assumption

though not sure if sound

  • dimensions are correctly saved, but wrongly applied during loading.
  • during restoring the loaded dimensions, one or more display metrics during some math are wrongfully taken from the primary screen instead of from the screen the window goes on.
    Hence when both screens have same dpi, the bug is hidden
    Hence the bug does not happen if the window is closed and reopened on the primary screen (when primary 150, secondary 100)
    And hence when the secondary screen has smaller dpi, the window dimensions shrink, and vice versa the dimensions increase when the secondary has higher dpi than the primary screen.

reason for saying "one or more display metrics": while never having worked with qt, I know window decoration metrics are their own source of problems when positioning windows programmatically. Since they're also different on both screens, they may account for the window slightly moving around. (Imo best tracking down the dimensions bug first, maybe the position problem goes away with it).

--
The following two also tested, but now noticing that there is no right answer for these, because I am switchting the secondary screen dpi. Maybe they can still help nonetheless:

NewTest4

  1. primary screen at 150%, secondary screen at 100%, Mumble client on secondary screen. Close window.
  2. switch secondary screen to 150%
  3. reopen Mumble client

Effect: it opens at the same dimensions as when closed (relative to the screen size), meaning same outline, less visible content (because of bigger font/icons).

NewTest5

  1. primary screen at 150%, secondary screen at 150%, Mumble client on secondary screen. Close window.
  2. switch secondary screen to 100%
  3. reopen Mumble client

Effect: it opens at smaller dimensions than when closed (relative to the screen size), meaning exact same visible content

@Krzmbrzl
Copy link
Member

Yeah, I think your display metrics theory sounds very likely. The only question remaining is whether this is a bug in our code base or a bug somewhere in Qt.

Do you have other Qt programs installed on your system? If so, do they suffer from the same issues?

@lePoMo
Copy link
Author

lePoMo commented Sep 27, 2022

Do you have other Qt programs installed on your system? If so, do they suffer from the same issues?

I have DupeGuru installed on my system (a duplicate file finder), it uses Qt and does not suffer from the same issues.
https://github.com/arsenetar/dupeguru/

@Krzmbrzl
Copy link
Member

Okay, then the issue is probably somewhere in our code.

@Aqualie
Copy link

Aqualie commented Feb 25, 2023

I have this issue as well everytime I open Mumble the window size and position is wrong. All my other applications don't have this problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A bug (error) in the software client ui
Projects
None yet
Development

No branches or pull requests

3 participants