Fix kwindowstatesavertest on Wayland

Elvis Angelaccio requested to merge work/kwindowstatesavertest-wayland into master

It seems that on Wayland a QWindow might return a different screen() after a resize. (disclaimer: I haven't checked on other wayland compositors, so this behavior might be a bug in kwin_wayland).

On my Wayland setup with two DisplayPort monitors, the QWindow of the QFontDialog widget in kwindowstatesavertest reports "DP-1" as its screen() after the first show() in testTopLevelDialog(), and reports "DP-2" after the following resize().

This breaks the keys used by KWindowConfig::restoreWindowSize(). As workaround for this behavior, if we fail to find the key for window->screen(), we try all the screens reported by Qt.

I also had to increase a bit the qWait()s in the test itself, otherwise the test would randomly fail even after this fix. Now instead it passes every time reliably.

Merge request reports