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