Add support for XDG Foreign
This adds a `KWindowSystem::setMainWindow` overload taking a `QString` for its parent window which consumes an XDG Foreign handle. This also adds an `exportWindow` and `unexportWindow` method to `KWaylandExtras`. `exportWindow(window)` asks the compositor for a handle and emits the `windowExported` signal once it received one. This token can then be sent to a different application and a window parented to it using `setMainWindow(window, handle)`. The wayland objects are parented to the respective `QWaylandWindow` so that they are cleaned up when the window is destroyed. Calling `exportWindow` on the same window will re-use the existing exported object. Even though you can technically export the same window multiple times and get a separate token each time, this isn't covered by this API and realistically not its primary use case. Furthermore, calling `unexportWindow(window)` will delete the exported object, should one exist on the given window. Calling `setMainWindow` with an invalid handle will destroy the imported object, severing the parent-child relationship.
Please register or sign in to comment