# HG changeset patch # User bsmith@81767d24-ef19-dc11-ae90-00e081727c95 # Date 1594271927 0 # Node ID e780c68cf5b1c11b1f6815598c965c7628c72ef8 # Parent bbd81ee0ca9a758ceb3ebb0eb19f7b895a04e725 Win: Added a function to create the MARGINS struct from RECT... Also call DwmExtendFrameIntoClientArea() so the frame controls still get drawn. diff -r bbd81ee0ca9a -r e780c68cf5b1 win/dw.c --- a/win/dw.c Thu Jul 09 01:33:12 2020 +0000 +++ b/win/dw.c Thu Jul 09 05:18:47 2020 +0000 @@ -815,6 +815,13 @@ } } +MARGINS _dw_rect_to_margins(RECT rect) +{ + MARGINS mar = { rect.left, rect.right, rect.top, rect.bottom }; + + return mar; +} + BOOL _CanThemeWindow(HWND window) { TCHAR tmpbuf[100] = {0}; @@ -2025,14 +2032,22 @@ if(cinfo) { - /*NCCALCSIZE_PARAMS* sz = (NCCALCSIZE_PARAMS*)mp2; + NCCALCSIZE_PARAMS* sz = (NCCALCSIZE_PARAMS*)mp2; sz->rgrc[0].left += cinfo->rect.left; sz->rgrc[0].right -= cinfo->rect.right; - sz->rgrc[0].bottom -= cinfo->rect.bottom;;*/ + sz->rgrc[0].bottom -= cinfo->rect.bottom; return 0; } } + else if(msg == WM_NCPAINT && _DW_DARK_MODE_ENABLED && _DW_DARK_MODE_ALLOWED > DW_DARK_MODE_BASIC) + { + /* Handle close/minimize/maximize/help button */ + LRESULT lResult; + + if(_DwmDefWindowProc && _DwmDefWindowProc(hWnd, msg, mp1, mp2, &lResult)) + return lResult; + } else if(msg == WM_NCHITTEST && _DW_DARK_MODE_ENABLED && _DW_DARK_MODE_ALLOWED > DW_DARK_MODE_BASIC) { /* Handle close/minimize/maximize/help button */ @@ -2570,26 +2585,32 @@ if(_DwmIsCompositionEnabled) _DwmIsCompositionEnabled(&_dw_composition); - if(cinfo && (cinfo->style & DW_FCF_COMPOSITED)) - { - /* If we are no longer compositing... */ - if(!_dw_composition) - { - MARGINS mar = {0}; - - SetLayeredWindowAttributes(hWnd, _dw_transparencykey, 255, LWA_ALPHA); - if(_DwmExtendFrameIntoClientArea) - _DwmExtendFrameIntoClientArea(hWnd, &mar); - } - /* If we have started compositing... */ + /* If we are no longer compositing... */ + if(!_dw_composition) + { + MARGINS mar = {0}; + + SetLayeredWindowAttributes(hWnd, _dw_transparencykey, 255, LWA_ALPHA); + if(_DwmExtendFrameIntoClientArea) + _DwmExtendFrameIntoClientArea(hWnd, &mar); + } + /* If we have started compositing... */ + else + { + MARGINS mar = {-1}; + + if(cinfo && (cinfo->style & DW_FCF_COMPOSITED)) + SetLayeredWindowAttributes(hWnd, _dw_transparencykey, 0, LWA_COLORKEY); else { - MARGINS mar = {-1}; - - SetLayeredWindowAttributes(hWnd, _dw_transparencykey, 0, LWA_COLORKEY); - if(_DwmExtendFrameIntoClientArea) - _DwmExtendFrameIntoClientArea(hWnd, &mar); + if(cinfo) + mar = _dw_rect_to_margins(cinfo->rect); + else + memset(&mar, 0, sizeof(MARGINS)); + SetLayeredWindowAttributes(hWnd, _dw_transparencykey, 255, LWA_ALPHA); } + if(_DwmExtendFrameIntoClientArea) + _DwmExtendFrameIntoClientArea(hWnd, &mar); } } break; @@ -5702,7 +5723,15 @@ SetLayeredWindowAttributes(hwndframe, _dw_transparencykey, 0, LWA_COLORKEY); } else + { + if(_DwmExtendFrameIntoClientArea && _dw_composition) + { + MARGINS mar = _dw_rect_to_margins(newbox->cinfo.rect); + + _DwmExtendFrameIntoClientArea(hwndframe, &mar); + } SetLayeredWindowAttributes(hwndframe, _dw_transparencykey, 255, LWA_ALPHA); + } #endif return hwndframe; @@ -8282,6 +8311,9 @@ { MARGINS mar = {0}; + if(cinfo) + mar = _dw_rect_to_margins(cinfo->rect); + /* Remove Aero Glass */ SetLayeredWindowAttributes(handle, _dw_transparencykey, 255, LWA_ALPHA); _DwmExtendFrameIntoClientArea(handle, &mar);