diff --git a/dll/win32/comctl32/toolbar.c b/dll/win32/comctl32/toolbar.c index e2b6193b66..d6ff704eb6 100644 --- a/dll/win32/comctl32/toolbar.c +++ b/dll/win32/comctl32/toolbar.c @@ -6739,15 +6739,32 @@ TOOLBAR_SysColorChange (void) /* update theme after a WM_THEMECHANGED message */ static LRESULT theme_changed (TOOLBAR_INFO *infoPtr) { + LONG res; + HKEY hkey = NULL; + DWORD Disposition; + DWORD Themed = 0; + HTHEME theme = GetWindowTheme (infoPtr->hwndSelf); CloseThemeData (theme); OpenThemeData (infoPtr->hwndSelf, themeClass); theme = GetWindowTheme (infoPtr->hwndSelf); if (theme) + { GetThemeMargins(theme, NULL, TP_BUTTON, TS_NORMAL, TMT_CONTENTMARGINS, NULL, &infoPtr->themeMargins); + Themed = 1; + } else memset(&infoPtr->themeMargins, 0 ,sizeof(infoPtr->themeMargins)); + res = RegCreateKeyExW(HKEY_LOCAL_MACHINE, L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer", + 0, NULL, 0, KEY_SET_VALUE, NULL, &hkey, &Disposition); + if (res != ERROR_SUCCESS) + ERR("RegCreateKeyExW returned '%ld'.\n", res); + else + res = RegSetValueExW(hkey, L"ThemeActive", 0, REG_DWORD, (BYTE *)&Themed, sizeof(DWORD)); + + RegCloseKey(hkey); + return 0; } #else diff --git a/win32ss/user/ntuser/scrollbar.c b/win32ss/user/ntuser/scrollbar.c index ece40873a4..198fe04e73 100644 --- a/win32ss/user/ntuser/scrollbar.c +++ b/win32ss/user/ntuser/scrollbar.c @@ -10,6 +10,38 @@ #include DBG_DEFAULT_CHANNEL(UserScrollbar); +BOOL IsThemeActive(void) +{ + BOOL bActive; + LRESULT Result; + HKEY hKey; + DWORD tmp[10]; + DWORD buffsize; + + bActive = FALSE; + Result = RegOpenKey(L"\\Registry\\Machine\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer", + &hKey); + if (Result == ERROR_SUCCESS) + { + buffsize = sizeof(tmp); + Result = RegQueryValue(hKey, + L"ThemeActive", + REG_DWORD, + (LPBYTE)tmp, + &buffsize); + if (NT_SUCCESS(Result)) + { + bActive = (tmp[0] != 0); + } + else + ERR("RegQueryValue Failed.\n"); + } + else + ERR("RegOpenKey Failed.\n"); + + return bActive; +} + /* Definitions for scrollbar hit testing [See SCROLLBARINFO in MSDN] */ #define SCROLL_NOWHERE 0x00 /* Outside the scroll bar */ #define SCROLL_TOP_ARROW 0x01 /* Top or left arrow */ @@ -643,20 +675,38 @@ co_IntSetScrollInfo(PWND Window, INT nBar, LPCSCROLLINFO lpsi, BOOL bRedraw) return lpsi->fMask & SIF_PREVIOUSPOS ? OldPos : pSBData->pos; /* SetWindowPos() already did the painting */ if (bRedraw) { - if (action & SA_SSI_REPAINT_ARROWS) + RECTL UpdateRect = psbi->rcScrollBar; + UpdateRect.left -= Window->rcClient.left - Window->rcWindow.left; + UpdateRect.right -= Window->rcClient.left - Window->rcWindow.left; + UpdateRect.top -= Window->rcClient.top - Window->rcWindow.top; + UpdateRect.bottom -= Window->rcClient.top - Window->rcWindow.top; + + if (action & SA_SSI_REPAINT_ARROWS && !IsThemeActive()) { // Redraw the entire bar. - RECTL UpdateRect = psbi->rcScrollBar; - UpdateRect.left -= Window->rcClient.left - Window->rcWindow.left; - UpdateRect.right -= Window->rcClient.left - Window->rcWindow.left; - UpdateRect.top -= Window->rcClient.top - Window->rcWindow.top; - UpdateRect.bottom -= Window->rcClient.top - Window->rcWindow.top; co_UserRedrawWindow(Window, &UpdateRect, 0, RDW_INVALIDATE | RDW_FRAME); } - else + + /* Just paint the interior and not the arrows. */ + if (!(action & SA_SSI_REPAINT_ARROWS) && IsThemeActive()) { - // Redraw only the interior part of the bar. - IntRefeshScrollInterior(Window, nBar, psbi); + if (nBar == SB_HORZ) + { + UpdateRect.left += psbi->dxyLineButton; + UpdateRect.right -= psbi->dxyLineButton; + } + if (nBar == SB_VERT) + { + UpdateRect.top += psbi->dxyLineButton; + UpdateRect.bottom -= psbi->dxyLineButton; + } } + if (IsThemeActive()) + co_UserRedrawWindow(Window, &UpdateRect, 0, RDW_INVALIDATE | RDW_FRAME); + else + if (!(action & SA_SSI_REPAINT_ARROWS)) + // Redraw only the interior part of the bar. + IntRefeshScrollInterior(Window, nBar, psbi); + } // FIXME: Arrows /* else if( action & SA_SSI_REPAINT_ARROWS ) {