From 8147ee109593f83a11306e975994d6c00ab7dfa5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Maxime=20Belleng=C3=A9?= <maxime.bellenge@laposte.net>
Date: Tue, 14 Oct 2003 20:12:05 +0000
Subject: [PATCH] Only redraw the necessary area of the tab component and not
 the whole component like windows does.

---
 dlls/comctl32/tab.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/dlls/comctl32/tab.c b/dlls/comctl32/tab.c
index d6d41842551..9ab5a628e14 100644
--- a/dlls/comctl32/tab.c
+++ b/dlls/comctl32/tab.c
@@ -2334,36 +2334,41 @@ static void TAB_InvalidateTabArea(
   RECT clientRect, r;
   DWORD lStyle = GetWindowLongA(hwnd, GWL_STYLE);
   INT lastRow = infoPtr->uNumRows - 1;
+  RECT rect;
 
   if (lastRow < 0) return;
 
   GetClientRect(hwnd, &clientRect);
 
+  TAB_InternalGetItemRect(hwnd, infoPtr, infoPtr->uNumItem-1 , &rect, NULL);
   if ((lStyle & TCS_BOTTOM) && !(lStyle & TCS_VERTICAL))
   {
     clientRect.top = clientRect.bottom -
                    infoPtr->tabHeight -
                    lastRow * (infoPtr->tabHeight - 2) -
                    ((lStyle & TCS_BUTTONS) ? lastRow * BUTTON_SPACINGY : 0) - 3;
+    clientRect.right = clientRect.left + rect.right + 2 * SELECTED_TAB_OFFSET;
   }
   else if((lStyle & TCS_BOTTOM) && (lStyle & TCS_VERTICAL))
   {
     clientRect.left = clientRect.right - infoPtr->tabHeight -
                       lastRow * (infoPtr->tabHeight - 2) -
                       ((lStyle & TCS_BUTTONS) ? lastRow * BUTTON_SPACINGY : 0) - 2;
+    clientRect.bottom = clientRect.top + rect.bottom + 2 * SELECTED_TAB_OFFSET;
   }
   else if(lStyle & TCS_VERTICAL)
   {
     clientRect.right = clientRect.left + infoPtr->tabHeight +
                        lastRow * (infoPtr->tabHeight - 2) -
                       ((lStyle & TCS_BUTTONS) ? lastRow * BUTTON_SPACINGY : 0) + 2;
-
+    clientRect.bottom = clientRect.top + rect.bottom + 2 * SELECTED_TAB_OFFSET;
   }
   else
   {
     clientRect.bottom = clientRect.top + infoPtr->tabHeight +
                       lastRow * (infoPtr->tabHeight - 2) +
                       ((lStyle & TCS_BUTTONS) ? lastRow * BUTTON_SPACINGY : 0) + 2;
+    clientRect.right = clientRect.left + rect.right + 2 * SELECTED_TAB_OFFSET;
   }
   
   /* Punch out the updown control */
-- 
GitLab