ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/rxvtperl.xs
(Generate patch)

Comparing rxvt-unicode/src/rxvtperl.xs (file contents):
Revision 1.115 by ayin, Wed Oct 31 09:55:24 2007 UTC vs.
Revision 1.123 by root, Sun Jun 15 14:54:44 2008 UTC

1/*----------------------------------------------------------------------* 1/*----------------------------------------------------------------------*
2 * File: rxvtperl.xs 2 * File: rxvtperl.xs
3 *----------------------------------------------------------------------* 3 *----------------------------------------------------------------------*
4 * 4 *
5 * All portions of code are copyright by their respective author/s. 5 * All portions of code are copyright by their respective author/s.
6 * Copyright (c) 2005-2006 Marc Lehmann <pcg@goof.com> 6 * Copyright (c) 2005-2008 Marc Lehmann <pcg@goof.com>
7 * 7 *
8 * This program is free software; you can redistribute it and/or modify 8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by 9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or 10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version. 11 * (at your option) any later version.
31#include <cstddef> 31#include <cstddef>
32#include <cstdarg> 32#include <cstdarg>
33 33
34#include "unistd.h" 34#include "unistd.h"
35 35
36#include "iom.h" 36#include "ev_cpp.h"
37#include "rxvt.h" 37#include "rxvt.h"
38#include "keyboard.h" 38#include "keyboard.h"
39#include "rxvtutil.h" 39#include "rxvtutil.h"
40#include "rxvtperl.h" 40#include "rxvtperl.h"
41 41
42#include "perlxsi.c" 42#include "perlxsi.c"
43 43
44#ifdef HAVE_SCROLLBARS
45# define GRAB_CURSOR THIS->leftptr_cursor 44#define GRAB_CURSOR THIS->scrollBar.leftptr_cursor
46#else
47# define GRAB_CURSOR None
48#endif
49 45
50#undef LINENO 46#undef LINENO
51#define LINENO(n) MOD (THIS->term_start + int(n), THIS->total_rows) 47#define LINENO(n) MOD (THIS->term_start + int(n), THIS->total_rows)
52#undef ROW 48#undef ROW
53#define ROW(n) THIS->row_buf [LINENO (n)] 49#define ROW(n) THIS->row_buf [LINENO (n)]
214 *hv_fetch ((HV *)SvRV ((SV *)THIS->perl.self), "_overlay", 8, 0) 210 *hv_fetch ((HV *)SvRV ((SV *)THIS->perl.self), "_overlay", 8, 0)
215 )); 211 ));
216 av_push (overlay_av, newSViv ((long)this)); 212 av_push (overlay_av, newSViv ((long)this));
217 213
218 THIS->want_refresh = 1; 214 THIS->want_refresh = 1;
215 THIS->refresh_check ();
219} 216}
220 217
221void 218void
222overlay::hide () 219overlay::hide ()
223{ 220{
237 234
238 SvREFCNT_dec (overlay_av); 235 SvREFCNT_dec (overlay_av);
239 overlay_av = 0; 236 overlay_av = 0;
240 237
241 THIS->want_refresh = 1; 238 THIS->want_refresh = 1;
239 THIS->refresh_check ();
242} 240}
243 241
244void overlay::swap () 242void overlay::swap ()
245{ 243{
246 int ov_x = max (0, min (MOD (x, THIS->ncol), THIS->ncol - w)); 244 int ov_x = max (0, min (MOD (x, THIS->ncol), THIS->ncol - w));
291 for (int col = min (AvFILL (av) + 1, w - x - border); col--; ) 289 for (int col = min (AvFILL (av) + 1, w - x - border); col--; )
292 this->rend [y][x + col] = SvIV (*av_fetch (av, col, 1)); 290 this->rend [y][x + col] = SvIV (*av_fetch (av, col, 1));
293 } 291 }
294 292
295 THIS->want_refresh = 1; 293 THIS->want_refresh = 1;
294 THIS->refresh_check ();
296} 295}
297 296
298///////////////////////////////////////////////////////////////////////////// 297/////////////////////////////////////////////////////////////////////////////
299 298
300#define IOM_CLASS "urxvt" 299#define IOM_CLASS "urxvt"
301#define IOM_WARN rxvt_warn 300#define IOM_WARN rxvt_warn
302#include <iom_perl.h> 301#include "iom_perl.h"
303 302
304///////////////////////////////////////////////////////////////////////////// 303/////////////////////////////////////////////////////////////////////////////
305 304
306struct rxvt_perl_interp rxvt_perl; 305struct rxvt_perl_interp rxvt_perl;
307 306
640 static const struct { 639 static const struct {
641 const char *name; 640 const char *name;
642 IV iv; 641 IV iv;
643 } *civ, const_iv[] = { 642 } *civ, const_iv[] = {
644# define const_iv(name) { # name, (IV)name } 643# define const_iv(name) { # name, (IV)name }
644 const_iv (NUM_RESOURCES),
645 const_iv (DEFAULT_RSTYLE), 645 const_iv (DEFAULT_RSTYLE),
646 const_iv (OVERLAY_RSTYLE), 646 const_iv (OVERLAY_RSTYLE),
647 const_iv (RS_Bold), 647 const_iv (RS_Bold),
648 const_iv (RS_Italic), 648 const_iv (RS_Italic),
649 const_iv (RS_Blink), 649 const_iv (RS_Blink),
775_exit (int status) 775_exit (int status)
776 776
777NV 777NV
778NOW () 778NOW ()
779 CODE: 779 CODE:
780 RETVAL = NOW; 780 RETVAL = ev::now ();
781 OUTPUT: 781 OUTPUT:
782 RETVAL 782 RETVAL
783 783
784int 784int
785GET_BASEFG (int rend) 785GET_BASEFG (int rend)
857 for (int i = AvFILL (env) + 1; i--; ) 857 for (int i = AvFILL (env) + 1; i--; )
858 envv->push_back (strdup (SvPVbyte_nolen (*av_fetch (env, i, 1)))); 858 envv->push_back (strdup (SvPVbyte_nolen (*av_fetch (env, i, 1))));
859 859
860 envv->push_back (0); 860 envv->push_back (0);
861 861
862 bool success;
863
864 try 862 try
865 { 863 {
866 success = term->init (argv, envv); 864 term->init (argv, envv);
867 } 865 }
868 catch (const class rxvt_failure_exception &e) 866 catch (const class rxvt_failure_exception &e)
869 {
870 success = false;
871 }
872
873 if (!success)
874 { 867 {
875 term->destroy (); 868 term->destroy ();
876 croak ("error while initializing new terminal instance"); 869 croak ("error while initializing new terminal instance");
877 } 870 }
878 871
1139 if (*i) 1132 if (*i)
1140 PUSHs (sv_2mortal (newSVpv (*i, 0))); 1133 PUSHs (sv_2mortal (newSVpv (*i, 0)));
1141} 1134}
1142 1135
1143int 1136int
1144rxvt_term::pty_ev_events (int events = EVENT_UNDEF) 1137rxvt_term::pty_ev_events (int events = ev::UNDEF)
1145 CODE: 1138 CODE:
1146 RETVAL = THIS->pty_ev.events; 1139 RETVAL = THIS->pty_ev.events;
1147 if (events != EVENT_UNDEF) 1140 if (events != ev::UNDEF)
1148 THIS->pty_ev.set (events); 1141 THIS->pty_ev.set (events);
1149 OUTPUT: 1142 OUTPUT:
1150 RETVAL 1143 RETVAL
1151 1144
1152int 1145int
1231 1224
1232void 1225void
1233rxvt_term::want_refresh () 1226rxvt_term::want_refresh ()
1234 CODE: 1227 CODE:
1235 THIS->want_refresh = 1; 1228 THIS->want_refresh = 1;
1229 THIS->refresh_check ();
1236 1230
1237void 1231void
1238rxvt_term::ROW_t (int row_number, SV *new_text = 0, int start_col = 0, int start_ofs = 0, int max_len = MAX_COLS) 1232rxvt_term::ROW_t (int row_number, SV *new_text = 0, int start_col = 0, int start_ofs = 0, int max_len = MAX_COLS)
1239 PPCODE: 1233 PPCODE:
1240{ 1234{
1437# undef reserve 1431# undef reserve
1438 }; 1432 };
1439 1433
1440 rs = rslist + sizeof (rslist) / sizeof (rslist [0]); 1434 rs = rslist + sizeof (rslist) / sizeof (rslist [0]);
1441 1435
1436 if (*name)
1442 do { 1437 {
1438 do {
1443 if (rs-- == rslist) 1439 if (rs-- == rslist)
1444 croak ("no such resource '%s', requested", name); 1440 croak ("no such resource '%s', requested", name);
1445 } while (strcmp (name, rs->name)); 1441 } while (strcmp (name, rs->name));
1446 1442
1447 index += rs->value; 1443 index += rs->value;
1444 }
1445 else
1446 {
1447 --rs;
1448 name = "";
1449 }
1448 1450
1449 if (!IN_RANGE_EXC (index, 0, NUM_RESOURCES)) 1451 if (!IN_RANGE_EXC (index, 0, NUM_RESOURCES))
1450 croak ("requested out-of-bound resource %s+%d,", name, index - rs->value); 1452 croak ("requested out-of-bound resource %s+%d,", name, index - rs->value);
1451 1453
1452 if (GIMME_V != G_VOID) 1454 if (GIMME_V != G_VOID)
1476 1478
1477 if (set >= 0) 1479 if (set >= 0)
1478 { 1480 {
1479 THIS->set_option (optval, set); 1481 THIS->set_option (optval, set);
1480 1482
1481 if (THIS->check_ev.is_active ()) // avoid doing this before START 1483 if (THIS->env_colorfgbg [0]) // avoid doing this before START
1482 switch (optval) 1484 switch (optval)
1483 { 1485 {
1484 case Opt_skipBuiltinGlyphs: 1486 case Opt_skipBuiltinGlyphs:
1485 THIS->set_fonts (); 1487 THIS->set_fonts ();
1486 THIS->scr_remap_chars (); 1488 THIS->scr_remap_chars ();
1487 THIS->scr_touch (true); 1489 THIS->scr_touch (true);
1488 THIS->want_refresh = 1; 1490 THIS->want_refresh = 1;
1491 THIS->refresh_check ();
1489 break; 1492 break;
1490 1493
1491 case Opt_cursorUnderline: 1494 case Opt_cursorUnderline:
1492 THIS->want_refresh = 1; 1495 THIS->want_refresh = 1;
1496 THIS->refresh_check ();
1493 break; 1497 break;
1494 1498
1495# case Opt_scrollBar_floating: 1499# case Opt_scrollBar_floating:
1496# case Opt_scrollBar_right: 1500# case Opt_scrollBar_right:
1497# THIS->resize_all_windows (THIS->width, THIS->height, 1); 1501# THIS->resize_all_windows (THIS->width, THIS->height, 1);
1555 1559
1556 clamp_it (rc.col, 0, THIS->ncol); 1560 clamp_it (rc.col, 0, THIS->ncol);
1557 clamp_it (rc.row, THIS->top_row, THIS->nrow - 1); 1561 clamp_it (rc.row, THIS->top_row, THIS->nrow - 1);
1558 1562
1559 if (ix) 1563 if (ix)
1564 {
1560 THIS->want_refresh = 1; 1565 THIS->want_refresh = 1;
1566 THIS->refresh_check ();
1567 }
1561 } 1568 }
1562} 1569}
1563 1570
1564char 1571char
1565rxvt_term::cur_charset () 1572rxvt_term::cur_charset ()
1705 XFree (prop); 1712 XFree (prop);
1706 } 1713 }
1707} 1714}
1708 1715
1709void 1716void
1710rxvt_term::XChangeWindowProperty (Window window, Atom property, Atom type, int format, SV *data) 1717rxvt_term::XChangeProperty (Window window, Atom property, Atom type, int format, SV *data)
1711 CODE: 1718 CODE:
1712{ 1719{
1713 STRLEN len; 1720 STRLEN len;
1714 char *data_ = SvPVbyte (data, len); 1721 char *data_ = SvPVbyte (data, len);
1715 1722

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines