comctl32/listview: update item height when changing font

Daniel Jelinski djelinski1 at gmail.com
Sat Jan 5 14:35:30 CST 2013


-------------- next part --------------
From 3f5faaeeaf692eeb2ea074620521644f331e2f60 Mon Sep 17 00:00:00 2001
From: Daniel Jelinski <djelinski1 at gmail.com>
Date: Sat, 5 Jan 2013 21:18:12 +0100
Subject: comctl32/listview: update item height when changing font

Current version keeps old item height, which causes items to overlap
when height is increased. Noticed when editing a listview in delphi,
same issue is prezent in lazarus and probably VS.

Surprisingly, item width is not updated, at least with comctl from winetricks.

After this patch there is still one minor issue - when changing font size
causes the scrollbar to disappear, the area under the scrollbar
is not invalidated.
---
 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 977bb18..5743755 100644
--- a/dlls/comctl32/listview.c
+++ b/dlls/comctl32/listview.c
@@ -10755,6 +10755,7 @@ static LRESULT LISTVIEW_SetFocus(LISTVIEW_INFO *infoPtr, HWND hwndLoseFocus)
 static LRESULT LISTVIEW_SetFont(LISTVIEW_INFO *infoPtr, HFONT hFont, WORD fRedraw)
 {
     HFONT oldFont = infoPtr->hFont;
+    INT oldHeight = infoPtr->nItemHeight;
 
     TRACE("(hfont=%p,redraw=%hu)\n", hFont, fRedraw);
 
@@ -10763,12 +10764,16 @@ static LRESULT LISTVIEW_SetFont(LISTVIEW_INFO *infoPtr, HFONT hFont, WORD fRedra
     
     LISTVIEW_SaveTextMetrics(infoPtr);
 
+    infoPtr->nItemHeight = LISTVIEW_CalculateItemHeight(infoPtr);
+
     if (infoPtr->uView == LV_VIEW_DETAILS)
     {
 	SendMessageW(infoPtr->hwndHeader, WM_SETFONT, (WPARAM)hFont, MAKELPARAM(fRedraw, 0));
         LISTVIEW_UpdateSize(infoPtr);
         LISTVIEW_UpdateScroll(infoPtr);
     }
+    else if (infoPtr->nItemHeight != oldHeight)
+        LISTVIEW_UpdateScroll(infoPtr);
 
     if (fRedraw) LISTVIEW_InvalidateList(infoPtr);
 
-- 
1.7.5.4


More information about the wine-patches mailing list