[EXPLORER_NEW]

* Cleanup some window procs.
* Fix some redraw issues in the notification area due to misuse of themeing.

svn path=/branches/shell-experiments/; revision=65124
This commit is contained in:
David Quintana 2014-10-30 14:55:56 +00:00
parent 4f72545247
commit 4dfef8d21d
3 changed files with 69 additions and 161 deletions

View file

@ -1443,9 +1443,8 @@ TaskSwitchWnd_Create(IN OUT PTASK_SWITCH_WND This)
TOOLBARCLASSNAME, TOOLBARCLASSNAME,
szRunningApps, szRunningApps,
WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN |
TBSTYLE_TOOLTIPS | TBSTYLE_WRAPABLE | TBSTYLE_LIST | TBSTYLE_TOOLTIPS | TBSTYLE_WRAPABLE | TBSTYLE_LIST | TBSTYLE_TRANSPARENT |
TBSTYLE_TRANSPARENT | CCS_TOP | CCS_NORESIZE | CCS_NODIVIDER,
CCS_TOP | CCS_NORESIZE | CCS_NODIVIDER,
0, 0,
0, 0,
0, 0,
@ -1942,8 +1941,7 @@ TaskSwitchWndProc(IN HWND hwnd,
if (uMsg != WM_NCCREATE) if (uMsg != WM_NCCREATE)
{ {
This = (PTASK_SWITCH_WND)GetWindowLongPtr(hwnd, This = (PTASK_SWITCH_WND)GetWindowLongPtr(hwnd, 0);
0);
} }
if (This != NULL || uMsg == WM_NCCREATE) if (This != NULL || uMsg == WM_NCCREATE)
@ -1954,8 +1952,10 @@ TaskSwitchWndProc(IN HWND hwnd,
TaskSwitchWnd_UpdateTheme(This); TaskSwitchWnd_UpdateTheme(This);
break; break;
case WM_ERASEBKGND: case WM_ERASEBKGND:
TaskSwitchWnd_DrawBackground(hwnd, (HDC)wParam); if (!This->TaskBandTheme)
break; break;
TaskSwitchWnd_DrawBackground(hwnd, (HDC) wParam);
return TRUE;
case WM_SIZE: case WM_SIZE:
{ {
SIZE szClient; SIZE szClient;
@ -1972,8 +1972,7 @@ TaskSwitchWndProc(IN HWND hwnd,
szClient.cy, szClient.cy,
SWP_NOZORDER); SWP_NOZORDER);
TaskSwitchWnd_UpdateButtonsSize(This, TaskSwitchWnd_UpdateButtonsSize(This, FALSE);
FALSE);
} }
break; break;
} }
@ -1982,21 +1981,17 @@ TaskSwitchWndProc(IN HWND hwnd,
{ {
/* We want the tray window to be draggable everywhere, so make the control /* We want the tray window to be draggable everywhere, so make the control
appear transparent */ appear transparent */
Ret = DefWindowProc(hwnd, Ret = DefWindowProc(hwnd, uMsg, wParam, lParam);
uMsg,
wParam,
lParam);
if (Ret != HTVSCROLL && Ret != HTHSCROLL) if (Ret != HTVSCROLL && Ret != HTHSCROLL)
Ret = HTTRANSPARENT; return HTTRANSPARENT;
break; return Ret;
} }
case WM_COMMAND: case WM_COMMAND:
{ {
if (lParam != 0 && (HWND)lParam == This->hWndToolbar) if (lParam != 0 && (HWND)lParam == This->hWndToolbar)
{ {
TaskSwitchWnd_HandleButtonClick(This, TaskSwitchWnd_HandleButtonClick(This, LOWORD(wParam));
LOWORD(wParam));
} }
break; break;
} }
@ -2007,10 +2002,9 @@ TaskSwitchWndProc(IN HWND hwnd,
if (nmh->hwndFrom == This->hWndToolbar) if (nmh->hwndFrom == This->hWndToolbar)
{ {
Ret = TaskSwitchWnd_HandleToolbarNotification(This, return TaskSwitchWnd_HandleToolbarNotification(This, nmh);
nmh);
} }
break; return 0;
} }
case TSWM_ENABLEGROUPING: case TSWM_ENABLEGROUPING:
@ -2021,16 +2015,13 @@ TaskSwitchWndProc(IN HWND hwnd,
TaskSwitchWnd_EnableGrouping(This, TaskSwitchWnd_EnableGrouping(This,
(BOOL)wParam); (BOOL)wParam);
} }
break; return Ret;
} }
case TSWM_UPDATETASKBARPOS: case TSWM_UPDATETASKBARPOS:
{ {
/* Update the button spacing */ /* Update the button spacing */
TaskSwitchWnd_UpdateTbButtonSpacing(This, TaskSwitchWnd_UpdateTbButtonSpacing(This, ITrayWindow_IsHorizontal(This->Tray), 0, 0);
ITrayWindow_IsHorizontal(This->Tray),
0,
0);
break; break;
} }
@ -2044,19 +2035,12 @@ TaskSwitchWndProc(IN HWND hwnd,
pt.x = (LONG)LOWORD(lParam); pt.x = (LONG)LOWORD(lParam);
pt.y = (LONG)HIWORD(lParam); pt.y = (LONG)HIWORD(lParam);
MapWindowPoints(NULL, MapWindowPoints(NULL, This->hWndToolbar, &pt, 1);
This->hWndToolbar,
&pt,
1);
iBtn = (INT_PTR)SendMessage(This->hWndToolbar, iBtn = (INT_PTR) SendMessage(This->hWndToolbar, TB_HITTEST, 0, (LPARAM) &pt);
TB_HITTEST,
0,
(LPARAM)&pt);
if (iBtn >= 0) if (iBtn >= 0)
{ {
TaskSwitchWnd_HandleButtonRightClick(This, TaskSwitchWnd_HandleButtonRightClick(This, iBtn);
iBtn);
} }
else else
goto ForwardContextMenuMsg; goto ForwardContextMenuMsg;
@ -2065,10 +2049,7 @@ TaskSwitchWndProc(IN HWND hwnd,
{ {
ForwardContextMenuMsg: ForwardContextMenuMsg:
/* Forward message */ /* Forward message */
Ret = SendMessage(ITrayWindow_GetHWND(This->Tray), Ret = SendMessage(ITrayWindow_GetHWND(This->Tray), uMsg, wParam, lParam);
uMsg,
wParam,
lParam);
} }
break; break;
} }
@ -2097,10 +2078,7 @@ ForwardContextMenuMsg:
TaskSwitchWnd_Create(This); TaskSwitchWnd_Create(This);
#if DUMP_TASKS != 0 #if DUMP_TASKS != 0
SetTimer(hwnd, SetTimer(hwnd, 1, 5000, NULL);
1,
5000,
NULL);
#endif #endif
break; break;
@ -2119,12 +2097,8 @@ ForwardContextMenuMsg:
case WM_NCDESTROY: case WM_NCDESTROY:
TaskSwitchWnd_NCDestroy(This); TaskSwitchWnd_NCDestroy(This);
HeapFree(hProcessHeap, HeapFree(hProcessHeap, 0, This);
0, SetWindowLongPtr(hwnd, 0, 0);
This);
SetWindowLongPtr(hwnd,
0,
0);
break; break;
#if DUMP_TASKS != 0 #if DUMP_TASKS != 0
@ -2161,28 +2135,14 @@ ForwardContextMenuMsg:
if (uMsg == This->ShellHookMsg && This->ShellHookMsg != 0) if (uMsg == This->ShellHookMsg && This->ShellHookMsg != 0)
{ {
/* Process shell messages */ /* Process shell messages */
Ret = (LRESULT)TaskSwitchWnd_HandleShellHookMsg(This, return (LRESULT) TaskSwitchWnd_HandleShellHookMsg(This, wParam, lParam);
wParam,
lParam);
break;
} }
Ret = DefWindowProc(hwnd,
uMsg,
wParam,
lParam);
break; break;
} }
} }
else
{
Ret = DefWindowProc(hwnd,
uMsg,
wParam,
lParam);
}
return Ret; return DefWindowProc(hwnd, uMsg, wParam, lParam);
} }

