mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-01 07:35:40 +00:00
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:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user