Mercurial > dwindows
comparison win/dw.c @ 2137:e780c68cf5b1
Win: Added a function to create the MARGINS struct from RECT...
Also call DwmExtendFrameIntoClientArea() so the frame controls still get drawn.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Thu, 09 Jul 2020 05:18:47 +0000 |
parents | bbd81ee0ca9a |
children | 55263d21b399 |
comparison
equal
deleted
inserted
replaced
2136:bbd81ee0ca9a | 2137:e780c68cf5b1 |
---|---|
813 _DW_DARK_MODE_ENABLED = _DW_ShouldAppsUseDarkMode(); | 813 _DW_DARK_MODE_ENABLED = _DW_ShouldAppsUseDarkMode(); |
814 } | 814 } |
815 } | 815 } |
816 } | 816 } |
817 | 817 |
818 MARGINS _dw_rect_to_margins(RECT rect) | |
819 { | |
820 MARGINS mar = { rect.left, rect.right, rect.top, rect.bottom }; | |
821 | |
822 return mar; | |
823 } | |
824 | |
818 BOOL _CanThemeWindow(HWND window) | 825 BOOL _CanThemeWindow(HWND window) |
819 { | 826 { |
820 TCHAR tmpbuf[100] = {0}; | 827 TCHAR tmpbuf[100] = {0}; |
821 LONG_PTR style = GetWindowLongPtr(window, GWL_STYLE); | 828 LONG_PTR style = GetWindowLongPtr(window, GWL_STYLE); |
822 | 829 |
2023 { | 2030 { |
2024 ColorInfo *cinfo = _dw_window_get_cinfo(hWnd); | 2031 ColorInfo *cinfo = _dw_window_get_cinfo(hWnd); |
2025 | 2032 |
2026 if(cinfo) | 2033 if(cinfo) |
2027 { | 2034 { |
2028 /*NCCALCSIZE_PARAMS* sz = (NCCALCSIZE_PARAMS*)mp2; | 2035 NCCALCSIZE_PARAMS* sz = (NCCALCSIZE_PARAMS*)mp2; |
2029 | 2036 |
2030 sz->rgrc[0].left += cinfo->rect.left; | 2037 sz->rgrc[0].left += cinfo->rect.left; |
2031 sz->rgrc[0].right -= cinfo->rect.right; | 2038 sz->rgrc[0].right -= cinfo->rect.right; |
2032 sz->rgrc[0].bottom -= cinfo->rect.bottom;;*/ | 2039 sz->rgrc[0].bottom -= cinfo->rect.bottom; |
2033 return 0; | 2040 return 0; |
2034 } | 2041 } |
2042 } | |
2043 else if(msg == WM_NCPAINT && _DW_DARK_MODE_ENABLED && _DW_DARK_MODE_ALLOWED > DW_DARK_MODE_BASIC) | |
2044 { | |
2045 /* Handle close/minimize/maximize/help button */ | |
2046 LRESULT lResult; | |
2047 | |
2048 if(_DwmDefWindowProc && _DwmDefWindowProc(hWnd, msg, mp1, mp2, &lResult)) | |
2049 return lResult; | |
2035 } | 2050 } |
2036 else if(msg == WM_NCHITTEST && _DW_DARK_MODE_ENABLED && _DW_DARK_MODE_ALLOWED > DW_DARK_MODE_BASIC) | 2051 else if(msg == WM_NCHITTEST && _DW_DARK_MODE_ENABLED && _DW_DARK_MODE_ALLOWED > DW_DARK_MODE_BASIC) |
2037 { | 2052 { |
2038 /* Handle close/minimize/maximize/help button */ | 2053 /* Handle close/minimize/maximize/help button */ |
2039 LRESULT lResult; | 2054 LRESULT lResult; |
2568 ColorInfo *cinfo = _dw_window_get_cinfo(hWnd); | 2583 ColorInfo *cinfo = _dw_window_get_cinfo(hWnd); |
2569 | 2584 |
2570 if(_DwmIsCompositionEnabled) | 2585 if(_DwmIsCompositionEnabled) |
2571 _DwmIsCompositionEnabled(&_dw_composition); | 2586 _DwmIsCompositionEnabled(&_dw_composition); |
2572 | 2587 |
2573 if(cinfo && (cinfo->style & DW_FCF_COMPOSITED)) | 2588 /* If we are no longer compositing... */ |
2589 if(!_dw_composition) | |
2574 { | 2590 { |
2575 /* If we are no longer compositing... */ | 2591 MARGINS mar = {0}; |
2576 if(!_dw_composition) | 2592 |
2577 { | 2593 SetLayeredWindowAttributes(hWnd, _dw_transparencykey, 255, LWA_ALPHA); |
2578 MARGINS mar = {0}; | 2594 if(_DwmExtendFrameIntoClientArea) |
2579 | 2595 _DwmExtendFrameIntoClientArea(hWnd, &mar); |
2580 SetLayeredWindowAttributes(hWnd, _dw_transparencykey, 255, LWA_ALPHA); | 2596 } |
2581 if(_DwmExtendFrameIntoClientArea) | 2597 /* If we have started compositing... */ |
2582 _DwmExtendFrameIntoClientArea(hWnd, &mar); | 2598 else |
2583 } | 2599 { |
2584 /* If we have started compositing... */ | 2600 MARGINS mar = {-1}; |
2601 | |
2602 if(cinfo && (cinfo->style & DW_FCF_COMPOSITED)) | |
2603 SetLayeredWindowAttributes(hWnd, _dw_transparencykey, 0, LWA_COLORKEY); | |
2585 else | 2604 else |
2586 { | 2605 { |
2587 MARGINS mar = {-1}; | 2606 if(cinfo) |
2588 | 2607 mar = _dw_rect_to_margins(cinfo->rect); |
2589 SetLayeredWindowAttributes(hWnd, _dw_transparencykey, 0, LWA_COLORKEY); | 2608 else |
2590 if(_DwmExtendFrameIntoClientArea) | 2609 memset(&mar, 0, sizeof(MARGINS)); |
2591 _DwmExtendFrameIntoClientArea(hWnd, &mar); | 2610 SetLayeredWindowAttributes(hWnd, _dw_transparencykey, 255, LWA_ALPHA); |
2592 } | 2611 } |
2612 if(_DwmExtendFrameIntoClientArea) | |
2613 _DwmExtendFrameIntoClientArea(hWnd, &mar); | |
2593 } | 2614 } |
2594 } | 2615 } |
2595 break; | 2616 break; |
2596 case WM_SETTINGCHANGE: | 2617 case WM_SETTINGCHANGE: |
2597 { | 2618 { |
5700 _DwmExtendFrameIntoClientArea(hwndframe, &fullmar); | 5721 _DwmExtendFrameIntoClientArea(hwndframe, &fullmar); |
5701 } | 5722 } |
5702 SetLayeredWindowAttributes(hwndframe, _dw_transparencykey, 0, LWA_COLORKEY); | 5723 SetLayeredWindowAttributes(hwndframe, _dw_transparencykey, 0, LWA_COLORKEY); |
5703 } | 5724 } |
5704 else | 5725 else |
5726 { | |
5727 if(_DwmExtendFrameIntoClientArea && _dw_composition) | |
5728 { | |
5729 MARGINS mar = _dw_rect_to_margins(newbox->cinfo.rect); | |
5730 | |
5731 _DwmExtendFrameIntoClientArea(hwndframe, &mar); | |
5732 } | |
5705 SetLayeredWindowAttributes(hwndframe, _dw_transparencykey, 255, LWA_ALPHA); | 5733 SetLayeredWindowAttributes(hwndframe, _dw_transparencykey, 255, LWA_ALPHA); |
5734 } | |
5706 #endif | 5735 #endif |
5707 | 5736 |
5708 return hwndframe; | 5737 return hwndframe; |
5709 } | 5738 } |
5710 | 5739 |
8279 _DwmExtendFrameIntoClientArea(handle, &mar); | 8308 _DwmExtendFrameIntoClientArea(handle, &mar); |
8280 } | 8309 } |
8281 else | 8310 else |
8282 { | 8311 { |
8283 MARGINS mar = {0}; | 8312 MARGINS mar = {0}; |
8313 | |
8314 if(cinfo) | |
8315 mar = _dw_rect_to_margins(cinfo->rect); | |
8284 | 8316 |
8285 /* Remove Aero Glass */ | 8317 /* Remove Aero Glass */ |
8286 SetLayeredWindowAttributes(handle, _dw_transparencykey, 255, LWA_ALPHA); | 8318 SetLayeredWindowAttributes(handle, _dw_transparencykey, 255, LWA_ALPHA); |
8287 _DwmExtendFrameIntoClientArea(handle, &mar); | 8319 _DwmExtendFrameIntoClientArea(handle, &mar); |
8288 } | 8320 } |