The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

X11::Xlib - Low-level access to the X11 library

SYNOPSIS

  use X11::Xlib;
  my $display = X11::Xlib->new();
  ...

DESCRIPTION

This module provides low-level access to X11 libary functions.

This includes access to some X11 extensions like the X11 test library (Xtst).

METHODS

X11::Xlib->new($display)

Instantiate a new X11::Xlib object. This object contains the connection to the X11 display.

The $display variable specifies the display adress to open. If unset, the $DISPLAY environement variable is used.

DISPLAY METHODS

$display->DisplayWidth($screen)

Return the width of screen number $screen (or 0 if not specified).

$display->DisplayHeight($screen)

Return the height of screen number $screen (or 0 if not specified).

EVENT METHODS

$display->XTestFakeMotionEvent($screen, $x, $y, $EventSendDelay)

Fake a mouse movement on screen number $screen to position $x,$y.

The optional $EventSendDelay parameter specifies the number of milliseconds to wait before sending the event. The default is 10 milliseconds.

$display->XTestFakeButtonEvent($button, $pressed, $EventSendDelay);

Simulate an action on mouse button number $button. $pressed indicates whether the button should be pressed (true) or released (false).

The optional $EventSendDelay parameter specifies the number of milliseconds ro wait before sending the event. The default is 10 milliseconds.

$display->XTestFakeKeyEvent($kc, $pressed, $EventSendDelay)

Simulate a event on any key on the keyboard. $kc is the key code (8 to 255), and $pressed indicates if the key was pressed or released.

The optional $EventSendDelay parameter specifies the number of milliseconds to wait before sending the event. The default is 10 milliseconds.

$display->XBell($percent)

Make the X server emit a sound.

$display->XQueryKeymap

Return an array of the key codes currently pressed on the keyboard.

$display->keyboard_leds

Return a mask value for the currently-lit keyboard LEDs.

$display->XFlush

Flush pending events sent via the Fake* methods to the X11 server.

This method must be used to ensure the fake events take are triggered.

$display->XSync($flush)

Force the X server to sync event. The optional $flush parameter allows pending events to be discarded.

$display->XKeysymToKeycode($keysym)

Return the key code corresponding to the character number $keysym.

$display->XGetKeyboardMapping($keycode, $count)

Return an array of character numbers corresponding to the key $keycode.

Each value in the array corresponds to the action of a key modifier (Shift, Alt).

$count is the number of the keycode to return. The default value is 1, e.g. it returns the character corresponding to the given $keycode.

$display->RootWindow

Return an X11::Xlib::Window object corresponding to the X11 root window.

KEYCODE FUNCTIONS

XKeysymToString($keysym)

Return the human-readable string for character number $keysym.

XKeysymToString is the exact reverse of XStringToKeysym.

XStringToKeysym($string)

Return the keysym number for the human-readable character $string.

XStringToKeysym is the exact reverse of XKeysymToString.

IsFunctionKey($keysym)

Return true if $keysym is a function key (F1 .. F35)

IsKeypadKey($keysym)

Return true if $keysym is on numeric keypad.

IsMiscFunctionKey($keysym)

Return true is key if... honestly don't know :\

IsModifierKey($keysym)

Return true if $keysym is a modifier key (Shift, Alt).

IsPFKey($keysym)

No idea.

IsPrivateKeypadKey($keysym)

Again, no idea.

SEE ALSO

X11::GUITest

This module provides the same functions but with a high level approach.

Gtk2

Functions provided by X11/Xlib are mostly included in the Gtk2 binding, but through the GTK API and perl objects.

NOTES

This module is still incomplete, but patches are welcome :)

AUTHOR

Olivier Thauvin, <nanardon@nanardon.zarb.org>

COPYRIGHT AND LICENSE

Copyright (C) 2009-2010 by Olivier Thauvin

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.10.0 or, at your option, any later version of Perl 5 you may have available.