Ownerdraw listview font patch...

Markus Gömmel m.goemmel at compulab.de
Wed May 30 07:47:15 CDT 2007


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 @@
  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);

--- 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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.diff
Type: application/octet-stream
Size: 591 bytes
Desc: not available
Url : http://www.winehq.org/pipermail/wine-devel/attachments/20070530/07a30146/patch.obj

More information about the wine-devel mailing list