Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions app/os_wayland.go
Original file line number Diff line number Diff line change
Expand Up @@ -1121,6 +1121,7 @@ func (w *window) setWindowConstraints() {
if scaled := w.config.MaxSize.Div(w.scale); scaled != (image.Point{}) {
C.xdg_toplevel_set_max_size(w.topLvl, C.int32_t(scaled.X), C.int32_t(scaled.Y+decoHeight))
}
w.updateOpaqueRegion()
}

// decoHeight returns the adjustment for client-side decorations, if applicable.
Expand Down Expand Up @@ -1724,6 +1725,12 @@ func (w *window) systemGesture() (*C.struct_wl_cursor, C.uint32_t) {
}

func (w *window) updateOpaqueRegion() {
if !w.config.Decorated {
// Don't mark CSD windows as opaque so the compositor can apply
// rounded corners and transparency effects.
C.wl_surface_set_opaque_region(w.surf, nil)
return
}
reg := C.wl_compositor_create_region(w.disp.compositor)
C.wl_region_add(reg, 0, 0, C.int32_t(w.size.X), C.int32_t(w.size.Y))
C.wl_surface_set_opaque_region(w.surf, reg)
Expand Down
10 changes: 3 additions & 7 deletions app/window.go
Original file line number Diff line number Diff line change
Expand Up @@ -207,13 +207,9 @@ func (w *Window) validateAndProcess(size image.Point, sync bool, frame *op.Ops,
}

func (w *Window) frame(frame *op.Ops, viewport image.Point) error {
if runtime.GOOS == "js" {
// Use transparent black when Gio is embedded, to allow mixing of Gio and
// foreign content below.
w.gpu.Clear(color.NRGBA{A: 0x00, R: 0x00, G: 0x00, B: 0x00})
} else {
w.gpu.Clear(color.NRGBA{A: 0xff, R: 0xff, G: 0xff, B: 0xff})
}
// Use transparent clear color to support window transparency and
// compositor-drawn rounded corners on Wayland/macOS.
w.gpu.Clear(color.NRGBA{A: 0x00, R: 0x00, G: 0x00, B: 0x00})
target, err := w.ctx.RenderTarget()
if err != nil {
return err
Expand Down