https://bugs.kde.org/show_bug.cgi?id=523825

            Bug ID: 523825
           Summary: Portal dialogs are not parented/centered on XWayland
                    (x11:) parent windows under Wayland (and repeated
                    modal dialogs can crash the compositor)
    Classification: Plasma
           Product: kwin
      Version First 6.7.3
       Reported In:
          Platform: Other
                OS: Linux
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: xwayland
          Assignee: [email protected]
          Reporter: [email protected]
  Target Milestone: ---

DESCRIPTION

On a Plasma Wayland session, dialogs shown by xdg-desktop-portal-kde on behalf
of an XWayland application are not parented to the calling window. The
application passes its parent as an "x11:<XID>" parent_window token, but that
path is a no-op under Wayland, so the dialog appears unparented.
The result is, it is not centered on the caller, cascades to arbitrary
positions, and can event open on the wrong monitor.

STEPS TO REPRODUCE
1. Log into a Plasma Wayland session.
2. Run any XWayland application that opens files through the portal - e.g. a
Java/Swing application.
3. Trigger a file Open/Save (or any portal dialog).

OBSERVED RESULT
The opened window is not centered on the caller. It cascades instead to
arbitrary positions, and can event open on the wrong monitor.

EXPECTED RESULT
The dialog is transient for and centered on the calling window, as it already
is for native Wayland callers (which pass a "wayland:" token).

SOFTWARE/OS VERSIONS
Operating System: Manjaro Linux
KDE Plasma Version: 6.7.3
KDE Frameworks Version: 6.28.0
Qt Version: 6.11.1

ADDITIONAL INFORMATION

An XWayland client speaks X11 to Xwayland and has no Wayland connection of its
own, so it cannot export a surface via xdg-foreign.
It can only reference its parent by X11 window id.
KWindowSystem::setMainWindow(QWindow*, WId) is a no-op on Wayland, so the
portal has no way to establish the transient relation.

Additional (crash) with repeated modal dialogs:
Once parenting is established, opening several modal portal dialogs and closing
the calling windows in between can abort the compositor with:
    ASSERT: "!check_active_modal" in x11window.cpp
X11Window::addTransient() sets the static check_active_modal flag for a modal
transient of the active X11 window; that flag is only ever reset from X11 code
paths, so a non-X11 (Wayland) modal transient leaves it stuck true until the
next ~X11Window() trips the assert.

Merge requests implementing the fix (kwin + xdg-desktop-portal-kde) to follow.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to