mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 21:53:06 +00:00
[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:
parent
97d934c8be
commit
8900ea9af6
3 changed files with 58 additions and 40 deletions
|
@ -269,8 +269,8 @@ ProcessStartupItems(VOID);
|
||||||
* trayprop.h
|
* trayprop.h
|
||||||
*/
|
*/
|
||||||
|
|
||||||
HWND
|
VOID
|
||||||
DisplayTrayProperties(ITrayWindow *Tray);
|
DisplayTrayProperties(IN HWND hwndOwner);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* desktop.c
|
* desktop.c
|
||||||
|
|
|
@ -361,38 +361,26 @@ InitPropSheetPage(PROPSHEETPAGE *psp,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
HWND
|
VOID
|
||||||
DisplayTrayProperties(ITrayWindow *Tray)
|
DisplayTrayProperties(IN HWND hwndOwner)
|
||||||
{
|
{
|
||||||
PPROPSHEET_INFO pPropInfo;
|
PROPSHEET_INFO propInfo;
|
||||||
PROPSHEETHEADER psh;
|
PROPSHEETHEADER psh;
|
||||||
PROPSHEETPAGE psp[5];
|
PROPSHEETPAGE psp[5];
|
||||||
TCHAR szCaption[256];
|
TCHAR szCaption[256];
|
||||||
|
|
||||||
pPropInfo = HeapAlloc(hProcessHeap,
|
|
||||||
HEAP_ZERO_MEMORY,
|
|
||||||
sizeof(PROPSHEET_INFO));
|
|
||||||
if (!pPropInfo)
|
|
||||||
{
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!LoadString(hExplorerInstance,
|
if (!LoadString(hExplorerInstance,
|
||||||
IDS_TASKBAR_STARTMENU_PROP_CAPTION,
|
IDS_TASKBAR_STARTMENU_PROP_CAPTION,
|
||||||
szCaption,
|
szCaption,
|
||||||
sizeof(szCaption) / sizeof(szCaption[0])))
|
sizeof(szCaption) / sizeof(szCaption[0])))
|
||||||
{
|
{
|
||||||
HeapFree(hProcessHeap,
|
return;
|
||||||
0,
|
|
||||||
pPropInfo);
|
|
||||||
|
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ZeroMemory(&psh, sizeof(PROPSHEETHEADER));
|
ZeroMemory(&psh, sizeof(PROPSHEETHEADER));
|
||||||
psh.dwSize = sizeof(PROPSHEETHEADER);
|
psh.dwSize = sizeof(PROPSHEETHEADER);
|
||||||
psh.dwFlags = PSH_PROPSHEETPAGE | PSH_PROPTITLE;
|
psh.dwFlags = PSH_PROPSHEETPAGE | PSH_PROPTITLE;
|
||||||
psh.hwndParent = NULL;
|
psh.hwndParent = hwndOwner;
|
||||||
psh.hInstance = hExplorerInstance;
|
psh.hInstance = hExplorerInstance;
|
||||||
psh.hIcon = NULL;
|
psh.hIcon = NULL;
|
||||||
psh.pszCaption = szCaption;
|
psh.pszCaption = szCaption;
|
||||||
|
@ -400,18 +388,11 @@ DisplayTrayProperties(ITrayWindow *Tray)
|
||||||
psh.nStartPage = 0;
|
psh.nStartPage = 0;
|
||||||
psh.ppsp = psp;
|
psh.ppsp = psp;
|
||||||
|
|
||||||
InitPropSheetPage(&psp[0], IDD_TASKBARPROP_TASKBAR, TaskbarPageProc, (LPARAM)pPropInfo);
|
InitPropSheetPage(&psp[0], IDD_TASKBARPROP_TASKBAR, TaskbarPageProc, (LPARAM)&propInfo);
|
||||||
InitPropSheetPage(&psp[1], IDD_TASKBARPROP_STARTMENU, StartMenuPageProc, (LPARAM)pPropInfo);
|
InitPropSheetPage(&psp[1], IDD_TASKBARPROP_STARTMENU, StartMenuPageProc, (LPARAM)&propInfo);
|
||||||
InitPropSheetPage(&psp[2], IDD_TASKBARPROP_NOTIFICATION, NotificationPageProc, (LPARAM)pPropInfo);
|
InitPropSheetPage(&psp[2], IDD_TASKBARPROP_NOTIFICATION, NotificationPageProc, (LPARAM)&propInfo);
|
||||||
InitPropSheetPage(&psp[3], IDD_TASKBARPROP_TOOLBARS, ToolbarsPageProc, (LPARAM)pPropInfo);
|
InitPropSheetPage(&psp[3], IDD_TASKBARPROP_TOOLBARS, ToolbarsPageProc, (LPARAM)&propInfo);
|
||||||
InitPropSheetPage(&psp[4], IDD_TASKBARPROP_ADVANCED, AdvancedSettingsPageProc, (LPARAM)pPropInfo);
|
InitPropSheetPage(&psp[4], IDD_TASKBARPROP_ADVANCED, AdvancedSettingsPageProc, (LPARAM)&propInfo);
|
||||||
|
|
||||||
PropertySheet(&psh);
|
PropertySheet(&psh);
|
||||||
|
|
||||||
HeapFree(hProcessHeap,
|
|
||||||
0,
|
|
||||||
pPropInfo);
|
|
||||||
|
|
||||||
// FIXME: return the HWND
|
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -92,7 +92,7 @@ typedef struct
|
||||||
IMenuPopup *StartMenuPopup;
|
IMenuPopup *StartMenuPopup;
|
||||||
HBITMAP hbmStartMenu;
|
HBITMAP hbmStartMenu;
|
||||||
|
|
||||||
HWND hWndTrayProperties;
|
HWND hwndTrayPropertiesOwner;
|
||||||
HWND hwndRunFileDlgOwner;
|
HWND hwndRunFileDlgOwner;
|
||||||
} ITrayWindowImpl;
|
} ITrayWindowImpl;
|
||||||
|
|
||||||
|
@ -1750,19 +1750,56 @@ ITrayWIndowImpl_GetCaptionFonts(IN OUT ITrayWindow *iface,
|
||||||
return This->hCaptionFont;
|
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
|
static HWND STDMETHODCALLTYPE
|
||||||
ITrayWindowImpl_DisplayProperties(IN OUT ITrayWindow *iface)
|
ITrayWindowImpl_DisplayProperties(IN OUT ITrayWindow *iface)
|
||||||
{
|
{
|
||||||
ITrayWindowImpl *This = impl_from_ITrayWindow(iface);
|
ITrayWindowImpl *This = impl_from_ITrayWindow(iface);
|
||||||
|
HWND hTrayProp;
|
||||||
|
|
||||||
if (This->hWndTrayProperties != NULL)
|
if (This->hwndTrayPropertiesOwner)
|
||||||
{
|
{
|
||||||
BringWindowToTop(This->hWndTrayProperties);
|
hTrayProp = GetLastActivePopup(This->hwndTrayPropertiesOwner);
|
||||||
return This->hWndTrayProperties;
|
if (hTrayProp != NULL &&
|
||||||
|
hTrayProp != This->hwndTrayPropertiesOwner)
|
||||||
|
{
|
||||||
|
SetForegroundWindow(hTrayProp);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
This->hWndTrayProperties = DisplayTrayProperties(ITrayWindow_from_impl(This));
|
CloseHandle(CreateThread(NULL, 0, TrayPropertiesThread, This, 0, NULL));
|
||||||
return This->hWndTrayProperties;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static VOID
|
static VOID
|
||||||
|
@ -2015,7 +2052,7 @@ RunFileDlgThread(IN OUT PVOID pParam)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
ITrayWindowImpl_ShowRunFileDlg(IN ITrayWindowImpl *This)
|
ITrayWindowImpl_DisplayRunFileDlg(IN ITrayWindowImpl *This)
|
||||||
{
|
{
|
||||||
HWND hRunDlg;
|
HWND hRunDlg;
|
||||||
if (This->hwndRunFileDlgOwner)
|
if (This->hwndRunFileDlgOwner)
|
||||||
|
@ -2551,7 +2588,7 @@ HandleTrayContextMenu:
|
||||||
|
|
||||||
case IDM_RUN:
|
case IDM_RUN:
|
||||||
{
|
{
|
||||||
ITrayWindowImpl_ShowRunFileDlg(This);
|
ITrayWindowImpl_DisplayRunFileDlg(This);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2798,7 +2835,7 @@ TrayMessageLoop(IN OUT ITrayWindow *Tray)
|
||||||
switch (Msg.wParam)
|
switch (Msg.wParam)
|
||||||
{
|
{
|
||||||
case IDHK_RUN: /* Win+R */
|
case IDHK_RUN: /* Win+R */
|
||||||
ITrayWindowImpl_ShowRunFileDlg(This);
|
ITrayWindowImpl_DisplayRunFileDlg(This);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue