mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-14 14:59:32 +02:00
* mousebutton 4 and 5 support (gpm only?) Mantis #13469
git-svn-id: trunk@24164 -
This commit is contained in:
parent
914b5a41d9
commit
07e23b8401
@ -33,6 +33,8 @@ const
|
||||
MouseLeftButton = $01; { Left mouse button }
|
||||
MouseRightButton = $02; { Right mouse button }
|
||||
MouseMiddleButton = $04; { Middle mouse button }
|
||||
MouseButton4 = $08;
|
||||
MouseButton5 = $10;
|
||||
|
||||
MouseEventBufSize = 16; { Size of event queue }
|
||||
|
||||
|
@ -491,6 +491,13 @@ const
|
||||
Action : 0;
|
||||
);
|
||||
|
||||
procedure GenFakeReleaseEvent(MouseEvent : TMouseEvent);
|
||||
begin
|
||||
MouseEvent.action := MouseActionUp;
|
||||
MouseEvent.buttons := 0;
|
||||
PutMouseEvent(MouseEvent);
|
||||
end;
|
||||
|
||||
procedure GenMouseEvent;
|
||||
var MouseEvent: TMouseEvent;
|
||||
ch : char;
|
||||
@ -510,7 +517,7 @@ const
|
||||
bit 5 : mouse movement while button down.
|
||||
bit 6 : interpret button 1 as button 4
|
||||
interpret button 2 as button 5}
|
||||
case buttonval and 3 of
|
||||
case buttonval and 67 of
|
||||
0 : {left button press}
|
||||
MouseEvent.buttons:=1;
|
||||
1 : {middle button pressed }
|
||||
@ -519,6 +526,10 @@ const
|
||||
MouseEvent.buttons:=4;
|
||||
3 : { no button pressed }
|
||||
MouseEvent.buttons:=0;
|
||||
64: { button 4 pressed }
|
||||
MouseEvent.buttons:=8;
|
||||
65: { button 5 pressed }
|
||||
MouseEvent.buttons:=16;
|
||||
end;
|
||||
if inhead=intail then
|
||||
fpSelect(StdInputHandle+1,@fdsin,nil,nil,10);
|
||||
@ -552,6 +563,8 @@ const
|
||||
end;
|
||||
*)
|
||||
PutMouseEvent(MouseEvent);
|
||||
if (MouseEvent.buttons and (8+16)) <> 0 then // 'M' escape sequence cannot map button 4&5 release, so fake one.
|
||||
GenFakeReleaseEvent(MouseEvent);
|
||||
{$ifdef DebugMouse}
|
||||
if MouseEvent.Action=MouseActionDown then
|
||||
Write(system.stderr,'Button down : ')
|
||||
|
Loading…
Reference in New Issue
Block a user