Bug 439578 - Maximize button sometimes appears even in non-resizable windows with xdg-decoration
Summary: Maximize button sometimes appears even in non-resizable windows with xdg-deco...
Status: RESOLVED FIXED
Alias: None
Product: kwin
Classification: Plasma
Component: wayland-generic (show other bugs)
Version: 5.22.2
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-07-07 04:33 UTC by David Gow
Modified: 2021-07-08 01:46 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.23


Attachments
test program (755 bytes, text/x-c++src)
2021-07-07 09:14 UTC, David Redondo
Details

Note You need to log in before you can comment on or make changes to this bug.
Description David Gow 2021-07-07 04:33:06 UTC
SUMMARY

A wayland window using xdg-decoration to request server-side decorations will sometimes show a (non-functional) maximize button in the title bar for windows which are not resizable.

This seems to occur if the decoration is created before set_min_size() and set_max_size() are called, but I've been unable thus far to conclusively confirm that.

This affects libdecor, which always creates an xdg-decoration object when a window is first created, and then simply toggles the mode later:
https://gitlab.gnome.org/jadahl/libdecoration/-/blob/82e8653af75348e5fcad4f490217c25959bb762a/src/libdecor.c#L497

SDL has worked around the issue in this commit:
https://github.com/libsdl-org/SDL/commit/efbb6ff9d70e791d755c9ece95f248d1055b10ab

There's some further discussion in the SDL issue for libdecor support:
https://github.com/libsdl-org/SDL/pull/4068#issuecomment-874626945

STEPS TO REPRODUCE
1. Build a version of SDL with libdecor support from this merge request:
https://github.com/libsdl-org/SDL/pull/4068
  - Note that you'll need to build libdecor first.
2. Run the SDL testwm2 app with this version of SDL. The maximize button should be visible, but useless.
3. Running the same testwm2 app with libdecor disabled will correctly not have a maximise button.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: openSUSE Tumbleweed
(available in About System)
KDE Plasma Version: 5.22.2
KDE Frameworks Version: 5.15.2
Qt Version: 5.83.0
Comment 1 David Redondo 2021-07-07 09:14:04 UTC
Created attachment 139916 [details]
test program
Comment 2 David Redondo 2021-07-07 09:17:11 UTC
I've used the attached test app

On X state seems to be correctly propagated:
- Breeze decoration does not draw a maximize button (but layouting breaks so a breeze bug)

On Wayland decoration buttons do not change. 

I've also tested with another decoration that draws the maximize button disabled if the window is not maxmizable. On X this happens on Wayland not
Comment 3 Bug Janitor Service 2021-07-07 11:53:29 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwin/-/merge_requests/1156
Comment 4 David Redondo 2021-07-07 12:26:27 UTC
Git commit 5fe6de699ca0cad9934197b317c93bcc4f41b117 by David Redondo.
Committed on 07/07/2021 at 12:17.
Pushed by davidre into branch 'master'.

Handle when a xdg-toplevel changes its min or max size

We previously never emitted maximiziableChanged() meaning we never
synced the state to the decoration.

M  +14   -0    src/xdgshellclient.cpp
M  +2    -0    src/xdgshellclient.h

https://invent.kde.org/plasma/kwin/commit/5fe6de699ca0cad9934197b317c93bcc4f41b117