changeset 1512:50d972da558e

Added experimental Aero translucent backgrounds on Windows 7 and Vista. Enabled with -DAEROGLASS for the time being.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Wed, 28 Dec 2011 22:49:26 +0000
parents 9d342b67eed5
children def1ca619ba2
files win/dw.c
diffstat 1 files changed, 34 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/win/dw.c	Wed Dec 28 16:05:54 2011 +0000
+++ b/win/dw.c	Wed Dec 28 22:49:26 2011 +0000
@@ -26,6 +26,9 @@
 #ifdef BUILD_DLL
 #include "XBrowseForFolder.h"
 #endif
+#ifdef AEROGLASS
+#include <uxtheme.h>
+#endif
 
 #ifdef GDIPLUS
 /* GDI+ Headers are not C compatible... so define what we need here instead */
@@ -101,6 +104,10 @@
 ULONG_PTR gdiplusToken; 
 #endif
 
+#ifdef AEROGLASS
+HRESULT (WINAPI *_DwmExtendFrameIntoClientArea)(HWND hWnd, const MARGINS *pMarInset) = 0;
+#endif
+
 /*
  * MinGW Is missing a bunch of definitions
  * so #define them here...
@@ -3523,6 +3530,9 @@
 #ifdef GDIPLUS
    struct GdiplusStartupInput si; 
 #endif
+#ifdef AEROGLASS
+   HANDLE hdwm;
+#endif
 
    /* Setup the private data directory */
    if(argc > 0 && argv[0])
@@ -3560,7 +3570,11 @@
    wc.lpfnWndProc = (WNDPROC)_wndproc;
    wc.cbClsExtra = 0;
    wc.cbWndExtra = 32;
+#ifdef AEROGLASS
+   wc.hbrBackground = CreateSolidBrush(RGB(0,0,0));
+#else
    wc.hbrBackground = NULL;
+#endif
    wc.lpszMenuName = NULL;
    wc.lpszClassName = ClassName;
 
@@ -3596,7 +3610,11 @@
    wc.lpfnWndProc = (WNDPROC)_framewndproc;
    wc.cbClsExtra = 0;
    wc.cbWndExtra = 32;
+#ifdef AEROGLASS
+   wc.hbrBackground = CreateSolidBrush(RGB(0,0,0));
+#else
    wc.hbrBackground = (HBRUSH)GetSysColorBrush(COLOR_3DFACE);
+#endif
    wc.hCursor = LoadCursor(NULL, IDC_ARROW);
    wc.lpszMenuName = NULL;
    wc.lpszClassName = FRAMECLASSNAME;
@@ -3694,6 +3712,13 @@
    si.SuppressExternalCodecs = FALSE;
    GdiplusStartup(&gdiplusToken, &si, NULL);
 #endif
+
+#ifdef AEROGLASS
+   /* Attempt to load the Desktop Window Manager library */
+   if((hdwm = LoadLibrary("dwmapi")))
+      _DwmExtendFrameIntoClientArea = (HRESULT (WINAPI *)(HWND, const MARGINS *))GetProcAddress(hdwm, "DwmExtendFrameIntoClientArea");
+      
+#endif
    return 0;
 }
 
@@ -4602,6 +4627,9 @@
    HWND hwndframe;
    Box *newbox = calloc(sizeof(Box), 1);
    ULONG flStyleEx = 0;
+#ifdef AEROGLASS
+   MARGINS mar = {-1};
+#endif
 
    newbox->type = DW_VERT;
    newbox->vsize = newbox->hsize = SIZEEXPAND;
@@ -4629,6 +4657,12 @@
    if(hwndOwner)
       SetParent(hwndframe, hwndOwner);
 
+#ifdef AEROGLASS
+   /* Attempt to enable Aero glass background on the entire window */
+   if(_DwmExtendFrameIntoClientArea)
+      _DwmExtendFrameIntoClientArea(hwndframe, &mar);
+#endif
+
    return hwndframe;
 }