[EXPLORER_NEW]

- Do not allow multiple "Taskbar and Start Menu Properties" windows. Based on patch by Edijs Kolesnikovičs & Grégori Macário Harbs.
CORE-6885 #resolve

svn path=/trunk/; revision=58217
This commit is contained in:
Thomas Faber 2013-01-25 22:28:41 +00:00
parent 97d934c8be
commit 8900ea9af6
3 changed files with 58 additions and 40 deletions

View file

@ -269,8 +269,8 @@ ProcessStartupItems(VOID);
* trayprop.h
*/
HWND
DisplayTrayProperties(ITrayWindow *Tray);
VOID
DisplayTrayProperties(IN HWND hwndOwner);
/*
* desktop.c

View file

@ -361,38 +361,26 @@ InitPropSheetPage(PROPSHEETPAGE *psp,
}
HWND
DisplayTrayProperties(ITrayWindow *Tray)
VOID
DisplayTrayProperties(IN HWND hwndOwner)
{
PPROPSHEET_INFO pPropInfo;
PROPSHEET_INFO propInfo;
PROPSHEETHEADER psh;
PROPSHEETPAGE psp[5];
TCHAR szCaption[256];
pPropInfo = HeapAlloc(hProcessHeap,
HEAP_ZERO_MEMORY,
sizeof(PROPSHEET_INFO));
if (!pPropInfo)
{
return NULL;
}
if (!LoadString(hExplorerInstance,
IDS_TASKBAR_STARTMENU_PROP_CAPTION,
szCaption,
sizeof(szCaption) / sizeof(szCaption[0])))
{
HeapFree(hProcessHeap,
0,
pPropInfo);
return NULL;
return;
}
ZeroMemory(&psh, sizeof(PROPSHEETHEADER));
psh.dwSize = sizeof(PROPSHEETHEADER);
psh.dwFlags = PSH_PROPSHEETPAGE | PSH_PROPTITLE;
psh.hwndParent = NULL;
psh.hwndParent = hwndOwner;
psh.hInstance = hExplorerInstance;
psh.hIcon = NULL;
psh.pszCaption = szCaption;
@ -400,18 +388,11 @@ DisplayTrayProperties(ITrayWindow *Tray)
psh.nStartPage = 0;
psh.ppsp = psp;
InitPropSheetPage(&psp[0], IDD_TASKBARPROP_TASKBAR, TaskbarPageProc, (LPARAM)pPropInfo);
InitPropSheetPage(&psp[1], IDD_TASKBARPROP_STARTMENU, StartMenuPageProc, (LPARAM)pPropInfo);
InitPropSheetPage(&psp[2], IDD_TASKBARPROP_NOTIFICATION, NotificationPageProc, (LPARAM)pPropInfo);
InitPropSheetPage(&psp[3], IDD_TASKBARPROP_TOOLBARS, ToolbarsPageProc, (LPARAM)pPropInfo);
InitPropSheetPage(&psp[4], IDD_TASKBARPROP_ADVANCED, AdvancedSettingsPageProc, (LPARAM)pPropInfo);
InitPropSheetPage(&psp[0], IDD_TASKBARPROP_TASKBAR, TaskbarPageProc, (LPARAM)&propInfo);
InitPropSheetPage(&psp[1], IDD_TASKBARPROP_STARTMENU, StartMenuPageProc, (LPARAM)&propInfo);
InitPropSheetPage(&psp[2], IDD_TASKBARPROP_NOTIFICATION, NotificationPageProc, (LPARAM)&propInfo);
InitPropSheetPage(&psp[3], IDD_TASKBARPROP_TOOLBARS, ToolbarsPageProc, (LPARAM)&propInfo);
InitPropSheetPage(&psp[4], IDD_TASKBARPROP_ADVANCED, AdvancedSettingsPageProc, (LPARAM)&propInfo);
PropertySheet(&psh);
HeapFree(hProcessHeap,
0,
pPropInfo);
// FIXME: return the HWND
return NULL;
}

View file

@ -92,7 +92,7 @@ typedef struct
IMenuPopup *StartMenuPopup;
HBITMAP hbmStartMenu;
HWND hWndTrayProperties;
HWND hwndTrayPropertiesOwner;
HWND hwndRunFileDlgOwner;
} ITrayWindowImpl;
@ -1750,19 +1750,56 @@ ITrayWIndowImpl_GetCaptionFonts(IN OUT ITrayWindow *iface,
return This->hCaptionFont;
}
static DWORD WINAPI
TrayPropertiesThread(IN OUT PVOID pParam)
{
ITrayWindowImpl *This = pParam;
HWND hwnd;
RECT posRect;
GetWindowRect(This->hwndStart, &posRect);
hwnd = CreateWindowEx(0,
WC_STATIC,
NULL,
WS_OVERLAPPED | WS_DISABLED | WS_CLIPSIBLINGS | WS_BORDER | SS_LEFT,
posRect.left,
posRect.top,
posRect.right - posRect.left,
posRect.bottom - posRect.top,
NULL,
NULL,
NULL,
NULL);
This->hwndTrayPropertiesOwner = hwnd;
DisplayTrayProperties(hwnd);
This->hwndTrayPropertiesOwner = NULL;
DestroyWindow(hwnd);
return 0;
}
static HWND STDMETHODCALLTYPE
ITrayWindowImpl_DisplayProperties(IN OUT ITrayWindow *iface)
{
ITrayWindowImpl *This = impl_from_ITrayWindow(iface);
HWND hTrayProp;
if (This->hWndTrayProperties != NULL)
if (This->hwndTrayPropertiesOwner)
{
BringWindowToTop(This->hWndTrayProperties);
return This->hWndTrayProperties;
hTrayProp = GetLastActivePopup(This->hwndTrayPropertiesOwner);
if (hTrayProp != NULL &&
hTrayProp != This->hwndTrayPropertiesOwner)
{
SetForegroundWindow(hTrayProp);
return NULL;
}
}
This->hWndTrayProperties = DisplayTrayProperties(ITrayWindow_from_impl(This));
return This->hWndTrayProperties;
CloseHandle(CreateThread(NULL, 0, TrayPropertiesThread, This, 0, NULL));
return NULL;
}
static VOID
@ -2015,7 +2052,7 @@ RunFileDlgThread(IN OUT PVOID pParam)
}
static void
ITrayWindowImpl_ShowRunFileDlg(IN ITrayWindowImpl *This)
ITrayWindowImpl_DisplayRunFileDlg(IN ITrayWindowImpl *This)
{
HWND hRunDlg;
if (This->hwndRunFileDlgOwner)
@ -2551,7 +2588,7 @@ HandleTrayContextMenu:
case IDM_RUN:
{
ITrayWindowImpl_ShowRunFileDlg(This);
ITrayWindowImpl_DisplayRunFileDlg(This);
break;
}
@ -2798,7 +2835,7 @@ TrayMessageLoop(IN OUT ITrayWindow *Tray)
switch (Msg.wParam)
{
case IDHK_RUN: /* Win+R */
ITrayWindowImpl_ShowRunFileDlg(This);
ITrayWindowImpl_DisplayRunFileDlg(This);
break;
}
}