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/WindowsDWM.h           |  91 +++++++++++-
 make/stub_includes/win32/gluegen/windows.h      |  67 +++++++++
 make/stub_includes/win32/gluegen/wingdi.h       |  70 ++++++++++
 make/stub_includes/win32/gluegen/wingdi_types.h | 175 ++++++++++++++++++++++++
 make/stub_includes/win32/gluegen/winwgl.h       |  91 ++++++++++++
 make/stub_includes/win32/windows.h              |  56 --------
 make/stub_includes/win32/wingdi.h               |  62 ---------
 make/stub_includes/win32/wingdi_types.h         | 167 ----------------------
 make/stub_includes/win32/winwgl.h               |  83 -----------
 9 files changed, 488 insertions(+), 374 deletions(-)
 create mode 100644 make/stub_includes/win32/gluegen/windows.h
 create mode 100644 make/stub_includes/win32/gluegen/wingdi.h
 create mode 100644 make/stub_includes/win32/gluegen/wingdi_types.h
 create mode 100644 make/stub_includes/win32/gluegen/winwgl.h
 delete mode 100644 make/stub_includes/win32/windows.h
 delete mode 100644 make/stub_includes/win32/wingdi.h
 delete mode 100644 make/stub_includes/win32/wingdi_types.h
 delete mode 100644 make/stub_includes/win32/winwgl.h

