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 /src/newt/classes | |
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 'src/newt/classes')
-rw-r--r-- | src/newt/classes/jogamp/newt/driver/windows/WindowDriver.java | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/newt/classes/jogamp/newt/driver/windows/WindowDriver.java b/src/newt/classes/jogamp/newt/driver/windows/WindowDriver.java index c1aa4cb90..af5dad3ac 100644 --- a/src/newt/classes/jogamp/newt/driver/windows/WindowDriver.java +++ b/src/newt/classes/jogamp/newt/driver/windows/WindowDriver.java @@ -157,6 +157,10 @@ public class WindowDriver extends WindowImpl { if ( 0 == _windowHandle ) { throw new NativeWindowException("Error creating window"); } + if( !cfg.getChosenCapabilities().isBackgroundOpaque() ) { + GDIUtil.DwmSetupTranslucency(_windowHandle, true); + } + InitWindow0(_windowHandle, flags); setWindowHandle(_windowHandle); windowHandleClose = _windowHandle; @@ -235,7 +239,16 @@ public class WindowDriver extends WindowImpl { width = posSize[2]; height = posSize[3]; } + + final boolean changeDecoration = 0 != ( CHANGE_MASK_DECORATION & flags); + final boolean isTranslucent = !getChosenCapabilities().isBackgroundOpaque(); + if( changeDecoration && isTranslucent ) { + GDIUtil.DwmSetupTranslucency(getWindowHandle(), false); + } reconfigureWindow0( getParentWindowHandle(), getWindowHandle(), x, y, width, height, flags); + if( changeDecoration && isTranslucent ) { + GDIUtil.DwmSetupTranslucency(getWindowHandle(), true); + } if( 0 != ( CHANGE_MASK_VISIBILITY & flags) ) { visibleChanged(false, 0 != ( STATE_MASK_VISIBLE & flags)); @@ -396,6 +409,7 @@ public class WindowDriver extends WindowImpl { private native long CreateWindow0(long hInstance, String wndClassName, String wndName, int winMajor, int winMinor, long parentWindowHandle, int x, int y, int width, int height, int flags); + private native void InitWindow0(long windowHandle, int flags); private native long MonitorFromWindow0(long windowHandle); private native void reconfigureWindow0(long parentWindowHandle, long windowHandle, int x, int y, int width, int height, int flags); |