From: root Date: Sat, 7 Jan 2006 20:23:52 +0000 (+0000) Subject: *** empty log message *** X-Git-Url: http://git.openbox.org/?a=commitdiff_plain;h=0082093990e1a16a0040ceb099a551a4df750079;p=dana%2Furxvt.git *** empty log message *** --- diff --git a/Makefile.in b/Makefile.in index a235f8cd..36f958ef 100644 --- a/Makefile.in +++ b/Makefile.in @@ -85,6 +85,7 @@ distclean: distdir: cd doc && $(MAKE) distdepend + cd src && $(MAKE) depend rm -rf $(VERNAME) mkdir $(VERNAME) rsync -aR `cat MANIFEST` $(VERNAME)/. diff --git a/src/Makefile.in b/src/Makefile.in index 893163e8..514721c6 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -123,8 +123,8 @@ depend: command.o: ../config.h rxvt.h rxvtlib.h ptytty.h feature.h encoding.h command.o: rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h iom_conf.h callback.h -command.o: salloc.h rsinc.h menubar.h rxvtperl.h version.h command.h -command.o: keyboard.h +command.o: salloc.h rxvtperl.h hookinc.h rsinc.h menubar.h version.h +command.o: command.h keyboard.h encoding.o: ../config.h encoding.h table/iso8859_1.h table/iso8859_15.h encoding.o: table/iso8859_2.h table/iso8859_3.h table/iso8859_4.h encoding.o: table/iso8859_5.h table/iso8859_6.h table/iso8859_7.h @@ -142,83 +142,87 @@ encoding.o: table/jis0212_1990_0.h table/jis0213_1.h table/jis0213_2.h encoding.o: table/compose.h table/category.h fdpass.o: ../config.h fdpass.h init.o: ../config.h rxvt.h rxvtlib.h ptytty.h feature.h encoding.h rxvtfont.h -init.o: rxvtutil.h rxvttoolkit.h iom.h iom_conf.h callback.h salloc.h rsinc.h -init.o: menubar.h init.h +init.o: rxvtutil.h rxvttoolkit.h iom.h iom_conf.h callback.h salloc.h +init.o: rxvtperl.h hookinc.h rsinc.h menubar.h init.h iom.o: iom.h iom_conf.h rxvtutil.h callback.h keyboard.o: ../config.h rxvt.h rxvtlib.h ptytty.h feature.h encoding.h keyboard.o: rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h iom_conf.h callback.h -keyboard.o: salloc.h rsinc.h menubar.h keyboard.h command.h +keyboard.o: salloc.h rxvtperl.h hookinc.h rsinc.h menubar.h keyboard.h +keyboard.o: command.h logging.o: ../config.h rxvt.h rxvtlib.h ptytty.h feature.h encoding.h logging.o: rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h iom_conf.h callback.h -logging.o: salloc.h rsinc.h menubar.h logging.h +logging.o: salloc.h rxvtperl.h hookinc.h rsinc.h menubar.h logging.h main.o: ../config.h rxvt.h rxvtlib.h ptytty.h feature.h encoding.h rxvtfont.h -main.o: rxvtutil.h rxvttoolkit.h iom.h iom_conf.h callback.h salloc.h rsinc.h -main.o: menubar.h keyboard.h rxvtperl.h +main.o: rxvtutil.h rxvttoolkit.h iom.h iom_conf.h callback.h salloc.h +main.o: rxvtperl.h hookinc.h rsinc.h menubar.h keyboard.h menubar.o: ../config.h rxvt.h rxvtlib.h ptytty.h feature.h encoding.h menubar.o: rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h iom_conf.h callback.h -menubar.o: salloc.h rsinc.h menubar.h version.h +menubar.o: salloc.h rxvtperl.h hookinc.h rsinc.h menubar.h version.h misc.o: ../config.h rxvt.h rxvtlib.h ptytty.h feature.h encoding.h rxvtfont.h -misc.o: rxvtutil.h rxvttoolkit.h iom.h iom_conf.h callback.h salloc.h rsinc.h -misc.o: menubar.h +misc.o: rxvtutil.h rxvttoolkit.h iom.h iom_conf.h callback.h salloc.h +misc.o: rxvtperl.h hookinc.h rsinc.h menubar.h netdisp.o: ../config.h rxvt.h rxvtlib.h ptytty.h feature.h encoding.h netdisp.o: rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h iom_conf.h callback.h -netdisp.o: salloc.h rsinc.h menubar.h +netdisp.o: salloc.h rxvtperl.h hookinc.h rsinc.h menubar.h ptytty.o: ../config.h rxvt.h rxvtlib.h ptytty.h feature.h encoding.h ptytty.o: rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h iom_conf.h callback.h -ptytty.o: salloc.h rsinc.h menubar.h +ptytty.o: salloc.h rxvtperl.h hookinc.h rsinc.h menubar.h rxvt.o: ../config.h rxvt.h rxvtlib.h ptytty.h feature.h encoding.h rxvtfont.h -rxvt.o: rxvtutil.h rxvttoolkit.h iom.h iom_conf.h callback.h salloc.h rsinc.h -rxvt.o: menubar.h +rxvt.o: rxvtutil.h rxvttoolkit.h iom.h iom_conf.h callback.h salloc.h +rxvt.o: rxvtperl.h hookinc.h rsinc.h menubar.h rxvtc.o: ../config.h rxvtdaemon.h rxvtutil.h fdpass.h rxvt.h rxvtlib.h rxvtc.o: ptytty.h feature.h encoding.h rxvtfont.h rxvttoolkit.h iom.h -rxvtc.o: iom_conf.h callback.h salloc.h rsinc.h menubar.h +rxvtc.o: iom_conf.h callback.h salloc.h rxvtperl.h hookinc.h rsinc.h +rxvtc.o: menubar.h rxvtd.o: ../config.h rxvt.h rxvtlib.h ptytty.h feature.h encoding.h rxvtd.o: rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h iom_conf.h callback.h -rxvtd.o: salloc.h rsinc.h menubar.h rxvtdaemon.h fdpass.h +rxvtd.o: salloc.h rxvtperl.h hookinc.h rsinc.h menubar.h rxvtdaemon.h +rxvtd.o: fdpass.h rxvtdaemon.o: rxvtdaemon.h rxvtutil.h rxvtfont.o: ../config.h rxvt.h rxvtlib.h ptytty.h feature.h encoding.h rxvtfont.o: rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h iom_conf.h callback.h -rxvtfont.o: salloc.h rsinc.h menubar.h table/linedraw.h +rxvtfont.o: salloc.h rxvtperl.h hookinc.h rsinc.h menubar.h table/linedraw.h rxvtperl.o: ../config.h rxvt.h rxvtlib.h ptytty.h feature.h encoding.h rxvtperl.o: rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h iom_conf.h callback.h -rxvtperl.o: salloc.h rsinc.h menubar.h rxvtperl.h perlxsi.c +rxvtperl.o: salloc.h rxvtperl.h hookinc.h rsinc.h menubar.h perlxsi.c rxvttoolkit.o: ../config.h rxvt.h rxvtlib.h ptytty.h feature.h encoding.h rxvttoolkit.o: rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h iom_conf.h -rxvttoolkit.o: callback.h salloc.h rsinc.h menubar.h +rxvttoolkit.o: callback.h salloc.h rxvtperl.h hookinc.h rsinc.h menubar.h rxvtutil.o: rxvtutil.h salloc.o: salloc.h screen.o: ../config.h rxvt.h rxvtlib.h ptytty.h feature.h encoding.h screen.o: rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h iom_conf.h callback.h -screen.o: salloc.h rsinc.h menubar.h rxvtperl.h salloc.C +screen.o: salloc.h rxvtperl.h hookinc.h rsinc.h menubar.h salloc.C scrollbar-next.o: ../config.h rxvt.h rxvtlib.h ptytty.h feature.h encoding.h scrollbar-next.o: rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h iom_conf.h -scrollbar-next.o: callback.h salloc.h rsinc.h menubar.h +scrollbar-next.o: callback.h salloc.h rxvtperl.h hookinc.h rsinc.h menubar.h scrollbar-plain.o: ../config.h rxvt.h rxvtlib.h ptytty.h feature.h encoding.h scrollbar-plain.o: rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h iom_conf.h -scrollbar-plain.o: callback.h salloc.h rsinc.h menubar.h +scrollbar-plain.o: callback.h salloc.h rxvtperl.h hookinc.h rsinc.h menubar.h scrollbar-rxvt.o: ../config.h rxvt.h rxvtlib.h ptytty.h feature.h encoding.h scrollbar-rxvt.o: rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h iom_conf.h -scrollbar-rxvt.o: callback.h salloc.h rsinc.h menubar.h +scrollbar-rxvt.o: callback.h salloc.h rxvtperl.h hookinc.h rsinc.h menubar.h scrollbar-xterm.o: ../config.h rxvt.h rxvtlib.h ptytty.h feature.h encoding.h scrollbar-xterm.o: rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h iom_conf.h -scrollbar-xterm.o: callback.h salloc.h rsinc.h menubar.h +scrollbar-xterm.o: callback.h salloc.h rxvtperl.h hookinc.h rsinc.h menubar.h scrollbar.o: ../config.h rxvt.h rxvtlib.h ptytty.h feature.h encoding.h scrollbar.o: rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h iom_conf.h callback.h -scrollbar.o: salloc.h rsinc.h menubar.h +scrollbar.o: salloc.h rxvtperl.h hookinc.h rsinc.h menubar.h strings.o: ../config.h rxvt.h rxvtlib.h ptytty.h feature.h encoding.h strings.o: rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h iom_conf.h callback.h -strings.o: salloc.h rsinc.h menubar.h +strings.o: salloc.h rxvtperl.h hookinc.h rsinc.h menubar.h xdefaults.o: ../config.h rxvt.h rxvtlib.h ptytty.h feature.h encoding.h xdefaults.o: rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h iom_conf.h callback.h -xdefaults.o: salloc.h rsinc.h menubar.h version.h keyboard.h +xdefaults.o: salloc.h rxvtperl.h hookinc.h rsinc.h menubar.h version.h +xdefaults.o: keyboard.h xpm.o: ../config.h rxvt.h rxvtlib.h ptytty.h feature.h encoding.h rxvtfont.h -xpm.o: rxvtutil.h rxvttoolkit.h iom.h iom_conf.h callback.h salloc.h rsinc.h -xpm.o: menubar.h +xpm.o: rxvtutil.h rxvttoolkit.h iom.h iom_conf.h callback.h salloc.h +xpm.o: rxvtperl.h hookinc.h rsinc.h menubar.h command.lo: ../config.h rxvt.h rxvtlib.h ptytty.h feature.h encoding.h command.lo: rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h iom_conf.h callback.h -command.lo: salloc.h rsinc.h menubar.h rxvtperl.h version.h command.h -command.lo: keyboard.h +command.lo: salloc.h rxvtperl.h hookinc.h rsinc.h menubar.h version.h +command.lo: command.h keyboard.h encoding.lo: ../config.h encoding.h table/iso8859_1.h table/iso8859_15.h encoding.lo: table/iso8859_2.h table/iso8859_3.h table/iso8859_4.h encoding.lo: table/iso8859_5.h table/iso8859_6.h table/iso8859_7.h @@ -237,74 +241,80 @@ encoding.lo: table/compose.h table/category.h fdpass.lo: ../config.h fdpass.h init.lo: ../config.h rxvt.h rxvtlib.h ptytty.h feature.h encoding.h init.lo: rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h iom_conf.h callback.h -init.lo: salloc.h rsinc.h menubar.h init.h +init.lo: salloc.h rxvtperl.h hookinc.h rsinc.h menubar.h init.h iom.lo: iom.h iom_conf.h rxvtutil.h callback.h keyboard.lo: ../config.h rxvt.h rxvtlib.h ptytty.h feature.h encoding.h keyboard.lo: rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h iom_conf.h callback.h -keyboard.lo: salloc.h rsinc.h menubar.h keyboard.h command.h +keyboard.lo: salloc.h rxvtperl.h hookinc.h rsinc.h menubar.h keyboard.h +keyboard.lo: command.h logging.lo: ../config.h rxvt.h rxvtlib.h ptytty.h feature.h encoding.h logging.lo: rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h iom_conf.h callback.h -logging.lo: salloc.h rsinc.h menubar.h logging.h +logging.lo: salloc.h rxvtperl.h hookinc.h rsinc.h menubar.h logging.h main.lo: ../config.h rxvt.h rxvtlib.h ptytty.h feature.h encoding.h main.lo: rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h iom_conf.h callback.h -main.lo: salloc.h rsinc.h menubar.h keyboard.h rxvtperl.h +main.lo: salloc.h rxvtperl.h hookinc.h rsinc.h menubar.h keyboard.h menubar.lo: ../config.h rxvt.h rxvtlib.h ptytty.h feature.h encoding.h menubar.lo: rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h iom_conf.h callback.h -menubar.lo: salloc.h rsinc.h menubar.h version.h +menubar.lo: salloc.h rxvtperl.h hookinc.h rsinc.h menubar.h version.h misc.lo: ../config.h rxvt.h rxvtlib.h ptytty.h feature.h encoding.h misc.lo: rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h iom_conf.h callback.h -misc.lo: salloc.h rsinc.h menubar.h +misc.lo: salloc.h rxvtperl.h hookinc.h rsinc.h menubar.h netdisp.lo: ../config.h rxvt.h rxvtlib.h ptytty.h feature.h encoding.h netdisp.lo: rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h iom_conf.h callback.h -netdisp.lo: salloc.h rsinc.h menubar.h +netdisp.lo: salloc.h rxvtperl.h hookinc.h rsinc.h menubar.h ptytty.lo: ../config.h rxvt.h rxvtlib.h ptytty.h feature.h encoding.h ptytty.lo: rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h iom_conf.h callback.h -ptytty.lo: salloc.h rsinc.h menubar.h +ptytty.lo: salloc.h rxvtperl.h hookinc.h rsinc.h menubar.h rxvt.lo: ../config.h rxvt.h rxvtlib.h ptytty.h feature.h encoding.h rxvt.lo: rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h iom_conf.h callback.h -rxvt.lo: salloc.h rsinc.h menubar.h +rxvt.lo: salloc.h rxvtperl.h hookinc.h rsinc.h menubar.h rxvtc.lo: ../config.h rxvtdaemon.h rxvtutil.h fdpass.h rxvt.h rxvtlib.h rxvtc.lo: ptytty.h feature.h encoding.h rxvtfont.h rxvttoolkit.h iom.h -rxvtc.lo: iom_conf.h callback.h salloc.h rsinc.h menubar.h +rxvtc.lo: iom_conf.h callback.h salloc.h rxvtperl.h hookinc.h rsinc.h +rxvtc.lo: menubar.h rxvtd.lo: ../config.h rxvt.h rxvtlib.h ptytty.h feature.h encoding.h rxvtd.lo: rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h iom_conf.h callback.h -rxvtd.lo: salloc.h rsinc.h menubar.h rxvtdaemon.h fdpass.h +rxvtd.lo: salloc.h rxvtperl.h hookinc.h rsinc.h menubar.h rxvtdaemon.h +rxvtd.lo: fdpass.h rxvtdaemon.lo: rxvtdaemon.h rxvtutil.h rxvtfont.lo: ../config.h rxvt.h rxvtlib.h ptytty.h feature.h encoding.h rxvtfont.lo: rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h iom_conf.h callback.h -rxvtfont.lo: salloc.h rsinc.h menubar.h table/linedraw.h +rxvtfont.lo: salloc.h rxvtperl.h hookinc.h rsinc.h menubar.h table/linedraw.h rxvtperl.lo: ../config.h rxvt.h rxvtlib.h ptytty.h feature.h encoding.h rxvtperl.lo: rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h iom_conf.h callback.h -rxvtperl.lo: salloc.h rsinc.h menubar.h rxvtperl.h perlxsi.c +rxvtperl.lo: salloc.h rxvtperl.h hookinc.h rsinc.h menubar.h perlxsi.c rxvttoolkit.lo: ../config.h rxvt.h rxvtlib.h ptytty.h feature.h encoding.h rxvttoolkit.lo: rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h iom_conf.h -rxvttoolkit.lo: callback.h salloc.h rsinc.h menubar.h +rxvttoolkit.lo: callback.h salloc.h rxvtperl.h hookinc.h rsinc.h menubar.h rxvtutil.lo: rxvtutil.h salloc.lo: salloc.h screen.lo: ../config.h rxvt.h rxvtlib.h ptytty.h feature.h encoding.h screen.lo: rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h iom_conf.h callback.h -screen.lo: salloc.h rsinc.h menubar.h rxvtperl.h salloc.C +screen.lo: salloc.h rxvtperl.h hookinc.h rsinc.h menubar.h salloc.C scrollbar-next.lo: ../config.h rxvt.h rxvtlib.h ptytty.h feature.h encoding.h scrollbar-next.lo: rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h iom_conf.h -scrollbar-next.lo: callback.h salloc.h rsinc.h menubar.h +scrollbar-next.lo: callback.h salloc.h rxvtperl.h hookinc.h rsinc.h menubar.h scrollbar-plain.lo: ../config.h rxvt.h rxvtlib.h ptytty.h feature.h scrollbar-plain.lo: encoding.h rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h -scrollbar-plain.lo: iom_conf.h callback.h salloc.h rsinc.h menubar.h +scrollbar-plain.lo: iom_conf.h callback.h salloc.h rxvtperl.h hookinc.h +scrollbar-plain.lo: rsinc.h menubar.h scrollbar-rxvt.lo: ../config.h rxvt.h rxvtlib.h ptytty.h feature.h encoding.h scrollbar-rxvt.lo: rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h iom_conf.h -scrollbar-rxvt.lo: callback.h salloc.h rsinc.h menubar.h +scrollbar-rxvt.lo: callback.h salloc.h rxvtperl.h hookinc.h rsinc.h menubar.h scrollbar-xterm.lo: ../config.h rxvt.h rxvtlib.h ptytty.h feature.h scrollbar-xterm.lo: encoding.h rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h -scrollbar-xterm.lo: iom_conf.h callback.h salloc.h rsinc.h menubar.h +scrollbar-xterm.lo: iom_conf.h callback.h salloc.h rxvtperl.h hookinc.h +scrollbar-xterm.lo: rsinc.h menubar.h scrollbar.lo: ../config.h rxvt.h rxvtlib.h ptytty.h feature.h encoding.h scrollbar.lo: rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h iom_conf.h callback.h -scrollbar.lo: salloc.h rsinc.h menubar.h +scrollbar.lo: salloc.h rxvtperl.h hookinc.h rsinc.h menubar.h strings.lo: ../config.h rxvt.h rxvtlib.h ptytty.h feature.h encoding.h strings.lo: rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h iom_conf.h callback.h -strings.lo: salloc.h rsinc.h menubar.h +strings.lo: salloc.h rxvtperl.h hookinc.h rsinc.h menubar.h xdefaults.lo: ../config.h rxvt.h rxvtlib.h ptytty.h feature.h encoding.h xdefaults.lo: rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h iom_conf.h callback.h -xdefaults.lo: salloc.h rsinc.h menubar.h version.h keyboard.h +xdefaults.lo: salloc.h rxvtperl.h hookinc.h rsinc.h menubar.h version.h +xdefaults.lo: keyboard.h xpm.lo: ../config.h rxvt.h rxvtlib.h ptytty.h feature.h encoding.h rxvtfont.h -xpm.lo: rxvtutil.h rxvttoolkit.h iom.h iom_conf.h callback.h salloc.h rsinc.h -xpm.lo: menubar.h +xpm.lo: rxvtutil.h rxvttoolkit.h iom.h iom_conf.h callback.h salloc.h +xpm.lo: rxvtperl.h hookinc.h rsinc.h menubar.h diff --git a/src/command.C b/src/command.C index a5819175..fb539abf 100644 --- a/src/command.C +++ b/src/command.C @@ -1564,18 +1564,20 @@ rxvt_term::x_cb (XEvent &ev) selection_send (ev.xselectionrequest); break; - case UnmapNotify: - mapped = 0; + case MapNotify: + mapped = 1; #ifdef TEXT_BLINK - text_blink_ev.stop (); + text_blink_ev.start (NOW + TEXT_BLINK_INTERVAL); #endif + HOOK_INVOKE ((this, HOOK_MAP_NOTIFY, DT_XEVENT, &ev, DT_END)); break; - case MapNotify: - mapped = 1; + case UnmapNotify: + mapped = 0; #ifdef TEXT_BLINK - text_blink_ev.start (NOW + TEXT_BLINK_INTERVAL); + text_blink_ev.stop (); #endif + HOOK_INVOKE ((this, HOOK_UNMAP_NOTIFY, DT_XEVENT, &ev, DT_END)); break; #ifdef TRANSPARENT diff --git a/src/hookinc.h b/src/hookinc.h index f2c9908e..abffd47a 100644 --- a/src/hookinc.h +++ b/src/hookinc.h @@ -12,9 +12,6 @@ def (SEL_CLICK) - def (FOCUS_IN) - def (FOCUS_OUT) - def (VIEW_CHANGE) def (SCROLL_BACK) def (LINE_UPDATE) @@ -26,8 +23,12 @@ def (KEYBOARD_COMMAND) + def (FOCUS_IN) + def (FOCUS_OUT) def (KEY_PRESS) def (KEY_RELEASE) def (BUTTON_PRESS) def (BUTTON_RELEASE) def (MOTION_NOTIFY) + def (MAP_NOTIFY) + def (UNMAP_NOTIFY) diff --git a/src/perl/urxvt-popup b/src/perl/urxvt-popup new file mode 100644 index 00000000..8e7a0424 --- /dev/null +++ b/src/perl/urxvt-popup @@ -0,0 +1,137 @@ +#! perl + +use List::Util; + +sub refresh { + my ($self) = @_; + + my $cmd = "\x1b[H"; + + my $row = 1; + for my $item (@{ $self->{data}{item} }) { + my $rend = "\x1b[30;47m"; + + if ($row == $self->{hover}) { + $rend = $self->{press} ? "\x1b[m" : "\x1b[30;46m"; + } + + $cmd .= "$rend\x1b[K" . $self->locale_encode ($item->{text}) . "\015\012"; + + $row++; + } + + $self->cmd_parse (substr $cmd, 0, -2); +} + +sub on_motion_notify { + my ($self, $event) = @_; + + $self->{hover} = $event->{row} + 1; + refresh $self; + + 1 +} + +sub on_button_press { + my ($self, $event) = @_; + + $self->{press}[$event->{button}] = 1; + refresh $self; + + 1 +} + +sub on_button_release { + my ($self, $event) = @_; + + my $row = $event->{row}; + my $col = $event->{col}; + + if ($event->{button} == $self->{data}{event}{button}) { + $self->ungrab; + $self->destroy; + } + + if ($event->{button} == 1) { + $self->{press}[$event->{button}] = 0; + refresh $self; + + warn "$event->{row} $event->{col}\n";#d# + + if ($col >= 0 && $col < $self->ncol + && $row >= 0 && $row < @{ $self->{data}{item} }) { + $self->{data}{item}[$row]{activate}->($event); + print "ok\n"; + } + } + + 1 +} + +sub on_focus_out { + my ($self) = @_; + + delete $self->{hover}; + refresh $self; + + () +} + +sub on_init { + my ($self) = @_; + + my $data = $self->{data} = $urxvt::popup::self; + + $_->{width} = $self->strwidth ($_->{text}) + for @{ $data->{item} }; + + $self->resource ($_ => $data->{term}->resource ($_)) + for qw(font boldFont italicFont boldItalicFont color+0 color+1); + + my $width = List::Util::max map $_->{width}, @{ $data->{item} }; + my $height = @{ $data->{item} }; + + my $pos = ""; + + 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"; + } + + $self->resource (geometry => "${width}x${height}$pos"); + + () +} + +sub on_start { + my ($self) = @_; + + # might fail, but try anyways + $self->grab ($self->{data}{event}{time}, 1) + and $self->allow_events_sync; + + on_button_press $self, $self->{data}{event} if $self->{data}{event}{button}; + + $self->cmd_parse ("\x1b[?25l\x1b[?7l"); + refresh $self; + + () +} + +sub on_map_notify { + my ($self, $event) = @_; + + # should definitely not fail + $self->grab ($self->{data}{event}{time}, 1) + and $self->allow_events_sync; +} + +sub on_destroy { +} + + + + + diff --git a/src/rxvtperl.xs b/src/rxvtperl.xs index 96f08fcf..a9c8b74e 100644 --- a/src/rxvtperl.xs +++ b/src/rxvtperl.xs @@ -585,22 +585,25 @@ PROTOTYPES: ENABLE BOOT: { -# define export_const(name) newCONSTSUB (gv_stashpv ("urxvt", 1), # name, newSViv (name)); + HV *stash = gv_stashpv ("urxvt", 1); +# define export_const_iv(name) newCONSTSUB (stash, # name, newSViv (name)); + AV *hookname = get_av ("urxvt::HOOKNAME", 1); # define def(sym) av_store (hookname, HOOK_ ## sym, newSVpv (# sym, 0)); # include "hookinc.h" # undef def - export_const (DEFAULT_RSTYLE); - export_const (OVERLAY_RSTYLE); - export_const (RS_Bold); - export_const (RS_Italic); - export_const (RS_Blink); - export_const (RS_RVid); - export_const (RS_Uline); - export_const (CurrentTime); - - sv_setpv (get_sv ("urxvt::LIBDIR", 1), LIBDIR); + + export_const_iv (DEFAULT_RSTYLE); + export_const_iv (OVERLAY_RSTYLE); + export_const_iv (RS_Bold); + export_const_iv (RS_Italic); + export_const_iv (RS_Blink); + export_const_iv (RS_RVid); + export_const_iv (RS_Uline); + export_const_iv (CurrentTime); + + sv_setsv (get_sv ("urxvt::LIBDIR", 1), newSVpvn (LIBDIR, sizeof (LIBDIR) - 1)); } SV * diff --git a/src/urxvt.pm b/src/urxvt.pm index c2a7a42c..86379892 100644 --- a/src/urxvt.pm +++ b/src/urxvt.pm @@ -181,16 +181,6 @@ processing. See the F example extension. -=item on_focus_in $term - -Called whenever the window gets the keyboard focus, before urxvt does -focus in processing. - -=item on_focus_out $term - -Called wheneever the window loses keyboard focus, before urxvt does focus -out processing. - =item on_view_change $term, $offset Called whenever the view offset changes, i..e the user or program @@ -263,6 +253,16 @@ Called whenever the user presses a key combination that has a C action bound to it (see description of the B resource in the @@RXVT_NAME@@(1) manpage). +=item on_focus_in $term + +Called whenever the window gets the keyboard focus, before rxvt-unicode +does focus in processing. + +=item on_focus_out $term + +Called wheneever the window loses keyboard focus, before rxvt-unicode does +focus out processing. + =item on_key_press $term, $event, $octets =item on_key_release $term, $event @@ -273,6 +273,10 @@ resource in the @@RXVT_NAME@@(1) manpage). =item on_motion_notify $term, $event +=item on_map_notify $term, $event + +=item on_unmap_notify $term, $event + Called whenever the corresponding X event is received for the terminal If the hook returns true, then the even will be ignored by rxvt-unicode. @@ -536,6 +540,14 @@ sub urxvt::term::proxy::AUTOLOAD { goto &$urxvt::term::proxy::AUTOLOAD; } +sub urxvt::destroy_hook::DESTROY { + ${$_[0]}->(); +} + +sub urxvt::destroy_hook(&) { + bless \shift, urxvt::destroy_hook:: +} + =head2 The C Class =over 4 @@ -583,7 +595,7 @@ list: sub urxvt::term::resource($$;$) { my ($self, $name) = (shift, shift); unshift @_, $self, $name, ($name =~ s/\s*\+\s*(\d+)$// ? $1 : 0); - goto &urxvt::term::_resource; + &urxvt::term::_resource } =item $rend = $term->rstyle ([$new_rstyle]) @@ -669,6 +681,33 @@ If hidden, display the overlay again. =back +=item $popup = $term->popup ($event) + +Creates a new C object that implements a popup menu. The +C<$event> I be the event causing the menu to pop up (a button event, +currently). + +=cut + +sub urxvt::term::popup { + my ($self, $event) = @_; + + $self->grab ($event->{time}, 1) + or return; + + my $popup = bless { + term => $self, + event => $event, + }, urxvt::popup::; + + Scalar::Util::weaken $popup->{term}; + + $self->{_destroy}{$popup} = urxvt::destroy_hook { $popup->{popup}->destroy }; + Scalar::Util::weaken $self->{_destroy}{$popup}; + + $popup +} + =item $cellwidth = $term->strwidth ($string) Returns the number of screen-cells this string would need. Correctly @@ -929,6 +968,43 @@ C<< $term->ROW_t >> for details. =back +=head2 The C Class + +=over 4 + +=cut + +package urxvt::popup; + +sub add_item { + my ($self, $item) = @_; + + push @{ $self->{item} }, $item; +} + +sub add_button { + my ($self, $text, $cb) = @_; + + $self->add_item ({ type => "button", text => "[ $text ]", activate => $cb }); +} + +sub show { + my ($self) = @_; + + local $urxvt::popup::self = $self; + + urxvt->new ("--perl-lib" => "", "--perl-ext-common" => "", "-pty-fd" => -1, "-sl" => 0, "-b" => 0, + "--transient-for" => $self->{term}->parent, + "-pe" => "urxvt_popup") + or die "unable to create popup window\n"; +} + +sub DESTROY { + my ($self) = @_; + + $self->{term}->ungrab; +} + =head2 The C Class This class implements timer watchers/events. Time is represented as a