Debian Codegraph @

docs/X11-GUITest.html

raw
1 <?xml version="1.0" ?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3 <html xmlns="http://www.w3.org/1999/xhtml">
4 <head>
5 <title></title>
6 <meta http-equiv="content-type" content="text/html; charset=utf-8" />
7 <link rev="made" href="mailto:root@localhost" />
8 </head>
9
10 <body style="background-color: white">
11
12
13
14 <ul id="index">
15 <li><a href="#NAME">NAME</a></li>
16 <li><a href="#VERSION">VERSION</a></li>
17 <li><a href="#DESCRIPTION">DESCRIPTION</a></li>
18 <li><a href="#DEPENDENCIES">DEPENDENCIES</a></li>
19 <li><a href="#INSTALLATION">INSTALLATION</a></li>
20 <li><a href="#SYNOPSIS">SYNOPSIS</a></li>
21 <li><a href="#FUNCTIONS">FUNCTIONS</a></li>
22 <li><a href="#OTHER-DOCUMENTATION">OTHER DOCUMENTATION</a></li>
23 <li><a href="#COPYRIGHT">COPYRIGHT</a></li>
24 <li><a href="#AUTHOR">AUTHOR</a></li>
25 <li><a href="#CONTRIBUTORS">CONTRIBUTORS</a></li>
26 <li><a href="#CREDITS">CREDITS</a></li>
27 </ul>
28
29 <h1 id="NAME">NAME</h1>
30
31 <p><b>X11::GUITest</b> - Provides GUI testing/interaction routines.</p>
32
33 <h1 id="VERSION">VERSION</h1>
34
35 <p>0.28</p>
36
37 <p>Updates are made available at the following sites:</p>
38
39 <pre><code> http://sourceforge.net/projects/x11guitest
40 http://www.cpan.org</code></pre>
41
42 <p>Please consult &#39;docs/Changes&#39; for the list of changes between module revisions.</p>
43
44 <h1 id="DESCRIPTION">DESCRIPTION</h1>
45
46 <p>This Perl package is intended to facilitate the testing of GUI applications by means of user emulation. It can be used to test/interact with GUI applications; which have been built upon the X library or toolkits (i.e., GTK+, Xt, Qt, Motif, etc.) that &quot;wrap&quot; the X library&#39;s functionality.</p>
47
48 <p>A basic recorder (x11guirecord) is also available, and can be found in the source code repository.</p>
49
50 <h1 id="DEPENDENCIES">DEPENDENCIES</h1>
51
52 <p>An X server with the XTest extensions enabled. This seems to be the norm. If it is not enabled, it usually can be by modifying the X server configuration (i.e., XF86Config).</p>
53
54 <p>The standard DISPLAY environment variable is utilized to determine the host, display, and screen to work with. By default it is usually set to &quot;:0.0&quot; for the localhost. However, by altering this variable one can interact with applications under a remote host&#39;s X server. To change this from a terminal window, one can utilize the following basic syntax: export DISPLAY=&lt;hostname-or-ipaddress&gt;:&lt;display&gt;.&lt;screen&gt; Please note that under most circumstances, xhost will need to be executed properly on the remote host as well.</p>
55
56 <p>There is a known incompatibility between the XTest and Xinerama extensions, which causes the XTestFakeMotionEvent() function to misbehave. When the Xinerama (X server) extension is turned on, this (Perl) extension has been modified to allow one to invoke an alternative function. See Makefile.PL for details.</p>
57
58 <h1 id="INSTALLATION">INSTALLATION</h1>
59
60 <pre><code> perl Makefile.PL
61 make
62 make test
63 make install
64
65 # If the build has errors, you may need to install the following dependencies:
66 # libxt-dev, libxtst-dev
67
68 # If you&#39;d like to install the recorder, use these steps:
69 cd recorder
70 ./autogen.sh
71 ./configure
72 make
73 make install
74 x11guirecord --help</code></pre>
75
76 <h1 id="SYNOPSIS">SYNOPSIS</h1>
77
78 <p>For additional examples, please look under the &#39;eg/&#39; sub-directory from the installation folder.</p>
79
80 <pre><code> use X11::GUITest qw/
81 StartApp
82 WaitWindowViewable
83 SendKeys
84 /;
85
86 # Start gedit application
87 StartApp(&#39;gedit&#39;);
88
89 # Wait for application window to come up and become viewable.
90 my ($GEditWinId) = WaitWindowViewable(&#39;gedit&#39;);
91 if (!$GEditWinId) {
92 die(&quot;Couldn&#39;t find gedit window in time!&quot;);
93 }
94
95 # Send text to it
96 SendKeys(&quot;Hello, how are you?\n&quot;);
97
98 # Close Application (Alt-f, q).
99 SendKeys(&#39;%(f)q&#39;);
100
101 # Handle gedit&#39;s Question window if it comes up when closing. Wait
102 # at most 5 seconds for it.
103 if (WaitWindowViewable(&#39;Question&#39;, undef, 5)) {
104 # DoN&#39;t Save (Alt-n)
105 SendKeys(&#39;%(n)&#39;);
106 }</code></pre>
107
108 <h1 id="FUNCTIONS">FUNCTIONS</h1>
109
110 <p>Parameters enclosed within [] are optional.</p>
111
112 <p>If there are multiple optional parameters available for a function and you would like to specify the last one, for example, you can utilize undef for those parameters you don&#39;t specify.</p>
113
114 <p>REGEX in the documentation below denotes an item that is treated as a regular expression. For example, the regex &quot;^OK$&quot; would look for an exact match for the word OK.</p>
115
116 <dl>
117
118 <dt id="FindWindowLike-TITLEREGEX-WINDOWIDSTARTUNDER">FindWindowLike TITLEREGEX [, WINDOWIDSTARTUNDER]</dt>
119 <dd>
120
121 <p>Finds the window Ids of the windows matching the specified title regex. Optionally one can specify the window to start under; which would allow one to constrain the search to child windows of that window.</p>
122
123 <p>An array of window Ids is returned for the matches found. An empty array is returned if no matches were found.</p>
124
125 <pre><code> my @WindowIds = FindWindowLike(&#39;gedit&#39;);
126 # Only worry about first window found
127 my ($WindowId) = FindWindowLike(&#39;gedit&#39;);</code></pre>
128
129 </dd>
130 </dl>
131
132 <dl>
133
134 <dt id="WaitWindowLike-TITLEREGEX-WINDOWIDSTARTUNDER-MAXWAITINSECONDS">WaitWindowLike TITLEREGEX [, WINDOWIDSTARTUNDER] [, MAXWAITINSECONDS]</dt>
135 <dd>
136
137 <p>Waits for a window to come up that matches the specified title regex. Optionally one can specify the window to start under; which would allow one to constrain the search to child windows of that window.</p>
138
139 <p>One can optionally specify an alternative wait amount in seconds. A window will keep being looked for that matches the specified title regex until this amount of time has been reached. The default amount is defined in the DEF_WAIT constant available through the :CONST export tag.</p>
140
141 <p>If a window is going to be manipulated by input, WaitWindowViewable is the more robust solution to utilize.</p>
142
143 <p>An array of window Ids is returned for the matches found. An empty array is returned if no matches were found.</p>
144
145 <pre><code> my @WindowIds = WaitWindowLike(&#39;gedit&#39;);
146 # Only worry about first window found
147 my ($WindowId) = WaitWindowLike(&#39;gedit&#39;);
148
149 WaitWindowLike(&#39;gedit&#39;) or die(&quot;gedit window not found!&quot;);</code></pre>
150
151 </dd>
152 </dl>
153
154 <dl>
155
156 <dt id="WaitWindowViewable-TITLEREGEX-WINDOWIDSTARTUNDER-MAXWAITINSECONDS">WaitWindowViewable TITLEREGEX [, WINDOWIDSTARTUNDER] [, MAXWAITINSECONDS]</dt>
157 <dd>
158
159 <p>Similar to WaitWindow, but only recognizes windows that are viewable. When GUI applications are started, their window isn&#39;t necessarily viewable yet, let alone available for input, so this function is very useful.</p>
160
161 <p>Likewise, this function will only return an array of the matching window Ids for those windows that are viewable. An empty array is returned if no matches were found.</p>
162
163 </dd>
164 </dl>
165
166 <dl>
167
168 <dt id="WaitWindowClose-WINDOWID-MAXWAITINSECONDS">WaitWindowClose WINDOWID [, MAXWAITINSECONDS]</dt>
169 <dd>
170
171 <p>Waits for the specified window to close.</p>
172
173 <p>One can optionally specify an alternative wait amount in seconds. The window will keep being checked to see if it has closed until this amount of time has been reached. The default amount is defined in the DEF_WAIT constant available through the :CONST export tag.</p>
174
175 <p>zero is returned if window is not gone, non-zero if it is gone.</p>
176
177 </dd>
178 </dl>
179
180 <dl>
181
182 <dt id="WaitSeconds-SECONDS">WaitSeconds SECONDS</dt>
183 <dd>
184
185 <p>Pauses execution for the specified amount of seconds.</p>
186
187 <pre><code> WaitSeconds(0.5); # Wait 1/2 second
188 WaitSeconds(3); # Wait 3 seconds</code></pre>
189
190 </dd>
191 </dl>
192
193 <dl>
194
195 <dt id="ClickWindow-WINDOWID-X-Offset-Y-Offset-Button">ClickWindow WINDOWID [, X Offset] [, Y Offset] [, Button]</dt>
196 <dd>
197
198 <p>Clicks on the specified window with the mouse.</p>
199
200 <p>Optionally one can specify the X offset and Y offset. By default, the top left corner of the window is clicked on, with these two parameters one can specify a different position to be clicked on.</p>
201
202 <p>One can also specify an alternative button. The default button is M_LEFT, but M_MIDDLE and M_RIGHT may be specified too. Also, you could use the logical Id for the button: M_BTN1, M_BTN2, M_BTN3, M_BTN4, M_BTN5. These are all available through the :CONST export tag.</p>
203
204 <p>zero is returned on failure, non-zero for success</p>
205
206 </dd>
207 </dl>
208
209 <dl>
210
211 <dt id="GetWindowsFromPid">GetWindowsFromPid</dt>
212 <dd>
213
214 <p>Returns a list of window ids discovered for the specified process id (pid).</p>
215
216 <p>undef is returned on error.</p>
217
218 </dd>
219 </dl>
220
221 <dl>
222
223 <dt id="GetWindowFromPoint-X-Y-SCREEN">GetWindowFromPoint X, Y [, SCREEN]</dt>
224 <dd>
225
226 <p>Returns the window that is at the specified point. If no screen is given, it is taken from the value given when opening the X display.</p>
227
228 <p>zero is returned if there are no matches (i.e., off screen).</p>
229
230 </dd>
231 </dl>
232
233 <dl>
234
235 <dt id="IsChild-PARENTWINDOWID-WINDOWID">IsChild PARENTWINDOWID, WINDOWID</dt>
236 <dd>
237
238 <p>Determines if the specified window is a child of the specified parent.</p>
239
240 <p>zero is returned for false, non-zero for true.</p>
241
242 </dd>
243 </dl>
244
245 <dl>
246
247 <dt id="QuoteStringForSendKeys-STRING">QuoteStringForSendKeys STRING</dt>
248 <dd>
249
250 <p>Quotes {} characters in the specified string that would be interpreted as having special meaning if sent to SendKeys directly. This function would be useful if you had a text file in which you wanted to use each line of the file as input to the SendKeys function, but didn&#39;t want any special interpretation of the characters in the file.</p>
251
252 <p>Returns the quoted string, undef is returned on error.</p>
253
254 <pre><code> # Quote ~, %, etc. as {~}, {%}, etc for literal use in SendKeys.
255 SendKeys( QuoteStringForSendKeys(&#39;Hello: ~%^(){}+#&#39;) );
256 SendKeys( QSfSK(&#39;#+#&#39;) );</code></pre>
257
258 <p>The international AltGr key - modifier character (&amp;) is not escaped by this function. Escape this character manually (&quot;{&amp;}&quot;), if used/needed.</p>
259
260 </dd>
261 </dl>
262
263 <dl>
264
265 <dt id="StartApp-COMMANDLINE">StartApp COMMANDLINE</dt>
266 <dd>
267
268 <p>Uses the shell to execute a program. This function returns as soon as the program is called. Useful for starting GUI /applications and then going on to work with them.</p>
269
270 <p>zero is returned on failure, non-zero for success</p>
271
272 <pre><code> StartApp(&#39;gedit&#39;);</code></pre>
273
274 </dd>
275 </dl>
276
277 <dl>
278
279 <dt id="RunApp-COMMANDLINE">RunApp COMMANDLINE</dt>
280 <dd>
281
282 <p>Uses the shell to execute a program until its completion.</p>
283
284 <p>Return value will be application specific, however -1 is returned to indicate a failure in starting the program.</p>
285
286 <pre><code> RunApp(&#39;/work/myapp&#39;);</code></pre>
287
288 </dd>
289 </dl>
290
291 <dl>
292
293 <dt id="ClickMouseButton-BUTTON">ClickMouseButton BUTTON</dt>
294 <dd>
295
296 <p>Clicks the specified mouse button. Available mouse buttons are: M_LEFT, M_MIDDLE, M_RIGHT, M_DOWN, M_UP. Also, you could use the logical Id for the button: M_BTN1, M_BTN2, M_BTN3, M_BTN4, M_BTN5. These are all available through the :CONST export tag.</p>
297
298 <p>zero is returned on failure, non-zero for success.</p>
299
300 </dd>
301 </dl>
302
303 <dl>
304
305 <dt id="DefaultScreen">DefaultScreen</dt>
306 <dd>
307
308 <p>Returns the screen number specified in the X display value used to open the display.</p>
309
310 <p>Leverages the Xlib macro of the same name.</p>
311
312 </dd>
313 </dl>
314
315 <dl>
316
317 <dt id="ScreenCount">ScreenCount</dt>
318 <dd>
319
320 <p>Returns the number of screens in the X display specified when opening it.</p>
321
322 <p>Leverages the Xlib macro of the same name.</p>
323
324 </dd>
325 </dl>
326
327 <dl>
328
329 <dt id="SetEventSendDelay-DELAYINMILLISECONDS">SetEventSendDelay DELAYINMILLISECONDS</dt>
330 <dd>
331
332 <p>Sets the milliseconds of delay between events being sent to the X display. It is usually not a good idea to set this to 0.</p>
333
334 <p>Please note that this delay will also affect SendKeys.</p>
335
336 <p>Returns the old delay amount in milliseconds.</p>
337
338 </dd>
339 </dl>
340
341 <dl>
342
343 <dt id="GetEventSendDelay">GetEventSendDelay</dt>
344 <dd>
345
346 <p>Returns the current event sending delay amount in milliseconds.</p>
347
348 </dd>
349 </dl>
350
351 <dl>
352
353 <dt id="SetKeySendDelay-DELAYINMILLISECONDS">SetKeySendDelay DELAYINMILLISECONDS</dt>
354 <dd>
355
356 <p>Sets the milliseconds of delay between keystrokes.</p>
357
358 <p>Returns the old delay amount in milliseconds.</p>
359
360 </dd>
361 </dl>
362
363 <dl>
364
365 <dt id="GetKeySendDelay">GetKeySendDelay</dt>
366 <dd>
367
368 <p>Returns the current keystroke sending delay amount in milliseconds.</p>
369
370 </dd>
371 </dl>
372
373 <dl>
374
375 <dt id="GetWindowName-WINDOWID">GetWindowName WINDOWID</dt>
376 <dd>
377
378 <p>Returns the window name for the specified window Id. undef is returned if name could not be obtained.</p>
379
380 <pre><code> # Return the name of the window that has the input focus.
381 my $WinName = GetWindowName(GetInputFocus());</code></pre>
382
383 </dd>
384 </dl>
385
386 <dl>
387
388 <dt id="GetWindowPid-WINDOWID">GetWindowPid WINDOWID</dt>
389 <dd>
390
391 <p>Returns the process id (pid) associated with the specified window. 0 is returned if the pid is not available.</p>
392
393 <pre><code> # Return the pid of the window that has the input focus.
394 my $pid = GetWindowPid(GetInputFocus());</code></pre>
395
396 </dd>
397 </dl>
398
399 <dl>
400
401 <dt id="SetWindowName-WINDOWID-NAME">SetWindowName WINDOWID, NAME</dt>
402 <dd>
403
404 <p>Sets the window name for the specified window Id.</p>
405
406 <p>zero is returned on failure, non-zero for success.</p>
407
408 </dd>
409 </dl>
410
411 <dl>
412
413 <dt id="GetRootWindow-SCREEN">GetRootWindow [SCREEN]</dt>
414 <dd>
415
416 <p>Returns the Id of the root window of the screen. This is the top/root level window that all other windows are under. If no screen is given, it is taken from the value given when opening the X display.</p>
417
418 </dd>
419 </dl>
420
421 <dl>
422
423 <dt id="GetChildWindows-WINDOWID">GetChildWindows WINDOWID</dt>
424 <dd>
425
426 <p>Returns an array of the child windows for the specified window Id. If it detects that the window hierarchy is in transition, it will wait half a second and try again.</p>
427
428 </dd>
429 </dl>
430
431 <dl>
432
433 <dt id="MoveMouseAbs-X-Y-SCREEN">MoveMouseAbs X, Y [, SCREEN]</dt>
434 <dd>
435
436 <p>Moves the mouse cursor to the specified absolute position in the optionally given screen. If no screen is given, it is taken from the value given when opening the X display.</p>
437
438 <p>Zero is returned on failure, non-zero for success.</p>
439
440 </dd>
441 </dl>
442
443 <dl>
444
445 <dt id="GetMousePos">GetMousePos</dt>
446 <dd>
447
448 <p>Returns an array containing the position and the screen (number) of the mouse cursor.</p>
449
450 <pre><code> my ($x, $y, $scr_num) = GetMousePos();</code></pre>
451
452 </dd>
453 </dl>
454
455 <dl>
456
457 <dt id="PressMouseButton-BUTTON">PressMouseButton BUTTON</dt>
458 <dd>
459
460 <p>Presses the specified mouse button. Available mouse buttons are: M_LEFT, M_MIDDLE, M_RIGHT, M_DOWN, M_UP. Also, you could use the logical Id for the button: M_BTN1, M_BTN2, M_BTN3, M_BTN4, M_BTN5. These are all available through the :CONST export tag.</p>
461
462 <p>zero is returned on failure, non-zero for success.</p>
463
464 </dd>
465 </dl>
466
467 <dl>
468
469 <dt id="ReleaseMouseButton-BUTTON">ReleaseMouseButton BUTTON</dt>
470 <dd>
471
472 <p>Releases the specified mouse button. Available mouse buttons are: M_LEFT, M_MIDDLE, M_RIGHT, M_DOWN, M_UP. Also, you could use the logical Id for the button: M_BTN1, M_BTN2, M_BTN3, M_BTN4, M_BTN5. These are all available through the :CONST export tag.</p>
473
474 <p>zero is returned on failure, non-zero for success.</p>
475
476 </dd>
477 </dl>
478
479 <dl>
480
481 <dt id="SendKeys-KEYS">SendKeys KEYS</dt>
482 <dd>
483
484 <p>Sends keystrokes to the window that has the input focus.</p>
485
486 <p>The keystrokes to send are those specified in KEYS parameter. Some characters have special meaning, they are:</p>
487
488 <pre><code> Modifier Keys:
489 ^ CTRL
490 % ALT
491 + SHIFT
492 # META
493 &amp; ALTGR
494
495 Other Keys:
496 ~ ENTER
497 \n ENTER
498 \t TAB
499 ( and ) MODIFIER GROUPING
500 { and } QUOTE / ESCAPE CHARACTERS</code></pre>
501
502 <p>Simply, one can send a text string like so:</p>
503
504 <pre><code> SendKeys(&#39;Hello, how are you today?&#39;);</code></pre>
505
506 <p>Parenthesis allow a modifier to work on one or more characters. For example:</p>
507
508 <pre><code> SendKeys(&#39;%(f)q&#39;); # Alt-f, then press q
509 SendKeys(&#39;%(fa)^(m)&#39;); # Alt-f, Alt-a, Ctrl-m
510 SendKeys(&#39;+(abc)&#39;); # Uppercase ABC using shift modifier
511 SendKeys(&#39;^(+(l))&#39;); # Ctrl-Shift-l
512 SendKeys(&#39;+&#39;); # Press shift</code></pre>
513
514 <p>Braces are used to quote special characters, for utilizing aliased key names, or for special functionality. Multiple characters can be specified in a brace by space delimiting the entries. Characters can be repeated using a number that is space delimited after the preceding key.</p>
515
516 <p>Quote Special Characters</p>
517
518 <pre><code> SendKeys(&#39;{{}&#39;); # {
519 SendKeys(&#39;{+}&#39;); # +
520 SendKeys(&#39;{#}&#39;); # #
521
522 You can also use QuoteStringForSendKeys (QSfSK) to perform quoting.</code></pre>
523
524 <p>Aliased Key Names</p>
525
526 <pre><code> SendKeys(&#39;{BAC}&#39;); # Backspace
527 SendKeys(&#39;{F1 F2 F3}&#39;); # F1, F2, F3
528 SendKeys(&#39;{TAB 3}&#39;); # Press TAB 3 times
529 SendKeys(&#39;{SPC 3 a b c}&#39;); # Space 3 times, a, b, c</code></pre>
530
531 <p>Special Functionality</p>
532
533 <pre><code> # Pause execution for 500 milliseconds
534 SendKeys(&#39;{PAUSE 500}&#39;);</code></pre>
535
536 <p>Combinations</p>
537
538 <pre><code> SendKeys(&#39;abc+(abc){TAB PAUSE 500}&#39;); # a, b, c, A, B, C, Tab, Pause 500
539 SendKeys(&#39;+({a b c})&#39;); # A, B, C</code></pre>
540
541 <p>The following abbreviated key names are currently recognized within a brace set. If you don&#39;t see the desired key, you can still use the unabbreviated name for the key. If you are unsure of this name, utilize the xev (X event view) tool, press the key you want and look at the tools output for the name of that key. Names that are in the list below can be utilized regardless of case. Ones that aren&#39;t in this list are going to be case sensitive and also not abbreviated. For example, using &#39;xev&#39; you will find that the name of the backspace key is BackSpace, so you could use {BackSpace} in place of {bac} if you really wanted to.</p>
542
543 <pre><code> Name Action
544 -------------------
545 BAC BackSpace
546 BS BackSpace
547 BKS BackSpace
548 BRE Break
549 CAN Cancel
550 CAP Caps_Lock
551 DEL Delete
552 DOWN Down
553 END End
554 ENT Return
555 ESC Escape
556 F1 F1
557 ... ...
558 F12 F12
559 HEL Help
560 HOM Home
561 INS Insert
562 LAL Alt_L
563 LMA Meta_L
564 LCT Control_L
565 LEF Left
566 LSH Shift_L
567 LSK Super_L
568 MNU Menu
569 NUM Num_Lock
570 PGD Page_Down
571 PGU Page_Up
572 PRT Print
573 RAL Alt_R
574 RMA Meta_R
575 RCT Control_R
576 RIG Right
577 RSH Shift_R
578 RSK Super_R
579 SCR Scroll_Lock
580 SPA Space
581 SPC Space
582 TAB Tab
583 UP Up</code></pre>
584
585 <p>zero is returned on failure, non-zero for success. For configurations (Xvfb) that don&#39;t support Alt_Left, Meta_Left is automatically used in its place.</p>
586
587 </dd>
588 </dl>
589
590 <dl>
591
592 <dt id="PressKey-KEY">PressKey KEY</dt>
593 <dd>
594
595 <p>Presses the specified key.</p>
596
597 <p>One can utilize the abbreviated key names from the table listed above as outlined in the following example:</p>
598
599 <pre><code> # Alt-n
600 PressKey(&#39;LAL&#39;); # Left Alt
601 PressKey(&#39;n&#39;);
602 ReleaseKey(&#39;n&#39;);
603 ReleaseKey(&#39;LAL&#39;);
604
605 # Uppercase a
606 PressKey(&#39;LSH&#39;); # Left Shift
607 PressKey(&#39;a&#39;);
608 ReleaseKey(&#39;a&#39;);
609 ReleaseKey(&#39;LSH&#39;);</code></pre>
610
611 <p>The ReleaseKey calls in the above example are there to set both key states back.</p>
612
613 <p>zero is returned on failure, non-zero for success.</p>
614
615 </dd>
616 </dl>
617
618 <dl>
619
620 <dt id="ReleaseKey-KEY">ReleaseKey KEY</dt>
621 <dd>
622
623 <p>Releases the specified key. Normally follows a PressKey call.</p>
624
625 <p>One can utilize the abbreviated key names from the table listed above.</p>
626
627 <pre><code> ReleaseKey(&#39;n&#39;);</code></pre>
628
629 <p>zero is returned on failure, non-zero for success.</p>
630
631 </dd>
632 </dl>
633
634 <dl>
635
636 <dt id="PressReleaseKey-KEY">PressReleaseKey KEY</dt>
637 <dd>
638
639 <p>Presses and releases the specified key.</p>
640
641 <p>One can utilize the abbreviated key names from the table listed above.</p>
642
643 <pre><code> PressReleaseKey(&#39;n&#39;);</code></pre>
644
645 <p>This function is affected by the key send delay.</p>
646
647 <p>zero is returned on failure, non-zero for success.</p>
648
649 </dd>
650 </dl>
651
652 <dl>
653
654 <dt id="IsKeyPressed-KEY">IsKeyPressed KEY</dt>
655 <dd>
656
657 <p>Determines if the specified key is currently being pressed.</p>
658
659 <p>You can specify such things as &#39;bac&#39; or the unabbreviated form &#39;BackSpace&#39; as covered in the SendKeys information. Brace forms such as &#39;{bac}&#39; are unsupported. A &#39;{&#39; is taken literally and letters are case sensitive.</p>
660
661 <pre><code> if (IsKeyPressed(&#39;esc&#39;)) { # Is Escape pressed?
662 if (IsKeyPressed(&#39;a&#39;)) { # Is a pressed?
663 if (IsKeyPressed(&#39;A&#39;)) { # Is A pressed?</code></pre>
664
665 <p>Returns non-zero for true, zero for false.</p>
666
667 </dd>
668 </dl>
669
670 <dl>
671
672 <dt id="IsMouseButtonPressed-BUTTON">IsMouseButtonPressed BUTTON</dt>
673 <dd>
674
675 <p>Determines if the specified mouse button is currently being pressed.</p>
676
677 <p>Available mouse buttons are: M_LEFT, M_MIDDLE, M_RIGHT. Also, you could use the logical Id for the button: M_BTN1, M_BTN2, M_BTN3, M_BTN4, M_BTN5. These are all available through the :CONST export tag.</p>
678
679 <pre><code> if (IsMouseButtonPressed(M_LEFT)) { # Is left button pressed?</code></pre>
680
681 <p>Returns non-zero for true, zero for false.</p>
682
683 </dd>
684 </dl>
685
686 <dl>
687
688 <dt id="IsWindow-WINDOWID">IsWindow WINDOWID</dt>
689 <dd>
690
691 <p>zero is returned if the specified window Id is not for something that can be recognized as a window. non-zero is returned if it looks like a window.</p>
692
693 </dd>
694 </dl>
695
696 <dl>
697
698 <dt id="IsWindowViewable-WINDOWID">IsWindowViewable WINDOWID</dt>
699 <dd>
700
701 <p>zero is returned if the specified window Id is for a window that isn&#39;t viewable. non-zero is returned if the window is viewable.</p>
702
703 </dd>
704 </dl>
705
706 <dl>
707
708 <dt id="IsWindowCursor-WINDOWID-CURSOR">IsWindowCursor WINDOWID CURSOR</dt>
709 <dd>
710
711 <p>Determines if the specified window has the specified cursor.</p>
712
713 <p>zero is returned for false, non-zero for true.</p>
714
715 <p>The following cursors are available through the :CONST export tag.</p>
716
717 <pre><code> Name
718 -------------------
719 XC_NUM_GLYPHS
720 XC_X_CURSOR
721 XC_ARROW
722 XC_BASED_ARROW_DOWN
723 XC_BASED_ARROW_UP
724 XC_BOAT
725 XC_BOGOSITY
726 XC_BOTTOM_LEFT_CORNER
727 XC_BOTTOM_RIGHT_CORNER
728 XC_BOTTOM_SIDE
729 XC_BOTTOM_TEE
730 XC_BOX_SPIRAL
731 XC_CENTER_PTR
732 XC_CIRCLE
733 XC_CLOCK
734 XC_COFFEE_MUG
735 XC_CROSS
736 XC_CROSS_REVERSE
737 XC_CROSSHAIR
738 XC_DIAMOND_CROSS
739 XC_DOT
740 XC_DOTBOX
741 XC_DOUBLE_ARROW
742 XC_DRAFT_LARGE
743 XC_DRAFT_SMALL
744 XC_DRAPED_BOX
745 XC_EXCHANGE
746 XC_FLEUR
747 XC_GOBBLER
748 XC_GUMBY
749 XC_HAND1
750 XC_HAND2
751 XC_HEART
752 XC_ICON
753 XC_IRON_CROSS
754 XC_LEFT_PTR
755 XC_LEFT_SIDE
756 XC_LEFT_TEE
757 XC_LEFTBUTTON
758 XC_LL_ANGLE
759 XC_LR_ANGLE
760 XC_MAN
761 XC_MIDDLEBUTTON
762 XC_MOUSE
763 XC_PENCIL
764 XC_PIRATE
765 XC_PLUS
766 XC_QUESTION_ARROW
767 XC_RIGHT_PTR
768 XC_RIGHT_SIDE
769 XC_RIGHT_TEE
770 XC_RIGHTBUTTON
771 XC_RTL_LOGO
772 XC_SAILBOAT
773 XC_SB_DOWN_ARROW
774 XC_SB_H_DOUBLE_ARROW
775 XC_SB_LEFT_ARROW
776 XC_SB_RIGHT_ARROW
777 XC_SB_UP_ARROW
778 XC_SB_V_DOUBLE_ARROW
779 XC_SHUTTLE
780 XC_SIZING
781 XC_SPIDER
782 XC_SPRAYCAN
783 XC_STAR
784 XC_TARGET
785 XC_TCROSS
786 XC_TOP_LEFT_ARROW
787 XC_TOP_LEFT_CORNER
788 XC_TOP_RIGHT_CORNER
789 XC_TOP_SIDE
790 XC_TOP_TEE
791 XC_TREK
792 XC_UL_ANGLE
793 XC_UMBRELLA
794 XC_UR_ANGLE
795 XC_WATCH
796 XC_XTERM</code></pre>
797
798 </dd>
799 </dl>
800
801 <dl>
802
803 <dt id="MoveWindow-WINDOWID-X-Y">MoveWindow WINDOWID, X, Y</dt>
804 <dd>
805
806 <p>Moves the window to the specified location.</p>
807
808 <p>zero is returned on failure, non-zero for success.</p>
809
810 </dd>
811 </dl>
812
813 <dl>
814
815 <dt id="ResizeWindow-WINDOWID-WIDTH-HEIGHT">ResizeWindow WINDOWID, WIDTH, HEIGHT</dt>
816 <dd>
817
818 <p>Resizes the window to the specified size.</p>
819
820 <p>zero is returned on failure, non-zero for success.</p>
821
822 </dd>
823 </dl>
824
825 <dl>
826
827 <dt id="IconifyWindow-WINDOWID">IconifyWindow WINDOWID</dt>
828 <dd>
829
830 <p>Minimizes (Iconifies) the specified window.</p>
831
832 <p>zero is returned on failure, non-zero for success.</p>
833
834 </dd>
835 </dl>
836
837 <dl>
838
839 <dt id="UnIconifyWindow-WINDOWID">UnIconifyWindow WINDOWID</dt>
840 <dd>
841
842 <p>Unminimizes (UnIconifies) the specified window.</p>
843
844 <p>zero is returned on failure, non-zero for success.</p>
845
846 </dd>
847 </dl>
848
849 <dl>
850
851 <dt id="RaiseWindow-WINDOWID">RaiseWindow WINDOWID</dt>
852 <dd>
853
854 <p>Raises the specified window to the top of the stack, so that no other windows cover it.</p>
855
856 <p>zero is returned on failure, non-zero for success.</p>
857
858 </dd>
859 </dl>
860
861 <dl>
862
863 <dt id="LowerWindow-WINDOWID">LowerWindow WINDOWID</dt>
864 <dd>
865
866 <p>Lowers the specified window to the bottom of the stack, so other existing windows will cover it.</p>
867
868 <p>zero is returned on failure, non-zero for success.</p>
869
870 </dd>
871 </dl>
872
873 <dl>
874
875 <dt id="GetInputFocus">GetInputFocus</dt>
876 <dd>
877
878 <p>Returns the window that currently has the input focus.</p>
879
880 </dd>
881 </dl>
882
883 <dl>
884
885 <dt id="SetInputFocus-WINDOWID">SetInputFocus WINDOWID</dt>
886 <dd>
887
888 <p>Sets the specified window to be the one that has the input focus.</p>
889
890 <p>zero is returned on failure, non-zero for success.</p>
891
892 </dd>
893 </dl>
894
895 <dl>
896
897 <dt id="GetWindowPos-WINDOWID">GetWindowPos WINDOWID</dt>
898 <dd>
899
900 <p>Returns an array containing the position information for the specified window. It also returns size information (including border width) and the number of the screen where the window resides.</p>
901
902 <pre><code> my ($x, $y, $width, $height, $borderWidth, $screen) =
903 GetWindowPos(GetRootWindow());</code></pre>
904
905 </dd>
906 </dl>
907
908 <dl>
909
910 <dt id="GetParentWindow-WINDOWID">GetParentWindow WINDOWID</dt>
911 <dd>
912
913 <p>Returns the parent of the specified window.</p>
914
915 <p>zero is returned if parent couldn&#39;t be determined (i.e., root window).</p>
916
917 </dd>
918 </dl>
919
920 <dl>
921
922 <dt id="GetScreenDepth-SCREEN">GetScreenDepth [SCREEN]</dt>
923 <dd>
924
925 <p>Returns the color depth for the screen. If no screen is specified, it is taken from the value given when opening the X display. If the screen (number) is invalid, -1 will be returned.</p>
926
927 <p>Value is represented as bits, i.e. 16.</p>
928
929 <pre><code> my $depth = GetScreenDepth();</code></pre>
930
931 </dd>
932 </dl>
933
934 <dl>
935
936 <dt id="GetScreenRes-SCREEN">GetScreenRes [SCREEN]</dt>
937 <dd>
938
939 <p>Returns the screen resolution. If no screen is specified, it is taken from the value given when opening the X display. If the screen (number) is invalid, the returned list will be empty.</p>
940
941 <pre><code> my ($x, $y) = GetScreenRes();</code></pre>
942
943 </dd>
944 </dl>
945
946 <h1 id="OTHER-DOCUMENTATION">OTHER DOCUMENTATION</h1>
947
948
949
950 <a href='../Changes'>Module Changes</a><br>
951 <a href='CodingStyle'>Coding-Style Guidelines</a><br>
952 <a href='../ToDo'>ToDo List</a><br>
953 <a href='Copying'>Copy of the GPL License</a><br>
954
955 <h1 id="COPYRIGHT">COPYRIGHT</h1>
956
957 <p>Copyright(c) 2003-2014 Dennis K. Paulsen, All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License.</p>
958
959 <h1 id="AUTHOR">AUTHOR</h1>
960
961 <p>Dennis K. Paulsen &lt;[email protected]&gt; (Iowa USA)</p>
962
963 <h1 id="CONTRIBUTORS">CONTRIBUTORS</h1>
964
965 <p>Paulo E. Castro &lt;pauloedgarcastro tata gmail.com&gt;</p>
966
967 <h1 id="CREDITS">CREDITS</h1>
968
969 <p>Thanks to everyone; including those specifically mentioned below for patches, suggestions, etc.:</p>
970
971 <pre><code> David Dick
972 Alexey Tourbin
973 Richard Clamp
974 Gustav Larsson
975 Nelson D. Caro</code></pre>
976
977
978 </body>
979
980 </html>
981
982