moucalls.pas 48 KB

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