Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dwmapi.go: add definitions for various DWM APIs #13

Merged
merged 1 commit into from
Aug 20, 2024
Merged
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
116 changes: 116 additions & 0 deletions dwmapi.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
// Copyright (c) Tailscale Inc & AUTHORS
// SPDX-License-Identifier: BSD-3-Clause

//go:build windows
// +build windows

package win

import "golang.org/x/sys/windows"

type DWMWINDOWATTRIBUTE uint32

const (
DWMWA_NCRENDERING_ENABLED DWMWINDOWATTRIBUTE = 1
DWMWA_NCRENDERING_POLICY DWMWINDOWATTRIBUTE = 2
DWMWA_TRANSITIONS_FORCEDISABLED DWMWINDOWATTRIBUTE = 3
DWMWA_ALLOW_NCPAINT DWMWINDOWATTRIBUTE = 4
DWMWA_CAPTION_BUTTON_BOUNDS DWMWINDOWATTRIBUTE = 5
DWMWA_NONCLIENT_RTL_LAYOUT DWMWINDOWATTRIBUTE = 6
DWMWA_FORCE_ICONIC_REPRESENTATION DWMWINDOWATTRIBUTE = 7
DWMWA_FLIP3D_POLICY DWMWINDOWATTRIBUTE = 8
DWMWA_EXTENDED_FRAME_BOUNDS DWMWINDOWATTRIBUTE = 9
DWMWA_HAS_ICONIC_BITMAP DWMWINDOWATTRIBUTE = 10
DWMWA_DISALLOW_PEEK DWMWINDOWATTRIBUTE = 11
DWMWA_EXCLUDED_FROM_PEEK DWMWINDOWATTRIBUTE = 12
DWMWA_CLOAK DWMWINDOWATTRIBUTE = 13
DWMWA_CLOAKED DWMWINDOWATTRIBUTE = 14
DWMWA_FREEZE_REPRESENTATION DWMWINDOWATTRIBUTE = 15
DWMWA_PASSIVE_UPDATE_MODE DWMWINDOWATTRIBUTE = 16
DWMWA_USE_HOSTBACKDROPBRUSH DWMWINDOWATTRIBUTE = 17
DWMWA_USE_IMMERSIVE_DARK_MODE DWMWINDOWATTRIBUTE = 20
DWMWA_WINDOW_CORNER_PREFERENCE DWMWINDOWATTRIBUTE = 33
DWMWA_BORDER_COLOR DWMWINDOWATTRIBUTE = 34
DWMWA_CAPTION_COLOR DWMWINDOWATTRIBUTE = 35
DWMWA_TEXT_COLOR DWMWINDOWATTRIBUTE = 36
DWMWA_VISIBLE_FRAME_BORDER_THICKNESS DWMWINDOWATTRIBUTE = 37
DWMWA_SYSTEMBACKDROP_TYPE DWMWINDOWATTRIBUTE = 38
)

const (
DWM_CLOAKED_APP uint32 = 0x00000001
DWM_CLOAKED_SHELL uint32 = 0x00000002
DWM_CLOAKED_INHERITED uint32 = 0x00000004
)

const (
DWMWA_COLOR_NONE uint32 = 0xFFFFFFFE
DWMWA_COLOR_DEFAULT uint32 = 0xFFFFFFFF
)

type DWMNCRENDERINGPOLICY int32

const (
DWMNCRP_USEWINDOWSTYLE DWMNCRENDERINGPOLICY = 0
DWMNCRP_DISABLED DWMNCRENDERINGPOLICY = 1
DWMNCRP_ENABLED DWMNCRENDERINGPOLICY = 2
)

type DWMFLIP3DWINDOWPOLICY int32

const (
DWMFLIP3D_DEFAULT DWMFLIP3DWINDOWPOLICY = 0
DWMFLIP3D_EXCLUDEBELOW DWMFLIP3DWINDOWPOLICY = 1
DWMFLIP3D_EXCLUDEABOVE DWMFLIP3DWINDOWPOLICY = 2
)

type DWM_WINDOW_CORNER_PREFERENCE int32

