comctl32/listview.c: Ownerdraw font problem during focus change fixed

m.goemmel at compulab.de m.goemmel at compulab.de
Wed Jun 6 07:51:07 CDT 2007


Some of our windows applications are 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.

Hope the patch is correct. If not, please give me a short note...

Markus
-------------- next part --------------
>From bbe414fc5b63b16fdebb4161e4ff795fe88375ae Mon Sep 17 00:00:00 2001
From: Markus Goemmel <m.goemmel at compulab.de>
Date: Wed, 6 Jun 2007 12:51:50 +0200
Subject: [PATCH] comctl32/listview.c: Ownerdraw font problem during focus change fixed

---
 dlls/comctl32/listview.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/dlls/comctl32/listview.c b/dlls/comctl32/listview.c
index ba94aec..7602217 100644
--- a/dlls/comctl32/listview.c
+++ b/dlls/comctl32/listview.c
@@ -1771,6 +1771,9 @@ static void LISTVIEW_ShowFocusRect(const
 	DRAWITEMSTRUCT dis;
 	LVITEMW item;
 
+	HFONT hFont = infoPtr->hFont ? infoPtr->hFont : infoPtr->hDefaultFont;
+	HFONT hOldFont = SelectObject(hdc, hFont);
+
         item.iItem = infoPtr->nFocusedItem;
 	item.iSubItem = 0;
         item.mask = LVIF_PARAM;
@@ -1788,6 +1791,8 @@ static void LISTVIEW_ShowFocusRect(const
 	dis.itemData = item.lParam;
 
 	SendMessageW(infoPtr->hwndNotify, WM_DRAWITEM, dis.CtlID, (LPARAM)&dis);
+
+	SelectObject(hdc, hOldFont);
     }
     else
     {
-- 
1.4.3.4



More information about the wine-patches mailing list