diff --git a/app/internal/windows/windows.go b/app/internal/windows/windows.go index 7a639746..4945bb71 100644 --- a/app/internal/windows/windows.go +++ b/app/internal/windows/windows.go @@ -47,6 +47,13 @@ type WndClassEx struct { HIconSm syscall.Handle } +type Margins struct { + CxLeftWidth int32 + CxRightWidth int32 + CyTopHeight int32 + CyBottomHeight int32 +} + type Msg struct { Hwnd syscall.Handle Message uint32 @@ -380,6 +387,9 @@ var ( _ImmReleaseContext = imm32.NewProc("ImmReleaseContext") _ImmSetCandidateWindow = imm32.NewProc("ImmSetCandidateWindow") _ImmSetCompositionWindow = imm32.NewProc("ImmSetCompositionWindow") + + dwmapi = syscall.NewLazySystemDLL("dwmapi") + _DwmExtendFrameIntoClientArea = dwmapi.NewProc("DwmExtendFrameIntoClientArea") ) func AdjustWindowRectEx(r *Rect, dwStyle uint32, bMenu int, dwExStyle uint32) { @@ -431,6 +441,14 @@ func DispatchMessage(m *Msg) { _DispatchMessage.Call(uintptr(unsafe.Pointer(m))) } +func DwmExtendFrameIntoClientArea(hwnd syscall.Handle, margins Margins) error { + r, _, _ := _DwmExtendFrameIntoClientArea.Call(uintptr(hwnd), uintptr(unsafe.Pointer(&margins))) + if r != 0 { + return fmt.Errorf("DwmExtendFrameIntoClientArea: %#x", r) + } + return nil +} + func EmptyClipboard() error { r, _, err := _EmptyClipboard.Call() if r == 0 { diff --git a/app/os_windows.go b/app/os_windows.go index a22a892f..c9d98b62 100644 --- a/app/os_windows.go +++ b/app/os_windows.go @@ -711,6 +711,10 @@ func (w *window) Configure(options []Option) { y = wr.Top width = r.Right - r.Left height = r.Bottom - r.Top + if !w.config.Decorated { + // Enable drop shadows when we draw decorations. + windows.DwmExtendFrameIntoClientArea(w.hwnd, windows.Margins{-1, -1, -1, -1}) + } case Fullscreen: mi := windows.GetMonitorInfo(w.hwnd)