*** empty log message ***
authorroot <root>
Thu, 19 Jan 2006 16:22:12 +0000 (16:22 +0000)
committerroot <root>
Thu, 19 Jan 2006 16:22:12 +0000 (16:22 +0000)
src/command.C
src/perl/selection-pastebin
src/perl/selection-popup
src/rxvt.h
src/screen.C
src/urxvt.pm

index 954baf2a5814e411a9c59a317243f7c0181676ec..bc3f69736be39f728da495309ee680f4aad672db 100644 (file)
@@ -466,7 +466,7 @@ rxvt_term::lookup_key (XKeyEvent &ev)
                 {
                     /* normal XTerm key bindings */
                   case XK_Insert:      /* Shift+Insert = paste mouse selection */
-                    selection_request (ev.time, 0, 0);
+                    selection_request (ev.time);
                     return;
 #if TODO
                     /* rxvt extras */
@@ -2157,9 +2157,14 @@ rxvt_term::button_release (XButtonEvent &ev)
           case Button3:
             selection_make (ev.time);
             break;
+
           case Button2:
-            selection_request (ev.time, ev.x, ev.y);
+            if (IN_RANGE_EXC (ev.x, 0, width)
+                && IN_RANGE_EXC (ev.y, 0, height))  // inside window?
+              selection_request (ev.time);
+
             break;
+
 #ifdef MOUSE_WHEEL
           case Button4:
           case Button5:
index fa34b73caaf2c70693c12b7c27e4edf3021ed387..13ecf03a0e74f6e33909e81306c2df57fc1e1e02 100644 (file)
@@ -49,19 +49,20 @@ sub upload_paste {
 
 sub on_start {
    my ($self) = @_;
+
    $pastebin_cmd = $self->x_resource ("selection-pastebin.cmd")
                    || "rcp -p % ruth:/var/www/www.ta-sa.org/files/txt/";
 
    $pastebin_url = $self->x_resource ("selection-pastebin.url")
                    || "http://www.ta-sa.org/files/txt/%";
 
+   push @{ $self->{term}{selection_popup_hook} }, sub {
+      ("pastebin upload" => sub { $self->upload_paste })
+   };
+
    ()
 }
 
-push @urxvt::ext::selection_popup::hook, sub {
-   ("pastebin upload" => sub { $self->upload_paste })
-};
-
 sub on_keyboard_command {
    my ($self, $cmd) = @_;
 
index 82e87d11b81c6bdf927d630f7a3395988478da2a..d5db95dcb9fa626831f20955d8280b7f4cc2f8de 100644 (file)
@@ -21,8 +21,6 @@ sub on_start {
    ()
 }
 
-our @hook;
-
 sub on_button_press {
    my ($self, $event) = @_;
 
@@ -73,7 +71,7 @@ sub on_button_press {
          /^(http|ftp|telnet|irc|news):\//
             and $add_button->("run $self->{browser}" => sub { $self->exec_async ($self->{browser}, $_) });
 
-         for my $hook (@hook) {
+         for my $hook (@{ $self->{term}{selection_popup_hook} || [] }) {
             if (my ($title, $cb) = $hook->($popup)) {
                $add_button->($title, $cb);
             }
index 4640b511b6a8cb27c902d34431c2e835cbaf8a0a..85885f75df3655a6f64e587bd17decea64f5252c 100644 (file)
@@ -1469,7 +1469,7 @@ struct rxvt_term : zero_initialized, rxvt_vars {
   void selection_check (int check_more);
   void selection_paste (Window win, Atom prop, bool delete_prop);
   void selection_property (Window win, Atom prop);
-  void selection_request (Time tm, int x, int y);
+  void selection_request (Time tm);
   int selection_request_other (Atom target, int selnum);
   void selection_clear ();
   void selection_make (Time tm);
index 2b1070682efe84c554929f19128b8f02cef524c4..9d53ad5456112fb1b976939ed40031f0dab9592e 100644 (file)
@@ -2802,11 +2802,8 @@ rxvt_term::selection_property (Window win, Atom prop)
  * EXT: button 2 release
  */
 void
-rxvt_term::selection_request (Time tm, int x, int y)
+rxvt_term::selection_request (Time tm)
 {
-  if (x < 0 || x >= width || y < 0 || y >= height)
-    return;                 /* outside window */
-
   if (selection.text)
     { /* internal selection */
       char *str = rxvt_wcstombs (selection.text, selection.len);
index bdbf6ca44e1f57bb2b64ef3ea520344204382604..7497db4b8388f8a83479a7b3a2f61c8e85560509 100644 (file)
@@ -91,8 +91,9 @@ Binds a popup menu to Ctrl-Button3 that lets you convert the selection
 text into various other formats/action (such as uri unescaping, perl
 evalution, web-browser starting etc.), depending on content.
 
-Other extensions can extend this popup menu by pushing a code reference onto
-C<@urxvt::ext::selection_popup::hook>, that is called whenever the popup is displayed.
+Other extensions can extend this popup menu by pushing a code reference
+onto C<@{ $term->{selection_popup_hook} }>, that is called whenever the
+popup is displayed.
 
 It's sole argument is the popup menu, which can be modified. The selection
 is in C<$_>, which can be used to decide wether to add something or not.
@@ -104,14 +105,11 @@ The following will add an entry C<a to b> that transforms all C<a>s in
 the selection to C<b>s, but only if the selection currently contains any
 C<a>s:
 
-   push urxvt::ext::selection_popup::hook, sub {
+   push @{ $self->{term}{selection_popup_hook} }, sub {
       /a/ ? ("a to be" => sub { s/a/b/g }
           : ()
    };
 
-Don't run it in a hook, otherwise the menu will grow and grow. Instead put
-it at the toplevel of your extension.
-
 =item searchable-scrollback<hotkey> (enabled by default)
 
 Adds regex search functionality to the scrollback buffer, triggered