Skip to content

Commit 5fc8fa4

Browse files
committed
Fix exlv sorting (regression from previous subclass changes)
1 parent d149591 commit 5fc8fa4

File tree

1 file changed

+8
-12
lines changed

1 file changed

+8
-12
lines changed

phlib/extlv.c

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ LRESULT CALLBACK PhpExtendedListViewWndProc(
164164
{
165165
HWND headerHandle;
166166

167-
headerHandle = (HWND)DefSubclassProc(hwnd, LVM_GETHEADER, 0, 0);
167+
headerHandle = (HWND)SendMessage(hwnd, LVM_GETHEADER, 0, 0);
168168

169169
if (header->hwndFrom == headerHandle)
170170
{
@@ -352,7 +352,7 @@ LRESULT CALLBACK PhpExtendedListViewWndProc(
352352
{
353353
if (i != column)
354354
{
355-
if (DefSubclassProc(hwnd, LVM_GETCOLUMN, i, (LPARAM)&lvColumn))
355+
if (SendMessage(hwnd, LVM_GETCOLUMN, i, (LPARAM)&lvColumn))
356356
{
357357
availableWidth -= lvColumn.cx;
358358
}
@@ -366,10 +366,10 @@ LRESULT CALLBACK PhpExtendedListViewWndProc(
366366
}
367367

368368
if (availableWidth >= 40)
369-
return DefSubclassProc(hwnd, LVM_SETCOLUMNWIDTH, column, availableWidth);
369+
return SendMessage(hwnd, LVM_SETCOLUMNWIDTH, column, availableWidth);
370370
}
371371

372-
return DefSubclassProc(hwnd, LVM_SETCOLUMNWIDTH, column, width);
372+
return SendMessage(hwnd, LVM_SETCOLUMNWIDTH, column, width);
373373
}
374374
break;
375375
case ELVM_SETCOMPAREFUNCTION:
@@ -549,13 +549,9 @@ static INT PhpExtendedListViewCompareFunc(
549549
yItem.iItem = y;
550550
yItem.iSubItem = 0;
551551

552-
// Don't use SendMessage/ListView_* because it will call our new window procedure, which will
553-
// use GetProp. This calls NtUserGetProp, and obviously having a system call in a comparison
554-
// function is very, very bad for performance.
555-
556-
if (!DefWindowProc(context->Handle, LVM_GETITEM, 0, (LPARAM)&xItem))
552+
if (!SendMessage(context->Handle, LVM_GETITEM, 0, (LPARAM)&xItem))
557553
return 0;
558-
if (!DefWindowProc(context->Handle, LVM_GETITEM, 0, (LPARAM)&yItem))
554+
if (!SendMessage(context->Handle, LVM_GETITEM, 0, (LPARAM)&yItem))
559555
return 0;
560556

561557
// First, do tri-state sorting.
@@ -717,7 +713,7 @@ static INT PhpDefaultCompareListViewItems(
717713
item.cchTextMax = 260;
718714

719715
xText[0] = 0;
720-
DefWindowProc(Context->Handle, LVM_GETITEM, 0, (LPARAM)&item);
716+
SendMessage(Context->Handle, LVM_GETITEM, 0, (LPARAM)&item);
721717

722718
// Get the Y item text.
723719

@@ -726,7 +722,7 @@ static INT PhpDefaultCompareListViewItems(
726722
item.cchTextMax = 260;
727723

728724
yText[0] = 0;
729-
DefWindowProc(Context->Handle, LVM_GETITEM, 0, (LPARAM)&item);
725+
SendMessage(Context->Handle, LVM_GETITEM, 0, (LPARAM)&item);
730726

731727
// Compare them.
732728

0 commit comments

Comments
 (0)