Browse Source

* various bugfixes
- Disable shared linking for now since it since it simply breaks
svn. (Already disabled in Makefile itself, likely accidentally
done with an old FPCMake, but it "fixed" svn to compile.)

git-svn-id: trunk@2401 -

daniel 19 years ago
parent
commit
d19c95db8f
6 changed files with 30 additions and 18 deletions
  1. 1 1
      Makefile.fpc
  2. 2 2
      rtl/inc/mouse.inc
  3. 6 5
      rtl/linux/gpm.pp
  4. 1 2
      rtl/linux/termio.pp
  5. 18 6
      rtl/unix/mouse.pp
  6. 2 2
      utils/grab_vcsa.pp

+ 1 - 1
Makefile.fpc

@@ -92,7 +92,7 @@ ifdef SNAPSHOT
 ALLTARGET=all
 ALLTARGET=all
 else
 else
 ifndef ALLTARGET
 ifndef ALLTARGET
-SHAREDTARGETS=linux freebsd
+SHAREDTARGETS=
 SMARTTARGETS=win32 go32v2 linux freebsd netbsd openbsd netware netwlibc
 SMARTTARGETS=win32 go32v2 linux freebsd netbsd openbsd netware netwlibc
 ifneq ($(findstring $(OS_TARGET),$(SHAREDTARGETS)),)
 ifneq ($(findstring $(OS_TARGET),$(SHAREDTARGETS)),)
 ALLTARGET=shared
 ALLTARGET=shared

+ 2 - 2
rtl/inc/mouse.inc

@@ -142,12 +142,12 @@ begin
     if (PendingMouseEvents>0) then
     if (PendingMouseEvents>0) then
       GetPendingEvent(MouseEvent)
       GetPendingEvent(MouseEvent)
     else
     else
-      FillChar(MouseEvent,sizeof(MouseEvent),0);
+      CurrentMouseDriver.GetMouseEvent(MouseEvent);
+{      FillChar(MouseEvent,sizeof(MouseEvent),0);}
     end
     end
   else
   else
     If Assigned(CurrentMouseDriver.GetMouseEvent) Then
     If Assigned(CurrentMouseDriver.GetMouseEvent) Then
       begin
       begin
-      CurrentMouseDriver.GetMouseEvent(MouseEvent);
       LastMouseEvent:=MouseEvent;
       LastMouseEvent:=MouseEvent;
       end
       end
     else
     else

+ 6 - 5
rtl/linux/gpm.pp

@@ -76,17 +76,17 @@ const
 type
 type
 {$PACKRECORDS c}
 {$PACKRECORDS c}
      Pgpm_event=^Tgpm_event;
      Pgpm_event=^Tgpm_event;
-     Tgpm_event=record
+     Tgpm_event=packed record
           buttons : byte;
           buttons : byte;
           modifiers : byte;
           modifiers : byte;
           vc : word;
           vc : word;
           dx : word;
           dx : word;
           dy : word;
           dy : word;
           x,y : word;
           x,y : word;
-          wdx,wdy : word;
           EventType : TGpmEType;
           EventType : TGpmEType;
           clicks : longint;
           clicks : longint;
           margin : TGpmMargin;
           margin : TGpmMargin;
+          wdx,wdy : word;
      end;
      end;
 
 
      Pgpmevent=Pgpm_event;
      Pgpmevent=Pgpm_event;
@@ -99,7 +99,7 @@ type
 
 
   type
   type
      Pgpm_connect = ^TGpm_connect;
      Pgpm_connect = ^TGpm_connect;
-     Tgpm_connect = record
+     Tgpm_connect = packed record
           eventMask : word;
           eventMask : word;
           defaultMask : word;
           defaultMask : word;
           minMod : word;
           minMod : word;
@@ -112,7 +112,7 @@ type
      Tgpmconnect=Tgpm_connect;
      Tgpmconnect=Tgpm_connect;
 
 
      Pgpm_roi=^Tgpm_roi;
      Pgpm_roi=^Tgpm_roi;
-     Tgpm_roi=record
+     Tgpm_roi=packed record
        xmin,xmax:integer;
        xmin,xmax:integer;
        ymin,ymax:integer;
        ymin,ymax:integer;
        minmod,maxmod:word;
        minmod,maxmod:word;
@@ -915,7 +915,6 @@ begin
       conn.vc:=GPM_REQ_BUTTONS;
       conn.vc:=GPM_REQ_BUTTONS;
       eptr:=@event;
       eptr:=@event;
     end;
     end;
-
   if gpm_fd=-1 then
   if gpm_fd=-1 then
     begin
     begin
       gpm_getsnapshot:=-1;
       gpm_getsnapshot:=-1;
@@ -935,6 +934,8 @@ begin
       else
       else
         begin
         begin
           gpm_getsnapshot:=eptr^.eventtype; { number of buttons }
           gpm_getsnapshot:=eptr^.eventtype; { number of buttons }
+          if eptr^.eventtype=0 then
+            gpm_getsnapshot:=15;
           eptr^.eventtype:=0;
           eptr^.eventtype:=0;
         end;
         end;
     end;
     end;

+ 1 - 2
rtl/linux/termio.pp

@@ -53,8 +53,7 @@ begin
     begin
     begin
       str(handle,s);
       str(handle,s);
       t:='/proc/self/fd/'+s+#0;
       t:='/proc/self/fd/'+s+#0;
