[NTUSER] Fix caret display mistake (#2180)
authorKatayama Hirofumi MZ <katayama.hirofumi.mz@gmail.com>
Thu, 26 Dec 2019 10:08:01 +0000 (19:08 +0900)
committerGitHub <noreply@github.com>
Thu, 26 Dec 2019 10:08:01 +0000 (19:08 +0900)
Take care of caret visibility. co_IntSetCaretPos function wrongly drawn the caret upon invisible caret. @Doug-Lyons did test this patch. CORE-15661

win32ss/user/ntuser/caret.c

index 9ab590c..24fadf6 100644 (file)
@@ -217,10 +217,13 @@ co_IntSetCaretPos(int X, int Y)
       if(ThreadQueue->CaretInfo.Pos.x != X || ThreadQueue->CaretInfo.Pos.y != Y)
       {
          co_IntHideCaret(&ThreadQueue->CaretInfo);
-         ThreadQueue->CaretInfo.Showing = 1;
          ThreadQueue->CaretInfo.Pos.x = X;
          ThreadQueue->CaretInfo.Pos.y = Y;
-         co_IntDrawCaret(pWnd, &ThreadQueue->CaretInfo);
+         if (ThreadQueue->CaretInfo.Visible)
+         {
+            ThreadQueue->CaretInfo.Showing = 1;
+            co_IntDrawCaret(pWnd, &ThreadQueue->CaretInfo);
+         }
 
          IntSetTimer(pWnd, IDCARETTIMER, gpsi->dtCaretBlink, CaretSystemTimerProc, TMRF_SYSTEM);
          IntNotifyWinEvent(EVENT_OBJECT_LOCATIONCHANGE, pWnd, OBJID_CARET, CHILDID_SELF, 0);