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
cb77ab1a
Commit
cb77ab1a
authored
Feb 04, 2013
by
Daniel Jelinski
Committed by
Alexandre Julliard
Feb 06, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
comctl32/listview: Correct icon spacing calculation when set to 0 or -1.
parent
72989b5b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
56 additions
and
49 deletions
+56
-49
listview.c
dlls/comctl32/listview.c
+17
-23
listview.c
dlls/comctl32/tests/listview.c
+39
-26
No files found.
dlls/comctl32/listview.c
View file @
cb77ab1a
...
...
@@ -8,6 +8,7 @@
* Copyright 2002 Dimitrie O. Paun
* Copyright 2009-2013 Nikolay Sivov
* Copyright 2009 Owen Rudge for CodeWeavers
* Copyright 2012-2013 Daniel Jelinski
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
...
...
@@ -8593,28 +8594,21 @@ static DWORD LISTVIEW_SetIconSpacing(LISTVIEW_INFO *infoPtr, INT cx, INT cy)
if
(
infoPtr
->
uView
!=
LV_VIEW_ICON
)
return
oldspacing
;
/* set to defaults, if instructed to */
if
(
cx
==
-
1
)
cx
=
GetSystemMetrics
(
SM_CXICONSPACING
);
if
(
cy
==
-
1
)
cy
=
GetSystemMetrics
(
SM_CYICONSPACING
);
/* if 0 then compute width
* FIXME: computed cx and cy is not matching native behaviour */
if
(
cx
==
0
)
{
cx
=
GetSystemMetrics
(
SM_CXICONSPACING
);
if
(
infoPtr
->
iconSize
.
cx
+
ICON_LR_PADDING
>
cx
)
cx
=
infoPtr
->
iconSize
.
cx
+
ICON_LR_PADDING
;
if
(
cx
==
-
1
&&
cy
==
-
1
)
{
cx
=
GetSystemMetrics
(
SM_CXICONSPACING
)
-
GetSystemMetrics
(
SM_CXICON
)
+
infoPtr
->
iconSize
.
cx
;
cy
=
GetSystemMetrics
(
SM_CYICONSPACING
)
-
GetSystemMetrics
(
SM_CYICON
)
+
infoPtr
->
iconSize
.
cy
;
}
/* if 0 then keep width */
if
(
cx
!=
0
)
infoPtr
->
iconSpacing
.
cx
=
cx
;
/* if 0 then compute height */
if
(
cy
==
0
)
cy
=
infoPtr
->
iconSize
.
cy
+
2
*
infoPtr
->
ntmHeight
+
ICON_BOTTOM_PADDING
+
ICON_TOP_PADDING
+
LABEL_VERT_PADDING
;
infoPtr
->
iconSpacing
.
cx
=
cx
;
infoPtr
->
iconSpacing
.
cy
=
cy
;
/* if 0 then keep height */
if
(
cy
!=
0
)
infoPtr
->
iconSpacing
.
cy
=
cy
;
TRACE
(
"old=(%d,%d), new=(%d,%d), iconSize=(%d,%d), ntmH=%d
\n
"
,
LOWORD
(
oldspacing
),
HIWORD
(
oldspacing
),
cx
,
cy
,
LOWORD
(
oldspacing
),
HIWORD
(
oldspacing
),
infoPtr
->
iconSpacing
.
cx
,
infoPtr
->
iconSpacing
.
cy
,
infoPtr
->
iconSize
.
cx
,
infoPtr
->
iconSize
.
cy
,
infoPtr
->
ntmHeight
);
...
...
@@ -8666,7 +8660,7 @@ static HIMAGELIST LISTVIEW_SetImageList(LISTVIEW_INFO *infoPtr, INT nType, HIMAG
himlOld
=
infoPtr
->
himlNormal
;
infoPtr
->
himlNormal
=
himl
;
if
(
infoPtr
->
uView
==
LV_VIEW_ICON
)
set_icon_size
(
&
infoPtr
->
iconSize
,
himl
,
FALSE
);
LISTVIEW_SetIconSpacing
(
infoPtr
,
0
,
0
);
LISTVIEW_SetIconSpacing
(
infoPtr
,
-
1
,
-
1
);
break
;
case
LVSIL_SMALL
:
...
...
@@ -9090,7 +9084,7 @@ static INT LISTVIEW_SetView(LISTVIEW_INFO *infoPtr, DWORD nView)
{
TRACE
(
"icon old size=(%d,%d), new size=(%d,%d)
\n
"
,
oldIconSize
.
cx
,
oldIconSize
.
cy
,
infoPtr
->
iconSize
.
cx
,
infoPtr
->
iconSize
.
cy
);
LISTVIEW_SetIconSpacing
(
infoPtr
,
0
,
0
);
LISTVIEW_SetIconSpacing
(
infoPtr
,
-
1
,
-
1
);
}
LISTVIEW_Arrange
(
infoPtr
,
LVA_DEFAULT
);
break
;
...
...
@@ -9389,8 +9383,8 @@ static LRESULT LISTVIEW_NCCreate(HWND hwnd, const CREATESTRUCTW *lpcs)
infoPtr
->
bRedraw
=
TRUE
;
infoPtr
->
bNoItemMetrics
=
TRUE
;
infoPtr
->
bDoChangeNotify
=
TRUE
;
infoPtr
->
iconSpacing
.
cx
=
GetSystemMetrics
(
SM_CXICONSPACING
);
infoPtr
->
iconSpacing
.
cy
=
GetSystemMetrics
(
SM_CYICONSPACING
);
infoPtr
->
iconSpacing
.
cx
=
GetSystemMetrics
(
SM_CXICONSPACING
)
-
GetSystemMetrics
(
SM_CXICON
)
;
infoPtr
->
iconSpacing
.
cy
=
GetSystemMetrics
(
SM_CYICONSPACING
)
-
GetSystemMetrics
(
SM_CYICON
)
;
infoPtr
->
nEditLabelItem
=
-
1
;
infoPtr
->
nLButtonDownItem
=
-
1
;
infoPtr
->
dwHoverTime
=
HOVER_DEFAULT
;
/* default system hover time */
...
...
@@ -11040,7 +11034,7 @@ static INT LISTVIEW_StyleChanged(LISTVIEW_INFO *infoPtr, WPARAM wStyleType,
{
TRACE
(
"icon old size=(%d,%d), new size=(%d,%d)
\n
"
,
oldIconSize
.
cx
,
oldIconSize
.
cy
,
infoPtr
->
iconSize
.
cx
,
infoPtr
->
iconSize
.
cy
);
LISTVIEW_SetIconSpacing
(
infoPtr
,
0
,
0
);
LISTVIEW_SetIconSpacing
(
infoPtr
,
-
1
,
-
1
);
}
}
else
if
(
uNewView
==
LVS_REPORT
)
...
...
dlls/comctl32/tests/listview.c
View file @
cb77ab1a
...
...
@@ -4598,9 +4598,7 @@ static void test_getitemspacing(void)
HWND
hwnd
;
DWORD
ret
;
INT
cx
,
cy
;
HIMAGELIST
himl
;
HBITMAP
hbmp
;
LVITEMA
itema
;
HIMAGELIST
himl40
,
himl80
;
cx
=
GetSystemMetrics
(
SM_CXICONSPACING
)
-
GetSystemMetrics
(
SM_CXICON
);
cy
=
GetSystemMetrics
(
SM_CYICONSPACING
)
-
GetSystemMetrics
(
SM_CYICON
);
...
...
@@ -4608,56 +4606,71 @@ static void test_getitemspacing(void)
/* LVS_ICON */
hwnd
=
create_listview_control
(
LVS_ICON
);
ret
=
SendMessage
(
hwnd
,
LVM_GETITEMSPACING
,
FALSE
,
0
);
todo_wine
{
expect
(
cx
,
LOWORD
(
ret
));
expect
(
cy
,
HIWORD
(
ret
));
}
/* now try with icons */
himl
=
ImageList_Create
(
40
,
40
,
0
,
4
,
4
);
ok
(
himl
!=
NULL
,
"failed to create imagelist
\n
"
);
hbmp
=
CreateBitmap
(
40
,
40
,
1
,
1
,
NULL
);
ok
(
hbmp
!=
NULL
,
"failed to create bitmap
\n
"
);
ret
=
ImageList_Add
(
himl
,
hbmp
,
0
);
expect
(
0
,
ret
);
ret
=
SendMessage
(
hwnd
,
LVM_SETIMAGELIST
,
0
,
(
LPARAM
)
himl
);
himl40
=
ImageList_Create
(
40
,
40
,
0
,
4
,
4
);
ok
(
himl40
!=
NULL
,
"failed to create imagelist
\n
"
);
himl80
=
ImageList_Create
(
80
,
80
,
0
,
4
,
4
);
ok
(
himl80
!=
NULL
,
"failed to create imagelist
\n
"
);
ret
=
SendMessage
(
hwnd
,
LVM_SETIMAGELIST
,
LVSIL_NORMAL
,
(
LPARAM
)
himl40
);
expect
(
0
,
ret
);
itema
.
mask
=
LVIF_IMAGE
;
itema
.
iImage
=
0
;
itema
.
iItem
=
0
;
itema
.
iSubItem
=
0
;
ret
=
SendMessage
(
hwnd
,
LVM_INSERTITEM
,
0
,
(
LPARAM
)
&
itema
);
expect
(
0
,
ret
);
ret
=
SendMessage
(
hwnd
,
LVM_GETITEMSPACING
,
FALSE
,
0
);
todo_wine
{
/* spacing + icon size returned */
expect
(
cx
+
40
,
LOWORD
(
ret
));
expect
(
cy
+
40
,
HIWORD
(
ret
));
}
/* try changing icon size */
SendMessage
(
hwnd
,
LVM_SETIMAGELIST
,
LVSIL_NORMAL
,
(
LPARAM
)
himl80
);
ret
=
SendMessage
(
hwnd
,
LVM_GETITEMSPACING
,
FALSE
,
0
);
/* spacing + icon size returned */
expect
(
cx
+
80
,
LOWORD
(
ret
));
expect
(
cy
+
80
,
HIWORD
(
ret
));
/* set own icon spacing */
ret
=
SendMessage
(
hwnd
,
LVM_SETICONSPACING
,
0
,
MAKELPARAM
(
100
,
100
));
expect
(
cx
+
80
,
LOWORD
(
ret
));
expect
(
cy
+
80
,
HIWORD
(
ret
));
ret
=
SendMessage
(
hwnd
,
LVM_GETITEMSPACING
,
FALSE
,
0
);
/* set size returned */
expect
(
100
,
LOWORD
(
ret
));
expect
(
100
,
HIWORD
(
ret
));
/* now change image list - icon spacing should be unaffected */
SendMessage
(
hwnd
,
LVM_SETIMAGELIST
,
LVSIL_NORMAL
,
(
LPARAM
)
himl40
);
ret
=
SendMessage
(
hwnd
,
LVM_GETITEMSPACING
,
FALSE
,
0
);
/* spacing + icon size returned */
expect
(
cx
+
40
,
LOWORD
(
ret
));
expect
(
cy
+
40
,
HIWORD
(
ret
));
SendMessage
(
hwnd
,
LVM_SETIMAGELIST
,
LVSIL_NORMAL
,
0
);
ImageList_Destroy
(
himl80
);
DestroyWindow
(
hwnd
);
/* LVS_SMALLICON */
hwnd
=
create_listview_control
(
LVS_SMALLICON
);
ret
=
SendMessage
(
hwnd
,
LVM_GETITEMSPACING
,
FALSE
,
0
);
todo_wine
{
expect
(
cx
,
LOWORD
(
ret
));
expect
(
cy
,
HIWORD
(
ret
));
}
ImageList_Destroy
(
himl40
);
DestroyWindow
(
hwnd
);
/* LVS_REPORT */
hwnd
=
create_listview_control
(
LVS_REPORT
);
ret
=
SendMessage
(
hwnd
,
LVM_GETITEMSPACING
,
FALSE
,
0
);
todo_wine
{
expect
(
cx
,
LOWORD
(
ret
));
expect
(
cy
,
HIWORD
(
ret
));
}
DestroyWindow
(
hwnd
);
/* LVS_LIST */
hwnd
=
create_listview_control
(
LVS_LIST
);
ret
=
SendMessage
(
hwnd
,
LVM_GETITEMSPACING
,
FALSE
,
0
);
todo_wine
{
expect
(
cx
,
LOWORD
(
ret
));
expect
(
cy
,
HIWORD
(
ret
));
}
DestroyWindow
(
hwnd
);
}
...
...
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