… | |
… | |
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); |