From 91eac4986d73dcecb9580b22b8afdf3035dcbbe5 Mon Sep 17 00:00:00 2001 From: nickysn Date: Tue, 4 Nov 2014 01:47:27 +0000 Subject: [PATCH] + mouse unit for go32v2: implement a 'hide count' for the custom drawn mouse cursor, so it behaves consistently with the cursor drawn by the int 33h mouse driver git-svn-id: trunk@28981 - --- packages/rtl-console/src/go32v2/mouse.pp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/packages/rtl-console/src/go32v2/mouse.pp b/packages/rtl-console/src/go32v2/mouse.pp index e1c7383ed5..6d4b903ca9 100644 --- a/packages/rtl-console/src/go32v2/mouse.pp +++ b/packages/rtl-console/src/go32v2/mouse.pp @@ -58,6 +58,16 @@ const CallCounter : longint = 0; {$endif DEBUG} drawmousecursor : boolean = false; + + { CustomMouse_HideCount holds the hide count for the custom drawn mouse + cursor. Normally, when the mouse cursor is drawn by the int 33h mouse + driver (and not by this unit), the driver internally maintains a 'hide + counter', so that if you call HideMouse multiple times, you need to call + ShowMouse the same number of times. When the mouse cursor is customly + drawn by this unit, we use this variable in order to maintain the same + behaviour. } + CustomMouse_HideCount: longint = 1; + { position where the mouse was drawn the last time } oldmousex : longint = -1; oldmousey : longint = -1; @@ -568,7 +578,9 @@ begin if drawmousecursor then begin lockmouse; - if not(mouseisvisible) then + if CustomMouse_HideCount>0 then + Dec(CustomMouse_HideCount); + if (CustomMouse_HideCount=0) and not(mouseisvisible) then begin oldmousex:=getmousex-1; oldmousey:=getmousey-1; @@ -598,6 +610,7 @@ begin if drawmousecursor then begin lockmouse; + Inc(CustomMouse_HideCount); if mouseisvisible then begin mouseisvisible:=false; @@ -725,6 +738,7 @@ procedure DoCustomMouse(b : boolean); begin lockmouse; + CustomMouse_HideCount:=1; oldmousex:=-1; oldmousey:=-1; SetMouseXRange(0,(screenwidth-1)*8);