Class: XlibObj::Event::ClientMessage

Inherits:
Object
  • Object
show all
Defined in:
lib/event/client_message.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type = nil, data = nil, subject = nil) ⇒ ClientMessage

Returns a new instance of ClientMessage.



12
13
14
15
16
# File 'lib/event/client_message.rb', line 12

def initialize(type=nil, data=nil, subject=nil)
  self.type = type
  self.data = data
  self.subject = subject
end

Instance Attribute Details

#data=(value) ⇒ Object (writeonly)

Sets the attribute data

Parameters:

  • value

    the value to set the attribute data to.



18
19
20
# File 'lib/event/client_message.rb', line 18

def data=(value)
  @data = value
end

#subject=(value) ⇒ Object (writeonly)

Sets the attribute subject

Parameters:

  • value

    the value to set the attribute subject to.



18
19
20
# File 'lib/event/client_message.rb', line 18

def subject=(value)
  @subject = value
end

#type=(value) ⇒ Object (writeonly)

Sets the attribute type

Parameters:

  • value

    the value to set the attribute type to.



18
19
20
# File 'lib/event/client_message.rb', line 18

def type=(value)
  @type = value
end

Instance Method Details

#send_to(receiver) ⇒ Object



20
21
22
23
24
25
26
27
# File 'lib/event/client_message.rb', line 20

def send_to(receiver)
  raise "The client message needs a type at least." unless @type
  @receiver = receiver
  Xlib.XSendEvent(@receiver.display.to_native, @receiver.to_native, false,
    Xlib::SubstructureNotifyMask | Xlib::SubstructureRedirectMask, to_native)
ensure
  Xlib::X.flush(@receiver.display)
end