class Xtst::RecordExtension
- Xtst::RecordExtension
- Reference
- Object
Defined in:
xtst/record-extension.crConstructors
-
.new
Connects to the display and raises if Record Extension Library was not found on the system.
Instance Method Summary
- #close : Int32
-
#create_context(range : LibXtst::RecordRange, *, flags = 0, client_spec = LibXtst::RecordClientSpec::AllClients)
Returns a new context.
-
#create_range
Create a mutable
range
for usage in#create_context
. -
#ctrl_display : X11::Display
The underlying Display object.
-
#data_display : X11::Display
The underlying Display object.
-
#enable_context_async(context : LibXtst::RecordContext, &callback : LibXtst::RecordInterceptData -> )
Start listening for the events configured in
context.range
. - #finalize
- #process_replies
Constructor Detail
Connects to the display and raises if Record Extension Library was not found on the system.
Instance Method Detail
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)
The underlying Display object. Docs recommend using two separate connections for control and data.
The underlying Display object. Docs recommend using two separate connections for control and data.
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