++ed by:
AERO

1 PAUSE user

Lubomir Rintel
and 1 contributors

NAME

WL::Connection - Estabilitsh connection for Wayland protocol

SYNOPSIS

  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 ();

DESCRIPTION

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.

METHODS

new

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 DATA [FILE]

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.

recv LENGTH

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.

send_request ID OPCODE PAYLOAD [FILE]

Add message heading with id, opcode and length to already marshalled payload and send it, optionally with an open file handle as anciliary data.

process_event

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.

get_display

Create and return a WL::wl_display singleton object.

round_trip DISPLAY

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.

loop

Process the events until the connection tears down.

disconnect

Tear down the connection.

SEE ALSO

COPYRIGHT

Copyright 2013 Lubomir Rintel

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

AUTHORS

Lubomir Rintel lkundrak@v3.sk