diff options
author | Sven Gothel <[email protected]> | 2015-10-01 23:36:54 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2015-10-01 23:36:54 +0200 |
commit | a9b3f6d13b45284e81b91a1e1e31b35c31dd3670 (patch) | |
tree | 1a2550bc440cb27476d9d9a328600dc4b5fb296b /make/stub_includes/win32/WindowsDWM.h | |
parent | 4b0be44f54a7d89192c03725a16e396eba98a712 (diff) |
Bug 1232 - NEWT Translucent Decorated Windows Not Working On Windows >= 8 (Lack of Aero / Blur )
Adopting new undocumented user32.dll Windows >= 8 API:
- SetWindowCompositionAttribute / AccentState
See:
- <https://github.com/riverar/sample-win10-aeroglass/blob/master/MainWindow.xaml.cs>
- <http://withinrafael.com/adding-the-aero-glass-blur-to-your-windows-10-apps/>
- <http://undoc.airesoft.co.uk/user32.dll/SetWindowCompositionAttribute.php>
- <http://undoc.airesoft.co.uk/user32.dll/GetWindowCompositionAttribute.php>
+++
Cleaning up WindowsDWM.h, use on header file (in stub_includes)
for GlueGen and implementation.
+++
Merge java implementation within GDIUtil.DwmSetupTranslucency(..),
to be utilized by NEWT and JOGL.
NEWT issues GDIUtil.DwmSetupTranslucency(..) at creation
and when toggling decoration.
Toggling decoration on Win >= 8 leads to lost of translucency
when returning to decorated window.
On Win 7, this may work .. but is also buggy.
+++
Followup patch is needed for NEWT to _not_ clear the background!
Diffstat (limited to 'make/stub_includes/win32/WindowsDWM.h')
-rw-r--r-- | make/stub_includes/win32/WindowsDWM.h | 91 |
1 files changed, 85 insertions, 6 deletions
diff --git a/make/stub_includes/win32/WindowsDWM.h b/make/stub_includes/win32/WindowsDWM.h index 2115a5908..247464afd 100644 --- a/make/stub_includes/win32/WindowsDWM.h +++ b/make/stub_includes/win32/WindowsDWM.h @@ -1,3 +1,6 @@ +#include <windows.h> +#include <stdint.h> + #ifndef WGL_DWM_VERSION_1_X #define DWM_BB_ENABLE 0x00000001 @@ -6,19 +9,44 @@ #define DWM_EC_DISABLECOMPOSITION 0 #define DWM_EC_ENABLECOMPOSITION 1 +typedef enum _DWMWINDOWATTRIBUTE { + DWMWA_NCRENDERING_ENABLED = 1, + DWMWA_NCRENDERING_POLICY, + DWMWA_TRANSITIONS_FORCEDISABLED, + DWMWA_ALLOW_NCPAINT, + DWMWA_CAPTION_BUTTON_BOUNDS, + DWMWA_NONCLIENT_RTL_LAYOUT, + DWMWA_FORCE_ICONIC_REPRESENTATION, + DWMWA_FLIP3D_POLICY, + DWMWA_EXTENDED_FRAME_BOUNDS, + DWMWA_HAS_ICONIC_BITMAP, + DWMWA_DISALLOW_PEEK, + DWMWA_EXCLUDED_FROM_PEEK, + DWMWA_CLOAK, + DWMWA_CLOAKED, + DWMWA_FREEZE_REPRESENTATION, + DWMWA_LAST +} DWMWINDOWATTRIBUTE; + +typedef enum _DWMNCRENDERINGPOLICY { + DWMNCRP_USEWINDOWSTYLE = 0, + DWMNCRP_DISABLED, + DWMNCRP_ENABLED, + DWMNCRP_LAST +} DWMNCRENDERINGPOLICY; typedef struct tagDWM_BLURBEHIND { DWORD dwFlags; - int fEnable; /* BOOL */ + int32_t fEnable; /* BOOL */ HRGN hRgnBlur; - int fTransitionOnMaximized; /* BOOL */ + int32_t fTransitionOnMaximized; /* BOOL */ } DWM_BLURBEHIND, *PDWM_BLURBEHIND; typedef struct tagMARGINS { - int cxLeftWidth; - int cxRightWidth; - int cyTopHeight; - int cyBottomHeight; + int32_t cxLeftWidth; + int32_t cxRightWidth; + int32_t cyTopHeight; + int32_t cyBottomHeight; } MARGINS, *PMARGINS; #endif /* WGL_DWM_VERSION_1_X */ @@ -31,6 +59,57 @@ BOOL DwmIsCompositionEnabled(); BOOL DwmEnableComposition( UINT uCompositionAction ); BOOL DwmEnableBlurBehindWindow(HWND, CONST DWM_BLURBEHIND *); BOOL DwmExtendFrameIntoClientArea(HWND, CONST MARGINS *); +HRESULT DwmGetWindowAttribute(HWND hwnd, DWORD dwAttribute, PVOID pvAttribute, DWORD cbAttribute); +HRESULT DwmSetWindowAttribute(HWND hwnd, DWORD dwAttribute, LPCVOID pvAttribute, DWORD cbAttribute); #endif /* WGL_DWM_VERSION_1_X */ +#ifndef WGL_WINCOMP_VERSION_0_X + +typedef enum _AccentState { + ACCENT_DISABLED = 0, + ACCENT_ENABLE_GRADIENT = 1, + ACCENT_ENABLE_TRANSPARENTGRADIENT = 2, + ACCENT_ENABLE_BLURBEHIND = 3, + ACCENT_INVALID_STATE = 4 +} AccentState; + +typedef struct _AccentPolicy { + AccentState AccentState; + int32_t AccentFlags; + int32_t GradientColor; + int32_t AnimationId; +} AccentPolicy; + + +#ifndef __GLUEGEN__ + +typedef enum _WindowCompositionAttribute { + WCA_ACCENT_POLICY = 19 +} WindowCompositionAttribute; + +typedef struct _WINCOMPATTRDATA { + /** The attribute to query */ + WindowCompositionAttribute attribute; + /** result storage */ + PVOID pData; + /** size of the result storage */ + ULONG dataSize; +} WINCOMPATTRDATA; + +#endif + +#endif /* WGL_WINCOMP_VERSION_0_X */ + +#ifndef WGL_WINCOMP_VERSION_0_X +#define WGL_WINCOMP_VERSION_0_X + +BOOL IsWindowCompositionExtensionAvailable(); +BOOL GetWindowCompositionAccentPolicy(HWND hwnd, AccentPolicy* pAccentPolicy); +BOOL SetWindowCompositionAccentPolicy(HWND hwnd, const AccentPolicy* pAccentPolicy); +#if 0 + BOOL GetWindowCompositionAttribute(HWND hwnd, WINCOMPATTRDATA* pAttrData); + BOOL SetWindowCompositionAttribute(HWND hwnd, WINCOMPATTRDATA* pAttrData); +#endif + +#endif /* WGL_WINCOMP_VERSION_0_X */ |