Class: XlibObj::Event
- Inherits:
-
Object
show all
- Defined in:
- lib/event.rb,
lib/event/client_message.rb,
lib/event/selection_notify.rb
Defined Under Namespace
Classes: ClientMessage, Mask, SelectionNotify
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(display, xevent) ⇒ Event
Returns a new instance of Event.
3
4
5
6
|
# File 'lib/event.rb', line 3
def initialize(display, xevent)
@display = display
@xevent = xevent
end
|
Instance Attribute Details
#xevent ⇒ Object
Returns the value of attribute xevent.
8
9
10
|
# File 'lib/event.rb', line 8
def xevent
@xevent
end
|
Instance Method Details
#cookie ⇒ Object
22
23
24
|
# File 'lib/event.rb', line 22
def cookie
@xevent[:xcookie]
end
|
#data? ⇒ Boolean
18
19
20
|
# File 'lib/event.rb', line 18
def data?
@is_cookie ||= generic? && Xlib::X.get_event_data(@display, cookie)
end
|
#extension ⇒ Object
30
31
32
33
34
|
# File 'lib/event.rb', line 30
def extension
@extension ||= @display.extensions.find do |ext|
data? ? opcode == ext.opcode : ext.event_range.include?(type)
end
end
|
#extension_event ⇒ Object
36
37
38
|
# File 'lib/event.rb', line 36
def extension_event
extension.event(data? ? cookie : xevent)
end
|
#generic? ⇒ Boolean
14
15
16
|
# File 'lib/event.rb', line 14
def generic?
type == Xlib::GenericEvent
end
|
#opcode ⇒ Object
26
27
28
|
# File 'lib/event.rb', line 26
def opcode
(data? and cookie[:extension])
end
|
#type ⇒ Object
10
11
12
|
# File 'lib/event.rb', line 10
def type
@xevent[:type]
end
|