forked from joejulian/gio
app: clip client area
On Wayland, app.Window provides fallback window decorations but clients are not prohibited from drawing over the decorations or capturing events. This change adds a clip operation to ensure no unwanted interaction between client content and decorations. Fixes issue described in https://lists.sr.ht/~eliasnaur/gio/%3C092fa6a19894af3306fab568fb919c965e98c4da.camel%40gmail.com%3E Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
@@ -25,6 +25,7 @@ import (
|
||||
"gioui.org/io/system"
|
||||
"gioui.org/layout"
|
||||
"gioui.org/op"
|
||||
"gioui.org/op/clip"
|
||||
"gioui.org/unit"
|
||||
"gioui.org/widget"
|
||||
"gioui.org/widget/material"
|
||||
@@ -799,7 +800,9 @@ func (w *Window) processEvent(d driver, e event.Event) {
|
||||
e2.FrameEvent.Size = w.decorate(d, e2.FrameEvent, wrapper)
|
||||
w.out <- e2.FrameEvent
|
||||
frame, gotFrame := w.waitFrame(d)
|
||||
cl := clip.Rect(image.Rectangle{Max: e2.FrameEvent.Size}).Push(wrapper)
|
||||
ops.AddCall(&wrapper.Internal, &frame.Internal, ops.PC{}, ops.PCFor(&frame.Internal))
|
||||
cl.Pop()
|
||||
err := w.validateAndProcess(d, size, e2.Sync, wrapper)
|
||||
if gotFrame {
|
||||
// We're done with frame, let the client continue.
|
||||
|
||||
Reference in New Issue
Block a user