mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-18 21:09:07 +02:00
* mouse events in the fifo doesn't get overriden under heavy load anymore
* fixed getmousevent, see comment in source git-svn-id: trunk@60 -
This commit is contained in:
parent
b9fc96073b
commit
7257f05776
@ -74,10 +74,18 @@ procedure MouseEventHandler(var ir:INPUT_RECORD);
|
||||
end
|
||||
else
|
||||
begin
|
||||
|
||||
if e.action<>0 then
|
||||
begin
|
||||
LastHandlermouseEvent:=e;
|
||||
|
||||
{ what till there is again space in the mouse event queue }
|
||||
while PendingMouseEvents>=MouseEventBufSize do
|
||||
begin
|
||||
LeaveCriticalSection(ChangeMouseEvents);
|
||||
sleep(0);
|
||||
EnterCriticalSection(ChangeMouseEvents);
|
||||
end;
|
||||
|
||||
PutMouseEvent(e);
|
||||
end;
|
||||
// this should be done in PutMouseEvent, now it is PM
|
||||
@ -150,9 +158,14 @@ begin
|
||||
EnterCriticalSection(ChangeMouseEvents);
|
||||
MouseEvent:=PendingMouseHead^;
|
||||
inc(PendingMouseHead);
|
||||
if longint(PendingMouseHead)=longint(@PendingMouseEvent)+sizeof(PendingMouseEvent) then
|
||||
if ptrint(PendingMouseHead)=ptrint(@PendingMouseEvent)+sizeof(PendingMouseEvent) then
|
||||
PendingMouseHead:=@PendingMouseEvent;
|
||||
dec(PendingMouseEvents);
|
||||
|
||||
{ LastMouseEvent is already set at the end of the mouse event handler,
|
||||
so this code might compare LastMouseEvent with itself leading to
|
||||
"empty" events (FK)
|
||||
|
||||
if (LastMouseEvent.x<>MouseEvent.x) or (LastMouseEvent.y<>MouseEvent.y) then
|
||||
MouseEvent.Action:=MouseActionMove;
|
||||
if (LastMouseEvent.Buttons<>MouseEvent.Buttons) then
|
||||
@ -162,8 +175,11 @@ begin
|
||||
else
|
||||
MouseEvent.Action:=MouseActionDown;
|
||||
end;
|
||||
if MouseEvent.action=0 then MousEevent.action:=MouseActionMove; // can sometimes happen due to compression of events.
|
||||
if MouseEvent.action=0 then
|
||||
MousEevent.action:=MouseActionMove; // can sometimes happen due to compression of events.
|
||||
LastMouseEvent:=MouseEvent;
|
||||
}
|
||||
|
||||
LeaveCriticalSection(ChangeMouseEvents);
|
||||
end;
|
||||
|
||||
@ -188,7 +204,7 @@ begin
|
||||
begin
|
||||
PendingMouseTail^:=MouseEvent;
|
||||
inc(PendingMouseTail);
|
||||
if longint(PendingMouseTail)=longint(@PendingMouseEvent)+sizeof(PendingMouseEvent) then
|
||||
if ptrint(PendingMouseTail)=ptrint(@PendingMouseEvent)+sizeof(PendingMouseEvent) then
|
||||
PendingMouseTail:=@PendingMouseEvent;
|
||||
{ why isn't this done here ?
|
||||
so the win32 version do this by hand:}
|
||||
|
Loading…
Reference in New Issue
Block a user