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.120 by root, Fri Jan 25 16:04:57 2008 UTC vs.
Revision 1.126 by root, Wed Nov 5 14:43:54 2008 UTC

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->scrollBar.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)]
111 107
112///////////////////////////////////////////////////////////////////////////// 108/////////////////////////////////////////////////////////////////////////////
113 109
114#define SvOVERLAY(sv) (overlay *)SvPTR (sv, "urxvt::overlay") 110#define SvOVERLAY(sv) (overlay *)SvPTR (sv, "urxvt::overlay")
115 111
116class overlay { 112class overlay : overlay_base
113{
117 rxvt_term *THIS; 114 rxvt_term *THIS;
118 AV *overlay_av; 115 AV *overlay_av;
119 int x, y, w, h;
120 int border; 116 int border;
121 text_t **text;
122 rend_t **rend;
123 117
124public: 118public:
125 HV *self; 119 HV *self;
126 120
127 overlay (rxvt_term *THIS, int x_, int y_, int w_, int h_, rend_t rstyle, int border); 121 overlay (rxvt_term *THIS, int x_, int y_, int w_, int h_, rend_t rstyle, int border);
134 128
135 void set (int x, int y, SV *str, SV *rend); 129 void set (int x, int y, SV *str, SV *rend);
136}; 130};
137 131
138overlay::overlay (rxvt_term *THIS, int x_, int y_, int w_, int h_, rend_t rstyle, int border) 132overlay::overlay (rxvt_term *THIS, int x_, int y_, int w_, int h_, rend_t rstyle, int border)
139: THIS(THIS), x(x_), y(y_), w(w_), h(h_), border(border == 2), overlay_av (0) 133: THIS(THIS), border(border == 2), overlay_av (0)
140{ 134{
135 x = x_;
136 y = y_;
137 w = w_;
138 h = h_;
139
141 if (w < 0) w = 0; 140 if (w < 0) w = 0;
142 if (h < 0) h = 0; 141 if (h < 0) h = 0;
143 142
144 if (border == 2) 143 if (border == 2)
145 { 144 {
249 int ov_y = max (0, min (MOD (y, THIS->nrow), THIS->nrow - h)); 248 int ov_y = max (0, min (MOD (y, THIS->nrow), THIS->nrow - h));
250 249
251 int ov_w = min (w, THIS->ncol - ov_x); 250 int ov_w = min (w, THIS->ncol - ov_x);
252 int ov_h = min (h, THIS->nrow - ov_y); 251 int ov_h = min (h, THIS->nrow - ov_y);
253 252
253 // hide cursor if it is within the overlay area
254 if (IN_RANGE_EXC (THIS->screen.cur.col - ov_x, 0, ov_w)
255 && IN_RANGE_EXC (THIS->screen.cur.row - ov_y, 0, ov_h))
256 THIS->screen.flags &= ~Screen_VisibleCursor;
257
254 for (int y = ov_h; y--; ) 258 for (int y = ov_h; y--; )
255 { 259 {
256 text_t *t1 = text [y]; 260 text_t *t1 = text [y];
257 rend_t *r1 = rend [y]; 261 rend_t *r1 = rend [y];
258 262
314{ 318{
315 if (perl) 319 if (perl)
316 { 320 {
317 perl_destruct (perl); 321 perl_destruct (perl);
318 perl_free (perl); 322 perl_free (perl);
323 PERL_SYS_TERM ();
319 } 324 }
320} 325}
321 326
322void 327void
323rxvt_perl_interp::init (rxvt_term *term) 328rxvt_perl_interp::init (rxvt_term *term)
327 rxvt_push_locale (""); // perl init destroys current locale 332 rxvt_push_locale (""); // perl init destroys current locale
328 333
329 perl_environ = rxvt_environ; 334 perl_environ = rxvt_environ;
330 swap (perl_environ, environ); 335 swap (perl_environ, environ);
331 336
332 char *argv[] = { 337 char *args[] = {
333 "", 338 "",
334 "-e" 339 "-e"
335 "BEGIN {" 340 "BEGIN {"
336 " urxvt->bootstrap;" 341 " urxvt->bootstrap;"
337 " unshift @INC, '" LIBDIR "';" 342 " unshift @INC, '" LIBDIR "';"
338 "}" 343 "}"
339 "" 344 ""
340 "use urxvt;" 345 "use urxvt;"
341 }; 346 };
347 int argc = sizeof (args) / sizeof (args[0]);
348 char **argv = args;
342 349
350 PERL_SYS_INIT3 (&argc, &argv, &environ);
343 perl = perl_alloc (); 351 perl = perl_alloc ();
344 perl_construct (perl); 352 perl_construct (perl);
345 353
346 if (perl_parse (perl, xs_init, 2, argv, (char **)NULL) 354 if (perl_parse (perl, xs_init, argc, argv, (char **)NULL)
347 || perl_run (perl)) 355 || perl_run (perl))
348 { 356 {
349 rxvt_warn ("unable to initialize perl-interpreter, continuing without.\n"); 357 rxvt_warn ("unable to initialize perl-interpreter, continuing without.\n");
350 358
351 perl_destruct (perl); 359 perl_destruct (perl);
643 static const struct { 651 static const struct {
644 const char *name; 652 const char *name;
645 IV iv; 653 IV iv;
646 } *civ, const_iv[] = { 654 } *civ, const_iv[] = {
647# define const_iv(name) { # name, (IV)name } 655# define const_iv(name) { # name, (IV)name }
656 const_iv (NUM_RESOURCES),
648 const_iv (DEFAULT_RSTYLE), 657 const_iv (DEFAULT_RSTYLE),
649 const_iv (OVERLAY_RSTYLE), 658 const_iv (OVERLAY_RSTYLE),
650 const_iv (RS_Bold), 659 const_iv (RS_Bold),
651 const_iv (RS_Italic), 660 const_iv (RS_Italic),
652 const_iv (RS_Blink), 661 const_iv (RS_Blink),
1100 { 1109 {
1101 case 0: RETVAL = THIS->ModLevel3Mask; break; 1110 case 0: RETVAL = THIS->ModLevel3Mask; break;
1102 case 1: RETVAL = THIS->ModMetaMask; break; 1111 case 1: RETVAL = THIS->ModMetaMask; break;
1103 case 2: RETVAL = THIS->ModNumLockMask; break; 1112 case 2: RETVAL = THIS->ModNumLockMask; break;
1104 case 3: RETVAL = THIS->current_screen; break; 1113 case 3: RETVAL = THIS->current_screen; break;
1114#ifdef CURSOR_BLINK
1105 case 4: RETVAL = THIS->hidden_cursor; break; 1115 case 4: RETVAL = THIS->hidden_cursor; break;
1116#endif
1106 } 1117 }
1107 OUTPUT: 1118 OUTPUT:
1108 RETVAL 1119 RETVAL
1109 1120
1110char * 1121char *
1434# undef reserve 1445# undef reserve
1435 }; 1446 };
1436 1447
1437 rs = rslist + sizeof (rslist) / sizeof (rslist [0]); 1448 rs = rslist + sizeof (rslist) / sizeof (rslist [0]);
1438 1449
1450 if (*name)
1439 do { 1451 {
1452 do {
1440 if (rs-- == rslist) 1453 if (rs-- == rslist)
1441 croak ("no such resource '%s', requested", name); 1454 croak ("no such resource '%s', requested", name);
1442 } while (strcmp (name, rs->name)); 1455 } while (strcmp (name, rs->name));
1443 1456
1444 index += rs->value; 1457 index += rs->value;
1458 }
1459 else
1460 {
1461 --rs;
1462 name = "";
1463 }
1445 1464
1446 if (!IN_RANGE_EXC (index, 0, NUM_RESOURCES)) 1465 if (!IN_RANGE_EXC (index, 0, NUM_RESOURCES))
1447 croak ("requested out-of-bound resource %s+%d,", name, index - rs->value); 1466 croak ("requested out-of-bound resource %s+%d,", name, index - rs->value);
1448 1467
1449 if (GIMME_V != G_VOID) 1468 if (GIMME_V != G_VOID)
1707 XFree (prop); 1726 XFree (prop);
1708 } 1727 }
1709} 1728}
1710 1729
1711void 1730void
1712rxvt_term::XChangeWindowProperty (Window window, Atom property, Atom type, int format, SV *data) 1731rxvt_term::XChangeProperty (Window window, Atom property, Atom type, int format, SV *data)
1713 CODE: 1732 CODE:
1714{ 1733{
1715 STRLEN len; 1734 STRLEN len;
1716 char *data_ = SvPVbyte (data, len); 1735 char *data_ = SvPVbyte (data, len);
1717 1736

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines