Author: rharabien
Date: Tue Apr 12 18:38:38 2011
New Revision: 51321
URL:
http://svn.reactos.org/svn/reactos?rev=51321&view=rev
Log:
[COMCTL32]
* Sync listview to Wine 1.3.17
* Set background and text color before calling DrawFocusRect. Those colors are used by
monochrome brush during painting. Tested this function in Windows and our implementation
is correct. Wine has DrawFocusRect not correctly implemented and that's why they
don't see this bug. Should be sent to wine (tm).
Modified:
trunk/reactos/dll/win32/comctl32/comctl32_ros.diff
trunk/reactos/dll/win32/comctl32/listview.c
Modified: trunk/reactos/dll/win32/comctl32/comctl32_ros.diff
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comctl32/comctl3…
==============================================================================
--- trunk/reactos/dll/win32/comctl32/comctl32_ros.diff [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/comctl32/comctl32_ros.diff [iso-8859-1] Tue Apr 12 18:38:38
2011
@@ -139,3 +139,41 @@
if (infoPtr->cdmode & CDRF_NOTIFYPOSTPAINT)
infoPtr->cdmode =
+Index: listview.c
+===================================================================
+--- listview.c (revision 51320)
++++ listview.c (working copy)
+@@ -1634,8 +1635,19 @@
+ /* used to handle collapse main item column case */
+ static inline BOOL LISTVIEW_DrawFocusRect(const LISTVIEW_INFO *infoPtr, HDC hdc)
+ {
+- return (infoPtr->rcFocus.left < infoPtr->rcFocus.right) ?
+- DrawFocusRect(hdc, &infoPtr->rcFocus) : FALSE;
++ BOOL Ret = FALSE;
++
++ if (infoPtr->rcFocus.left < infoPtr->rcFocus.right)
++ {
++ DWORD dwOldBkColor, dwOldTextColor;
++
++ dwOldBkColor = SetBkColor(hdc, RGB(255, 255, 255));
++ dwOldTextColor = SetBkColor(hdc, RGB(0, 0, 0));
++ Ret = DrawFocusRect(hdc, &infoPtr->rcFocus);
++ SetBkColor(hdc, dwOldBkColor);
++ SetBkColor(hdc, dwOldTextColor);
++ }
++ return Ret;
+ }
+
+ /* Listview invalidation functions: use _only_ these functions to invalidate */
+@@ -5041,7 +5053,11 @@
+
+ /* Draw marquee rectangle if appropriate */
+ if (infoPtr->bMarqueeSelect)
++ {
++ SetBkColor(hdc, RGB(255, 255, 255));
++ SetTextColor(hdc, RGB(0, 0, 0));
+ DrawFocusRect(hdc, &infoPtr->marqueeDrawRect);
++ }
+
+ if (cdmode & CDRF_NOTIFYPOSTPAINT)
+ notify_postpaint(infoPtr, &nmlvcd);
Modified: trunk/reactos/dll/win32/comctl32/listview.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comctl32/listvie…
==============================================================================
--- trunk/reactos/dll/win32/comctl32/listview.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/comctl32/listview.c [iso-8859-1] Tue Apr 12 18:38:38 2011
@@ -360,7 +360,7 @@
#define SB_INTERNAL -1
/* maximum size of a label */
-#define DISP_TEXT_SIZE 512
+#define DISP_TEXT_SIZE 260
/* padding for items in list and small icon display modes */
#define WIDTH_PADDING 12
@@ -543,7 +543,7 @@
static inline int textcmpWT(LPCWSTR aw, LPCWSTR bt, BOOL isW)
{
if (!aw) return bt ? -1 : 0;
- if (!bt) return aw ? 1 : 0;
+ if (!bt) return 1;
if (aw == LPSTR_TEXTCALLBACKW)
return bt == LPSTR_TEXTCALLBACKW ? 1 : -1;
if (bt != LPSTR_TEXTCALLBACKW)
@@ -865,6 +865,7 @@
item.mask = LVIF_PARAM|LVIF_STATE;
item.iItem = htInfo->iItem;
item.iSubItem = 0;
+ item.stateMask = (UINT)-1;
if (LISTVIEW_GetItemT(infoPtr, &item, TRUE)) {
nmia.lParam = item.lParam;
nmia.uOldState = item.state;
@@ -1634,8 +1635,19 @@
/* used to handle collapse main item column case */
static inline BOOL LISTVIEW_DrawFocusRect(const LISTVIEW_INFO *infoPtr, HDC hdc)
{
- return (infoPtr->rcFocus.left < infoPtr->rcFocus.right) ?
- DrawFocusRect(hdc, &infoPtr->rcFocus) : FALSE;
+ BOOL Ret = FALSE;
+
+ if (infoPtr->rcFocus.left < infoPtr->rcFocus.right)
+ {
+ DWORD dwOldBkColor, dwOldTextColor;
+
+ dwOldBkColor = SetBkColor(hdc, RGB(255, 255, 255));
+ dwOldTextColor = SetBkColor(hdc, RGB(0, 0, 0));
+ Ret = DrawFocusRect(hdc, &infoPtr->rcFocus);
+ SetBkColor(hdc, dwOldBkColor);
+ SetBkColor(hdc, dwOldTextColor);
+ }
+ return Ret;
}
/* Listview invalidation functions: use _only_ these functions to invalidate */
@@ -5041,7 +5053,11 @@
/* Draw marquee rectangle if appropriate */
if (infoPtr->bMarqueeSelect)
+ {
+ SetBkColor(hdc, RGB(255, 255, 255));
+ SetTextColor(hdc, RGB(0, 0, 0));
DrawFocusRect(hdc, &infoPtr->marqueeDrawRect);
+ }
if (cdmode & CDRF_NOTIFYPOSTPAINT)
notify_postpaint(infoPtr, &nmlvcd);
@@ -5878,6 +5894,7 @@
SetWindowLongPtrA(hedit, GWLP_WNDPROC, (DWORD_PTR)EditLblWndProcA) );
SendMessageW(hedit, WM_SETFONT, (WPARAM)infoPtr->hFont, FALSE);
+ SendMessageW(hedit, EM_SETLIMITTEXT, DISP_TEXT_SIZE-1, 0);
return hedit;
}
@@ -6743,7 +6760,7 @@
pszText = lpLVItem->pszText;
bResult = LISTVIEW_GetItemT(infoPtr, lpLVItem, isW);
- if (bResult && lpLVItem->pszText != pszText)
+ if (bResult && (lpLVItem->mask & LVIF_TEXT) &&
lpLVItem->pszText != pszText)
{
if (lpLVItem->pszText != LPSTR_TEXTCALLBACKW)
textcpynT(pszText, isW, lpLVItem->pszText, isW, lpLVItem->cchTextMax);