*** empty log message ***
authorroot <root>
Sun, 8 Jan 2006 22:58:13 +0000 (22:58 +0000)
committerroot <root>
Sun, 8 Jan 2006 22:58:13 +0000 (22:58 +0000)
src/perl/option-popup
src/perl/urxvt-popup
src/rxvtperl.xs
src/urxvt.pm

index 5ac602663613612d3a6890de37b68a1a36d5b27c..18e09c20566242f1ad3840608980f0751bddad80 100644 (file)
@@ -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;
index b1f3cbdfb818756c5014b64bcbfa0554f384bc96..ca2d0f8ece8dca1656b157ee974419203f5d7a33 100644 (file)
@@ -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 {
 }
 
 
-
-
-
-
index 471a9e1df2c01df4e331a0280d8b7150cd3a7f38..a5fdb8d6516b65fd1057900bcc7392c18972ec28 100644 (file)
@@ -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)
index e285d151e304ce8f0ce59e025e0a12c520120b99..c9c14ad8239172d6f7a5f90c9804c49dd0dd4f89 100644 (file)
@@ -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