After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 764413 - Wayland: not fullscreenable gtk+ apps can be fullscreened
Wayland: not fullscreenable gtk+ apps can be fullscreened
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Backend: Wayland
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
: 771413 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2016-03-31 13:07 UTC by Marek Chalupa
Modified: 2016-09-14 11:38 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
screenshot (161.89 KB, image/png)
2016-03-31 13:07 UTC, Marek Chalupa
  Details
[PATCH] wayland: obey configure event if maximized/fullscreen (2.44 KB, patch)
2016-04-04 16:39 UTC, Olivier Fourdan
none Details | Review
[POC PATCH gtk+] wayland: add set preferred size limits to gtk-shell (5.03 KB, patch)
2016-04-06 17:22 UTC, Olivier Fourdan
none Details | Review
[POC PATCH mutter] wayland: add set preferred size limits to gtk-shell (7.68 KB, patch)
2016-04-06 17:23 UTC, Olivier Fourdan
none Details | Review
Test program (1.29 KB, text/plain)
2016-04-21 08:40 UTC, Olivier Fourdan
  Details
[PATCH wayland-procols] add min/max size requests to xdg-shell unstable v5 (4.28 KB, patch)
2016-04-22 09:38 UTC, Olivier Fourdan
needs-work Details | Review
[PATCH gtk+] wayland: add min/max size from xdg-shell v6 (2.61 KB, patch)
2016-04-22 09:42 UTC, Olivier Fourdan
none Details | Review
[PATCH mutter] wayland: add min/max size from xdg-shell v6 (11.60 KB, patch)
2016-04-22 09:44 UTC, Olivier Fourdan
none Details | Review
[PATCH gtk+] wayland: add min/max size from xdg-shell v6 (2.81 KB, patch)
2016-08-22 09:30 UTC, Olivier Fourdan
committed Details | Review

Description Marek Chalupa 2016-03-31 13:07:32 UTC
Created attachment 325085 [details]
screenshot

How reproducible:

1) run gnome-control-center
2) (set and) press fullscreen keyshortcut
3) the g-c-c is fullscreened

g-c-c has no borders (actually, it is cropped) and is moved to 0x0

Not happening under X
Comment 1 Olivier Fourdan 2016-03-31 13:08:50 UTC
I had a patch for that, lemme see if I can find it...
Comment 2 Olivier Fourdan 2016-03-31 13:18:04 UTC
Ah right, here it is...

It was attachment 314814 [details] [review] in bug 757530 - It needs a rebase most likely as this code has changed since then, and probably some work as well, but the idea is that in Wayland, the compositor doesn't have any hint what the size limit a window may have as this is handled entirely by the client, so the compositor cannot tell whther or not a window can be maximized/fullscreened beforehand...

So the client (ie gtk+ in this case) has to adjust its state if it doesn't match. Or else you'll need an xdg-shell addition to give the compositor a hint, but this was not accepted in the past (Was just dicussing this with Jasper yesterday on irc...)
Comment 3 Matthias Clasen 2016-04-02 16:12:28 UTC
At the end of that bug, you said: forget about that patch, it's not needed.

Now it is needed after all ?
Comment 4 Olivier Fourdan 2016-04-04 07:07:42 UTC
(In reply to Matthias Clasen from comment #3)
> At the end of that bug, you said: forget about that patch, it's not needed.
> 
> Now it is needed after all ?

It was not needed for the original issue in bug 757530 in its initial description.

There are two slightly different issues, one is the app requesting to fullscreen/maximize state by itself, although its own constraints wouldn't allow for it, that was bug 757530 which was addressed with attachment 314815 [details] [review] (ie teach gtk+ not to try to switch its state to maximized if the window cannot).

There is another issue that I found out while working on bug 757530 which is with the Wayland compositor trying to switch a window to fullscreen/maximized while the window itself should not be allowed (again, due to its constraints), this would be this bug 764413 here instead, and attachment 314814 [details] [review] was to address this (other) particular issue - As attachment 314814 [details] [review] did not really reached a consensus, I preferred to move forward as this wasn't required for bug 757530.

The problem with Wayland is that we don't have a way for the client to tell what should be the maximum size if a given window, so the compositor might always try to maximize/fullscreen a window, and its then up to the client to deny the change.

Either we take the approach followed in attachment 314814 [details] [review] or we (try to) add some hints[*] in xdg-shell that would allow an application to tell the compositor that some window states such as maximized/fullscreen should not be possible.

[*] by the lack of a better word here, some people do not like the word "hint" for this and would avoid it, but I use it here as this is what X uses so we have a broader common understanding...
Comment 5 Olivier Fourdan 2016-04-04 09:22:33 UTC
After further discussion on irc on #wayland, it seems there is a need for a max_size hint so that the compositor can allow/disallow maximize/fullscreen transition, draw an accurate animation etc.

https://patchwork.freedesktop.org/series/5270/
Comment 6 Olivier Fourdan 2016-04-04 16:39:18 UTC
Created attachment 325360 [details] [review]
[PATCH] wayland: obey configure event if maximized/fullscreen

While discussing the possiblity to add an max size hint to xdg-shell on irc, I have been pointed out to the current xdg-shell specification that states that if the surface is maximized or fullscreen, the window geometry specified in the configure event _must_ be obeyed by the client, which gtk+ doesn't (thus this bug):

https://cgit.freedesktop.org/wayland/wayland-protocols/tree/unstable/xdg-shell/xdg-shell-unstable-v5.xml#n345

      <entry name="maximized" value="1" summary="the surface is maximized">
	<description summary="the surface is maximized">
	  The surface is maximized. The window geometry specified in the configure
	  event must be obeyed by the client.
	</description>
      </entry>
      <entry name="fullscreen" value="2" summary="the surface is fullscreen">
	<description summary="the surface is fullscreen">
	  The surface is fullscreen. The window geometry specified in the configure
	  event must be obeyed by the client.
	</description>
      </entry>

Therefore, this bug would be a bug in the application (ie gtk+) that doesn't resize to the given size.

This patch makes it so that the given maximize/fullscreen size is obeyed, gnome-calculator now maximize properly :-)

