mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-18 16:49:20 +02:00
+ 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 -
This commit is contained in:
parent
dd285d7a16
commit
91eac4986d
@ -58,6 +58,16 @@ const
|
|||||||
CallCounter : longint = 0;
|
CallCounter : longint = 0;
|
||||||
{$endif DEBUG}
|
{$endif DEBUG}
|
||||||
drawmousecursor : boolean = false;
|
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 }
|
{ position where the mouse was drawn the last time }
|
||||||
oldmousex : longint = -1;
|
oldmousex : longint = -1;
|
||||||
oldmousey : longint = -1;
|
oldmousey : longint = -1;
|
||||||
@ -568,7 +578,9 @@ begin
|
|||||||
if drawmousecursor then
|
if drawmousecursor then
|
||||||
begin
|
begin
|
||||||
lockmouse;
|
lockmouse;
|
||||||
if not(mouseisvisible) then
|
if CustomMouse_HideCount>0 then
|
||||||
|
Dec(CustomMouse_HideCount);
|
||||||
|
if (CustomMouse_HideCount=0) and not(mouseisvisible) then
|
||||||
begin
|
begin
|
||||||
oldmousex:=getmousex-1;
|
oldmousex:=getmousex-1;
|
||||||
oldmousey:=getmousey-1;
|
oldmousey:=getmousey-1;
|
||||||
@ -598,6 +610,7 @@ begin
|
|||||||
if drawmousecursor then
|
if drawmousecursor then
|
||||||
begin
|
begin
|
||||||
lockmouse;
|
lockmouse;
|
||||||
|
Inc(CustomMouse_HideCount);
|
||||||
if mouseisvisible then
|
if mouseisvisible then
|
||||||
begin
|
begin
|
||||||
mouseisvisible:=false;
|
mouseisvisible:=false;
|
||||||
@ -725,6 +738,7 @@ procedure DoCustomMouse(b : boolean);
|
|||||||
|
|
||||||
begin
|
begin
|
||||||
lockmouse;
|
lockmouse;
|
||||||
|
CustomMouse_HideCount:=1;
|
||||||
oldmousex:=-1;
|
oldmousex:=-1;
|
||||||
oldmousey:=-1;
|
oldmousey:=-1;
|
||||||
SetMouseXRange(0,(screenwidth-1)*8);
|
SetMouseXRange(0,(screenwidth-1)*8);
|
||||||
|
Loading…
Reference in New Issue
Block a user