winapi_ui_automation/um/
dwmapi.rs

1// Licensed under the Apache License, Version 2.0
2// <LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
3// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your option.
4// All files in the project carrying such notice may not be copied, modified, or distributed
5// except according to those terms.
6//! Procedure declarations, constant definitions, and macros for the NLS component.
7use shared::basetsd::UINT32;
8use shared::minwindef::{
9    BOOL, BYTE, DWORD, HRGN, INT, LPARAM, LPCVOID, LPVOID, LRESULT, UINT, WPARAM
10};
11use shared::windef::{HBITMAP, HWND, POINT, PSIZE, RECT};
12use um::uxtheme::MARGINS;
13use um::winnt::{HANDLE, HRESULT, ULONGLONG};
14pub const DWM_BB_ENABLE: DWORD = 0x00000001;
15pub const DWM_BB_BLURREGION: DWORD = 0x00000002;
16pub const DWM_BB_TRANSITIONONMAXIMIZED: DWORD = 0x00000004;
17STRUCT!{#[repr(packed)] struct DWM_BLURBEHIND {
18    dwFlags: DWORD,
19    fEnable: BOOL,
20    hRgnBlur: HRGN,
21    fTransitionOnMaximized: BOOL,
22}}
23ENUM!{enum DWMWINDOWATTRIBUTE {
24    DWMWA_NCRENDERING_ENABLED = 1,
25    DWMWA_NCRENDERING_POLICY = 2,
26    DWMWA_TRANSITIONS_FORCEDISABLED = 3,
27    DWMWA_ALLOW_NCPAINT = 4,
28    DWMWA_CAPTION_BUTTON_BOUNDS = 5,
29    DWMWA_NONCLIENT_RTL_LAYOUT = 6,
30    DWMWA_FORCE_ICONIC_REPRESENTATION = 7,
31    DWMWA_FLIP3D_POLICY = 8,
32    DWMWA_EXTENDED_FRAME_BOUNDS = 9,
33    DWMWA_HAS_ICONIC_BITMAP = 10,
34    DWMWA_DISALLOW_PEEK = 11,
35    DWMWA_EXCLUDED_FROM_PEEK = 12,
36    DWMWA_CLOAK = 13,
37    DWMWA_CLOAKED = 14,
38    DWMWA_FREEZE_REPRESENTATION = 15,
39    DWMWA_LAST = 16,
40}}
41ENUM!{enum DWMNCRENDERINGPOLICY {
42    DWMNCRP_USEWINDOWSTYLE = 0,
43    DWMNCRP_DISABLED = 1,
44    DWMNCRP_ENABLED = 2,
45    DWMNCRP_LAST = 3,
46}}
47ENUM!{enum DWMFLIP3DWINDOWPOLICY {
48    DWMFLIP3D_DEFAULT = 0,
49    DWMFLIP3D_EXCLUDEBELOW = 1,
50    DWMFLIP3D_EXCLUDEABOVE = 2,
51    DWMFLIP3D_LAST = 3,
52}}
53pub const DWM_CLOAKED_APP: u32 = 0x00000001;
54pub const DWM_CLOAKED_SHELL: u32 = 0x00000002;
55pub const DWM_CLOAKED_INHERITED: u32 = 0x00000004;
56pub type HTHUMBNAIL = HANDLE;
57pub type PHTHUMBNAIL = *mut HTHUMBNAIL;
58pub const DWM_TNP_RECTDESTINATION: DWORD = 0x00000001;
59pub const DWM_TNP_RECTSOURCE: DWORD = 0x00000002;
60pub const DWM_TNP_OPACITY: DWORD = 0x00000004;
61pub const DWM_TNP_VISIBLE: DWORD = 0x00000008;
62pub const DWM_TNP_SOURCECLIENTAREAONLY: DWORD = 0x00000010;
63STRUCT!{#[repr(packed)] struct DWM_THUMBNAIL_PROPERTIES {
64    dwFlags: DWORD,
65    rcDestination: RECT,
66    rcSource: RECT,
67    opacity: BYTE,
68    fVisible: BOOL,
69    fSourceClientAreaOnly: BOOL,
70}}
71pub type PDWM_THUMBNAIL_PROPERTIES = *mut DWM_THUMBNAIL_PROPERTIES;
72pub type DWM_FRAME_COUNT = ULONGLONG;
73pub type QPC_TIME = ULONGLONG;
74STRUCT!{#[repr(packed)] struct UNSIGNED_RATIO {
75    uiNumerator: UINT32,
76    uiDenominator: UINT32,
77}}
78STRUCT!{#[repr(packed)] struct DWM_TIMING_INFO {
79    cbSize: UINT32,
80    rateRefresh: UNSIGNED_RATIO,
81    qpcRefreshPeriod: QPC_TIME,
82    rateCompose: UNSIGNED_RATIO,
83    qpcVBlank: QPC_TIME,
84    cRefresh: DWM_FRAME_COUNT,
85    cDXRefresh: UINT,
86    qpcCompose: QPC_TIME,
87    cFrame: DWM_FRAME_COUNT,
88    cDXPresent: UINT,
89    cRefreshFrame: DWM_FRAME_COUNT,
90    cFrameSubmitted: DWM_FRAME_COUNT,
91    cDXPresentSubmitted: UINT,
92    cFrameConfirmed: DWM_FRAME_COUNT,
93    cDXPresentConfirmed: UINT,
94    cRefreshConfirmed: DWM_FRAME_COUNT,
95    cDXRefreshConfirmed: UINT,
96    cFramesLate: DWM_FRAME_COUNT,
97    cFramesOutstanding: UINT,
98    cFrameDisplayed: DWM_FRAME_COUNT,
99    qpcFrameDisplayed: QPC_TIME,
100    cRefreshFrameDisplayed: DWM_FRAME_COUNT,
101    cFrameComplete: DWM_FRAME_COUNT,
102    qpcFrameComplete: QPC_TIME,
103    cFramePending: DWM_FRAME_COUNT,
104    qpcFramePending: QPC_TIME,
105    cFramesDisplayed: DWM_FRAME_COUNT,
106    cFramesComplete: DWM_FRAME_COUNT,
107    cFramesPending: DWM_FRAME_COUNT,
108    cFramesAvailable: DWM_FRAME_COUNT,
109    cFramesDropped: DWM_FRAME_COUNT,
110    cFramesMissed: DWM_FRAME_COUNT,
111    cRefreshNextDisplayed: DWM_FRAME_COUNT,
112    cRefreshNextPresented: DWM_FRAME_COUNT,
113    cRefreshesDisplayed: DWM_FRAME_COUNT,
114    cRefreshesPresented: DWM_FRAME_COUNT,
115    cRefreshStarted: DWM_FRAME_COUNT,
116    cPixelsReceived: ULONGLONG,
117    cPixelsDrawn: ULONGLONG,
118    cBuffersEmpty: DWM_FRAME_COUNT,
119}}
120ENUM!{enum DWM_SOURCE_FRAME_SAMPLING {
121    DWM_SOURCE_FRAME_SAMPLING_POINT = 0,
122    DWM_SOURCE_FRAME_SAMPLING_COVERAGE = 1,
123    DWM_SOURCE_FRAME_SAMPLING_LAST = 2,
124}}
125// pub const c_DwmMaxQueuedBuffers: UINT = 8;
126// pub const c_DwmMaxMonitors: UINT = 16;
127// pub const c_DwmMaxAdapters: UINT = 16;
128STRUCT!{#[repr(packed)] struct DWM_PRESENT_PARAMETERS {
129    cbSize: UINT32,
130    fQueue: BOOL,
131    cRefreshStart: DWM_FRAME_COUNT,
132    cBuffer: UINT,
133    fUseSourceRate: BOOL,
134    rateSource: UNSIGNED_RATIO,
135    cRefreshesPerFrame: UINT,
136    eSampling: DWM_SOURCE_FRAME_SAMPLING,
137}}
138// pub const DWM_FRAME_DURATION_DEFAULT: i32 = -1;
139extern "system" {
140    pub fn DwmDefWindowProc(
141        hWnd: HWND,
142        msg: UINT,
143        wParam: WPARAM,
144        lParam: LPARAM,
145        plResult: *mut LRESULT,
146    ) -> BOOL;
147    pub fn DwmEnableBlurBehindWindow(
148        hWnd: HWND,
149        pBlurBehind: *const DWM_BLURBEHIND,
150    ) -> HRESULT;
151}
152pub const DWM_EC_DISABLECOMPOSITION: UINT = 0;
153pub const DWM_EC_ENABLECOMPOSITION: UINT = 1;
154extern "system" {
155    pub fn DwmEnableComposition(
156        uCompositionAction: UINT,
157    ) -> HRESULT;
158    pub fn DwmEnableMMCSS(
159        fEnableMMCSS: BOOL,
160    ) -> HRESULT;
161    pub fn DwmExtendFrameIntoClientArea(
162        hWnd: HWND,
163        pMarInset: *const MARGINS,
164    ) -> HRESULT;
165    pub fn DwmGetColorizationColor(
166        pcrColorization: *mut DWORD,
167        pfOpaqueBlend: *mut BOOL,
168    ) -> HRESULT;
169    pub fn DwmGetCompositionTimingInfo(
170        hWnd: HWND,
171        pTimingInfo: *mut DWM_TIMING_INFO,
172    ) -> HRESULT;
173    pub fn DwmGetWindowAttribute(
174        hWnd: HWND,
175        dwAttribute: DWORD,
176        pvAttribute: LPVOID,
177        cbAttribute: DWORD,
178    ) -> HRESULT;
179    pub fn DwmIsCompositionEnabled(
180        pfEnabled: *mut BOOL,
181    ) -> HRESULT;
182    pub fn DwmModifyPreviousDxFrameDuration(
183        hwnd: HWND,
184        cRefreshes: INT,
185        fRelative: BOOL,
186    ) -> HRESULT;
187    pub fn DwmQueryThumbnailSourceSize(
188        hThumbnail: HTHUMBNAIL,
189        pSize: PSIZE,
190    ) -> HRESULT;
191    pub fn DwmRegisterThumbnail(
192        hwndDestination: HWND,
193        hwndSource: HWND,
194        phThumbnailId: PHTHUMBNAIL,
195    ) -> HRESULT;
196    pub fn DwmSetDxFrameDuration(
197        hwnd: HWND,
198        cRefreshes: INT,
199    ) -> HRESULT;
200    pub fn DwmSetPresentParameters(
201        hwnd: HWND,
202        pPresentParams: *mut DWM_PRESENT_PARAMETERS,
203    ) -> HRESULT;
204    pub fn DwmSetWindowAttribute(
205        hWnd: HWND,
206        dwAttribute: DWORD,
207        pvAttribute: LPCVOID,
208        cbAttribute: DWORD,
209    ) -> HRESULT;
210    pub fn DwmUnregisterThumbnail(
211        hThumbnailId: HTHUMBNAIL,
212    ) -> HRESULT;
213    pub fn DwmUpdateThumbnailProperties(
214        hThumbnailId: HTHUMBNAIL,
215        ptnProperties: *const DWM_THUMBNAIL_PROPERTIES,
216    ) -> HRESULT;
217}
218pub const DWM_SIT_DISPLAYFRAME: DWORD = 0x00000001;
219extern "system" {
220    pub fn DwmSetIconicThumbnail(
221        hwnd: HWND,
222        hbmp: HBITMAP,
223        dwSITFlags: DWORD,
224    ) -> HRESULT;
225    pub fn DwmSetIconicLivePreviewBitmap(
226        hwnd: HWND,
227        hbmp: HBITMAP,
228        pptClient: *mut POINT,
229        dwSITFlags: DWORD,
230    ) -> HRESULT;
231    pub fn DwmInvalidateIconicBitmaps(
232        hwnd: HWND,
233    ) -> HRESULT;
234    // pub fn DwmAttachMilContent(hwnd: HWND) -> HRESULT;
235    // pub fn DwmDetachMilContent(hwnd: HWND) -> HRESULT;
236    pub fn DwmFlush() -> HRESULT;
237    // pub fn DwmGetGraphicsStreamTransformHint();
238    // pub fn DwmGetGraphicsStreamClient();
239    pub fn DwmGetTransportAttributes(
240        pfIsRemoting: *mut BOOL,
241        pfIsConnected: *mut BOOL,
242        pDwGeneration: *mut DWORD,
243    ) -> HRESULT;
244}
245ENUM!{enum DWMTRANSITION_OWNEDWINDOW_TARGET {
246    DWMTRANSITION_OWNEDWINDOW_NULL = -1i32 as u32,
247    DWMTRANSITION_OWNEDWINDOW_REPOSITION = 0,
248}}
249extern "system" {
250    pub fn DwmTransitionOwnedWindow(
251        hwnd: HWND,
252        target: DWMTRANSITION_OWNEDWINDOW_TARGET,
253    ) -> HRESULT;
254}
255ENUM!{enum GESTURE_TYPE {
256    GT_PEN_TAP = 0,
257    GT_PEN_DOUBLETAP = 1,
258    GT_PEN_RIGHTTAP = 2,
259    GT_PEN_PRESSANDHOLD = 3,
260    GT_PEN_PRESSANDHOLDABORT = 4,
261    GT_TOUCH_TAP = 5,
262    GT_TOUCH_DOUBLETAP = 6,
263    GT_TOUCH_RIGHTTAP = 7,
264    GT_TOUCH_PRESSANDHOLD = 8,
265    GT_TOUCH_PRESSANDHOLDABORT = 9,
266    GT_TOUCH_PRESSANDTAP = 10,
267}}
268extern "system" {
269    pub fn DwmRenderGesture(
270        gt: GESTURE_TYPE,
271        cContacts: UINT,
272        pdwPointerID: *const DWORD,
273        pPoints: *const POINT,
274    ) -> HRESULT;
275    pub fn DwmTetherContact(
276        dwPointerID: DWORD,
277        fEnable: BOOL,
278        ptTether: POINT,
279    ) -> HRESULT;
280}
281ENUM!{enum DWM_SHOWCONTACT {
282    DWMSC_DOWN = 0x00000001,
283    DWMSC_UP = 0x00000002,
284    DWMSC_DRAG = 0x00000004,
285    DWMSC_HOLD = 0x00000008,
286    DWMSC_PENBARREL = 0x00000010,
287    DWMSC_NONE = 0x00000000,
288    DWMSC_ALL = 0xFFFFFFFF,
289}}
290extern "system" {
291    pub fn DwmShowContact(
292        dwPointerID: DWORD,
293        eShowContact: DWM_SHOWCONTACT,
294    ) -> HRESULT;
295}