I'm trying to disable mouse reporting for a brief period when the urxvt
window is focused. This is so that if I'm running vim with mouse
support, and I click the window to focus it, the vim cursor wont move.
I've had success with this by enabling a hook on `tt_write` to discard
mouse reporting data, but this just feels dirty. The ideal way would be
to disable mouse reporting and then turn it back on, however this is
what I cant get to work. From `man urxvtperl`, it seems like `cmd_parse`
is the right way to do this, and to send the escape codes to save mouse
reporting state, disable it, and then later restore mouse reporting state.
Why isnt this approach working? Is there any better way to control mouse
reporting (like a direct perl interface to control it)?
Below is what my code looks like. The idea is to disable mouse reporting
when the mouse button event fires within 0.001 seconds of the window
gaining focus, and then re-enable mouse reporting when the button is
released. (Note, the first character in the cmd_parse is a literal
escape char)
use Time::HiRes qw(time);
my $fuzz_time = 0.001;
my $last_focus_time = 0;
sub on_focus_in {
my $term = shift;
$last_focus_time = time();
print("focus\n");
$term->enable('button_press' => \&button_press);
return(0);
}
sub button_press {
my $term = shift;
if(time() > $last_focus_time + $fuzz_time) {
$term->disable('button_press');
$term->disable('button_release');
return(0);
}
$term->cmd_parse("[?9s");
$term->cmd_parse("[?9l");
print("Disabling\n");
#debug#$term->enable('button_release' => \&button_release);
return(0);
}
_______________________________________________
rxvt-unicode mailing list
[email protected]
http://lists.schmorp.de/cgi-bin/mailman/listinfo/rxvt-unicode