WL::Connection - Estabilitsh connection for Wayland protocol |
WL::Connection - Estabilitsh connection for Wayland protocol
use WL::Connection;
# Connect to Wayland server (compositor)
my $conn = new WL::Connection;
# Obtain the display object singleton
my $display = $conn->get_display ();
...
$conn->loop ();
WL::Connection takes care of estabilishing and tearing down a Wayland protocol connection, marshalling and demarshalling the messages and event processing. Moreover it bootstraps the WL::wl_display singleton that is essential for further communication via Wayland protocol.
Please consider this an alpha quality code, whose API can change at any time, until we reach version 1.0.
Estabilish the connection. The display socket address is determined using XDG_RUNTIME_DIR
and WAYLAND_DISPLAY
environment variables, falling back to wayland-0
display.
Send a request. The data is aready marshalled message from a WL::Base subclass and the optional second argument is a file handle to be sent as anciliary data alongside the message.
This should only be used by send_request
called from WL::Base subclasses, not directly.
Read an event, returning the data and optionally a file handle, if a file descriptor is obtained from anciliary data.
This should only be used from process_event
, not directly.
Add message heading with id, opcode and length to already marshalled payload and send it, optionally with an open file handle as anciliary data.
Read a message, decode the header and call a callback
method (inherited from WL::Base) of its recipient with raw message body and optional file handle.
Create and return a WL::wl_display singleton object.
Issue a sync
call for the display object and wait for done
event receipt.
As Wayland ensures the calls are processed in order, this creates a barrier in message stream.
Process the events until the connection tears down.
Tear down the connection.
http://wayland.freedesktop.org/ -- Wayland project web site
WL::Base -- Base class for Wayland objects
Copyright 2013 Lubomir Rintel
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Lubomir Rintel lkundrak@v3.sk
WL::Connection - Estabilitsh connection for Wayland protocol |