Class: Net::VNC::PointerState
- Inherits:
-
Object
- Object
- Net::VNC::PointerState
- Defined in:
- lib/net/vnc/vnc.rb
Instance Attribute Summary collapse
-
#button ⇒ Object
Returns the value of attribute button.
-
#x ⇒ Object
readonly
Returns the value of attribute x.
-
#y ⇒ Object
readonly
Returns the value of attribute y.
Instance Method Summary collapse
-
#initialize(vnc) ⇒ PointerState
constructor
A new instance of PointerState.
- #refresh ⇒ Object
- #update(x, y, button = @button) ⇒ Object
Constructor Details
#initialize(vnc) ⇒ PointerState
Returns a new instance of PointerState.
32 33 34 35 |
# File 'lib/net/vnc/vnc.rb', line 32 def initialize vnc @x = @y = @button = 0 @vnc = vnc end |
Instance Attribute Details
#button ⇒ Object
Returns the value of attribute button.
30 31 32 |
# File 'lib/net/vnc/vnc.rb', line 30 def @button end |
#x ⇒ Object (readonly)
Returns the value of attribute x.
30 31 32 |
# File 'lib/net/vnc/vnc.rb', line 30 def x @x end |
#y ⇒ Object (readonly)
Returns the value of attribute y.
30 31 32 |
# File 'lib/net/vnc/vnc.rb', line 30 def y @y end |
Instance Method Details
#refresh ⇒ Object
48 49 50 51 52 53 54 55 |
# File 'lib/net/vnc/vnc.rb', line 48 def refresh packet = 0.chr * 6 packet[0] = 5.chr packet[1] = .chr packet[2, 2] = [x].pack 'n' packet[4, 2] = [y].pack 'n' @vnc.socket.write packet end |
#update(x, y, button = @button) ⇒ Object
43 44 45 46 |
# File 'lib/net/vnc/vnc.rb', line 43 def update x, y, =@button @x, @y, @button = x, y, refresh end |