Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
fd60414f
Commit
fd60414f
authored
Oct 07, 2021
by
Piotr Caban
Committed by
Alexandre Julliard
Oct 07, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
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
>
parent
1b6f8a1a
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
46 additions
and
25 deletions
+46
-25
win.c
dlls/user32/tests/win.c
+7
-10
win.c
dlls/user32/win.c
+27
-13
server_protocol.h
include/wine/server_protocol.h
+3
-1
protocol.def
server/protocol.def
+2
-0
request.h
server/request.h
+3
-1
trace.c
server/trace.c
+2
-0
window.c
server/window.c
+2
-0
No files found.
dlls/user32/tests/win.c
View file @
fd60414f
...
...
@@ -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
);
}
...
...
dlls/user32/win.c
View file @
fd60414f
...
...
@@ -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
->
dwExS
tyle
;
wndPtr
->
dwStyle
=
style
;
wndPtr
->
dwExStyle
=
ex_s
tyle
;
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
;
...
...
include/wine/server_protocol.h
View file @
fd60414f
...
...
@@ -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 73
2
#define SERVER_PROTOCOL_VERSION 73
3
/* ### protocol_version end ### */
...
...
server/protocol.def
View file @
fd60414f
...
...
@@ -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 */
...
...
server/request.h
View file @
fd60414f
...
...
@@ -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
);
...
...
server/trace.c
View file @
fd60414f
...
...
@@ -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
);
}
...
...
server/window.c
View file @
fd60414f
...
...
@@ -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
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment