mirror of
https://github.com/reactos/reactos.git
synced 2024-10-04 16:36:11 +00:00
Fix the dialog manager to ignore WS_EX_MDICHILD.
See issue #2289 for more details. svn path=/trunk/; revision=27707
This commit is contained in:
parent
14e9f977d9
commit
d68854511a
|
@ -48,3 +48,18 @@ SCROLL_HitTest( HWND hwnd, INT nBar, POINT pt, BOOL bDragging );
|
||||||
LRESULT FASTCALL IntCallWindowProcW(BOOL IsAnsiProc, WNDPROC WndProc,
|
LRESULT FASTCALL IntCallWindowProcW(BOOL IsAnsiProc, WNDPROC WndProc,
|
||||||
HWND hWnd, UINT Msg, WPARAM wParam,
|
HWND hWnd, UINT Msg, WPARAM wParam,
|
||||||
LPARAM lParam);
|
LPARAM lParam);
|
||||||
|
|
||||||
|
HWND STDCALL
|
||||||
|
User32CreateWindowEx(DWORD dwExStyle,
|
||||||
|
LPCSTR lpClassName,
|
||||||
|
LPCSTR lpWindowName,
|
||||||
|
DWORD dwStyle,
|
||||||
|
int x,
|
||||||
|
int y,
|
||||||
|
int nWidth,
|
||||||
|
int nHeight,
|
||||||
|
HWND hWndParent,
|
||||||
|
HMENU hMenu,
|
||||||
|
HINSTANCE hInstance,
|
||||||
|
LPVOID lpParam,
|
||||||
|
BOOL Unicode);
|
||||||
|
|
|
@ -734,10 +734,11 @@ static HWND DIALOG_CreateIndirect( HINSTANCE hInst, LPCVOID dlgTemplate,
|
||||||
|
|
||||||
if (unicode)
|
if (unicode)
|
||||||
{
|
{
|
||||||
hwnd = CreateWindowExW(template.exStyle, template.className, template.caption,
|
hwnd = User32CreateWindowEx(template.exStyle, template.className, template.caption,
|
||||||
template.style & ~WS_VISIBLE,
|
template.style & ~WS_VISIBLE,
|
||||||
rect.left, rect.top, rect.right, rect.bottom,
|
rect.left, rect.top, rect.right, rect.bottom,
|
||||||
owner, hMenu, hInst, NULL );
|
owner, hMenu, hInst, NULL,
|
||||||
|
TRUE);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -756,10 +757,11 @@ static HWND DIALOG_CreateIndirect( HINSTANCE hInst, LPCVOID dlgTemplate,
|
||||||
caption = HeapAlloc( GetProcessHeap(), 0, len );
|
caption = HeapAlloc( GetProcessHeap(), 0, len );
|
||||||
WideCharToMultiByte( CP_ACP, 0, template.caption, -1, caption, len, NULL, NULL );
|
WideCharToMultiByte( CP_ACP, 0, template.caption, -1, caption, len, NULL, NULL );
|
||||||
}
|
}
|
||||||
hwnd = CreateWindowExA(template.exStyle, class, caption,
|
hwnd = User32CreateWindowEx(template.exStyle, class, caption,
|
||||||
template.style & ~WS_VISIBLE,
|
template.style & ~WS_VISIBLE,
|
||||||
rect.left, rect.top, rect.right, rect.bottom,
|
rect.left, rect.top, rect.right, rect.bottom,
|
||||||
owner, hMenu, hInst, NULL );
|
owner, hMenu, hInst, NULL,
|
||||||
|
FALSE);
|
||||||
if (HIWORD(class)) HeapFree( GetProcessHeap(), 0, class );
|
if (HIWORD(class)) HeapFree( GetProcessHeap(), 0, class );
|
||||||
if (HIWORD(caption)) HeapFree( GetProcessHeap(), 0, caption );
|
if (HIWORD(caption)) HeapFree( GetProcessHeap(), 0, caption );
|
||||||
}
|
}
|
||||||
|
|
|
@ -162,7 +162,6 @@ User32CreateWindowEx(DWORD dwExStyle,
|
||||||
WNDCLASSEXA wceA;
|
WNDCLASSEXA wceA;
|
||||||
WNDCLASSEXW wceW;
|
WNDCLASSEXW wceW;
|
||||||
HWND Handle;
|
HWND Handle;
|
||||||
MDICREATESTRUCTA mdi;
|
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
DbgPrint("[window] User32CreateWindowEx style %d, exstyle %d, parent %d\n", dwStyle, dwExStyle, hWndParent);
|
DbgPrint("[window] User32CreateWindowEx style %d, exstyle %d, parent %d\n", dwStyle, dwExStyle, hWndParent);
|
||||||
|
@ -193,18 +192,103 @@ User32CreateWindowEx(DWORD dwExStyle,
|
||||||
ControlsInitialized = ControlsInit(ClassName.Buffer);
|
ControlsInitialized = ControlsInit(ClassName.Buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Unicode)
|
||||||
|
RtlInitUnicodeString(&WindowName, (PCWSTR)lpWindowName);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (!RtlCreateUnicodeStringFromAsciiz(&WindowName, (PCSZ)lpWindowName))
|
||||||
|
{
|
||||||
|
if (!IS_ATOM(lpClassName))
|
||||||
|
{
|
||||||
|
RtlFreeUnicodeString(&ClassName);
|
||||||
|
}
|
||||||
|
SetLastError(ERROR_OUTOFMEMORY);
|
||||||
|
return (HWND)0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!hMenu && (dwStyle & (WS_OVERLAPPEDWINDOW | WS_POPUP)))
|
||||||
|
{
|
||||||
|
if(Unicode)
|
||||||
|
{
|
||||||
|
wceW.cbSize = sizeof(WNDCLASSEXW);
|
||||||
|
if(GetClassInfoExW(hInstance, (LPCWSTR)lpClassName, &wceW) && wceW.lpszMenuName)
|
||||||
|
{
|
||||||
|
hMenu = LoadMenuW(hInstance, wceW.lpszMenuName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
wceA.cbSize = sizeof(WNDCLASSEXA);
|
||||||
|
if(GetClassInfoExA(hInstance, lpClassName, &wceA) && wceA.lpszMenuName)
|
||||||
|
{
|
||||||
|
hMenu = LoadMenuA(hInstance, wceA.lpszMenuName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Handle = NtUserCreateWindowEx(dwExStyle,
|
||||||
|
&ClassName,
|
||||||
|
&WindowName,
|
||||||
|
dwStyle,
|
||||||
|
x,
|
||||||
|
y,
|
||||||
|
nWidth,
|
||||||
|
nHeight,
|
||||||
|
hWndParent,
|
||||||
|
hMenu,
|
||||||
|
hInstance,
|
||||||
|
lpParam,
|
||||||
|
SW_SHOW,
|
||||||
|
FALSE);
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
DbgPrint("[window] NtUserCreateWindowEx() == %d\n", Handle);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if(!Unicode)
|
||||||
|
{
|
||||||
|
RtlFreeUnicodeString(&WindowName);
|
||||||
|
|
||||||
|
if (!IS_ATOM(lpClassName))
|
||||||
|
{
|
||||||
|
RtlFreeUnicodeString(&ClassName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return Handle;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @implemented
|
||||||
|
*/
|
||||||
|
HWND STDCALL
|
||||||
|
CreateWindowExA(DWORD dwExStyle,
|
||||||
|
LPCSTR lpClassName,
|
||||||
|
LPCSTR lpWindowName,
|
||||||
|
DWORD dwStyle,
|
||||||
|
int x,
|
||||||
|
int y,
|
||||||
|
int nWidth,
|
||||||
|
int nHeight,
|
||||||
|
HWND hWndParent,
|
||||||
|
HMENU hMenu,
|
||||||
|
HINSTANCE hInstance,
|
||||||
|
LPVOID lpParam)
|
||||||
|
{
|
||||||
|
MDICREATESTRUCTA mdi;
|
||||||
|
HWND hwnd;
|
||||||
|
|
||||||
if (dwExStyle & WS_EX_MDICHILD)
|
if (dwExStyle & WS_EX_MDICHILD)
|
||||||
{
|
{
|
||||||
POINT mPos[2];
|
POINT mPos[2];
|
||||||
UINT id = 0;
|
UINT id = 0;
|
||||||
|
|
||||||
/* lpParams of WM_[NC]CREATE is different for MDI children.
|
/* lpParams of WM_[NC]CREATE is different for MDI children.
|
||||||
* MDICREATESTRUCT members have the originally passed values.
|
* MDICREATESTRUCT members have the originally passed values.
|
||||||
*
|
|
||||||
* Note: we rely on the fact that MDICREATESTRUCTA and MDICREATESTRUCTW
|
|
||||||
* have the same layout.
|
|
||||||
*/
|
*/
|
||||||
mdi.szClass = (LPCSTR)lpClassName;
|
mdi.szClass = lpClassName;
|
||||||
mdi.szTitle = (LPCSTR)lpWindowName;
|
mdi.szTitle = lpWindowName;
|
||||||
mdi.hOwner = hInstance;
|
mdi.hOwner = hInstance;
|
||||||
mdi.x = x;
|
mdi.x = x;
|
||||||
mdi.y = y;
|
mdi.y = y;
|
||||||
|
@ -263,98 +347,7 @@ User32CreateWindowEx(DWORD dwExStyle,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Unicode)
|
hwnd = User32CreateWindowEx(dwExStyle,
|
||||||
RtlInitUnicodeString(&WindowName, (PCWSTR)lpWindowName);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (!RtlCreateUnicodeStringFromAsciiz(&WindowName, (PCSZ)lpWindowName))
|
|
||||||
{
|
|
||||||
if (!IS_ATOM(lpClassName))
|
|
||||||
{
|
|
||||||
RtlFreeUnicodeString(&ClassName);
|
|
||||||
}
|
|
||||||
SetLastError(ERROR_OUTOFMEMORY);
|
|
||||||
return (HWND)0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!hMenu && (dwStyle & (WS_OVERLAPPEDWINDOW | WS_POPUP)))
|
|
||||||
{
|
|
||||||
if(Unicode)
|
|
||||||
{
|
|
||||||
wceW.cbSize = sizeof(WNDCLASSEXW);
|
|
||||||
if(GetClassInfoExW(hInstance, (LPCWSTR)lpClassName, &wceW) && wceW.lpszMenuName)
|
|
||||||
{DbgPrint("LoadingMenu 0x%p %d\n", wceW.lpszMenuName, IS_INTRESOURCE(wceW.lpszMenuName));
|
|
||||||
hMenu = LoadMenuW(hInstance, wceW.lpszMenuName);DbgPrint("Loaded menu: 0x%p\n", hMenu);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
wceA.cbSize = sizeof(WNDCLASSEXA);
|
|
||||||
if(GetClassInfoExA(hInstance, lpClassName, &wceA) && wceA.lpszMenuName)
|
|
||||||
{
|
|
||||||
hMenu = LoadMenuA(hInstance, wceA.lpszMenuName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Handle = NtUserCreateWindowEx(dwExStyle,
|
|
||||||
&ClassName,
|
|
||||||
&WindowName,
|
|
||||||
dwStyle,
|
|
||||||
x,
|
|
||||||
y,
|
|
||||||
nWidth,
|
|
||||||
nHeight,
|
|
||||||
hWndParent,
|
|
||||||
hMenu,
|
|
||||||
hInstance,
|
|
||||||
lpParam,
|
|
||||||
SW_SHOW,
|
|
||||||
FALSE);
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
DbgPrint("[window] NtUserCreateWindowEx() == %d\n", Handle);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if ((dwStyle & WS_VISIBLE) && (dwExStyle & WS_EX_MDICHILD) && Handle != (HWND)0)
|
|
||||||
{
|
|
||||||
SendMessageW(hWndParent, WM_MDIREFRESHMENU, 0, 0);
|
|
||||||
SetWindowPos(Handle, HWND_TOP, 0, 0, 0, 0, SWP_SHOWWINDOW |
|
|
||||||
SWP_NOMOVE | SWP_NOSIZE);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!Unicode)
|
|
||||||
{
|
|
||||||
RtlFreeUnicodeString(&WindowName);
|
|
||||||
|
|
||||||
if (!IS_ATOM(lpClassName))
|
|
||||||
{
|
|
||||||
RtlFreeUnicodeString(&ClassName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return Handle;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* @implemented
|
|
||||||
*/
|
|
||||||
HWND STDCALL
|
|
||||||
CreateWindowExA(DWORD dwExStyle,
|
|
||||||
LPCSTR lpClassName,
|
|
||||||
LPCSTR lpWindowName,
|
|
||||||
DWORD dwStyle,
|
|
||||||
int x,
|
|
||||||
int y,
|
|
||||||
int nWidth,
|
|
||||||
int nHeight,
|
|
||||||
HWND hWndParent,
|
|
||||||
HMENU hMenu,
|
|
||||||
HINSTANCE hInstance,
|
|
||||||
LPVOID lpParam)
|
|
||||||
{
|
|
||||||
return User32CreateWindowEx(dwExStyle,
|
|
||||||
lpClassName,
|
lpClassName,
|
||||||
lpWindowName,
|
lpWindowName,
|
||||||
dwStyle,
|
dwStyle,
|
||||||
|
@ -367,6 +360,14 @@ CreateWindowExA(DWORD dwExStyle,
|
||||||
hInstance,
|
hInstance,
|
||||||
lpParam,
|
lpParam,
|
||||||
FALSE);
|
FALSE);
|
||||||
|
|
||||||
|
if ((dwStyle & WS_VISIBLE) && (dwExStyle & WS_EX_MDICHILD) && hwnd != (HWND)0)
|
||||||
|
{
|
||||||
|
SendMessageW(hWndParent, WM_MDIREFRESHMENU, 0, 0);
|
||||||
|
SetWindowPos(hwnd, HWND_TOP, 0, 0, 0, 0, SWP_SHOWWINDOW | SWP_NOMOVE | SWP_NOSIZE);
|
||||||
|
}
|
||||||
|
|
||||||
|
return hwnd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -387,7 +388,78 @@ CreateWindowExW(DWORD dwExStyle,
|
||||||
HINSTANCE hInstance,
|
HINSTANCE hInstance,
|
||||||
LPVOID lpParam)
|
LPVOID lpParam)
|
||||||
{
|
{
|
||||||
return User32CreateWindowEx(dwExStyle,
|
MDICREATESTRUCTW mdi;
|
||||||
|
HWND hwnd;
|
||||||
|
|
||||||
|
if (dwExStyle & WS_EX_MDICHILD)
|
||||||
|
{
|
||||||
|
POINT mPos[2];
|
||||||
|
UINT id = 0;
|
||||||
|
|
||||||
|
/* lpParams of WM_[NC]CREATE is different for MDI children.
|
||||||
|
* MDICREATESTRUCT members have the originally passed values.
|
||||||
|
*/
|
||||||
|
mdi.szClass = lpClassName;
|
||||||
|
mdi.szTitle = lpWindowName;
|
||||||
|
mdi.hOwner = hInstance;
|
||||||
|
mdi.x = x;
|
||||||
|
mdi.y = y;
|
||||||
|
mdi.cx = nWidth;
|
||||||
|
mdi.cy = nHeight;
|
||||||
|
mdi.style = dwStyle;
|
||||||
|
mdi.lParam = (LPARAM)lpParam;
|
||||||
|
|
||||||
|
lpParam = (LPVOID)&mdi;
|
||||||
|
|
||||||
|
if (GetWindowLongW(hWndParent, GWL_STYLE) & MDIS_ALLCHILDSTYLES)
|
||||||
|
{
|
||||||
|
if (dwStyle & WS_POPUP)
|
||||||
|
{
|
||||||
|
DPRINT1("WS_POPUP with MDIS_ALLCHILDSTYLES is not allowed\n");
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
|
dwStyle |= (WS_CHILD | WS_CLIPSIBLINGS);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dwStyle &= ~WS_POPUP;
|
||||||
|
dwStyle |= (WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CAPTION |
|
||||||
|
WS_SYSMENU | WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX);
|
||||||
|
}
|
||||||
|
|
||||||
|
HWND top_child = GetWindow(hWndParent, GW_CHILD);
|
||||||
|
|
||||||
|
if (top_child)
|
||||||
|
{
|
||||||
|
/* Restore current maximized child */
|
||||||
|
if((dwStyle & WS_VISIBLE) && IsZoomed(top_child))
|
||||||
|
{
|
||||||
|
DPRINT("Restoring current maximized child %p\n", top_child);
|
||||||
|
SendMessageW( top_child, WM_SETREDRAW, FALSE, 0 );
|
||||||
|
ShowWindow(top_child, SW_RESTORE);
|
||||||
|
SendMessageW( top_child, WM_SETREDRAW, TRUE, 0 );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
MDI_CalcDefaultChildPos(hWndParent, -1, mPos, 0, &id);
|
||||||
|
|
||||||
|
if (!(dwStyle & WS_POPUP)) hMenu = (HMENU)id;
|
||||||
|
|
||||||
|
if (dwStyle & (WS_CHILD | WS_POPUP))
|
||||||
|
{
|
||||||
|
if (x == CW_USEDEFAULT || x == CW_USEDEFAULT16)
|
||||||
|
{
|
||||||
|
x = mPos[0].x;
|
||||||
|
y = mPos[0].y;
|
||||||
|
}
|
||||||
|
if (nWidth == CW_USEDEFAULT || nWidth == CW_USEDEFAULT16 || !nWidth)
|
||||||
|
nWidth = mPos[1].x;
|
||||||
|
if (nHeight == CW_USEDEFAULT || nHeight == CW_USEDEFAULT16 || !nHeight)
|
||||||
|
nHeight = mPos[1].y;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
hwnd = User32CreateWindowEx(dwExStyle,
|
||||||
(LPCSTR) lpClassName,
|
(LPCSTR) lpClassName,
|
||||||
(LPCSTR) lpWindowName,
|
(LPCSTR) lpWindowName,
|
||||||
dwStyle,
|
dwStyle,
|
||||||
|
@ -400,6 +472,14 @@ CreateWindowExW(DWORD dwExStyle,
|
||||||
hInstance,
|
hInstance,
|
||||||
lpParam,
|
lpParam,
|
||||||
TRUE);
|
TRUE);
|
||||||
|
|
||||||
|
if ((dwStyle & WS_VISIBLE) && (dwExStyle & WS_EX_MDICHILD) && hwnd != (HWND)0)
|
||||||
|
{
|
||||||
|
SendMessageW(hWndParent, WM_MDIREFRESHMENU, 0, 0);
|
||||||
|
SetWindowPos(hwnd, HWND_TOP, 0, 0, 0, 0, SWP_SHOWWINDOW | SWP_NOMOVE | SWP_NOSIZE);
|
||||||
|
}
|
||||||
|
|
||||||
|
return hwnd;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in a new issue