Mercurial > dwindows
diff win/dw.c @ 1535:2913bb58f439
Added DW_FCF_COMPOSITED frame creation flag, used only on Windows currently...
it enabled composited (translucent) windows on supported versions of Windows (7 and Vista).
Deprecated the DW_FCF_VERTSCROLL and DW_FCF_HORZSCROLL flags... use scrollboxes instead.
Removed a terrible hack of using the WS_VSCROLL flag to pass task list... applications
require a recompile so we will still handle the old WS_VSCROLL flag until version 3.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Wed, 11 Jan 2012 05:36:00 +0000 |
parents | 6c55d68fd08a |
children | a71ec02f3b70 |
line wrap: on
line diff
--- a/win/dw.c Mon Jan 09 16:04:00 2012 +0000 +++ b/win/dw.c Wed Jan 11 05:36:00 2012 +0000 @@ -1060,7 +1060,7 @@ GetClassName(handle, tmpbuf, 99); - if(strnicmp(tmpbuf, ClassName, strlen(ClassName))!=0) + if(strnicmp(tmpbuf, ClassName, strlen(ClassName)+1)!=0) return; @@ -2086,11 +2086,27 @@ { #ifdef AEROGLASS case WM_DWMCOMPOSITIONCHANGED: - if(_DwmIsCompositionEnabled) - _DwmIsCompositionEnabled(&_dw_composition); + { + DWORD styleex = GetWindowLongPtr(hWnd, GWL_EXSTYLE); + + if(_DwmIsCompositionEnabled) + _DwmIsCompositionEnabled(&_dw_composition); + + /* If we are no longer compositing... disable layered windows */ + if(!_dw_composition && (styleex & WS_EX_LAYERED)) + { + MARGINS mar = {0}; + + SetWindowLongPtr(hWnd, GWL_EXSTYLE, styleex & ~WS_EX_LAYERED); + if(_DwmExtendFrameIntoClientArea) + _DwmExtendFrameIntoClientArea(hWnd, &mar); + } + } break; +#endif +#ifdef AEROGLASS1 case WM_ERASEBKGND: - if(_dw_composition) + if(_dw_composition && (GetWindowLongPtr(hWnd, GWL_EXSTYLE) & WS_EX_LAYERED)) { static HBRUSH hbrush = 0; RECT rect; @@ -2100,8 +2116,9 @@ GetClientRect(hWnd, &rect); FillRect((HDC)mp1, &rect, hbrush); - } - return TRUE; + return TRUE; + } + break; #endif case WM_PAINT: { @@ -2266,7 +2283,7 @@ break; #ifdef AEROGLASS case WM_ERASEBKGND: - if(_dw_composition) + if(_dw_composition && (GetWindowLongPtr(_toplevel_window(hWnd), GWL_EXSTYLE) & WS_EX_LAYERED)) { static HBRUSH hbrush = 0; RECT rect; @@ -2276,8 +2293,9 @@ GetClientRect(hWnd, &rect); FillRect((HDC)mp1, &rect, hbrush); - } - return TRUE; + return TRUE; + } + break; #endif case WM_PAINT: { @@ -2733,8 +2751,9 @@ case WM_CTLCOLORBTN: case WM_CTLCOLORDLG: { - if(_dw_composition && (!thiscinfo || (thiscinfo && - (thiscinfo->back == -1 || thiscinfo->back == DW_RGB_TRANSPARENT)))) + + if((_dw_composition && GetWindowLongPtr(_toplevel_window(hWnd), GWL_EXSTYLE) & WS_EX_LAYERED) && + (!thiscinfo || (thiscinfo && (thiscinfo->back == -1 || thiscinfo->back == DW_RGB_TRANSPARENT)))) { if(!(msg == WM_CTLCOLORSTATIC && SendMessage((HWND)mp2, STM_GETIMAGE, IMAGE_BITMAP, 0))) { @@ -4631,7 +4650,7 @@ #ifdef AEROGLASS MARGINS mar = {-1}; - if(_dw_composition) + if(_dw_composition && (flStyle & DW_FCF_COMPOSITED)) flStyleEx = WS_EX_LAYERED; #endif @@ -4642,18 +4661,17 @@ if(!(flStyle & WS_CAPTION)) flStyle |= WS_POPUPWINDOW; - if(flStyle & DW_FCF_TASKLIST) - { - ULONG newflags = (flStyle | WS_CLIPCHILDREN) & ~DW_FCF_TASKLIST; - - hwndframe = CreateWindowEx(flStyleEx, ClassName, title, newflags, CW_USEDEFAULT, CW_USEDEFAULT, + if(flStyle & DW_FCF_TASKLIST || + flStyle & WS_VSCROLL /* This is deprecated and should go away in version 3? */) + { + hwndframe = CreateWindowEx(flStyleEx, ClassName, title, (flStyle | WS_CLIPCHILDREN) & 0xffdf0000, CW_USEDEFAULT, CW_USEDEFAULT, 0, 0, hwndOwner, NULL, DWInstance, NULL); } else { flStyleEx |= WS_EX_TOOLWINDOW; - hwndframe = CreateWindowEx(flStyleEx, ClassName, title, flStyle | WS_CLIPCHILDREN, CW_USEDEFAULT, CW_USEDEFAULT, + hwndframe = CreateWindowEx(flStyleEx, ClassName, title, (flStyle | WS_CLIPCHILDREN) & 0xffff0000, CW_USEDEFAULT, CW_USEDEFAULT, 0, 0, hwndOwner, NULL, DWInstance, NULL); } SetWindowLongPtr(hwndframe, GWLP_USERDATA, (LONG_PTR)newbox); @@ -4663,7 +4681,7 @@ #ifdef AEROGLASS /* Attempt to enable Aero glass background on the entire window */ - if(_DwmExtendFrameIntoClientArea && _dw_composition) + if(_DwmExtendFrameIntoClientArea && _dw_composition && (flStyle & DW_FCF_COMPOSITED)) { SetLayeredWindowAttributes(hwndframe, _dw_transparencykey, 0, LWA_COLORKEY); _DwmExtendFrameIntoClientArea(hwndframe, &mar); @@ -6873,7 +6891,11 @@ { ULONG tmp, currentstyle; ColorInfo *cinfo; - + char tmpbuf[100] = {0}; + + if(!handle) + return; + if(handle < (HWND)65536) { char buffer[31] = {0}; @@ -6888,6 +6910,8 @@ return; } + GetClassName(handle, tmpbuf, 99); + currentstyle = GetWindowLong(handle, GWL_STYLE); cinfo = (ColorInfo *)GetWindowLongPtr(handle, GWLP_USERDATA); @@ -6895,24 +6919,55 @@ tmp ^= mask; tmp |= style; - /* We are using SS_NOPREFIX as a VCENTER flag */ - if(tmp & SS_NOPREFIX) - { - - if(cinfo) - cinfo->vcenter = 1; - else - { - cinfo = calloc(1, sizeof(ColorInfo)); - cinfo->fore = cinfo->back = -1; - cinfo->vcenter = 1; - - cinfo->pOldProc = SubclassWindow(handle, _colorwndproc); - SetWindowLongPtr(handle, GWLP_USERDATA, (LONG_PTR)cinfo); - } - } - else if(cinfo) - cinfo->vcenter = 0; + if(strnicmp(tmpbuf, ClassName, strlen(ClassName)+1)==0) + { + tmp = tmp & 0xffff0000; +#ifdef AEROGLASS + if(mask & DW_FCF_COMPOSITED && _DwmExtendFrameIntoClientArea && _dw_composition) + { + DWORD styleex = GetWindowLongPtr(handle, GWL_EXSTYLE); + + if(style & DW_FCF_COMPOSITED) + { + MARGINS mar = {-1}; + + /* Attempt to enable Aero glass background on the entire window */ + SetWindowLongPtr(handle, GWL_EXSTYLE, styleex | WS_EX_LAYERED); + SetLayeredWindowAttributes(handle, _dw_transparencykey, 0, LWA_COLORKEY); + _DwmExtendFrameIntoClientArea(handle, &mar); + } + else + { + MARGINS mar = {0}; + + /* Remove Aero Glass */ + SetWindowLongPtr(handle, GWL_EXSTYLE, styleex & ~WS_EX_LAYERED); + _DwmExtendFrameIntoClientArea(handle, &mar); + } + } +#endif + } + else + { + /* We are using SS_NOPREFIX as a VCENTER flag */ + if(tmp & SS_NOPREFIX) + { + + if(cinfo) + cinfo->vcenter = 1; + else + { + cinfo = calloc(1, sizeof(ColorInfo)); + cinfo->fore = cinfo->back = -1; + cinfo->vcenter = 1; + + cinfo->pOldProc = SubclassWindow(handle, _colorwndproc); + SetWindowLongPtr(handle, GWLP_USERDATA, (LONG_PTR)cinfo); + } + } + else if(cinfo) + cinfo->vcenter = 0; + } SetWindowLong(handle, GWL_STYLE, tmp); }