Re: listbox: ownerdraw fix
On November 17, 2003 07:33 am, Huw D M Davies wrote:
- LISTBOX_RepaintItem( hwnd, descr, i, ODA_SELECT ); + if (!IS_OWNERDRAW(descr)) + LISTBOX_RepaintItem( hwnd, descr, i, ODA_SELECT ); + else + LISTBOX_InvalidateItemRect(hwnd, descr, i); +
Why not simply invalidate rect always, even when not in owner draw? -- Dimi.
On Mon, Nov 17, 2003 at 09:59:20AM -0500, Dimitrie O. Paun wrote:
Why not simply invalidate rect always, even when not in owner draw?
Works for me. Aric Stewart <aric(a)codeweavers.com> invalidate items on setselection. -- Huw Davies huw(a)codeweavers.com Index: controls/listbox.c =================================================================== RCS file: /home/wine/wine/controls/listbox.c,v retrieving revision 1.97 diff -u -r1.97 listbox.c --- controls/listbox.c 14 Oct 2003 05:24:21 -0000 1.97 +++ controls/listbox.c 17 Nov 2003 15:13:31 -0000 @@ -1143,6 +1143,13 @@ } } +static void LISTBOX_InvalidateItemRect( HWND hwnd, LB_DESCR *descr, INT index ) +{ + RECT rect; + + if (LISTBOX_GetItemRect( descr, index, &rect ) == 1) + InvalidateRect( hwnd, &rect, TRUE ); +} /*********************************************************************** * LISTBOX_GetItemHeight @@ -1361,7 +1368,7 @@ { if (descr->items[i].selected) continue; descr->items[i].selected = TRUE; - LISTBOX_RepaintItem( hwnd, descr, i, ODA_SELECT ); + LISTBOX_InvalidateItemRect(hwnd, descr, i); } LISTBOX_SetCaretIndex( hwnd, descr, last, TRUE ); } @@ -1371,7 +1378,7 @@ { if (!descr->items[i].selected) continue; descr->items[i].selected = FALSE; - LISTBOX_RepaintItem( hwnd, descr, i, ODA_SELECT ); + LISTBOX_InvalidateItemRect(hwnd, descr, i); } } return LB_OKAY;
On November 17, 2003 10:16 am, Huw D M Davies wrote:
+ if (LISTBOX_GetItemRect( descr, index, &rect ) == 1)
OK, I very sorry to nick pick so much, but this test is not only strange in C, but it's a bit dangerous as well, since in the future LISTBOX_GetItemRect may return something >1 for TRUE, and things will break silently. Why not the more common: if (LISTBOX_GetItemRect( descr, index, &rect )) -- Dimi.
On Mon, Nov 17, 2003 at 10:33:33AM -0500, Dimitrie O. Paun wrote:
On November 17, 2003 10:16 am, Huw D M Davies wrote:
+ if (LISTBOX_GetItemRect( descr, index, &rect ) == 1)
OK, I very sorry to nick pick so much, but this test is not only strange in C, but it's a bit dangerous as well, since in the future LISTBOX_GetItemRect may return something >1 for TRUE, and things will break silently. Why not the more common: if (LISTBOX_GetItemRect( descr, index, &rect ))
I guess that's because there are several other calls to LISTBOX_GetItemRect that have the same syntax. Note that LISTBOX_GetItemRect can return -1 on error. Huw. -- Huw Davies huw(a)codeweavers.com
On November 17, 2003 10:47 am, Huw D M Davies wrote:
I guess that's because there are several other calls to LISTBOX_GetItemRect that have the same syntax. Note that LISTBOX_GetItemRect can return -1 on error.
Of course, my bad, I've commented without actually checking out the code. Please disregard my comments. I've noticed a bit at line 437 that we may replace with a call to the new function. The only difference is that we'd erase the background in the new case which may create flicker. Oh well, it needs some experimentation I guess. -- Dimi.
participants (2)
-
Dimitrie O. Paun -
Huw D M Davies