1 /*
2 * Dwmapi
3 *
4 * Copyright 2007 Andras Kovacs
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 *
20 */
21
22 #include <stdarg.h>
23
24 #ifdef __REACTOS__
25 #include <rtlfuncs.h>
26 #else
27 #include "winternl.h"
28 #endif
29
30 #define COBJMACROS
31 #include "windef.h"
32 #include "winbase.h"
33 #include "wingdi.h"
34 #include "winuser.h"
35 #include "dwmapi.h"
36 #include "wine/debug.h"
37
38 WINE_DEFAULT_DEBUG_CHANNEL(dwmapi);
39
40
41 /**********************************************************************
42 * DwmIsCompositionEnabled (DWMAPI.@)
43 */
DwmIsCompositionEnabled(BOOL * enabled)44 HRESULT WINAPI DwmIsCompositionEnabled(BOOL *enabled)
45 {
46
47 #ifdef __REACTOS__
48 RTL_OSVERSIONINFOW version;
49 #else
50 RTL_OSVERSIONINFOEXW version;
51 #endif
52
53 TRACE("%p\n", enabled);
54
55 if (!enabled)
56 return E_INVALIDARG;
57
58 *enabled = FALSE;
59 version.dwOSVersionInfoSize = sizeof(version);
60 if (!RtlGetVersion(&version))
61 *enabled = (version.dwMajorVersion > 6 || (version.dwMajorVersion == 6 && version.dwMinorVersion >= 3));
62
63 return S_OK;
64 }
65
66 /**********************************************************************
67 * DwmEnableComposition (DWMAPI.102)
68 */
DwmEnableComposition(UINT uCompositionAction)69 HRESULT WINAPI DwmEnableComposition(UINT uCompositionAction)
70 {
71 FIXME("(%d) stub\n", uCompositionAction);
72
73 return S_OK;
74 }
75
76 /**********************************************************************
77 * DwmExtendFrameIntoClientArea (DWMAPI.@)
78 */
DwmExtendFrameIntoClientArea(HWND hwnd,const MARGINS * margins)79 HRESULT WINAPI DwmExtendFrameIntoClientArea(HWND hwnd, const MARGINS* margins)
80 {
81 FIXME("(%p, %p) stub\n", hwnd, margins);
82
83 return S_OK;
84 }
85
86 /**********************************************************************
87 * DwmGetColorizationColor (DWMAPI.@)
88 */
DwmGetColorizationColor(DWORD * colorization,BOOL * opaque_blend)89 HRESULT WINAPI DwmGetColorizationColor(DWORD *colorization, BOOL *opaque_blend)
90 {
91 FIXME("(%p, %p) stub\n", colorization, opaque_blend);
92
93 return E_NOTIMPL;
94 }
95
96 /**********************************************************************
97 * DwmFlush (DWMAPI.@)
98 */
DwmFlush(void)99 HRESULT WINAPI DwmFlush(void)
100 {
101 static BOOL once;
102
103 if (!once++) FIXME("() stub\n");
104
105 return S_OK;
106 }
107
108 /**********************************************************************
109 * DwmInvalidateIconicBitmaps (DWMAPI.@)
110 */
DwmInvalidateIconicBitmaps(HWND hwnd)111 HRESULT WINAPI DwmInvalidateIconicBitmaps(HWND hwnd)
112 {
113 static BOOL once;
114
115 if (!once++) FIXME("(%p) stub\n", hwnd);
116
117 return E_NOTIMPL;
118 }
119
120 /**********************************************************************
121 * DwmSetWindowAttribute (DWMAPI.@)
122 */
DwmSetWindowAttribute(HWND hwnd,DWORD attributenum,LPCVOID attribute,DWORD size)123 HRESULT WINAPI DwmSetWindowAttribute(HWND hwnd, DWORD attributenum, LPCVOID attribute, DWORD size)
124 {
125 static BOOL once;
126
127 if (!once++) FIXME("(%p, %lx, %p, %lx) stub\n", hwnd, attributenum, attribute, size);
128
129 return S_OK;
130 }
131
132 /**********************************************************************
133 * DwmGetGraphicsStreamClient (DWMAPI.@)
134 */
DwmGetGraphicsStreamClient(UINT uIndex,UUID * pClientUuid)135 HRESULT WINAPI DwmGetGraphicsStreamClient(UINT uIndex, UUID *pClientUuid)
136 {
137 FIXME("(%d, %p) stub\n", uIndex, pClientUuid);
138
139 return E_NOTIMPL;
140 }
141
142 /**********************************************************************
143 * DwmGetTransportAttributes (DWMAPI.@)
144 */
DwmGetTransportAttributes(BOOL * pfIsRemoting,BOOL * pfIsConnected,DWORD * pDwGeneration)145 HRESULT WINAPI DwmGetTransportAttributes(BOOL *pfIsRemoting, BOOL *pfIsConnected, DWORD *pDwGeneration)
146 {
147 FIXME("(%p, %p, %p) stub\n", pfIsRemoting, pfIsConnected, pDwGeneration);
148
149 return DWM_E_COMPOSITIONDISABLED;
150 }
151
152 /**********************************************************************
153 * DwmUnregisterThumbnail (DWMAPI.@)
154 */
DwmUnregisterThumbnail(HTHUMBNAIL thumbnail)155 HRESULT WINAPI DwmUnregisterThumbnail(HTHUMBNAIL thumbnail)
156 {
157 FIXME("(%p) stub\n", thumbnail);
158
159 return E_NOTIMPL;
160 }
161
162 /**********************************************************************
163 * DwmEnableMMCSS (DWMAPI.@)
164 */
DwmEnableMMCSS(BOOL enableMMCSS)165 HRESULT WINAPI DwmEnableMMCSS(BOOL enableMMCSS)
166 {
167 FIXME("(%d) stub\n", enableMMCSS);
168
169 return S_OK;
170 }
171
172 /**********************************************************************
173 * DwmGetGraphicsStreamTransformHint (DWMAPI.@)
174 */
DwmGetGraphicsStreamTransformHint(UINT uIndex,MilMatrix3x2D * pTransform)175 HRESULT WINAPI DwmGetGraphicsStreamTransformHint(UINT uIndex, MilMatrix3x2D *pTransform)
176 {
177 FIXME("(%d, %p) stub\n", uIndex, pTransform);
178
179 return E_NOTIMPL;
180 }
181
182 /**********************************************************************
183 * DwmEnableBlurBehindWindow (DWMAPI.@)
184 */
DwmEnableBlurBehindWindow(HWND hWnd,const DWM_BLURBEHIND * pBlurBuf)185 HRESULT WINAPI DwmEnableBlurBehindWindow(HWND hWnd, const DWM_BLURBEHIND *pBlurBuf)
186 {
187 FIXME("%p %p\n", hWnd, pBlurBuf);
188
189 return E_NOTIMPL;
190 }
191
192 /**********************************************************************
193 * DwmDefWindowProc (DWMAPI.@)
194 */
DwmDefWindowProc(HWND hWnd,UINT Msg,WPARAM wParam,LPARAM lParam,LRESULT * plResult)195 BOOL WINAPI DwmDefWindowProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam, LRESULT *plResult)
196 {
197 static int i;
198
199 if (!i++) FIXME("stub\n");
200
201 return FALSE;
202 }
203
204 /**********************************************************************
205 * DwmGetWindowAttribute (DWMAPI.@)
206 */
DwmGetWindowAttribute(HWND hwnd,DWORD attribute,PVOID pv_attribute,DWORD size)207 HRESULT WINAPI DwmGetWindowAttribute(HWND hwnd, DWORD attribute, PVOID pv_attribute, DWORD size)
208 {
209 FIXME("(%p %ld %p %ld) stub\n", hwnd, attribute, pv_attribute, size);
210
211 return E_NOTIMPL;
212 }
213
214 /**********************************************************************
215 * DwmRegisterThumbnail (DWMAPI.@)
216 */
DwmRegisterThumbnail(HWND dest,HWND src,PHTHUMBNAIL thumbnail_id)217 HRESULT WINAPI DwmRegisterThumbnail(HWND dest, HWND src, PHTHUMBNAIL thumbnail_id)
218 {
219 FIXME("(%p %p %p) stub\n", dest, src, thumbnail_id);
220
221 return E_NOTIMPL;
222 }
223
get_display_frequency(void)224 static int get_display_frequency(void)
225 {
226 DEVMODEW mode;
227 BOOL ret;
228
229 memset(&mode, 0, sizeof(mode));
230 mode.dmSize = sizeof(mode);
231 ret = EnumDisplaySettingsExW(NULL, ENUM_CURRENT_SETTINGS, &mode, 0);
232 if (ret && mode.dmFields & DM_DISPLAYFREQUENCY && mode.dmDisplayFrequency)
233 {
234 return mode.dmDisplayFrequency;
235 }
236 else
237 {
238 WARN("Failed to query display frequency, returning a fallback value.\n");
239 return 60;
240 }
241 }
242
243 /**********************************************************************
244 * DwmGetCompositionTimingInfo (DWMAPI.@)
245 */
DwmGetCompositionTimingInfo(HWND hwnd,DWM_TIMING_INFO * info)246 HRESULT WINAPI DwmGetCompositionTimingInfo(HWND hwnd, DWM_TIMING_INFO *info)
247 {
248 LARGE_INTEGER performance_frequency, qpc;
249 static int i, display_frequency;
250
251 if (!info)
252 return E_INVALIDARG;
253
254 if (info->cbSize != sizeof(DWM_TIMING_INFO))
255 return MILERR_MISMATCHED_SIZE;
256
257 if(!i++) FIXME("(%p %p)\n", hwnd, info);
258
259 memset(info, 0, info->cbSize);
260 info->cbSize = sizeof(DWM_TIMING_INFO);
261
262 display_frequency = get_display_frequency();
263 info->rateRefresh.uiNumerator = display_frequency;
264 info->rateRefresh.uiDenominator = 1;
265 info->rateCompose.uiNumerator = display_frequency;
266 info->rateCompose.uiDenominator = 1;
267
268 QueryPerformanceFrequency(&performance_frequency);
269 info->qpcRefreshPeriod = performance_frequency.QuadPart / display_frequency;
270
271 QueryPerformanceCounter(&qpc);
272 info->qpcVBlank = (qpc.QuadPart / info->qpcRefreshPeriod) * info->qpcRefreshPeriod;
273
274 return S_OK;
275 }
276
277 /**********************************************************************
278 * DwmAttachMilContent (DWMAPI.@)
279 */
DwmAttachMilContent(HWND hwnd)280 HRESULT WINAPI DwmAttachMilContent(HWND hwnd)
281 {
282 FIXME("(%p) stub\n", hwnd);
283 return E_NOTIMPL;
284 }
285
286 /**********************************************************************
287 * DwmDetachMilContent (DWMAPI.@)
288 */
DwmDetachMilContent(HWND hwnd)289 HRESULT WINAPI DwmDetachMilContent(HWND hwnd)
290 {
291 FIXME("(%p) stub\n", hwnd);
292 return E_NOTIMPL;
293 }
294
295 /**********************************************************************
296 * DwmUpdateThumbnailProperties (DWMAPI.@)
297 */
DwmUpdateThumbnailProperties(HTHUMBNAIL thumbnail,const DWM_THUMBNAIL_PROPERTIES * props)298 HRESULT WINAPI DwmUpdateThumbnailProperties(HTHUMBNAIL thumbnail, const DWM_THUMBNAIL_PROPERTIES *props)
299 {
300 FIXME("(%p, %p) stub\n", thumbnail, props);
301 return E_NOTIMPL;
302 }
303
304 /**********************************************************************
305 * DwmSetPresentParameters (DWMAPI.@)
306 */
DwmSetPresentParameters(HWND hwnd,DWM_PRESENT_PARAMETERS * params)307 HRESULT WINAPI DwmSetPresentParameters(HWND hwnd, DWM_PRESENT_PARAMETERS *params)
308 {
309 FIXME("(%p %p) stub\n", hwnd, params);
310 return S_OK;
311 };
312
313 /**********************************************************************
314 * DwmSetIconicLivePreviewBitmap (DWMAPI.@)
315 */
DwmSetIconicLivePreviewBitmap(HWND hwnd,HBITMAP hbmp,POINT * pos,DWORD flags)316 HRESULT WINAPI DwmSetIconicLivePreviewBitmap(HWND hwnd, HBITMAP hbmp, POINT *pos, DWORD flags)
317 {
318 FIXME("(%p %p %p %lx) stub\n", hwnd, hbmp, pos, flags);
319 return S_OK;
320 };
321
322 /**********************************************************************
323 * DwmSetIconicThumbnail (DWMAPI.@)
324 */
DwmSetIconicThumbnail(HWND hwnd,HBITMAP hbmp,DWORD flags)325 HRESULT WINAPI DwmSetIconicThumbnail(HWND hwnd, HBITMAP hbmp, DWORD flags)
326 {
327 FIXME("(%p %p %lx) stub\n", hwnd, hbmp, flags);
328 return S_OK;
329 };
330
331 /**********************************************************************
332 * DwmpGetColorizationParameters (DWMAPI.@)
333 */
DwmpGetColorizationParameters(void * params)334 HRESULT WINAPI DwmpGetColorizationParameters(void *params)
335 {
336 FIXME("(%p) stub\n", params);
337 return E_NOTIMPL;
338 }
339