(limited to 'make/stub_includes/win32')

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/gluegen/windows.h b/make/stub_includes/win32/gluegen/windows.h
new file mode 100644
index 000000000..46a560767
--- /dev/null
+++ b/make/stub_includes/win32/gluegen/windows.h
@@ -0,0 +1,67 @@
+/* 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_
+
+#define FAR
+#define WINBASEAPI
+#define WINGDIAPI
+#define WINUSERAPI
+#define WINAPI
+#define APIENTRY
+#define CONST const
+#define VOID void
+typedef int                 BOOL;
+typedef unsigned char       BYTE;
+typedef char                CHAR;
+typedef unsigned __int32    DWORD;
+typedef int                 INT;
+typedef __int32             INT32;
+typedef __int64             INT64;
+typedef float               FLOAT;
+typedef struct _handle*     HANDLE;
+typedef HANDLE              HBITMAP;
+typedef HANDLE              HDC;
+typedef HANDLE              HGDIOBJ;
+typedef HANDLE              HGLRC;
+typedef HANDLE              HMODULE;
+typedef HANDLE              HINSTANCE;
+typedef HANDLE              HPALETTE;
+typedef HANDLE              HWND;
+typedef HANDLE              HRGN;
+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;
+typedef unsigned int        UINT;
+typedef unsigned short      USHORT;
+typedef unsigned short      WORD;
+typedef unsigned short      ATOM;
+typedef intptr_t            DWORD_PTR;
+typedef intptr_t*           PDWORD_PTR;
+typedef __int32             HRESULT;
+
+/* Necessary handle typedefs for parsing wglext.h */
+
+typedef HANDLE              HPBUFFERARB;
+typedef HANDLE              HPBUFFEREXT;
+typedef HANDLE              HGPUNV;
+typedef HANDLE              HVIDEOOUTPUTDEVICENV;
+typedef HANDLE              HVIDEOINPUTDEVICENV;
+typedef HANDLE              HPVIDEODEV;
+
+#endif /* _WINDOWS_ */
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 */
+
diff --git a/make/stub_includes/win32/gluegen/wingdi_types.h b/make/stub_includes/win32/gluegen/wingdi_types.h
new file mode 100644
index 000000000..659b39e8b
--- /dev/null
+++ b/make/stub_includes/win32/gluegen/wingdi_types.h
@@ -0,0 +1,175 @@
+/**
+ *
+ * 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_TYPES_1_X
+#define GDI_TYPES_1_X
+
+typedef struct tagRECT {
+    LONG left;
+    LONG top;
+    LONG right;
+    LONG bottom;
+} RECT;
+
+typedef RECT*               PRECT;
+typedef RECT*               LPRECT;
+
+typedef struct tagRGBQUAD {
+    BYTE rgbBlue;
+    BYTE rgbGreen;
+    BYTE rgbRed;
+    BYTE rgbReserved;
+} RGBQUAD;
+
+typedef RGBQUAD *LPRGBQUAD;
+
+typedef struct tagBITMAPINFOHEADER {
+    DWORD biSize;
+    LONG biWidth;
+    LONG biHeight;
+    WORD biPlanes;
+    WORD biBitCount;
+    DWORD biCompression;
+    DWORD biSizeImage;
+    LONG biXPelsPerMeter;
+    LONG biYPelsPerMeter;
+    DWORD biClrUsed;
+    DWORD biClrImportant;
+} BITMAPINFOHEADER,*LPBITMAPINFOHEADER,*PBITMAPINFOHEADER;
+
+typedef struct tagBITMAPINFO {
+    BITMAPINFOHEADER bmiHeader;
+    RGBQUAD bmiColors[1];
+} BITMAPINFO,*LPBITMAPINFO,*PBITMAPINFO;
+
+/* constants for the biCompression field */
+#define BI_RGB        0
+#define BI_RLE8       1
+#define BI_RLE4       2
+#define BI_BITFIELDS  3
+
+/* DIB color table identifiers */
+
+#define DIB_RGB_COLORS      0 /* color table in RGBs */
+#define DIB_PAL_COLORS      1 /* color table in palette indices */
+
+typedef struct tagPIXELFORMATDESCRIPTOR {
+    WORD nSize;
+    WORD nVersion;
+    DWORD dwFlags;
+    BYTE iPixelType;
+    BYTE cColorBits;
+    BYTE cRedBits;
+    BYTE cRedShift;
+    BYTE cGreenBits;
+    BYTE cGreenShift;
+    BYTE cBlueBits;
+    BYTE cBlueShift;
+    BYTE cAlphaBits;
+    BYTE cAlphaShift;
+    BYTE cAccumBits;
+    BYTE cAccumRedBits;
+    BYTE cAccumGreenBits;
+    BYTE cAccumBlueBits;
+    BYTE cAccumAlphaBits;
+    BYTE cDepthBits;
+    BYTE cStencilBits;
+    BYTE cAuxBuffers;
+    BYTE iLayerType;
+    BYTE bReserved;
+    DWORD dwLayerMask;
+    DWORD dwVisibleMask;
+    DWORD dwDamageMask;
+} PIXELFORMATDESCRIPTOR,*PPIXELFORMATDESCRIPTOR,*LPPIXELFORMATDESCRIPTOR;
+
+#define PFD_TYPE_RGBA 0
+#define PFD_TYPE_COLORINDEX 1
+
+#define PFD_MAIN_PLANE 0
+#define PFD_OVERLAY_PLANE 1
+#define PFD_UNDERLAY_PLANE (-1)
+
+#define PFD_DOUBLEBUFFER 0x00000001
+#define PFD_STEREO 0x00000002
+#define PFD_DRAW_TO_WINDOW 0x00000004
+#define PFD_DRAW_TO_BITMAP 0x00000008
+#define PFD_SUPPORT_GDI 0x00000010
+#define PFD_SUPPORT_OPENGL 0x00000020
+#define PFD_GENERIC_FORMAT 0x00000040
+#define PFD_NEED_PALETTE 0x00000080
+#define PFD_NEED_SYSTEM_PALETTE 0x00000100
+#define PFD_SWAP_EXCHANGE 0x00000200
+#define PFD_SWAP_COPY 0x00000400
+#define PFD_SWAP_LAYER_BUFFERS 0x00000800
+#define PFD_GENERIC_ACCELERATED 0x00001000
+#define PFD_SUPPORT_DIRECTDRAW 0x00002000
+
+#define PFD_DEPTH_DONTCARE 0x20000000
+#define PFD_DOUBLEBUFFER_DONTCARE 0x40000000
+#define PFD_STEREO_DONTCARE 0x80000000
+
+/* error codes (from winerror.h) */
+/* FIXME: these should have a trailing "L" but apparently PCPP doesn't handle that syntax */
+#define ERROR_SUCCESS                    0
+#define ERROR_INVALID_PIXEL_FORMAT       2000
+#define ERROR_NO_SYSTEM_RESOURCES        1450
+#define ERROR_INVALID_DATA               13
+#define ERROR_PROC_NOT_FOUND             127
+#define ERROR_INVALID_WINDOW_HANDLE      1400
+
+/*
+ * ShowWindow() Commands
+ */
+#define SW_HIDE             0
+#define SW_SHOWNORMAL       1
+#define SW_NORMAL           1
+#define SW_SHOWMINIMIZED    2
+#define SW_SHOWMAXIMIZED    3
+#define SW_MAXIMIZE         3
+#define SW_SHOWNOACTIVATE   4
+#define SW_SHOW             5
+#define SW_MINIMIZE         6
+#define SW_SHOWMINNOACTIVE  7
+#define SW_SHOWNA           8
+#define SW_RESTORE          9
+#define SW_SHOWDEFAULT      10
+#define SW_FORCEMINIMIZE    11
+#define SW_MAX              11
+
+/**
+ * GetObjectType() Command
+ */
+#define OBJ_PEN 1
+#define OBJ_BRUSH 2
+#define OBJ_DC 3
+#define OBJ_METADC 4
+#define OBJ_PAL 5
+#define OBJ_FONT 6
+#define OBJ_BITMAP 7
+#define OBJ_REGION 8
+#define OBJ_METAFILE 9
+#define OBJ_MEMDC 10
+#define OBJ_EXTPEN 11
+#define OBJ_ENHMETADC 12
+#define OBJ_ENHMETAFILE 13
+#define OBJ_COLORSPACE 14
+
+#endif /* GDI_TYPES_1_X */
+
+
diff --git a/make/stub_includes/win32/gluegen/winwgl.h b/make/stub_includes/win32/gluegen/winwgl.h
new file mode 100644
index 000000000..ca743c9fe
--- /dev/null
+++ b/make/stub_includes/win32/gluegen/winwgl.h
@@ -0,0 +1,91 @@
+/**
+ *
+ * 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 WGL_GDI_VERSION_1_X
+
+#include "wingdi_types.h"
+
+/* layer types */
+#define WGL_SWAP_MAIN_PLANE 1
+#define WGL_SWAP_OVERLAY1 2
+#define WGL_SWAP_OVERLAY2 4
+#define WGL_SWAP_OVERLAY3 8
+#define WGL_SWAP_OVERLAY4 16
+#define WGL_SWAP_OVERLAY5 32
+#define WGL_SWAP_OVERLAY6 64
+#define WGL_SWAP_OVERLAY7 128
+#define WGL_SWAP_OVERLAY8 256
+#define WGL_SWAP_OVERLAY9 512
+#define WGL_SWAP_OVERLAY10 1024
+#define WGL_SWAP_OVERLAY11 2048
+#define WGL_SWAP_OVERLAY12 4096
+#define WGL_SWAP_OVERLAY13 8192
+#define WGL_SWAP_OVERLAY14 16384
+#define WGL_SWAP_OVERLAY15 32768
+#define WGL_SWAP_UNDERLAY1 65536
+#define WGL_SWAP_UNDERLAY2 0x20000
+#define WGL_SWAP_UNDERLAY3 0x40000
+#define WGL_SWAP_UNDERLAY4 0x80000
+#define WGL_SWAP_UNDERLAY5 0x100000
+#define WGL_SWAP_UNDERLAY6 0x200000
+#define WGL_SWAP_UNDERLAY7 0x400000
+#define WGL_SWAP_UNDERLAY8 0x800000
+#define WGL_SWAP_UNDERLAY9 0x1000000
+#define WGL_SWAP_UNDERLAY10 0x2000000
+#define WGL_SWAP_UNDERLAY11 0x4000000
+#define WGL_SWAP_UNDERLAY12 0x8000000
+#define WGL_SWAP_UNDERLAY13 0x10000000
+#define WGL_SWAP_UNDERLAY14 0x20000000
+#define WGL_SWAP_UNDERLAY15 0x40000000
+
+#endif /*  WGL_GDI_VERSION_1_X */
+
+#ifndef WGL_GDI_VERSION_1_X
+#define WGL_GDI_VERSION_1_X
+
+WINGDIAPI BOOL  WINAPI wglCopyContext(HGLRC,HGLRC,UINT);
+WINGDIAPI HGLRC WINAPI wglCreateContext(HDC);
+WINGDIAPI BOOL  WINAPI wglDeleteContext(HGLRC);
+WINGDIAPI HGLRC WINAPI wglGetCurrentContext(VOID);
+WINGDIAPI HDC   WINAPI wglGetCurrentDC(VOID);
+WINGDIAPI BOOL  WINAPI wglMakeCurrent(HDC, HGLRC);
+WINGDIAPI BOOL  WINAPI wglShareLists(HGLRC, HGLRC);
+WINGDIAPI PROC  WINAPI wglGetProcAddress(LPCSTR);
+WINGDIAPI BOOL  WINAPI wglSwapLayerBuffers(HDC,UINT);
+
+// Runtime Link GDI/OpenGL-related routines
+WINGDIAPI int   WINAPI wglChoosePixelFormat(HDC, CONST PIXELFORMATDESCRIPTOR *);
+WINGDIAPI int   WINAPI wglDescribePixelFormat(HDC, int, UINT, LPPIXELFORMATDESCRIPTOR);
+WINGDIAPI int   WINAPI wglGetPixelFormat(HDC);
+WINGDIAPI BOOL  WINAPI wglSetPixelFormat(HDC, int, CONST PIXELFORMATDESCRIPTOR *);
+WINGDIAPI BOOL  WINAPI wglSwapBuffers(HDC);
+
+/* --- FIXME: need to handle these entry points! 
+WINGDIAPI HGLRC WINAPI wglCreateLayerContext(HDC, int);
+WINGDIAPI BOOL  WINAPI wglUseFontBitmapsA(HDC, DWORD, DWORD, DWORD);
+WINGDIAPI BOOL  WINAPI wglUseFontBitmapsW(HDC, DWORD, DWORD, DWORD);
+#ifdef UNICODE
+#define wglUseFontBitmaps  wglUseFontBitmapsW
+#else
+#define wglUseFontBitmaps  wglUseFontBitmapsA
+#endif // !UNICODE
+*/
+
+#endif /*  WGL_GDI_VERSION_1_X */
+
diff --git a/make/stub_includes/win32/windows.h b/make/stub_includes/win32/windows.h
deleted file mode 100644
index 9958e6d3a..000000000
--- a/make/stub_includes/win32/windows.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/* Windows #defines and typedefs required for processing of extracts
-   from WINGDI.H and jawt_md.h */
-
-#ifndef _WINDOWS_
-#define _WINDOWS_
-
-#define FAR
-#define WINBASEAPI
-#define WINGDIAPI
-#define WINUSERAPI
-#define WINAPI
-#define APIENTRY
-#define CONST const
-#define VOID void
-typedef int                 BOOL;
-typedef unsigned char       BYTE;
-typedef char                CHAR;
-typedef unsigned __int32    DWORD;
-typedef int                 INT;
-typedef __int32             INT32;
-typedef __int64             INT64;
-typedef float               FLOAT;
-typedef struct _handle*     HANDLE;
-typedef HANDLE              HBITMAP;
-typedef HANDLE              HDC;
-typedef HANDLE              HGDIOBJ;
-typedef HANDLE              HGLRC;
-typedef HANDLE              HMODULE;
-typedef HANDLE              HINSTANCE;
-typedef HANDLE              HPALETTE;
-typedef HANDLE              HWND;
-typedef HANDLE              HRGN;
-typedef __int32             LONG;
-typedef const char*         LPCSTR;
-typedef void*               LPVOID;
-typedef unsigned __int64    ULONG_PTR;
-typedef struct _proc*       PROC;
-typedef unsigned int*       PUINT;
-typedef unsigned int        UINT;
-typedef unsigned short      USHORT;
-typedef unsigned short      WORD;
-typedef unsigned short      ATOM;
-typedef intptr_t            DWORD_PTR;
-typedef intptr_t*           PDWORD_PTR;
-typedef __int32             HRESULT;
-
-/* Necessary handle typedefs for parsing wglext.h */
-
-typedef HANDLE              HPBUFFERARB;
-typedef HANDLE              HPBUFFEREXT;
-typedef HANDLE              HGPUNV;
-typedef HANDLE              HVIDEOOUTPUTDEVICENV;
-typedef HANDLE              HVIDEOINPUTDEVICENV;
-typedef HANDLE              HPVIDEODEV;
-
-#endif /* _WINDOWS_ */
diff --git a/make/stub_includes/win32/wingdi.h b/make/stub_includes/win32/wingdi.h
deleted file mode 100644
index 0fb042eb1..000000000
--- a/make/stub_includes/win32/wingdi.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/**
- *
- * 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
- */
-
-#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 */
-
diff --git a/make/stub_includes/win32/wingdi_types.h b/make/stub_includes/win32/wingdi_types.h
deleted file mode 100644
index 14210bf2f..000000000
--- a/make/stub_includes/win32/wingdi_types.h
+++ /dev/null
@@ -1,167 +0,0 @@
-/**
- *
- * 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
- */
-
-#ifndef GDI_TYPES_1_X
-#define GDI_TYPES_1_X
-
-typedef struct tagRECT {
-    LONG left;
-    LONG top;
-    LONG right;
-    LONG bottom;
-} RECT;
-
-typedef RECT*               PRECT;
-typedef RECT*               LPRECT;
-
-typedef struct tagRGBQUAD {
-    BYTE rgbBlue;
-    BYTE rgbGreen;
-    BYTE rgbRed;
-    BYTE rgbReserved;
-} RGBQUAD;
-
-typedef RGBQUAD *LPRGBQUAD;
-
-typedef struct tagBITMAPINFOHEADER {
-    DWORD biSize;
-    LONG biWidth;
-    LONG biHeight;
-    WORD biPlanes;
-    WORD biBitCount;
-    DWORD biCompression;
-    DWORD biSizeImage;
-    LONG biXPelsPerMeter;
-    LONG biYPelsPerMeter;
-    DWORD biClrUsed;
-    DWORD biClrImportant;
-} BITMAPINFOHEADER,*LPBITMAPINFOHEADER,*PBITMAPINFOHEADER;
-
-typedef struct tagBITMAPINFO {
-    BITMAPINFOHEADER bmiHeader;
-    RGBQUAD bmiColors[1];
-} BITMAPINFO,*LPBITMAPINFO,*PBITMAPINFO;
-
-/* constants for the biCompression field */
-#define BI_RGB        0
-#define BI_RLE8       1
-#define BI_RLE4       2
-#define BI_BITFIELDS  3
-
-/* DIB color table identifiers */
-
-#define DIB_RGB_COLORS      0 /* color table in RGBs */
-#define DIB_PAL_COLORS      1 /* color table in palette indices */
-
-typedef struct tagPIXELFORMATDESCRIPTOR {
-    WORD nSize;
-    WORD nVersion;
-    DWORD dwFlags;
-    BYTE iPixelType;
-    BYTE cColorBits;
-    BYTE cRedBits;
-    BYTE cRedShift;
-    BYTE cGreenBits;
-    BYTE cGreenShift;
-    BYTE cBlueBits;
-    BYTE cBlueShift;
-    BYTE cAlphaBits;
-    BYTE cAlphaShift;
-    BYTE cAccumBits;
-    BYTE cAccumRedBits;
-    BYTE cAccumGreenBits;
-    BYTE cAccumBlueBits;
-    BYTE cAccumAlphaBits;
-    BYTE cDepthBits;
-    BYTE cStencilBits;
-    BYTE cAuxBuffers;
-    BYTE iLayerType;
-    BYTE bReserved;
-    DWORD dwLayerMask;
-    DWORD dwVisibleMask;
-    DWORD dwDamageMask;
-} PIXELFORMATDESCRIPTOR,*PPIXELFORMATDESCRIPTOR,*LPPIXELFORMATDESCRIPTOR;
-
-#define PFD_TYPE_RGBA 0
-#define PFD_TYPE_COLORINDEX 1
-
-#define PFD_MAIN_PLANE 0
-#define PFD_OVERLAY_PLANE 1
-#define PFD_UNDERLAY_PLANE (-1)
-
-#define PFD_DOUBLEBUFFER 0x00000001
-#define PFD_STEREO 0x00000002
-#define PFD_DRAW_TO_WINDOW 0x00000004
-#define PFD_DRAW_TO_BITMAP 0x00000008
-#define PFD_SUPPORT_GDI 0x00000010
-#define PFD_SUPPORT_OPENGL 0x00000020
-#define PFD_GENERIC_FORMAT 0x00000040
-#define PFD_NEED_PALETTE 0x00000080
-#define PFD_NEED_SYSTEM_PALETTE 0x00000100
-#define PFD_SWAP_EXCHANGE 0x00000200
-#define PFD_SWAP_COPY 0x00000400
-#define PFD_SWAP_LAYER_BUFFERS 0x00000800
-#define PFD_GENERIC_ACCELERATED 0x00001000
-#define PFD_SUPPORT_DIRECTDRAW 0x00002000
-
-#define PFD_DEPTH_DONTCARE 0x20000000
-#define PFD_DOUBLEBUFFER_DONTCARE 0x40000000
-#define PFD_STEREO_DONTCARE 0x80000000
-
-/* error codes (from winerror.h) */
-/* FIXME: these should have a trailing "L" but apparently PCPP doesn't handle that syntax */
-#define ERROR_SUCCESS                    0
-#define ERROR_INVALID_PIXEL_FORMAT       2000
-#define ERROR_NO_SYSTEM_RESOURCES        1450
-#define ERROR_INVALID_DATA               13
-#define ERROR_PROC_NOT_FOUND             127
-#define ERROR_INVALID_WINDOW_HANDLE      1400
-
-/*
- * ShowWindow() Commands
- */
-#define SW_HIDE             0
-#define SW_SHOWNORMAL       1
-#define SW_NORMAL           1
-#define SW_SHOWMINIMIZED    2
-#define SW_SHOWMAXIMIZED    3
-#define SW_MAXIMIZE         3
-#define SW_SHOWNOACTIVATE   4
-#define SW_SHOW             5
-#define SW_MINIMIZE         6
-#define SW_SHOWMINNOACTIVE  7
-#define SW_SHOWNA           8
-#define SW_RESTORE          9
-#define SW_SHOWDEFAULT      10
-#define SW_FORCEMINIMIZE    11
-#define SW_MAX              11
-
-/**
- * GetObjectType() Command
- */
-#define OBJ_PEN 1
-#define OBJ_BRUSH 2
-#define OBJ_DC 3
-#define OBJ_METADC 4
-#define OBJ_PAL 5
-#define OBJ_FONT 6
-#define OBJ_BITMAP 7
-#define OBJ_REGION 8
-#define OBJ_METAFILE 9
-#define OBJ_MEMDC 10
-#define OBJ_EXTPEN 11
-#define OBJ_ENHMETADC 12
-#define OBJ_ENHMETAFILE 13
-#define OBJ_COLORSPACE 14
-
-#endif /* GDI_TYPES_1_X */
-
-
diff --git a/make/stub_includes/win32/winwgl.h b/make/stub_includes/win32/winwgl.h
deleted file mode 100644
index cc0589574..000000000
--- a/make/stub_includes/win32/winwgl.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/**
- *
- * 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
- */
-
-#ifndef WGL_GDI_VERSION_1_X
-
-#include "wingdi_types.h"
-
-/* layer types */
-#define WGL_SWAP_MAIN_PLANE 1
-#define WGL_SWAP_OVERLAY1 2
-#define WGL_SWAP_OVERLAY2 4
-#define WGL_SWAP_OVERLAY3 8
-#define WGL_SWAP_OVERLAY4 16
-#define WGL_SWAP_OVERLAY5 32
-#define WGL_SWAP_OVERLAY6 64
-#define WGL_SWAP_OVERLAY7 128
-#define WGL_SWAP_OVERLAY8 256
-#define WGL_SWAP_OVERLAY9 512
-#define WGL_SWAP_OVERLAY10 1024
-#define WGL_SWAP_OVERLAY11 2048
-#define WGL_SWAP_OVERLAY12 4096
-#define WGL_SWAP_OVERLAY13 8192
-#define WGL_SWAP_OVERLAY14 16384
-#define WGL_SWAP_OVERLAY15 32768
-#define WGL_SWAP_UNDERLAY1 65536
-#define WGL_SWAP_UNDERLAY2 0x20000
-#define WGL_SWAP_UNDERLAY3 0x40000
-#define WGL_SWAP_UNDERLAY4 0x80000
-#define WGL_SWAP_UNDERLAY5 0x100000
-#define WGL_SWAP_UNDERLAY6 0x200000
-#define WGL_SWAP_UNDERLAY7 0x400000
-#define WGL_SWAP_UNDERLAY8 0x800000
-#define WGL_SWAP_UNDERLAY9 0x1000000
-#define WGL_SWAP_UNDERLAY10 0x2000000
-#define WGL_SWAP_UNDERLAY11 0x4000000
-#define WGL_SWAP_UNDERLAY12 0x8000000
-#define WGL_SWAP_UNDERLAY13 0x10000000
-#define WGL_SWAP_UNDERLAY14 0x20000000
-#define WGL_SWAP_UNDERLAY15 0x40000000
-
-#endif /*  WGL_GDI_VERSION_1_X */
-
-#ifndef WGL_GDI_VERSION_1_X
-#define WGL_GDI_VERSION_1_X
-
-WINGDIAPI BOOL  WINAPI wglCopyContext(HGLRC,HGLRC,UINT);
-WINGDIAPI HGLRC WINAPI wglCreateContext(HDC);
-WINGDIAPI BOOL  WINAPI wglDeleteContext(HGLRC);
-WINGDIAPI HGLRC WINAPI wglGetCurrentContext(VOID);
-WINGDIAPI HDC   WINAPI wglGetCurrentDC(VOID);
-WINGDIAPI BOOL  WINAPI wglMakeCurrent(HDC, HGLRC);
-WINGDIAPI BOOL  WINAPI wglShareLists(HGLRC, HGLRC);
-WINGDIAPI PROC  WINAPI wglGetProcAddress(LPCSTR);
-WINGDIAPI BOOL  WINAPI wglSwapLayerBuffers(HDC,UINT);
-
-// Runtime Link GDI/OpenGL-related routines
-WINGDIAPI int   WINAPI wglChoosePixelFormat(HDC, CONST PIXELFORMATDESCRIPTOR *);
-WINGDIAPI int   WINAPI wglDescribePixelFormat(HDC, int, UINT, LPPIXELFORMATDESCRIPTOR);
-WINGDIAPI int   WINAPI wglGetPixelFormat(HDC);
-WINGDIAPI BOOL  WINAPI wglSetPixelFormat(HDC, int, CONST PIXELFORMATDESCRIPTOR *);
-WINGDIAPI BOOL  WINAPI wglSwapBuffers(HDC);
-
-/* --- FIXME: need to handle these entry points! 
-WINGDIAPI HGLRC WINAPI wglCreateLayerContext(HDC, int);
-WINGDIAPI BOOL  WINAPI wglUseFontBitmapsA(HDC, DWORD, DWORD, DWORD);
-WINGDIAPI BOOL  WINAPI wglUseFontBitmapsW(HDC, DWORD, DWORD, DWORD);
-#ifdef UNICODE
-#define wglUseFontBitmaps  wglUseFontBitmapsW
-#else
-#define wglUseFontBitmaps  wglUseFontBitmapsA
-#endif // !UNICODE
-*/
-
-#endif /*  WGL_GDI_VERSION_1_X */
-
-- 
cgit v1.2.3