|
@@ -189,7 +189,6 @@ end;
|
|
function SysDetectMouse:byte;
|
|
function SysDetectMouse:byte;
|
|
{$ifndef NOGPM}
|
|
{$ifndef NOGPM}
|
|
var
|
|
var
|
|
- x : longint;
|
|
|
|
connect : TGPMConnect;
|
|
connect : TGPMConnect;
|
|
{$endif ndef NOGPM}
|
|
{$endif ndef NOGPM}
|
|
begin
|
|
begin
|
|
@@ -219,6 +218,69 @@ begin
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
+procedure SysGetMouseEvent(var MouseEvent: TMouseEvent);
|
|
|
|
+{$ifndef NOGPM}
|
|
|
|
+var
|
|
|
|
+ e : TGPMEvent;
|
|
|
|
+{$endif ndef NOGPM}
|
|
|
|
+begin
|
|
|
|
+ fillchar(MouseEvent,SizeOf(TMouseEvent),#0);
|
|
|
|
+ if gpm_fs<0 then
|
|
|
|
+ exit;
|
|
|
|
+{$ifndef NOGPM}
|
|
|
|
+ Gpm_GetEvent(e);
|
|
|
|
+ GPMEvent2MouseEvent(e,MouseEvent);
|
|
|
|
+ SysLastMouseEvent:=MouseEvent;
|
|
|
|
+{ update mouse cursor }
|
|
|
|
+ if PrintMouseCur then
|
|
|
|
+ PlaceMouseCur(MouseEvent.y*ScreenWidth+MouseEvent.x);
|
|
|
|
+{$endif ndef NOGPM}
|
|
|
|
+end;
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+function SysPollMouseEvent(var MouseEvent: TMouseEvent):boolean;
|
|
|
|
+{$ifndef NOGPM}
|
|
|
|
+var
|
|
|
|
+ e : TGPMEvent;
|
|
|
|
+ fds : tFDSet;
|
|
|
|
+{$endif ndef NOGPM}
|
|
|
|
+begin
|
|
|
|
+ fillchar(MouseEvent,SizeOf(TMouseEvent),#0);
|
|
|
|
+{$ifndef NOGPM}
|
|
|
|
+ if gpm_fs<0 then
|
|
|
|
+ exit(false);
|
|
|
|
+ if gpm_fs>0 then
|
|
|
|
+ begin
|
|
|
|
+ fpFD_ZERO(fds);
|
|
|
|
+ fpFD_SET(gpm_fs,fds);
|
|
|
|
+ end;
|
|
|
|
+ if (fpSelect(gpm_fs+1,@fds,nil,nil,1)>0) then
|
|
|
|
+ begin
|
|
|
|
+ FillChar(e,SizeOf(e),#0);
|
|
|
|
+ { Gpm_snapshot does not work here PM }
|
|
|
|
+ Gpm_GetEvent(e);
|
|
|
|
+ GPMEvent2MouseEvent(e,MouseEvent);
|
|
|
|
+ SysLastMouseEvent:=MouseEvent;
|
|
|
|
+ if (MouseEvent.Action<>0) then
|
|
|
|
+ begin
|
|
|
|
+ { As we now use Gpm_GetEvent, we need to put in
|
|
|
|
+ in the MouseEvent queue PM }
|
|
|
|
+ PutMouseEvent(MouseEvent);
|
|
|
|
+ SysPollMouseEvent:=true;
|
|
|
|
+ { update mouse cursor is also required here
|
|
|
|
+ as next call will read MouseEvent from queue }
|
|
|
|
+ if PrintMouseCur then
|
|
|
|
+ PlaceMouseCur(MouseEvent.y*ScreenWidth+MouseEvent.x);
|
|
|
|
+ end
|
|
|
|
+ else
|
|
|
|
+ SysPollMouseEvent:=false;
|
|
|
|
+ end
|
|
|
|
+ else
|
|
|
|
+{$endif NOGPM}
|
|
|
|
+ SysPollMouseEvent:=false;
|
|
|
|
+end;
|
|
|
|
+
|
|
function SysGetMouseX:word;
|
|
function SysGetMouseX:word;
|
|
{$ifndef NOGPM}
|
|
{$ifndef NOGPM}
|
|
var
|
|
var
|
|
@@ -230,6 +292,8 @@ begin
|
|
{$ifndef NOGPM}
|
|
{$ifndef NOGPM}
|
|
if PollMouseEvent(ME) then
|
|
if PollMouseEvent(ME) then
|
|
begin
|
|
begin
|
|
|
|
+ { Remove mouse event, we are only interrested in
|
|
|
|
+ the X,Y so all other events can be thrown away }
|
|
GetMouseEvent(ME);
|
|
GetMouseEvent(ME);
|
|
SysGetMouseX:=ME.X
|
|
SysGetMouseX:=ME.X
|
|
end
|
|
end
|
|
@@ -252,6 +316,8 @@ begin
|
|
{$ifndef NOGPM}
|
|
{$ifndef NOGPM}
|
|
if PollMouseEvent(ME) then
|
|
if PollMouseEvent(ME) then
|
|
begin
|
|
begin
|
|
|
|
+ { Remove mouse event, we are only interrested in
|
|
|
|
+ the X,Y so all other events can be thrown away }
|
|
GetMouseEvent(ME);
|
|
GetMouseEvent(ME);
|
|
SysGetMouseY:=ME.Y
|
|
SysGetMouseY:=ME.Y
|
|
end
|
|
end
|
|
@@ -305,83 +371,20 @@ begin
|
|
exit(0);
|
|
exit(0);
|
|
{$ifndef NOGPM}
|
|
{$ifndef NOGPM}
|
|
if PollMouseEvent(ME) then
|
|
if PollMouseEvent(ME) then
|
|
- begin
|
|
|
|
- // why should we remove that event ?? PM
|
|
|
|
- // GetMouseEvent(ME);
|
|
|
|
- SysGetMouseButtons:=ME.buttons
|
|
|
|
- end
|
|
|
|
|
|
+ begin
|
|
|
|
+ { Remove mouse event, we are only interrested in
|
|
|
|
+ the buttons so all other events can be thrown away }
|
|
|
|
+ GetMouseEvent(ME);
|
|
|
|
+ SysGetMouseButtons:=ME.Buttons;
|
|
|
|
+ end
|
|
else
|
|
else
|
|
begin
|
|
begin
|
|
- SysGetMouseButtons:=SysLastMouseEvent.Buttons;
|
|
|
|
|
|
+ SysGetMouseButtons:=SysLastMouseEvent.buttons;
|
|
end;
|
|
end;
|
|
{$endif ndef NOGPM}
|
|
{$endif ndef NOGPM}
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
|
|
-procedure SysGetMouseEvent(var MouseEvent: TMouseEvent);
|
|
|
|
-{$ifndef NOGPM}
|
|
|
|
-var
|
|
|
|
- e : TGPMEvent;
|
|
|
|
-{$endif ndef NOGPM}
|
|
|
|
-begin
|
|
|
|
- fillchar(MouseEvent,SizeOf(TMouseEvent),#0);
|
|
|
|
- if gpm_fs<0 then
|
|
|
|
- exit;
|
|
|
|
-{$ifndef NOGPM}
|
|
|
|
- Gpm_GetEvent(e);
|
|
|
|
- GPMEvent2MouseEvent(e,MouseEvent);
|
|
|
|
- SysLastMouseEvent:=MouseEvent;
|
|
|
|
-{ update mouse cursor }
|
|
|
|
- if PrintMouseCur then
|
|
|
|
- PlaceMouseCur(MouseEvent.y*ScreenWidth+MouseEvent.x);
|
|
|
|
-{$endif ndef NOGPM}
|
|
|
|
-end;
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-function SysPollMouseEvent(var MouseEvent: TMouseEvent):boolean;
|
|
|
|
-{$ifndef NOGPM}
|
|
|
|
-var
|
|
|
|
- e : TGPMEvent;
|
|
|
|
- fds : tFDSet;
|
|
|
|
-{$endif ndef NOGPM}
|
|
|
|
-begin
|
|
|
|
- fillchar(MouseEvent,SizeOf(TMouseEvent),#0);
|
|
|
|
-{$ifndef NOGPM}
|
|
|
|
- if gpm_fs<0 then
|
|
|
|
- exit(false);
|
|
|
|
- if gpm_fs>0 then
|
|
|
|
- begin
|
|
|
|
- fpFD_ZERO(fds);
|
|
|
|
- fpFD_SET(gpm_fs,fds);
|
|
|
|
- end;
|
|
|
|
- if (fpSelect(gpm_fs+1,@fds,nil,nil,1)>0) then
|
|
|
|
- begin
|
|
|
|
- FillChar(e,SizeOf(e),#0);
|
|
|
|
- { Gpm_snapshot does not work here PM }
|
|
|
|
- Gpm_GetEvent(e);
|
|
|
|
- GPMEvent2MouseEvent(e,MouseEvent);
|
|
|
|
- SysLastMouseEvent:=MouseEvent;
|
|
|
|
- if (MouseEvent.Action<>0) then
|
|
|
|
- begin
|
|
|
|
- { As we now use Gpm_GetEvent, we need to put in
|
|
|
|
- in the MouseEvent queue PM }
|
|
|
|
- PutMouseEvent(MouseEvent);
|
|
|
|
- SysPollMouseEvent:=true;
|
|
|
|
- { update mouse cursor is also required here
|
|
|
|
- as next call will read MouseEvent from queue }
|
|
|
|
- if PrintMouseCur then
|
|
|
|
- PlaceMouseCur(MouseEvent.y*ScreenWidth+MouseEvent.x);
|
|
|
|
- end
|
|
|
|
- else
|
|
|
|
- SysPollMouseEvent:=false;
|
|
|
|
- end
|
|
|
|
- else
|
|
|
|
-{$endif NOGPM}
|
|
|
|
- SysPollMouseEvent:=false;
|
|
|
|
-end;
|
|
|
|
-
|
|
|
|
-
|
|
|
|
Const
|
|
Const
|
|
SysMouseDriver : TMouseDriver = (
|
|
SysMouseDriver : TMouseDriver = (
|
|
UseDefaultQueue : true;
|
|
UseDefaultQueue : true;
|
|
@@ -426,7 +429,10 @@ end.
|
|
|
|
|
|
{
|
|
{
|
|
$Log$
|
|
$Log$
|
|
- Revision 1.13 2004-11-03 16:51:05 peter
|
|
|
|
|
|
+ Revision 1.14 2004-11-06 20:06:19 peter
|
|
|
|
+ * mouse works again
|
|
|
|
+
|
|
|
|
+ Revision 1.13 2004/11/03 16:51:05 peter
|
|
* fixed valgrind issues
|
|
* fixed valgrind issues
|
|
|
|
|
|
Revision 1.12 2003/10/24 18:09:56 marco
|
|
Revision 1.12 2003/10/24 18:09:56 marco
|