* eol style property in main branch fixed

git-svn-id: trunk@19 -
This commit is contained in:
fpc 2005-05-18 16:53:52 +00:00
parent aabbd3c7df
commit 48feb5014c
5 changed files with 1357 additions and 1361 deletions

6
.gitattributes vendored
View File

@ -234,8 +234,6 @@ install/macosx/resources/English.lproj/InstallationCheck.strings -text
install/macosx/resources/German.lproj/InstallationCheck.strings -text install/macosx/resources/German.lproj/InstallationCheck.strings -text
install/macosx/resources/InstallationCheck -text install/macosx/resources/InstallationCheck -text
install/macosx/resources/InstallationCheck.strings -text install/macosx/resources/InstallationCheck.strings -text
install/macosx/resources/License.txt -text
install/macosx/resources/ReadMe.txt -text
install/macosx/resources/postflight -text install/macosx/resources/postflight -text
install/makepack -text install/makepack -text
install/makesource -text install/makesource -text
@ -443,7 +441,6 @@ packages/extra/unixutil/Makefile -text
packages/extra/unzip/Makefile -text packages/extra/unzip/Makefile -text
packages/extra/utmp/Makefile -text packages/extra/utmp/Makefile -text
packages/extra/winunits/Makefile -text packages/extra/winunits/Makefile -text
packages/extra/winunits/jedi.inc -text
packages/extra/x11/Makefile -text packages/extra/x11/Makefile -text
packages/extra/zlib/Makefile -text packages/extra/zlib/Makefile -text
rtl/COPYING -text rtl/COPYING -text
@ -592,7 +589,6 @@ rtl/watcom/Makefile -text
rtl/watcom/prt0.asm -text rtl/watcom/prt0.asm -text
rtl/win32/Makefile -text rtl/win32/Makefile -text
rtl/win32/gprt0.as -text rtl/win32/gprt0.as -text
rtl/win32/mouse.pp -text
rtl/win32/wcygprt0.as -text rtl/win32/wcygprt0.as -text
rtl/win32/wdllprt0.as -text rtl/win32/wdllprt0.as -text
rtl/win32/wininc/Makefile -text rtl/win32/wininc/Makefile -text
@ -644,7 +640,7 @@ tests/utils/Makefile -text
tests/utils/macos/LinkRunDir -text tests/utils/macos/LinkRunDir -text
tests/utils/macos/LinkRunTests -text tests/utils/macos/LinkRunTests -text
tests/utils/tests.sql -text tests/utils/tests.sql -text
tests/webtbs/tw1472.pp -text tests/webtbs/tw1472.pp svneol=native#unset
utils/Makefile -text utils/Makefile -text
utils/README -text utils/README -text
utils/data2inc.exm -text utils/data2inc.exm -text

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@ -1,255 +1,255 @@
{ {
$Id: mouse.pp,v 1.11 2005/03/31 14:43:03 marco Exp $ $Id: mouse.pp,v 1.11 2005/03/31 14:43:03 marco Exp $
This file is part of the Free Pascal run time library. This file is part of the Free Pascal run time library.
Copyright (c) 1999-2000 by Florian Klaempfl Copyright (c) 1999-2000 by Florian Klaempfl
member of the Free Pascal development team member of the Free Pascal development team
Mouse unit for linux Mouse unit for linux
See the file COPYING.FPC, included in this distribution, See the file COPYING.FPC, included in this distribution,
for details about the copyright. for details about the copyright.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
**********************************************************************} **********************************************************************}
unit Mouse; unit Mouse;
interface interface
{$i mouseh.inc} {$i mouseh.inc}
implementation implementation
uses uses
windows,dos,Winevent; windows,dos,Winevent;
{$i mouse.inc} {$i mouse.inc}
var var
ChangeMouseEvents : TCriticalSection; ChangeMouseEvents : TCriticalSection;
LastHandlerMouseEvent : TMouseEvent; LastHandlerMouseEvent : TMouseEvent;
procedure MouseEventHandler(var ir:INPUT_RECORD); procedure MouseEventHandler(var ir:INPUT_RECORD);
var var
e : TMouseEvent; e : TMouseEvent;
begin begin
EnterCriticalSection(ChangeMouseEvents); EnterCriticalSection(ChangeMouseEvents);
e.x:=ir.Event.MouseEvent.dwMousePosition.x; e.x:=ir.Event.MouseEvent.dwMousePosition.x;
e.y:=ir.Event.MouseEvent.dwMousePosition.y; e.y:=ir.Event.MouseEvent.dwMousePosition.y;
e.buttons:=0; e.buttons:=0;
e.action:=0; e.action:=0;
if (ir.Event.MouseEvent.dwButtonState and FROM_LEFT_1ST_BUTTON_PRESSED<>0) then if (ir.Event.MouseEvent.dwButtonState and FROM_LEFT_1ST_BUTTON_PRESSED<>0) then
e.buttons:=e.buttons or MouseLeftButton; e.buttons:=e.buttons or MouseLeftButton;
if (ir.Event.MouseEvent.dwButtonState and FROM_LEFT_2ND_BUTTON_PRESSED<>0) then if (ir.Event.MouseEvent.dwButtonState and FROM_LEFT_2ND_BUTTON_PRESSED<>0) then
e.buttons:=e.buttons or MouseMiddleButton; e.buttons:=e.buttons or MouseMiddleButton;
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;
if (Lasthandlermouseevent.x<>e.x) or (LasthandlerMouseEvent.y<>e.y) then if (Lasthandlermouseevent.x<>e.x) or (LasthandlerMouseEvent.y<>e.y) then
e.Action:=MouseActionMove; e.Action:=MouseActionMove;
if (LastHandlerMouseEvent.Buttons<>e.Buttons) then if (LastHandlerMouseEvent.Buttons<>e.Buttons) then
begin begin
if (LasthandlerMouseEvent.Buttons and e.buttons<>LasthandlerMouseEvent.Buttons) then if (LasthandlerMouseEvent.Buttons and e.buttons<>LasthandlerMouseEvent.Buttons) then
e.Action:=MouseActionUp e.Action:=MouseActionUp
else else
e.Action:=MouseActionDown; e.Action:=MouseActionDown;
end; end;
// //
// The mouse event compression here was flawed and could lead // The mouse event compression here was flawed and could lead
// to "zero" mouse actions if the new (x,y) was the same as the // to "zero" mouse actions if the new (x,y) was the same as the
// previous one. (bug 2312) // previous one. (bug 2312)
// //
{ can we compress the events? } { can we compress the events? }
if (PendingMouseEvents>0) and 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
PendingMouseTail^.x:=e.x; PendingMouseTail^.x:=e.x;
PendingMouseTail^.y:=e.y; PendingMouseTail^.y:=e.y;
end end
else else
begin begin
if e.action<>0 then if e.action<>0 then
begin begin
LastHandlermouseEvent:=e; LastHandlermouseEvent:=e;
PutMouseEvent(e); PutMouseEvent(e);
end; 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;
LastMouseEvent:=e; LastMouseEvent:=e;
LeaveCriticalSection(ChangeMouseEvents); LeaveCriticalSection(ChangeMouseEvents);
end; end;
procedure SysInitMouse; procedure SysInitMouse;
var var
mode : dword; mode : dword;
begin begin
// enable mouse events // enable mouse events
GetConsoleMode(StdInputHandle,@mode); GetConsoleMode(StdInputHandle,@mode);
mode:=mode or ENABLE_MOUSE_INPUT; mode:=mode or ENABLE_MOUSE_INPUT;
SetConsoleMode(StdInputHandle,mode); SetConsoleMode(StdInputHandle,mode);
PendingMouseHead:=@PendingMouseEvent; PendingMouseHead:=@PendingMouseEvent;
PendingMouseTail:=@PendingMouseEvent; PendingMouseTail:=@PendingMouseEvent;
PendingMouseEvents:=0; PendingMouseEvents:=0;
FillChar(LastMouseEvent,sizeof(TMouseEvent),0); FillChar(LastMouseEvent,sizeof(TMouseEvent),0);
InitializeCriticalSection(ChangeMouseEvents); InitializeCriticalSection(ChangeMouseEvents);
SetMouseEventHandler(@MouseEventHandler); SetMouseEventHandler(@MouseEventHandler);
ShowMouse; ShowMouse;
end; end;
procedure SysDoneMouse; procedure SysDoneMouse;
var var
mode : dword; mode : dword;
begin begin
HideMouse; HideMouse;
// disable mouse events // disable mouse events
GetConsoleMode(StdInputHandle,@mode); GetConsoleMode(StdInputHandle,@mode);
mode:=mode and (not ENABLE_MOUSE_INPUT); mode:=mode and (not ENABLE_MOUSE_INPUT);
SetConsoleMode(StdInputHandle,mode); SetConsoleMode(StdInputHandle,mode);
SetMouseEventHandler(nil); SetMouseEventHandler(nil);
DeleteCriticalSection(ChangeMouseEvents); DeleteCriticalSection(ChangeMouseEvents);
end; end;
function SysDetectMouse:byte; function SysDetectMouse:byte;
var var
num : dword; num : dword;
begin begin
GetNumberOfConsoleMouseButtons(@num); GetNumberOfConsoleMouseButtons(@num);
SysDetectMouse:=num; SysDetectMouse:=num;
end; end;
procedure SysGetMouseEvent(var MouseEvent: TMouseEvent); procedure SysGetMouseEvent(var MouseEvent: TMouseEvent);
var var
b : byte; b : byte;
begin begin
repeat repeat
EnterCriticalSection(ChangeMouseEvents); EnterCriticalSection(ChangeMouseEvents);
b:=PendingMouseEvents; b:=PendingMouseEvents;
LeaveCriticalSection(ChangeMouseEvents); LeaveCriticalSection(ChangeMouseEvents);
if b>0 then if b>0 then
break break
else else
sleep(50); sleep(50);
until false; until false;
EnterCriticalSection(ChangeMouseEvents); EnterCriticalSection(ChangeMouseEvents);
MouseEvent:=PendingMouseHead^; MouseEvent:=PendingMouseHead^;
inc(PendingMouseHead); inc(PendingMouseHead);
if longint(PendingMouseHead)=longint(@PendingMouseEvent)+sizeof(PendingMouseEvent) then if longint(PendingMouseHead)=longint(@PendingMouseEvent)+sizeof(PendingMouseEvent) then
PendingMouseHead:=@PendingMouseEvent; PendingMouseHead:=@PendingMouseEvent;
dec(PendingMouseEvents); dec(PendingMouseEvents);
if (LastMouseEvent.x<>MouseEvent.x) or (LastMouseEvent.y<>MouseEvent.y) then if (LastMouseEvent.x<>MouseEvent.x) or (LastMouseEvent.y<>MouseEvent.y) then
MouseEvent.Action:=MouseActionMove; MouseEvent.Action:=MouseActionMove;
if (LastMouseEvent.Buttons<>MouseEvent.Buttons) then if (LastMouseEvent.Buttons<>MouseEvent.Buttons) then
begin begin
if (LastMouseEvent.Buttons and MouseEvent.buttons<>LastMouseEvent.Buttons) then if (LastMouseEvent.Buttons and MouseEvent.buttons<>LastMouseEvent.Buttons) then
MouseEvent.Action:=MouseActionUp MouseEvent.Action:=MouseActionUp
else else
MouseEvent.Action:=MouseActionDown; MouseEvent.Action:=MouseActionDown;
end; 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; LastMouseEvent:=MouseEvent;
LeaveCriticalSection(ChangeMouseEvents); LeaveCriticalSection(ChangeMouseEvents);
end; end;
function SysPollMouseEvent(var MouseEvent: TMouseEvent):boolean; function SysPollMouseEvent(var MouseEvent: TMouseEvent):boolean;
begin begin
EnterCriticalSection(ChangeMouseEvents); EnterCriticalSection(ChangeMouseEvents);
if PendingMouseEvents>0 then if PendingMouseEvents>0 then
begin begin
MouseEvent:=PendingMouseHead^; MouseEvent:=PendingMouseHead^;
SysPollMouseEvent:=true; SysPollMouseEvent:=true;
end end
else else
SysPollMouseEvent:=false; SysPollMouseEvent:=false;
LeaveCriticalSection(ChangeMouseEvents); LeaveCriticalSection(ChangeMouseEvents);
end; end;
procedure SysPutMouseEvent(const MouseEvent: TMouseEvent); procedure SysPutMouseEvent(const MouseEvent: TMouseEvent);
begin begin
if PendingMouseEvents<MouseEventBufSize then if PendingMouseEvents<MouseEventBufSize then
begin begin
PendingMouseTail^:=MouseEvent; PendingMouseTail^:=MouseEvent;
inc(PendingMouseTail); inc(PendingMouseTail);
if longint(PendingMouseTail)=longint(@PendingMouseEvent)+sizeof(PendingMouseEvent) then if longint(PendingMouseTail)=longint(@PendingMouseEvent)+sizeof(PendingMouseEvent) then
PendingMouseTail:=@PendingMouseEvent; PendingMouseTail:=@PendingMouseEvent;
{ why isn't this done here ? { why isn't this done here ?
so the win32 version do this by hand:} so the win32 version do this by hand:}
inc(PendingMouseEvents); inc(PendingMouseEvents);
end; end;
end; end;
function SysGetMouseX:word; function SysGetMouseX:word;
begin begin
EnterCriticalSection(ChangeMouseEvents); EnterCriticalSection(ChangeMouseEvents);
SysGetMouseX:=LastMouseEvent.x; SysGetMouseX:=LastMouseEvent.x;
LeaveCriticalSection(ChangeMouseEvents); LeaveCriticalSection(ChangeMouseEvents);
end; end;
function SysGetMouseY:word; function SysGetMouseY:word;
begin begin
EnterCriticalSection(ChangeMouseEvents); EnterCriticalSection(ChangeMouseEvents);
SysGetMouseY:=LastMouseEvent.y; SysGetMouseY:=LastMouseEvent.y;
LeaveCriticalSection(ChangeMouseEvents); LeaveCriticalSection(ChangeMouseEvents);
end; end;
function SysGetMouseButtons:word; function SysGetMouseButtons:word;
begin begin
EnterCriticalSection(ChangeMouseEvents); EnterCriticalSection(ChangeMouseEvents);
SysGetMouseButtons:=LastMouseEvent.Buttons; SysGetMouseButtons:=LastMouseEvent.Buttons;
LeaveCriticalSection(ChangeMouseEvents); LeaveCriticalSection(ChangeMouseEvents);
end; end;
Const Const
SysMouseDriver : TMouseDriver = ( SysMouseDriver : TMouseDriver = (
UseDefaultQueue : False; UseDefaultQueue : False;
InitDriver : @SysInitMouse; InitDriver : @SysInitMouse;
DoneDriver : @SysDoneMouse; DoneDriver : @SysDoneMouse;
DetectMouse : @SysDetectMouse; DetectMouse : @SysDetectMouse;
ShowMouse : Nil; ShowMouse : Nil;
HideMouse : Nil; HideMouse : Nil;
GetMouseX : @SysGetMouseX; GetMouseX : @SysGetMouseX;
GetMouseY : @SysGetMouseY; GetMouseY : @SysGetMouseY;
GetMouseButtons : @SysGetMouseButtons; GetMouseButtons : @SysGetMouseButtons;
SetMouseXY : Nil; SetMouseXY : Nil;
GetMouseEvent : @SysGetMouseEvent; GetMouseEvent : @SysGetMouseEvent;
PollMouseEvent : @SysPollMouseEvent; PollMouseEvent : @SysPollMouseEvent;
PutMouseEvent : @SysPutMouseEvent; PutMouseEvent : @SysPutMouseEvent;
); );
Begin Begin
SetMouseDriver(SysMouseDriver); SetMouseDriver(SysMouseDriver);
end. end.
{ {
$Log: mouse.pp,v $ $Log: mouse.pp,v $
Revision 1.11 2005/03/31 14:43:03 marco Revision 1.11 2005/03/31 14:43:03 marco
* fix to lastmouseevent update * fix to lastmouseevent update
Revision 1.10 2005/02/14 17:13:32 peter Revision 1.10 2005/02/14 17:13:32 peter
* truncate log * truncate log
Revision 1.9 2005/01/12 10:25:48 armin Revision 1.9 2005/01/12 10:25:48 armin
* Patch for bug 3548 from Peter * Patch for bug 3548 from Peter
} }