1 {Set tabsize to 4.}
2 {****************************************************************************
3 
4 
5                            MOUCALLS interface unit
6                      Free Pascal Runtime Library for OS/2
7                    Copyright (c) 1999-2000 by Florian Kl�mpfl
8                     Copyright (c) 1999-2000 by Daniel Mantione
9                       Copyright (c) 1999-2000 by Tomas Hajny
10 
11  The Free Pascal runtime library is distributed under the Library GNU Public
12  License v2. So is this unit. The Library GNU Public License requires you to
13  distribute the source code of this unit with any product that uses it.
14  Because the EMX library isn't under the LGPL, we grant you an exception to
15  this, and that is, when you compile a program with the Free Pascal Compiler,
16  you do not need to ship source code with that program, AS LONG AS YOU ARE
17  USING UNMODIFIED CODE! If you modify this code, you MUST change the next
18  line:
19 
20  <This is an official, unmodified Free Pascal source code file.>
21 
22  Send us your modified files, we can work together if you want!
23 
24  Free Pascal is distributed in the hope that it will be useful,
25  but WITHOUT ANY WARRANTY; without even the implied warranty of
26  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
27  Library GNU General Public License for more details.
28 
29  You should have received a copy of the Library GNU General Public License
30  along with Free Pascal; see the file COPYING.LIB.  If not, write to
31  the Free Software Foundation, 51 Franklin Street, Fifth Floor,
32  Boston, MA 02110-1301, USA.
33 
34 ****************************************************************************}
35 
36 unit MouCalls;
37 
38 { Interface library to MOUCALLS.DLL (through EMXWRAP.DLL; C calling convention
39   - cdecl - must be used for EMXWRAP, whereas direct MOUCALLS calls would need
40   16-bit Pascal calling convention with thunking instead).
41 
42 Variant records and aliases for some record types created to maintain highest
43 possible level of compatibility with other existing OS/2 compilers.
44 
45 Changelog:
46 
47     People:
48 
49         TH - Tomas Hajny (xhajt03@mbox.vol.cz on Internet)
50 
51     Date:           Description of change:              Changed by:
52 
53      -              First released version 1.0          TH
54 
55 Coding style:
56 
57     I have tried to use the same coding style as Daniel Mantione in unit
58     DOSCALLS, although I can't say I would write it the same way otherwise
59     (I would write much more spaces myself, at least). Try to use it as well,
60     please. Original note by Daniel Mantione follows:
61 
62 
63     It may be well possible that coding style feels a bit strange to you.
64     Nevertheless I friendly ask you to try to make your changes not look all
65     to different. To make life easier, set your IDE to use tab characters,
66     turn optimal fill, autoindent and backspace unindents on and set a
67     tabsize of 4.}
68 
69 {***************************************************************************}
70 interface
71 {***************************************************************************}
72 
73 {$IFDEF FPC}
74     {$PACKRECORDS 1}
75 {$ENDIF FPC}
76 
77 const
78 {return codes / error constants (those marked with * shouldn't occur under
79 normal conditions)}
80     NO_ERROR                        =  0;
81     Error_Invalid_Parameter         = 87;
82     ERROR_SEM_TIMEOUT               =121;
83     ERROR_MOUSE_NO_DEVICE           =385;
84     ERROR_MOUSE_INV_HANDLE          =386; {*}
85     ERROR_MOUSE_INV_PARMS           =387;
86     ERROR_MOUSE_CANT_RESET          =388; {*}
87     ERROR_MOUSE_DISPLAY_PARMS       =389; {*}
88     ERROR_MOUSE_INV_MODULE          =390;
89     ERROR_MOUSE_INV_ENTRY_PT        =391; {*}
90     ERROR_MOUSE_INV_MASK            =392; {*}
91     NO_ERROR_MOUSE_NO_DATA          =393;
92     NO_ERROR_MOUSE_PTR_DRAWN        =394; {*}
93     ERROR_MOUSE_SMG_ONLY            =412;
94     ERROR_MOUSE_INVALID_ASCIIZ      =413;
95     ERROR_MOUSE_INVALID_MASK        =414;
96     ERROR_MOUSE_REGISTER            =415;
97     ERROR_MOUSE_DEREGISTER          =416;
98     ERROR_MOUSE_INVALID_IOWAIT      =435; {*}
99     ERROR_MOU_DETACHED              =466;
100     ERROR_MOUSE_NO_CONSOLE          =501;
101     ERROR_MOUSE_INVALID_HANDLE      =502; {*}
102     ERROR_MOU_EXTENDED_SG           =505;
103     ERROR_MOU_NOT_INITIALIZED       =530; {*}
104     ERROR_MOUINITREAL_DONE          =531; {*}
105     ERROR_MOUSE_CALLER_NOT_SUBSYS   =533; {*}
106 
107 {constants for FnMask in MouRegister}
108     MR_MOUGETNUMBUTTONS =$00000001;
109     MR_MOUGETNUMMICKEYS =$00000002;
110     MR_MOUGETDEVSTATUS  =$00000004;
111     MR_MOUGETNUMQUEEL   =$00000008;
112     MR_MOUREADEVENTQUE  =$00000010;
113     MR_MOUGETSCALEFACT  =$00000020;
114     MR_MOUGETEVENTMASK  =$00000040;
115     MR_MOUSETSCALEFACT  =$00000080;
116     MR_MOUSETEVENTMASK  =$00000100;
117     MR_MOUOPEN          =$00000800;
118     MR_MOUCLOSE         =$00001000;
119     MR_MOUGETPTRSHAPE   =$00002000;
120     MR_MOUSETPTRSHAPE   =$00004000;
121     MR_MOUDRAWPTR       =$00008000;
122     MR_MOUREMOVEPTR     =$00010000;
123     MR_MOUGETPTRPOS     =$00020000;
124     MR_MOUSETPTRPOS     =$00040000;
125     MR_MOUINITREAL      =$00080000;
126     MR_MOUSETDEVSTATUS  =$00100000;
127 
128 {constants for mouse hot key bits in MouGetHotKey/MouSetHotKey}
129     MHK_BUTTON1 =1;
130     MHK_BUTTON2 =2;
131     MHK_BUTTON3 =4;
132 
133 {MouGetDevStatus/MouSetDevStatus device status constants}
134     MOUSE_QUEUEBUSY         =$0001; {event queue busy with I/O}
135     MOUSE_BLOCKREAD         =$0002; {block read in progress}
136     MOUSE_FLUSH             =$0004; {flush in progress}
137     MOUSE_UNSUPPORTED_MODE  =$0008; {pointer draw routine disabled}
138                                     {by unsupported mode          }
139     MOUSE_DISABLED          =$0100; {drawing operations for pointer}
140                                     {draw routine are disabled     }
141     MOUSE_MICKEYS           =$0200; {mouse data returned in mickeys, not pels}
142 
143 {constants for WaitFlag in MouReadEventQue and MouSynch}
144     MOU_NOWAIT   =$0000;    {MouReadEventQue: don't wait for data    }
145                             {   on empty queue (return a null record)}
146                             {MouSynch: control immediately}
147                             {   returned to requestor     }
148     MOU_WAIT     =$0001;    {MouReadEventQue: wait for data on empty queue}
149                             {MouSynch: requestor waits until}
150                             {   mouse device driver is free }
151 
152 {constants for MouGetEventMask/MouSetEventMask events}
153     MOUSE_MOTION                =$0001; {report mouse motion events with}
154                                         {no button press/release events }
155     MOUSE_MOTION_WITH_BN1_DOWN  =$0002; {report button 1 press/release}
156                                         {events, with mouse motion    }
157     MOUSE_BN1_DOWN              =$0004; {report button 1 press/release}
158                                         {events, without mouse motion }
159     MOUSE_MOTION_WITH_BN2_DOWN  =$0008; {report button 2 press/release}
160                                         {events, with mouse motion    }
161     MOUSE_BN2_DOWN              =$0010; {report button 2 press/release}
162                                         {events, without mouse motion }
163     MOUSE_MOTION_WITH_BN3_DOWN  =$0020; {report button 3 press/release}
164                                         {events, with mouse motion    }
165     MOUSE_BN3_DOWN              =$0040; {report button 3 press/release}
166                                         {events, without mouse motion }
167 
168 {constants for Status in MouSetDevStatus}
169     MOU_DRAW    =0;
170     MOU_NODRAW  =1;
171 
172     MOU_PELS    =0;
173     MOU_MICKEYS =2;
174 
175 type
176 {unnecessary, just FYI}
177     THMOU=word;
178     PHMOU=^THMOU;
179 
180 {record type for MouGetPtrPos/MouSetPtrPos}
181     TPtrLoc=record
182         Row,        {mouse pointer row coordinate (in pels or characters)}
183         Col:word;   {mouse pointer column coordinate (in pels or characters)}
184     end;
185     PPtrLoc=^TPtrLoc;
186     PtrLoc=TPtrLoc;
187 
188 {record type for MouGetPtrShape/MouSetPtrShape}
189     TPtrShape=record
190         cb,             {length of image buffer in bytes}
191         Col,            {pointer width in characters (in text}
192                         {modes; always 1) or pixels (>= 1)   }
193         Row,            {pointer height in characters (in text}
194                         {modes; always 1) or pixels (>=1)     }
195         ColHot,         {hotspot offset from the left}
196                         {side, in characters or pels }
197                         {(must be 0 in text modes)   }
198         RowHot:word;    {hotspot offset from the top,}
199                         {in characters or pels       }
200                         {(must be 0 in text modes)   }
201      end;
202      PPtrShape=^TPtrShape;
203      PtrShape=TPtrShape;
204 
205 {record type for MouReadEventQue}
206 (*   #pragma pack(2) ??? *)
207     TMouEventInfo=record
208         fs:word;        {event bits (state of the mouse at the time     }
209                         {of the event) - see MOUSE_MOTION,              }
210                         {MOUSE_MOTION_WITH_BN1_DOWN, MOUSE_BN1_DOWN,    }
211                         {MOUSE_MOTION_WITH_BN2_DOWN, MOUSE_BN2_DOWN,    }
212                         {MOUSE_MOTION_WITH_BN3_DOWN and MOUSE_BN3_DOWN  }
213                         {constants (other bits reserved and set to zero)}
214         Time:cardinal;  {event timestamp - unique number of milliseconds}
215                         {(since the system was started                  }
216         Row,            {pointer current row position (absolute or relative)}
217         Col:integer;    {pointer current column position}
218                         {(absolute or relative)         }
219     end;
220     PMouEventInfo=^TMouEventInfo;
221     MouEventInfo=TMouEventInfo;
222 
223 {record type for MouGetNumQueEl}
224     TMouQueInfo=record
225         cEvents,            {current number of elements in event}
226                             {queue, between 0 and cmaxEvents    }
227         cmaxEvents:word;    {maximum queue size in elements, as specified    }
228                             {in the QSIZE=NN parameter in DEVICE=MOUSExxx.SYS}
229                             {statement in CONFIG.SYS                         }
230     end;
231     PMouQueInfo=^TMouQueInfo;
232     MouQueInfo=TMouQueInfo;
233 
234 {record type for MouGetScaleFact/MouSetScaleFact}
235     TScaleFact=record
236         RowScale,       {current row scaling factor}
237         ColScale:word;  {current column scaling factor}
238     end;
239     PScaleFact=^TScaleFact;
240     ScaleFact=TScaleFact;
241 
242 {record type for MouRemovePtr}
243     TNoPtrRect=record
244         Row,        {upper row of the rectangle (pels or characters)}
245         Col,        {column of the left edge (pels or characters)}
246         cRow,       {bottom row of the rectangle (pels or characters)}
247         cCol:word;  {column of the right edge (pels or characters)}
248     end;
249     PNoPtrRect=^TNoPtrRect;
250     NoPtrRect=TNoPtrRect;
251 
252     TThreshold=record
253         case boolean of
254         false:(Length:word;     {length of data in bytes}
255         Level1,                 {first movement level}
256         Lev1Mult,               {first level multiplier}
257         Level2,                 {second movement level}
258         Lev2Mult:word);         {second level multiplier}
259         true:(aLength:word);
260     end;
261     PThreshold=^TThreshold;
262     Threshold=TThreshold;
263 
264 
265 {Register a mouse subsystem within a session.}
266 {ModuleName is name of the dynamic link module (the maximum length
267 is 8 characters - plus the final #0 character in the PChar version of this
268 call), ProcName is the dynamic link entry point name of a routine that receives
269 control when any of the registered functions are called (the maximum length
270 is 32 bytes - plus the final #0 character in the PChar version of this call),
271 FnMask is a mask of bits, where each bit set to 1 identifies a mouse function
272 being registered - see MR_MOU* constants.}
273 {Possible return codes:
274     0         NO_ERROR
275     385       ERROR_MOUSE_NO_DEVICE
276     413       ERROR_MOUSE_INVALID_ASCIIZ
277     414       ERROR_MOUSE_INVALID_MASK
278     415       ERROR_MOUSE_REGISTER
279     466       ERROR_MOU_DETACHED
280     505       ERROR_MOU_EXTENDED_SG}
281 {Remarks:
282 * The Base Mouse Subsystem is the default mouse subsystem. There can be only
283   one MouRegister outstanding for each session without an intervening
284   MouDeRegister. MouDeRegister must be issued by the same process that issued
285   MouRegister.
286 * When any registered function is called, control is routed to EntryName.
287   When this routine is entered, four additional values are pushed onto the
288   stack. The first is the index number (Word) of the function being called.
289   The second is a near pointer (Word). The third is the caller's DS register
290   (Word). The fourth is the return address (DWord) to the mouse router. For
291   example, if MouGetNumMickeys were called and control routed to EntryName,
292   the stack would appear as if the following instructions were executed:
293 
294   PUSH@ WORD    MickeyCnt
295   PUSH  WORD    MouHandle
296   CALL  FAR     MouGetNumMickeys
297   PUSH  WORD    Function Code
298   CALL  NEAR    Entry point in Mouse Router
299   PUSH  DS
300   CALL  FAR     EntryName
301 
302 
303 * When a registered function returns to the Mouse Router, AX is interpreted
304   as follows:
305     AX = 0 - no error, do not invoke the Base Mouse Subsystem routine,
306             return AX = 0
307     AX = -1 - invoke the BaseMouse Subsystem routine, return AX = return code
308             from the Base Mouse Subsystem
309     AX = error (if not 0 or -1) - do not invoke the Base Mouse Subsystem
310             Routine, return AX = error
311 * When the mouse router receives a mouse call, it routes it to the Base Mouse
312   Subsystem unless an application or other mouse subsystem has previously
313   issued MouRegister for that call. If the call was registered, the subsystem
314   is entered at the EntryName specified, and provided with the applicable
315   function code.
316 * The registered function mask is used to determine whether a requested
317   function is performed by the registered mouse subsystem or default to the
318   Base Mouse Subsystem.
319 * The following list shows the relationship of the mouse API calls and the
320   Function Code passed to either the Base Mouse Subsystem or a registered
321   mouse subsystem.
322 
323   MOU API calls               Function Code
324   MouGetNumButtons            00h
325   MouGetNumMickeys            01h
326   MouGetDevStatus             02h
327   MouGetNumQueEl              03h
328   MouReadEventQue             04h
329   MouGetScaleFact             05h
330   MouGetEventMask             06h
331   MouSetScaleFact             07h
332   MouSetEventMask             08h
333   Reserved                    09h
334   Reserved                    0Ah
335   MouOpen                     0Bh
336   MouClose                    0Ch
337   MouGetPtrShape              0Dh
338   MouSetPtrShape              0Eh
339   MouDrawPtr                  0Fh
340   MouRemovePtr                10h
341   MouGetPtrPos                11h
342   MouSetPtrPos                12h
343   MouInitReal                 13h
344   MouFlushQue                 14h
345   MouSetDevStatus             15h
346 * A registered mouse sybsystem must leave the stack, on exit, in the exact
347   state it was received.}
MouRegisternull348 function MouRegister(ModuleName,ProcName:PChar;FnMask:cardinal):word; cdecl;
MouRegisternull349 function MouRegister(ModuleName,ProcName:string;FnMask:cardinal):word;
350 
351 {Deregister a mouse subsystem previously registered within a session.}
352 {Possible return codes:
353     0         NO_ERROR
354     385       ERROR_MOUSE_NO_DEVICE
355     416       ERROR_MOUSE_DEREGISTER
356     466       ERROR_MOU_DETACHED
357     505       ERROR_MOU_EXTENDED_SG}
358 {Remarks:
359 * The process that issued the MouRegister must release the session
360   (by a MouDeRegister call) from the registered subsystem before another PID
361   may issue MouRegister.
362 * The process that issued the MouRegister is the only process that may
363   issue MouDeRegister against the currently registered subsystem.
364 * After the owning process has released the subsystem with a MouDeRegister
365   call, any other process in the session may issue a MouRegister and therefore
366   modify the mouse support for the entire session.}
MouDeRegisternull367 function MouDeRegister:word; cdecl;
368 
369 {Direct the mouse driver to flush (empty) the mouse event queue and the monitor
370 chain data for the session.}
371 {MouHandle is the mouse device handle from a previous MouOpen call.}
372 {Possible return codes:
373     0         NO_ERROR
374     385       ERROR_MOUSE_NO_DEVICE
375     466       ERROR_MOU_DETACHED
376     501       ERROR_MOUSE_NO_CONSOLE
377     505       ERROR_MOU_EXTENDED_SG}
MouFlushQuenull378 function MouFlushQue(MouHandle:word):word; cdecl;
379 
380 {Query the mouse driver to determine the current row and column coordinate
381 position of the mouse pointer.}
382 {Mouse pointer position returned in MouPtr, MouHandle is the mouse device
383 handle from a previous MouOpen call.}
384 {Possible return codes:
385     0         NO_ERROR
386     385       ERROR_MOUSE_NO_DEVICE
387     466       ERROR_MOU_DETACHED
388     501       ERROR_MOUSE_NO_CONSOLE
389     505       ERROR_MOU_EXTENDED_SG}
390 {Remarks:
391 * For a text window (VIO) application, the text window is a view on the
392   larger logical video buffer (LVB). The mouse pointer can be outside that
393   view and still be within the extent of the LVB. MouGetPtrPos then returns
394   the coordinates of the cell under the mouse pointer. If the pointer is
395   outside the LVB image extent, the coordinates of the nearest LVB cell are
396   returned. In either case, the LVB is scrolled until the reported LVB cell
397   appears within the view window.}
MouGetPtrPosnull398 function MouGetPtrPos(var MouPtr:TPtrLoc;MouHandle:word):word; cdecl;
399 
400 {Direct the mouse driver to set a new row and column coordinate position for
401 the mouse pointer.}
402 {MouPtr contains the new pointer coordinates, MouHandle is the mouse device
403 handle from a previous MouOpen call.}
404 {Possible return codes:
405     0         NO_ERROR
406     385       ERROR_MOUSE_NO_DEVICE
407     387       ERROR_MOUSE_INV_PARMS
408     466       ERROR_MOU_DETACHED
409     501       ERROR_MOUSE_NO_CONSOLE
410     505       ERROR_MOU_EXTENDED_SG}
411 {Remarks:
412 * The application must ensure that the coordinate position specified conforms
413   to the current display mode orientation for the session. Pel values must
414   be used for graphics modes and character values for text modes.
415 * This function has no effect on the display's current collision area
416   definition as specified by the MouDrawPtr call. If the mouse pointer image
417   is directed into a defined collision area, the pointer image is not drawn
418   until either the pointer is moved outside the collision area or the collision
419   area is released by the MouDrawPtr call.}
MouSetPtrPosnull420 function MouSetPtrPos(const MouPtr:TPtrLoc;MouHandle:word):word; cdecl;
421 
422 {Set the pointer shape and size to be used as the mouse device pointer image
423 for all applications in a session.}
424 {ImageBuf contains the bit image used by the mouse device driver as the pointer
425 shape for that session. The buffer consists of AND and XOR pointer masks
426 in a format meaningful to the pointer draw device driver (see remarks bellow),
427 ImageInfo contains the necessary data for the pointer draw device driver to
428 build a row-by-column image for each bit plan for the current display mode,
429 MouHandle is the mouse device handle from a previous MouOpen call.}
430 {Possible return codes:
431     0         NO_ERROR
432     385       ERROR_MOUSE_NO_DEVICE
433     387       ERROR_MOUSE_INV_PARMS
434     466       ERROR_MOU_DETACHED
435     501       ERROR_MOUSE_NO_CONSOLE
436     505       ERROR_MOU_EXTENDED_SG}
437 {Remarks:
438 * An application passes a data image to the mouse device driver that the mouse
439   driver applies to the screen whenever the logical pointer position is not
440   located in the application-defined collision area. The application
441   synchronizes use of the screen with the mouse driver by way of MouRemovePtr
442   and MouDrawPtr.
443 * The pointer shape is dependent on the display device driver used to support
444   the display device. OS/2 supports text and graphics modes. These modes are
445   restricted to modes 0 through 7, depending on the display device. Character
446   modes (modes 0, 1, 2, 3, and 7) support the pointer cursor only as a reverse
447   block character. This reverse block character has a character height
448   and width equal to 1.
449 * The pointer shape is mapped by the Pointer Draw Device Driver and determined
450   completely by the application. The height and width may vary from 1 through
451   the pel size of the display screen. For restrictions concerning the Pointer
452   Draw Device Driver, see IBM Operating System/2 Version 1.2 I/O Subsystems And
453   Device Support Volume 1.
454 * For CGA compatible text modes (0, 1, 2, and 3) the following describes
455   the AND and XOR pointer mask bit definitions for each character cell
456   of the masks. Bit values are:
457     Bit       Description
458     15        Blinking
459     14-12     Background color
460     11        Intensity
461     10-8      Foreground color
462     7-0       Character
463 * For other custom displays and for the extended modes of the EGA attachment,
464   it is possible to set the display to modes that require multiple bit planes.
465   In these cases, the area sized by the row and column limits must be repeated
466   for each bit plane supported in that mode. Consequently, the calling process
467   must supply enough data to allow the mouse device driver to draw the pointer
468   shape on all currently supported bit planes in that session. For text modes,
469   row and column offset must equal 0.}
MouSetPtrShapenull470 function MouSetPtrShape(var ImageBuf;var ImageInfo:TPtrShape;
471                                                    MouHandle:word):word; cdecl;
MouSetPtrShapenull472 function MouSetPtrShape(ImageBuf:pointer;var ImageInfo:TPtrShape;
473                                                    MouHandle:word):word; cdecl;
474 
475 {Get (copy) the mouse pointer shape for the session.}
476 {The pointer bit image is returned in ImageBuf (see MouSetPtrShape description
477 for information about the resulting content of this buffer), the size of the
478 pointer image buffer must be supplied in ImageInfo.cb (if the value is too
479 small, the true length is placed in this field and an error is returned),
480 on return, ImageInfo is filled with mouse pointer information, MouHandle is
481 the mouse device handle from a previous MouOpen call.}
482 {Possible return codes:
483     0         NO_ERROR
484     385       ERROR_MOUSE_NO_DEVICE
485     387       ERROR_MOUSE_INV_PARMS
486     466       ERROR_MOU_DETACHED
487     501       ERROR_MOUSE_NO_CONSOLE
488     505       ERROR_MOU_EXTENDED_SG}
489 {Remarks:
490 * The application passes a parameter list with the same meaning as defined
491   for MouSetPtrShape to the mouse device driver. The mouse device driver
492   copies the parameters that describe the pointer shape and attributes into
493   the pointer definition control block pointed to by the PtrDefRec parameter.
494   The word 0 (buffer length = cb) pointer definition record parameter field
495   must contain the size in bytes of the application buffer where the device
496   driver is to insert the session's pointer image. All other words in
497   the parameter list are returned to the application by MouGetPtrShape.
498 * For all OS/2 system-supported modes, size of the pointer image buffer
499   is specified in bytes and is equal to:
500     1) Mono & Text Modes:
501         For text mode, height and width must be 1, so length is always 4.
502 
503         size = (height in chars) * (width in chars) * 2 * 2 = 1 * 1 * 2 * 2 = 4
504 
505     2) Graphics Mode:
506         Width-in-pels must be a multiple of 8.
507 
508         size = (height in pels) * (width in pels) * (bits per pel) * 2 / 8
509 
510         a) Modes 4 and 5 (320 X 200)
511 
512             size = (height) * (width) * 2 * 2 / 8
513 
514         b) Mode 6 (640 X 200)
515 
516             size = (height) * (width) * 1 * 2 / 8
517 * If the buffer size is insufficient, the cb field contains the actual size
518   in bytes of the returned pointer image.
519 * The pointer shape may be set by the application with MouSetPtrShape or may
520   be the default image provided by the installed Pointer Device Driver.}
MouGetPtrShapenull521 function MouGetPtrShape(var ImageBuf;var ImageInfo:TPtrShape;
522                                                    MouHandle:word):word; cdecl;
MouGetPtrShapenull523 function MouGetPtrShape(ImageBuf:pointer;var ImageInfo:TPtrShape;
524                                                    MouHandle:word):word; cdecl;
525 
526 {Return status flags for the installed mouse device driver.}
527 {The current status flag settings for the installed mouse device driver are
528 returned in Status - see MOUSE_QUEUEBUSY, MOUSE_BLOCKREAD, MOUSE_FLUSH,
529 MOUSE_UNSUPPORTED_MODE, MOUSE_DISABLED and MOUSE_MICKEYS constants (other bits
530 are reserved and set to zero), MouHandle is the mouse device handle from
531 a previous MouOpen call.}
532 {Possible return codes:
533     0         NO_ERROR
534     385       ERROR_MOUSE_NO_DEVICE
535     466       ERROR_MOU_DETACHED
536     501       ERROR_MOUSE_NO_CONSOLE
537     505       ERROR_MOU_EXTENDED_SG}
MouGetDevStatusnull538 function MouGetDevStatus(var Status:word;MouHandle:word):word; cdecl;
539 
540 {Return the number of buttons supported on the installed mouse driver.}
541 {Number of physical buttons (1..3) returned in ButtonCount, MouHandle is
542 the mouse device handle from a previous MouOpen call.}
543 {Possible return codes:
544     0         NO_ERROR
545     385       ERROR_MOUSE_NO_DEVICE
546     466       ERROR_MOU_DETACHED
547     501       ERROR_MOUSE_NO_CONSOLE
548     505       ERROR_MOU_EXTENDED_SG}
MouGetNumButtonsnull549 function MouGetNumButtons(var ButtonCount:word;MouHandle:word):word; cdecl;
550 
551 {Return the number of mickeys in each centimeter for the installed mouse
552 driver.}
553 {Number of physical mouse motion units (mickeys) in each centimeter (a constant
554 based upon the attached mouse device) returned in MickeyCnt, MouHandle is
555 the mouse device handle from a previous MouOpen call.}
556 {Possible return codes:
557     0         NO_ERROR
558     385       ERROR_MOUSE_NO_DEVICE
559     466       ERROR_MOU_DETACHED
560     501       ERROR_MOUSE_NO_CONSOLE
561     505       ERROR_MOU_EXTENDED_SG}
MouGetNumMickeysnull562 function MouGetNumMickeys(var MickeyCnt:word;MouHandle:word):word; cdecl;
563 
564 {Read an event from the mouse device FIFO event queue.}
565 {The mouse event queue is returned in Event, WaitFlag determines the action to
566 take when MouReadEventQue is issued and no event is available (the mouse event
567 queue is empty) - see MOU_NOWAIT and MOU_WAIT constants, MouHandle is the mouse
568 device handle from a previous MouOpen call.}
569 {Possible return codes:
570     0         NO_ERROR
571     385       ERROR_MOUSE_NO_DEVICE
572     387       ERROR_MOUSE_INV_PARMS
573     393       ERROR_MOUSE_NO_DATA
574     466       ERROR_MOU_DETACHED
575     501       ERROR_MOUSE_NO_CONSOLE
576     505       ERROR_MOU_EXTENDED_SG}
577 {Remarks:
578 * The types of queued events are directly affected by the current value of
579   the Mouse EventMask. MouSetEventMask is used to indicate the types of events
580   desired, and MouGetEventMask is used to query the current value of the mask.
581   Refer to these functions for further explanation of the masking of events.
582   Recognition of the mouse transition depends on the use of MouState returned
583   in the event record. The application should focus on bit transitions that
584   occur in this word. It is important to properly set the event mask with
585   MouSetEventMask for reporting the state transitions.
586   Event.fs reports the state of the mouse that resulted from the action that
587   caused the event. The action can be pressing or releasing a button, and/or
588   moving the mouse. All status is given, regardless of the EventMask that
589   was used to determine whether or not to report the event.
590   For example, assume the EventMask indicates that the application wishes only
591   button 1 events. The EventMask has only bits 1 and 2 set in this case. Also
592   assume the current state of the mouse is no buttons down, and mouse is not
593   moving. At this point, button 1 is pressed causing an event; the status shows
594   button 1 down (bit 2 set). Next the mouse is moved, thereby causing more
595   events; status shows bit 1 set. Finally, mouse is stopped and button 1 is
596   released. The event shows status with no bits set.
597   Next, button 2 is pressed. No event occurs. Mouse is then moved; again,
598   no event. Then, while mouse is still in motion, button 1 is pressed; an event
599   is generated with bits 1 and 3 set in the state word. While mouse is still
600   in motion, both buttons are released. Because button 1 changes states,
601   an event occurs. The state word has bit 0 set. Finally, mouse is stopped.
602   No event occurs, again because no button 1 transition has taken place.
603 * The Event.Row and Event.Col fields may contain either absolute display
604   coordinates or relative mouse motion in mickeys. See MouSetDevStatus for
605   additional information.}
MouReadEventQuenull606 function MouReadEventQue(var Event:TMouEventInfo;var WaitFlag:word;
607                                                    MouHandle:word):word; cdecl;
608 
609 {Return the current status for the mouse device driver event queue.}
610 {Mouse queue status returned in MouseQInfo, MouHandle is the mouse device
611 handle from a previous MouOpen call.}
612 {Possible return codes:
613     0         NO_ERROR
614     385       ERROR_MOUSE_NO_DEVICE
615     466       ERROR_MOU_DETACHED
616     501       ERROR_MOUSE_NO_CONSOLE
617     505       ERROR_MOU_EXTENDED_SG}
MouGetNumQueElnull618 function MouGetNumQueEl(var MouseQInfo:TMouQueInfo;MouHandle:word):word; cdecl;
619 
620 {Return the current value of the mouse event queue mask.}
621 {The current mouse device driver's event mask (as previously set by
622 MouSetEventMask call) is returned in EventMask - see MOUSE_MOTION,
623 MOUSE_MOTION_WITH_BN1_DOWN, MOUSE_BN1_DOWN, MOUSE_MOTION_WITH_BN2_DOWN,
624 MOUSE_BN2_DOWN, MOUSE_MOTION_WITH_BN3_DOWN and MOUSE_BN3_DOWN constants (other
625 bits are reserved and set to zero, MouHandle is the mouse device handle from
626 a previous MouOpen call.}
627 {Possible return codes:
628     0         NO_ERROR
629     385       ERROR_MOUSE_NO_DEVICE
630     466       ERROR_MOU_DETACHED
631     501       ERROR_MOUSE_NO_CONSOLE
632     505       ERROR_MOU_EXTENDED_SG}
633 {Remarks:
634 * Buttons are logically numbered from left to right.}
MouGetEventMasknull635 function MouGetEventMask(var EventMask:word;MouHandle:word):word; cdecl;
636 
637 {Assign a new event mask to the current mouse device driver.}
638 {EventMask contains the mask indicating what mouse events are to be placed on
639 the event queue (see MouReadEventQue) and which events are to be ignored - see
640 MOUSE_MOTION, MOUSE_MOTION_WITH_BN1_DOWN, MOUSE_BN1_DOWN,
641 MOUSE_MOTION_WITH_BN2_DOWN, MOUSE_BN2_DOWN, MOUSE_MOTION_WITH_BN3_DOWN and
642 MOUSE_BN3_DOWN constants (other bits reserved and set to zero; a bit set to
643 zero means that the associated type of event is not reported to the
644 application, mouse buttons are always numbered from left to right - when the
645 mouse is properly positioned for use, the left-hand button is button 1),
646 MouHandle is the mouse device handle from a previous MouOpen call.}
647 {Possible return codes:
648     0         NO_ERROR
649     385       ERROR_MOUSE_NO_DEVICE
650     466       ERROR_MOU_DETACHED
651     501       ERROR_MOUSE_NO_CONSOLE
652     505       ERROR_MOU_EXTENDED_SG}
653 {Remarks:
654 * Setting a bit in the event mask means that the associated event is reported
655   on the mouse FIFO event queue. See MouReadEventQue for examples of event
656   mask use.}
MouSetEventMasknull657 function MouSetEventMask(var EventMask:word;MouHandle:word):word; cdecl;
658 
659 {Return scaling factors for the current mouse device (a pair of 1-word
660 values).}
661 {Current row and column coordinate scaling factors (1 <= factor <= 32767)
662 returned in Scale (see MouSetScaleFact for more information), MouHandle is
663 the mouse device handle from a previous MouOpen call.}
664 {Possible return codes:
665     0         NO_ERROR
666     385       ERROR_MOUSE_NO_DEVICE
667     466       ERROR_MOU_DETACHED
668     501       ERROR_MOUSE_NO_CONSOLE
669     505       ERROR_MOU_EXTENDED_SG}
670 {Remarks:
671 * The units of the scale factor depend on the mode of the display screen
672   for the session. If the screen is operating in text mode, the scaling units
673   are relative to characters. If the screen is operating in graphics mode,
674   the scaling units are relative to pels.}
MouGetScaleFactnull675 function MouGetScaleFact(var Scale:TScaleFact;MouHandle:word):word; cdecl;
676 
677 {Assign to the current mouse device driver a new pair of 1-word scaling
678 factors.}
679 {Scale contains the new row and column coordinate scaling factors (1 <= factor
680 <= 32767), MouHandle is the mouse device handle from a previous MouOpen call.}
681 {Possible return codes:
682     0         NO_ERROR
683     385       ERROR_MOUSE_NO_DEVICE
684     387       ERROR_MOUSE_INV_PARMS
685     466       ERROR_MOU_DETACHED
686     501       ERROR_MOUSE_NO_CONSOLE
687     505       ERROR_MOU_EXTENDED_SG}
688 {Remarks:
689 * MouSetScaleFact sets the mickey-to-pixel ratio for mouse motion. The row
690   scale and column scale ratios specify a number of mickeys for each 8 pixels.
691   The default value for the row scale is 16 mickeys for each 8 pixels. The
692   default value for the column scale is 8 mickeys to 8 pixels.
693 * The number of pixels moved does not have to correspond 1-to-1 with the number
694   of mickeys the mouse moves. The scaling factor defines a sensitivity
695   for the mouse that is a ratio of the number of mickeys required to move
696   the cursor 8 pixels on the screen. The sensitivity determines at what rate
697   the cursor moves on the screen.}
MouSetScaleFactnull698 function MouSetScaleFact(const Scale:TScaleFact;MouHandle:word):word; cdecl;
699 
700 {Open the mouse device for the current session.}
701 {DriverName contains the name of the pointer draw device driver to be used as
702 the pointer-image drawing routine for this session (such device driver must be
703 included in the CONFIG.SYS file at system start-up time) or is nil (the default
704 pointer draw device driver supplied by the system is used then), mouse device
705 handle is returned in MouHandle.}
706 {Possible return codes:
707     0         NO_ERROR
708     385       ERROR_MOUSE_NO_DEVICE
709     390       ERROR_MOUSE_INV_MODULE_PT
710     466       ERROR_MOU_DETACHED
711     501       ERROR_MOUSE_NO_CONSOLE
712     505       ERROR_MOU_EXTENDED_SG}
713 {Remarks:
714 * MouOpen initializes the mouse functions to a known state. The application
715   may have to issue additional mouse functions to establish the environment
716   it desires. For example, after the MouOpen, the collision area is defined
717   to be the size of the entire display. Therefore, to get the pointer to be
718   displayed, the application must issue a MouDrawPtr to remove the collision
719   area.
720 * The state of the mouse after the first MouOpen is:
721   - Row/Col scale factors set to 16/8 (see MouSetScaleFact)
722   - all events reported (see MouSetEventMask)
723   - empty event queue (see MouReadEventQue and MouGetNumQueEl)
724   - all user settable Device Status bits reset (set to zero;
725     see MouSetDevStatus)
726   - pointer set to center of screen if valid display mode is set (see
727     MouSetPtrPos)
728   - pointer shape set to the default for the pointer device driver currently
729     registered in the session (see MouSetPtrShape)
730   - collision area equal to full screen (see MouDrawPtr and MouRemovePtr)
731 * DriverName has a different definition when the caller is the Base Video
732   Subsystem (BVS). However, this implies direct calling of the 16-bit routine,
733   which is not supported currently. In such case the selector portion
734   of the pointer is zero, the offset portion is non-zero and contains a display
735   configuration number (sequentially numbered where 1 is the first display
736   configuration). The MouOpen call issued by BVS is executed on the VioSetMode
737   path. Using the display configuration number passed on the MouOpen call, the
738   Base Mouse Subsystem can detect a change in display configurations. This form
739   of the MouOpen call is not recommended for applications. Applications should
740   either send the name of the pointer draw device driver or nil.}
MouOpennull741 function MouOpen(DriverName:PChar;var MouHandle:word):word; cdecl;
MouOpennull742 function MouOpen(DriverName:string;var MouHandle:word):word;
743 
744 {Close the mouse device for the current session.}
745 {MouHandle is the mouse device handle from a previous MouOpen call.}
746 {Possible return codes:
747     0         NO_ERROR
748     385       ERROR_MOUSE_NO_DEVICE
749     466       ERROR_MOU_DETACHED
750     501       ERROR_MOUSE_NO_CONSOLE
751     505       ERROR_MOU_EXTENDED_SG}
752 {Remarks:
753 * MouClose closes the mouse device for the current session and removes the
754   mouse device driver handle from the list of valid open mouse device
755   handles.}
MouClosenull756 function MouClose(MouHandle:word):word; cdecl;
757 
758 {Notify the mouse device driver that the area defined by the passed parameters
759 if for exclusive use of the application. This area is defined as the
760 "collision" area and is not available to the mouse device driver when drawing
761 pointer images.}
762 {ProtectArea is the pointer shape collision area, MouHandle is the mouse device
763 handle from a previous MouOpen call.}
764 {Possible return codes:
765     0         NO_ERROR
766     385       ERROR_MOUSE_NO_DEVICE
767     387       ERROR_MOUSE_INV_PARMS
768     466       ERROR_MOU_DETACHED
769     501       ERROR_MOUSE_NO_CONSOLE
770     505       ERROR_MOU_EXTENDED_SG}
771 {Remarks:
772 * MouRemovePtr may be issued by any process in the session. However, only one
773   collision area is active at a time. Each MouRemovePtr command has the effect
774   of resetting the collision area to the location and area specified
775   by the current command.
776 * If the logical pointer position is outside of the collision area specified
777   by the latest MouRemovePtr command, the pointer image is drawn.
778 * The MouDrawPtr command effectively cancels the MouRemovePtr command
779   and allows the pointer to be drawn anywhere on the screen, until a new
780   MouRemovePtr command is issued.}
MouRemovePtrnull781 function MouRemovePtr(var ProtectArea:TNoPtrRect;MouHandle:word):word; cdecl;
782 
783 {Notify the mouse device driver that an area previously restricted
784 to the pointer image is now available to the mouse device driver.}
785 {MouHandle is the mouse device handle from a previous MouOpen call.}
786 {Possible return codes:
787     0         NO_ERROR
788     385       ERROR_MOUSE_NO_DEVICE
789     466       ERROR_MOU_DETACHED
790     501       ERROR_MOUSE_NO_CONSOLE
791     505       ERROR_MOU_EXTENDED_SG}
792 {Remarks:
793 * The collision area (the pointer image restricted area) is established by
794   MouOpen and by MouRemovePtr. MouDrawPtr nullifies the effect of the
795   MouRemovePtr command. If there was no previous MouDrawPtr command or if a
796   previous  MouDrawPtr command has already nullified the collision area, the
797   MouRemovePtr command is effectively a null operation.
798 * This call is required to begin session pointer image drawing. Immediately
799   after MouOpen is issued, the collision area is defined as the size of the
800   display. A MouDrawPtr is issued to begin pointer drawing after the
801   MouOpen.}
MouDrawPtrnull802 function MouDrawPtr(MouHandle:word):word; cdecl;
803 
804 {Set the mouse device driver status flags for the installed mouse device
805 driver.}
806 {Status contains the desired status flag settings (2-byte set, only the
807 high-order byte has meaning - see MOUSE_DISABLED and MOUSE_MICKEYS constants;
808 other bits are reserved and set to zero). MouHandle is the mouse device handle
809 from a previous MouOpen call.}
810 {Possible return codes:
811     0         NO_ERROR
812     385       ERROR_MOUSE_NO_DEVICE
813     387       ERROR_MOUSE_INV_PARMS
814     466       ERROR_MOU_DETACHED
815     501       ERROR_MOUSE_NO_CONSOLE
816     505       ERROR_MOU_EXTENDED_SG}
817 {Remarks:
818 * MouSetDevStatus is the complement to MouGetDevStatus. However, not all status
819   flags may be set with MouSetDevStatus. Only the flags corresponding
820   to the following functions may be modified:
821   - Return data in mickeys
822     Normally, mouse data is returned to the application with the absolute
823     display mode coordinates of the pointer image position on the display
824     screen. By setting this status flag, mouse data is returned in relative
825     mickeys, a unit of mouse movement.
826   - Don't call pointer draw device
827     Normally, the pointer draw device driver is called for all drawing
828     operations. By setting this status flag, the mouse device driver does not
829     call the pointer draw device driver. The application must draw any required
830     pointer image on the screen.}
MouSetDevStatusnull831 function MouSetDevStatus(var Status:word;MouHandle:word):word; cdecl;
832 
833 {Initialize mouse pointer draw support for DOS mode.}
834 {Name of the Pointer Draw Device Driver used as the pointer-image drawing
835 routine for the DOS mode session must sent in DriverName; the name of the
836 device driver must be included in the CONFIG.SYS file at system start-up time.}
837 {Possible return codes:
838     0         NO_ERROR
839     385       ERROR_MOUSE_NO_DEVICE
840     466       ERROR_MOU_DETACHED
841     412       ERROR_MOUSE_SMG_ONLY
842     501       ERROR_MOUSE_NO_CONSOLE
843     505       ERROR_MOU_EXTENDED_SG}
844 {Remarks:
845 * MouInitReal is issued by the Base Video Subsystem at system initialization
846   time.
847 * The DOS mode mouse API (INT 33h), in contrast to the OS/2 mode Mouse API,
848   does not contain an OPEN command. In addition, there is only one session
849   for DOS mode.
850 * The default pointer draw routine for DOS mode is located in the same pointer
851   draw device driver, POINTER$, that is used for OS/2 mode. Establishing
852   addressability to the pointer draw routine must be done during system
853   initialization. This requires passing the entry point of the DOS mode pointer
854   draw routine to the mouse device driver. This is the purpose
855   of the MouInitReal call. It passes the address of the default, power-up
856   pointer draw routine for DOS mode to the mouse device driver. This
857   initialization is transparent to applications.
858 * This call is for use only by the Base Video Subsystem when invoked during
859   system initialization under the shell/session manager PID.
860 * The error code ERROR_MOUSE_SMG_ONLY is valid from shell process only.
861 * When using direct calls to the 16-bit routine, another version of this call
862   is supported as well - if the selector part of the far pointer is zero
863   and the offset portion is non-zero, the offset portion identifies the
864   power-up display configuration. However, this isn't possible in the current
865   implementation (using 32-bit wrap-around function supplied in EMXWRAP.DLL).}
MouInitRealnull866 function MouInitReal(DriverName:PChar):word; cdecl;
MouInitRealnull867 function MouInitReal(DriverName:string):word;
868 
869 {Synchronize the mouse subsystem with the mouse device driver.}
870 {WaitFlag specifies whether the routine should wait for the mouse device driver
871 being free - see MOU_NOWAIT and MOU_WAIT constants.}
872 {Possible return codes:
873     0         NO_ERROR
874     121       ERROR_SEM_TIMEOUT}
875 {Remarks:
876 * MouSynch blocks all other threads within a session until the semaphore
877   clears (returns from the subsystem to the router). To ensure proper
878   synchronization, MouSynch should be issued by a mouse subsystem if it intends
879   to access dynamically modifiable shared data for each session or if it
880   intends to issue a DosDevIOCtl. MouSynch does not protect globally shared
881   data from threads in other sessions.}
MouSynchnull882 function MouSynch(WaitFlag:word):word; cdecl;
883 
MouGetThresholdnull884 function MouGetThreshold(var MouThreshold:TThreshold;MouHandle:word):word;
885                                                                          cdecl;
886 
MouSetThresholdnull887 function MouSetThreshold(var MouThreshold:TThreshold;MouHandle:word):word;
888                                                                          cdecl;
889 
890 (*
891 following two functions are undocumented and not present within C header files:
892 
893 function MouGetHotKey(var ButtonBits:word;MouHandle:word):word;
894 
895 function MouSetHotKey(var ButtonBits:word;MouHandle:word):word;
896 *)
897 
898 (* Following routines are not supported
899    (just have a look in some C header
900    file - you probably won't find it there either).
901 MouFree (index 4)
902 MouShellInit (index 12)
903 *)
904 
905 {***************************************************************************}
906 implementation
907 {***************************************************************************}
908 
909 
MouRegisternull910 function MouRegister(ModuleName,ProcName:PChar;FnMask:cardinal):word; cdecl;
911 external 'EMXWRAP' index 324;
912 {external 'MOUCALLS' index 24;}
913 
MouRegisternull914 function MouRegister(ModuleName,ProcName:string;FnMask:cardinal):word;
915 begin
916     if byte(ModuleName[0])>8 then byte(ModuleName[0]):=8;
917     ModuleName[Succ(byte(ModuleName[0]))]:=#0;
918     if byte(ProcName[0])>32 then byte(ProcName[0]):=32;
919     ProcName[Succ(byte(ProcName[0]))]:=#0;
920     MouRegister:=MouRegister(@ModuleName[1],@ProcName[1],FnMask);
921 end;
922 
MouDeRegisternull923 function MouDeRegister:word; cdecl;
924 external 'EMXWRAP' index 314;
925 {external 'MOUCALLS' index 14;}
926 
MouFlushQuenull927 function MouFlushQue(MouHandle:word):word; cdecl;
928 external 'EMXWRAP' index 307;
929 {external 'MOUCALLS' index 7;}
930 
MouGetPtrPosnull931 function MouGetPtrPos(var MouPtr:TPtrLoc;MouHandle:word):word; cdecl;
932 external 'EMXWRAP' index 319;
933 {external 'MOUCALLS' index 19;}
934 
MouSetPtrPosnull935 function MouSetPtrPos(const MouPtr:TPtrLoc;MouHandle:word):word; cdecl;
936 external 'EMXWRAP' index 321;
937 {external 'MOUCALLS' index 21;}
938 
MouSetPtrShapenull939 function MouSetPtrShape(ImageBuf:pointer;var ImageInfo:TPtrShape;
940                                                    MouHandle:word):word; cdecl;
941 external 'EMXWRAP' index 302;
942 {external 'MOUCALLS' index 2;}
943 
MouSetPtrShapenull944 function MouSetPtrShape(var ImageBuf;var ImageInfo:TPtrShape;
945                                                    MouHandle:word):word; cdecl;
946 external 'EMXWRAP' index 302;
947 {external 'MOUCALLS' index 2;}
948 
MouGetPtrShapenull949 function MouGetPtrShape(var ImageBuf;var ImageInfo:TPtrShape;
950                                                    MouHandle:word):word; cdecl;
951 external 'EMXWRAP' index 301;
952 {external 'MOUCALLS' index 1;}
953 
MouGetPtrShapenull954 function MouGetPtrShape(ImageBuf:pointer;var ImageInfo:TPtrShape;
955                                                    MouHandle:word):word; cdecl;
956 external 'EMXWRAP' index 301;
957 {external 'MOUCALLS' index 1;}
958 
MouGetDevStatusnull959 function MouGetDevStatus(var Status:word;MouHandle:word):word; cdecl;
960 external 'EMXWRAP' index 322;
961 {external 'MOUCALLS' index 22;}
962 
MouGetNumButtonsnull963 function MouGetNumButtons(var ButtonCount:word;MouHandle:word):word; cdecl;
964 external 'EMXWRAP' index 308;
965 {external 'MOUCALLS' index 8;}
966 
MouGetNumMickeysnull967 function MouGetNumMickeys(var MickeyCnt:word;MouHandle:word):word; cdecl;
968 external 'EMXWRAP' index 303;
969 {external 'MOUCALLS' index 3;}
970 
MouReadEventQuenull971 function MouReadEventQue(var Event:TMouEventInfo;var WaitFlag:word;
972                                                    MouHandle:word):word; cdecl;
973 external 'EMXWRAP' index 320;
974 {external 'MOUCALLS' index 20;}
975 
MouGetNumQueElnull976 function MouGetNumQueEl(var MouseQInfo:TMouQueInfo;MouHandle:word):word; cdecl;
977 external 'EMXWRAP' index 313;
978 {external 'MOUCALLS' index 13;}
979 
MouGetEventMasknull980 function MouGetEventMask(var EventMask:word;MouHandle:word):word; cdecl;
981 external 'EMXWRAP' index 315;
982 {external 'MOUCALLS' index 15;}
983 
MouSetEventMasknull984 function MouSetEventMask(var EventMask:word;MouHandle:word):word; cdecl;
985 external 'EMXWRAP' index 316;
986 {external 'MOUCALLS' index 16;}
987 
MouGetScaleFactnull988 function MouGetScaleFact(var Scale:TScaleFact;MouHandle:word):word; cdecl;
989 external 'EMXWRAP' index 306;
990 {external 'MOUCALLS' index 6;}
991 
MouSetScaleFactnull992 function MouSetScaleFact(const Scale:TScaleFact;MouHandle:word):word; cdecl;
993 external 'EMXWRAP' index 311;
994 {external 'MOUCALLS' index 11;}
995 
MouOpennull996 function MouOpen(DriverName:PChar;var MouHandle:word):word; cdecl;
997 external 'EMXWRAP' index 317;
998 {external 'MOUCALLS' index 17;}
999 
MouOpennull1000 function MouOpen(DriverName:string;var MouHandle:word):word;
1001 
1002 var B:byte;
1003 
1004 begin
1005     B:=byte(DriverName[0]);
1006     if B=0 then MouOpen:=MouOpen(nil,MouHandle) else
1007     begin
1008         if B<>255 then
1009         begin
1010             DriverName[Succ(B)]:=#0;
1011             MouOpen:=MouOpen(@DriverName[1],MouHandle);
1012         end else
1013         begin
1014             Move(DriverName[1],DriverName[0],B);
1015             DriverName[B]:=#0;
1016             MouOpen:=MouOpen(@DriverName,MouHandle);
1017         end;
1018     end;
1019 end;
1020 
MouClosenull1021 function MouClose(MouHandle:word):word; cdecl;
1022 external 'EMXWRAP' index 309;
1023 {external 'MOUCALLS' index 9;}
1024 
MouRemovePtrnull1025 function MouRemovePtr(var ProtectArea:TNoPtrRect;MouHandle:word):word; cdecl;
1026 external 'EMXWRAP' index 318;
1027 {external 'MOUCALLS' index 18;}
1028 
MouDrawPtrnull1029 function MouDrawPtr(MouHandle:word):word; cdecl;
1030 external 'EMXWRAP' index 326;
1031 {external 'MOUCALLS' index 26;}
1032 
MouSetDevStatusnull1033 function MouSetDevStatus(var Status:word;MouHandle:word):word; cdecl;
1034 external 'EMXWRAP' index 326;
1035 {external 'MOUCALLS' index 26;}
1036 
MouInitRealnull1037 function MouInitReal(DriverName:PChar):word; cdecl;
1038 external 'EMXWRAP' index 327;
1039 {external 'MOUCALLS' index 27;}
1040 
MouInitRealnull1041 function MouInitReal(DriverName:string):word;
1042 
1043 var B:byte;
1044 
1045 begin
1046     B:=byte(DriverName[0]);
1047     if B=0 then MouInitReal:=MouInitReal(nil) else
1048     begin
1049         if B<>255 then
1050         begin
1051             DriverName[Succ(B)]:=#0;
1052             MouInitReal:=MouInitReal(@DriverName[1]);
1053         end else
1054         begin
1055             Move(DriverName[1],DriverName[0],B);
1056             DriverName[B]:=#0;
1057             MouInitReal:=MouInitReal(@DriverName);
1058         end;
1059     end;
1060 end;
1061 
MouSynchnull1062 function MouSynch(WaitFlag:word):word; cdecl;
1063 external 'EMXWRAP' index 323;
1064 {external 'MOUCALLS' index 23;}
1065 
MouGetThresholdnull1066 function MouGetThreshold(var MouThreshold:TThreshold;MouHandle:word):word;
1067                                                                          cdecl;
1068 external 'EMXWRAP' index 329;
1069 {external 'MOUCALLS' index 29;}
1070 
MouSetThresholdnull1071 function MouSetThreshold(var MouThreshold:TThreshold;MouHandle:word):word;
1072                                                                          cdecl;
1073 external 'EMXWRAP' index 330;
1074 {external 'MOUCALLS' index 30;}
1075 
1076 
1077 (*
1078 following two functions are undocumented and not present within C header files:
1079 
1080 function MouGetHotKey(var ButtonBits:word;MouHandle:word):word;
1081 external 'MOUCALLS' index 4;
1082 
1083 function MouSetHotKey(var ButtonBits:word;MouHandle:word):word;
1084 external 'MOUCALLS' index 10;
1085 *)
1086 
1087 
1088 end.
1089