… | |
… | |
282 | } |
282 | } |
283 | } |
283 | } |
284 | |
284 | |
285 | } |
285 | } |
286 | |
286 | |
287 | void overlay::set (int x, int y, SV *str, SV *rend) |
287 | void overlay::set (int x, int y, SV *text, SV *rend) |
288 | { |
288 | { |
289 | x += border; |
289 | x += border; |
290 | y += border; |
290 | y += border; |
291 | |
291 | |
292 | if (!IN_RANGE_EXC (y, 0, h - border)) |
292 | if (!IN_RANGE_EXC (y, 0, h - border)) |
293 | return; |
293 | return; |
294 | |
294 | |
295 | wchar_t *wstr = sv2wcs (str); |
295 | wchar_t *wtext = sv2wcs (text); |
296 | |
296 | |
297 | for (int col = min (wcslen (wstr), w - x - border); col--; ) |
297 | for (int col = min (wcslen (wtext), w - x - border); col--; ) |
298 | text [y][x + col] = wstr [col]; |
298 | this->text [y][x + col] = wtext [col]; |
299 | |
299 | |
300 | free (wstr); |
300 | free (wtext); |
|
|
301 | |
|
|
302 | if (rend) |
|
|
303 | { |
|
|
304 | if (!SvROK (rend) || SvTYPE (SvRV (rend)) != SVt_PVAV) |
|
|
305 | croak ("rend must be arrayref"); |
|
|
306 | |
|
|
307 | AV *av = (AV *)SvRV (rend); |
|
|
308 | |
|
|
309 | for (int col = min (av_len (av) + 1, w - x - border); col--; ) |
|
|
310 | this->rend [y][x + col] = SvIV (*av_fetch (av, col, 1)); |
|
|
311 | } |
301 | |
312 | |
302 | THIS->want_refresh = 1; |
313 | THIS->want_refresh = 1; |
303 | } |
314 | } |
304 | |
315 | |
305 | |
316 | |
… | |
… | |
356 | if (htype == HOOK_INIT) // first hook ever called |
367 | if (htype == HOOK_INIT) // first hook ever called |
357 | { |
368 | { |
358 | term->self = (void *)newSVptr ((void *)term, "urxvt::term"); |
369 | term->self = (void *)newSVptr ((void *)term, "urxvt::term"); |
359 | hv_store ((HV *)SvRV ((SV *)term->self), "_overlay", 8, newRV_noinc ((SV *)newHV ()), 0); |
370 | hv_store ((HV *)SvRV ((SV *)term->self), "_overlay", 8, newRV_noinc ((SV *)newHV ()), 0); |
360 | } |
371 | } |
|
|
372 | else if (!term->self) |
|
|
373 | return false; // perl not initialized for this instance |
361 | else if (htype == HOOK_DESTROY) |
374 | else if (htype == HOOK_DESTROY) |
362 | { |
375 | { |
363 | // handled later |
376 | // handled later |
364 | } |
377 | } |
365 | else if (htype == HOOK_REFRESH_BEGIN || htype == HOOK_REFRESH_END) |
378 | else if (htype == HOOK_REFRESH_BEGIN || htype == HOOK_REFRESH_END) |
… | |
… | |
831 | THIS->want_refresh = 1; |
844 | THIS->want_refresh = 1; |
832 | } |
845 | } |
833 | } |
846 | } |
834 | |
847 | |
835 | int |
848 | int |
836 | rxvt_term::selection_grab (int eventtime) |
849 | rxvt_term::selection_grab (int eventtime = CurrentTime) |
837 | |
850 | |
838 | void |
851 | void |
839 | rxvt_term::selection (SV *newtext = 0) |
852 | rxvt_term::selection (SV *newtext = 0) |
840 | PPCODE: |
853 | PPCODE: |
841 | { |
854 | { |