app: use material.Decorations on undecorated platforms

This patch implements a mechanism for customizing window
decorations.
If a window is configured with app.Decorated(true), then
the widget/material.Decorations are applied. On Wayland,
the option is automatically set when the server does not
provide window decorations.

Server side decorations are no longer requested.
The Decorated flag is set according to the
server's requests.

Wayland is now the default driver for UNIX platforms.

References: https://todo.sr.ht/~eliasnaur/gio/318
Signed-off-by: Pierre Curto <pierre.curto@gmail.com>
This commit is contained in:
Pierre Curto
2022-01-23 21:54:14 +01:00
committed by Elias Naur
parent 90ad0010ec
commit 5ce1e98282
12 changed files with 246 additions and 16 deletions
+2 -4
View File
@@ -57,7 +57,7 @@ type Decorations struct {
// Decorate a window with the title and actions defined in DecorationsStyle.
// The space used by the decorations is returned as an inset for the window
// content.
func (d *Decorations) Decorate(gtx layout.Context, title string) layout.Inset {
func (d *Decorations) Decorate(gtx layout.Context, title string) layout.Dimensions {
rec := op.Record(gtx.Ops)
dims := d.layoutDecorations(gtx, title)
decos := rec.Stop()
@@ -65,9 +65,7 @@ func (d *Decorations) Decorate(gtx layout.Context, title string) layout.Inset {
paint.FillShape(gtx.Ops, d.DecorationsStyle.Background, r.Op())
decos.Add(gtx.Ops)
d.layoutResizing(gtx)
return layout.Inset{
Top: unit.Px(float32(dims.Size.Y)),
}
return dims
}
func (d *Decorations) layoutResizing(gtx layout.Context) {