From ad6460c301cb27c6b57d3d0f30b2674fdc5779a7 Mon Sep 17 00:00:00 2001 From: hut Date: Sun, 19 Jul 2009 16:35:19 +0200 Subject: added doubleclick, with configurable mouseinterval --- code/cli.rb | 4 ++-- code/keys.rb | 17 ++++++++++++----- 2 files changed, 14 insertions(+), 7 deletions(-) (limited to 'code') diff --git a/code/cli.rb b/code/cli.rb index 60f74e75..3c0f506e 100644 --- a/code/cli.rb +++ b/code/cli.rb @@ -73,8 +73,8 @@ module CLI MOUSE_MASK_ON = Ncurses::ALL_MOUSE_EVENTS | Ncurses::REPORT_MOUSE_POSITION MOUSE_MASK_OFF = 0 - def init_mouse - Ncurses.mouseinterval( 0 ) + def init_mouse( interval ) + Ncurses.mouseinterval( interval ) Ncurses.mousemask( MOUSE_MASK_ON, [] ) end diff --git a/code/keys.rb b/code/keys.rb index f553cf24..5916c69c 100644 --- a/code/keys.rb +++ b/code/keys.rb @@ -483,7 +483,14 @@ module Fm when Option.mouse && '' log mouse.bstate - if mouse.press3? or mouse.press1? + if mouse.press1? or + mouse.press3? or + mouse.click1? or + mouse.click3? or + mouse.doubleclick1? + + left = ! (right = mouse.press3? or mouse.click3?) + if mouse.y == 0 elsif mouse.y >= CLI.lines - @bars.size - 1 else @@ -494,26 +501,26 @@ module Fm case mouse.x when ranges[0] descend - if mouse.press1? + if left @pwd.pos = get_offset( @path[-1], lines ) + mouse.y - 1 descend end when ranges[1] descend - if mouse.press1? + if left @pwd.pos = get_offset( @path[-1], lines ) + mouse.y - 1 end when ranges[2] @pwd.pos = get_offset( @path[-1], lines ) + mouse.y - 1 - if mouse.press3? + if right or mouse.doubleclick1? @buffer.clear if mouse.ctrl? then press('L') else press('l') end end when ranges[3] @buffer.clear if mouse.ctrl? then press('L') else press('l') end - if mouse.press1? and currentfile.dir? + if left and currentfile.dir? @pwd.pos = get_offset( @path[-1], lines ) + mouse.y - 1 end end -- cgit 1.4.1-2-gfad0