Bug 397479 - xdg-shell v6 with acked configure breaks plasma shell surfaces
Summary: xdg-shell v6 with acked configure breaks plasma shell surfaces
Status: RESOLVED UPSTREAM
Alias: None
Product: kwin
Classification: Plasma
Component: wayland-generic (show other bugs)
Version: git master
Platform: Other Linux
: NOR major
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-08-15 09:27 UTC by Fabian Vogt
Modified: 2018-10-03 17:43 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Fabian Vogt 2018-08-15 09:27:46 UTC
Qt with https://codereview.qt-project.org/#/c/222255/ and GTK 3 windows snap back to their old size after they lose focus. The Qt change (part of 5.12) breaks Plasma as well.
Comment 1 David Edmundson 2018-08-21 20:52:31 UTC
I applied that one change on top of 5.11 everything seems fine?

gtk3 windows I'm not finding them have an issue when I change focus, but they do jump when 

There is one relevant quirk based on our debug output.

We send a lot of configure(someState, QSize());  when we're just updating the state (like active changing)

>      If the width or height arguments are zero, it means the client
        should decide its own window dimension.

In kwin we take that to mean "use the last thing I sent you" which seems a sensible assumption, but that's not how toolkits interpret that line nor how other WMs behave.

I shall:
 - update kwin to always send a size
 - try and build qt master and see if I can reproduce there
Comment 2 Fabian Vogt 2018-08-21 21:08:48 UTC
(In reply to David Edmundson from comment #1)
> I applied that one change on top of 5.11 everything seems fine?

Adding stikonas to CC as he initially discovered this.
I'm not sure what the broken Plasma behaviour was - I believe popups
appearing in the wrong place?

> gtk3 windows I'm not finding them have an issue when I change focus, but
> they do jump when 

when...?

> There is one relevant quirk based on our debug output.
> 
> We send a lot of configure(someState, QSize());  when we're just updating
> the state (like active changing)
> 
> >      If the width or height arguments are zero, it means the client
>         should decide its own window dimension.
> 
> In kwin we take that to mean "use the last thing I sent you" which seems a
> sensible assumption, but that's not how toolkits interpret that line nor how
> other WMs behave.
> 
> I shall:
>  - update kwin to always send a size
>  - try and build qt master and see if I can reproduce there

That sounds like a reasonable explanation for the GTK behaviour at least.
Comment 3 David Edmundson 2018-08-21 21:10:36 UTC
I was building suspense.

gtk3 windows I'm not finding them have an issue when I change focus, but
they do jump when I start a new resize
Comment 4 Andrius Štikonas 2018-08-21 21:13:09 UTC
Yes, I saw plasma windows at the top left corner:
https://bugs.kde.org/show_bug.cgi?id=396650
Comment 5 David Edmundson 2018-08-21 21:47:15 UTC
what do you mean by "plasma windows" ?
Comment 6 Andrius Štikonas 2018-08-21 21:48:50 UTC
(In reply to David Edmundson from comment #5)
> what do you mean by "plasma windows" ?

If I remember correctly, e.g. surface that opens when I click on "K-menu" (or if I click on calendar, plasma-nm, etc.)
Comment 7 David Edmundson 2018-08-22 11:19:41 UTC
Reproduced for plasma windows. Regular windows are fine.

I think the GTK window situation might be a different bug.
Comment 8 David Edmundson 2018-08-22 21:52:48 UTC
More related but different bugs :(

I've identified the source of the GTK bug that bothers me the most.

We block so that we only send one configure request until we get a damage event, in an attempt to keep things synced.

In some cases we send configure with the same size twice; this will cause no surface commit, and our lock holds indefinitely until we cause a repaint.

I don't want to do the fix of addressing the requests we send, but instead making us more robust to blocking. Ideally by removing the blocks and just tracking configure/acks correctly.
Comment 9 David Edmundson 2018-09-28 18:05:12 UTC
So back on the Qt issue with 5.12

QWindow->setPosition(10,10)  on wayland does nothing

but window->position() still returned 10,10

in new Qt it returns 0,0 (or rather it does after ack which is a bit weird) because it didn't really move anything. To a large extent, this change is quite sensible.

but the magic plasmashell protocol relied on it.

I'll submit a Qt patch and see what happens, otherwise we have a tonne of plasma work cut out for us.
Comment 10 David Edmundson 2018-10-01 20:36:12 UTC
There are two bugs.

The geometry issue, but also Qt's geometry updates can deadlock and then never show windows a second time \o/

https://bugreports.qt.io/browse/QTBUG-70845?focusedCommentId=424274&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-424274

The first issue is arguably us relying on quirky behaviour, the second is a bug for definite. Unfortunately the underlying bug is only exposed in plasma dialogs and not simpler test cases.
Comment 11 David Edmundson 2018-10-02 17:46:25 UTC
That more worrying deadlock bug is now fixed.

I wrote a review for the other one: https://codereview.qt-project.org/#/c/241711/
Not convinced it'll get in worst case I'll upload a workaround to p-f.
Comment 12 David Edmundson 2018-10-03 17:43:12 UTC
Both Qt patches merged \o/

5.12 latest is all good to go.