1
<?xml version="1.0" encoding="ISO8859-1"?>
5
$Id: gpm.xml,v 1.3 2005/04/29 07:57:29 michael Exp $
6
This file is part of the FPC documentation.
7
Copyright (C) 1997, by Michael Van Canneyt
9
The FPC documentation is free text; you can redistribute it and/or
10
modify it under the terms of the GNU Library General Public License as
11
published by the Free Software Foundation; either version 2 of the
12
License, or (at your option) any later version.
14
The FPC Documentation is distributed in the hope that it will be useful,
15
but WITHOUT ANY WARRANTY; without even the implied warranty of
16
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17
Library General Public License for more details.
19
You should have received a copy of the GNU Library General Public
20
License along with the FPC documentation; see the file COPYING.LIB. If not,
21
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
22
Boston, MA 02111-1307, USA.
26
<short>Interface to GPM (General Purpose Mouse) library</short>
29
The <file>GPM</file> unit implements an interface to <file>libgpm</file>,
30
the console program for mouse handling. This unit was created by Peter
31
Vreman, and is only available on linux.
34
When this unit is used, your program is linked to the C libraries, so
35
you must take care of the C library version. Also, it will only work with
36
version 1.17 or higher of the <file>libgpm</file> library.
40
<element name="_PATH_VARRUN">
41
<short>Location of run PID files directory.</short>
43
<element name="_PATH_DEV">
44
<short>Location of <file>/dev</file> directory. </short>
46
<element name="GPM_NODE_DIR">
47
<short>Where to write socket.</short>
49
<element name="GPM_NODE_DIR_MODE">
50
<short>Mode of socket.</short>
52
<element name="GPM_NODE_PID">
53
<short>Name of PID file.</short>
55
<element name="GPM_NODE_DEV">
56
<short>Device socket filename</short>
58
<element name="GPM_NODE_CTL">
59
<short>Control socket</short>
61
<element name="GPM_NODE_FIFO">
62
<short>FIFO name</short>
64
<element name="GPM_B_LEFT">
65
<short>Left mouse button identifier.</short>
67
<element name="GPM_B_MIDDLE">
68
<short>Middle mouse button identifier.</short>
70
<element name="GPM_B_RIGHT">
71
<short>Right mouse button identifier.</short>
73
<element name="GPM_MOVE">
74
<short>Mouse move event.</short>
76
<element name="GPM_DRAG">
77
<short>Mouse drag event.</short>
79
<element name="GPM_DOWN">
80
<short>Mouse button down event.</short>
82
<element name="GPM_UP">
83
<short>Mouse button up event.</short>
85
<element name="GPM_SINGLE">
86
<short>Mouse single click event.</short>
88
<element name="GPM_DOUBLE">
89
<short>Mouse double click event.</short>
91
<element name="GPM_TRIPLE">
92
<short>Mouse triple click event.</short>
94
<element name="GPM_MFLAG">
95
<short>Motion flag.</short>
97
<element name="GPM_HARD">
100
<element name="GPM_ENTER">
101
<short>Enter area event.</short>
103
<element name="GPM_LEAVE">
104
<short>Leave area event.</short>
106
<element name="GPM_TOP">
107
<short>Top of area.</short>
109
<element name="GPM_BOT">
110
<short>Bottom of area.</short>
112
<element name="GPM_LFT">
113
<short>Left side of area.</short>
115
<element name="GPM_RGT">
116
<short>Right side of area.</short>
118
<element name="TGpmEtype">
119
<short>Type for event type.</short>
121
<element name="TGpmMargin">
122
<short>Type to hold area margin.</short>
124
<element name="PGpmEvent">
125
<short>Pointer to <link id="TGpmEvent"/> record</short>
127
<element name="PGpm_Event">
128
<short>Pointer to <link id="TGpm_Event"/> record</short>
130
<element name="TGpmEvent">
131
<short>Alias for <link id="TGPM_EVent"/> record</short>
133
<element name="Tgpm_event">
134
<short>GPM event record</short>
136
<var>Tgpm_event</var> describes the events that are reported by GPM.
139
<element name="Tgpm_event.buttons">
140
<short>Pressed buttons</short>
142
<element name="Tgpm_event.modifiers">
143
<short>Modifier flags</short>
145
<element name="Tgpm_event.vc">
146
<short>Virtual console</short>
148
<element name="Tgpm_event.dx">
149
<short>Change in horizontal position since last event</short>
151
<element name="Tgpm_event.dy">
152
<short>Change in vertical position since last event</short>
154
<element name="Tgpm_event.x">
155
<short>Horizontal position of event</short>
157
<element name="Tgpm_event.y">
158
<short>Vertical position of event</short>
160
<element name="Tgpm_event.EventType">
161
<short>Event type</short>
163
<element name="Tgpm_event.clicks">
164
<short>Number of clicks</short>
166
<element name="Tgpm_event.margin">
167
<short>Position where mouse cursor left the screen.</short>
169
<element name="TGpmHandler">
170
<short>Mouse event handler callback.</short>
172
<element name="PGpmConnect">
173
<short>Pointer to <link id="TGpmConnect"/> record.</short>
175
<element name="PGpm_Connect">
176
<short>Pointer to <link id="TGpm_Connect"/> record.</short>
178
<element name="TGpmConnect">
179
<short>Alias for <link id="TGpm_Connect"/> record.</short>
181
<element name="TGpm_Connect">
182
<short>GPM server connection information.</short>
184
<element name="TGpm_Connect.eventMask">
185
<short>Mask with events which client is interested in</short>
187
<element name="TGpm_Connect.defaultMask">
188
<short>Mask with events that should be handled with defaults</short>
190
<element name="TGpm_Connect.minMod">
191
<short>Minimum amount of modifiers required for client</short>
193
<element name="TGpm_Connect.maxMod">
194
<short>Maximum amount of modifiers client can handle</short>
196
<element name="TGpm_Connect.pid">
197
<short>PID of connecting application</short>
199
<element name="TGpm_Connect.vc">
200
<short>Virtual console that should be handled.</short>
203
<element name="PGpmRoi">
204
<short>Pointer to <link id="TGpmRoi"/> record.</short>
206
<element name="TGpmRoi">
207
<short>Alias for <link id="TGpm_roi"/>Record</short>
209
<element name="Pgpm_roi">
210
<short>Pointer to <link id="Tgpm_roi"/> record.</short>
212
<element name="Tgpm_roi">
213
<short>Record used to define regions of interest.</short>
215
<element name="Tgpm_roi.xMin">
216
<short>Minimum horizontal position.</short>
218
<element name="Tgpm_roi.xMax">
219
<short>Maximum horizontal position.</short>
221
<element name="Tgpm_roi.yMin">
222
<short>Minimum vertical position.</short>
224
<element name="Tgpm_roi.yMax">
225
<short>Maximum horizontal position.</short>
227
<element name="Tgpm_roi.minMod">
228
<short>Minimum modifiers required</short>
230
<element name="Tgpm_roi.maxMod">
231
<short>Maximum modifiers allowed</short>
233
<element name="Tgpm_roi.eventMask">
234
<short>Events to signal</short>
236
<element name="Tgpm_roi.owned">
239
<element name="Tgpm_roi.handler">
240
<short>Handler to call in case of event.</short>
242
<element name="Tgpm_roi.clientdata">
243
<short>Clientdata to pass to event handler</short>
245
<element name="Tgpm_roi.prev">
246
<short>Previous region of interest.</short>
248
<element name="Tgpm_roi.next">
249
<short>Next region of interest.</short>
251
<element name="gpm_flag">
252
<short>Internal gpm library variable. Do not use.</short>
254
<element name="gpm_fd">
255
<short>Internal gpm library variable. Do not use.</short>
257
<element name="gpm_morekeys">
258
<short>Internal gpm library variable. Do not use.</short>
260
<element name="gpm_zerobased">
261
<short>Internal gpm library variable. Do not use.</short>
263
<element name="gpm_visiblepointer">
264
<short>Internal gpm library variable. Do not use.</short>
266
<element name="gpm_mx">
267
<short>Internal gpm library variable. Do not use.</short>
269
<element name="gpm_my">
270
<short>Internal gpm library variable. Do not use.</short>
272
<element name="gpm_timeout">
273
<short>Internal gpm library variable. Do not use.</short>
275
<element name="_gpm_buf">
276
<short>Internal gpm library variable. Do not use.</short>
278
<element name="_gpm_arg">
279
<short>Internal gpm library variable. Do not use.</short>
281
<element name="gpm_handler">
282
<short>Internal gpm library variable. Do not use.</short>
284
<element name="gpm_data">
285
<short>Internal gpm library variable. Do not use.</short>
287
<element name="gpm_roi_handler">
288
<short>Internal gpm library variable. Do not use.</short>
290
<element name="gpm_roi_data">
291
<short>Internal gpm library variable. Do not use.</short>
293
<element name="gpm_roi">
294
<short>Internal gpm library variable. Do not use.</short>
296
<element name="gpm_current_roi">
297
<short>Internal gpm library variable. Do not use.</short>
299
<element name="gpm_consolefd">
300
<short>Internal gpm library variable. Do not use.</short>
302
<element name="Gpm_HandleRoi">
303
<short>Internal gpm library variable. Do not use.</short>
306
<element name="Gpm_AnyDouble">
307
<short>Check whether event has double click event.</short>
309
<var>Gpm_AnyDouble</var> returns <var>True</var> if <var>EventType</var> contains
310
the <var>GPM_DOUBLE</var> flag, <var>False</var> otherwise.
316
<link id="Gpm_StrictSingle"/>
317
<link id="Gpm_AnySingle"/>
318
<link id="Gpm_StrictDouble"/>
319
<link id="Gpm_StrictTriple"/>
320
<link id="Gpm_AnyTriple"/>
324
<element name="Gpm_AnySingle">
325
<short>Check whether event has a single click event. </short>
327
<var>Gpm_AnySingle</var> returns <var>True</var> if <var>EventType</var> contains
328
the <var>GPM_SINGLE</var> flag, <var>False</var> otherwise.
334
<link id="Gpm_StrictSingle"/>
335
<link id="Gpm_AnyDouble"/>
336
<link id="Gpm_StrictDouble"/>
337
<link id="Gpm_StrictTriple"/>
338
<link id="Gpm_AnyTriple"/>
342
<element name="Gpm_AnyTriple">
343
<short>Check whether event has a triple click event.</short>
345
<var>Gpm_AnySingle</var> returns <var>True</var> if <var>EventType</var> contains
346
the <var>GPM_TRIPLE</var> flag, <var>False</var> otherwise.
352
<link id="Gpm_StrictSingle"/>
353
<link id="Gpm_AnyDouble"/>
354
<link id="Gpm_StrictDouble"/>
355
<link id="Gpm_StrictTriple"/>
356
<link id="Gpm_AnySingle"/>
360
<element name="Gpm_Close">
361
<short>Close connection to GPM server.</short>
364
<var>Gpm_Close</var> closes the current connection, and pops the connection
365
stack; this means that the previous connection becomes active again.
368
The function returns -1 if the current connection is not the last one,
369
and it returns 0 if the current connection is the last one.
372
for an example, see <link id="Gpm_GetEvent"/>.
379
<link id="Gpm_Open"/>
384
<element name="Gpm_FitValues">
385
<short>Change coordinates to fit physical screen.</short>
387
<var>Gpm_fitValues</var> changes <var>x</var> and <var>y</var> so they fit in the visible
388
screen. The actual mouse pointer is not affected by this function.
394
<link id="Gpm_FitValuesM"/>
398
<element name="Gpm_FitValuesM">
399
<short>Change coordinates to fit margin.</short>
401
<var>Gpm_FitValuesM</var> changes <var>x</var> and <var>y</var> so they fit in the margin
402
indicated by <var>margin</var>. If <var>margin</var> is -1, then the values are fitted
403
to the screen. The actual mouse pointer is not affected by this function.
409
<link id="Gpm_FitValues"/>
413
<element name="Gpm_GetEvent">
414
<short>Get event from event queue.</short>
417
<var>Gpm_GetEvent</var> Reads an event from the file descriptor <var>gpm_fd</var>.
418
This file is only for internal use and should never be called by a client
422
It returns 1 on succes, and -1 on failue.
426
On error, -1 is returned.
429
<link id="Gpm_GetSnapshot"/>
431
<example file="gpmex/gpmex"/>
435
<element name="Gpm_GetLibVersion">
436
<short>Return GPM library version.</short>
439
<var>Gpm_GetLibVersion</var> returns a pointer to a version string, and returns
440
in <var>where</var> an integer representing the version. The version string
441
represents the version of the gpm library.
444
The return value is a pchar, which should not be dealloacted, i.e. it is not
452
<link id="Gpm_GetServerVersion"/>
456
<element name="Gpm_GetServerVersion">
457
<short>Return GPM server version.</short>
460
<var>Gpm_GetServerVersion</var> returns a pointer to a version string, and
461
returns in <var>where</var> an integer representing the version. The version string
462
represents the version of the gpm server program.
465
The return value is a pchar, which should not be dealloacted, i.e. it is not
470
If the gpm program is not present, then the function returns <var>Nil</var>
473
<link id="Gpm_GetLibVersion"/>
477
<element name="Gpm_GetSnapshot">
478
<short>Return servers' current image of mouse state.</short>
481
<var>Gpm_GetSnapshot</var> returns the picture that the server has of the
482
current situation in <var>Event</var>.
483
This call will not read the current situation from the mouse file
484
descriptor, but returns a buffered version.
487
The function returns the number of mouse buttons, or -1 if this information
495
<link id="Gpm_GetEvent"/>
499
<element name="Gpm_LowerRoi">
500
<short>Lower a region of interest in the stack.</short>
503
<var>Gpm_LowerRoi</var> lowers the region of interest <var>which</var> after
504
<var>after</var>. If <var>after</var> is <var>Nil</var>, the region of interest is moved to
505
the bottom of the stack.
508
The return value is the new top of the region-of-interest stack.
515
<link id="Gpm_RaiseRoi"/>
516
<link id="Gpm_PopRoi"/>
517
<link id="Gpm_PushRoi"/>
521
<element name="Gpm_Open">
522
<short>Open connection to GPM server.</short>
525
<var>Gpm_Open</var> opens a new connection to the mouse server. The connection
526
is described by the fields of the <var>conn</var> record of type
527
<link id="TGPMConnect"/>.
530
if <var>Flag</var> is 0, then the application only receives events that come from
531
its own terminal device. If it is negative it will receive all events. If
532
the value is positive then it is considered a console number to which to
536
The return value is -1 on error, or the file descriptor used to communicate
537
with the client. Under an X-Term the return value is -2.
540
for an example, see <link id="Gpm_GetEvent"/>.
544
On Error, the return value is -1.
547
<link id="Gpm_Open"/>
552
<element name="Gpm_PopRoi">
553
<short>Pop region of interest from the stack.</short>
555
<var>Gpm_PopRoi</var> pops the topmost region of interest from the stack.
556
It returns the next element on the stack, or <var>Nil</var> if the current
557
element was the last one.
563
<link id="Gpm_RaiseRoi"/>
564
<link id="Gpm_LowerRoi"/>
565
<link id="Gpm_PushRoi"/>
569
<element name="Gpm_PushRoi">
570
<short>Push region of interest on the stack.</short>
573
<var>Gpm_PushRoi</var> puts a new <em> region of interest</em> on the stack.
574
The region of interest is defined by a rectangle described by the corners
575
<var>(X1,Y1)</var> and <var>(X2,Y2)</var>.
578
The <var>mask</var> describes which events the handler {fun} will handle;
579
<var>ExtraData</var> will be put in the <var>xtradata</var> field of the {TGPM_Roi}
580
record passed to the <var>fun</var> handler.
587
<link id="Gpm_RaiseRoi"/>
588
<link id="Gpm_PopRoi"/>
589
<link id="Gpm_LowerRoi"/>
593
<element name="Gpm_RaiseRoi">
594
<short>Raise region of interest in the stack.</short>
596
<var>Gpm_RaiseRoi</var> raises the <em> region of interest</em> <var>which</var> till it
597
is on top of region <var>before</var>. If <var>before</var> is nil then the region is
598
put on top of the stack. The returned value is the top of the stack.
604
<link id="Gpm_PushRoi"/>
605
<link id="Gpm_PopRoi"/>
606
<link id="Gpm_LowerRoi"/>
610
<element name="Gpm_Repeat">
611
<short>Check for presence of mouse event.</short>
613
<var>Gpm_Repeat</var> returns 1 of no mouse event arrives in the next
614
<var>millisec</var> miiliseconds, it returns 0 otherwise.
620
<link id="Gpm_GetEvent"/>
624
<element name="Gpm_StrictDouble">
625
<short>Check whether event contains only a double-click event.</short>
627
<var>Gpm_StrictDouble</var> returns true if <var>EventType</var> contains only a
628
doubleclick event, <var>False</var> otherwise.
634
<link id="Gpm_StrictSingle"/>
635
<link id="Gpm_AnyTriple"/>
636
<link id="Gpm_AnyDouble"/>
637
<link id="Gpm_StrictTriple"/>
638
<link id="Gpm_AnySingle"/>
642
<element name="Gpm_StrictSingle">
643
<short>Check whether event contains only a single-click event.</short>
645
<var>Gpm_StrictDouble</var> returns <var>True</var> if <var>EventType</var> contains only a
646
singleclick event, <var>False</var> otherwise.
652
<link id="Gpm_AnyTriple"/>
653
<link id="Gpm_StrictDouble"/>
654
<link id="Gpm_AnyDouble"/>
655
<link id="Gpm_StrictTriple"/>
656
<link id="Gpm_AnySingle"/>
660
<element name="Gpm_StrictTriple">
661
<short>Check whether event contains only a triple-click event.</short>
663
<var>Gpm_StrictTriple</var> returns true if <var>EventType</var> contains only a
664
triple click event, <var>False</var> otherwise.
670
<link id="Gpm_AnyTriple"/>
671
<link id="Gpm_StrictDouble"/>
672
<link id="Gpm_AnyDouble"/>
673
<link id="Gpm_StrictSingle"/>
674
<link id="Gpm_AnySingle"/>
678
<element name="GPM_MAGIC">
679
<short>Constant identifying GPM in <link id="gpm_Open"/>.</short>
682
<element name="baseUnix">
683
<short>Basic unix definitions</short>
686
<!-- variable Visibility: default -->
687
<element name="Tgpm_event.wdx">
688
<short>Horizontal size</short>
691
<!-- variable Visibility: default -->
692
<element name="Tgpm_event.wdy">
693
<short>Vertical size</short>
698
</fpdoc-descriptions>