Skip to content

Fix multimonitor window size restoration

The size saving and restoring code saves width and height values under a config key that changes based on the active screens, the name of the current screen, and the resolution of the current screen. This suffers from a few issues:

  • Due to https://bugreports.qt.io/browse/QTBUG-50788, what counts as the current screen is volatile at runtime, and hence data gets saved to and read from different config file keys.
  • Including the screen resolution of the current screen only makes sense for single-screen setups anyway as it's just random data causing entropy for multi-screen setups.

Both of these issues contribute to the problem of window size being restored incorrectly for multi-screen setups.

This commit fixes the issue by no longer including current-screen-based data in the config file keys for multi-screen setups; just including the current set of screens is good enough and it's non-volatile within the scope of what we care about.

BUG: 460260 FIXED-IN: 5.104

Test plan

  1. Have one screen
  2. Open KWrite
  3. Resize its window
  4. Close KWrite
  5. Open KWrite -> last-used window size is restored
  6. Attach a second screen
  7. Open KWrite
  8. Resize its window
  9. Close KWrite
  10. Open KWrite -> last-used window size for the multi-monitor setup is restored

Merge request reports

Loading