comparison win/dw.c @ 2214:c60588f740ec

Win: Add IS_WIN8PLUS macro and disable DW_FCF_COMPOSITION for Windows 8 and higher. The method used in Vista and Windows 7 to control what is drawn as glass has adverse side effects on Windows 8 and 10. Mouse clicks on what would be "glass" passed through to underlying windows due to the use of LWA_COLORKEY to specify transparency color. Additionally the glass effect has been removed. Glass was the main reason for implementing DW_FCF_COMPOSITION so just ignore the flag on Windows 8 and higher. https://stackoverflow.com/questions/4768862/dwmextendframeintoclientarea-without-transparencykey
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Mon, 14 Dec 2020 13:14:27 +0000
parents f903f7576e9d
children 69b0d157bc9f
comparison
equal deleted inserted replaced
2213:0132afc8c955 2214:c60588f740ec
264 264
265 #define PACKVERSION(major,minor) MAKELONG(minor,major) 265 #define PACKVERSION(major,minor) MAKELONG(minor,major)
266 266
267 #define IS_XPPLUS (dwComctlVer >= PACKVERSION(5,82)) 267 #define IS_XPPLUS (dwComctlVer >= PACKVERSION(5,82))
268 #define IS_VISTAPLUS (dwComctlVer >= PACKVERSION(6,10)) 268 #define IS_VISTAPLUS (dwComctlVer >= PACKVERSION(6,10))
269 #define IS_WIN8PLUS (dwVersion >= PACKVERSION(6,1))
269 270
270 #ifndef MIN 271 #ifndef MIN
271 #define MIN(a, b) (((a) < (b)) ? (a) : (b)) 272 #define MIN(a, b) (((a) < (b)) ? (a) : (b))
272 #endif 273 #endif
273 274
2767 /* If we have started compositing... */ 2768 /* If we have started compositing... */
2768 else 2769 else
2769 { 2770 {
2770 MARGINS mar = {-1,-1,-1,-1}; 2771 MARGINS mar = {-1,-1,-1,-1};
2771 2772
2772 if(cinfo && (cinfo->style & DW_FCF_COMPOSITED)) 2773 if(cinfo && (cinfo->style & DW_FCF_COMPOSITED) && !IS_WIN8PLUS)
2773 SetLayeredWindowAttributes(hWnd, _dw_transparencykey, 0, LWA_COLORKEY); 2774 SetLayeredWindowAttributes(hWnd, _dw_transparencykey, 0, LWA_COLORKEY);
2774 else 2775 else
2775 { 2776 {
2776 #ifdef DARK_MODE_TITLEBAR_MENU 2777 #ifdef DARK_MODE_TITLEBAR_MENU
2777 if(cinfo) 2778 if(cinfo)
3014 case WM_ERASEBKGND: 3015 case WM_ERASEBKGND:
3015 if(_dw_composition) 3016 if(_dw_composition)
3016 { 3017 {
3017 ColorInfo *cinfo = _dw_window_get_cinfo(_toplevel_window(hWnd)); 3018 ColorInfo *cinfo = _dw_window_get_cinfo(_toplevel_window(hWnd));
3018 3019
3019 if(cinfo && cinfo->style & DW_FCF_COMPOSITED) 3020 if(cinfo && cinfo->style & DW_FCF_COMPOSITED && !IS_WIN8PLUS)
3020 { 3021 {
3021 static HBRUSH hbrush = 0; 3022 static HBRUSH hbrush = 0;
3022 RECT rect; 3023 RECT rect;
3023 3024
3024 if(!hbrush) 3025 if(!hbrush)
3506 case WM_CTLCOLORBTN: 3507 case WM_CTLCOLORBTN:
3507 case WM_CTLCOLORDLG: 3508 case WM_CTLCOLORDLG:
3508 { 3509 {
3509 ColorInfo *tlcinfo = _dw_window_get_cinfo(_toplevel_window(hWnd)); 3510 ColorInfo *tlcinfo = _dw_window_get_cinfo(_toplevel_window(hWnd));
3510 3511
3511 if((_dw_composition && tlcinfo && (tlcinfo->style & DW_FCF_COMPOSITED)) && 3512 if((_dw_composition && tlcinfo && (tlcinfo->style & DW_FCF_COMPOSITED)) && !IS_WIN8PLUS &&
3512 (!thiscinfo || (thiscinfo && (thiscinfo->back == -1 || thiscinfo->back == DW_RGB_TRANSPARENT)))) 3513 (!thiscinfo || (thiscinfo && (thiscinfo->back == -1 || thiscinfo->back == DW_RGB_TRANSPARENT))))
3513 { 3514 {
3514 if(!(msg == WM_CTLCOLORSTATIC && SendMessage((HWND)mp2, STM_GETIMAGE, IMAGE_BITMAP, 0))) 3515 if(!(msg == WM_CTLCOLORSTATIC && SendMessage((HWND)mp2, STM_GETIMAGE, IMAGE_BITMAP, 0)))
3515 { 3516 {
3516 SetBkColor((HDC)mp1, _dw_transparencykey); 3517 SetBkColor((HDC)mp1, _dw_transparencykey);
4162 parentcinfo = _dw_window_get_cinfo(GetParent(hwnd)); 4163 parentcinfo = _dw_window_get_cinfo(GetParent(hwnd));
4163 tlcinfo = _dw_window_get_cinfo(_toplevel_window(hwnd)); 4164 tlcinfo = _dw_window_get_cinfo(_toplevel_window(hwnd));
4164 4165
4165 /* If we don't require themed drawing */ 4166 /* If we don't require themed drawing */
4166 if(((cinfo->back != -1 && cinfo->back != DW_RGB_TRANSPARENT) || (parentcinfo && parentcinfo->back != -1)) 4167 if(((cinfo->back != -1 && cinfo->back != DW_RGB_TRANSPARENT) || (parentcinfo && parentcinfo->back != -1))
4167 || !_dw_composition || !tlcinfo || !(tlcinfo->style & DW_FCF_COMPOSITED)) 4168 || !_dw_composition || !tlcinfo || !(tlcinfo->style & DW_FCF_COMPOSITED) || IS_WIN8PLUS)
4168 return _colorwndproc(hwnd, msg, mp1, mp2); 4169 return _colorwndproc(hwnd, msg, mp1, mp2);
4169 4170
4170 pOldProc = cinfo->pOldProc; 4171 pOldProc = cinfo->pOldProc;
4171 4172
4172 switch(msg) 4173 switch(msg)
5876 newbox->cinfo.rect.top, newbox->cinfo.rect.bottom); 5877 newbox->cinfo.rect.top, newbox->cinfo.rect.bottom);
5877 #endif 5878 #endif
5878 newbox->cinfo.rect.top *= -1; 5879 newbox->cinfo.rect.top *= -1;
5879 newbox->cinfo.rect.left = newbox->cinfo.rect.right = newbox->cinfo.rect.bottom = 1; 5880 newbox->cinfo.rect.left = newbox->cinfo.rect.right = newbox->cinfo.rect.bottom = 1;
5880 5881
5881 if(flStyle & DW_FCF_COMPOSITED) 5882 if((flStyle & DW_FCF_COMPOSITED) && !IS_WIN8PLUS)
5882 { 5883 {
5883 /* Attempt to enable Aero glass background on the entire window */ 5884 /* Attempt to enable Aero glass background on the entire window */
5884 if(_DwmExtendFrameIntoClientArea && _dw_composition) 5885 if(_DwmExtendFrameIntoClientArea && _dw_composition)
5885 { 5886 {
5886 MARGINS fullmar = {-1,-1,-1,-1}; 5887 MARGINS fullmar = {-1,-1,-1,-1};
8525 return; 8526 return;
8526 else if(_tcsnicmp(tmpbuf, ClassName, _tcslen(ClassName)+1)==0) 8527 else if(_tcsnicmp(tmpbuf, ClassName, _tcslen(ClassName)+1)==0)
8527 { 8528 {
8528 tmp = tmp & 0xffff0000; 8529 tmp = tmp & 0xffff0000;
8529 #ifdef AEROGLASS 8530 #ifdef AEROGLASS
8530 if(mask & DW_FCF_COMPOSITED && _DwmExtendFrameIntoClientArea && _dw_composition) 8531 if(mask & DW_FCF_COMPOSITED && _DwmExtendFrameIntoClientArea && _dw_composition && !IS_WIN8PLUS)
8531 { 8532 {
8532 if(style & DW_FCF_COMPOSITED) 8533 if(style & DW_FCF_COMPOSITED)
8533 { 8534 {
8534 MARGINS mar = {-1,-1,-1,-1}; 8535 MARGINS mar = {-1,-1,-1,-1};
8535 8536