From d19c95db8f6e309cb12e5cf747e63cb19cf69a09 Mon Sep 17 00:00:00 2001 From: daniel Date: Thu, 2 Feb 2006 08:22:35 +0000 Subject: [PATCH] * 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 - --- Makefile.fpc | 2 +- rtl/inc/mouse.inc | 4 ++-- rtl/linux/gpm.pp | 11 ++++++----- rtl/linux/termio.pp | 3 +-- rtl/unix/mouse.pp | 24 ++++++++++++++++++------ utils/grab_vcsa.pp | 4 ++-- 6 files changed, 30 insertions(+), 18 deletions(-) diff --git a/Makefile.fpc b/Makefile.fpc index 1903a88968..80f1ba1533 100644 --- a/Makefile.fpc +++ b/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 diff --git a/rtl/inc/mouse.inc b/rtl/inc/mouse.inc index 7362d16b97..99698cd937 100644 --- a/rtl/inc/mouse.inc +++ b/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 diff --git a/rtl/linux/gpm.pp b/rtl/linux/gpm.pp index e1c1f72c80..d48acc95c6 100644 --- a/rtl/linux/gpm.pp +++ b/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; diff --git a/rtl/linux/termio.pp b/rtl/linux/termio.pp index 9d1b3dff2c..98c1089f96 100644 --- a/rtl/linux/termio.pp +++ b/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; diff --git a/rtl/unix/mouse.pp b/rtl/unix/mouse.pp index aecfa38933..cc9a10fbcd 100644 --- a/rtl/unix/mouse.pp +++ b/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 diff --git a/utils/grab_vcsa.pp b/utils/grab_vcsa.pp index 0daa61f07d..08bbe1b81a 100644 --- a/utils/grab_vcsa.pp +++ b/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);