moucalls.pas 48 KB

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