class

Xtst::RecordExtension

Inherits Reference < Object

Constructors

new

Connects to the display and raises if Record Extension Library was not found on the system.

Source

Instance methods

close
Source
create_context(range : LibXtst::RecordRange, *, flags = 0, client_spec = LibXtst::RecordClientSpec::AllClients)

Returns a new context. A range can be created with create_range.

Example usage:

range = record.create_range
range.device_events.first = X11::KeyPress
range.device_events.last = X11::ButtonRelease
context = record.create_context(record_range)
Source
create_range

Create a mutable range for usage in create_context.

Source
ctrl_display

The underlying Display object. Docs recommend using two separate connections for control and data.

Source
data_display

The underlying Display object. Docs recommend using two separate connections for control and data.

Source
enable_context_async(context : LibXtst::RecordContext, &callback : LibXtst::RecordInterceptData -> )

Start listening for the events configured in context.range. This method does not block. The block does not get run on its own, you need to additionally repeatedly call process_replies. For the structure of record_data.data, please refer to xEvent (NOT XEvent) at _xEvent in Xproto.h. There are no docs available for this, only other reference implementations.

Example usage:

record.enable_context_async(context) do |record_data|
  next if record_data.category != Xtst::LibXtst::RecordInterceptDataCategory::FromServer.value
  xevent = record_data.data
  repeat = xevent[2] == 1
  next if repeat
  type = xevent[0]
  keycode = xevent[1]
  state = xevent[28]
  pp! type, keycode, state
end
fd = IO::FileDescriptor.new record.data_display.connection_number
loop do
  dpy_fd.wait_readable
  record.process_replies
end
Source
finalize
Source
process_replies
Source