-      fpreadlink(@t[1],@ttyname[1],255);
-      ttyname[0]:=char(strlen(@ttyname[1]));
+      ttyname[0]:=char(fpreadlink(@t[1],@ttyname[1],255));
     end;
     end;
 end;
 end;
 
 

+ 18 - 6
rtl/unix/mouse.pp

@@ -48,7 +48,7 @@ const
   gpm_fs : longint = -1;
   gpm_fs : longint = -1;
 
 
 {$ifndef NOGPM}
 {$ifndef NOGPM}
-procedure GPMEvent2MouseEvent(const e:TGPMEvent;var mouseevent:tmouseevent);
+procedure GPMEvent2MouseEvent(const e:Tgpm_event;var mouseevent:tmouseevent);
 var
 var
   PrevButtons : byte;
   PrevButtons : byte;
 
 
@@ -98,7 +98,7 @@ begin
         WaitMouseMove:=false;
         WaitMouseMove:=false;
       end;
       end;
   else
   else
-   MouseEvent.Action:=0;
+   MouseEvent.Action:=MouseActionMove;
   end;
   end;
 end;
 end;
 {$ENDIF}
 {$ENDIF}
@@ -131,7 +131,7 @@ procedure SysInitMouse;
 {$ifndef NOGPM}
 {$ifndef NOGPM}
 var
 var
   connect : TGPMConnect;
   connect : TGPMConnect;
-  E : TGPMEvent;
+  E : Tgpm_event;
 {$endif ndef NOGPM}
 {$endif ndef NOGPM}
 begin
 begin
 {$ifndef NOGPM}
 {$ifndef NOGPM}
@@ -189,6 +189,8 @@ function SysDetectMouse:byte;
 {$ifndef NOGPM}
 {$ifndef NOGPM}
 var
 var
   connect : TGPMConnect;
   connect : TGPMConnect;
+  fds : tFDSet;
+  e : Tgpm_event;
 {$endif ndef NOGPM}
 {$endif ndef NOGPM}
 begin
 begin
 {$ifndef NOGPM}
 {$ifndef NOGPM}
@@ -205,12 +207,22 @@ begin
           gpm_fs:=-1;
           gpm_fs:=-1;
         end;
         end;
     end;
     end;
-{ always a mouse deamon present }
+  if gpm_fs>=0 then
+    begin
+      fpFD_ZERO(fds);
+      fpFD_SET(gpm_fs,fds);
+      while fpSelect(gpm_fs+1,@fds,nil,nil,1)>0 do
+        begin
+          fillchar(e,sizeof(e),#0);
+          Gpm_GetEvent(e);
+        end;
+    end;
   if gpm_fs<>-1 then
   if gpm_fs<>-1 then
     SysDetectMouse:=Gpm_GetSnapshot(nil)
     SysDetectMouse:=Gpm_GetSnapshot(nil)
   else
   else
     SysDetectMouse:=0;
     SysDetectMouse:=0;
 {$else ifdef NOGPM}
 {$else ifdef NOGPM}
+{ always a mouse deamon present }
   if (fpgetenv('TERM')='xterm') then
   if (fpgetenv('TERM')='xterm') then
     SysDetectMouse:=2;
     SysDetectMouse:=2;
 {$endif NOGPM}
 {$endif NOGPM}
@@ -220,7 +232,7 @@ end;
 procedure SysGetMouseEvent(var MouseEvent: TMouseEvent);
 procedure SysGetMouseEvent(var MouseEvent: TMouseEvent);
 {$ifndef NOGPM}
 {$ifndef NOGPM}
 var
 var
-  e : TGPMEvent;
+  e : Tgpm_event;
 {$endif ndef NOGPM}
 {$endif ndef NOGPM}
 begin
 begin
   fillchar(MouseEvent,SizeOf(TMouseEvent),#0);
   fillchar(MouseEvent,SizeOf(TMouseEvent),#0);
@@ -241,7 +253,7 @@ end;
 function SysPollMouseEvent(var MouseEvent: TMouseEvent):boolean;
 function SysPollMouseEvent(var MouseEvent: TMouseEvent):boolean;
 {$ifndef NOGPM}
 {$ifndef NOGPM}
 var
 var
-  e : TGPMEvent;
+  e : Tgpm_event;
   fds : tFDSet;
   fds : tFDSet;
 {$endif ndef NOGPM}
 {$endif ndef NOGPM}
 begin
 begin

+ 2 - 2
utils/grab_vcsa.pp

@@ -99,14 +99,14 @@ begin
         read(f,dummy);
         read(f,dummy);
         read(f,device);
         read(f,device);
         close(f);
         close(f);
-        found_vcsa:=device and $ffffff00=$00000400; {/dev/tty*}
+        found_vcsa:=device and $ffffffc0=$00000400; {/dev/tty*}
         if (device=0) or (pid=-1) or (ppid=pid) then
         if (device=0) or (pid=-1) or (ppid=pid) then
           break; {Not attached to a terminal, i.e. an xterm.}
           break; {Not attached to a terminal, i.e. an xterm.}
       until found_vcsa;
       until found_vcsa;
       if found_vcsa then
       if found_vcsa then
         begin
         begin
           {We are running on the Linux console}
           {We are running on the Linux console}
-          str(device and $000000ff,s);
+          str(device and $0000003f,s);
           tty:='/dev/tty'+s;
           tty:='/dev/tty'+s;
           if fpstat(tty,ttystat)<>0 then
           if fpstat(tty,ttystat)<>0 then
             halt(result_stat_error);
             halt(result_stat_error);