Skip to content

Commit 9d1e8a5

Browse files
committed
Set decoration size on frame event and config events respectfully
1 parent 56207e8 commit 9d1e8a5

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

app/window.go

+7-4
Original file line numberDiff line numberDiff line change
@@ -753,7 +753,7 @@ func (w *Window) processEvent(d driver, e event.Event) {
753753
wrapper := &w.decorations.Ops
754754
wrapper.Reset()
755755
size := e2.Size // save the initial window size as the decorations will change it.
756-
e2.FrameEvent.Size = w.decorate(d, e2.FrameEvent, wrapper)
756+
e2.FrameEvent.Size, e2.FrameEvent.DecorationSize = w.decorate(d, e2.FrameEvent, wrapper)
757757
w.out <- e2.FrameEvent
758758
frame, gotFrame := w.waitFrame(d)
759759
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) {
791791
w.decorations.size = image.Point{}
792792
}
793793
e2.Config.Size = e2.Config.Size.Sub(w.decorations.size)
794+
e2.Config.DecorationSize = w.decorations.size
794795
w.out <- e2
795796
case event.Event:
796797
if w.queue.q.Queue(e2) {
@@ -856,9 +857,9 @@ func (w *Window) fallbackDecorate() bool {
856857
}
857858

858859
// decorate the window if enabled and returns the corresponding Insets.
859-
func (w *Window) decorate(d driver, e system.FrameEvent, o *op.Ops) image.Point {
860+
func (w *Window) decorate(d driver, e system.FrameEvent, o *op.Ops) (image.Point, image.Point) {
860861
if !w.fallbackDecorate() {
861-
return e.Size
862+
return e.Size, image.Point{}
862863
}
863864
theme := w.decorations.Theme
864865
if theme == nil {
@@ -906,13 +907,15 @@ func (w *Window) decorate(d driver, e system.FrameEvent, o *op.Ops) image.Point
906907
size := image.Point{Y: dims.Size.Y}
907908
op.Offset(f32.Point{Y: float32(size.Y)}).Add(o)
908909
appSize := e.Size.Sub(size)
910+
decSize := w.decorations.size
909911
if w.decorations.size != size {
910912
w.decorations.size = size
911913
cnf := w.decorations.Config
912914
cnf.Size = appSize
915+
cnf.DecorationSize = decSize
913916
w.out <- ConfigEvent{Config: cnf}
914917
}
915-
return appSize
918+
return appSize, decSize
916919
}
917920

918921
// Perform the actions on the window.

0 commit comments

Comments
 (0)