From 9d1e8a59da705e11a6062ba07d42df26e5656dcd Mon Sep 17 00:00:00 2001 From: tauraamui Date: Fri, 18 Mar 2022 02:09:04 +0000 Subject: [PATCH] Set decoration size on frame event and config events respectfully --- app/window.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/app/window.go b/app/window.go index 4702958b4..6434aef35 100644 --- a/app/window.go +++ b/app/window.go @@ -753,7 +753,7 @@ func (w *Window) processEvent(d driver, e event.Event) { wrapper := &w.decorations.Ops wrapper.Reset() size := e2.Size // save the initial window size as the decorations will change it. - e2.FrameEvent.Size = w.decorate(d, e2.FrameEvent, wrapper) + e2.FrameEvent.Size, e2.FrameEvent.DecorationSize = w.decorate(d, e2.FrameEvent, wrapper) w.out <- e2.FrameEvent frame, gotFrame := w.waitFrame(d) ops.AddCall(&wrapper.Internal, &frame.Internal, ops.PC{}, ops.PCFor(&frame.Internal)) @@ -791,6 +791,7 @@ func (w *Window) processEvent(d driver, e event.Event) { w.decorations.size = image.Point{} } e2.Config.Size = e2.Config.Size.Sub(w.decorations.size) + e2.Config.DecorationSize = w.decorations.size w.out <- e2 case event.Event: if w.queue.q.Queue(e2) { @@ -856,9 +857,9 @@ func (w *Window) fallbackDecorate() bool { } // decorate the window if enabled and returns the corresponding Insets. -func (w *Window) decorate(d driver, e system.FrameEvent, o *op.Ops) image.Point { +func (w *Window) decorate(d driver, e system.FrameEvent, o *op.Ops) (image.Point, image.Point) { if !w.fallbackDecorate() { - return e.Size + return e.Size, image.Point{} } theme := w.decorations.Theme if theme == nil { @@ -906,13 +907,15 @@ func (w *Window) decorate(d driver, e system.FrameEvent, o *op.Ops) image.Point size := image.Point{Y: dims.Size.Y} op.Offset(f32.Point{Y: float32(size.Y)}).Add(o) appSize := e.Size.Sub(size) + decSize := w.decorations.size if w.decorations.size != size { w.decorations.size = size cnf := w.decorations.Config cnf.Size = appSize + cnf.DecorationSize = decSize w.out <- ConfigEvent{Config: cnf} } - return appSize + return appSize, decSize } // Perform the actions on the window.