View file

@ -353,10 +353,10 @@ SysPagerWnd_ToolbarSubclassedProc(IN HWND hWnd,
{ {
HWND parent = GetParent(hWnd); HWND parent = GetParent(hWnd);
if (!parent) if (parent)
return 0; {
SendMessage(parent, msg, wParam, lParam);
SendMessage(parent, msg, wParam, lParam); }
} }
return DefSubclassProc(hWnd, msg, wParam, lParam); return DefSubclassProc(hWnd, msg, wParam, lParam);
@ -544,8 +544,11 @@ SysPagerWndProc(IN HWND hwnd,
switch (uMsg) switch (uMsg)
{ {
case WM_ERASEBKGND: case WM_ERASEBKGND:
SysPagerWnd_DrawBackground(hwnd,(HDC)wParam); if (!IsAppThemed())
return 0; break;
SysPagerWnd_DrawBackground(hwnd, (HDC) wParam);
return TRUE;
case WM_NCCREATE: case WM_NCCREATE:
{ {
@ -556,9 +559,7 @@ SysPagerWndProc(IN HWND hwnd,
This->ButtonCount = 0; This->ButtonCount = 0;
This->VisibleButtonCount = 0; This->VisibleButtonCount = 0;
SetWindowLongPtr(hwnd, SetWindowLongPtr(hwnd, 0, (LONG_PTR) This);
0,
(LONG_PTR)This);
return TRUE; return TRUE;
} }
@ -604,22 +605,14 @@ SysPagerWndProc(IN HWND hwnd,
szClient.cx = LOWORD(lParam); szClient.cx = LOWORD(lParam);
szClient.cy = HIWORD(lParam); szClient.cy = HIWORD(lParam);
Ret = DefWindowProc(hwnd, Ret = DefWindowProc(hwnd, uMsg, wParam, lParam);
uMsg,
wParam,
lParam);
if (This->hWndToolbar != NULL && This->hWndToolbar != hwnd) if (This->hWndToolbar != NULL && This->hWndToolbar != hwnd)
{ {
SetWindowPos(This->hWndToolbar, SetWindowPos(This->hWndToolbar, NULL, 0, 0, szClient.cx, szClient.cy, SWP_NOZORDER);
NULL,
0,
0,
szClient.cx,
szClient.cy,
SWP_NOZORDER);
} }
return Ret;
} }
default: default:
@ -644,15 +637,11 @@ SysPagerWndProc(IN HWND hwnd,
return 0; return 0;
} }
Ret = DefWindowProc(hwnd,
uMsg,
wParam,
lParam);
break; break;
} }
} }
return Ret; return DefWindowProc(hwnd, uMsg, wParam, lParam);
} }
static HWND static HWND
@ -1273,8 +1262,11 @@ TrayClockWndProc(IN HWND hwnd,
TrayClockWnd_UpdateTheme(This); TrayClockWnd_UpdateTheme(This);
break; break;
case WM_ERASEBKGND: case WM_ERASEBKGND:
TrayClockWnd_DrawBackground(hwnd, (HDC)wParam); if (!IsAppThemed())
break; break;
TrayClockWnd_DrawBackground(hwnd, (HDC) wParam);
return TRUE;
case WM_PAINT: case WM_PAINT:
case WM_PRINTCLIENT: case WM_PRINTCLIENT:
{ {
@ -1283,19 +1275,16 @@ TrayClockWndProc(IN HWND hwnd,
if (wParam == 0) if (wParam == 0)
{ {
hDC = BeginPaint(This->hWnd, hDC = BeginPaint(This->hWnd, &ps);
&ps);
} }
if (hDC != NULL) if (hDC != NULL)
{ {
TrayClockWnd_Paint(This, TrayClockWnd_Paint(This, hDC);
hDC);
if (wParam == 0) if (wParam == 0)
{ {
EndPaint(This->hWnd, EndPaint(This->hWnd, &ps);
&ps);
} }
} }
break; break;
@ -1316,23 +1305,18 @@ TrayClockWndProc(IN HWND hwnd,
case WM_NCHITTEST: case WM_NCHITTEST:
/* We want the user to be able to drag the task bar when clicking the clock */ /* We want the user to be able to drag the task bar when clicking the clock */
Ret = HTTRANSPARENT; return HTTRANSPARENT;
break;
case TCWM_GETMINIMUMSIZE: case TCWM_GETMINIMUMSIZE:
{ {
This->IsHorizontal = (BOOL)wParam; This->IsHorizontal = (BOOL)wParam;
Ret = (LRESULT)TrayClockWnd_GetMinimumSize(This, return (LRESULT) TrayClockWnd_GetMinimumSize(This, (BOOL) wParam, (PSIZE) lParam) != 0;
(BOOL)wParam,
(PSIZE)lParam) != 0;
break;
} }
case TCWM_UPDATETIME: case TCWM_UPDATETIME:
{ {
Ret = (LRESULT)TrayClockWnd_ResetTime(This); return (LRESULT)TrayClockWnd_ResetTime(This);
break;
} }
case WM_NCCREATE: case WM_NCCREATE:
@ -1342,9 +1326,7 @@ TrayClockWndProc(IN HWND hwnd,
This->hWnd = hwnd; This->hWnd = hwnd;
This->hWndNotify = CreateStruct->hwndParent; This->hWndNotify = CreateStruct->hwndParent;
SetWindowLongPtr(hwnd, SetWindowLongPtr(hwnd, 0, (LONG_PTR) This);
0,
(LONG_PTR)This);
TrayClockWnd_UpdateTheme(This); TrayClockWnd_UpdateTheme(This);
return TRUE; return TRUE;
@ -1382,17 +1364,10 @@ TrayClockWndProc(IN HWND hwnd,
TRUE); TRUE);
break; break;
} }
default:
Ret = DefWindowProc(hwnd,
uMsg,
wParam,
lParam);
break;
} }
} }
return Ret; return DefWindowProc(hwnd, uMsg, wParam, lParam);
} }
static HWND static HWND
@ -1747,7 +1722,6 @@ TrayNotifyWndProc(IN HWND hwnd,
IN LPARAM lParam) IN LPARAM lParam)
{ {
PTRAY_NOTIFY_WND_DATA This = NULL; PTRAY_NOTIFY_WND_DATA This = NULL;
LRESULT Ret = FALSE;
if (uMsg != WM_NCCREATE) if (uMsg != WM_NCCREATE)
{ {
@ -1764,17 +1738,11 @@ TrayNotifyWndProc(IN HWND hwnd,
return 0; return 0;
case WM_ERASEBKGND: case WM_ERASEBKGND:
if (!This->TrayTheme) if (!This->TrayTheme)
goto HandleDefaultMessage; break;
return TrayNotifyWnd_DrawBackground(hwnd, return TrayNotifyWnd_DrawBackground(hwnd, uMsg, wParam, lParam);
uMsg,
wParam,
lParam);
case TNWM_GETMINIMUMSIZE: case TNWM_GETMINIMUMSIZE:
{ {
Ret = (LRESULT)TrayNotifyWnd_GetMinimumSize(This, return (LRESULT) TrayNotifyWnd_GetMinimumSize(This, (BOOL) wParam, (PSIZE) lParam);
(BOOL)wParam,
(PSIZE)lParam);
break;
} }
case TNWM_UPDATETIME: case TNWM_UPDATETIME:
@ -1782,12 +1750,9 @@ TrayNotifyWndProc(IN HWND hwnd,
if (This->hWndTrayClock != NULL) if (This->hWndTrayClock != NULL)
{ {
/* Forward the message to the tray clock window procedure */ /* Forward the message to the tray clock window procedure */
Ret = TrayClockWndProc(This->hWndTrayClock, return TrayClockWndProc(This->hWndTrayClock, TCWM_UPDATETIME, wParam, lParam);
TCWM_UPDATETIME,
wParam,
lParam);
} }
break; return 0;
} }
case WM_SIZE: case WM_SIZE:
@ -1799,15 +1764,13 @@ TrayNotifyWndProc(IN HWND hwnd,
TrayNotifyWnd_Size(This, TrayNotifyWnd_Size(This,
&szClient); &szClient);
break; return 0;
} }
case WM_NCHITTEST: case WM_NCHITTEST:
/* We want the user to be able to drag the task bar when clicking the /* We want the user to be able to drag the task bar when clicking the
tray notification window */ tray notification window */
Ret = HTTRANSPARENT; return HTTRANSPARENT;
break;
case TNWM_SHOWCLOCK: case TNWM_SHOWCLOCK:
{ {
BOOL PrevHidden = This->HideClock; BOOL PrevHidden = This->HideClock;
@ -1819,8 +1782,7 @@ TrayNotifyWndProc(IN HWND hwnd,
This->HideClock ? SW_HIDE : SW_SHOW); This->HideClock ? SW_HIDE : SW_SHOW);
} }
Ret = (LRESULT)(!PrevHidden); return (LRESULT) (!PrevHidden);
break;
} }
case WM_NOTIFY: case WM_NOTIFY:
@ -1830,12 +1792,9 @@ TrayNotifyWndProc(IN HWND hwnd,
if (nmh->hwndFrom == This->hWndTrayClock) if (nmh->hwndFrom == This->hWndTrayClock)
{ {
/* Pass down notifications */ /* Pass down notifications */
Ret = SendMessage(This->hWndNotify, return SendMessage(This->hWndNotify, WM_NOTIFY, wParam, lParam);
WM_NOTIFY,
wParam,
lParam);
} }
break; return 0;
} }
case WM_SETFONT: case WM_SETFONT:
@ -1847,7 +1806,7 @@ TrayNotifyWndProc(IN HWND hwnd,
wParam, wParam,
lParam); lParam);
} }
goto HandleDefaultMessage; break;
} }
case WM_NCCREATE: case WM_NCCREATE:
@ -1857,32 +1816,22 @@ TrayNotifyWndProc(IN HWND hwnd,
This->hWnd = hwnd; This->hWnd = hwnd;
This->hWndNotify = CreateStruct->hwndParent; This->hWndNotify = CreateStruct->hwndParent;
SetWindowLongPtr(hwnd, SetWindowLongPtr(hwnd, 0, (LONG_PTR) This);
0,
(LONG_PTR)This);
return TRUE; return TRUE;
} }
case WM_CREATE: case WM_CREATE:
TrayNotifyWnd_Create(This); TrayNotifyWnd_Create(This);
break; return 0;
case WM_NCDESTROY: case WM_NCDESTROY:
TrayNotifyWnd_NCDestroy(This); TrayNotifyWnd_NCDestroy(This);
break; return 0;
default:
HandleDefaultMessage:
Ret = DefWindowProc(hwnd,
uMsg,
wParam,
lParam);
break;
} }
} }
return Ret; return DefWindowProc(hwnd, uMsg, wParam, lParam);
} }
HWND HWND

View file

@ -2449,8 +2449,7 @@ TrayWndProc(IN HWND hwnd,
case WM_ERASEBKGND: case WM_ERASEBKGND:
if (!This->TaskbarTheme) if (!This->TaskbarTheme)
goto DefHandler; goto DefHandler;
return ITrayWindowImpl_DrawBackground(This, return ITrayWindowImpl_DrawBackground(This, (HDC)wParam);
(HDC)wParam);
case WM_CTLCOLORBTN: case WM_CTLCOLORBTN:
SetBkMode((HDC)wParam, TRANSPARENT); SetBkMode((HDC)wParam, TRANSPARENT);
return (LRESULT)GetStockObject(HOLLOW_BRUSH); return (LRESULT)GetStockObject(HOLLOW_BRUSH);