Class: LogBench::App::MouseHandler

Inherits:
Object
  • Object
show all
Includes:
Curses
Defined in:
lib/log_bench/app/mouse_handler.rb

Constant Summary collapse

DEFAULT_VISIBLE_HEIGHT =

UI constants

20

Instance Method Summary collapse

Constructor Details

#initialize(state, screen) ⇒ MouseHandler

Returns a new instance of MouseHandler.



11
12
13
14
# File 'lib/log_bench/app/mouse_handler.rb', line 11

def initialize(state, screen)
  self.state = state
  self.screen = screen
end

Instance Method Details

#handle_mouse_inputObject



16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/log_bench/app/mouse_handler.rb', line 16

def handle_mouse_input
  with_warnings_suppressed do
    mouse_event = getmouse

    return unless mouse_event

    if mouse_event.bstate & BUTTON1_CLICKED != 0
      handle_mouse_click(mouse_event.x, mouse_event.y)
    end
  end
rescue
  nil
end