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.
7 use shared::basetsd::UINT32;
8 use shared::minwindef::{
9     BOOL, BYTE, DWORD, HRGN, INT, LPARAM, LPCVOID, LPVOID, LRESULT, UINT, WPARAM
10 };
11 use shared::windef::{HBITMAP, HWND, POINT, PSIZE, RECT};
12 use um::uxtheme::MARGINS;
13 use um::winnt::{HANDLE, HRESULT, ULONGLONG};
14 pub const DWM_BB_ENABLE: DWORD = 0x00000001;
15 pub const DWM_BB_BLURREGION: DWORD = 0x00000002;
16 pub const DWM_BB_TRANSITIONONMAXIMIZED: DWORD = 0x00000004;
17 STRUCT!{#[repr(packed)] struct DWM_BLURBEHIND {
18     dwFlags: DWORD,
19     fEnable: BOOL,
20     hRgnBlur: HRGN,
21     fTransitionOnMaximized: BOOL,
22 }}
23 ENUM!{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 }}
41 ENUM!{enum DWMNCRENDERINGPOLICY {
42     DWMNCRP_USEWINDOWSTYLE = 0,
43     DWMNCRP_DISABLED = 1,
44     DWMNCRP_ENABLED = 2,
45     DWMNCRP_LAST = 3,
46 }}
47 ENUM!{enum DWMFLIP3DWINDOWPOLICY {
48     DWMFLIP3D_DEFAULT = 0,
49     DWMFLIP3D_EXCLUDEBELOW = 1,
50     DWMFLIP3D_EXCLUDEABOVE = 2,
51     DWMFLIP3D_LAST = 3,
52 }}
53 pub const DWM_CLOAKED_APP: u32 = 0x00000001;
54 pub const DWM_CLOAKED_SHELL: u32 = 0x00000002;
55 pub const DWM_CLOAKED_INHERITED: u32 = 0x00000004;
56 pub type HTHUMBNAIL = HANDLE;
57 pub type PHTHUMBNAIL = *mut HTHUMBNAIL;
58 pub const DWM_TNP_RECTDESTINATION: DWORD = 0x00000001;
59 pub const DWM_TNP_RECTSOURCE: DWORD = 0x00000002;
60 pub const DWM_TNP_OPACITY: DWORD = 0x00000004;
61 pub const DWM_TNP_VISIBLE: DWORD = 0x00000008;
62 pub const DWM_TNP_SOURCECLIENTAREAONLY: DWORD = 0x00000010;
63 STRUCT!{#[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 }}
71 pub type PDWM_THUMBNAIL_PROPERTIES = *mut DWM_THUMBNAIL_PROPERTIES;
72 pub type DWM_FRAME_COUNT = ULONGLONG;
73 pub type QPC_TIME = ULONGLONG;
74 STRUCT!{#[repr(packed)] struct UNSIGNED_RATIO {
75     uiNumerator: UINT32,
76     uiDenominator: UINT32,
77 }}
78 STRUCT!{#[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 }}
120 ENUM!{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;
128 STRUCT!{#[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;
139 extern "system" {
DwmDefWindowProc( hWnd: HWND, msg: UINT, wParam: WPARAM, lParam: LPARAM, plResult: *mut LRESULT, ) -> BOOL140     pub fn DwmDefWindowProc(
141         hWnd: HWND,
142         msg: UINT,
143         wParam: WPARAM,
144         lParam: LPARAM,
145         plResult: *mut LRESULT,
146     ) -> BOOL;
DwmEnableBlurBehindWindow( hWnd: HWND, pBlurBehind: *const DWM_BLURBEHIND, ) -> HRESULT147     pub fn DwmEnableBlurBehindWindow(
148         hWnd: HWND,
149         pBlurBehind: *const DWM_BLURBEHIND,
150     ) -> HRESULT;
151 }
152 pub const DWM_EC_DISABLECOMPOSITION: UINT = 0;
153 pub const DWM_EC_ENABLECOMPOSITION: UINT = 1;
154 extern "system" {
DwmEnableComposition( uCompositionAction: UINT, ) -> HRESULT155     pub fn DwmEnableComposition(
156         uCompositionAction: UINT,
157     ) -> HRESULT;
DwmEnableMMCSS( fEnableMMCSS: BOOL, ) -> HRESULT158     pub fn DwmEnableMMCSS(
159         fEnableMMCSS: BOOL,
160     ) -> HRESULT;
DwmExtendFrameIntoClientArea( hWnd: HWND, pMarInset: *const MARGINS, ) -> HRESULT161     pub fn DwmExtendFrameIntoClientArea(
162         hWnd: HWND,
163         pMarInset: *const MARGINS,
164     ) -> HRESULT;
DwmGetColorizationColor( pcrColorization: *mut DWORD, pfOpaqueBlend: *mut BOOL, ) -> HRESULT165     pub fn DwmGetColorizationColor(
166         pcrColorization: *mut DWORD,
167         pfOpaqueBlend: *mut BOOL,
168     ) -> HRESULT;
DwmGetCompositionTimingInfo( hWnd: HWND, pTimingInfo: *mut DWM_TIMING_INFO, ) -> HRESULT169     pub fn DwmGetCompositionTimingInfo(
170         hWnd: HWND,
171         pTimingInfo: *mut DWM_TIMING_INFO,
172     ) -> HRESULT;
DwmGetWindowAttribute( hWnd: HWND, dwAttribute: DWORD, pvAttribute: LPVOID, cbAttribute: DWORD, ) -> HRESULT173     pub fn DwmGetWindowAttribute(
174         hWnd: HWND,
175         dwAttribute: DWORD,
176         pvAttribute: LPVOID,
177         cbAttribute: DWORD,
178     ) -> HRESULT;
DwmIsCompositionEnabled( pfEnabled: *mut BOOL, ) -> HRESULT179     pub fn DwmIsCompositionEnabled(
180         pfEnabled: *mut BOOL,
181     ) -> HRESULT;
DwmModifyPreviousDxFrameDuration( hwnd: HWND, cRefreshes: INT, fRelative: BOOL, ) -> HRESULT182     pub fn DwmModifyPreviousDxFrameDuration(
183         hwnd: HWND,
184         cRefreshes: INT,
185         fRelative: BOOL,
186     ) -> HRESULT;
DwmQueryThumbnailSourceSize( hThumbnail: HTHUMBNAIL, pSize: PSIZE, ) -> HRESULT187     pub fn DwmQueryThumbnailSourceSize(
188         hThumbnail: HTHUMBNAIL,
189         pSize: PSIZE,
190     ) -> HRESULT;
DwmRegisterThumbnail( hwndDestination: HWND, hwndSource: HWND, phThumbnailId: PHTHUMBNAIL, ) -> HRESULT191     pub fn DwmRegisterThumbnail(
192         hwndDestination: HWND,
193         hwndSource: HWND,
194         phThumbnailId: PHTHUMBNAIL,
195     ) -> HRESULT;
DwmSetDxFrameDuration( hwnd: HWND, cRefreshes: INT, ) -> HRESULT196     pub fn DwmSetDxFrameDuration(
197         hwnd: HWND,
198         cRefreshes: INT,
199     ) -> HRESULT;
DwmSetPresentParameters( hwnd: HWND, pPresentParams: *mut DWM_PRESENT_PARAMETERS, ) -> HRESULT200     pub fn DwmSetPresentParameters(
201         hwnd: HWND,
202         pPresentParams: *mut DWM_PRESENT_PARAMETERS,
203     ) -> HRESULT;
DwmSetWindowAttribute( hWnd: HWND, dwAttribute: DWORD, pvAttribute: LPCVOID, cbAttribute: DWORD, ) -> HRESULT204     pub fn DwmSetWindowAttribute(
205         hWnd: HWND,
206         dwAttribute: DWORD,
207         pvAttribute: LPCVOID,
208         cbAttribute: DWORD,
209     ) -> HRESULT;
DwmUnregisterThumbnail( hThumbnailId: HTHUMBNAIL, ) -> HRESULT210     pub fn DwmUnregisterThumbnail(
211         hThumbnailId: HTHUMBNAIL,
212     ) -> HRESULT;
DwmUpdateThumbnailProperties( hThumbnailId: HTHUMBNAIL, ptnProperties: *const DWM_THUMBNAIL_PROPERTIES, ) -> HRESULT213     pub fn DwmUpdateThumbnailProperties(
214         hThumbnailId: HTHUMBNAIL,
215         ptnProperties: *const DWM_THUMBNAIL_PROPERTIES,
216     ) -> HRESULT;
217 }
218 pub const DWM_SIT_DISPLAYFRAME: DWORD = 0x00000001;
219 extern "system" {
DwmSetIconicThumbnail( hwnd: HWND, hbmp: HBITMAP, dwSITFlags: DWORD, ) -> HRESULT220     pub fn DwmSetIconicThumbnail(
221         hwnd: HWND,
222         hbmp: HBITMAP,
223         dwSITFlags: DWORD,
224     ) -> HRESULT;
DwmSetIconicLivePreviewBitmap( hwnd: HWND, hbmp: HBITMAP, pptClient: *mut POINT, dwSITFlags: DWORD, ) -> HRESULT225     pub fn DwmSetIconicLivePreviewBitmap(
226         hwnd: HWND,
227         hbmp: HBITMAP,
228         pptClient: *mut POINT,
229         dwSITFlags: DWORD,
230     ) -> HRESULT;
DwmInvalidateIconicBitmaps( hwnd: HWND, ) -> HRESULT231     pub fn DwmInvalidateIconicBitmaps(
232         hwnd: HWND,
233     ) -> HRESULT;
234     // pub fn DwmAttachMilContent(hwnd: HWND) -> HRESULT;
235     // pub fn DwmDetachMilContent(hwnd: HWND) -> HRESULT;
DwmFlush() -> HRESULT236     pub fn DwmFlush() -> HRESULT;
237     // pub fn DwmGetGraphicsStreamTransformHint();
238     // pub fn DwmGetGraphicsStreamClient();
DwmGetTransportAttributes( pfIsRemoting: *mut BOOL, pfIsConnected: *mut BOOL, pDwGeneration: *mut DWORD, ) -> HRESULT239     pub fn DwmGetTransportAttributes(
240         pfIsRemoting: *mut BOOL,
241         pfIsConnected: *mut BOOL,
242         pDwGeneration: *mut DWORD,
243     ) -> HRESULT;
244 }
245 ENUM!{enum DWMTRANSITION_OWNEDWINDOW_TARGET {
246     DWMTRANSITION_OWNEDWINDOW_NULL = -1i32 as u32,
247     DWMTRANSITION_OWNEDWINDOW_REPOSITION = 0,
248 }}
249 extern "system" {
DwmTransitionOwnedWindow( hwnd: HWND, target: DWMTRANSITION_OWNEDWINDOW_TARGET, ) -> HRESULT250     pub fn DwmTransitionOwnedWindow(
251         hwnd: HWND,
252         target: DWMTRANSITION_OWNEDWINDOW_TARGET,
253     ) -> HRESULT;
254 }
255 ENUM!{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 }}
268 extern "system" {
DwmRenderGesture( gt: GESTURE_TYPE, cContacts: UINT, pdwPointerID: *const DWORD, pPoints: *const POINT, ) -> HRESULT269     pub fn DwmRenderGesture(
270         gt: GESTURE_TYPE,
271         cContacts: UINT,
272         pdwPointerID: *const DWORD,
273         pPoints: *const POINT,
274     ) -> HRESULT;
DwmTetherContact( dwPointerID: DWORD, fEnable: BOOL, ptTether: POINT, ) -> HRESULT275     pub fn DwmTetherContact(
276         dwPointerID: DWORD,
277         fEnable: BOOL,
278         ptTether: POINT,
279     ) -> HRESULT;
280 }
281 ENUM!{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 }}
290 extern "system" {
DwmShowContact( dwPointerID: DWORD, eShowContact: DWM_SHOWCONTACT, ) -> HRESULT291     pub fn DwmShowContact(
292         dwPointerID: DWORD,
293         eShowContact: DWM_SHOWCONTACT,
294     ) -> HRESULT;
295 }
296