diff --git a/base/shell/explorer/taskswnd.cpp b/base/shell/explorer/taskswnd.cpp index f8f4147c22..c4c4f8a1fe 100644 --- a/base/shell/explorer/taskswnd.cpp +++ b/base/shell/explorer/taskswnd.cpp @@ -1411,6 +1411,13 @@ public: LRESULT OnThemeChanged(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { TRACE("OmThemeChanged\n"); + WCHAR Themed1[1]; + wcscpy(Themed1, L"0"); + ERR("OmThemeChanged to '%d'.\n", IsThemeActive()); + if (IsThemeActive()) + wcscpy(Themed1, L"1"); + + RegSetValueW(HKEY_LOCAL_MACHINE, L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Themes", REG_SZ, (LPWSTR)Themed1, sizeof(WCHAR)); if (m_Theme) CloseThemeData(m_Theme); diff --git a/win32ss/user/ntuser/scrollbar.c b/win32ss/user/ntuser/scrollbar.c index ece40873a4..96e66a0ede 100644 --- a/win32ss/user/ntuser/scrollbar.c +++ b/win32ss/user/ntuser/scrollbar.c @@ -10,6 +10,36 @@ #include DBG_DEFAULT_CHANNEL(UserScrollbar); +BOOL IsThemeActive(void) +{ + BOOL bActive; + LRESULT Result; + HKEY hKey; + CHAR tmp[10] = ""; + DWORD buffsize = 4 * sizeof(WCHAR); + + bActive = FALSE; + Result = RegOpenKey(L"\\Registry\\Machine\\Software\\Microsoft\\Windows\\CurrentVersion\\Themes", + &hKey); + if (Result == ERROR_SUCCESS) + { + Result = RegQueryValue(hKey, + NULL, + REG_SZ, + (LPBYTE)tmp, + &buffsize); + if (NT_SUCCESS(Result)) + { + bActive = (!strcmp(tmp, "1")); + } + else + ERR("RegQueryValue Failed with '%x'.\n", Result); + } + 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,19 +673,43 @@ 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) - { // 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); + 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 (!IsThemeActive()) + { +// ERR("Not using themes.\n"); + if (action & SA_SSI_REPAINT_ARROWS) + { // Redraw the entire bar. + co_UserRedrawWindow(Window, &UpdateRect, 0, RDW_INVALIDATE | RDW_FRAME); + } + else + { + // Redraw only the interior part of the bar. + IntRefeshScrollInterior(Window, nBar, psbi); + } } - else + else /* Using Themes */ { - // Redraw only the interior part of the bar. - IntRefeshScrollInterior(Window, nBar, psbi); +// ERR("Using themes.\n"); + /* Just paint the interior and not the arrows. */ + if (!(action & SA_SSI_REPAINT_ARROWS)) + { + if (nBar == SB_HORZ) + { + UpdateRect.left += psbi->dxyLineButton; + UpdateRect.right -= psbi->dxyLineButton; + } + if (nBar == SB_VERT) + { + UpdateRect.top += psbi->dxyLineButton; + UpdateRect.bottom -= psbi->dxyLineButton; + } + } + co_UserRedrawWindow(Window, &UpdateRect, 0, RDW_INVALIDATE | RDW_FRAME); } } // FIXME: Arrows /* else if( action & SA_SSI_REPAINT_ARROWS )