mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-15 23:29:13 +02:00
* fix for bug #2246, zero events surpressed by moving compression into handler
This commit is contained in:
parent
af1ab052af
commit
859d1e05bb
@ -28,6 +28,7 @@ uses
|
|||||||
|
|
||||||
var
|
var
|
||||||
ChangeMouseEvents : TCriticalSection;
|
ChangeMouseEvents : TCriticalSection;
|
||||||
|
LastHandlerMouseEvent : TMouseEvent;
|
||||||
|
|
||||||
procedure MouseEventHandler(var ir:INPUT_RECORD);
|
procedure MouseEventHandler(var ir:INPUT_RECORD);
|
||||||
|
|
||||||
@ -47,8 +48,26 @@ procedure MouseEventHandler(var ir:INPUT_RECORD);
|
|||||||
if (ir.Event.MouseEvent.dwButtonState and RIGHTMOST_BUTTON_PRESSED<>0) then
|
if (ir.Event.MouseEvent.dwButtonState and RIGHTMOST_BUTTON_PRESSED<>0) then
|
||||||
e.buttons:=e.buttons or MouseRightButton;
|
e.buttons:=e.buttons or MouseRightButton;
|
||||||
|
|
||||||
{ can we compress the events? }
|
|
||||||
if (PendingMouseEvents>0) and
|
if (Lasthandlermouseevent.x<>e.x) or (LasthandlerMouseEvent.y<>e.y) then
|
||||||
|
e.Action:=MouseActionMove;
|
||||||
|
if (LastHandlerMouseEvent.Buttons<>e.Buttons) then
|
||||||
|
begin
|
||||||
|
if (LasthandlerMouseEvent.Buttons=0) then
|
||||||
|
e.Action:=MouseActionDown
|
||||||
|
else
|
||||||
|
e.Action:=MouseActionUp;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
|
// The mouse event compression here was flawed and could lead
|
||||||
|
// to "zero" mouse actions if the new (x,y) was the same as the
|
||||||
|
// previous one. (bug 2312)
|
||||||
|
//
|
||||||
|
|
||||||
|
{ can we compress the events? }
|
||||||
|
if (PendingMouseEvents>0) and
|
||||||
(e.buttons=PendingMouseTail^.buttons) and
|
(e.buttons=PendingMouseTail^.buttons) and
|
||||||
(e.action=PendingMouseTail^.action) then
|
(e.action=PendingMouseTail^.action) then
|
||||||
begin
|
begin
|
||||||
@ -57,7 +76,12 @@ procedure MouseEventHandler(var ir:INPUT_RECORD);
|
|||||||
end
|
end
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
PutMouseEvent(e);
|
|
||||||
|
if e.action<>0 then
|
||||||
|
begin
|
||||||
|
LastHandlermouseEvent:=e;
|
||||||
|
PutMouseEvent(e);
|
||||||
|
end;
|
||||||
// this should be done in PutMouseEvent, now it is PM
|
// this should be done in PutMouseEvent, now it is PM
|
||||||
// inc(PendingMouseEvents);
|
// inc(PendingMouseEvents);
|
||||||
end;
|
end;
|
||||||
@ -139,6 +163,7 @@ begin
|
|||||||
else
|
else
|
||||||
MouseEvent.Action:=MouseActionUp;
|
MouseEvent.Action:=MouseActionUp;
|
||||||
end;
|
end;
|
||||||
|
if MouseEvent.action=0 then MousEevent.action:=MouseActionMove; // can sometimes happen due to compression of events.
|
||||||
LastMouseEvent:=MouseEvent;
|
LastMouseEvent:=MouseEvent;
|
||||||
LeaveCriticalSection(ChangeMouseEvents);
|
LeaveCriticalSection(ChangeMouseEvents);
|
||||||
end;
|
end;
|
||||||
@ -218,7 +243,10 @@ Begin
|
|||||||
end.
|
end.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.7 2004-11-04 10:21:07 peter
|
Revision 1.8 2004-11-21 15:24:35 marco
|
||||||
|
* fix for bug 2246, zero events surpressed by moving compression into handler
|
||||||
|
|
||||||
|
Revision 1.7 2004/11/04 10:21:07 peter
|
||||||
GetMouse[X,Y,Buttons] based on LastMouseEvent
|
GetMouse[X,Y,Buttons] based on LastMouseEvent
|
||||||
|
|
||||||
Revision 1.6 2002/09/07 16:01:29 peter
|
Revision 1.6 2002/09/07 16:01:29 peter
|
||||||
|
Loading…
Reference in New Issue
Block a user