Author: tfaber
Date: Fri Jan 25 22:28:41 2013
New Revision: 58217
URL:
http://svn.reactos.org/svn/reactos?rev=58217&view=rev
Log:
[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
Modified:
trunk/reactos/base/shell/explorer-new/precomp.h
trunk/reactos/base/shell/explorer-new/trayprop.c
trunk/reactos/base/shell/explorer-new/traywnd.c
Modified: trunk/reactos/base/shell/explorer-new/precomp.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/explorer-new/pr…
==============================================================================
--- trunk/reactos/base/shell/explorer-new/precomp.h [iso-8859-1] (original)
+++ trunk/reactos/base/shell/explorer-new/precomp.h [iso-8859-1] Fri Jan 25 22:28:41 2013
@@ -269,8 +269,8 @@
* trayprop.h
*/
-HWND
-DisplayTrayProperties(ITrayWindow *Tray);
+VOID
+DisplayTrayProperties(IN HWND hwndOwner);
/*
* desktop.c
Modified: trunk/reactos/base/shell/explorer-new/trayprop.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/explorer-new/tr…
==============================================================================
--- trunk/reactos/base/shell/explorer-new/trayprop.c [iso-8859-1] (original)
+++ trunk/reactos/base/shell/explorer-new/trayprop.c [iso-8859-1] Fri Jan 25 22:28:41
2013
@@ -361,38 +361,26 @@
}
-HWND
-DisplayTrayProperties(ITrayWindow *Tray)
-{
- PPROPSHEET_INFO pPropInfo;
+VOID
+DisplayTrayProperties(IN HWND hwndOwner)
+{
+ 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 @@
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;
-}
+}
Modified: trunk/reactos/base/shell/explorer-new/traywnd.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/explorer-new/tr…
==============================================================================
--- trunk/reactos/base/shell/explorer-new/traywnd.c [iso-8859-1] (original)
+++ trunk/reactos/base/shell/explorer-new/traywnd.c [iso-8859-1] Fri Jan 25 22:28:41 2013
@@ -92,7 +92,7 @@
IMenuPopup *StartMenuPopup;
HBITMAP hbmStartMenu;
- HWND hWndTrayProperties;
+ HWND hwndTrayPropertiesOwner;
HWND hwndRunFileDlgOwner;
} ITrayWindowImpl;
@@ -1750,19 +1750,56 @@
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);
-
- if (This->hWndTrayProperties != NULL)
- {
- BringWindowToTop(This->hWndTrayProperties);
- return This->hWndTrayProperties;
- }
-
- This->hWndTrayProperties = DisplayTrayProperties(ITrayWindow_from_impl(This));
- return This->hWndTrayProperties;
+ HWND hTrayProp;
+
+ if (This->hwndTrayPropertiesOwner)
+ {
+ hTrayProp = GetLastActivePopup(This->hwndTrayPropertiesOwner);
+ if (hTrayProp != NULL &&
+ hTrayProp != This->hwndTrayPropertiesOwner)
+ {
+ SetForegroundWindow(hTrayProp);
+ return NULL;
+ }
+ }
+
+ CloseHandle(CreateThread(NULL, 0, TrayPropertiesThread, This, 0, NULL));
+ return NULL;
}
static VOID
@@ -2015,7 +2052,7 @@
}
static void
-ITrayWindowImpl_ShowRunFileDlg(IN ITrayWindowImpl *This)
+ITrayWindowImpl_DisplayRunFileDlg(IN ITrayWindowImpl *This)
{
HWND hRunDlg;
if (This->hwndRunFileDlgOwner)
@@ -2551,7 +2588,7 @@
case IDM_RUN:
{
- ITrayWindowImpl_ShowRunFileDlg(This);
+ ITrayWindowImpl_DisplayRunFileDlg(This);
break;
}
@@ -2798,7 +2835,7 @@
switch (Msg.wParam)
{
case IDHK_RUN: /* Win+R */
- ITrayWindowImpl_ShowRunFileDlg(This);
+ ITrayWindowImpl_DisplayRunFileDlg(This);
break;
}
}