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