From a9b3f6d13b45284e81b91a1e1e31b35c31dd3670 Mon Sep 17 00:00:00 2001
From: Sven Gothel <sgothel@jausoft.com>
Date: Thu, 1 Oct 2015 23:36:54 +0200
Subject: 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!
---
 make/stub_includes/win32/gluegen/wingdi.h | 70 +++++++++++++++++++++++++++++++
 1 file changed, 70 insertions(+)
 create mode 100644 make/stub_includes/win32/gluegen/wingdi.h

(limited to 'make/stub_includes/win32/gluegen/wingdi.h')

diff --git a/make/stub_includes/win32/gluegen/wingdi.h b/make/stub_includes/win32/gluegen/wingdi.h
new file mode 100644
index 000000000..5914c708c
--- /dev/null
+++ b/make/stub_includes/win32/gluegen/wingdi.h
@@ -0,0 +1,70 @@
+/**
+ *
+ * This file is derived from w64 mingw-runtime package's mingw64/x86_64-w64-mingw32/include/wingdi.h file
+ * and states: 
+ *
+ *     This file has no copyright assigned and is placed in the Public Domain.
+ *     No warranty is given; refer to the file DISCLAIMER.PD within this package.
+ *
+ * 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
+
+#include "wingdi_types.h"
+
+// Windows routines
+WINBASEAPI DWORD WINAPI GetLastError(VOID);
+
+// GDI / ICD OpenGL-related routines
+WINGDIAPI int   WINAPI ChoosePixelFormat(HDC, CONST PIXELFORMATDESCRIPTOR *);
+WINGDIAPI int   WINAPI DescribePixelFormat(HDC, int, UINT, LPPIXELFORMATDESCRIPTOR);
+WINGDIAPI int   WINAPI GetPixelFormat(HDC);
+WINGDIAPI BOOL  WINAPI SetPixelFormat(HDC, int, CONST PIXELFORMATDESCRIPTOR *);
+WINGDIAPI BOOL  WINAPI SwapBuffers(HDC);
+
+// Routines related to bitmap creation for off-screen rendering
+WINGDIAPI HDC     WINAPI CreateCompatibleDC(HDC);
+WINGDIAPI HBITMAP WINAPI CreateDIBSection(HDC, CONST BITMAPINFO *, UINT, VOID **, HANDLE, DWORD);
+WINGDIAPI BOOL    WINAPI DeleteDC(HDC);
+WINGDIAPI BOOL    WINAPI DeleteObject(HGDIOBJ);
+WINGDIAPI HGDIOBJ WINAPI SelectObject(HDC, HGDIOBJ);
+
+// Routines for creation of a dummy window, device context and OpenGL
+// context for the purposes of getting wglChoosePixelFormatARB and
+// associated routines
+           HINSTANCE   GetApplicationHandle();
+WINUSERAPI BOOL WINAPI ShowWindow(HWND hWnd, int nCmdShow);
+WINUSERAPI HDC  WINAPI GetDC(HWND);
+WINUSERAPI int  WINAPI ReleaseDC(HWND hWnd, HDC hDC);
+WINUSERAPI HWND WINAPI WindowFromDC(HDC hDC); // avail in >= Win2k
+WINUSERAPI BOOL WINAPI GetClientRect(HWND hwnd, LPRECT lpRect);
+WINUSERAPI BOOL WINAPI DestroyWindow(HWND hWnd);
+WINUSERAPI DWORD WINAPI GetObjectType(HGDIOBJ h);
+WINUSERAPI BOOL WINAPI IsWindowVisible(HWND hWnd);
+WINUSERAPI BOOL WINAPI IsWindow(HWND hWnd);
+WINUSERAPI HWND WINAPI GetParent(HWND hWnd);
+WINUSERAPI HWND WINAPI SetParent(HWND hWndChild,HWND hWndNewParent);
+
+WINUSERAPI HANDLE WINAPI GetCurrentProcess(void);
+WINUSERAPI HANDLE WINAPI GetCurrentThread(void);
+WINUSERAPI BOOL WINAPI GetProcessAffinityMask(HANDLE hProcess, PDWORD_PTR lpProcessAffinityMask, PDWORD_PTR lpSystemAffinityMask);
+WINUSERAPI BOOL WINAPI SetProcessAffinityMask(HANDLE hProcess, DWORD_PTR dwProcessAffinityMask);
+WINUSERAPI DWORD_PTR WINAPI SetThreadAffinityMask(HANDLE hThread, DWORD_PTR dwThreadAffinityMask);
+
+
+// Routines for changing gamma ramp of display device
+WINGDIAPI BOOL        WINAPI GetDeviceGammaRamp(HDC,LPVOID);
+WINGDIAPI BOOL        WINAPI SetDeviceGammaRamp(HDC,LPVOID);
+
+#endif /*  GDI_VERSION_1_X */
+
-- 
cgit v1.2.3