mirror of
https://gitlab.winehq.org/wine/wine.git
synced 2024-11-21 17:09:06 -07:00
user32: Fix window style while CBT_CREATEWND hook is called.
Signed-off-by: Piotr Caban <piotr@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
1b6f8a1adb
commit
fd60414fce
7 changed files with 46 additions and 25 deletions
|
@ -1222,10 +1222,9 @@ static LRESULT CALLBACK cbt_hook_proc(int nCode, WPARAM wParam, LPARAM lParam)
|
|||
|
||||
/* WS_VISIBLE should be turned off yet */
|
||||
style = createwnd->lpcs->style & ~WS_VISIBLE;
|
||||
todo_wine_if(!(style & WS_CLIPSIBLINGS) && (!(style & WS_CHILD) || (style & WS_POPUP)))
|
||||
ok(style == GetWindowLongA(hwnd, GWL_STYLE),
|
||||
"style of hwnd and style in the CREATESTRUCT do not match: %08x != %08x\n",
|
||||
GetWindowLongA(hwnd, GWL_STYLE), style);
|
||||
ok(style == GetWindowLongA(hwnd, GWL_STYLE),
|
||||
"style of hwnd and style in the CREATESTRUCT do not match: %08x != %08x\n",
|
||||
GetWindowLongA(hwnd, GWL_STYLE), style);
|
||||
|
||||
if (0)
|
||||
{
|
||||
|
@ -4451,13 +4450,11 @@ static LRESULT WINAPI cbt_proc(int ncode, WPARAM wparam, LPARAM lparam)
|
|||
c->lpcs->dwExStyle, ts->cs_exstyle);
|
||||
|
||||
style = GetWindowLongW(hwnd, GWL_STYLE);
|
||||
todo_wine_if(!(ts->cs_style & WS_CHILD) || (ts->cs_style & WS_POPUP))
|
||||
ok(style == ts->cs_style, "style = 0x%08x, expected 0x%08x\n",
|
||||
style, ts->cs_style);
|
||||
ok(style == ts->cs_style, "style = 0x%08x, expected 0x%08x\n",
|
||||
style, ts->cs_style);
|
||||
style = GetWindowLongW(hwnd, GWL_EXSTYLE);
|
||||
todo_wine_if(ts->exstyle != ts->cs_exstyle)
|
||||
ok(style == (ts->cs_exstyle & ~WS_EX_LAYERED),
|
||||
"exstyle = 0x%08x, expected 0x%08x\n", style, ts->cs_exstyle);
|
||||
ok(style == (ts->cs_exstyle & ~WS_EX_LAYERED),
|
||||
"exstyle = 0x%08x, expected 0x%08x\n", style, ts->cs_exstyle);
|
||||
return CallNextHookEx(NULL, ncode, wparam, lparam);
|
||||
}
|
||||
|
||||
|
|
|
@ -192,7 +192,8 @@ void *free_user_handle( HANDLE handle, enum user_obj_type type )
|
|||
* Create a window handle with the server.
|
||||
*/
|
||||
static WND *create_window_handle( HWND parent, HWND owner, LPCWSTR name,
|
||||
HINSTANCE instance, BOOL unicode )
|
||||
HINSTANCE instance, BOOL unicode,
|
||||
DWORD style, DWORD ex_style )
|
||||
{
|
||||
WORD index;
|
||||
WND *win;
|
||||
|
@ -209,6 +210,8 @@ static WND *create_window_handle( HWND parent, HWND owner, LPCWSTR name,
|
|||
req->instance = wine_server_client_ptr( instance );
|
||||
req->dpi = GetDpiForSystem();
|
||||
req->awareness = awareness;
|
||||
req->style = style;
|
||||
req->ex_style = ex_style;
|
||||
if (!(req->atom = get_int_atom_value( name )) && name)
|
||||
wine_server_add_data( req, name, lstrlenW(name)*sizeof(WCHAR) );
|
||||
if (!wine_server_call_err( req ))
|
||||
|
@ -1482,7 +1485,7 @@ static DWORD fix_exstyle( DWORD style, DWORD exstyle )
|
|||
*/
|
||||
HWND WIN_CreateWindowEx( CREATESTRUCTW *cs, LPCWSTR className, HINSTANCE module, BOOL unicode )
|
||||
{
|
||||
INT cx, cy, style, sw = SW_SHOW;
|
||||
INT cx, cy, style, ex_style, sw = SW_SHOW;
|
||||
LRESULT result;
|
||||
RECT rect;
|
||||
WND *wndPtr;
|
||||
|
@ -1614,13 +1617,17 @@ HWND WIN_CreateWindowEx( CREATESTRUCTW *cs, LPCWSTR className, HINSTANCE module,
|
|||
|
||||
/* Create the window structure */
|
||||
|
||||
if (!(wndPtr = create_window_handle( parent, owner, className, module, unicode )))
|
||||
style = cs->style & ~WS_VISIBLE;
|
||||
ex_style = cs->dwExStyle & ~WS_EX_LAYERED;
|
||||
if (!(wndPtr = create_window_handle( parent, owner, className, module,
|
||||
unicode, style, ex_style )))
|
||||
{
|
||||
WNDCLASSW wc;
|
||||
/* if it's a comctl32 class, GetClassInfo will load it, then we can retry */
|
||||
if (GetLastError() != ERROR_INVALID_HANDLE ||
|
||||
!GetClassInfoW( 0, className, &wc ) ||
|
||||
!(wndPtr = create_window_handle( parent, owner, className, module, unicode )))
|
||||
!(wndPtr = create_window_handle( parent, owner, className, module,
|
||||
unicode, style, ex_style )))
|
||||
return 0;
|
||||
}
|
||||
hwnd = wndPtr->obj.handle;
|
||||
|
@ -1630,8 +1637,8 @@ HWND WIN_CreateWindowEx( CREATESTRUCTW *cs, LPCWSTR className, HINSTANCE module,
|
|||
wndPtr->tid = GetCurrentThreadId();
|
||||
wndPtr->hInstance = cs->hInstance;
|
||||
wndPtr->text = NULL;
|
||||
wndPtr->dwStyle = cs->style & ~WS_VISIBLE;
|
||||
wndPtr->dwExStyle = cs->dwExStyle;
|
||||
wndPtr->dwStyle = style;
|
||||
wndPtr->dwExStyle = ex_style;
|
||||
wndPtr->wIDmenu = 0;
|
||||
wndPtr->helpContext = 0;
|
||||
wndPtr->pScroll = NULL;
|
||||
|
@ -1647,6 +1654,19 @@ HWND WIN_CreateWindowEx( CREATESTRUCTW *cs, LPCWSTR className, HINSTANCE module,
|
|||
|
||||
if (wndPtr->dwStyle & WS_SYSMENU) SetSystemMenu( hwnd, 0 );
|
||||
|
||||
/* call the WH_CBT hook */
|
||||
|
||||
WIN_ReleasePtr( wndPtr );
|
||||
cbcs = *cs;
|
||||
cbtc.lpcs = &cbcs;
|
||||
cbtc.hwndInsertAfter = HWND_TOP;
|
||||
if (HOOK_CallHooks( WH_CBT, HCBT_CREATEWND, (WPARAM)hwnd, (LPARAM)&cbtc, unicode ) ||
|
||||
!(wndPtr = WIN_GetPtr( hwnd )))
|
||||
{
|
||||
free_window_handle( hwnd );
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Correct the window styles.
|
||||
*
|
||||
|
@ -1660,6 +1680,7 @@ HWND WIN_CreateWindowEx( CREATESTRUCTW *cs, LPCWSTR className, HINSTANCE module,
|
|||
wndPtr->dwStyle |= WS_CAPTION;
|
||||
}
|
||||
|
||||
wndPtr->dwExStyle = cs->dwExStyle;
|
||||
/* WS_EX_WINDOWEDGE depends on some other styles */
|
||||
if ((wndPtr->dwStyle & (WS_DLGFRAME | WS_THICKFRAME)) &&
|
||||
!(wndPtr->dwStyle & (WS_CHILD | WS_POPUP)))
|
||||
|
@ -1713,13 +1734,6 @@ HWND WIN_CreateWindowEx( CREATESTRUCTW *cs, LPCWSTR className, HINSTANCE module,
|
|||
|
||||
context = SetThreadDpiAwarenessContext( GetWindowDpiAwarenessContext( hwnd ));
|
||||
|
||||
/* call the WH_CBT hook */
|
||||
|
||||
cbcs = *cs;
|
||||
cbtc.lpcs = &cbcs;
|
||||
cbtc.hwndInsertAfter = HWND_TOP;
|
||||
if (HOOK_CallHooks( WH_CBT, HCBT_CREATEWND, (WPARAM)hwnd, (LPARAM)&cbtc, unicode )) goto failed;
|
||||
|
||||
/* send the WM_GETMINMAXINFO message and fix the size if needed */
|
||||
|
||||
cx = cs->cx;
|
||||
|
|
|
@ -3021,6 +3021,8 @@ struct create_window_request
|
|||
mod_handle_t instance;
|
||||
int dpi;
|
||||
int awareness;
|
||||
unsigned int style;
|
||||
unsigned int ex_style;
|
||||
/* VARARG(class,unicode_str); */
|
||||
};
|
||||
struct create_window_reply
|
||||
|
@ -6257,7 +6259,7 @@ union generic_reply
|
|||
|
||||
/* ### protocol_version begin ### */
|
||||
|
||||
#define SERVER_PROTOCOL_VERSION 732
|
||||
#define SERVER_PROTOCOL_VERSION 733
|
||||
|
||||
/* ### protocol_version end ### */
|
||||
|
||||
|
|
|
@ -2241,6 +2241,8 @@ enum message_type
|
|||
mod_handle_t instance; /* module instance */
|
||||
int dpi; /* system DPI */
|
||||
int awareness; /* thread DPI awareness */
|
||||
unsigned int style; /* window style */
|
||||
unsigned int ex_style; /* window extended style */
|
||||
VARARG(class,unicode_str); /* class name */
|
||||
@REPLY
|
||||
user_handle_t handle; /* created window */
|
||||
|
|
|
@ -1441,7 +1441,9 @@ C_ASSERT( FIELD_OFFSET(struct create_window_request, atom) == 20 );
|
|||
C_ASSERT( FIELD_OFFSET(struct create_window_request, instance) == 24 );
|
||||
C_ASSERT( FIELD_OFFSET(struct create_window_request, dpi) == 32 );
|
||||
C_ASSERT( FIELD_OFFSET(struct create_window_request, awareness) == 36 );
|
||||
C_ASSERT( sizeof(struct create_window_request) == 40 );
|
||||
C_ASSERT( FIELD_OFFSET(struct create_window_request, style) == 40 );
|
||||
C_ASSERT( FIELD_OFFSET(struct create_window_request, ex_style) == 44 );
|
||||
C_ASSERT( sizeof(struct create_window_request) == 48 );
|
||||
C_ASSERT( FIELD_OFFSET(struct create_window_reply, handle) == 8 );
|
||||
C_ASSERT( FIELD_OFFSET(struct create_window_reply, parent) == 12 );
|
||||
C_ASSERT( FIELD_OFFSET(struct create_window_reply, owner) == 16 );
|
||||
|
|
|
@ -2929,6 +2929,8 @@ static void dump_create_window_request( const struct create_window_request *req
|
|||
dump_uint64( ", instance=", &req->instance );
|
||||
fprintf( stderr, ", dpi=%d", req->dpi );
|
||||
fprintf( stderr, ", awareness=%d", req->awareness );
|
||||
fprintf( stderr, ", style=%08x", req->style );
|
||||
fprintf( stderr, ", ex_style=%08x", req->ex_style );
|
||||
dump_varargs_unicode_str( ", class=", cur_size );
|
||||
}
|
||||
|
||||
|
|
|
@ -1964,6 +1964,8 @@ DECL_HANDLER(create_window)
|
|||
win->dpi_awareness = req->awareness;
|
||||
win->dpi = req->dpi;
|
||||
}
|
||||
win->style = req->style;
|
||||
win->ex_style = req->ex_style;
|
||||
|
||||
reply->handle = win->handle;
|
||||
reply->parent = win->parent ? win->parent->handle : 0;
|
||||
|
|
Loading…
Reference in a new issue