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

The X11::Xlib module provide low level access to X11 libary function.

This include access to some X11 extension like the X11 test library (xtst).

FUNCTIONS

X11::Xlib->new($display)

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

The $display variable specify the display adress to open. If unset the $DISPLAY envirronement variable is used.

DISPLAY FUNCTION

$dpy->DisplayWidth($screen)

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

$dpy->DisplayHeight($screen)

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

EVENT FUNCTIONS

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

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

The optional $EventSendDelay is a delay to wait before sending the event in milliseconds, default value is 10.

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

Simulate an action on mouse button number $button. $pressed indicate if the button is either pressed (True) or released (False).

The optional $EventSendDelay is a delay to wait before sending the event in milliseconds, default value is 10.

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

Simulate an event on any key on the keyboard. $kc is the key code (8 to 255) and $pressed indicate if the key get pressed or released.

The optional $EventSendDelay is a delay to wait before sending the event in milliseconds, default value is 10.

$dpy->XBell($percent)

Make the Xserver emit a sound.

$dpy->XQueryKeymap

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

$dpy->keyboard_leds

Return a mask value for keyboard leds currently on.

$dpy->XFlush

Flush pending events sent with *Fake* functions to X11 server.

This function must be used to make fake event taking effect.

$dpy->XSync($flush)

Force Xserver to sync event. The optionnal $flush allow to discard pending event.

WINDOW FUNCTIONS

$dpy->RootWindow

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

KEYCODE FUNCTIONS

XKeysymToString($keysym)

Return the human readable string for caracter number $keysym.

XKeysymToString is the exact reverse of XStringToKeysym.

XStringToKeysym($string)

Return the keysym number for human readable caracter $string.

XStringToKeysym is the exact reverse of XKeysymToString.

IsFunctionKey($keysym)

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

IsKeypadKey($keysym)

Return true is $keysym is on numeric pad

IsMiscFunctionKey($keysym)

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

IsModifierKey($keysym)

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

IsPFKey($keysym)

No idea.

IsPrivateKeypadKey($keysym)

No more idea.

$dpy->XKeysymToKeycode($keysym)

Return the key code returning the caracter number $keysym.

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

Return an array of caracter number corresponding to the key $keycode.

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

The $count is the number of keycode to return. Default value is 1, eg returning caracter for the given $keycode.

SEE ALSO

X11::GUITest

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

Gtk2

Functions provided by this modules are mostly include in Gtk2 binding, but trough Gtk API and perl objects.

NOTES

This module is still incompleted, but patch are welcome :)

AUTHOR

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

COPYRIGHT AND LICENSE

Copyright (C) 2009 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.