Bug 393167 - [Wayland] Child toplevel window placement doesn't work
Summary: [Wayland] Child toplevel window placement doesn't work
Status: RESOLVED FIXED
Alias: None
Product: kwin
Classification: Plasma
Component: wayland-generic (show other bugs)
Version: 5.12.4
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
: 375185 (view as bug list)
Depends on:
Blocks:
 
Reported: 2018-04-15 14:55 UTC by Andrius Štikonas
Modified: 2018-10-23 11:40 UTC (History)
8 users (show)

See Also:
Latest Commit:
Version Fixed In:
mgraesslin: Wayland+
mgraesslin: X11-
kde: ReviewRequest+


Attachments
support information (5.46 KB, text/plain)
2018-04-15 15:18 UTC, Andrius Štikonas
Details
Screenshot.png (285.81 KB, image/png)
2018-04-15 17:45 UTC, Andrius Štikonas
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Andrius Štikonas 2018-04-15 14:55:05 UTC
This is probably simply not implemented yet but Smart window placement does not work on Wayland. Instead all windows open in the top left corner of their available area (either screen or parent window).

Even some other placements like centered don't work for dialog (still open at the top left corner of the parent window) but at least top level windows open at the centre.
Comment 1 Martin Flöser 2018-04-15 15:12:24 UTC
The placement strategies in general work - also on Wayland. If it doesn't work for you we need to figure out why. Can you post the support information?
Comment 2 Andrius Štikonas 2018-04-15 15:18:18 UTC
Created attachment 112045 [details]
support information
Comment 3 Martin Flöser 2018-04-15 17:38:38 UTC
Where's your panel?
Comment 4 Andrius Štikonas 2018-04-15 17:41:13 UTC
(In reply to Martin Flöser from comment #3)
> Where's your panel?

At the bottom of the screen.
Comment 5 Andrius Štikonas 2018-04-15 17:45:18 UTC
Created attachment 112050 [details]
Screenshot.png
Comment 6 Andrius Štikonas 2018-04-18 12:12:15 UTC
I did a few more comparisons between X11 and Wayland. I think it's actually just child windows that are placed on top left corner of the parent window. On X11 they are centred.



I can also reproduce this on neon livecd (after installing plasma-wayland-desktop)
Comment 7 Alexander Mentyu 2018-07-02 20:12:43 UTC
Can reproduce - top left child windows placement - below the parent window titlebar:

Plasma: 5.13.2
Apps: 18.04.2
Frameworks: 5.47.0
Qt: 5.11.1
Kernel: 4.18.0-1-MANJARO
OS: Netrunner Rolling
Video: Intel 4400
Driver: xf86-video-intel 1:2.99.917+831+ge7bfc906-1
Mesa 3D: 18.1.3
Screen: 1600x900
Xorg: 1.20
Wayland: 1.15.0-1
Wayland Protocols: 1.14-1
Comment 8 Alexander Mentyu 2018-07-02 20:27:48 UTC
Child windows of Elisa player are opening in top left position of screen - not below the titlebar of parent window

elisa-0.1.1-1
Comment 9 Alexander Mentyu 2018-07-02 20:53:28 UTC
Updated Elisa - child windows are opening in top left, top right and bottom right screen position - after moving the main Elisa window

elisa-0.2.0-1
Comment 10 Andrius Štikonas 2018-07-02 20:55:06 UTC
(In reply to Alexander Mentyu from comment #9)
> Updated Elisa - child windows are opening in top left, top right and bottom
> right screen position - after moving the main Elisa window
> 
> elisa-0.2.0-1

Elisa updates wouldn't help. That's not Elisa's problem. Windows are placed by kwin.
Comment 11 Alexander Mentyu 2018-07-14 06:47:22 UTC
*** Bug 375185 has been marked as a duplicate of this bug. ***
Comment 12 Martin Flöser 2018-07-14 07:36:31 UTC
If child windows of Elisa are missplaced that is Elisa's problem and not KWin's
Comment 13 Andrius Štikonas 2018-07-14 10:40:00 UTC
(In reply to Martin Flöser from comment #12)
> If child windows of Elisa are missplaced that is Elisa's problem and not
> KWin's

So how can application position e.g. its about dialog? I don't think application controls that because if I choose centered window placement in system settings then it works.

Or am I misunderstanding what child window in Elisa is (I haven't used it). Anyway my bug is not Elisa specific.
Comment 14 Martin Flöser 2018-07-14 12:28:54 UTC
A child window is from a window manager perspective a "transient". The application needs to tell that it is a transient and needs to provide a placement positioning hint. If it doesn't KWin will place the window given the placement strategy. So if a child window gets placed by KWin it is an application bug.
Comment 15 Andrius Štikonas 2018-07-14 13:13:44 UTC
(In reply to Martin Flöser from comment #14)
> A child window is from a window manager perspective a "transient". The
> application needs to tell that it is a transient and needs to provide a
> placement positioning hint. If it doesn't KWin will place the window given
> the placement strategy. So if a child window gets placed by KWin it is an
> application bug.

Ok, I agree. Then it is not bug in KWin.

So from what you say it seems to me that every single Qt dialog created with new QDialog(this). Where is this set? QtWayland? Surely centered child windows would have been a better default...

Or do we have to call some other function every time we create "new QDialog(this)"?
Comment 16 Andrius Štikonas 2018-07-14 13:27:28 UTC
(In reply to Andrius Štikonas from comment #15)
> Ok, I agree. Then it is not bug in KWin.
> 
> So from what you say it seems to me that every single Qt dialog created with
> new QDialog(this).

So from what you say it seems to me that this is a bug in every single Qt dialog created with new QDialog(this).
Comment 17 Roman Gilg 2018-07-15 19:35:49 UTC
This bug was meant to be about the placement of transients. I can reproduce the problem for example with the Help->About dialog of Dolphin.

It is opened in the top-left  corner, but should be positioned centered. So this means there is a bug in the handling of some Xdg shell version? I'm using Qt 5.11 and master Kwayland.
Comment 18 Martin Flöser 2018-07-15 19:41:39 UTC
no, it means that the about dialog does not get the correct hints. Might also be a bug in Qt.
Comment 19 Andrius Štikonas 2018-07-15 19:42:23 UTC
QT_WAYLAND_SHELL_INTEGRATION=wl-shell works though, dialogs are centered.
Comment 20 Fabian Vogt 2018-07-15 20:06:34 UTC
This is the output with WAYLAND_DEBUG=1 | grep xdg;

[4221669,270] zxdg_shell_v6@28.ping(4354)
[4221669,320]  -> zxdg_shell_v6@28.pong(4354)
[4221669,811] zxdg_toplevel_v6@30.configure(0, 0, array)
[4221669,861] zxdg_surface_v6@29.configure(4357)
[4221669,884]  -> zxdg_surface_v6@29.ack_configure(4357)
[4222127,358] zxdg_shell_v6@28.ping(4361)
[4222127,403]  -> zxdg_shell_v6@28.pong(4361)
[4222127,855]  -> zxdg_shell_v6@28.get_xdg_surface(new id zxdg_surface_v6@51, wl_surface@46)
[4222127,896]  -> zxdg_shell_v6@28.create_positioner(new id zxdg_positioner_v6@53)
[4222127,920]  -> zxdg_positioner_v6@53.set_anchor_rect(612, 27, 1, 1)
[4222127,962]  -> zxdg_positioner_v6@53.set_anchor(5)
[4222127,979]  -> zxdg_positioner_v6@53.set_gravity(10)
[4222127,997]  -> zxdg_positioner_v6@53.set_size(339, 236)
[4222128,026]  -> zxdg_surface_v6@51.get_popup(new id zxdg_popup_v6@50, zxdg_surface_v6@29, zxdg_positioner_v6@53)
[4222128,066]  -> zxdg_positioner_v6@53.destroy()
[4222128,082]  -> zxdg_popup_v6@50.grab(wl_seat@6, 4362)
[4222129,031] zxdg_popup_v6@50.configure(612, 27, 339, 236)
[4222129,082] zxdg_surface_v6@51.configure(4363)
[4222129,108]  -> zxdg_surface_v6@51.ack_configure(4363)
[4224958,779]  -> zxdg_popup_v6@50.destroy()
[4224958,804]  -> zxdg_surface_v6@51.destroy()
[4225095,841]  -> zxdg_shell_v6@28.get_xdg_surface(new id zxdg_surface_v6@79, wl_surface@74)
[4225095,877]  -> zxdg_surface_v6@79.get_toplevel(new id zxdg_toplevel_v6@78)
[4225095,884]  -> zxdg_toplevel_v6@78.set_parent(zxdg_toplevel_v6@30)
[4225095,891]  -> zxdg_toplevel_v6@78.set_title("Über Kate")
[4225095,897]  -> zxdg_toplevel_v6@78.set_app_id("org.kde.kate")
[4225260,576] zxdg_toplevel_v6@78.configure(0, 0, array)
[4225260,587] zxdg_surface_v6@79.configure(4373)
[4225260,595]  -> zxdg_surface_v6@79.ack_configure(4373)
Comment 21 emohr 2018-10-14 17:49:26 UTC
*** Bug 373454 has been marked as a duplicate of this bug. ***
Comment 22 emohr 2018-10-14 17:50:23 UTC
*** Bug 374669 has been marked as a duplicate of this bug. ***
Comment 23 David Edmundson 2018-10-18 09:19:44 UTC
This bug has gotten quite confusing, there's talk about toplevels on top of toplevels (i.e dolphin's help-> about) and there's a trace from popups in another app.

The two are very different.

I'm going to make this bug purely about toplevel on toplevel with a parent set.
(and I can see an obvious bug there)

@fvogt if you have any popup bugs can you make a new report.
Comment 24 David Edmundson 2018-10-23 11:40:13 UTC
Git commit bdf348c603b8e342af2d6c97ab42b3703fd02813 by David Edmundson.
Committed on 23/10/2018 at 11:37.
Pushed by davidedmundson into branch 'master'.

[wayland] Set better placement for XDG Toplevels

Summary:
XDG Popups will have a transient parent and positional information.
XDG Toplevels can have a transient parent without having positional
information.

Currently we set that we have a transient placement hint of 0,0 which
means the newly opened children go to the top left of the parent.

This new code paths treat child top levels as dialogs centering them to
the parent.

Test Plan:
Dolphin help->about
Appeared where it does on X

Reviewers: #kwin, zzag

Reviewed By: #kwin, zzag

Subscribers: zzag, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D16293

M  +2    -0    placement.cpp

https://commits.kde.org/kwin/bdf348c603b8e342af2d6c97ab42b3703fd02813