Class: Net::VNC::PointerState
- Inherits:
-
Object
- Object
- Net::VNC::PointerState
- Defined in:
- lib/net/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.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.rb', line 30 def @button end |
#x ⇒ Object (readonly)
Returns the value of attribute x.
30 31 32 |
# File 'lib/net/vnc.rb', line 30 def x @x end |
#y ⇒ Object (readonly)
Returns the value of attribute y.
30 31 32 |
# File 'lib/net/vnc.rb', line 30 def y @y end |
Instance Method Details
#refresh ⇒ Object
50 51 52 53 54 55 56 57 |
# File 'lib/net/vnc.rb', line 50 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 47 48 |
# File 'lib/net/vnc.rb', line 43 def update(x, y, = @button) @x = x @y = y @button = refresh end |