Class: Net::VNC::PointerState

Inherits:
Object
  • Object
show all
Defined in:
lib/net/vnc.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#buttonObject

Returns the value of attribute button.



30
31
32
# File 'lib/net/vnc.rb', line 30

def button
  @button
end

#xObject (readonly)

Returns the value of attribute x.



30
31
32
# File 'lib/net/vnc.rb', line 30

def x
  @x
end

#yObject (readonly)

Returns the value of attribute y.



30
31
32
# File 'lib/net/vnc.rb', line 30

def y
  @y
end

Instance Method Details

#refreshObject



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] = button.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 = @button)
  @x = x
  @y = y
  @button = button
  refresh
end