From 19c6455e8ddcbb230a72596a5f0117398ed4253e Mon Sep 17 00:00:00 2001 From: Rana718 Date: Sun, 5 Jul 2026 18:36:15 +0530 Subject: [PATCH] app: enable transparent CSD windows on Wayland --- app/os_wayland.go | 7 +++++++ app/window.go | 10 +++------- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/app/os_wayland.go b/app/os_wayland.go index b020c6d17..1f71867d1 100644 --- a/app/os_wayland.go +++ b/app/os_wayland.go @@ -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. @@ -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) diff --git a/app/window.go b/app/window.go index d232968f0..6b6019fc6 100644 --- a/app/window.go +++ b/app/window.go @@ -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