Author: gadamopoulos Date: Sun Mar 26 16:46:55 2017 New Revision: 74231
URL: http://svn.reactos.org/svn/reactos?rev=74231&view=rev Log: [EXPLORER]: Fix most problems with the size of the taskbar. (Most problems when run in windows. Running on ros still isn't perfect.) - CTaskSwitchWnd: Use the height of the start button as minimum height in horizontal mode. - CTrayClockWnd: Actually process WM_THEMECHANGED message. - CTaskSwitchWnd: Use SM_CYSIZE as the height of the buttons of the toolbar. - CStartButton: Simplify calculating the minimum size of the button. - CTrayWindow: Don't use IsThemeActive. Checking if OpenThemeData returned non null is enough.
Modified: trunk/reactos/base/shell/explorer/precomp.h trunk/reactos/base/shell/explorer/taskband.cpp trunk/reactos/base/shell/explorer/taskswnd.cpp trunk/reactos/base/shell/explorer/trayntfy.cpp trunk/reactos/base/shell/explorer/traywnd.cpp
Modified: trunk/reactos/base/shell/explorer/precomp.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/explorer/precomp... ============================================================================== --- trunk/reactos/base/shell/explorer/precomp.h [iso-8859-1] (original) +++ trunk/reactos/base/shell/explorer/precomp.h [iso-8859-1] Sun Mar 26 16:46:55 2017 @@ -233,7 +233,7 @@ */
extern const GUID CLSID_ITaskBand; /* Internal Task Band CLSID */ -HRESULT CTaskBand_CreateInstance(IN ITrayWindow *Tray, REFIID riid, void **ppv); +HRESULT CTaskBand_CreateInstance(IN ITrayWindow *Tray, HWND hWndStartButton, REFIID riid, void **ppv);
/* * tbsite.cpp
Modified: trunk/reactos/base/shell/explorer/taskband.cpp URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/explorer/taskban... ============================================================================== --- trunk/reactos/base/shell/explorer/taskband.cpp [iso-8859-1] (original) +++ trunk/reactos/base/shell/explorer/taskband.cpp [iso-8859-1] Sun Mar 26 16:46:55 2017 @@ -40,6 +40,7 @@ CComPtr<IUnknown> m_Site;
HWND m_hWnd; + HWND m_hWndStartButton; DWORD m_BandID;
public: @@ -124,7 +125,10 @@ } else { - pdbi->ptMinSize.y = GetSystemMetrics(SM_CYSIZE) + (2 * GetSystemMetrics(SM_CYEDGE)); /* FIXME: Query */ + /* When the band is horizontal its minimum height is the height of the start button */ + RECT rcButton; + GetWindowRect(m_hWndStartButton, &rcButton); + pdbi->ptMinSize.y = rcButton.bottom - rcButton.top; pdbi->ptIntegral.y = pdbi->ptMinSize.y + (3 * GetSystemMetrics(SM_CYEDGE) / 2); /* FIXME: Query metrics */ /* We're not going to allow task bands where not even the minimum button size fits into the band */ pdbi->ptMinSize.x = pdbi->ptIntegral.y; @@ -327,10 +331,11 @@
/*****************************************************************************/
- HRESULT STDMETHODCALLTYPE Initialize(IN OUT ITrayWindow *tray) + HRESULT STDMETHODCALLTYPE Initialize(IN OUT ITrayWindow *tray, HWND hWndStartButton) { m_Tray = tray; m_BandID = (DWORD) -1; + m_hWndStartButton = hWndStartButton; return S_OK; }
@@ -348,7 +353,7 @@ END_COM_MAP() };
-HRESULT CTaskBand_CreateInstance(IN ITrayWindow *Tray, REFIID riid, void **ppv) +HRESULT CTaskBand_CreateInstance(IN ITrayWindow *Tray, HWND hWndStartButton, REFIID riid, void **ppv) { - return ShellObjectCreatorInit<CTaskBand>(Tray, riid, ppv); + return ShellObjectCreatorInit<CTaskBand>(Tray, hWndStartButton, riid, ppv); }
Modified: trunk/reactos/base/shell/explorer/taskswnd.cpp URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/explorer/taskswn... ============================================================================== --- trunk/reactos/base/shell/explorer/taskswnd.cpp [iso-8859-1] (original) +++ trunk/reactos/base/shell/explorer/taskswnd.cpp [iso-8859-1] Sun Mar 26 16:46:55 2017 @@ -1146,7 +1146,7 @@ BOOL Horizontal;
int cx = GetSystemMetrics(SM_CXMINIMIZED); - int cy = m_ButtonSize.cy = GetSystemMetrics(SM_CYSIZE) + (2 * GetSystemMetrics(SM_CYEDGE)); + int cy = m_ButtonSize.cy = GetSystemMetrics(SM_CYSIZE); m_TaskBar.SetButtonSize(cx, cy);
if (GetClientRect(&rcClient) && !IsRectEmpty(&rcClient))
Modified: trunk/reactos/base/shell/explorer/trayntfy.cpp URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/explorer/trayntf... ============================================================================== --- trunk/reactos/base/shell/explorer/trayntfy.cpp [iso-8859-1] (original) +++ trunk/reactos/base/shell/explorer/trayntfy.cpp [iso-8859-1] Sun Mar 26 16:46:55 2017 @@ -1206,6 +1206,7 @@ MESSAGE_HANDLER(WM_SIZE, OnSize) MESSAGE_HANDLER(WM_PAINT, OnPaint) MESSAGE_HANDLER(WM_PRINTCLIENT, OnPaint) + MESSAGE_HANDLER(WM_THEMECHANGED, OnThemeChanged) MESSAGE_HANDLER(WM_TIMER, OnTimer) MESSAGE_HANDLER(WM_NCHITTEST, OnNcHitTest) MESSAGE_HANDLER(WM_SETFONT, OnSetFont) @@ -1229,10 +1230,7 @@ Create(hWndParent, 0, NULL, dwStyle);
if (m_hWnd != NULL) - { SetWindowTheme(m_hWnd, L"TrayNotify", NULL); - OnThemeChanged(); - }
return m_hWnd;
Modified: trunk/reactos/base/shell/explorer/traywnd.cpp URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/explorer/traywnd... ============================================================================== --- trunk/reactos/base/shell/explorer/traywnd.cpp [iso-8859-1] (original) +++ trunk/reactos/base/shell/explorer/traywnd.cpp [iso-8859-1] Sun Mar 26 16:46:55 2017 @@ -101,10 +101,7 @@ Size.cx = 2 * GetSystemMetrics(SM_CXEDGE) + GetSystemMetrics(SM_CYCAPTION) * 3; }
- if (GetWindowTheme(m_hWnd)) - Size.cy = max(Size.cy, GetSystemMetrics(SM_CYCAPTION)); - else - Size.cy = max(Size.cy, GetSystemMetrics(SM_CYSIZE) + (2 * GetSystemMetrics(SM_CYEDGE))); + Size.cy = max(Size.cy, GetSystemMetrics(SM_CYCAPTION));
/* Save the size of the start button */ m_Size = Size; @@ -732,6 +729,10 @@
void UpdateFonts() { + /* There is nothing to do if themes are not enabled */ + if (m_Theme) + return; + m_StartButton.UpdateFont();
NONCLIENTMETRICS ncm = {sizeof(ncm)}; @@ -902,7 +903,7 @@
*pRect = *pScreen;
- if(!IsThemeActive()) + if(!m_Theme) { /* Move the border outside of the screen */ InflateRect(pRect, @@ -1407,7 +1408,7 @@ entire window size, not just the client size. However, we use a thinner border than a standard thick border, so that the start button and bands are not stuck to the screen border. */ - if(!IsThemeActive()) + if(!m_Theme) { sr.Size.cx = StartBtnSize.cx + (2 * (EdgeSize.cx + DlgFrameSize.cx)); sr.Size.cy = StartBtnSize.cy + (2 * (EdgeSize.cy + DlgFrameSize.cy)); @@ -1445,7 +1446,7 @@ loaded from the registry are at least. The windows explorer behaves the same way, it allows the user to save a zero width vertical tray window, but not a zero height horizontal tray window. */ - if(!IsThemeActive()) + if(!m_Theme) { WndSize.cx = 2 * (EdgeSize.cx + DlgFrameSize.cx); WndSize.cy = StartBtnSize.cy + (2 * (EdgeSize.cy + DlgFrameSize.cy)); @@ -1970,7 +1971,7 @@ dwExStyle |= WS_EX_TOPMOST;
DWORD dwStyle = WS_POPUP | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN; - if(!IsThemeActive()) + if(!m_Theme) { dwStyle |= WS_THICKFRAME | WS_BORDER; } @@ -2098,7 +2099,7 @@ m_StartMenuPopup = CreateStartMenu(this, &m_StartMenuBand, hbmBanner, 0);
/* Create the task band */ - hRet = CTaskBand_CreateInstance(this, IID_PPV_ARG(IDeskBand, &m_TaskBand)); + hRet = CTaskBand_CreateInstance(this, m_StartButton.m_hWnd, IID_PPV_ARG(IDeskBand, &m_TaskBand)); if (FAILED_UNEXPECTEDLY(hRet)) return FALSE;
@@ -2153,10 +2154,7 @@ if (m_Theme) CloseThemeData(m_Theme);
- if (IsThemeActive()) - m_Theme = OpenThemeData(m_hWnd, L"TaskBar"); - else - m_Theme = NULL; + m_Theme = OpenThemeData(m_hWnd, L"TaskBar");
if (m_Theme) { @@ -2690,7 +2688,7 @@ { RECT *rc = NULL; /* Ignore WM_NCCALCSIZE if we are not themed or locked */ - if(!IsThemeActive() || Locked) + if(!m_Theme || Locked) { bHandled = FALSE; return 0;