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
66bad889
Commit
66bad889
authored
Oct 04, 2010
by
Nikolay Sivov
Committed by
Alexandre Julliard
Oct 04, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
comctl32/treeview: Prevent item height to be calculated to zero value.
parent
03bd3c80
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
5 deletions
+36
-5
treeview.c
dlls/comctl32/tests/treeview.c
+26
-0
treeview.c
dlls/comctl32/treeview.c
+10
-5
No files found.
dlls/comctl32/tests/treeview.c
View file @
66bad889
...
...
@@ -713,6 +713,32 @@ static void test_get_set_itemheight(void)
ok_sequence
(
sequences
,
TREEVIEW_SEQ_INDEX
,
test_get_set_itemheight_seq
,
"test get set item height"
,
FALSE
);
/* without TVS_NONEVENHEIGHT */
SetWindowLong
(
hTree
,
GWL_STYLE
,
GetWindowLong
(
hTree
,
GWL_STYLE
)
&
~
TVS_NONEVENHEIGHT
);
/* odd value */
ulOldHeight
=
SendMessage
(
hTree
,
TVM_SETITEMHEIGHT
,
3
,
0
);
ok
(
ulOldHeight
==
8
,
"got %d, expected %d
\n
"
,
ulOldHeight
,
8
);
ulNewHeight
=
(
int
)
SendMessage
(
hTree
,
TVM_GETITEMHEIGHT
,
0
,
0
);
ok
(
ulNewHeight
==
2
,
"got %d, expected %d
\n
"
,
ulNewHeight
,
2
);
ulOldHeight
=
SendMessage
(
hTree
,
TVM_SETITEMHEIGHT
,
4
,
0
);
ok
(
ulOldHeight
==
2
,
"got %d, expected %d
\n
"
,
ulOldHeight
,
2
);
ulNewHeight
=
(
int
)
SendMessage
(
hTree
,
TVM_GETITEMHEIGHT
,
0
,
0
);
ok
(
ulNewHeight
==
4
,
"got %d, expected %d
\n
"
,
ulNewHeight
,
4
);
/* with TVS_NONEVENHEIGHT */
SetWindowLong
(
hTree
,
GWL_STYLE
,
GetWindowLong
(
hTree
,
GWL_STYLE
)
|
TVS_NONEVENHEIGHT
);
/* odd value */
ulOldHeight
=
SendMessage
(
hTree
,
TVM_SETITEMHEIGHT
,
3
,
0
);
ok
(
ulOldHeight
==
4
,
"got %d, expected %d
\n
"
,
ulOldHeight
,
4
);
ulNewHeight
=
(
int
)
SendMessage
(
hTree
,
TVM_GETITEMHEIGHT
,
0
,
0
);
ok
(
ulNewHeight
==
3
,
"got %d, expected %d
\n
"
,
ulNewHeight
,
3
);
/* even value */
ulOldHeight
=
SendMessage
(
hTree
,
TVM_SETITEMHEIGHT
,
10
,
0
);
ok
(
ulOldHeight
==
3
,
"got %d, expected %d
\n
"
,
ulOldHeight
,
3
);
ulNewHeight
=
(
int
)
SendMessage
(
hTree
,
TVM_GETITEMHEIGHT
,
0
,
0
);
ok
(
ulNewHeight
==
10
,
"got %d, expected %d
\n
"
,
ulNewHeight
,
10
);
DestroyWindow
(
hTree
);
}
...
...
dlls/comctl32/treeview.c
View file @
66bad889
...
...
@@ -1828,7 +1828,7 @@ TREEVIEW_SetItemHeight(TREEVIEW_INFO *infoPtr, INT newHeight)
{
INT
prevHeight
=
infoPtr
->
uItemHeight
;
TRACE
(
"
%d
\n
"
,
new
Height
);
TRACE
(
"
new=%d, old=%d
\n
"
,
newHeight
,
prev
Height
);
if
(
newHeight
==
-
1
)
{
infoPtr
->
uItemHeight
=
TREEVIEW_NaturalHeight
(
infoPtr
);
...
...
@@ -1836,13 +1836,17 @@ TREEVIEW_SetItemHeight(TREEVIEW_INFO *infoPtr, INT newHeight)
}
else
{
infoPtr
->
uItemHeight
=
newHeight
;
infoPtr
->
bHeightSet
=
TRUE
;
if
(
newHeight
==
0
)
newHeight
=
1
;
infoPtr
->
uItemHeight
=
newHeight
;
infoPtr
->
bHeightSet
=
TRUE
;
}
/* Round down, unless we support odd ("non even") heights. */
if
(
!
(
infoPtr
->
dwStyle
&
TVS_NONEVENHEIGHT
))
infoPtr
->
uItemHeight
&=
~
1
;
if
(
!
(
infoPtr
->
dwStyle
&
TVS_NONEVENHEIGHT
)
&&
infoPtr
->
uItemHeight
!=
1
)
{
infoPtr
->
uItemHeight
&=
~
1
;
TRACE
(
"after rounding=%d
\n
"
,
infoPtr
->
uItemHeight
);
}
if
(
infoPtr
->
uItemHeight
!=
prevHeight
)
{
...
...
@@ -2062,6 +2066,7 @@ static inline LRESULT
TREEVIEW_GetVisibleCount
(
const
TREEVIEW_INFO
*
infoPtr
)
{
/* Surprise! This does not take integral height into account. */
TRACE
(
"client=%d, item=%d
\n
"
,
infoPtr
->
clientHeight
,
infoPtr
->
uItemHeight
);
return
infoPtr
->
clientHeight
/
infoPtr
->
uItemHeight
;
}
...
...
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