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
a7c1b0e0
Commit
a7c1b0e0
authored
Nov 21, 2006
by
Dmitry Timoshkov
Committed by
Alexandre Julliard
Nov 21, 2006
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
user32: Add a rudimentary WM_SETFONT message test for the static control, make it pass under Wine.
parent
10c3a4db
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
113 additions
and
7 deletions
+113
-7
static.c
dlls/user32/static.c
+20
-7
msg.c
dlls/user32/tests/msg.c
+93
-0
No files found.
dlls/user32/static.c
View file @
a7c1b0e0
...
@@ -323,13 +323,17 @@ static VOID STATIC_TryPaintFcn(HWND hwnd, LONG full_style)
...
@@ -323,13 +323,17 @@ static VOID STATIC_TryPaintFcn(HWND hwnd, LONG full_style)
static
HBRUSH
STATIC_SendWmCtlColorStatic
(
HWND
hwnd
,
HDC
hdc
)
static
HBRUSH
STATIC_SendWmCtlColorStatic
(
HWND
hwnd
,
HDC
hdc
)
{
{
HBRUSH
hBrush
=
(
HBRUSH
)
SendMessageW
(
GetParent
(
hwnd
),
HBRUSH
hBrush
;
HWND
parent
=
GetParent
(
hwnd
);
if
(
!
parent
)
parent
=
hwnd
;
hBrush
=
(
HBRUSH
)
SendMessageW
(
parent
,
WM_CTLCOLORSTATIC
,
(
WPARAM
)
hdc
,
(
LPARAM
)
hwnd
);
WM_CTLCOLORSTATIC
,
(
WPARAM
)
hdc
,
(
LPARAM
)
hwnd
);
if
(
!
hBrush
)
/* did the app forget to call DefWindowProc ? */
if
(
!
hBrush
)
/* did the app forget to call DefWindowProc ? */
{
{
/* FIXME: DefWindowProc should return different colors if a
/* FIXME: DefWindowProc should return different colors if a
manifest is present */
manifest is present */
hBrush
=
(
HBRUSH
)
DefWindowProcW
(
GetParent
(
hwnd
)
,
WM_CTLCOLORSTATIC
,
hBrush
=
(
HBRUSH
)
DefWindowProcW
(
parent
,
WM_CTLCOLORSTATIC
,
(
WPARAM
)
hdc
,
(
LPARAM
)
hwnd
);
(
WPARAM
)
hdc
,
(
LPARAM
)
hwnd
);
}
}
return
hBrush
;
return
hBrush
;
...
@@ -399,6 +403,10 @@ static LRESULT StaticWndProc_common( HWND hwnd, UINT uMsg, WPARAM wParam,
...
@@ -399,6 +403,10 @@ static LRESULT StaticWndProc_common( HWND hwnd, UINT uMsg, WPARAM wParam,
else
return
unicode
?
DefWindowProcW
(
hwnd
,
uMsg
,
wParam
,
lParam
)
:
else
return
unicode
?
DefWindowProcW
(
hwnd
,
uMsg
,
wParam
,
lParam
)
:
DefWindowProcA
(
hwnd
,
uMsg
,
wParam
,
lParam
);
DefWindowProcA
(
hwnd
,
uMsg
,
wParam
,
lParam
);
case
WM_ERASEBKGND
:
/* do all painting in WM_PAINT like Windows does */
return
1
;
case
WM_PRINTCLIENT
:
case
WM_PRINTCLIENT
:
case
WM_PAINT
:
case
WM_PAINT
:
{
{
...
@@ -496,7 +504,7 @@ static LRESULT StaticWndProc_common( HWND hwnd, UINT uMsg, WPARAM wParam,
...
@@ -496,7 +504,7 @@ static LRESULT StaticWndProc_common( HWND hwnd, UINT uMsg, WPARAM wParam,
{
{
SetWindowLongPtrW
(
hwnd
,
HFONT_GWL_OFFSET
,
wParam
);
SetWindowLongPtrW
(
hwnd
,
HFONT_GWL_OFFSET
,
wParam
);
if
(
LOWORD
(
lParam
))
if
(
LOWORD
(
lParam
))
STATIC_TryPaintFcn
(
hwnd
,
full_style
);
RedrawWindow
(
hwnd
,
NULL
,
0
,
RDW_INVALIDATE
|
RDW_ERASE
|
RDW_UPDATENOW
|
RDW_ALLCHILDREN
);
}
}
break
;
break
;
...
@@ -612,7 +620,7 @@ static void STATIC_PaintTextfn( HWND hwnd, HDC hdc, DWORD style )
...
@@ -612,7 +620,7 @@ static void STATIC_PaintTextfn( HWND hwnd, HDC hdc, DWORD style )
HBRUSH
hBrush
;
HBRUSH
hBrush
;
HFONT
hFont
,
hOldFont
=
NULL
;
HFONT
hFont
,
hOldFont
=
NULL
;
WORD
wFormat
;
WORD
wFormat
;
INT
len
;
INT
len
,
buf_size
;
WCHAR
*
text
;
WCHAR
*
text
;
GetClientRect
(
hwnd
,
&
rc
);
GetClientRect
(
hwnd
,
&
rc
);
...
@@ -673,9 +681,14 @@ static void STATIC_PaintTextfn( HWND hwnd, HDC hdc, DWORD style )
...
@@ -673,9 +681,14 @@ static void STATIC_PaintTextfn( HWND hwnd, HDC hdc, DWORD style )
if
(
!
IsWindowEnabled
(
hwnd
))
SetTextColor
(
hdc
,
GetSysColor
(
COLOR_GRAYTEXT
));
if
(
!
IsWindowEnabled
(
hwnd
))
SetTextColor
(
hdc
,
GetSysColor
(
COLOR_GRAYTEXT
));
}
}
if
(
!
(
len
=
SendMessageW
(
hwnd
,
WM_GETTEXTLENGTH
,
0
,
0
)))
return
;
buf_size
=
256
;
if
(
!
(
text
=
HeapAlloc
(
GetProcessHeap
(),
0
,
(
len
+
1
)
*
sizeof
(
WCHAR
)
)))
return
;
if
(
!
(
text
=
HeapAlloc
(
GetProcessHeap
(),
0
,
buf_size
*
sizeof
(
WCHAR
)
)))
return
;
SendMessageW
(
hwnd
,
WM_GETTEXT
,
len
+
1
,
(
LPARAM
)
text
);
while
((
len
=
InternalGetWindowText
(
hwnd
,
text
,
buf_size
))
==
buf_size
-
1
)
{
buf_size
*=
2
;
if
(
!
(
text
=
HeapReAlloc
(
GetProcessHeap
(),
0
,
text
,
buf_size
*
sizeof
(
WCHAR
)
)))
return
;
}
if
(((
style
&
SS_TYPEMASK
)
==
SS_SIMPLE
)
&&
(
style
&
SS_NOPREFIX
))
if
(((
style
&
SS_TYPEMASK
)
==
SS_SIMPLE
)
&&
(
style
&
SS_NOPREFIX
))
{
{
...
...
dlls/user32/tests/msg.c
View file @
a7c1b0e0
...
@@ -4217,6 +4217,98 @@ static void test_button_messages(void)
...
@@ -4217,6 +4217,98 @@ static void test_button_messages(void)
DestroyWindow
(
hwnd
);
DestroyWindow
(
hwnd
);
}
}
/****************** static message test *************************/
static
const
struct
message
WmSetFontStaticSeq
[]
=
{
{
WM_SETFONT
,
sent
},
{
WM_PAINT
,
sent
|
defwinproc
},
{
WM_ERASEBKGND
,
sent
|
defwinproc
},
{
WM_CTLCOLORSTATIC
,
sent
|
defwinproc
},
{
0
}
};
static
WNDPROC
old_static_proc
;
static
LRESULT
CALLBACK
static_hook_proc
(
HWND
hwnd
,
UINT
message
,
WPARAM
wParam
,
LPARAM
lParam
)
{
static
long
defwndproc_counter
=
0
;
LRESULT
ret
;
struct
message
msg
;
trace
(
"static: %p, %04x, %08x, %08lx
\n
"
,
hwnd
,
message
,
wParam
,
lParam
);
/* explicitly ignore WM_GETICON message */
if
(
message
==
WM_GETICON
)
return
0
;
msg
.
message
=
message
;
msg
.
flags
=
sent
|
wparam
|
lparam
;
if
(
defwndproc_counter
)
msg
.
flags
|=
defwinproc
;
msg
.
wParam
=
wParam
;
msg
.
lParam
=
lParam
;
add_message
(
&
msg
);
defwndproc_counter
++
;
ret
=
CallWindowProcA
(
old_static_proc
,
hwnd
,
message
,
wParam
,
lParam
);
defwndproc_counter
--
;
return
ret
;
}
static
void
subclass_static
(
void
)
{
WNDCLASSA
cls
;
if
(
!
GetClassInfoA
(
0
,
"static"
,
&
cls
))
assert
(
0
);
old_static_proc
=
cls
.
lpfnWndProc
;
cls
.
hInstance
=
GetModuleHandle
(
0
);
cls
.
lpfnWndProc
=
static_hook_proc
;
cls
.
lpszClassName
=
"my_static_class"
;
if
(
!
RegisterClassA
(
&
cls
))
assert
(
0
);
}
static
void
test_static_messages
(
void
)
{
/* FIXME: make as comprehensive as the button message test */
static
const
struct
{
DWORD
style
;
DWORD
dlg_code
;
const
struct
message
*
setfont
;
}
static_ctrl
[]
=
{
{
SS_LEFT
,
DLGC_STATIC
,
WmSetFontStaticSeq
}
};
unsigned
int
i
;
HWND
hwnd
;
DWORD
dlg_code
;
subclass_static
();
for
(
i
=
0
;
i
<
sizeof
(
static_ctrl
)
/
sizeof
(
static_ctrl
[
0
]);
i
++
)
{
hwnd
=
CreateWindowExA
(
0
,
"my_static_class"
,
"test"
,
static_ctrl
[
i
].
style
|
WS_POPUP
,
0
,
0
,
50
,
14
,
0
,
0
,
0
,
NULL
);
ok
(
hwnd
!=
0
,
"Failed to create static window
\n
"
);
dlg_code
=
SendMessageA
(
hwnd
,
WM_GETDLGCODE
,
0
,
0
);
ok
(
dlg_code
==
static_ctrl
[
i
].
dlg_code
,
"%u: wrong dlg_code %08x
\n
"
,
i
,
dlg_code
);
ShowWindow
(
hwnd
,
SW_SHOW
);
UpdateWindow
(
hwnd
);
SetFocus
(
0
);
flush_sequence
();
trace
(
"static style %08x
\n
"
,
static_ctrl
[
i
].
style
);
SendMessage
(
hwnd
,
WM_SETFONT
,
(
WPARAM
)
GetStockObject
(
DEFAULT_GUI_FONT
),
TRUE
);
ok_sequence
(
static_ctrl
[
i
].
setfont
,
"WM_SETFONT on a static"
,
FALSE
);
DestroyWindow
(
hwnd
);
}
}
/************* painting message test ********************/
/************* painting message test ********************/
void
dump_region
(
HRGN
hrgn
)
void
dump_region
(
HRGN
hrgn
)
...
@@ -8137,6 +8229,7 @@ START_TEST(msg)
...
@@ -8137,6 +8229,7 @@ START_TEST(msg)
invisible_parent_tests
();
invisible_parent_tests
();
test_mdi_messages
();
test_mdi_messages
();
test_button_messages
();
test_button_messages
();
test_static_messages
();
test_paint_messages
();
test_paint_messages
();
test_interthread_messages
();
test_interthread_messages
();
test_message_conversion
();
test_message_conversion
();
...
...
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