浏览代码

* 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 年之前
父节点
当前提交
d19c95db8f
共有 6 个文件被更改,包括 30 次插入18 次删除
  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
 else
 ifndef ALLTARGET
-SHAREDTARGETS=linux freebsd
+SHAREDTARGETS=
 SMARTTARGETS=win32 go32v2 linux freebsd netbsd openbsd netware netwlibc
 ifneq ($(findstring $(OS_TARGET),$(SHAREDTARGETS)),)
 ALLTARGET=shared

+ 2 - 2
rtl/inc/mouse.inc

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

+ 6 - 5
rtl/linux/gpm.pp

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

+ 1 - 2
rtl/linux/termio.pp

@@ -53,8 +53,7 @@ begin
     begin
       str(handle,s);
       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;
 

+ 18 - 6
rtl/unix/mouse.pp

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

+ 2 - 2
utils/grab_vcsa.pp

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