Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-fonts
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
Aleksandr Isakov
wine-fonts
Commits
176bd922
Commit
176bd922
authored
Apr 03, 2022
by
Rafał Harabień
Committed by
Alexandre Julliard
Apr 07, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
comctl32: Send WM_CTLCOLORSTATIC for all static control types.
Signed-off-by:
Rafał Harabień
<
rafalh92@outlook.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
4e8277e6
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
71 additions
and
83 deletions
+71
-83
static.c
dlls/comctl32/static.c
+61
-73
misc.c
dlls/comctl32/tests/misc.c
+2
-2
static.c
dlls/comctl32/tests/static.c
+8
-8
No files found.
dlls/comctl32/static.c
View file @
176bd922
...
...
@@ -44,13 +44,13 @@
WINE_DEFAULT_DEBUG_CHANNEL
(
static
);
static
void
STATIC_PaintOwnerDrawfn
(
HWND
hwnd
,
HDC
hdc
,
DWORD
style
);
static
void
STATIC_PaintTextfn
(
HWND
hwnd
,
HDC
hdc
,
DWORD
style
);
static
void
STATIC_PaintRectfn
(
HWND
hwnd
,
HDC
hdc
,
DWORD
style
);
static
void
STATIC_PaintIconfn
(
HWND
hwnd
,
HDC
hdc
,
DWORD
style
);
static
void
STATIC_PaintBitmapfn
(
HWND
hwnd
,
HDC
hdc
,
DWORD
style
);
static
void
STATIC_PaintEnhMetafn
(
HWND
hwnd
,
HDC
hdc
,
DWORD
style
);
static
void
STATIC_PaintEtchedfn
(
HWND
hwnd
,
HDC
hdc
,
DWORD
style
);
static
void
STATIC_PaintOwnerDrawfn
(
HWND
hwnd
,
HDC
hdc
,
HBRUSH
hbrush
,
DWORD
style
);
static
void
STATIC_PaintTextfn
(
HWND
hwnd
,
HDC
hdc
,
HBRUSH
hbrush
,
DWORD
style
);
static
void
STATIC_PaintRectfn
(
HWND
hwnd
,
HDC
hdc
,
HBRUSH
hbrush
,
DWORD
style
);
static
void
STATIC_PaintIconfn
(
HWND
hwnd
,
HDC
hdc
,
HBRUSH
hbrush
,
DWORD
style
);
static
void
STATIC_PaintBitmapfn
(
HWND
hwnd
,
HDC
hdc
,
HBRUSH
hbrush
,
DWORD
style
);
static
void
STATIC_PaintEnhMetafn
(
HWND
hwnd
,
HDC
hdc
,
HBRUSH
hbrush
,
DWORD
style
);
static
void
STATIC_PaintEtchedfn
(
HWND
hwnd
,
HDC
hdc
,
HBRUSH
hbrush
,
DWORD
style
);
struct
static_extra_info
{
...
...
@@ -64,7 +64,7 @@ struct static_extra_info
BOOL
image_has_alpha
;
};
typedef
void
(
*
pfPaint
)(
HWND
hwnd
,
HDC
hdc
,
DWORD
style
);
typedef
void
(
*
pfPaint
)(
HWND
hwnd
,
HDC
hdc
,
HBRUSH
hbrush
,
DWORD
style
);
static
const
pfPaint
staticPaintFunc
[
SS_TYPEMASK
+
1
]
=
{
...
...
@@ -371,6 +371,22 @@ static HICON STATIC_LoadIconW( HINSTANCE hInstance, LPCWSTR name, DWORD style )
return
hicon
;
}
static
HBRUSH
STATIC_SendWmCtlColorStatic
(
HWND
hwnd
,
HDC
hdc
)
{
HBRUSH
hBrush
;
HWND
parent
=
GetParent
(
hwnd
);
if
(
!
parent
)
parent
=
hwnd
;
hBrush
=
(
HBRUSH
)
SendMessageW
(
parent
,
WM_CTLCOLORSTATIC
,
(
WPARAM
)
hdc
,
(
LPARAM
)
hwnd
);
if
(
!
hBrush
)
/* did the app forget to call DefWindowProc ? */
{
/* FIXME: DefWindowProc should return different colors if a
manifest is present */
hBrush
=
(
HBRUSH
)
DefWindowProcW
(
parent
,
WM_CTLCOLORSTATIC
,
(
WPARAM
)
hdc
,
(
LPARAM
)
hwnd
);
}
return
hBrush
;
}
/***********************************************************************
* STATIC_TryPaintFcn
*
...
...
@@ -378,40 +394,26 @@ static HICON STATIC_LoadIconW( HINSTANCE hInstance, LPCWSTR name, DWORD style )
*/
static
VOID
STATIC_TryPaintFcn
(
HWND
hwnd
,
LONG
full_style
)
{
LONG
style
=
full_style
&
SS_TYPEMASK
;
RECT
rc
;
GetClientRect
(
hwnd
,
&
rc
);
if
(
!
IsRectEmpty
(
&
rc
)
&&
IsWindowVisible
(
hwnd
)
&&
staticPaintFunc
[
style
])
if
(
IsWindowVisible
(
hwnd
))
{
RECT
rc
;
HDC
hdc
;
HRGN
hrgn
;
HBRUSH
hbrush
;
LONG
style
=
full_style
&
SS_TYPEMASK
;
GetClientRect
(
hwnd
,
&
rc
);
hdc
=
GetDC
(
hwnd
);
hrgn
=
set_control_clipping
(
hdc
,
&
rc
);
(
staticPaintFunc
[
style
])(
hwnd
,
hdc
,
full_style
);
hbrush
=
STATIC_SendWmCtlColorStatic
(
hwnd
,
hdc
);
if
(
staticPaintFunc
[
style
])
(
staticPaintFunc
[
style
])(
hwnd
,
hdc
,
hbrush
,
full_style
);
SelectClipRgn
(
hdc
,
hrgn
);
if
(
hrgn
)
DeleteObject
(
hrgn
);
ReleaseDC
(
hwnd
,
hdc
);
}
}
static
HBRUSH
STATIC_SendWmCtlColorStatic
(
HWND
hwnd
,
HDC
hdc
)
{
HBRUSH
hBrush
;
HWND
parent
=
GetParent
(
hwnd
);
if
(
!
parent
)
parent
=
hwnd
;
hBrush
=
(
HBRUSH
)
SendMessageW
(
parent
,
WM_CTLCOLORSTATIC
,
(
WPARAM
)
hdc
,
(
LPARAM
)
hwnd
);
if
(
!
hBrush
)
/* did the app forget to call DefWindowProc ? */
{
/* FIXME: DefWindowProc should return different colors if a
manifest is present */
hBrush
=
(
HBRUSH
)
DefWindowProcW
(
parent
,
WM_CTLCOLORSTATIC
,
(
WPARAM
)
hdc
,
(
LPARAM
)
hwnd
);
}
return
hBrush
;
}
/***********************************************************************
* hasTextStyle
*
...
...
@@ -492,14 +494,16 @@ static LRESULT CALLBACK STATIC_WindowProc( HWND hwnd, UINT uMsg, WPARAM wParam,
PAINTSTRUCT
ps
;
RECT
rect
;
HDC
hdc
=
wParam
?
(
HDC
)
wParam
:
BeginPaint
(
hwnd
,
&
ps
);
HRGN
hrgn
;
HBRUSH
hbrush
;
GetClientRect
(
hwnd
,
&
rect
);
hrgn
=
set_control_clipping
(
hdc
,
&
rect
);
hbrush
=
STATIC_SendWmCtlColorStatic
(
hwnd
,
hdc
);
if
(
staticPaintFunc
[
style
])
{
HRGN
hrgn
=
set_control_clipping
(
hdc
,
&
rect
);
(
staticPaintFunc
[
style
])(
hwnd
,
hdc
,
full_style
);
SelectClipRgn
(
hdc
,
hrgn
);
if
(
hrgn
)
DeleteObject
(
hrgn
);
}
(
staticPaintFunc
[
style
])(
hwnd
,
hdc
,
hbrush
,
full_style
);
SelectClipRgn
(
hdc
,
hrgn
);
if
(
hrgn
)
DeleteObject
(
hrgn
);
if
(
!
wParam
)
EndPaint
(
hwnd
,
&
ps
);
}
break
;
...
...
@@ -653,7 +657,7 @@ static LRESULT CALLBACK STATIC_WindowProc( HWND hwnd, UINT uMsg, WPARAM wParam,
return
lResult
;
}
static
void
STATIC_PaintOwnerDrawfn
(
HWND
hwnd
,
HDC
hdc
,
DWORD
style
)
static
void
STATIC_PaintOwnerDrawfn
(
HWND
hwnd
,
HDC
hdc
,
HBRUSH
hbrush
,
DWORD
style
)
{
DRAWITEMSTRUCT
dis
;
HFONT
font
,
oldFont
=
NULL
;
...
...
@@ -671,15 +675,13 @@ static void STATIC_PaintOwnerDrawfn( HWND hwnd, HDC hdc, DWORD style )
font
=
STATIC_GetFont
(
hwnd
);
if
(
font
)
oldFont
=
SelectObject
(
hdc
,
font
);
SendMessageW
(
GetParent
(
hwnd
),
WM_CTLCOLORSTATIC
,
(
WPARAM
)
hdc
,
(
LPARAM
)
hwnd
);
SendMessageW
(
GetParent
(
hwnd
),
WM_DRAWITEM
,
id
,
(
LPARAM
)
&
dis
);
if
(
font
)
SelectObject
(
hdc
,
oldFont
);
}
static
void
STATIC_PaintTextfn
(
HWND
hwnd
,
HDC
hdc
,
DWORD
style
)
static
void
STATIC_PaintTextfn
(
HWND
hwnd
,
HDC
hdc
,
HBRUSH
hbrush
,
DWORD
style
)
{
RECT
rc
;
HBRUSH
hBrush
;
HFONT
hFont
,
hOldFont
=
NULL
;
UINT
format
;
INT
len
,
buf_size
;
...
...
@@ -736,13 +738,9 @@ static void STATIC_PaintTextfn( HWND hwnd, HDC hdc, DWORD style )
if
((
hFont
=
STATIC_GetFont
(
hwnd
)))
hOldFont
=
SelectObject
(
hdc
,
hFont
);
/* SS_SIMPLE controls: WM_CTLCOLORSTATIC is sent, but the returned
brush is not used */
hBrush
=
STATIC_SendWmCtlColorStatic
(
hwnd
,
hdc
);
if
((
style
&
SS_TYPEMASK
)
!=
SS_SIMPLE
)
{
FillRect
(
hdc
,
&
rc
,
h
B
rush
);
FillRect
(
hdc
,
&
rc
,
h
b
rush
);
if
(
!
IsWindowEnabled
(
hwnd
))
SetTextColor
(
hdc
,
GetSysColor
(
COLOR_GRAYTEXT
));
}
...
...
@@ -779,56 +777,52 @@ no_TextOut:
SelectObject
(
hdc
,
hOldFont
);
}
static
void
STATIC_PaintRectfn
(
HWND
hwnd
,
HDC
hdc
,
DWORD
style
)
static
void
STATIC_PaintRectfn
(
HWND
hwnd
,
HDC
hdc
,
HBRUSH
hbrush
,
DWORD
style
)
{
RECT
rc
;
HBRUSH
hBrush
;
GetClientRect
(
hwnd
,
&
rc
);
/* FIXME: send WM_CTLCOLORSTATIC */
switch
(
style
&
SS_TYPEMASK
)
{
case
SS_BLACKRECT
:
h
B
rush
=
CreateSolidBrush
(
comctl32_color
.
clr3dDkShadow
);
FillRect
(
hdc
,
&
rc
,
h
B
rush
);
h
b
rush
=
CreateSolidBrush
(
comctl32_color
.
clr3dDkShadow
);
FillRect
(
hdc
,
&
rc
,
h
b
rush
);
break
;
case
SS_GRAYRECT
:
h
B
rush
=
CreateSolidBrush
(
comctl32_color
.
clr3dShadow
);
FillRect
(
hdc
,
&
rc
,
h
B
rush
);
h
b
rush
=
CreateSolidBrush
(
comctl32_color
.
clr3dShadow
);
FillRect
(
hdc
,
&
rc
,
h
b
rush
);
break
;
case
SS_WHITERECT
:
h
B
rush
=
CreateSolidBrush
(
comctl32_color
.
clr3dHilight
);
FillRect
(
hdc
,
&
rc
,
h
B
rush
);
h
b
rush
=
CreateSolidBrush
(
comctl32_color
.
clr3dHilight
);
FillRect
(
hdc
,
&
rc
,
h
b
rush
);
break
;
case
SS_BLACKFRAME
:
h
B
rush
=
CreateSolidBrush
(
comctl32_color
.
clr3dDkShadow
);
FrameRect
(
hdc
,
&
rc
,
h
B
rush
);
h
b
rush
=
CreateSolidBrush
(
comctl32_color
.
clr3dDkShadow
);
FrameRect
(
hdc
,
&
rc
,
h
b
rush
);
break
;
case
SS_GRAYFRAME
:
h
B
rush
=
CreateSolidBrush
(
comctl32_color
.
clr3dShadow
);
FrameRect
(
hdc
,
&
rc
,
h
B
rush
);
h
b
rush
=
CreateSolidBrush
(
comctl32_color
.
clr3dShadow
);
FrameRect
(
hdc
,
&
rc
,
h
b
rush
);
break
;
case
SS_WHITEFRAME
:
h
B
rush
=
CreateSolidBrush
(
comctl32_color
.
clr3dHilight
);
FrameRect
(
hdc
,
&
rc
,
h
B
rush
);
h
b
rush
=
CreateSolidBrush
(
comctl32_color
.
clr3dHilight
);
FrameRect
(
hdc
,
&
rc
,
h
b
rush
);
break
;
default:
return
;
}
DeleteObject
(
h
B
rush
);
DeleteObject
(
h
b
rush
);
}
static
void
STATIC_PaintIconfn
(
HWND
hwnd
,
HDC
hdc
,
DWORD
style
)
static
void
STATIC_PaintIconfn
(
HWND
hwnd
,
HDC
hdc
,
HBRUSH
hbrush
,
DWORD
style
)
{
RECT
rc
,
iconRect
;
HBRUSH
hbrush
;
HICON
hIcon
;
SIZE
size
;
GetClientRect
(
hwnd
,
&
rc
);
hbrush
=
STATIC_SendWmCtlColorStatic
(
hwnd
,
hdc
);
hIcon
=
STATIC_GetImage
(
hwnd
,
IMAGE_ICON
,
style
);
if
(
!
hIcon
||
!
get_icon_size
(
hIcon
,
&
size
))
{
...
...
@@ -851,13 +845,10 @@ static void STATIC_PaintIconfn( HWND hwnd, HDC hdc, DWORD style )
}
}
static
void
STATIC_PaintBitmapfn
(
HWND
hwnd
,
HDC
hdc
,
DWORD
style
)
static
void
STATIC_PaintBitmapfn
(
HWND
hwnd
,
HDC
hdc
,
HBRUSH
hbrush
,
DWORD
style
)
{
HDC
hMemDC
;
HBITMAP
hBitmap
,
oldbitmap
;
HBRUSH
hbrush
;
hbrush
=
STATIC_SendWmCtlColorStatic
(
hwnd
,
hdc
);
if
((
hBitmap
=
STATIC_GetImage
(
hwnd
,
IMAGE_BITMAP
,
style
))
&&
(
GetObjectType
(
hBitmap
)
==
OBJ_BITMAP
)
...
...
@@ -902,14 +893,12 @@ static void STATIC_PaintBitmapfn(HWND hwnd, HDC hdc, DWORD style )
}
}
static
void
STATIC_PaintEnhMetafn
(
HWND
hwnd
,
HDC
hdc
,
DWORD
style
)
static
void
STATIC_PaintEnhMetafn
(
HWND
hwnd
,
HDC
hdc
,
HBRUSH
hbrush
,
DWORD
style
)
{
HENHMETAFILE
hEnhMetaFile
;
RECT
rc
;
HBRUSH
hbrush
;
GetClientRect
(
hwnd
,
&
rc
);
hbrush
=
STATIC_SendWmCtlColorStatic
(
hwnd
,
hdc
);
FillRect
(
hdc
,
&
rc
,
hbrush
);
if
((
hEnhMetaFile
=
STATIC_GetImage
(
hwnd
,
IMAGE_ENHMETAFILE
,
style
)))
{
...
...
@@ -920,11 +909,10 @@ static void STATIC_PaintEnhMetafn(HWND hwnd, HDC hdc, DWORD style )
}
}
static
void
STATIC_PaintEtchedfn
(
HWND
hwnd
,
HDC
hdc
,
DWORD
style
)
static
void
STATIC_PaintEtchedfn
(
HWND
hwnd
,
HDC
hdc
,
HBRUSH
hbrush
,
DWORD
style
)
{
RECT
rc
;
/* FIXME: sometimes (not always) sends WM_CTLCOLORSTATIC */
GetClientRect
(
hwnd
,
&
rc
);
DrawEdge
(
hdc
,
&
rc
,
EDGE_ETCHED
,
BF_RECT
);
}
...
...
dlls/comctl32/tests/misc.c
View file @
176bd922
...
...
@@ -874,11 +874,11 @@ static void test_themed_background(void)
{
REBARCLASSNAMEA
,
0
,
empty_seq
},
{
WC_STATICA
,
SS_LEFT
,
wm_ctlcolorstatic_seq
},
{
WC_STATICA
,
SS_ICON
,
wm_ctlcolorstatic_seq
},
{
WC_STATICA
,
SS_BLACKRECT
,
wm_ctlcolorstatic_seq
,
TRUE
},
{
WC_STATICA
,
SS_BLACKRECT
,
wm_ctlcolorstatic_seq
},
{
WC_STATICA
,
SS_OWNERDRAW
,
wm_ctlcolorstatic_seq
},
{
WC_STATICA
,
SS_BITMAP
,
wm_ctlcolorstatic_seq
},
{
WC_STATICA
,
SS_ENHMETAFILE
,
wm_ctlcolorstatic_seq
},
{
WC_STATICA
,
SS_ETCHEDHORZ
,
wm_ctlcolorstatic_seq
,
TRUE
},
{
WC_STATICA
,
SS_ETCHEDHORZ
,
wm_ctlcolorstatic_seq
},
{
STATUSCLASSNAMEA
,
0
,
empty_seq
},
{
"SysLink"
,
0
,
wm_ctlcolorstatic_seq
},
{
WC_TABCONTROLA
,
0
,
drawthemeparentbackground_seq
},
...
...
dlls/comctl32/tests/static.c
View file @
176bd922
...
...
@@ -424,18 +424,18 @@ START_TEST(static)
test_updates
(
0
,
0
);
test_updates
(
SS_ICON
,
0
);
test_updates
(
SS_BLACKRECT
,
TODO_COUNT
);
test_updates
(
SS_WHITERECT
,
TODO_COUNT
);
test_updates
(
SS_BLACKFRAME
,
TODO_COUNT
);
test_updates
(
SS_WHITEFRAME
,
TODO_COUNT
);
test_updates
(
SS_USERITEM
,
TODO_COUNT
);
test_updates
(
SS_BLACKRECT
,
0
);
test_updates
(
SS_WHITERECT
,
0
);
test_updates
(
SS_BLACKFRAME
,
0
);
test_updates
(
SS_WHITEFRAME
,
0
);
test_updates
(
SS_USERITEM
,
0
);
test_updates
(
SS_SIMPLE
,
0
);
test_updates
(
SS_OWNERDRAW
,
0
);
test_updates
(
SS_BITMAP
,
0
);
test_updates
(
SS_BITMAP
|
SS_CENTERIMAGE
,
0
);
test_updates
(
SS_ETCHEDHORZ
,
TODO_COUNT
);
test_updates
(
SS_ETCHEDVERT
,
TODO_COUNT
);
test_updates
(
SS_ETCHEDFRAME
,
TODO_COUNT
);
test_updates
(
SS_ETCHEDHORZ
,
0
);
test_updates
(
SS_ETCHEDVERT
,
0
);
test_updates
(
SS_ETCHEDFRAME
,
0
);
test_updates
(
SS_SUNKEN
,
0
);
test_set_text
();
test_set_image
();
...
...
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