Ownerdraw listview font patch...
Hi, one of our windows application is using an OWNERDRAW_FIXED listview. With the current version of Wine I mentioned that when the listview is loosing its focus, the selected item will be repainted in a wrong front (System 12 instead of my MS Shell Dlg 11)... after the focus comes back, the item is redrawn again, now with correct font settings again. After searching for a while my idea is that the LISTVIEW_ShowFocusRect function is missing a SelectObject call to the font stored in the item-structure for this particular listview item. So the hdc transfered over WM_DRAWITEM to the application contains the wrong font. I created the attached patch, which looks like this: --- snipp --- diff -u -u -r1.485 listview.c --- dlls/comctl32/listview.c 25 May 2007 19:46:02 -0000 1.485 +++ dlls/comctl32/listview.c 30 May 2007 12:28:44 -0000 @@ -1770,6 +1770,9 @@ { DRAWITEMSTRUCT dis; LVITEMW item; + + HFONT hFont = infoPtr->hFont ? infoPtr->hFont : infoPtr->hDefaultFont; + HFONT hOldFont = SelectObject(hdc, hFont); item.iItem = infoPtr->nFocusedItem; item.iSubItem = 0; @@ -1788,6 +1791,8 @@ dis.itemData = item.lParam; SendMessageW(infoPtr->hwndNotify, WM_DRAWITEM, dis.CtlID, (LPARAM)&dis); + + SelectObject(hdc, hOldFont); } else { --- snipp --- Before sending this to wine.patches, I wanted to ask if anyone here can tell me if the above is ok or total bullshit. Thanks and regards Markus
On Wed, May 30, 2007 08:47, Markus Gömmel wrote:
Before sending this to wine.patches, I wanted to ask if anyone here can tell me if the above is ok or total bullshit.
Looks good to me. I wonder if we shouldn't set other things as well, but this would require testing to figure out. -- Dimi Paun <dimi(a)lattica.com> Lattica, Inc.
participants (2)
-
Dimi Paun -
Markus Gömmel