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
fef35d7b
Commit
fef35d7b
authored
Mar 08, 2021
by
Nikolay Sivov
Committed by
Alexandre Julliard
Mar 09, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
comctl32/listview: Remove current sorting arguments from control structure.
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
043ecca3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
46 deletions
+23
-46
listview.c
dlls/comctl32/listview.c
+23
-46
No files found.
dlls/comctl32/listview.c
View file @
fef35d7b
...
...
@@ -254,10 +254,6 @@ typedef struct tagLISTVIEW_INFO
INT
nItemHeight
;
INT
nItemWidth
;
/* sorting */
PFNLVCOMPARE
pfnCompare
;
/* sorting callback pointer */
LPARAM
lParamSort
;
/* style */
DWORD
dwStyle
;
/* the cached window GWL_STYLE */
DWORD
dwLvExStyle
;
/* extended listview style */
...
...
@@ -9232,52 +9228,31 @@ static INT LISTVIEW_SetView(LISTVIEW_INFO *infoPtr, DWORD nView)
/* LISTVIEW_SetWorkAreas */
/***
* DESCRIPTION:
* Callback internally used by LISTVIEW_SortItems() in response of LVM_SORTITEMS
*
* PARAMETER(S):
* [I] first : pointer to first ITEM_INFO to compare
* [I] second : pointer to second ITEM_INFO to compare
* [I] lParam : HWND of control
*
* RETURN:
* if first comes before second : negative
* if first comes after second : positive
* if first and second are equivalent : zero
*/
struct
sorting_context
{
LISTVIEW_INFO
*
infoPtr
;
PFNLVCOMPARE
compare_func
;
LPARAM
lParam
;
};
/* DPA_Sort() callback used for LVM_SORTITEMS */
static
INT
WINAPI
LISTVIEW_CallBackCompare
(
LPVOID
first
,
LPVOID
second
,
LPARAM
lParam
)
{
LISTVIEW_INFO
*
infoPtr
=
(
LISTVIEW_INFO
*
)
lParam
;
ITEM_INFO
*
lv_first
=
DPA_GetPtr
(
first
,
0
);
ITEM_INFO
*
lv_second
=
DPA_GetPtr
(
second
,
0
);
struct
sorting_context
*
context
=
(
struct
sorting_context
*
)
lParam
;
ITEM_INFO
*
lv_first
=
DPA_GetPtr
(
first
,
0
);
ITEM_INFO
*
lv_second
=
DPA_GetPtr
(
second
,
0
);
/* Forward the call to the client defined callback */
return
(
infoPtr
->
pfnCompare
)(
lv_first
->
lParam
,
lv_second
->
lParam
,
infoPtr
->
lParamSort
);
return
context
->
compare_func
(
lv_first
->
lParam
,
lv_second
->
lParam
,
context
->
lParam
);
}
/***
* DESCRIPTION:
* Callback internally used by LISTVIEW_SortItems() in response of LVM_SORTITEMSEX
*
* PARAMETER(S):
* [I] first : pointer to first ITEM_INFO to compare
* [I] second : pointer to second ITEM_INFO to compare
* [I] lParam : HWND of control
*
* RETURN:
* if first comes before second : negative
* if first comes after second : positive
* if first and second are equivalent : zero
*/
/* DPA_Sort() callback used for LVM_SORTITEMSEX */
static
INT
WINAPI
LISTVIEW_CallBackCompareEx
(
LPVOID
first
,
LPVOID
second
,
LPARAM
lParam
)
{
LISTVIEW_INFO
*
infoPtr
=
(
LISTVIEW_INFO
*
)
lParam
;
INT
first_idx
=
DPA_GetPtrIndex
(
infoPtr
->
hdpaItems
,
first
);
INT
second_idx
=
DPA_GetPtrIndex
(
infoPtr
->
hdpaItems
,
second
);
struct
sorting_context
*
context
=
(
struct
sorting_context
*
)
lParam
;
INT
first_idx
=
DPA_GetPtrIndex
(
context
->
infoPtr
->
hdpaItems
,
first
);
INT
second_idx
=
DPA_GetPtrIndex
(
context
->
infoPtr
->
hdpaItems
,
second
);
/* Forward the call to the client defined callback */
return
(
infoPtr
->
pfnCompare
)(
first_idx
,
second_idx
,
infoPtr
->
lParamSort
);
return
context
->
compare_func
(
first_idx
,
second_idx
,
context
->
lParam
);
}
/***
...
...
@@ -9301,6 +9276,7 @@ static BOOL LISTVIEW_SortItems(LISTVIEW_INFO *infoPtr, PFNLVCOMPARE pfnCompare,
ITEM_INFO
*
lpItem
;
LPVOID
selectionMarkItem
=
NULL
;
LPVOID
focusedItem
=
NULL
;
struct
sorting_context
context
;
int
i
;
TRACE
(
"(pfnCompare=%p, lParamSort=%lx)
\n
"
,
pfnCompare
,
lParamSort
);
...
...
@@ -9322,12 +9298,13 @@ static BOOL LISTVIEW_SortItems(LISTVIEW_INFO *infoPtr, PFNLVCOMPARE pfnCompare,
if
(
infoPtr
->
nFocusedItem
>=
0
)
focusedItem
=
DPA_GetPtr
(
infoPtr
->
hdpaItems
,
infoPtr
->
nFocusedItem
);
infoPtr
->
pfnCompare
=
pfnCompare
;
infoPtr
->
lParamSort
=
lParamSort
;
context
.
infoPtr
=
infoPtr
;
context
.
compare_func
=
pfnCompare
;
context
.
lParam
=
lParamSort
;
if
(
IsEx
)
DPA_Sort
(
infoPtr
->
hdpaItems
,
LISTVIEW_CallBackCompareEx
,
(
LPARAM
)
infoPtr
);
DPA_Sort
(
infoPtr
->
hdpaItems
,
LISTVIEW_CallBackCompareEx
,
(
LPARAM
)
&
context
);
else
DPA_Sort
(
infoPtr
->
hdpaItems
,
LISTVIEW_CallBackCompare
,
(
LPARAM
)
infoPtr
);
DPA_Sort
(
infoPtr
->
hdpaItems
,
LISTVIEW_CallBackCompare
,
(
LPARAM
)
&
context
);
/* restore selection ranges */
for
(
i
=
0
;
i
<
infoPtr
->
nItemCount
;
i
++
)
...
...
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