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 | |
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')
-rw-r--r-- | make/stub_includes/win32/WindowsDWM.h | 91 | ||||
-rw-r--r-- | make/stub_includes/win32/gluegen/windows.h (renamed from make/stub_includes/win32/windows.h) | 13 | ||||
-rw-r--r-- | make/stub_includes/win32/gluegen/wingdi.h (renamed from make/stub_includes/win32/wingdi.h) | 8 | ||||
-rw-r--r-- | make/stub_includes/win32/gluegen/wingdi_types.h (renamed from make/stub_includes/win32/wingdi_types.h) | 8 | ||||
-rw-r--r-- | make/stub_includes/win32/gluegen/winwgl.h (renamed from make/stub_includes/win32/winwgl.h) | 8 |
5 files changed, 121 insertions, 7 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 */ diff --git a/make/stub_includes/win32/windows.h b/make/stub_includes/win32/gluegen/windows.h index 9958e6d3a..46a560767 100644 --- a/make/stub_includes/win32/windows.h +++ b/make/stub_includes/win32/gluegen/windows.h @@ -1,6 +1,14 @@ /* Windows #defines and typedefs required for processing of extracts from WINGDI.H and jawt_md.h */ +/** + * These are standard include replacement files + * for gluegen processing only! + */ +#ifndef __GLUEGEN__ + #error "This file is intended to be used for GlueGen code generation, not native compilation. +#endif + #ifndef _WINDOWS_ #define _WINDOWS_ @@ -30,9 +38,12 @@ typedef HANDLE HINSTANCE; typedef HANDLE HPALETTE; typedef HANDLE HWND; typedef HANDLE HRGN; -typedef __int32 LONG; typedef const char* LPCSTR; +typedef void* PVOID; typedef void* LPVOID; +typedef const void* LPCVOID; +typedef __int32 LONG; +typedef unsigned __int32 ULONG; typedef unsigned __int64 ULONG_PTR; typedef struct _proc* PROC; typedef unsigned int* PUINT; diff --git a/make/stub_includes/win32/wingdi.h b/make/stub_includes/win32/gluegen/wingdi.h index 0fb042eb1..5914c708c 100644 --- a/make/stub_includes/win32/wingdi.h +++ b/make/stub_includes/win32/gluegen/wingdi.h @@ -9,6 +9,14 @@ * Editions / Removals and a split (wingdi.h -> wingdi.h + wingdi_types.h + winwgl.h) were made by the JogAmp Community, 2010, 2012 */ +/** + * These are standard include replacement files + * for gluegen processing only! + */ +#ifndef __GLUEGEN__ + #error "This file is intended to be used for GlueGen code generation, not native compilation. +#endif + #ifndef GDI_VERSION_1_X #define GDI_VERSION_1_X diff --git a/make/stub_includes/win32/wingdi_types.h b/make/stub_includes/win32/gluegen/wingdi_types.h index 14210bf2f..659b39e8b 100644 --- a/make/stub_includes/win32/wingdi_types.h +++ b/make/stub_includes/win32/gluegen/wingdi_types.h @@ -9,6 +9,14 @@ * Editions / Removals and a split (wingdi.h -> wingdi.h + wingdi_types.h + winwgl.h) were made by the JogAmp Community, 2010, 2012 */ +/** + * These are standard include replacement files + * for gluegen processing only! + */ +#ifndef __GLUEGEN__ + #error "This file is intended to be used for GlueGen code generation, not native compilation. +#endif + #ifndef GDI_TYPES_1_X #define GDI_TYPES_1_X diff --git a/make/stub_includes/win32/winwgl.h b/make/stub_includes/win32/gluegen/winwgl.h index cc0589574..ca743c9fe 100644 --- a/make/stub_includes/win32/winwgl.h +++ b/make/stub_includes/win32/gluegen/winwgl.h @@ -9,6 +9,14 @@ * Editions / Removals and a split (wingdi.h -> wingdi.h + wingdi_types.h + winwgl.h) were made by the JogAmp Community, 2010, 2012 */ +/** + * These are standard include replacement files + * for gluegen processing only! + */ +#ifndef __GLUEGEN__ + #error "This file is intended to be used for GlueGen code generation, not native compilation. +#endif + #ifndef WGL_GDI_VERSION_1_X #include "wingdi_types.h" |