const (
DWMWCP_DEFAULT DWM_WINDOW_CORNER_PREFERENCE = 0
DWMWCP_DONOTROUND DWM_WINDOW_CORNER_PREFERENCE = 1
DWMWCP_ROUND DWM_WINDOW_CORNER_PREFERENCE = 2
DWMWCP_ROUNDSMALL DWM_WINDOW_CORNER_PREFERENCE = 3
)

type DWM_SYSTEMBACKDROP_TYPE int32

const (
DWMSBT_AUTO DWM_SYSTEMBACKDROP_TYPE = 0
DWMSBT_NONE DWM_SYSTEMBACKDROP_TYPE = 1
DWMSBT_MAINWINDOW DWM_SYSTEMBACKDROP_TYPE = 2
DWMSBT_TRANSIENTWINDOW DWM_SYSTEMBACKDROP_TYPE = 3
DWMSBT_TABBEDWINDOW DWM_SYSTEMBACKDROP_TYPE = 4
)

type HTHUMBNAIL windows.Handle

const (
DWM_TNP_RECTDESTINATION = 0x00000001
DWM_TNP_RECTSOURCE = 0x00000002
DWM_TNP_OPACITY = 0x00000004
DWM_TNP_VISIBLE = 0x00000008
DWM_TNP_SOURCECLIENTAREAONLY = 0x00000010
)

type DWM_THUMBNAIL_PROPERTIES struct {
Flags uint32
RcDestination RECT
RcSource RECT
Opacity byte
FVisible BOOL
FSourceClientAreaOnly BOOL
}

const DWM_SIT_DISPLAYFRAME = 0x00000001

//sys DwmExtendFrameIntoClientArea(hwnd HWND, inset *MARGINS) (ret HRESULT) = dwmapi.DwmExtendFrameIntoClientArea
//sys DwmGetWindowAttribute(hwnd HWND, attribute DWMWINDOWATTRIBUTE, attrVal unsafe.Pointer, attrValLen uint32) (ret HRESULT) = dwmapi.DwmGetWindowAttribute
//sys DwmInvalidateIconicBitmaps(hwnd HWND) (ret HRESULT) = dwmapi.DwmInvalidateIconicBitmaps
//sys DwmQueryThumbnailSourceSize(thumbnail HTHUMBNAIL, size *SIZE) (ret HRESULT) = dwmapi.DwmQueryThumbnailSourceSize
//sys DwmRegisterThumbnail(hwndDest HWND, hwndSrc HWND, handle *HTHUMBNAIL) (ret HRESULT) = dwmapi.DwmRegisterThumbnail
//sys DwmSetIconicLivePreviewBitmap(hwnd HWND, hbmp HBITMAP, clientRegionOffset *POINT, flags uint32) (ret HRESULT) = dwmapi.DwmSetIconicLivePreviewBitmap
//sys DwmSetIconicThumbnail(hwnd HWND, hbmp HBITMAP, flags uint32) (ret HRESULT) = dwmapi.DwmSetIconicThumbnail
//sys DwmSetWindowAttribute(hwnd HWND, attribute DWMWINDOWATTRIBUTE, attrVal unsafe.Pointer, attrValLen uint32) (ret HRESULT) = dwmapi.DwmSetWindowAttribute
//sys DwmUpdateThumbnailProperties(thumbnail HTHUMBNAIL, props *DWM_THUMBNAIL_PROPERTIES) (ret HRESULT) = dwmapi.DwmUpdateThumbnailProperties
//sys DwmUnregisterThumbnail(thumbnail HTHUMBNAIL) (ret HRESULT) = dwmapi.DwmUnregisterThumbnail
2 changes: 1 addition & 1 deletion mksyscall.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@

package win

//go:generate go run golang.org/x/sys/windows/mkwinsyscall -output zsyscall_windows.go comctl32.go gdiplus.go kernel32.go user32.go uxtheme.go
//go:generate go run golang.org/x/sys/windows/mkwinsyscall -output zsyscall_windows.go comctl32.go dwmapi.go gdiplus.go kernel32.go user32.go uxtheme.go
//go:generate go run golang.org/x/tools/cmd/goimports -w zsyscall_windows.go
71 changes: 71 additions & 0 deletions zsyscall_windows.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.