From b3ecc88efca2a2f969e1e5a375086148821ee3c5 Mon Sep 17 00:00:00 2001
From: Sven Gothel <sgothel@jausoft.com>
Date: Sat, 26 Sep 2015 09:56:06 +0200
Subject: Bug 1232 - NEWT Translucent Decorated Windows Not Working On Windows
 >= 8 (Lack of Aero / Blur )

- Wrap GDI::DwmIsCompositionEnabled() in GDIUtil,
  so it always returns true if Windows >= 8 (even if not manifested)

- Nothing we seem to be able to do about the lack of Aero,
  i.e. blur effect of decorated windows

- Undecorated windows work well though ..
---
 .../jogamp/nativewindow/windows/GDIUtil.java       | 26 ++++++++++++++++++++++
 1 file changed, 26 insertions(+)

(limited to 'src/nativewindow/classes/jogamp')

diff --git a/src/nativewindow/classes/jogamp/nativewindow/windows/GDIUtil.java b/src/nativewindow/classes/jogamp/nativewindow/windows/GDIUtil.java
index bdf9630af..7c01d7b2e 100644
--- a/src/nativewindow/classes/jogamp/nativewindow/windows/GDIUtil.java
+++ b/src/nativewindow/classes/jogamp/nativewindow/windows/GDIUtil.java
@@ -32,6 +32,8 @@ import com.jogamp.nativewindow.NativeWindowException;
 import com.jogamp.nativewindow.NativeWindowFactory;
 
 import com.jogamp.common.ExceptionUtils;
+import com.jogamp.common.os.Platform;
+import com.jogamp.common.util.VersionNumber;
 
 import jogamp.nativewindow.NWJNILibLoader;
 import jogamp.nativewindow.Debug;
@@ -122,6 +124,30 @@ public class GDIUtil implements ToolkitProperties {
         return (Point) GetRelativeLocation0(src_win, dest_win, src_x, src_y);
     }
 
+    /**
+     * Windows >= 8, even if not manifested
+     * @see https://msdn.microsoft.com/en-us/library/windows/desktop/ms724832%28v=vs.85%29.aspx
+     */
+    private static final VersionNumber Win8Version = new VersionNumber(6, 2, 0);
+
+    /**
+     * Wrapper for {@link GDI#DwmIsCompositionEnabled()}
+     * taking the Windows 8 version into account.
+     * <p>
+     * If Windows version >= {@link #Win8Version} method always returns {@code true},
+     * otherwise value of {@link GDI#DwmIsCompositionEnabled()} is returned.
+     * </p>
+     * @see https://msdn.microsoft.com/en-us/library/windows/desktop/aa969518%28v=vs.85%29.aspx
+     */
+    public static boolean DwmIsCompositionEnabled() {
+        final VersionNumber winVer = Platform.getOSVersionNumber();
+        if( winVer.compareTo(Win8Version) >= 0 ) {
+            return true;
+        } else {
+            return GDI.DwmIsCompositionEnabled();
+        }
+    }
+
     public static boolean IsUndecorated(final long win) {
         return IsUndecorated0(win);
     }
-- 
cgit v1.2.3