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
81e698da
Commit
81e698da
authored
Mar 01, 2018
by
Nikolay Sivov
Committed by
Alexandre Julliard
Mar 01, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
comctl32/button: Do not select old font back after painting.
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
b7a08c92
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
4 deletions
+36
-4
button.c
dlls/comctl32/button.c
+2
-3
button.c
dlls/comctl32/tests/button.c
+34
-1
No files found.
dlls/comctl32/button.c
View file @
81e698da
...
...
@@ -1220,7 +1220,7 @@ static void OB_Paint( const BUTTON_INFO *infoPtr, HDC hDC, UINT action )
DRAWITEMSTRUCT
dis
;
LONG_PTR
id
=
GetWindowLongPtrW
(
infoPtr
->
hwnd
,
GWLP_ID
);
HWND
parent
;
HFONT
hFont
,
hPrevFont
=
0
;
HFONT
hFont
;
HRGN
hrgn
;
dis
.
CtlType
=
ODT_BUTTON
;
...
...
@@ -1235,7 +1235,7 @@ static void OB_Paint( const BUTTON_INFO *infoPtr, HDC hDC, UINT action )
dis
.
itemData
=
0
;
GetClientRect
(
infoPtr
->
hwnd
,
&
dis
.
rcItem
);
if
((
hFont
=
infoPtr
->
font
))
hPrevFont
=
SelectObject
(
hDC
,
hFont
);
if
((
hFont
=
infoPtr
->
font
))
SelectObject
(
hDC
,
hFont
);
parent
=
GetParent
(
infoPtr
->
hwnd
);
if
(
!
parent
)
parent
=
infoPtr
->
hwnd
;
SendMessageW
(
parent
,
WM_CTLCOLORBTN
,
(
WPARAM
)
hDC
,
(
LPARAM
)
infoPtr
->
hwnd
);
...
...
@@ -1243,7 +1243,6 @@ static void OB_Paint( const BUTTON_INFO *infoPtr, HDC hDC, UINT action )
hrgn
=
set_control_clipping
(
hDC
,
&
dis
.
rcItem
);
SendMessageW
(
GetParent
(
infoPtr
->
hwnd
),
WM_DRAWITEM
,
id
,
(
LPARAM
)
&
dis
);
if
(
hPrevFont
)
SelectObject
(
hDC
,
hPrevFont
);
SelectClipRgn
(
hDC
,
hrgn
);
if
(
hrgn
)
DeleteObject
(
hrgn
);
}
...
...
dlls/comctl32/tests/button.c
View file @
81e698da
...
...
@@ -519,11 +519,12 @@ static void test_button_messages(void)
setfocus_seq
,
killfocus_seq
,
setstyle_seq
,
setstate_seq
,
setstate_seq
,
setcheck_ignored_seq
},
};
LOGFONTA
logfont
=
{
0
};
const
struct
message
*
seq
;
HFONT
zfont
,
hfont2
;
unsigned
int
i
;
HWND
hwnd
,
parent
;
DWORD
dlg_code
;
HFONT
zfont
;
BOOL
todo
;
/* selection with VK_SPACE should capture button window */
...
...
@@ -540,10 +541,19 @@ static void test_button_messages(void)
100
,
100
,
200
,
200
,
0
,
0
,
0
,
NULL
);
ok
(
parent
!=
0
,
"Failed to create parent window
\n
"
);
logfont
.
lfHeight
=
-
12
;
logfont
.
lfWeight
=
FW_NORMAL
;
strcpy
(
logfont
.
lfFaceName
,
"Tahoma"
);
hfont2
=
CreateFontIndirectA
(
&
logfont
);
ok
(
hfont2
!=
NULL
,
"Failed to create Tahoma font
\n
"
);
for
(
i
=
0
;
i
<
sizeof
(
button
)
/
sizeof
(
button
[
0
]);
i
++
)
{
HFONT
prevfont
,
hfont
;
MSG
msg
;
DWORD
style
,
state
;
HDC
hdc
;
trace
(
"%d: button test sequence
\n
"
,
i
);
hwnd
=
create_button
(
button
[
i
].
style
,
parent
);
...
...
@@ -686,9 +696,32 @@ static void test_button_messages(void)
else
ok
(
style
==
button
[
i
].
style
,
"expected style %04x got %04x
\n
"
,
button
[
i
].
style
,
style
);
/* Test that original font is not selected back after painting */
hfont
=
(
HFONT
)
SendMessageA
(
hwnd
,
WM_GETFONT
,
0
,
0
);
ok
(
hfont
==
NULL
,
"Unexpected control font.
\n
"
);
SendMessageA
(
hwnd
,
WM_SETFONT
,
(
WPARAM
)
GetStockObject
(
SYSTEM_FONT
),
0
);
hdc
=
CreateCompatibleDC
(
0
);
prevfont
=
SelectObject
(
hdc
,
hfont2
);
SendMessageA
(
hwnd
,
WM_PRINTCLIENT
,
(
WPARAM
)
hdc
,
0
);
ok
(
hfont2
!=
GetCurrentObject
(
hdc
,
OBJ_FONT
)
||
broken
(
hfont2
==
GetCurrentObject
(
hdc
,
OBJ_FONT
))
/* WinXP */
,
"button[%u]: unexpected font selected after WM_PRINTCLIENT
\n
"
,
i
);
SelectObject
(
hdc
,
prevfont
);
prevfont
=
SelectObject
(
hdc
,
hfont2
);
SendMessageA
(
hwnd
,
WM_PAINT
,
(
WPARAM
)
hdc
,
0
);
ok
(
hfont2
!=
GetCurrentObject
(
hdc
,
OBJ_FONT
)
||
broken
(
hfont2
==
GetCurrentObject
(
hdc
,
OBJ_FONT
))
/* WinXP */
,
"button[%u]: unexpected font selected after WM_PAINT
\n
"
,
i
);
SelectObject
(
hdc
,
prevfont
);
DeleteDC
(
hdc
);
DestroyWindow
(
hwnd
);
}
DeleteObject
(
hfont2
);
DestroyWindow
(
parent
);
hwnd
=
create_button
(
BS_PUSHBUTTON
,
NULL
);
...
...
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