Commit 0f2f2b34 authored by Rein Klazes's avatar Rein Klazes Committed by Alexandre Julliard

Move calling of CBT hooks from WIN_CreateWindowEx() to the driver.

parent 19d66cc1
......@@ -12,6 +12,7 @@
#include "win.h"
#include "winpos.h"
#include "debugtools.h"
#include "hook.h"
DEFAULT_DEBUG_CHANNEL(ttydrv);
......@@ -28,6 +29,7 @@ DEFAULT_DEBUG_CHANNEL(ttydrv);
BOOL TTYDRV_CreateWindow( HWND hwnd, CREATESTRUCTA *cs, BOOL unicode )
{
BOOL ret;
HWND hwndLinkAfter;
#ifdef WINE_CURSES
WND *wndPtr = WIN_FindWndPtr( hwnd );
......@@ -60,6 +62,29 @@ BOOL TTYDRV_CreateWindow( HWND hwnd, CREATESTRUCTA *cs, BOOL unicode )
FIXME("(%x): stub\n", hwnd);
#endif /* defined(WINE_CURSES) */
/* Call the WH_CBT hook */
hwndLinkAfter = ((cs->style & (WS_CHILD|WS_MAXIMIZE)) == WS_CHILD)
? HWND_BOTTOM : HWND_TOP;
if (HOOK_IsHooked( WH_CBT ))
{
CBT_CREATEWNDA cbtc;
LRESULT lret;
cbtc.lpcs = cs;
cbtc.hwndInsertAfter = hwndLinkAfter;
lret = (unicode) ? HOOK_CallHooksW(WH_CBT, HCBT_CREATEWND,
(WPARAM)hwnd, (LPARAM)&cbtc)
: HOOK_CallHooksA(WH_CBT, HCBT_CREATEWND,
(WPARAM)hwnd, (LPARAM)&cbtc);
if (lret)
{
TRACE("CBT-hook returned !0\n");
return FALSE;
}
}
if (unicode)
{
ret = SendMessageW( hwnd, WM_NCCREATE, 0, (LPARAM)cs );
......
......@@ -25,6 +25,7 @@
#include "winpos.h"
#include "dce.h"
#include "options.h"
#include "hook.h"
DEFAULT_DEBUG_CHANNEL(x11drv);
......@@ -821,6 +822,7 @@ BOOL X11DRV_DestroyWindow( HWND hwnd )
*/
BOOL X11DRV_CreateWindow( HWND hwnd, CREATESTRUCTA *cs, BOOL unicode )
{
HWND hwndLinkAfter;
Display *display = thread_display();
WND *wndPtr;
struct x11drv_win_data *data;
......@@ -855,6 +857,31 @@ BOOL X11DRV_CreateWindow( HWND hwnd, CREATESTRUCTA *cs, BOOL unicode )
SetPropA( hwnd, whole_window_atom, (HANDLE)data->whole_window );
SetPropA( hwnd, client_window_atom, (HANDLE)data->client_window );
/* Call the WH_CBT hook */
hwndLinkAfter = ((cs->style & (WS_CHILD|WS_MAXIMIZE)) == WS_CHILD)
? HWND_BOTTOM : HWND_TOP;
if (HOOK_IsHooked( WH_CBT ))
{
CBT_CREATEWNDA cbtc;
LRESULT lret;
cbtc.lpcs = cs;
cbtc.hwndInsertAfter = hwndLinkAfter;
lret = (unicode) ? HOOK_CallHooksW(WH_CBT, HCBT_CREATEWND,
(WPARAM)hwnd, (LPARAM)&cbtc)
: HOOK_CallHooksA(WH_CBT, HCBT_CREATEWND,
(WPARAM)hwnd, (LPARAM)&cbtc);
if (lret)
{
TRACE("CBT-hook returned !0\n");
goto failed;
}
}
/* Send the WM_GETMINMAXINFO message and fix the size if needed */
if ((cs->style & WS_THICKFRAME) || !(cs->style & (WS_POPUP | WS_CHILD)))
{
......
......@@ -961,7 +961,7 @@ static HWND WIN_CreateWindowEx( CREATESTRUCTA *cs, ATOM classAtom,
INT sw = SW_SHOW;
struct tagCLASS *classPtr;
WND *wndPtr;
HWND hwnd, hwndLinkAfter, parent, owner;
HWND hwnd, parent, owner;
INT wndExtra;
DWORD clsStyle;
WNDPROC winproc;
......@@ -1067,32 +1067,6 @@ static HWND WIN_CreateWindowEx( CREATESTRUCTA *cs, ATOM classAtom,
if (wndExtra) memset( wndPtr->wExtra, 0, wndExtra);
/* Call the WH_CBT hook */
hwndLinkAfter = ((cs->style & (WS_CHILD|WS_MAXIMIZE)) == WS_CHILD)
? HWND_BOTTOM : HWND_TOP;
if (HOOK_IsHooked( WH_CBT ))
{
CBT_CREATEWNDA cbtc;
LRESULT ret;
cbtc.lpcs = cs;
cbtc.hwndInsertAfter = hwndLinkAfter;
ret = (type == WIN_PROC_32W) ? HOOK_CallHooksW(WH_CBT, HCBT_CREATEWND,
(WPARAM)hwnd, (LPARAM)&cbtc)
: HOOK_CallHooksA(WH_CBT, HCBT_CREATEWND,
(WPARAM)hwnd, (LPARAM)&cbtc);
if (ret)
{
TRACE("CBT-hook returned 0\n");
free_window_handle( hwnd );
CLASS_RemoveWindow( classPtr );
WIN_ReleaseWndPtr(wndPtr);
return 0;
}
}
/* Correct the window style - stage 2 */
if (!(cs->style & WS_CHILD))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment