[x11] Add support for _GTK_FRAME_EXTENTS
ClosedPublic

Authored by zzag on Oct 15 2019, 10:41 AM.
Tags
Subscribers
Tokens
"Love" token, awarded by alexde."Love" token, awarded by lephuong."Love" token, awarded by GB_2."Love" token, awarded by ngraham."Love" token, awarded by ognarb.

Details

Summary

KDE is known for having a strong view on the client-side decorations vs
server-side decorations issue. The main argument raised against CSD is
that desktop will look less consistent when clients start drawing window
decorations by themselves, which is somewhat true. It all ties to how
well each toolkit is integrated with the desktop environment.

KDE doesn't control the desktop market on Linux. Another big "player"
is GNOME. Both KDE and GNOME have very polarized views on in which
direction desktop should move forward. The KDE community is pushing more
toward server-side decorations while the GNOME community is pushing
more toward client-side decorations. Both communities have developed
great applications and it's not rare to see a GNOME application being
used in KDE Plasma. The only problem is that these different views are
not left behind the curtain and our users pay the price. Resizing GTK
clients in Plasma became practically impossible due to resize borders
having small hit area.

When a client draws its window decoration, it's more likely that it also
draws the drop-shadow around the decoration. The compositor must know
the extents of the shadow so things like snapping and so on work as
expected. And here lies the problem... While the xdg-shell protocol has
a way to specify such things, the NetWM spec doesn't have anything like
that. There's _GTK_FRAME_EXTENTS in the wild, however the problem with
it is that it's a proprietary atom, which is specific only to GTK apps.

Due to that, _GTK_FRAME_EXTENTS wasn't implemented because implementing
anything like that would require major changes in how we think about
geometry.

Recent xdg-shell window geometry patches adjusted geometry abstractions
in kwin to such a degree that it's very easy to add support for client
side decorated clients on X11. We just have to make sure that the
X11Client class provides correct buffer geometry and frame geometry when
the gtk frame extents are set.

Even though the X11 code is feature frozen, I still think it's worth
to have _GTK_FRAME_EXTENTS support in kwin because it will fix the resize
issues. Also, because KWin/Wayland is unfortunately far from becoming
default, it will help us with testing some implementation bits of the
window geometry from xdg-shell.

BUG: 390550
FIXED-IN: 5.18.0

Test Plan

Things like quick tiling, maximizing, tiling scripts and so on work as
expected with GTK clients.

Diff Detail

Repository
R108 KWin
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
zzag created this revision.Oct 15 2019, 10:41 AM
Restricted Application added a project: KWin. · View Herald TranscriptOct 15 2019, 10:41 AM
Restricted Application added a subscriber: kwin. · View Herald Transcript
zzag requested review of this revision.Oct 15 2019, 10:41 AM
ngraham edited the summary of this revision. (Show Details)Oct 15 2019, 1:55 PM
GB_2 awarded a token.Oct 21 2019, 10:17 AM
zzag edited the summary of this revision. (Show Details)Oct 21 2019, 12:06 PM
trmdi added a subscriber: trmdi.Nov 11 2019, 2:20 AM
cblack added a subscriber: cblack.Nov 24 2019, 7:13 PM

I've been using this patch for a while, and here are some things I've noticed:

  • Thumbnails include window shadow; this appears fine in alt-tab switcher but on panel switcher thumbnails they're drawn with a solid background.
  • Snapping can be a bit odd as CSD windows can sometimes not realize that their size has changed until after you let go of the mouse
  • The shadows don't really fare well when you turn off compositing; toggling compositing while application is running does not seem to be an expected use case in GTK.
zzag added a comment.Nov 26 2019, 8:30 AM

I've been using this patch for a while, and here are some things I've noticed:

  • Thumbnails include window shadow; this appears fine in alt-tab switcher but on panel switcher thumbnails they're drawn with a solid background.

This needs to be fixed in plasma-framework.

  • Snapping can be a bit odd as CSD windows can sometimes not realize that their size has changed until after you let go of the mouse

Is this something that needs to be fixed in the compositor itself? How can I reproduce the issue you've described?

  • The shadows don't really fare well when you turn off compositing; toggling compositing while application is running does not seem to be an expected use case in GTK.

Unfortunately, this can't be fixed in KWin.

davidedmundson accepted this revision.Nov 26 2019, 4:27 PM
This revision is now accepted and ready to land.Nov 26 2019, 4:27 PM
In D24660#567598, @zzag wrote:
  • Snapping can be a bit odd as CSD windows can sometimes not realize that their size has changed until after you let go of the mouse

Is this something that needs to be fixed in the compositor itself? How can I reproduce the issue you've described?

I don't have exact steps, but you're bound to run into it if you snap CSD windows frequently. I don't experience equivalent behavior under Mutter so I'm assuming it's something to do with the window manager. You can tell when the window is snapping odd by the window content clipping.

zzag added a comment.Nov 27 2019, 12:10 PM

I don't have exact steps, but you're bound to run into it if you snap CSD windows frequently. I don't experience equivalent behavior under Mutter so I'm assuming it's something to do with the window manager. You can tell when the window is snapping odd by the window content clipping.

Hmm, I've been running this patch series for quite a while and haven't noticed issues with snapping. Could you please file a bug report? Also, it would be great if you could attach a screencast or something so it's much easier to see what's the issue.

This revision was automatically updated to reflect the committed changes.