Module: Xlib::X
- Defined in:
- lib/xlib/x.rb
Class Method Summary collapse
- .close_display(display) ⇒ Object
- .flush(display) ⇒ Object
- .get_event_data(display, event_cookie) ⇒ Object
- .list_extensions(display) ⇒ Object
- .next_event(display) ⇒ Object
- .open_display(name) ⇒ Object
- .pending(display) ⇒ Object
- .query_extension(display, name) ⇒ Object
- .select_input(display, window, mask) ⇒ Object
Class Method Details
.close_display(display) ⇒ Object
10 11 12 |
# File 'lib/xlib/x.rb', line 10 def close_display(display) Xlib.XCloseDisplay(display.to_native) end |
.flush(display) ⇒ Object
53 54 55 |
# File 'lib/xlib/x.rb', line 53 def flush(display) Xlib.XFlush(display.to_native) end |
.get_event_data(display, event_cookie) ⇒ Object
34 35 36 |
# File 'lib/xlib/x.rb', line 34 def get_event_data(display, ) Xlib::XGetEventData(display.to_native, .pointer) end |
.list_extensions(display) ⇒ Object
14 15 16 17 18 19 20 21 |
# File 'lib/xlib/x.rb', line 14 def list_extensions(display) nextensions_ptr = FFI::MemoryPointer.new :pointer extensions_ptr = Xlib.XListExtensions(display.to_native, nextensions_ptr) nextensions = nextensions_ptr.read_int extensions = extensions_ptr.get_array_of_string(0, nextensions) Xlib.XFreeExtensionList(extensions_ptr) extensions end |
.next_event(display) ⇒ Object
43 44 45 46 47 |
# File 'lib/xlib/x.rb', line 43 def next_event(display) xevent = Xlib::XEvent.new Xlib.XNextEvent(display.to_native, xevent) # blocks xevent end |
.open_display(name) ⇒ Object
4 5 6 7 8 |
# File 'lib/xlib/x.rb', line 4 def open_display(name) display_pointer = Xlib.XOpenDisplay(name) raise ArgumentError, "Unknown display #{name}" if display_pointer.null? Xlib::Display.new(display_pointer) end |
.pending(display) ⇒ Object
49 50 51 |
# File 'lib/xlib/x.rb', line 49 def pending(display) Xlib.XPending(display.to_native) end |
.query_extension(display, name) ⇒ Object
23 24 25 26 27 28 29 30 31 32 |
# File 'lib/xlib/x.rb', line 23 def query_extension(display, name) opcode_ptr = FFI::MemoryPointer.new :int evcode_ptr = FFI::MemoryPointer.new :int errcode_ptr = FFI::MemoryPointer.new :int if Xlib.XQueryExtension(display.to_native, name, opcode_ptr, evcode_ptr, errcode_ptr) { opcode: opcode_ptr.read_int, first_event: evcode_ptr.read_int, first_error: errcode_ptr.read_int} else false end end |
.select_input(display, window, mask) ⇒ Object
38 39 40 41 |
# File 'lib/xlib/x.rb', line 38 def select_input(display, window, mask) Xlib.XSelectInput(display.to_native, window.to_native, mask) flush(display) end |