Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
a289bab1
Commit
a289bab1
authored
Jul 22, 2008
by
Mikołaj Zalewski
Committed by
Alexandre Julliard
Jul 23, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
comctl32: toolbar: TB_SETBITMAPSIZE should not change a coordinate when passed -1 (with testcase).
parent
412cd04c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
11 deletions
+42
-11
toolbar.c
dlls/comctl32/tests/toolbar.c
+19
-0
toolbar.c
dlls/comctl32/toolbar.c
+23
-11
No files found.
dlls/comctl32/tests/toolbar.c
View file @
a289bab1
...
...
@@ -203,6 +203,13 @@ static void rebuild_toolbar_with_buttons(HWND *hToolbar)
ok
(
SendMessage
(
*
hToolbar
,
TB_AUTOSIZE
,
0
,
0
)
==
0
,
"TB_AUTOSIZE failed
\n
"
);
}
static
void
add_128x15_bitmap
(
HWND
hToolbar
,
int
nCmds
)
{
TBADDBITMAP
bmp128
;
bmp128
.
hInst
=
GetModuleHandle
(
NULL
);
bmp128
.
nID
=
IDB_BITMAP_128x15
;
ok
(
SendMessageA
(
hToolbar
,
TB_ADDBITMAP
,
nCmds
,
(
LPARAM
)
&
bmp128
)
==
0
,
"TB_ADDBITMAP - unexpected return
\n
"
);
}
#define CHECK_IMAGELIST(count, dx, dy) { \
int cx, cy; \
...
...
@@ -854,6 +861,18 @@ static void test_sizes(void)
ok
(
SendMessageA
(
hToolbar
,
TB_GETBUTTONSIZE
,
0
,
0
)
==
MAKELONG
(
23
,
22
),
"Unexpected button size
\n
"
);
SendMessageA
(
hToolbar
,
TB_SETBITMAPSIZE
,
0
,
MAKELONG
(
16
,
15
));
ok
(
SendMessageA
(
hToolbar
,
TB_GETBUTTONSIZE
,
0
,
0
)
==
MAKELONG
(
23
,
21
),
"Unexpected button size
\n
"
);
/* -1 in TB_SETBITMAPSIZE is a special code meaning that the coordinate shouldn't be changed */
add_128x15_bitmap
(
hToolbar
,
16
);
ok
(
SendMessageA
(
hToolbar
,
TB_SETBITMAPSIZE
,
0
,
MAKELONG
(
14
,
-
1
)),
"TB_SETBITMAPSIZE failed
\n
"
);
compare
((
int
)
SendMessageA
(
hToolbar
,
TB_GETBUTTONSIZE
,
0
,
0
),
MAKELONG
(
21
,
21
),
"%x"
);
ok
(
SendMessageA
(
hToolbar
,
TB_SETBITMAPSIZE
,
0
,
MAKELONG
(
-
1
,
12
)),
"TB_SETBITMAPSIZE failed
\n
"
);
compare
((
int
)
SendMessageA
(
hToolbar
,
TB_GETBUTTONSIZE
,
0
,
0
),
MAKELONG
(
21
,
18
),
"%x"
);
ok
(
SendMessageA
(
hToolbar
,
TB_SETBITMAPSIZE
,
0
,
MAKELONG
(
-
1
,
-
1
)),
"TB_SETBITMAPSIZE failed
\n
"
);
compare
((
int
)
SendMessageA
(
hToolbar
,
TB_GETBUTTONSIZE
,
0
,
0
),
MAKELONG
(
21
,
18
),
"%x"
);
/* check the imagelist */
InvalidateRect
(
hToolbar
,
NULL
,
TRUE
);
UpdateWindow
(
hToolbar
);
CHECK_IMAGELIST
(
16
,
14
,
12
);
rebuild_toolbar
(
&
hToolbar
);
SendMessageA
(
hToolbar
,
TB_ADDSTRINGA
,
0
,
(
LPARAM
)
"A
\0
MMMMMMMMMMMMM
\0
"
);
...
...
dlls/comctl32/toolbar.c
View file @
a289bab1
...
...
@@ -4374,26 +4374,38 @@ TOOLBAR_SetBitmapSize (HWND hwnd, WPARAM wParam, LPARAM lParam)
{
TOOLBAR_INFO
*
infoPtr
=
TOOLBAR_GetInfoPtr
(
hwnd
);
HIMAGELIST
himlDef
=
GETDEFIMAGELIST
(
infoPtr
,
0
);
short
width
=
(
short
)
LOWORD
(
lParam
);
short
height
=
(
short
)
HIWORD
(
lParam
);
TRACE
(
"hwnd=%p, wParam=%ld, lParam=%ld
\n
"
,
hwnd
,
wParam
,
lParam
);
if
(
wParam
!=
0
)
FIXME
(
"wParam is %ld. Perhaps image list index?
\n
"
,
wParam
);
if
(
LOWORD
(
lParam
)
==
0
)
lParam
=
MAKELPARAM
(
1
,
HIWORD
(
lParam
));
if
(
HIWORD
(
lParam
)
==
0
)
lParam
=
MAKELPARAM
(
LOWORD
(
lParam
),
1
)
;
/* 0 width or height is changed to 1 */
if
(
width
==
0
)
width
=
1
;
if
(
height
==
0
)
height
=
1
;
if
(
infoPtr
->
nNumButtons
>
0
)
WARN
(
"%d buttons, undoc increase to bitmap size : %d-%d -> %d-%d
\n
"
,
infoPtr
->
nNumButtons
,
infoPtr
->
nBitmapWidth
,
infoPtr
->
nBitmapHeight
,
LOWORD
(
lParam
),
HIWORD
(
lParam
));
TRACE
(
"%d buttons, undoc change to bitmap size : %d-%d -> %d-%d
\n
"
,
infoPtr
->
nNumButtons
,
infoPtr
->
nBitmapWidth
,
infoPtr
->
nBitmapHeight
,
width
,
height
);
if
(
width
<
-
1
||
height
<
-
1
)
{
/* Windows destroys the imagelist and seems to actually use negative
* values to compute button sizes */
FIXME
(
"Negative bitmap sizes not supported (%d, %d)
\n
"
,
width
,
height
);
return
FALSE
;
}
infoPtr
->
nBitmapWidth
=
(
INT
)
LOWORD
(
lParam
);
infoPtr
->
nBitmapHeight
=
(
INT
)
HIWORD
(
lParam
);
/* width or height of -1 means no change */
if
(
width
!=
-
1
)
infoPtr
->
nBitmapWidth
=
width
;
if
(
height
!=
-
1
)
infoPtr
->
nBitmapHeight
=
height
;
if
((
himlDef
==
infoPtr
->
himlInt
)
&&
(
ImageList_GetImageCount
(
infoPtr
->
himlInt
)
==
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