Bug 458886

Summary: QWindow::setScreen() no longer works with layer-shell-qt
Product: [Frameworks and Libraries] layer-shell-qt Reporter: Aleksei Bavshin <alebastr>
Component: generalAssignee: Aleix Pol <aleixpol>
Status: REPORTED ---    
Severity: normal CC: ngompa13
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Fedora RPMs   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Aleksei Bavshin 2022-09-08 17:47:24 UTC
SUMMARY
Before 9f8b8c97[1] it was possible to use layer-shell-qt with only `QT_WAYLAND_SHELL_INTEGRATION=layer-shell`. Existing code with QWindow->setScreen() was assigning the screens without any changes.

Now any application that uses multiple screens MUST use layer-shell-qt explicitly and implement an additional, ifdef'ed code path to set the screens for only that scenario. And by the way, layer-shell-qt lacks the way to check if wlr-layer-shell is actually supported by the compositor, which makes that code path even more complicated.

For the record, I perfectly realize the purpose of desiredScreen -- lack of the way to request a compositor default screen with setScreen.
I don't have a good solution for that, just a random idea to throw at you:
Can we set primaryScreen to QPlaceholderPlatformScreen from layer-shell-qt init code or otherwise keep it in sync with the compositor default?
Are there other, better ways to check that the window's screen was set explicitly by user?

[1]: https://invent.kde.org/plasma/layer-shell-qt/-/merge_requests/15

STEPS TO REPRODUCE
```
for (QScreen *screen : qGuiApp->primaryScreen()->virtualSiblings()) {
  QQuickView *view = new QQuickView();
  // ...
  view->setScreen(screen);
  view->setResizeMode(QQuickView::SizeRootObjectToView);
  view->setGeometry(screen->geometry());
  view->show();
}
```

(if this code looks familiar - yes, it's a simplified snippet from sddm GreeterApp)

OBSERVED RESULT
All the surfaces are created on the same screen, only one is visible.

EXPECTED RESULT
I expect to see one surface per screen.

SOFTWARE/OS VERSIONS
Qt Version: 5.15.5
Layer-shell-qt version: 5.25.4

ADDITIONAL INFORMATION