[TASKMGR]: Disable the "End task" button if no item is selected.

Part 2 of a patch by Edijs.
CORE-5655 #comment Patch committed. When one of you will have a patch for the Windows-menu items disabled bug, please reopen the report. #resolve

svn path=/trunk/; revision=65677
This commit is contained in:
Hermès Bélusca-Maïto 2014-12-15 20:45:38 +00:00
parent 0e707a8c26
commit a55958d1b1
2 changed files with 27 additions and 3 deletions

View file

@ -41,6 +41,8 @@ static int nApplicationPageHeight;
static BOOL bSortAscending = TRUE;
DWORD WINAPI ApplicationPageRefreshThread(void *lpParameter);
BOOL noApps;
BOOL bApplicationPageSelectionMade = FALSE;
BOOL CALLBACK EnumWindowsProc(HWND hWnd, LPARAM lParam);
void AddOrUpdateHwnd(HWND hWnd, WCHAR *szTitle, HICON hIcon, BOOL bHung);
void ApplicationPageUpdate(void);
@ -138,6 +140,10 @@ ApplicationPageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
#ifdef RUN_APPS_PAGE
hApplicationThread = CreateThread(NULL, 0, ApplicationPageRefreshThread, NULL, 0, &dwApplicationThread);
#endif
/* Refresh page */
ApplicationPageUpdate();
return TRUE;
case WM_DESTROY:
@ -272,7 +278,10 @@ DWORD WINAPI ApplicationPageRefreshThread(void *lpParameter)
noApps = TRUE;
EnumWindows(EnumWindowsProc, 0);
if (noApps)
{
(void)ListView_DeleteAllItems(hApplicationPageListCtrl);
bApplicationPageSelectionMade = FALSE;
}
/* Get the image lists */
hImageListLarge = ListView_GetImageList(hApplicationPageListCtrl, LVSIL_NORMAL);
@ -457,7 +466,20 @@ void AddOrUpdateHwnd(HWND hWnd, WCHAR *szTitle, HICON hIcon, BOOL bHung)
item.lParam = (LPARAM)pAPLI;
(void)ListView_InsertItem(hApplicationPageListCtrl, &item);
}
return;
/* Select first item if any */
if ((ListView_GetNextItem(hApplicationPageListCtrl, -1, LVNI_FOCUSED | LVNI_SELECTED) == -1) &&
(ListView_GetItemCount(hApplicationPageListCtrl) > 0) && !bApplicationPageSelectionMade)
{
ListView_SetItemState(hApplicationPageListCtrl, 0, LVIS_FOCUSED | LVIS_SELECTED, LVIS_FOCUSED | LVIS_SELECTED);
bApplicationPageSelectionMade = TRUE;
}
/*
else
{
bApplicationPageSelectionMade = FALSE;
}
*/
}
void ApplicationPageUpdate(void)

View file

@ -158,7 +158,7 @@ ProcessPageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
hProcessThread = CreateThread(NULL, 0, ProcessPageRefreshThread, NULL, 0, &dwProcessThread);
#endif
/* Refresh controls */
/* Refresh page */
ProcessPageUpdate();
return TRUE;
@ -433,6 +433,8 @@ DWORD WINAPI ProcessPageRefreshThread(void *lpParameter)
wsprintfW(text, szProcesses, OldProcessCount);
SendMessageW(hStatusWnd, SB_SETTEXT, 0, (LPARAM)text);
}
ProcessPageUpdate();
}
}
return 0;
@ -480,7 +482,7 @@ void UpdateProcesses()
SendMessage(hProcessPageListCtrl, WM_SETREDRAW, TRUE, 0);
/* Select first item if any */
if ((ListView_GetNextItem(hProcessPageListCtrl, -1, LVNI_SELECTED | LVNI_FOCUSED) == -1) &&
if ((ListView_GetNextItem(hProcessPageListCtrl, -1, LVNI_FOCUSED | LVNI_SELECTED) == -1) &&
(ListView_GetItemCount(hProcessPageListCtrl) > 0) && !bProcessPageSelectionMade)
{
ListView_SetItemState(hProcessPageListCtrl, 0, LVIS_FOCUSED | LVIS_SELECTED, LVIS_FOCUSED | LVIS_SELECTED);