08:48 Dami_Lu: Hi, When you have two windows stacked on top of each other in the same process, and you set one window to be the parent of the other (xdg_toplevel.set_parent), the child window will always appear on top when you switch focus to the parent window (in X11, the parent window will appear on top when you switch focus to the parent window). Is this a design feature of Wayland or a bug?
08:53 Dami_Lu: Can anyone please help explain this problem
09:17 vyivel: Dami_Lu: that's the intended behavior
09:18 Dami_Lu: But for client programs, there will be problems with inconsistent phenomena under x11 and wayland.
09:20 emersion: it's up to the client to not indicate the parent-child relationship if there is no such relationship?
09:22 Dami_Lu: This problem will only occur if the parent-child relationship is set, and it will not occur if it is not set.
09:22 emersion: that's what the parent-child relationship means yes
09:24 Dami_Lu: The same setting can switch the focus in x11 and let the child window display under the parent window.
09:37 MrCooper: I suspect there's actually no parent-child relationship with X, that's why it works there
09:38 MrCooper: or it could be an X window manager issue
09:45 Dami_Lu: The parent-child relationship between the child window and the parent window is specially set.
09:45 Dami_Lu: Of course, it is not ruled out that it is a problem under X, but after using X for a long time, many users do not think that this is a problem under X.
10:00 MrCooper: Dami_Lu: X child windows are always visible on top of their parent, so it can't be that at least; would have to be some kind of window manager protocol like NETWM instead, in which case the WM is a factor
10:04 Dami_Lu: I used Qt demo and tested it with Kwin, Mutter, and Weston in x and wayland, and the effects were consistent.
10:05 Dami_Lu: The child window is created when the button is pressed:
10:05 Dami_Lu: connect(ui->pushButton, &QPushButton::clicked, this, [this] {
10:05 Dami_Lu: QMainWindow *w =new QMainWindow(this);
10:05 Dami_Lu: w->show();
10:05 Dami_Lu: });
10:08 davidre: Dami_Lu If the QWindow has a parent QtWayland creates a subsurface for it. If it has a transientParent it will be a xdg_toplevel with a parent set
10:11 Dami_Lu: davidre: Yes, I am also analyzing the logic you mentioned in Qtwayland and kwin.
10:11 Dami_Lu: xdg_toplevel.set_parent
10:11 davidre: I am not sure which of both happens of you do a QMainWindow like this
10:13 Dami_Lu: This is just an example. In fact, it’s not just QMainWindow, it’s the same for other sub-windows.
10:20 davidre: Dami_Lu: I can't reproduce your issue
10:20 davidre: I can switch focus to the parent window