mirror of
				https://gitlab.com/freepascal.org/fpc/source.git
				synced 2025-10-31 03:11:39 +01:00 
			
		
		
		
	+ set conditional NOMOUSE to get dummy mouse unit
This commit is contained in:
		
							parent
							
								
									3f46012444
								
							
						
					
					
						commit
						102fba3a50
					
				| @ -6,11 +6,13 @@ | |||||||
| 
 | 
 | ||||||
| uses | uses | ||||||
|   Linux,Video |   Linux,Video | ||||||
|  | {$ifndef NOMOUSE} | ||||||
| {$ifdef OLDGPM} | {$ifdef OLDGPM} | ||||||
|   ,gpm114 |   ,gpm114 | ||||||
| {$else} | {$else} | ||||||
|   ,gpm |   ,gpm | ||||||
| {$endif} | {$endif} | ||||||
|  | {$endif ndef NOMOUSE} | ||||||
|   ; |   ; | ||||||
| 
 | 
 | ||||||
| const | const | ||||||
| @ -22,9 +24,12 @@ var | |||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| procedure PlaceMouseCur(ofs:longint); | procedure PlaceMouseCur(ofs:longint); | ||||||
|  | {$ifndef NOMOUSE} | ||||||
| var | var | ||||||
|   upd : boolean; |   upd : boolean; | ||||||
|  | {$endif ndef NOMOUSE} | ||||||
| begin | begin | ||||||
|  | {$ifndef NOMOUSE} | ||||||
|   if VideoBuf=nil then |   if VideoBuf=nil then | ||||||
|    exit; |    exit; | ||||||
|   upd:=false; |   upd:=false; | ||||||
| @ -42,13 +47,17 @@ begin | |||||||
|    end; |    end; | ||||||
|   if upd then |   if upd then | ||||||
|    Updatescreen(false); |    Updatescreen(false); | ||||||
|  | {$endif ndef NOMOUSE} | ||||||
| end; | end; | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| procedure InitMouse; | procedure InitMouse; | ||||||
|  | {$ifndef NOMOUSE} | ||||||
| var | var | ||||||
|   connect : TGPMConnect; |   connect : TGPMConnect; | ||||||
|  | {$endif ndef NOMOUSE} | ||||||
| begin | begin | ||||||
|  | {$ifndef NOMOUSE} | ||||||
|   PendingMouseHead:=@PendingMouseEvent; |   PendingMouseHead:=@PendingMouseEvent; | ||||||
|   PendingMouseTail:=@PendingMouseEvent; |   PendingMouseTail:=@PendingMouseEvent; | ||||||
|   PendingMouseEvents:=0; |   PendingMouseEvents:=0; | ||||||
| @ -61,20 +70,27 @@ begin | |||||||
|   Gpm_Open(connect,0); |   Gpm_Open(connect,0); | ||||||
| { show mousepointer } | { show mousepointer } | ||||||
|   ShowMouse; |   ShowMouse; | ||||||
|  | {$endif ndef NOMOUSE} | ||||||
| end; | end; | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| procedure DoneMouse; | procedure DoneMouse; | ||||||
| begin | begin | ||||||
|  | {$ifndef NOMOUSE} | ||||||
|   HideMouse; |   HideMouse; | ||||||
|   Gpm_Close; |   Gpm_Close; | ||||||
|  | {$endif ndef NOMOUSE} | ||||||
| end; | end; | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| function DetectMouse:byte; | function DetectMouse:byte; | ||||||
| begin | begin | ||||||
|  | {$ifdef NOMOUSE} | ||||||
|  |   DetectMouse:=0; | ||||||
|  | {$else ndef NOMOUSE} | ||||||
| { always a mouse deamon present } | { always a mouse deamon present } | ||||||
|   DetectMouse:=2; |   DetectMouse:=2; | ||||||
|  | {$endif ndef NOMOUSE} | ||||||
| end; | end; | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| @ -93,35 +109,53 @@ end; | |||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| function GetMouseX:word; | function GetMouseX:word; | ||||||
|  | {$ifndef NOMOUSE} | ||||||
| var | var | ||||||
|   e : TGPMEvent; |   e : TGPMEvent; | ||||||
|  | {$endif ndef NOMOUSE} | ||||||
| begin | begin | ||||||
|  | {$ifdef NOMOUSE} | ||||||
|  |   GetMouseX:=0; | ||||||
|  | {$else ndef NOMOUSE} | ||||||
|   if gpm_fd<0 then |   if gpm_fd<0 then | ||||||
|    exit(0); |    exit(0); | ||||||
|   Gpm_GetSnapshot(e); |   Gpm_GetSnapshot(e); | ||||||
|   GetMouseX:=e.x-1; |   GetMouseX:=e.x-1; | ||||||
|  | {$endif ndef NOMOUSE} | ||||||
| end; | end; | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| function GetMouseY:word; | function GetMouseY:word; | ||||||
|  | {$ifndef NOMOUSE} | ||||||
| var | var | ||||||
|   e : TGPMEvent; |   e : TGPMEvent; | ||||||
|  | {$endif ndef NOMOUSE} | ||||||
| begin | begin | ||||||
|  | {$ifdef NOMOUSE} | ||||||
|  |   GetMouseY:=0; | ||||||
|  | {$else ndef NOMOUSE} | ||||||
|   if gpm_fd<0 then |   if gpm_fd<0 then | ||||||
|    exit(0); |    exit(0); | ||||||
|   Gpm_GetSnapshot(e); |   Gpm_GetSnapshot(e); | ||||||
|   GetMouseY:=e.y-1; |   GetMouseY:=e.y-1; | ||||||
|  | {$endif ndef NOMOUSE} | ||||||
| end; | end; | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| function GetMouseButtons:word; | function GetMouseButtons:word; | ||||||
|  | {$ifndef NOMOUSE} | ||||||
| var | var | ||||||
|   e : TGPMEvent; |   e : TGPMEvent; | ||||||
|  | {$endif ndef NOMOUSE} | ||||||
| begin | begin | ||||||
|  | {$ifdef NOMOUSE} | ||||||
|  |   GetMouseButtons:=0; | ||||||
|  | {$else ndef NOMOUSE} | ||||||
|   if gpm_fd<0 then |   if gpm_fd<0 then | ||||||
|    exit(0); |    exit(0); | ||||||
|   Gpm_GetSnapshot(e); |   Gpm_GetSnapshot(e); | ||||||
|   GetMouseButtons:=e.buttons; |   GetMouseButtons:=e.buttons; | ||||||
|  | {$endif ndef NOMOUSE} | ||||||
| end; | end; | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| @ -131,9 +165,14 @@ end; | |||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| procedure GetMouseEvent(var MouseEvent: TMouseEvent); | procedure GetMouseEvent(var MouseEvent: TMouseEvent); | ||||||
|  | {$ifndef NOMOUSE} | ||||||
| var | var | ||||||
|   e : TGPMEvent; |   e : TGPMEvent; | ||||||
|  | {$endif ndef NOMOUSE} | ||||||
| begin | begin | ||||||
|  | {$ifdef NOMOUSE} | ||||||
|  |   fillchar(@MouseEvent,SizeOf(TMouseEvent),#0);
 | ||||||
|  | {$else ndef NOMOUSE} | ||||||
|   if gpm_fd<0 then |   if gpm_fd<0 then | ||||||
|    exit; |    exit; | ||||||
|   Gpm_GetEvent(e); |   Gpm_GetEvent(e); | ||||||
| @ -158,15 +197,22 @@ begin | |||||||
| { update mouse cursor } | { update mouse cursor } | ||||||
|   if mousecur then |   if mousecur then | ||||||
|    PlaceMouseCur(MouseEvent.y*ScreenWidth+MouseEvent.x); |    PlaceMouseCur(MouseEvent.y*ScreenWidth+MouseEvent.x); | ||||||
|  | {$endif ndef NOMOUSE} | ||||||
| end; | end; | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| function PollMouseEvent(var MouseEvent: TMouseEvent):boolean; | function PollMouseEvent(var MouseEvent: TMouseEvent):boolean; | ||||||
| 
 | 
 | ||||||
|  | {$ifndef NOMOUSE} | ||||||
| var | var | ||||||
|   e : TGPMEvent; |   e : TGPMEvent; | ||||||
|   fds : FDSet; |   fds : FDSet; | ||||||
|  | {$endif ndef NOMOUSE} | ||||||
| begin | begin | ||||||
|  | {$ifdef NOMOUSE} | ||||||
|  |   fillchar(@MouseEvent,SizeOf(TMouseEvent),#0);
 | ||||||
|  |   exit(false); | ||||||
|  | {$else ndef NOMOUSE} | ||||||
|   if gpm_fd<0 then |   if gpm_fd<0 then | ||||||
|    exit(false); |    exit(false); | ||||||
|   FD_Zero(fds); |   FD_Zero(fds); | ||||||
| @ -195,11 +241,15 @@ begin | |||||||
|    end |    end | ||||||
|   else |   else | ||||||
|    PollMouseEvent:=false; |    PollMouseEvent:=false; | ||||||
|  | {$endif ndef NOMOUSE} | ||||||
| end; | end; | ||||||
| 
 | 
 | ||||||
| { | { | ||||||
|   $Log$ |   $Log$ | ||||||
|   Revision 1.1  2000-01-06 01:20:31  peter |   Revision 1.2  2000-04-17 08:51:38  pierre | ||||||
|  |    + set conditional NOMOUSE to get dummy mouse unit | ||||||
|  | 
 | ||||||
|  |   Revision 1.1  2000/01/06 01:20:31  peter | ||||||
|     * moved out of packages/ back to topdir |     * moved out of packages/ back to topdir | ||||||
| 
 | 
 | ||||||
|   Revision 1.1  1999/11/24 23:36:38  peter |   Revision 1.1  1999/11/24 23:36:38  peter | ||||||
| @ -228,4 +278,4 @@ end; | |||||||
|   Revision 1.2  1998/10/29 12:49:49  peter |   Revision 1.2  1998/10/29 12:49:49  peter | ||||||
|     * more fixes |     * more fixes | ||||||
| 
 | 
 | ||||||
| } | } | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 pierre
						pierre