From ae1dfa4bfce614a5f2786321132f6020d6e055f9 Mon Sep 17 00:00:00 2001 From: root Date: Sun, 8 Jan 2006 22:58:13 +0000 Subject: [PATCH] *** empty log message *** --- src/perl/option-popup | 3 ++- src/perl/urxvt-popup | 8 ++------ src/rxvtperl.xs | 27 ++++++++++++++++----------- src/urxvt.pm | 20 ++++++++++++++------ 4 files changed, 34 insertions(+), 24 deletions(-) diff --git a/src/perl/option-popup b/src/perl/option-popup index 5ac60266..18e09c20 100644 --- a/src/perl/option-popup +++ b/src/perl/option-popup @@ -10,7 +10,8 @@ sub on_button_press { my ($self, $event) = @_; if ($event->{button} == 3 && $event->{state} & urxvt::ControlMask) { - my $popup = $self->popup ($event); + my $popup = $self->popup ($event) + or return; $popup->add_title ("Options"); $popup->add_separator; diff --git a/src/perl/urxvt-popup b/src/perl/urxvt-popup index b1f3cbdf..ca2d0f8e 100644 --- a/src/perl/urxvt-popup +++ b/src/perl/urxvt-popup @@ -63,7 +63,8 @@ sub on_button_release { 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; @@ -99,7 +100,6 @@ sub on_init { 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"; } @@ -132,7 +132,3 @@ sub on_map_notify { } - - - - diff --git a/src/rxvtperl.xs b/src/rxvtperl.xs index 471a9e1d..a5fdb8d6 100644 --- a/src/rxvtperl.xs +++ b/src/rxvtperl.xs @@ -784,27 +784,32 @@ rxvt_term::grab (U32 eventtime, int sync = 0) 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) diff --git a/src/urxvt.pm b/src/urxvt.pm index e285d151..c9c14ad8 100644 --- a/src/urxvt.pm +++ b/src/urxvt.pm @@ -536,7 +536,10 @@ sub invoke { @_, ) and last; }; - warn $@ if $@;#d# + if ($@) { + $TERM->ungrab; # better to lose the grab than the session + warn $@; + } } } @@ -576,6 +579,10 @@ sub urxvt::term::proxy::AUTOLOAD { goto &$urxvt::term::proxy::AUTOLOAD; } +sub urxvt::term::proxy::DESTROY { + # nop +} + # urxvt::destroy_hook sub urxvt::destroy_hook::DESTROY { @@ -1159,8 +1166,8 @@ sub add_toggle { 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); @@ -1180,6 +1187,7 @@ sub show { sub DESTROY { my ($self) = @_; + delete $self->{term}{_destroy}{$self}; $self->{term}->ungrab; } @@ -1293,11 +1301,11 @@ numbers indicate more verbose output. =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 -- 2.34.1