From e3810e3accd2755e6532b07018592794edb54faa Mon Sep 17 00:00:00 2001
From: Francois Gouget <fgouget@free.fr>
Date: Wed, 1 Nov 2000 01:52:37 +0000
Subject: [PATCH] Check for SB_CTL before displaying a caret.

---
 controls/scroll.c | 28 +++++++++++++---------------
 1 file changed, 13 insertions(+), 15 deletions(-)

diff --git a/controls/scroll.c b/controls/scroll.c
index 477b2a1f358..2b8f3f42269 100644
--- a/controls/scroll.c
+++ b/controls/scroll.c
@@ -816,7 +816,8 @@ void SCROLL_DrawScrollBar( HWND hwnd, HDC hdc, INT nBar,
         (SCROLL_TrackingBar == nBar))
         SCROLL_DrawMovingThumb( hdc, &rect, vertical, arrowSize, thumbSize );
 
-    if(hwnd==GetFocus())  /* if scroll bar has focus, reposition the caret*/
+    /* if scroll bar has focus, reposition the caret*/
+    if(hwnd==GetFocus() && (nBar==SB_CTL))
     {
         if (!vertical)
         {
@@ -1174,22 +1175,19 @@ LRESULT WINAPI ScrollBarWndProc( HWND hwnd, UINT message, WPARAM wParam,
             /* Create a caret when a ScrollBar get focus*/
             RECT rect;
             int arrowSize, thumbSize, thumbPos, vertical;
-            if(hwnd==GetFocus())
+            vertical = SCROLL_GetScrollBarRect( hwnd, SB_CTL, &rect,
+                                                &arrowSize, &thumbSize, &thumbPos );
+            if (!vertical)
             {
-                vertical = SCROLL_GetScrollBarRect( hwnd, SB_CTL, &rect,
-                                                    &arrowSize, &thumbSize, &thumbPos );
-                if (!vertical)
-                {
-                    CreateCaret(hwnd,1, thumbSize-2, rect.bottom-rect.top-2);
-                    SetCaretPos(thumbPos+1, rect.top+1);
-                }
-                else
-                {
-                    CreateCaret(hwnd,1, rect.right-rect.left-2,thumbSize-2);
-                    SetCaretPos(rect.top+1, thumbPos+1);
-                }
-                ShowCaret(hwnd);
+                CreateCaret(hwnd,1, thumbSize-2, rect.bottom-rect.top-2);
+                SetCaretPos(thumbPos+1, rect.top+1);
             }
+            else
+            {
+                CreateCaret(hwnd,1, rect.right-rect.left-2,thumbSize-2);
+                SetCaretPos(rect.top+1, thumbPos+1);
+            }
+            ShowCaret(hwnd);
         }
         break;
 
-- 
GitLab