But I still reckon a max size hint would be beneficial to let the compositor know that the window should not be resized to a greater size that specified, so even if we fix this by becoming in-line with the xdg-shell specification, we might want to also add the max size request to xdg-shell (if it ever reaches consensus on the ML).
Comment 7 Olivier Fourdan 2016-04-06 17:22:50 UTC
Created attachment 325499 [details] [review]
[POC PATCH gtk+] wayland: add set preferred size limits to gtk-shell

This is a proof of concept (i.e. do not push), it adds set preferred size limits to gtk-shell.

This patch is for gtk+
Comment 8 Olivier Fourdan 2016-04-06 17:23:41 UTC
Created attachment 325500 [details] [review]
[POC PATCH mutter] wayland: add set preferred size limits to gtk-shell

This is a proof of concept (i.e. do not push), it adds set preferred size limits to gtk-shell.

This patch is for mutter
Comment 9 Olivier Fourdan 2016-04-21 08:40:28 UTC
Created attachment 326475 [details]
Test program

This simple reproducer is to demonstrate the need for attachment 325360 [details] [review] independently of the min/max addition to xdg-shell v6.

Even on X11, mutter will maximize windows that have a max size and a min size set.

Basically, on X11, what mutter does is to check if the window is resizeable or not. If the window is resizeable, it can be maximized or fullscreened, even if the specified max size is actually smaller than the available workarea.

mutter reckons a window is not resizeable if min == max. If min < max, it can be maximized for mutter (other window managers might behave differently, but that's not the point here).

 1. Save and build the attached program
 2. Start a GNOME on X11 session
 3. Run the reproducer in X11

Notice that the window cannot be resized manually to the full size of the monitor, yet moving it toward the top edge of the monitor and mutter will happily maximize the window.

Assuming this is the expected and desired behaviour, we need attachment 325360 [details] [review] in gtk+ to have the same in Wayland, even with the min/max size hint added to xdg-shell (which have now been pushed in xdg-shell v6 btw).
Comment 10 Olivier Fourdan 2016-04-21 08:43:17 UTC
Other possbily relevant discussion:
https://lists.freedesktop.org/archives/wayland-devel/2016-April/028266.html
Comment 11 Olivier Fourdan 2016-04-22 09:38:43 UTC
Created attachment 326535 [details] [review]
[PATCH wayland-procols] add min/max size requests to xdg-shell unstable v5

OK, this is cheating, the sole purpose of this patch is to add min/max size requests to xdg-shell unstable protocol v5 so I can prepare the patches for gtk+ and mutter without adding support for all of xdg-shell unstable protocol v6 (naughty, I know...).

So, to make it clear, this patch is not for merging (min/max have already been merged upstream in xdg-shell unstable protocol v6), this is just to test the two following patches for gtk+ and mutter without breaking everything.
Comment 12 Olivier Fourdan 2016-04-22 09:42:13 UTC
Created attachment 326536 [details] [review]
[PATCH gtk+] wayland: add min/max size from xdg-shell v6

Not to be merged, at least not until xdg-shell unstable v6 becomes official.
Comment 13 Olivier Fourdan 2016-04-22 09:44:09 UTC
Created attachment 326537 [details] [review]
[PATCH mutter] wayland: add min/max size from xdg-shell v6

Not to be merged, at least not until xdg-shell unstable v6 becomes official.
Comment 14 Olivier Fourdan 2016-08-22 09:30:19 UTC
Created attachment 333874 [details] [review]
[PATCH gtk+] wayland: add min/max size from xdg-shell v6

Patch rebased on top of https://github.com/jadahl/gtk.git :wip/xdg-shell-unstable-v6
Comment 15 Matthias Clasen 2016-08-23 20:52:35 UTC
Review of attachment 333874 [details] [review]:

looks ok to me (once xdg-shell v6 lands)
Comment 16 Olivier Fourdan 2016-08-25 09:06:46 UTC
Comment on attachment 333874 [details] [review]
[PATCH gtk+] wayland: add min/max size from xdg-shell v6

(In reply to Matthias Clasen from comment #15)
> Review of attachment 333874 [details] [review] [review]:
> 
> looks ok to me (once xdg-shell v6 lands)

attachment 333874 [details] [review] pushed as commit 9f57fe9 - wayland: add min/max size from xdg-shell v6
Comment 17 Olivier Fourdan 2016-08-25 09:09:39 UTC
For the record, I made one change/fix before pushing, the patch was testing xdg_surface not being NULL whereas it should have been xdg_toplevel (that was a leftover of the previous implementation before xdg-shell v6)
Comment 18 Olivier Fourdan 2016-08-25 09:11:24 UTC
Note: It needs the patch from bug 770226 in mutter for the min/max to be effective.
Comment 19 Olivier Fourdan 2016-09-14 11:38:09 UTC
*** Bug 771413 has been marked as a duplicate of this bug. ***