--- rxvt-unicode/src/rxvtperl.xs 2007/10/31 09:55:24 1.115 +++ rxvt-unicode/src/rxvtperl.xs 2008/11/05 14:43:54 1.126 @@ -3,7 +3,7 @@ *----------------------------------------------------------------------* * * All portions of code are copyright by their respective author/s. - * Copyright (c) 2005-2006 Marc Lehmann + * Copyright (c) 2005-2008 Marc Lehmann * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -33,7 +33,7 @@ #include "unistd.h" -#include "iom.h" +#include "ev_cpp.h" #include "rxvt.h" #include "keyboard.h" #include "rxvtutil.h" @@ -41,11 +41,7 @@ #include "perlxsi.c" -#ifdef HAVE_SCROLLBARS -# define GRAB_CURSOR THIS->leftptr_cursor -#else -# define GRAB_CURSOR None -#endif +#define GRAB_CURSOR THIS->scrollBar.leftptr_cursor #undef LINENO #define LINENO(n) MOD (THIS->term_start + int(n), THIS->total_rows) @@ -113,13 +109,11 @@ #define SvOVERLAY(sv) (overlay *)SvPTR (sv, "urxvt::overlay") -class overlay { +class overlay : overlay_base +{ rxvt_term *THIS; AV *overlay_av; - int x, y, w, h; int border; - text_t **text; - rend_t **rend; public: HV *self; @@ -136,8 +130,13 @@ }; overlay::overlay (rxvt_term *THIS, int x_, int y_, int w_, int h_, rend_t rstyle, int border) -: THIS(THIS), x(x_), y(y_), w(w_), h(h_), border(border == 2), overlay_av (0) +: THIS(THIS), border(border == 2), overlay_av (0) { + x = x_; + y = y_; + w = w_; + h = h_; + if (w < 0) w = 0; if (h < 0) h = 0; @@ -216,6 +215,7 @@ av_push (overlay_av, newSViv ((long)this)); THIS->want_refresh = 1; + THIS->refresh_check (); } void @@ -239,6 +239,7 @@ overlay_av = 0; THIS->want_refresh = 1; + THIS->refresh_check (); } void overlay::swap () @@ -249,6 +250,11 @@ int ov_w = min (w, THIS->ncol - ov_x); int ov_h = min (h, THIS->nrow - ov_y); + // hide cursor if it is within the overlay area + if (IN_RANGE_EXC (THIS->screen.cur.col - ov_x, 0, ov_w) + && IN_RANGE_EXC (THIS->screen.cur.row - ov_y, 0, ov_h)) + THIS->screen.flags &= ~Screen_VisibleCursor; + for (int y = ov_h; y--; ) { text_t *t1 = text [y]; @@ -293,13 +299,14 @@ } THIS->want_refresh = 1; + THIS->refresh_check (); } ///////////////////////////////////////////////////////////////////////////// #define IOM_CLASS "urxvt" #define IOM_WARN rxvt_warn -#include +#include "iom_perl.h" ///////////////////////////////////////////////////////////////////////////// @@ -313,6 +320,7 @@ { perl_destruct (perl); perl_free (perl); + PERL_SYS_TERM (); } } @@ -326,7 +334,7 @@ perl_environ = rxvt_environ; swap (perl_environ, environ); - char *argv[] = { + char *args[] = { "", "-e" "BEGIN {" @@ -336,11 +344,14 @@ "" "use urxvt;" }; + int argc = sizeof (args) / sizeof (args[0]); + char **argv = args; + PERL_SYS_INIT3 (&argc, &argv, &environ); perl = perl_alloc (); perl_construct (perl); - if (perl_parse (perl, xs_init, 2, argv, (char **)NULL) + if (perl_parse (perl, xs_init, argc, argv, (char **)NULL) || perl_run (perl)) { rxvt_warn ("unable to initialize perl-interpreter, continuing without.\n"); @@ -642,6 +653,7 @@ IV iv; } *civ, const_iv[] = { # define const_iv(name) { # name, (IV)name } + const_iv (NUM_RESOURCES), const_iv (DEFAULT_RSTYLE), const_iv (OVERLAY_RSTYLE), const_iv (RS_Bold), @@ -777,7 +789,7 @@ NV NOW () CODE: - RETVAL = NOW; + RETVAL = ev::now (); OUTPUT: RETVAL @@ -859,19 +871,12 @@ envv->push_back (0); - bool success; - try { - success = term->init (argv, envv); + term->init (argv, envv); } catch (const class rxvt_failure_exception &e) { - success = false; - } - - if (!success) - { term->destroy (); croak ("error while initializing new terminal instance"); } @@ -1106,7 +1111,9 @@ case 1: RETVAL = THIS->ModMetaMask; break; case 2: RETVAL = THIS->ModNumLockMask; break; case 3: RETVAL = THIS->current_screen; break; +#ifdef CURSOR_BLINK case 4: RETVAL = THIS->hidden_cursor; break; +#endif } OUTPUT: RETVAL @@ -1141,10 +1148,10 @@ } int -rxvt_term::pty_ev_events (int events = EVENT_UNDEF) +rxvt_term::pty_ev_events (int events = ev::UNDEF) CODE: RETVAL = THIS->pty_ev.events; - if (events != EVENT_UNDEF) + if (events != ev::UNDEF) THIS->pty_ev.set (events); OUTPUT: RETVAL @@ -1233,6 +1240,7 @@ rxvt_term::want_refresh () CODE: THIS->want_refresh = 1; + THIS->refresh_check (); void rxvt_term::ROW_t (int row_number, SV *new_text = 0, int start_col = 0, int start_ofs = 0, int max_len = MAX_COLS) @@ -1439,12 +1447,20 @@ rs = rslist + sizeof (rslist) / sizeof (rslist [0]); - do { - if (rs-- == rslist) - croak ("no such resource '%s', requested", name); - } while (strcmp (name, rs->name)); + if (*name) + { + do { + if (rs-- == rslist) + croak ("no such resource '%s', requested", name); + } while (strcmp (name, rs->name)); - index += rs->value; + index += rs->value; + } + else + { + --rs; + name = ""; + } if (!IN_RANGE_EXC (index, 0, NUM_RESOURCES)) croak ("requested out-of-bound resource %s+%d,", name, index - rs->value); @@ -1478,7 +1494,7 @@ { THIS->set_option (optval, set); - if (THIS->check_ev.is_active ()) // avoid doing this before START + if (THIS->env_colorfgbg [0]) // avoid doing this before START switch (optval) { case Opt_skipBuiltinGlyphs: @@ -1486,10 +1502,12 @@ THIS->scr_remap_chars (); THIS->scr_touch (true); THIS->want_refresh = 1; + THIS->refresh_check (); break; case Opt_cursorUnderline: THIS->want_refresh = 1; + THIS->refresh_check (); break; # case Opt_scrollBar_floating: @@ -1557,7 +1575,10 @@ clamp_it (rc.row, THIS->top_row, THIS->nrow - 1); if (ix) - THIS->want_refresh = 1; + { + THIS->want_refresh = 1; + THIS->refresh_check (); + } } } @@ -1707,7 +1728,7 @@ } void -rxvt_term::XChangeWindowProperty (Window window, Atom property, Atom type, int format, SV *data) +rxvt_term::XChangeProperty (Window window, Atom property, Atom type, int format, SV *data) CODE: { STRLEN len;