https://bugzilla.gnome.org/show_bug.cgi?id=771561

--- Comment #10 from Olivier Fourdan <ofour...@redhat.com> ---
Created attachment 335846
  --> https://bugzilla.gnome.org/attachment.cgi?id=335846&action=edit
Sample program

(In reply to Sjoerd Simons from comment #9)
> CSD != shadows.

Not sure what you mean by that sentence...

With CSD, the shadows are drawn by the client, i.e. they are within the
toplevel GdkWindow size whereas with SSD the shadows are drawn by the window
manager, ie outside of the GdkWindow.

That's precisely why you need _GTK_FRAME_EXTENTS for CSD on X11.

> If your claim is correct (which i don't think it is, but i could be wrong)
> other code in gdkwindow-wayland is obviously wrong as
> gdk_wayland_window_get_window_geometry already removed the margins for the
> geometry, so calling _set_geometry_hints with that geometry will decrease
> with the margins twice.. 
> 
> clamping make sense to prevent protocol errors, but from what i can tell the
> problem here isn't the application given dumb values...

To demonstrate why we need to remove the shadow sizes, please consider the
attached sample program.

What this code does is trivially setting the min height of its window to 1
pixel usign the GtkWindow API (gtk_window_set_geometry_hints()).

Now, this needs to work in all 3 following cases:

1. X11 without CSD (i.e. with SSD)
2. X11 with CSD
3. Wayland

Which means that the geometry value passed to X11 must match what the program
sets as-is, whereas the values given to CSD must add up the header bar and the
shadow values.

This program works as expected in all 3 cases, ie the window *content* (ie not
counting the shadows and hederbar) minimum is 1 in X11 with SSD, X11 with CSD
and Wayland with CSD.

Applying your patch results in the min height being too large in Wayland as
seen in WAYLAND_DEBUG=1 logs:

Without your patch:

[3747632.054]  -> zxdg_toplevel_v6@28.set_min_size(248, 37)
[3747632.062]  -> zxdg_toplevel_v6@28.set_max_size(248, 248)
[3747632.070]  -> zxdg_surface_v6@27.set_window_geometry(26, 23, 248, 239)

With your patch:

[3782500.453]  -> zxdg_toplevel_v6@28.set_min_size(300, 89)
[3782500.462]  -> zxdg_toplevel_v6@28.set_max_size(300, 300)
[3782500.472]  -> zxdg_surface_v6@27.set_window_geometry(26, 23, 248, 248)

And resizing to the min gives:

[4270822.924] zxdg_toplevel_v6@28.configure(248, 37, array)

And 37 is the height of the gtkheaderbar, matching the min height (without your
patch) whereas your patch gives a min height of 89.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
wayland-bugs mailing list
wayland-bugs@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-bugs

Reply via email to