Mercurial > dwindows
comparison win/dw.c @ 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 | 9b2600034473 |
children | f33dca736917 |
comparison
equal
deleted
inserted
replaced
1511:9d342b67eed5 | 1512:50d972da558e |
---|---|
23 #include <time.h> | 23 #include <time.h> |
24 #include <math.h> | 24 #include <math.h> |
25 #include "dw.h" | 25 #include "dw.h" |
26 #ifdef BUILD_DLL | 26 #ifdef BUILD_DLL |
27 #include "XBrowseForFolder.h" | 27 #include "XBrowseForFolder.h" |
28 #endif | |
29 #ifdef AEROGLASS | |
30 #include <uxtheme.h> | |
28 #endif | 31 #endif |
29 | 32 |
30 #ifdef GDIPLUS | 33 #ifdef GDIPLUS |
31 /* GDI+ Headers are not C compatible... so define what we need here instead */ | 34 /* GDI+ Headers are not C compatible... so define what we need here instead */ |
32 struct GdiplusStartupInput | 35 struct GdiplusStartupInput |
97 #define PixelFormat64bppPARGB (14 | (64 << 8) | PixelFormatAlpha | PixelFormatPAlpha | PixelFormatExtended) | 100 #define PixelFormat64bppPARGB (14 | (64 << 8) | PixelFormatAlpha | PixelFormatPAlpha | PixelFormatExtended) |
98 #define PixelFormat32bppCMYK (15 | (32 << 8)) | 101 #define PixelFormat32bppCMYK (15 | (32 << 8)) |
99 | 102 |
100 /* Token to the GDI+ Instance */ | 103 /* Token to the GDI+ Instance */ |
101 ULONG_PTR gdiplusToken; | 104 ULONG_PTR gdiplusToken; |
105 #endif | |
106 | |
107 #ifdef AEROGLASS | |
108 HRESULT (WINAPI *_DwmExtendFrameIntoClientArea)(HWND hWnd, const MARGINS *pMarInset) = 0; | |
102 #endif | 109 #endif |
103 | 110 |
104 /* | 111 /* |
105 * MinGW Is missing a bunch of definitions | 112 * MinGW Is missing a bunch of definitions |
106 * so #define them here... | 113 * so #define them here... |
3521 INITCOMMONCONTROLSEX icc; | 3528 INITCOMMONCONTROLSEX icc; |
3522 char *alttmpdir; | 3529 char *alttmpdir; |
3523 #ifdef GDIPLUS | 3530 #ifdef GDIPLUS |
3524 struct GdiplusStartupInput si; | 3531 struct GdiplusStartupInput si; |
3525 #endif | 3532 #endif |
3533 #ifdef AEROGLASS | |
3534 HANDLE hdwm; | |
3535 #endif | |
3526 | 3536 |
3527 /* Setup the private data directory */ | 3537 /* Setup the private data directory */ |
3528 if(argc > 0 && argv[0]) | 3538 if(argc > 0 && argv[0]) |
3529 { | 3539 { |
3530 char *pos = strrchr(argv[0], '\\'); | 3540 char *pos = strrchr(argv[0], '\\'); |
3558 memset(&wc, 0, sizeof(WNDCLASS)); | 3568 memset(&wc, 0, sizeof(WNDCLASS)); |
3559 wc.style = CS_DBLCLKS; | 3569 wc.style = CS_DBLCLKS; |
3560 wc.lpfnWndProc = (WNDPROC)_wndproc; | 3570 wc.lpfnWndProc = (WNDPROC)_wndproc; |
3561 wc.cbClsExtra = 0; | 3571 wc.cbClsExtra = 0; |
3562 wc.cbWndExtra = 32; | 3572 wc.cbWndExtra = 32; |
3573 #ifdef AEROGLASS | |
3574 wc.hbrBackground = CreateSolidBrush(RGB(0,0,0)); | |
3575 #else | |
3563 wc.hbrBackground = NULL; | 3576 wc.hbrBackground = NULL; |
3577 #endif | |
3564 wc.lpszMenuName = NULL; | 3578 wc.lpszMenuName = NULL; |
3565 wc.lpszClassName = ClassName; | 3579 wc.lpszClassName = ClassName; |
3566 | 3580 |
3567 RegisterClass(&wc); | 3581 RegisterClass(&wc); |
3568 | 3582 |
3594 memset(&wc, 0, sizeof(WNDCLASS)); | 3608 memset(&wc, 0, sizeof(WNDCLASS)); |
3595 wc.style = CS_DBLCLKS; | 3609 wc.style = CS_DBLCLKS; |
3596 wc.lpfnWndProc = (WNDPROC)_framewndproc; | 3610 wc.lpfnWndProc = (WNDPROC)_framewndproc; |
3597 wc.cbClsExtra = 0; | 3611 wc.cbClsExtra = 0; |
3598 wc.cbWndExtra = 32; | 3612 wc.cbWndExtra = 32; |
3613 #ifdef AEROGLASS | |
3614 wc.hbrBackground = CreateSolidBrush(RGB(0,0,0)); | |
3615 #else | |
3599 wc.hbrBackground = (HBRUSH)GetSysColorBrush(COLOR_3DFACE); | 3616 wc.hbrBackground = (HBRUSH)GetSysColorBrush(COLOR_3DFACE); |
3617 #endif | |
3600 wc.hCursor = LoadCursor(NULL, IDC_ARROW); | 3618 wc.hCursor = LoadCursor(NULL, IDC_ARROW); |
3601 wc.lpszMenuName = NULL; | 3619 wc.lpszMenuName = NULL; |
3602 wc.lpszClassName = FRAMECLASSNAME; | 3620 wc.lpszClassName = FRAMECLASSNAME; |
3603 | 3621 |
3604 RegisterClass(&wc); | 3622 RegisterClass(&wc); |
3691 si.GdiplusVersion = 1; | 3709 si.GdiplusVersion = 1; |
3692 si.DebugEventCallback = NULL; | 3710 si.DebugEventCallback = NULL; |
3693 si.SuppressBackgroundThread = FALSE; | 3711 si.SuppressBackgroundThread = FALSE; |
3694 si.SuppressExternalCodecs = FALSE; | 3712 si.SuppressExternalCodecs = FALSE; |
3695 GdiplusStartup(&gdiplusToken, &si, NULL); | 3713 GdiplusStartup(&gdiplusToken, &si, NULL); |
3714 #endif | |
3715 | |
3716 #ifdef AEROGLASS | |
3717 /* Attempt to load the Desktop Window Manager library */ | |
3718 if((hdwm = LoadLibrary("dwmapi"))) | |
3719 _DwmExtendFrameIntoClientArea = (HRESULT (WINAPI *)(HWND, const MARGINS *))GetProcAddress(hdwm, "DwmExtendFrameIntoClientArea"); | |
3720 | |
3696 #endif | 3721 #endif |
3697 return 0; | 3722 return 0; |
3698 } | 3723 } |
3699 | 3724 |
3700 /* | 3725 /* |
4600 HWND API dw_window_new(HWND hwndOwner, char *title, ULONG flStyle) | 4625 HWND API dw_window_new(HWND hwndOwner, char *title, ULONG flStyle) |
4601 { | 4626 { |
4602 HWND hwndframe; | 4627 HWND hwndframe; |
4603 Box *newbox = calloc(sizeof(Box), 1); | 4628 Box *newbox = calloc(sizeof(Box), 1); |
4604 ULONG flStyleEx = 0; | 4629 ULONG flStyleEx = 0; |
4630 #ifdef AEROGLASS | |
4631 MARGINS mar = {-1}; | |
4632 #endif | |
4605 | 4633 |
4606 newbox->type = DW_VERT; | 4634 newbox->type = DW_VERT; |
4607 newbox->vsize = newbox->hsize = SIZEEXPAND; | 4635 newbox->vsize = newbox->hsize = SIZEEXPAND; |
4608 newbox->cinfo.fore = newbox->cinfo.back = -1; | 4636 newbox->cinfo.fore = newbox->cinfo.back = -1; |
4609 | 4637 |
4626 } | 4654 } |
4627 SetWindowLongPtr(hwndframe, GWLP_USERDATA, (LONG_PTR)newbox); | 4655 SetWindowLongPtr(hwndframe, GWLP_USERDATA, (LONG_PTR)newbox); |
4628 | 4656 |
4629 if(hwndOwner) | 4657 if(hwndOwner) |
4630 SetParent(hwndframe, hwndOwner); | 4658 SetParent(hwndframe, hwndOwner); |
4659 | |
4660 #ifdef AEROGLASS | |
4661 /* Attempt to enable Aero glass background on the entire window */ | |
4662 if(_DwmExtendFrameIntoClientArea) | |
4663 _DwmExtendFrameIntoClientArea(hwndframe, &mar); | |
4664 #endif | |
4631 | 4665 |
4632 return hwndframe; | 4666 return hwndframe; |
4633 } | 4667 } |
4634 | 4668 |
4635 /* | 4669 /* |