my ($row, $col) = ($event->{row}, $event->{col});
if ($col >= 0 && $col < $self->ncol
&& $row >= 0 && $row < @{ $self->{data}{item} }) {
- $self->{data}{item}[$row]{activate}->($event);
+ my $item = $self->{data}{item}[$row];
+ $item->{activate}->($event, $item);
}
$self->refresh;
if ($data->{event}) {
my $x = int List::Util::max 0, $data->{event}{x_root} - $width * $data->{term}->fwidth * 0.5;
my $y = int List::Util::max 0, $data->{event}{y_root} - $data->{term}->fheight * 0.5;
-
$pos = "+$x+$y";
}
}
-
-
-
-
RETVAL
void
-rxvt_term::allow_events_async (U32 eventtime = THIS->perl.grabtime)
+rxvt_term::allow_events_async ()
CODE:
- XAllowEvents (THIS->display->display, AsyncBoth, eventtime);
+ XAllowEvents (THIS->display->display, AsyncBoth, THIS->perl.grabtime);
void
-rxvt_term::allow_events_sync (U32 eventtime = THIS->perl.grabtime)
+rxvt_term::allow_events_sync ()
CODE:
- XAllowEvents (THIS->display->display, SyncBoth, eventtime);
+ XAllowEvents (THIS->display->display, SyncBoth, THIS->perl.grabtime);
void
-rxvt_term::allow_events_replay (U32 eventtime = THIS->perl.grabtime)
+rxvt_term::allow_events_replay ()
CODE:
- XAllowEvents (THIS->display->display, ReplayPointer, eventtime);
- XAllowEvents (THIS->display->display, ReplayKeyboard, eventtime);
+ XAllowEvents (THIS->display->display, ReplayPointer, THIS->perl.grabtime);
+ XAllowEvents (THIS->display->display, ReplayKeyboard, THIS->perl.grabtime);
void
-rxvt_term::ungrab (U32 eventtime = THIS->perl.grabtime)
+rxvt_term::ungrab ()
CODE:
- THIS->perl.grabtime = 0;
- XUngrabKeyboard (THIS->display->display, eventtime);
- XUngrabPointer (THIS->display->display, eventtime);
+{
+ if (THIS->perl.grabtime)
+ {
+ XUngrabKeyboard (THIS->display->display, THIS->perl.grabtime);
+ XUngrabPointer (THIS->display->display, THIS->perl.grabtime);
+ THIS->perl.grabtime = 0;
+ }
+}
int
rxvt_term::strwidth (SV *str)
@_,
) and last;
};
- warn $@ if $@;#d#
+ if ($@) {
+ $TERM->ungrab; # better to lose the grab than the session
+ warn $@;
+ }
}
}
goto &$urxvt::term::proxy::AUTOLOAD;
}
+sub urxvt::term::proxy::DESTROY {
+ # nop
+}
+
# urxvt::destroy_hook
sub urxvt::destroy_hook::DESTROY {
type => "button",
text => " $text",
value => $value,
- render => sub { ($item->{value} ? "* " : " ") . $text },
- activate => sub { $cb->($item->{value} = !$item->{value}); },
+ render => sub { ($_[0]{value} ? "* " : " ") . $text },
+ activate => sub { $cb->($_[0]{value} = !$_[0]{value}); },
};
$self->add_item ($item);
sub DESTROY {
my ($self) = @_;
+ delete $self->{term}{_destroy}{$self};
$self->{term}->ungrab;
}
=over 4
-=item =0 - only fatal messages
+=item == 0 - fatal messages
-=item =3 - script loading and management
+=item >= 3 - script loading and management
-=item =10 - all events received
+=item >=10 - all events received
=back