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

            Bug ID: 439137
           Summary: GTK4 child windows/dialogs positioned incorrectly on
                    KWin X11
           Product: kwin
           Version: 5.22.2
          Platform: Archlinux Packages
                OS: Linux
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: general
          Assignee: kwin-bugs-n...@kde.org
          Reporter: nyanpas...@tuta.io
  Target Milestone: ---

Not sure if this is a GTK4 bug or a WM bug. For more information, see my GTK4
bug report at https://gitlab.gnome.org/GNOME/gtk/-/issues/4070.

SUMMARY
When GTK4 applications spawn child windows or dialogs, they randomly appear at
the top-left corner of the screen instead of on top of their parent.

STEPS TO REPRODUCE
0. Install KDE Plasma on X11, and GTK4.
1. Launch KDE Plasma X11.
2. Run gtk4-demo. Scroll down to "Dialogs" and press "Run" in the title bar.
3. Push "Message Dialog" or "Interactive Dialog".

OBSERVED RESULT
On KDE Plasma X11, with gtk4-demo, the "Dialogs" window has a 45%-ish chance of
appearing at the top-left corner of the screen, a 45%-ish chance of appearing
where there's empty room on the desktop, and a 10%-ish chance of appearing on
top of the parent window. The "Message Dialog" (with title bar) and
"Interactive Dialog" it creates have a 50%-ish chance of appearing at the top
left corner of the screen, instead of on the window. If you `killall kwin_x11`
before opening the windows/dialogs, they will always appear in the top-left of
the screen.

If you follow the same steps with gtk3-demo, the "Dialogs and Message Boxes"
window always appears where there is room on-screen (otherwise on the top-left
corner), and the Message/Interactive Dialogs always appear on top of their
parent windows. With kwin_x11 killed, all windows and dialogs appear in the
top-left corner of the screen.

EXPECTED RESULT
I expect GTK4 windows to not be positioned nondeterministically on KWin (which
could be a KWin bug, or something more complex), and not be placed in the
top-left corner of the screen. Ideally GTK4 windows would behave like GTK3
windows.

Does GTK4 think it's the responsibility of the GUI toolkit or WM to position
windows? I'm guessing both GTK3 and GTK4 do not communicate window positions to
X, but instead supplies instructions to the WM, and GTK4 does so differently,
and they're either wrong or misinterpreted by non-GNOME WMs. (I've heard on the
gtk-rs Matrix that GTK4 doesn't compute window positions itself, and I observed
that gtk3-demos's "Dialogs and Message Boxes" window is placed on the parent in
XFCE, but in empty space on KDE.) And there are even bigger behavioral
differences on GTK4.

----

I didn't take the time to test gtk3/4-demo's behavior on GNOME or any DE's
Wayland, but I did test gtk3/4-widget-factory's behavior. (See
https://gitlab.gnome.org/GNOME/gtk/-/issues/4070#additional-information.)
Window positioning is much more consistent on Wayland. I suspect that's because
the WM, not the toolkit, manages window positioning, so GTK4 has no room to
screw positions up. But I don't know why GTK on X11 has inconsistent windowing
behavior, since I think it delegates positioning to the WM like Wayland does.
(I think so because it spawns windows at (0, 0) without a WM running.)

SOFTWARE/OS VERSIONS
Operating System: Arch Linux
KDE Plasma Version: 5.22.2
KDE Frameworks Version: 5.83.0
Qt Version: 5.15.2
Kernel Version: 5.12.12-zen1-1-zen (64-bit)
Graphics Platform: X11
Processors: 12 × AMD Ryzen 5 5600X 6-Core Processor
Memory: 15.6 GiB of RAM
Graphics Processor: NVIDIA GeForce GT 730/PCIe/SSE2

GTK: 4.2.1

ADDITIONAL INFORMATION

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

Reply via email to