From fcbc8f277a5cb76f00ee4947394351f886cc6e57 Mon Sep 17 00:00:00 2001 From: Amine Khaldi Date: Sat, 13 Jun 2015 11:00:24 +0000 Subject: [PATCH] [USER32][UXTHEME] Properly paint the general menubar when application is themed. Brought to you by Stefano Toncich aka Tonix. CORE-9585 svn path=/trunk/; revision=68116 --- reactos/dll/win32/uxtheme/nonclient.c | 4 --- reactos/win32ss/user/user32/windows/font.c | 29 +++++++++++++++++++++- 2 files changed, 28 insertions(+), 5 deletions(-) diff --git a/reactos/dll/win32/uxtheme/nonclient.c b/reactos/dll/win32/uxtheme/nonclient.c index 36c9274c4fb..4cb7079cbab 100644 --- a/reactos/dll/win32/uxtheme/nonclient.c +++ b/reactos/dll/win32/uxtheme/nonclient.c @@ -513,11 +513,7 @@ ThemeDrawMenuItem(PDRAW_CONTEXT pcontext, HMENU Menu, int imenu) GetMenuItemRect(pcontext->hWnd, Menu, imenu, &Rect); -#ifdef __REACTOS__ - OffsetRect(&Rect, -pcontext->wi.rcClient.left, -pcontext->wi.rcClient.top); -#else OffsetRect(&Rect, -pcontext->wi.rcWindow.left, -pcontext->wi.rcWindow.top); -#endif SetBkColor(pcontext->hDC, GetSysColor(flat_menu ? COLOR_MENUBAR : COLOR_MENU)); SetTextColor(pcontext->hDC, GetSysColor(Item.fState & MF_GRAYED ? COLOR_GRAYTEXT : COLOR_MENUTEXT)); diff --git a/reactos/win32ss/user/user32/windows/font.c b/reactos/win32ss/user/user32/windows/font.c index 66f4e1d640a..56fec12ea68 100644 --- a/reactos/win32ss/user/user32/windows/font.c +++ b/reactos/win32ss/user/user32/windows/font.c @@ -1212,14 +1212,41 @@ INT WINAPI DrawTextExW( HDC hdc, LPWSTR str, INT i_count, last_line = !(flags & DT_NOCLIP) && y + ((flags & DT_EDITCONTROL) ? 2*lh-1 : lh) > rect->bottom; strPtr = TEXT_NextLineW(hdc, strPtr, &count, line, &len, width, flags, &size, last_line, &p_retstr, tabwidth, &prefix_offset, &ellip); +#ifdef __REACTOS__ + if (flags & DT_CENTER) + { + if (((rect->right - rect->left) < size.cx) && (flags & DT_CALCRECT)) + { + x = rect->left + size.cx; + } + else + { + x = (rect->left + rect->right - size.cx) / 2; + } + } +#else if (flags & DT_CENTER) x = (rect->left + rect->right - size.cx) / 2; +#endif else if (flags & DT_RIGHT) x = rect->right - size.cx; if (flags & DT_SINGLELINE) { if (flags & DT_VCENTER) - y = rect->top + (rect->bottom - rect->top) / 2 + (invert_y ? (size.cy / 2) : (-size.cy / 2)); +#ifdef __REACTOS__ + { + if (((rect->bottom - rect->top) < (invert_y ? -size.cy : size.cy)) && (flags & DT_CALCRECT)) + { + y = rect->top + (invert_y ? -size.cy : size.cy); + } + else + { +#endif + y = rect->top + (rect->bottom - rect->top) / 2 + (invert_y ? (size.cy / 2) : (-size.cy / 2)); +#ifdef __REACTOS__ + } + } +#endif else if (flags & DT_BOTTOM) y = rect->bottom + (invert_y ? 0 : -size.cy); } -- 2.17.1