comparison win/dw.c @ 2134:9e6e4ebd5e96

Win: Changes to allow drawing in the titlebar so we can add a button there which will be used in place of the non-dark mode menubar. These are experimental changes protected by the DARK_MODE_TITLEBAR_MENU #ifdef.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Tue, 07 Jul 2020 23:14:12 +0000
parents 663467f6eee4
children d9720d48d61e
comparison
equal deleted inserted replaced
2133:2090d7f46de5 2134:9e6e4ebd5e96
207 207
208 #ifdef AEROGLASS 208 #ifdef AEROGLASS
209 HRESULT (WINAPI *_DwmExtendFrameIntoClientArea)(HWND hWnd, const MARGINS *pMarInset) = 0; 209 HRESULT (WINAPI *_DwmExtendFrameIntoClientArea)(HWND hWnd, const MARGINS *pMarInset) = 0;
210 HRESULT (WINAPI *_DwmIsCompositionEnabled)(BOOL *pfEnabled) = 0; 210 HRESULT (WINAPI *_DwmIsCompositionEnabled)(BOOL *pfEnabled) = 0;
211 HRESULT (WINAPI *_DwmSetWindowAttribute)(HWND, DWORD, LPCVOID, DWORD) = 0; 211 HRESULT (WINAPI *_DwmSetWindowAttribute)(HWND, DWORD, LPCVOID, DWORD) = 0;
212 BOOL (WINAPI *_DwmDefWindowProc)(HWND, UINT, WPARAM, LPARAM, LRESULT *) = 0;
212 HTHEME (WINAPI *_OpenThemeData)(HWND hwnd, LPCWSTR pszClassList) = 0; 213 HTHEME (WINAPI *_OpenThemeData)(HWND hwnd, LPCWSTR pszClassList) = 0;
213 HPAINTBUFFER (WINAPI *_BeginBufferedPaint)(HDC hdcTarget, const RECT *prcTarget, BP_BUFFERFORMAT dwFormat, BP_PAINTPARAMS *pPaintParams, HDC *phdc) = 0; 214 HPAINTBUFFER (WINAPI *_BeginBufferedPaint)(HDC hdcTarget, const RECT *prcTarget, BP_BUFFERFORMAT dwFormat, BP_PAINTPARAMS *pPaintParams, HDC *phdc) = 0;
214 HRESULT (WINAPI *_BufferedPaintSetAlpha)(HPAINTBUFFER hBufferedPaint, const RECT *prc, BYTE alpha) = 0; 215 HRESULT (WINAPI *_BufferedPaintSetAlpha)(HPAINTBUFFER hBufferedPaint, const RECT *prc, BYTE alpha) = 0;
215 HRESULT (WINAPI *_DrawThemeTextEx)(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, LPCWSTR pszText, int iCharCount, DWORD dwFlags, LPRECT pRect, const DTTOPTS *pOptions) = 0; 216 HRESULT (WINAPI *_DrawThemeTextEx)(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, LPCWSTR pszText, int iCharCount, DWORD dwFlags, LPRECT pRect, const DTTOPTS *pOptions) = 0;
216 HRESULT (WINAPI *_EndBufferedPaint)(HPAINTBUFFER hBufferedPaint, BOOL fUpdateTarget) = 0; 217 HRESULT (WINAPI *_EndBufferedPaint)(HPAINTBUFFER hBufferedPaint, BOOL fUpdateTarget) = 0;
328 void _resize_notebook_page(HWND handle, int pageid); 329 void _resize_notebook_page(HWND handle, int pageid);
329 void _handle_splitbar_resize(HWND hwnd, float percent, int type, int x, int y); 330 void _handle_splitbar_resize(HWND hwnd, float percent, int type, int x, int y);
330 int _lookup_icon(HWND handle, HICON hicon, int type); 331 int _lookup_icon(HWND handle, HICON hicon, int type);
331 HFONT _acquire_font(HWND handle, const char *fontname); 332 HFONT _acquire_font(HWND handle, const char *fontname);
332 void _click_default(HWND handle); 333 void _click_default(HWND handle);
333 void _do_resize(Box *thisbox, int x, int y); 334 void _do_resize(Box *thisbox, int x, int y, int xborder, int yborder);
334 335
335 /* Internal function to queue a window redraw */ 336 /* Internal function to queue a window redraw */
336 void _dw_redraw(HWND window, int skip) 337 void _dw_redraw(HWND window, int skip)
337 { 338 {
338 static HWND lastwindow = 0; 339 static HWND lastwindow = 0;
771 } 772 }
772 773
773 /* Our own ShouldAppsUseDarkMode() that handles the forced option */ 774 /* Our own ShouldAppsUseDarkMode() that handles the forced option */
774 BOOL _DW_ShouldAppsUseDarkMode(void) 775 BOOL _DW_ShouldAppsUseDarkMode(void)
775 { 776 {
776 if(_DW_DARK_MODE_ALLOWED == 3) 777 if(_DW_DARK_MODE_ALLOWED == DW_DARK_MODE_FULL)
777 return TRUE; 778 return TRUE;
778 return (_ShouldAppsUseDarkMode() && !IsHighContrast()); 779 return (_ShouldAppsUseDarkMode() && !IsHighContrast());
779 } 780 }
780 781
781 void _dw_init_dark_mode(void) 782 void _dw_init_dark_mode(void)
827 return FALSE; 828 return FALSE;
828 #ifdef TOOLBAR 829 #ifdef TOOLBAR
829 else if(_tcsnicmp(tmpbuf, TOOLBARCLASSNAME, _tcslen(TOOLBARCLASSNAME)+1) == 0) 830 else if(_tcsnicmp(tmpbuf, TOOLBARCLASSNAME, _tcslen(TOOLBARCLASSNAME)+1) == 0)
830 { 831 {
831 /* If we aren't in full dark mode */ 832 /* If we aren't in full dark mode */
832 if(_DW_DARK_MODE_ALLOWED < 2) 833 if(_DW_DARK_MODE_ALLOWED < DW_DARK_MODE_FULL)
833 { 834 {
834 /* Enable or disable visual themes */ 835 /* Enable or disable visual themes */
835 if(_SetWindowTheme) 836 if(_SetWindowTheme)
836 _SetWindowTheme(window, (style & TBSTYLE_FLAT) ? L"" : NULL, (style & TBSTYLE_FLAT) ? L"" : NULL); 837 _SetWindowTheme(window, (style & TBSTYLE_FLAT) ? L"" : NULL, (style & TBSTYLE_FLAT) ? L"" : NULL);
837 } 838 }
845 { 846 {
846 if(_DW_DARK_MODE_SUPPORTED) 847 if(_DW_DARK_MODE_SUPPORTED)
847 { 848 {
848 if(_CanThemeWindow(window)) 849 if(_CanThemeWindow(window))
849 { 850 {
850 if(_DW_DARK_MODE_ALLOWED > 1) 851 if(_DW_DARK_MODE_ALLOWED > DW_DARK_MODE_BASIC)
851 { 852 {
852 if(_DW_DARK_MODE_ENABLED) 853 if(_DW_DARK_MODE_ENABLED)
853 _SetWindowTheme(window, L"DarkMode_Explorer", NULL); 854 _SetWindowTheme(window, L"DarkMode_Explorer", NULL);
854 else 855 else
855 _SetWindowTheme(window, L"Explorer", NULL); 856 _SetWindowTheme(window, L"Explorer", NULL);
930 { 931 {
931 HBRUSH retval = GetSysColorBrush(nIndex); 932 HBRUSH retval = GetSysColorBrush(nIndex);
932 #ifdef AEROGLASS 933 #ifdef AEROGLASS
933 static HBRUSH darkBkColorBrush = 0; 934 static HBRUSH darkBkColorBrush = 0;
934 935
935 if(_DW_DARK_MODE_ALLOWED > 1 && _DW_DARK_MODE_ENABLED) 936 if(_DW_DARK_MODE_ALLOWED > DW_DARK_MODE_BASIC && _DW_DARK_MODE_ENABLED)
936 { 937 {
937 if(!darkBkColorBrush) 938 if(!darkBkColorBrush)
938 darkBkColorBrush = CreateSolidBrush(0x383838); 939 darkBkColorBrush = CreateSolidBrush(0x383838);
939 940
940 switch(nIndex) 941 switch(nIndex)
1486 } 1487 }
1487 1488
1488 /* This function calculates how much space the widgets and boxes require 1489 /* This function calculates how much space the widgets and boxes require
1489 * and does expansion as necessary. 1490 * and does expansion as necessary.
1490 */ 1491 */
1491 static void _resize_box(Box *thisbox, int *depth, int x, int y, int pass) 1492 static void _resize_box(Box *thisbox, int *depth, int x, int y, int xborder, int yborder, int pass)
1492 { 1493 {
1493 /* Current item position */ 1494 /* Current item position */
1494 int z, currentx = thisbox->pad, currenty = thisbox->pad; 1495 int z, currentx = thisbox->pad, currenty = thisbox->pad;
1495 /* Used x, y and padding maximum values... 1496 /* Used x, y and padding maximum values...
1496 * These will be used to find the widest or 1497 * These will be used to find the widest or
1554 if(pass == 1) 1555 if(pass == 1)
1555 { 1556 {
1556 (*depth)++; 1557 (*depth)++;
1557 1558
1558 /* Save the newly calculated values on the box */ 1559 /* Save the newly calculated values on the box */
1559 _resize_box(tmp, depth, x, y, pass); 1560 _resize_box(tmp, depth, x, y, 0, 0, pass);
1560 1561
1561 /* Duplicate the values in the item list for use below */ 1562 /* Duplicate the values in the item list for use below */
1562 thisbox->items[z].width = tmp->minwidth; 1563 thisbox->items[z].width = tmp->minwidth;
1563 thisbox->items[z].height = tmp->minheight; 1564 thisbox->items[z].height = tmp->minheight;
1564 1565
1683 GetClassName(handle, tmpbuf, 99); 1684 GetClassName(handle, tmpbuf, 99);
1684 1685
1685 if(_tcsnicmp(tmpbuf, COMBOBOXCLASSNAME, _tcslen(COMBOBOXCLASSNAME)+1)==0) 1686 if(_tcsnicmp(tmpbuf, COMBOBOXCLASSNAME, _tcslen(COMBOBOXCLASSNAME)+1)==0)
1686 { 1687 {
1687 /* Handle special case Combobox */ 1688 /* Handle special case Combobox */
1688 MoveWindow(handle, currentx + pad, currenty + pad, 1689 MoveWindow(handle, currentx + pad + xborder, currenty + pad + yborder,
1689 width, height + 400, FALSE); 1690 width, height + 400, FALSE);
1690 } 1691 }
1691 #ifdef TOOLBAR 1692 #ifdef TOOLBAR
1692 /* Bitmap Buttons */ 1693 /* Bitmap Buttons */
1693 else if(_tcsnicmp(tmpbuf, TOOLBARCLASSNAME, _tcslen(TOOLBARCLASSNAME)+1) == 0) 1694 else if(_tcsnicmp(tmpbuf, TOOLBARCLASSNAME, _tcslen(TOOLBARCLASSNAME)+1) == 0)
1694 { 1695 {
1695 SendMessage(handle, TB_SETBUTTONSIZE, 0, MAKELPARAM(width, height)); 1696 SendMessage(handle, TB_SETBUTTONSIZE, 0, MAKELPARAM(width, height));
1696 1697
1697 MoveWindow(handle, currentx + pad, currenty + pad, width, height, FALSE); 1698 MoveWindow(handle, currentx + pad + xborder, currenty + pad + yborder, width, height, FALSE);
1698 } 1699 }
1699 #endif 1700 #endif
1700 else if(_tcsnicmp(tmpbuf, UPDOWN_CLASS, _tcslen(UPDOWN_CLASS)+1)==0) 1701 else if(_tcsnicmp(tmpbuf, UPDOWN_CLASS, _tcslen(UPDOWN_CLASS)+1)==0)
1701 { 1702 {
1702 /* Handle special case Spinbutton */ 1703 /* Handle special case Spinbutton */
1703 ColorInfo *cinfo = (ColorInfo *)GetWindowLongPtr(handle, GWLP_USERDATA); 1704 ColorInfo *cinfo = (ColorInfo *)GetWindowLongPtr(handle, GWLP_USERDATA);
1704 1705
1705 MoveWindow(handle, currentx + pad + (width - 20), currenty + pad, 1706 MoveWindow(handle, currentx + pad + (width - 20) + xborder, currenty + pad + yborder,
1706 20, height, FALSE); 1707 20, height, FALSE);
1707 1708
1708 if(cinfo) 1709 if(cinfo)
1709 { 1710 {
1710 MoveWindow(cinfo->buddy, currentx + pad, currenty + pad, 1711 MoveWindow(cinfo->buddy, currentx + pad + xborder, currenty + pad + yborder,
1711 width - 20, height, FALSE); 1712 width - 20, height, FALSE);
1712 } 1713 }
1713 } 1714 }
1714 else if(_tcsncmp(tmpbuf, ScrollClassName, _tcslen(ScrollClassName)+1)==0) 1715 else if(_tcsncmp(tmpbuf, ScrollClassName, _tcslen(ScrollClassName)+1)==0)
1715 { 1716 {
1726 /* Save the current scroll positions */ 1727 /* Save the current scroll positions */
1727 GetScrollInfo(handle, SB_HORZ, &hsi); 1728 GetScrollInfo(handle, SB_HORZ, &hsi);
1728 GetScrollInfo(handle, SB_VERT, &vsi); 1729 GetScrollInfo(handle, SB_VERT, &vsi);
1729 1730
1730 /* Position the scrollbox */ 1731 /* Position the scrollbox */
1731 MoveWindow(handle, currentx + pad, currenty + pad, width, height, FALSE); 1732 MoveWindow(handle, currentx + pad + xborder, currenty + pad + yborder, width, height, FALSE);
1732 1733
1733 GetClientRect(handle, &rect); 1734 GetClientRect(handle, &rect);
1734 cx = rect.right; 1735 cx = rect.right;
1735 cy = rect.bottom; 1736 cy = rect.bottom;
1736 1737
1737 1738
1738 /* Get the required space for the box */ 1739 /* Get the required space for the box */
1739 _resize_box(thisbox, &depth, cx, cy, 1); 1740 _resize_box(thisbox, &depth, cx, cy, 0, 0, 1);
1740 1741
1741 if(cx < thisbox->minwidth) 1742 if(cx < thisbox->minwidth)
1742 { 1743 {
1743 cx = thisbox->minwidth; 1744 cx = thisbox->minwidth;
1744 } 1745 }
1771 MoveWindow(cinfo->combo, -hsi.nPos, -vsi.nPos, cx, cy, FALSE); 1772 MoveWindow(cinfo->combo, -hsi.nPos, -vsi.nPos, cx, cy, FALSE);
1772 SetScrollInfo(handle, SB_HORZ, &hsi, TRUE); 1773 SetScrollInfo(handle, SB_HORZ, &hsi, TRUE);
1773 SetScrollInfo(handle, SB_VERT, &vsi, TRUE); 1774 SetScrollInfo(handle, SB_VERT, &vsi, TRUE);
1774 1775
1775 /* Layout the content of the scrollbox */ 1776 /* Layout the content of the scrollbox */
1776 _do_resize(thisbox, cx, cy); 1777 _do_resize(thisbox, cx, cy, 0, 0);
1777 } 1778 }
1778 else if(_tcsncmp(tmpbuf, SplitbarClassName, _tcslen(SplitbarClassName)+1)==0) 1779 else if(_tcsncmp(tmpbuf, SplitbarClassName, _tcslen(SplitbarClassName)+1)==0)
1779 { 1780 {
1780 /* Then try the bottom or right box */ 1781 /* Then try the bottom or right box */
1781 float *percent = (float *)dw_window_get_data(handle, "_dw_percent"); 1782 float *percent = (float *)dw_window_get_data(handle, "_dw_percent");
1782 int type = DW_POINTER_TO_INT(dw_window_get_data(handle, "_dw_type")); 1783 int type = DW_POINTER_TO_INT(dw_window_get_data(handle, "_dw_type"));
1783 1784
1784 MoveWindow(handle, currentx + pad, currenty + pad, 1785 MoveWindow(handle, currentx + pad + xborder, currenty + pad + yborder,
1785 width, height, FALSE); 1786 width, height, FALSE);
1786 1787
1787 if(percent && width > 0 && height > 0) 1788 if(percent && width > 0 && height > 0)
1788 _handle_splitbar_resize(handle, *percent, type, width, height); 1789 _handle_splitbar_resize(handle, *percent, type, width, height);
1789 } 1790 }
1803 /* Figure out how big the text is */ 1804 /* Figure out how big the text is */
1804 dw_font_text_extents_get(handle, 0, WideToUTF8(thisbuf), 0, &textheight); 1805 dw_font_text_extents_get(handle, 0, WideToUTF8(thisbuf), 0, &textheight);
1805 1806
1806 diff = (total - textheight) / 2; 1807 diff = (total - textheight) / 2;
1807 1808
1808 MoveWindow(handle, currentx + pad, currenty + pad + diff, 1809 MoveWindow(handle, currentx + pad + xborder, currenty + pad + diff + yborder,
1809 width, height - diff, FALSE); 1810 width, height - diff, FALSE);
1810 } 1811 }
1811 else 1812 else
1812 { 1813 {
1813 MoveWindow(handle, currentx + pad, currenty + pad, 1814 MoveWindow(handle, currentx + pad + xborder, currenty + pad + yborder,
1814 width, height, FALSE); 1815 width, height, FALSE);
1815 } 1816 }
1816 } 1817 }
1817 else 1818 else
1818 { 1819 {
1819 /* Everything else */ 1820 /* Everything else */
1820 if(*depth) 1821 if(*depth)
1821 MoveWindow(handle, currentx + pad, currenty + pad, width, height, FALSE); 1822 MoveWindow(handle, currentx + pad + xborder, currenty + pad + yborder, width, height, FALSE);
1822 else /* FIXME: This is a hack to generate WM_PAINT messages for items on the top-level */ 1823 else /* FIXME: This is a hack to generate WM_PAINT messages for items on the top-level */
1823 SetWindowPos(handle, HWND_TOP, currentx + pad, currenty + pad, width, height, 0); 1824 SetWindowPos(handle, HWND_TOP, currentx + pad + xborder, currenty + pad + yborder, width, height, 0);
1824 1825
1825 /* After placing a box... place its components */ 1826 /* After placing a box... place its components */
1826 if(thisbox->items[z].type == TYPEBOX) 1827 if(thisbox->items[z].type == TYPEBOX)
1827 { 1828 {
1828 Box *boxinfo = (Box *)GetWindowLongPtr(handle, GWLP_USERDATA); 1829 Box *boxinfo = (Box *)GetWindowLongPtr(handle, GWLP_USERDATA);
1835 MoveWindow(boxinfo->grouphwnd, 0, 0, 1836 MoveWindow(boxinfo->grouphwnd, 0, 0,
1836 width, height, FALSE); 1837 width, height, FALSE);
1837 } 1838 }
1838 /* Dive into the box */ 1839 /* Dive into the box */
1839 (*depth)++; 1840 (*depth)++;
1840 _resize_box(boxinfo, depth, width, height, pass); 1841 _resize_box(boxinfo, depth, width, height, 0, 0, pass);
1841 (*depth)--; 1842 (*depth)--;
1842 } 1843 }
1843 } 1844 }
1844 } 1845 }
1845 1846
1876 } 1877 }
1877 } 1878 }
1878 } 1879 }
1879 } 1880 }
1880 1881
1881 void _do_resize(Box *thisbox, int x, int y) 1882 void _do_resize(Box *thisbox, int x, int y, int xborder, int yborder)
1882 { 1883 {
1883 if(x != 0 && y != 0) 1884 if(x != 0 && y != 0)
1884 { 1885 {
1885 if(thisbox) 1886 if(thisbox)
1886 { 1887 {
1887 int depth = 0; 1888 int depth = 0;
1888 1889
1889 /* Calculate space requirements */ 1890 /* Calculate space requirements */
1890 _resize_box(thisbox, &depth, x, y, 1); 1891 _resize_box(thisbox, &depth, x, y, xborder, yborder, 1);
1891 1892
1892 /* Finally place all the boxes and controls */ 1893 /* Finally place all the boxes and controls */
1893 _resize_box(thisbox, &depth, x, y, 2); 1894 _resize_box(thisbox, &depth, x, y, xborder, yborder, 2);
1894 } 1895 }
1895 } 1896 }
1896 } 1897 }
1897 1898
1898 int _HandleScroller(HWND handle, int bar, int pos, int which) 1899 int _HandleScroller(HWND handle, int bar, int pos, int which)
1989 { 1990 {
1990 int result = -1, taskbar = FALSE; 1991 int result = -1, taskbar = FALSE;
1991 SignalHandler *tmp = Root; 1992 SignalHandler *tmp = Root;
1992 void (DWSIGNAL *windowfunc)(PVOID); 1993 void (DWSIGNAL *windowfunc)(PVOID);
1993 ULONG origmsg = msg; 1994 ULONG origmsg = msg;
1995
1996 #ifdef DARK_MODE_TITLEBAR_MENU
1997 /* Expand the client area into the titlebar so we can draw our alternate dark mode button
1998 * which when clicked will display the window's menubar menu. Since the menubar cannot be
1999 * made dark, hide it and add the button to the titlebar instead.
2000 */
2001 if(msg == WM_NCCALCSIZE && mp2 && _DW_DARK_MODE_ENABLED && _DW_DARK_MODE_ALLOWED > DW_DARK_MODE_BASIC)
2002 {
2003 MARGINS *margins = dw_window_get_data(hWnd, "_dw_margins");
2004 RECT *border_thickness = dw_window_get_data(hWnd, "_dw_border");
2005
2006 if (margins && border_thickness)
2007 {
2008 NCCALCSIZE_PARAMS* sz = (NCCALCSIZE_PARAMS*)mp2;
2009
2010 sz->rgrc[0].left += border_thickness->left;
2011 sz->rgrc[0].right -= border_thickness->right;
2012 sz->rgrc[0].bottom -= border_thickness->bottom;
2013
2014 if (_DwmExtendFrameIntoClientArea)
2015 _DwmExtendFrameIntoClientArea(hWnd, margins);
2016 SetWindowPos(hWnd, NULL, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED);
2017 return 0;
2018 }
2019 }
2020 else if(msg == WM_NCHITTEST && _DW_DARK_MODE_ENABLED && _DW_DARK_MODE_ALLOWED > DW_DARK_MODE_BASIC)
2021 {
2022 /* Handle close/minimize/maximize/help button */
2023 LRESULT lResult;
2024
2025 if(_DwmDefWindowProc && _DwmDefWindowProc(hWnd, msg, mp1, mp2, &lResult))
2026 return lResult;
2027
2028 /* Do default processing, except change the result for caption area */
2029 lResult = DefWindowProc(hWnd, msg, mp1, mp2);
2030 if(lResult == HTCLIENT)
2031 {
2032 MARGINS *margins = dw_window_get_data(hWnd, "_dw_margins");
2033 RECT *border_thickness = dw_window_get_data(hWnd, "_dw_border");
2034
2035 if (margins && border_thickness)
2036 {
2037 POINT pt = { LOWORD(mp2), HIWORD(mp2) };
2038
2039 ScreenToClient(hWnd, &pt);
2040 if (pt.y < border_thickness->top) return HTTOP;
2041 if (pt.y < margins->cyTopHeight) return HTCAPTION;
2042 }
2043 }
2044 return lResult;
2045 }
2046 #endif
1994 2047
1995 /* Deal with translating some messages */ 2048 /* Deal with translating some messages */
1996 if (msg == WM_USER+2) 2049 if (msg == WM_USER+2)
1997 { 2050 {
1998 taskbar = TRUE; 2051 taskbar = TRUE;
2503 _DwmIsCompositionEnabled(&_dw_composition); 2556 _DwmIsCompositionEnabled(&_dw_composition);
2504 2557
2505 /* If we are no longer compositing... disable layered windows */ 2558 /* If we are no longer compositing... disable layered windows */
2506 if(!_dw_composition && (styleex & WS_EX_LAYERED)) 2559 if(!_dw_composition && (styleex & WS_EX_LAYERED))
2507 { 2560 {
2508 MARGINS mar = {0}; 2561 MARGINS *mar = dw_window_get_data(hWnd, "_dw_margins");
2509 2562
2510 SetWindowLongPtr(hWnd, GWL_EXSTYLE, styleex & ~WS_EX_LAYERED); 2563 SetWindowLongPtr(hWnd, GWL_EXSTYLE, styleex & ~WS_EX_LAYERED);
2511 if(_DwmExtendFrameIntoClientArea) 2564 if(_DwmExtendFrameIntoClientArea && mar)
2512 _DwmExtendFrameIntoClientArea(hWnd, &mar); 2565 _DwmExtendFrameIntoClientArea(hWnd, mar);
2513 } 2566 }
2514 } 2567 }
2515 break; 2568 break;
2516 case WM_SETTINGCHANGE: 2569 case WM_SETTINGCHANGE:
2517 { 2570 {
2552 break; 2605 break;
2553 case WM_SIZE: 2606 case WM_SIZE:
2554 { 2607 {
2555 static int lastx = -1, lasty = -1; 2608 static int lastx = -1, lasty = -1;
2556 static HWND lasthwnd = 0; 2609 static HWND lasthwnd = 0;
2557 2610 int x = LOWORD(mp2), y = HIWORD(mp2);
2558 if(lastx != LOWORD(mp2) || lasty != HIWORD(mp2) || lasthwnd != hWnd) 2611
2612 if(lastx != x || lasty != y || lasthwnd != hWnd)
2559 { 2613 {
2560 Box *mybox = (Box *)GetWindowLongPtr(hWnd, GWLP_USERDATA); 2614 Box *mybox = (Box *)GetWindowLongPtr(hWnd, GWLP_USERDATA);
2561 2615
2562 if(mybox && mybox->count) 2616 if(mybox && mybox->count)
2563 { 2617 {
2564 lastx = LOWORD(mp2); 2618 int xborder = 0, yborder = 0;
2565 lasty = HIWORD(mp2); 2619
2620 lastx = x;
2621 lasty = y;
2566 lasthwnd = hWnd; 2622 lasthwnd = hWnd;
2567 2623
2624 #ifdef DARK_MODE_TITLEBAR_MENU
2625 if(_DW_DARK_MODE_ALLOWED > DW_DARK_MODE_BASIC && _DW_DARK_MODE_ENABLED)
2626 {
2627 RECT *border_thickness = dw_window_get_data(hWnd, "_dw_border");
2628
2629 if(border_thickness)
2630 {
2631 dw_debug("Modifying resize from original %d, %d, %d, %d\n", x, y, xborder, yborder);
2632 x -= (border_thickness->left + border_thickness->right);
2633 y -= (border_thickness->top + border_thickness->bottom);
2634 xborder = border_thickness->left;
2635 yborder = border_thickness->top;
2636 dw_debug("To resize %d, %d, %d, %d\n", x, y, xborder, yborder);
2637 }
2638 }
2639 #endif
2640
2568 ShowWindow(mybox->items[0].hwnd, SW_HIDE); 2641 ShowWindow(mybox->items[0].hwnd, SW_HIDE);
2569 _do_resize(mybox,LOWORD(mp2),HIWORD(mp2)); 2642 _do_resize(mybox, x, y, xborder, yborder);
2570 ShowWindow(mybox->items[0].hwnd, SW_SHOW); 2643 ShowWindow(mybox->items[0].hwnd, SW_SHOW);
2571 return 0; 2644 return 0;
2572 } 2645 }
2573 } 2646 }
2574 } 2647 }
2725 case WM_MOUSEMOVE: 2798 case WM_MOUSEMOVE:
2726 _wndproc(hWnd, msg, mp1, mp2); 2799 _wndproc(hWnd, msg, mp1, mp2);
2727 break; 2800 break;
2728 #ifdef AEROGLASS 2801 #ifdef AEROGLASS
2729 case WM_THEMECHANGED: 2802 case WM_THEMECHANGED:
2730 if(_DW_DARK_MODE_ALLOWED > 1 && _DW_DARK_MODE_SUPPORTED) 2803 if(_DW_DARK_MODE_ALLOWED > DW_DARK_MODE_BASIC && _DW_DARK_MODE_SUPPORTED)
2731 { 2804 {
2732 SetClassLongPtr(hWnd, GCLP_HBRBACKGROUND, (LONG_PTR)_DW_GetSysColorBrush(COLOR_3DFACE)); 2805 SetClassLongPtr(hWnd, GCLP_HBRBACKGROUND, (LONG_PTR)_DW_GetSysColorBrush(COLOR_3DFACE));
2733 InvalidateRect(hWnd, NULL, TRUE); 2806 InvalidateRect(hWnd, NULL, TRUE);
2734 } 2807 }
2735 break; 2808 break;
3180 SetTextColor((HDC)mp1, RGB(DW_RED_VALUE(fore), 3253 SetTextColor((HDC)mp1, RGB(DW_RED_VALUE(fore),
3181 DW_GREEN_VALUE(fore), 3254 DW_GREEN_VALUE(fore),
3182 DW_BLUE_VALUE(fore))); 3255 DW_BLUE_VALUE(fore)));
3183 } 3256 }
3184 #ifdef AEROGLASS 3257 #ifdef AEROGLASS
3185 else if(thiscinfo->fore == DW_CLR_DEFAULT && _DW_DARK_MODE_ALLOWED > 1 && _DW_DARK_MODE_ENABLED) 3258 else if(thiscinfo->fore == DW_CLR_DEFAULT && _DW_DARK_MODE_ALLOWED > DW_DARK_MODE_BASIC && _DW_DARK_MODE_ENABLED)
3186 SetTextColor((HDC)mp1, _DW_GetSysColor(COLOR_WINDOWTEXT)); 3259 SetTextColor((HDC)mp1, _DW_GetSysColor(COLOR_WINDOWTEXT));
3187 #endif 3260 #endif
3188 /* Handle background */ 3261 /* Handle background */
3189 if(thiscinfo->back == DW_RGB_TRANSPARENT) 3262 if(thiscinfo->back == DW_RGB_TRANSPARENT)
3190 { 3263 {
3251 case WM_CTLCOLOREDIT: 3324 case WM_CTLCOLOREDIT:
3252 case WM_CTLCOLORMSGBOX: 3325 case WM_CTLCOLORMSGBOX:
3253 case WM_CTLCOLORSCROLLBAR: 3326 case WM_CTLCOLORSCROLLBAR:
3254 case WM_CTLCOLORDLG: 3327 case WM_CTLCOLORDLG:
3255 { 3328 {
3256 if(_DW_DARK_MODE_ALLOWED > 1 && _DW_DARK_MODE_ENABLED) 3329 if(_DW_DARK_MODE_ALLOWED > DW_DARK_MODE_BASIC && _DW_DARK_MODE_ENABLED)
3257 { 3330 {
3258 ColorInfo *parentcinfo = (ColorInfo *)GetWindowLongPtr(hWnd, GWLP_USERDATA); 3331 ColorInfo *parentcinfo = (ColorInfo *)GetWindowLongPtr(hWnd, GWLP_USERDATA);
3259 int thisback = thiscinfo ? thiscinfo->back : -1; 3332 int thisback = thiscinfo ? thiscinfo->back : -1;
3260 3333
3261 if(thisback == DW_RGB_TRANSPARENT && parentcinfo) 3334 if(thisback == DW_RGB_TRANSPARENT && parentcinfo)
3302 case WM_MOUSEMOVE: 3375 case WM_MOUSEMOVE:
3303 _wndproc(hWnd, msg, mp1, mp2); 3376 _wndproc(hWnd, msg, mp1, mp2);
3304 break; 3377 break;
3305 #ifdef AEROGLASS 3378 #ifdef AEROGLASS
3306 case WM_THEMECHANGED: 3379 case WM_THEMECHANGED:
3307 if(_DW_DARK_MODE_ALLOWED > 1 && _DW_DARK_MODE_SUPPORTED) 3380 if(_DW_DARK_MODE_ALLOWED > DW_DARK_MODE_BASIC && _DW_DARK_MODE_SUPPORTED)
3308 { 3381 {
3309 if(!continfo || continfo->cinfo.back == -1 || continfo->cinfo.back == DW_CLR_DEFAULT) 3382 if(!continfo || continfo->cinfo.back == -1 || continfo->cinfo.back == DW_CLR_DEFAULT)
3310 { 3383 {
3311 COLORREF bk = _DW_GetSysColor(COLOR_WINDOW); 3384 COLORREF bk = _DW_GetSysColor(COLOR_WINDOW);
3312 3385
3328 3401
3329 /* Create the colors based on the current theme */ 3402 /* Create the colors based on the current theme */
3330 if(continfo->odd == DW_CLR_DEFAULT) 3403 if(continfo->odd == DW_CLR_DEFAULT)
3331 { 3404 {
3332 #ifdef AEROGLASS 3405 #ifdef AEROGLASS
3333 if(_DW_DARK_MODE_ALLOWED > 1 && _DW_DARK_MODE_ENABLED) 3406 if(_DW_DARK_MODE_ALLOWED > DW_DARK_MODE_BASIC && _DW_DARK_MODE_ENABLED)
3334 odd = RGB(100,100,100); 3407 odd = RGB(100,100,100);
3335 else 3408 else
3336 #endif 3409 #endif
3337 odd = RGB(230, 230, 230); 3410 odd = RGB(230, 230, 230);
3338 } 3411 }
3515 LRESULT CALLBACK _treewndproc(HWND hWnd, UINT msg, WPARAM mp1, LPARAM mp2) 3588 LRESULT CALLBACK _treewndproc(HWND hWnd, UINT msg, WPARAM mp1, LPARAM mp2)
3516 { 3589 {
3517 #ifdef AEROGLASS 3590 #ifdef AEROGLASS
3518 if(msg == WM_THEMECHANGED) 3591 if(msg == WM_THEMECHANGED)
3519 { 3592 {
3520 if(_DW_DARK_MODE_ALLOWED > 1 && _DW_DARK_MODE_SUPPORTED) 3593 if(_DW_DARK_MODE_ALLOWED > DW_DARK_MODE_BASIC && _DW_DARK_MODE_SUPPORTED)
3521 { 3594 {
3522 ContainerInfo *continfo = (ContainerInfo *)GetWindowLongPtr(hWnd, GWLP_USERDATA); 3595 ContainerInfo *continfo = (ContainerInfo *)GetWindowLongPtr(hWnd, GWLP_USERDATA);
3523 3596
3524 if(!continfo || continfo->cinfo.back == -1 || continfo->cinfo.back == DW_CLR_DEFAULT) 3597 if(!continfo || continfo->cinfo.back == -1 || continfo->cinfo.back == DW_CLR_DEFAULT)
3525 TreeView_SetBkColor(hWnd, _DW_GetSysColor(COLOR_WINDOW)); 3598 TreeView_SetBkColor(hWnd, _DW_GetSysColor(COLOR_WINDOW));
3573 Box *tmp = (Box *)GetWindowLongPtr(handle1, GWLP_USERDATA); 3646 Box *tmp = (Box *)GetWindowLongPtr(handle1, GWLP_USERDATA);
3574 3647
3575 newx = (int)((float)newx * ratio) - (SPLITBAR_WIDTH/2); 3648 newx = (int)((float)newx * ratio) - (SPLITBAR_WIDTH/2);
3576 3649
3577 MoveWindow(handle1, 0, 0, newx, y, FALSE); 3650 MoveWindow(handle1, 0, 0, newx, y, FALSE);
3578 _do_resize(tmp, newx - 1, y - 1); 3651 _do_resize(tmp, newx - 1, y - 1, 0, 0);
3579 3652
3580 tmp = (Box *)GetWindowLongPtr(handle2, GWLP_USERDATA); 3653 tmp = (Box *)GetWindowLongPtr(handle2, GWLP_USERDATA);
3581 3654
3582 newx = x - newx - SPLITBAR_WIDTH; 3655 newx = x - newx - SPLITBAR_WIDTH;
3583 3656
3584 MoveWindow(handle2, x - newx, 0, newx, y, FALSE); 3657 MoveWindow(handle2, x - newx, 0, newx, y, FALSE);
3585 _do_resize(tmp, newx - 1, y - 1); 3658 _do_resize(tmp, newx - 1, y - 1, 0, 0);
3586 3659
3587 dw_window_set_data(hwnd, "_dw_start", DW_INT_TO_POINTER(newx)); 3660 dw_window_set_data(hwnd, "_dw_start", DW_INT_TO_POINTER(newx));
3588 } 3661 }
3589 else 3662 else
3590 { 3663 {
3593 Box *tmp = (Box *)GetWindowLongPtr(handle2, GWLP_USERDATA); 3666 Box *tmp = (Box *)GetWindowLongPtr(handle2, GWLP_USERDATA);
3594 3667
3595 newy = (int)((float)newy * ratio) - (SPLITBAR_WIDTH/2); 3668 newy = (int)((float)newy * ratio) - (SPLITBAR_WIDTH/2);
3596 3669
3597 MoveWindow(handle2, 0, y - newy, x, newy, FALSE); 3670 MoveWindow(handle2, 0, y - newy, x, newy, FALSE);
3598 _do_resize(tmp, x - 1, newy - 1); 3671 _do_resize(tmp, x - 1, newy - 1, 0, 0);
3599 3672
3600 tmp = (Box *)GetWindowLongPtr(handle1, GWLP_USERDATA); 3673 tmp = (Box *)GetWindowLongPtr(handle1, GWLP_USERDATA);
3601 3674
3602 newy = y - newy - SPLITBAR_WIDTH; 3675 newy = y - newy - SPLITBAR_WIDTH;
3603 3676
3604 MoveWindow(handle1, 0, 0, x, newy, FALSE); 3677 MoveWindow(handle1, 0, 0, x, newy, FALSE);
3605 _do_resize(tmp, x - 1, newy - 1); 3678 _do_resize(tmp, x - 1, newy - 1, 0, 0);
3606 3679
3607 dw_window_set_data(hwnd, "_dw_start", DW_INT_TO_POINTER(newy)); 3680 dw_window_set_data(hwnd, "_dw_start", DW_INT_TO_POINTER(newy));
3608 } 3681 }
3609 3682
3610 ShowWindow(handle1, SW_SHOW); 3683 ShowWindow(handle1, SW_SHOW);
3687 case WM_ACTIVATE: 3760 case WM_ACTIVATE:
3688 case WM_SETFOCUS: 3761 case WM_SETFOCUS:
3689 return FALSE; 3762 return FALSE;
3690 #ifdef AEROGLASS 3763 #ifdef AEROGLASS
3691 case WM_THEMECHANGED: 3764 case WM_THEMECHANGED:
3692 if(_DW_DARK_MODE_ALLOWED > 1 && _DW_DARK_MODE_SUPPORTED) 3765 if(_DW_DARK_MODE_ALLOWED > DW_DARK_MODE_BASIC && _DW_DARK_MODE_SUPPORTED)
3693 InvalidateRect(hwnd, NULL, TRUE); 3766 InvalidateRect(hwnd, NULL, TRUE);
3694 break; 3767 break;
3695 #endif 3768 #endif
3696 case WM_PAINT: 3769 case WM_PAINT:
3697 { 3770 {
3799 InvalidateRgn(hwnd, NULL, TRUE); 3872 InvalidateRgn(hwnd, NULL, TRUE);
3800 return ret; 3873 return ret;
3801 } 3874 }
3802 #ifdef AEROGLASS 3875 #ifdef AEROGLASS
3803 case WM_THEMECHANGED: 3876 case WM_THEMECHANGED:
3804 if(_DW_DARK_MODE_ALLOWED > 1 && _DW_DARK_MODE_SUPPORTED) 3877 if(_DW_DARK_MODE_ALLOWED > DW_DARK_MODE_BASIC && _DW_DARK_MODE_SUPPORTED)
3805 InvalidateRect(hwnd, NULL, TRUE); 3878 InvalidateRect(hwnd, NULL, TRUE);
3806 break; 3879 break;
3807 #endif 3880 #endif
3808 case WM_PAINT: 3881 case WM_PAINT:
3809 { 3882 {
3828 /* If we are in full dark mode, or we have custom colors selected... 3901 /* If we are in full dark mode, or we have custom colors selected...
3829 * we will draw the status window ourselves... otherwise DrawStatusText() 3902 * we will draw the status window ourselves... otherwise DrawStatusText()
3830 */ 3903 */
3831 if( 3904 if(
3832 #ifdef AEROGLASS 3905 #ifdef AEROGLASS
3833 (_DW_DARK_MODE_ALLOWED > 1 && _DW_DARK_MODE_ENABLED) || 3906 (_DW_DARK_MODE_ALLOWED > DW_DARK_MODE_BASIC && _DW_DARK_MODE_ENABLED) ||
3834 #endif 3907 #endif
3835 (cinfo && cinfo->fore != -1 && cinfo->fore != DW_CLR_DEFAULT && 3908 (cinfo && cinfo->fore != -1 && cinfo->fore != DW_CLR_DEFAULT &&
3836 cinfo->back !=- -1 && cinfo->back != DW_CLR_DEFAULT)) 3909 cinfo->back !=- -1 && cinfo->back != DW_CLR_DEFAULT))
3837 { 3910 {
3838 ULONG fore = (cinfo && (cinfo->fore != -1 && cinfo->fore != DW_CLR_DEFAULT)) ? _internal_color(cinfo->fore) : DW_RGB_TRANSPARENT; 3911 ULONG fore = (cinfo && (cinfo->fore != -1 && cinfo->fore != DW_CLR_DEFAULT)) ? _internal_color(cinfo->fore) : DW_RGB_TRANSPARENT;
4143 MoveWindow(array[pageid]->hwnd, rect.left, rect.top, 4216 MoveWindow(array[pageid]->hwnd, rect.left, rect.top,
4144 rect.right - rect.left, rect.bottom-rect.top, TRUE); 4217 rect.right - rect.left, rect.bottom-rect.top, TRUE);
4145 if(box && box->count) 4218 if(box && box->count)
4146 { 4219 {
4147 ShowWindow(box->items[0].hwnd, SW_HIDE); 4220 ShowWindow(box->items[0].hwnd, SW_HIDE);
4148 _do_resize(box, rect.right - rect.left, rect.bottom - rect.top); 4221 _do_resize(box, rect.right - rect.left, rect.bottom - rect.top, 0, 0);
4149 ShowWindow(box->items[0].hwnd, SW_SHOW); 4222 ShowWindow(box->items[0].hwnd, SW_SHOW);
4150 } 4223 }
4151 4224
4152 ShowWindow(array[pageid]->hwnd, SW_SHOWNORMAL); 4225 ShowWindow(array[pageid]->hwnd, SW_SHOWNORMAL);
4153 } 4226 }
4313 /* Attempt to load the Desktop Window Manager and Theme library */ 4386 /* Attempt to load the Desktop Window Manager and Theme library */
4314 if(huxtheme && (hdwm = LoadLibrary(TEXT("dwmapi")))) 4387 if(huxtheme && (hdwm = LoadLibrary(TEXT("dwmapi"))))
4315 { 4388 {
4316 _DwmExtendFrameIntoClientArea = (HRESULT (WINAPI *)(HWND, const MARGINS *))GetProcAddress(hdwm, "DwmExtendFrameIntoClientArea"); 4389 _DwmExtendFrameIntoClientArea = (HRESULT (WINAPI *)(HWND, const MARGINS *))GetProcAddress(hdwm, "DwmExtendFrameIntoClientArea");
4317 _DwmSetWindowAttribute = (HRESULT (WINAPI *)(HWND, DWORD, LPCVOID, DWORD))GetProcAddress(hdwm, "DwmSetWindowAttribute"); 4390 _DwmSetWindowAttribute = (HRESULT (WINAPI *)(HWND, DWORD, LPCVOID, DWORD))GetProcAddress(hdwm, "DwmSetWindowAttribute");
4391 _DwmDefWindowProc = (BOOL (WINAPI *)(HWND, UINT, WPARAM, LPARAM, LRESULT *))GetProcAddress(hdwm, "DwmDefWindowProc");
4318 if((_DwmIsCompositionEnabled = (HRESULT (WINAPI *)(BOOL *))GetProcAddress(hdwm, "DwmIsCompositionEnabled"))) 4392 if((_DwmIsCompositionEnabled = (HRESULT (WINAPI *)(BOOL *))GetProcAddress(hdwm, "DwmIsCompositionEnabled")))
4319 _DwmIsCompositionEnabled(&_dw_composition); 4393 _DwmIsCompositionEnabled(&_dw_composition);
4320 _OpenThemeData = (HTHEME (WINAPI *)(HWND, LPCWSTR))GetProcAddress(huxtheme, "OpenThemeData"); 4394 _OpenThemeData = (HTHEME (WINAPI *)(HWND, LPCWSTR))GetProcAddress(huxtheme, "OpenThemeData");
4321 _BeginBufferedPaint = (HPAINTBUFFER (WINAPI *)(HDC, const RECT *, BP_BUFFERFORMAT, BP_PAINTPARAMS *, HDC *))GetProcAddress(huxtheme, "BeginBufferedPaint"); 4395 _BeginBufferedPaint = (HPAINTBUFFER (WINAPI *)(HDC, const RECT *, BP_BUFFERFORMAT, BP_PAINTPARAMS *, HDC *))GetProcAddress(huxtheme, "BeginBufferedPaint");
4322 _BufferedPaintSetAlpha = (HRESULT (WINAPI *)(HPAINTBUFFER, const RECT *, BYTE))GetProcAddress(huxtheme, "BufferedPaintSetAlpha"); 4396 _BufferedPaintSetAlpha = (HRESULT (WINAPI *)(HPAINTBUFFER, const RECT *, BYTE))GetProcAddress(huxtheme, "BufferedPaintSetAlpha");
4856 int istoplevel = (GetParent(handle) == HWND_DESKTOP); 4930 int istoplevel = (GetParent(handle) == HWND_DESKTOP);
4857 4931
4858 GetClientRect(handle, &rect); 4932 GetClientRect(handle, &rect);
4859 4933
4860 ShowWindow(istoplevel ? mybox->items[0].hwnd : handle, SW_HIDE); 4934 ShowWindow(istoplevel ? mybox->items[0].hwnd : handle, SW_HIDE);
4861 _do_resize(mybox, rect.right - rect.left, rect.bottom - rect.top); 4935 _do_resize(mybox, rect.right - rect.left, rect.bottom - rect.top, 0, 0);
4862 ShowWindow(istoplevel ? mybox->items[0].hwnd : handle, SW_SHOW); 4936 ShowWindow(istoplevel ? mybox->items[0].hwnd : handle, SW_SHOW);
4863 } 4937 }
4864 } 4938 }
4865 4939
4866 /* 4940 /*
5570 { 5644 {
5571 HWND hwndframe; 5645 HWND hwndframe;
5572 Box *newbox = calloc(sizeof(Box), 1); 5646 Box *newbox = calloc(sizeof(Box), 1);
5573 ULONG flStyleEx = 0; 5647 ULONG flStyleEx = 0;
5574 #ifdef AEROGLASS 5648 #ifdef AEROGLASS
5575 MARGINS mar = {-1}; 5649 MARGINS *margins = calloc(1, sizeof(MARGINS));
5576 5650 RECT *border_thickness = calloc(1, sizeof(RECT));
5577 if(_dw_composition && (flStyle & DW_FCF_COMPOSITED)) 5651
5652 if (_dw_composition && (flStyle & DW_FCF_COMPOSITED))
5578 flStyleEx = WS_EX_LAYERED; 5653 flStyleEx = WS_EX_LAYERED;
5579 #endif 5654 #endif
5580 5655
5581 newbox->type = DW_VERT; 5656 newbox->type = DW_VERT;
5582 newbox->vsize = newbox->hsize = SIZEEXPAND; 5657 newbox->vsize = newbox->hsize = SIZEEXPAND;
5596 flStyleEx |= WS_EX_TOOLWINDOW; 5671 flStyleEx |= WS_EX_TOOLWINDOW;
5597 5672
5598 hwndframe = CreateWindowEx(flStyleEx, ClassName, UTF8toWide(title), (flStyle | WS_CLIPCHILDREN) & 0xffff0000, CW_USEDEFAULT, CW_USEDEFAULT, 5673 hwndframe = CreateWindowEx(flStyleEx, ClassName, UTF8toWide(title), (flStyle | WS_CLIPCHILDREN) & 0xffff0000, CW_USEDEFAULT, CW_USEDEFAULT,
5599 0, 0, hwndOwner, NULL, DWInstance, NULL); 5674 0, 0, hwndOwner, NULL, DWInstance, NULL);
5600 } 5675 }
5676
5601 SetWindowLongPtr(hwndframe, GWLP_USERDATA, (LONG_PTR)newbox); 5677 SetWindowLongPtr(hwndframe, GWLP_USERDATA, (LONG_PTR)newbox);
5602 5678
5603 if(hwndOwner) 5679 if(hwndOwner)
5604 SetParent(hwndframe, hwndOwner); 5680 SetParent(hwndframe, hwndOwner);
5605 5681
5606 #ifdef AEROGLASS 5682 #ifdef AEROGLASS
5683 /* Determine the borders of the default window frame */
5684 AdjustWindowRectEx(border_thickness, flStyle, FALSE, 0);
5685 border_thickness->left *= -1;
5686 border_thickness->top *= -1;
5687
5688 /* With the DW_FCF_COMPOSITED flag, expand it to the entire window */
5689 if (flStyle & DW_FCF_COMPOSITED)
5690 {
5691 MARGINS fullmar = { -1 };
5692 *margins = fullmar;
5693 }
5694 else
5695 {
5696 /* Otherwise use the calculated border sizes */
5697 margins->cyTopHeight = border_thickness->top;
5698 }
5699
5700 dw_window_set_data(hwndframe, "_dw_margins", margins);
5701 dw_window_set_data(hwndframe, "_dw_border", border_thickness);
5702
5607 /* Attempt to enable Aero glass background on the entire window */ 5703 /* Attempt to enable Aero glass background on the entire window */
5608 if(_DwmExtendFrameIntoClientArea && _dw_composition && (flStyle & DW_FCF_COMPOSITED)) 5704 if(_DwmExtendFrameIntoClientArea && _dw_composition &&
5705 ((flStyle & DW_FCF_COMPOSITED) || (_DW_DARK_MODE_ALLOWED > DW_DARK_MODE_BASIC && _DW_DARK_MODE_ENABLED)))
5609 { 5706 {
5610 SetLayeredWindowAttributes(hwndframe, _dw_transparencykey, 0, LWA_COLORKEY); 5707 SetLayeredWindowAttributes(hwndframe, _dw_transparencykey, 0, LWA_COLORKEY);
5611 _DwmExtendFrameIntoClientArea(hwndframe, &mar); 5708 _DwmExtendFrameIntoClientArea(hwndframe, margins);
5612 } 5709 }
5613 #endif 5710 #endif
5614 5711
5615 return hwndframe; 5712 return hwndframe;
5616 } 5713 }
7901 DWORD dwExStyle = GetWindowLong(handle, GWL_EXSTYLE); 7998 DWORD dwExStyle = GetWindowLong(handle, GWL_EXSTYLE);
7902 HMENU menu = GetMenu(handle) ; 7999 HMENU menu = GetMenu(handle) ;
7903 RECT rc = { 0 } ; 8000 RECT rc = { 0 } ;
7904 8001
7905 /* Calculate space requirements */ 8002 /* Calculate space requirements */
7906 _resize_box(thisbox, &depth, *width, *height, 1); 8003 _resize_box(thisbox, &depth, *width, *height, 0, 0, 1);
7907 8004
7908 rc.right = thisbox->minwidth; 8005 rc.right = thisbox->minwidth;
7909 rc.bottom = thisbox->minheight; 8006 rc.bottom = thisbox->minheight;
7910 8007
7911 /* Take into account the window border and menu here */ 8008 /* Take into account the window border and menu here */
7964 if(thisbox) 8061 if(thisbox)
7965 { 8062 {
7966 int depth = 0; 8063 int depth = 0;
7967 8064
7968 /* Calculate space requirements */ 8065 /* Calculate space requirements */
7969 _resize_box(thisbox, &depth, 0, 0, 1); 8066 _resize_box(thisbox, &depth, 0, 0, 0, 0, 1);
7970 8067
7971 /* Return what was requested */ 8068 /* Return what was requested */
7972 if(width) *width = thisbox->minwidth; 8069 if(width) *width = thisbox->minwidth;
7973 if(height) *height = thisbox->minheight; 8070 if(height) *height = thisbox->minheight;
7974 } 8071 }
13456 #endif 13553 #endif
13457 /* These features are supported and configurable */ 13554 /* These features are supported and configurable */
13458 #ifdef AEROGLASS 13555 #ifdef AEROGLASS
13459 case DW_FEATURE_DARK_MODE: 13556 case DW_FEATURE_DARK_MODE:
13460 { 13557 {
13461 if(state >= 0 && state <= 3) 13558 if(state >= DW_DARK_MODE_DISABLED && state <= DW_DARK_MODE_FORCED)
13462 { 13559 {
13463 _DW_DARK_MODE_ALLOWED = state; 13560 _DW_DARK_MODE_ALLOWED = state;
13464 return DW_ERROR_NONE; 13561 return DW_ERROR_NONE;
13465 } 13562 }
13466 return DW_ERROR_GENERAL; 13563 return DW_ERROR_GENERAL;