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.133 by root, Tue Dec 7 17:51:27 2010 UTC vs.
Revision 1.152 by sf-exg, Thu Jan 19 13:33:43 2012 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-2008 Marc Lehmann <pcg@goof.com> 6 * Copyright (c) 2005-2008,2011 Marc Lehmann <schmorp@schmorp.de>
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.
23#define line_t perl_line_t 23#define line_t perl_line_t
24#include <EXTERN.h> 24#include <EXTERN.h>
25#include <perl.h> 25#include <perl.h>
26#include <XSUB.h> 26#include <XSUB.h>
27#undef line_t 27#undef line_t
28#undef bool // perl defines it's own bool type, except with g++... what a trap
28 29
29#include "../config.h" 30#include "../config.h"
30 31
31#include <cstddef> 32#include <stddef.h>
32#include <cstdarg> 33#include <stdarg.h>
33 34
34#include "unistd.h" 35#include "unistd.h"
35 36
36#include "ev_cpp.h" 37#include "ev_cpp.h"
37#include "rxvt.h" 38#include "rxvt.h"
302 THIS->refresh_check (); 303 THIS->refresh_check ();
303} 304}
304 305
305///////////////////////////////////////////////////////////////////////////// 306/////////////////////////////////////////////////////////////////////////////
306 307
307#define IOM_CLASS "urxvt"
308#define IOM_WARN rxvt_warn
309#include "iom_perl.h" 308#include "iom_perl.h"
310 309
311///////////////////////////////////////////////////////////////////////////// 310/////////////////////////////////////////////////////////////////////////////
312 311
313struct rxvt_perl_interp rxvt_perl; 312struct rxvt_perl_interp rxvt_perl;
329{ 328{
330 if (!perl) 329 if (!perl)
331 { 330 {
332 rxvt_push_locale (""); // perl init destroys current locale 331 rxvt_push_locale (""); // perl init destroys current locale
333 332
333 {
334 perl_environ = rxvt_environ; 334 perl_environ = rxvt_environ;
335 swap (perl_environ, environ); 335 localise_env set_environ (perl_environ);
336 336
337 char *args[] = { 337 char *args[] = {
338 "", 338 "",
339 "-e" 339 "-e"
340 "BEGIN {" 340 "BEGIN {"
341 " urxvt->bootstrap;" 341 " urxvt->bootstrap;"
342 " unshift @INC, '" LIBDIR "';" 342 " unshift @INC, '" LIBDIR "';"
343 "}" 343 "}"
344 "" 344 ""
345 "use urxvt;" 345 "use urxvt;"
346 }; 346 };
347 int argc = sizeof (args) / sizeof (args[0]); 347 int argc = ecb_array_length (args);
348 char **argv = args; 348 char **argv = args;
349 349
350 PERL_SYS_INIT3 (&argc, &argv, &environ); 350 PERL_SYS_INIT3 (&argc, &argv, &environ);
351 perl = perl_alloc (); 351 perl = perl_alloc ();
352 perl_construct (perl); 352 perl_construct (perl);
353 353
354 if (perl_parse (perl, xs_init, argc, argv, (char **)NULL) 354 if (perl_parse (perl, xs_init, argc, argv, (char **)NULL)
355 || perl_run (perl)) 355 || perl_run (perl))
356 { 356 {
357 rxvt_warn ("unable to initialize perl-interpreter, continuing without.\n"); 357 rxvt_warn ("unable to initialize perl-interpreter, continuing without.\n");
358 358
359 perl_destruct (perl); 359 perl_destruct (perl);
360 perl_free (perl); 360 perl_free (perl);
361 perl = 0; 361 perl = 0;
362 } 362 }
363 363 }
364 swap (perl_environ, environ);
365 364
366 rxvt_pop_locale (); 365 rxvt_pop_locale ();
367 } 366 }
368 367
369 if (perl) 368 if (perl)
370 { 369 {
371 // runs outside of perls ENV 370 // runs outside of perls ENV
372 term->perl.self = (void *)newSVptr ((void *)term, "urxvt::term"); 371 term->perl.self = (void *)newSVptr ((void *)term, "urxvt::term");
373 hv_store ((HV *)SvRV ((SV *)term->perl.self), "_overlay", 8, newRV_noinc ((SV *)newAV ()), 0); 372 hv_store ((HV *)SvRV ((SV *)term->perl.self), "_overlay", 8, newRV_noinc ((SV *)newAV ()), 0);
373 hv_store ((HV *)SvRV ((SV *)term->perl.self), "_selection", 10, newRV_noinc ((SV *)newAV ()), 0);
374 } 374 }
375} 375}
376 376
377static void 377static void
378ungrab (rxvt_term *THIS) 378ungrab (rxvt_term *THIS)
389rxvt_perl_interp::invoke (rxvt_term *term, hook_type htype, ...) 389rxvt_perl_interp::invoke (rxvt_term *term, hook_type htype, ...)
390{ 390{
391 if (!perl || !term->perl.self) 391 if (!perl || !term->perl.self)
392 return false; 392 return false;
393 393
394 localise_env set_environ (perl_environ);
395
394 // pre-handling of some events 396 // pre-handling of some events
395 if (htype == HOOK_REFRESH_END) 397 if (htype == HOOK_REFRESH_END)
396 { 398 {
397 AV *av = (AV *)SvRV (*hv_fetch ((HV *)SvRV ((SV *)term->perl.self), "_overlay", 8, 0)); 399 AV *av = (AV *)SvRV (*hv_fetch ((HV *)SvRV ((SV *)term->perl.self), "_overlay", 8, 0));
398 400
399 for (int i = 0; i <= AvFILL (av); i++) 401 for (int i = 0; i <= AvFILL (av); i++)
400 ((overlay *)SvIV (*av_fetch (av, i, 0)))->swap (); 402 ((overlay *)SvIV (*av_fetch (av, i, 0)))->swap ();
401 } 403 }
404 else if (htype == HOOK_DESTROY)
405 {
406 AV *av = (AV *)SvRV (*hv_fetch ((HV *)SvRV ((SV *)term->perl.self), "_selection", 10, 0));
402 407
403 swap (perl_environ, environ); 408 for (int i = AvFILL (av); i >= 0; i--)
409 {
410 rxvt_selection *req = (rxvt_selection *)SvIV (*av_fetch (av, i, 0));
411 delete req;
412 }
413 }
404 414
405 bool event_consumed; 415 bool event_consumed;
406 416
407 if (htype == HOOK_INIT || htype == HOOK_DESTROY // must be called always 417 if (htype == HOOK_INIT || htype == HOOK_DESTROY // must be called always
408 || term->perl.should_invoke [htype]) 418 || term->perl.should_invoke [htype])
409 try
410 { 419 {
411 dSP; 420 dSP;
412 va_list ap; 421 va_list ap;
413 422
414 va_start (ap, htype); 423 va_start (ap, htype);
415 424
416 ENTER; 425 ENTER;
417 SAVETMPS; 426 SAVETMPS;
418 427
419 PUSHMARK (SP); 428 PUSHMARK (SP);
420 429
430 EXTEND (SP, 2);
421 XPUSHs (sv_2mortal (newSVterm (term))); 431 PUSHs (sv_2mortal (newSVterm (term)));
422 XPUSHs (sv_2mortal (newSViv (htype))); 432 PUSHs (sv_2mortal (newSViv (htype)));
423 433
424 for (;;) { 434 for (;;) {
425 data_type dt = (data_type)va_arg (ap, int); 435 data_type dt = (data_type)va_arg (ap, int);
426 436
427 switch (dt) 437 switch (dt)
428 { 438 {
429 case DT_INT: 439 case DT_INT:
430 XPUSHs (sv_2mortal (newSViv (va_arg (ap, int)))); 440 XPUSHs (sv_2mortal (newSViv (va_arg (ap, int))));
431 break; 441 break;
432 442
433 case DT_LONG: 443 case DT_LONG:
434 XPUSHs (sv_2mortal (newSViv (va_arg (ap, long)))); 444 XPUSHs (sv_2mortal (newSViv (va_arg (ap, long))));
435 break; 445 break;
436 446
437 case DT_STR: 447 case DT_STR:
438 XPUSHs (sv_2mortal (newSVpv (va_arg (ap, char *), 0))); 448 XPUSHs (sv_2mortal (newSVpv (va_arg (ap, char *), 0)));
439 break; 449 break;
440 450
441 case DT_STR_LEN: 451 case DT_STR_LEN:
442 { 452 {
443 char *str = va_arg (ap, char *); 453 char *str = va_arg (ap, char *);
444 int len = va_arg (ap, int); 454 int len = va_arg (ap, int);
445 455
446 XPUSHs (sv_2mortal (newSVpvn (str, len))); 456 XPUSHs (sv_2mortal (newSVpvn (str, len)));
447 } 457 }
448 break; 458 break;
449 459
450 case DT_WCS_LEN: 460 case DT_WCS_LEN:
451 { 461 {
452 wchar_t *wstr = va_arg (ap, wchar_t *); 462 wchar_t *wstr = va_arg (ap, wchar_t *);
453 int wlen = va_arg (ap, int); 463 int wlen = va_arg (ap, int);
454 464
455 XPUSHs (sv_2mortal (wcs2sv (wstr, wlen))); 465 XPUSHs (sv_2mortal (wcs2sv (wstr, wlen)));
456 } 466 }
457 break; 467 break;
458 468
459 case DT_LCS_LEN: 469 case DT_LCS_LEN:
460 { 470 {
461 long *lstr = va_arg (ap, long *); 471 long *lstr = va_arg (ap, long *);
462 int llen = va_arg (ap, int); 472 int llen = va_arg (ap, int);
463 473
464 XPUSHs (sv_2mortal (newSVpvn ((char *)lstr, llen * sizeof (long)))); 474 XPUSHs (sv_2mortal (newSVpvn ((char *)lstr, llen * sizeof (long))));
465 } 475 }
466 break; 476 break;
467 477
468 case DT_XEVENT: 478 case DT_XEVENT:
469 { 479 {
470 XEvent *xe = va_arg (ap, XEvent *); 480 XEvent *xe = va_arg (ap, XEvent *);
471 HV *hv = newHV (); 481 HV *hv = newHV ();
472 482
473# define set(name, sv) hv_store (hv, # name, sizeof (# name) - 1, sv, 0) 483# define set(name, sv) hv_store (hv, # name, sizeof (# name) - 1, sv, 0)
474# define setiv(name, val) hv_store (hv, # name, sizeof (# name) - 1, newSViv (val), 0) 484# define setiv(name, val) hv_store (hv, # name, sizeof (# name) - 1, newSViv (val), 0)
475# define setuv(name, val) hv_store (hv, # name, sizeof (# name) - 1, newSVuv (val), 0) 485# define setuv(name, val) hv_store (hv, # name, sizeof (# name) - 1, newSVuv (val), 0)
476# undef set 486# undef set
477 487
478 setiv (type, xe->type); 488 setiv (type, xe->type);
479 setiv (send_event, xe->xany.send_event); 489 setiv (send_event, xe->xany.send_event);
480 setiv (serial, xe->xany.serial); 490 setiv (serial, xe->xany.serial);
481 491
482 switch (xe->type) 492 switch (xe->type)
483 { 493 {
484 case KeyPress: 494 case KeyPress:
485 case KeyRelease: 495 case KeyRelease:
486 case ButtonPress: 496 case ButtonPress:
487 case ButtonRelease: 497 case ButtonRelease:
488 case MotionNotify: 498 case MotionNotify:
489 setuv (window, xe->xmotion.window); 499 setuv (window, xe->xmotion.window);
490 setuv (root, xe->xmotion.root); 500 setuv (root, xe->xmotion.root);
491 setuv (subwindow, xe->xmotion.subwindow); 501 setuv (subwindow, xe->xmotion.subwindow);
492 setuv (time, xe->xmotion.time); 502 setuv (time, xe->xmotion.time);
493 setiv (x, xe->xmotion.x); 503 setiv (x, xe->xmotion.x);
494 setiv (y, xe->xmotion.y); 504 setiv (y, xe->xmotion.y);
495 setiv (row, xe->xmotion.y / term->fheight + term->view_start); 505 setiv (row, xe->xmotion.y / term->fheight + term->view_start);
496 setiv (col, xe->xmotion.x / term->fwidth); 506 setiv (col, xe->xmotion.x / term->fwidth);
497 setiv (x_root, xe->xmotion.x_root); 507 setiv (x_root, xe->xmotion.x_root);
498 setiv (y_root, xe->xmotion.y_root); 508 setiv (y_root, xe->xmotion.y_root);
499 setuv (state, xe->xmotion.state); 509 setuv (state, xe->xmotion.state);
500 510
501 switch (xe->type) 511 switch (xe->type)
502 { 512 {
503 case KeyPress: 513 case KeyPress:
504 case KeyRelease: 514 case KeyRelease:
505 setuv (keycode, xe->xkey.keycode); 515 setuv (keycode, xe->xkey.keycode);
506 break; 516 break;
507 517
508 case ButtonPress: 518 case ButtonPress:
509 case ButtonRelease: 519 case ButtonRelease:
510 setuv (button, xe->xbutton.button); 520 setuv (button, xe->xbutton.button);
511 break; 521 break;
512 522
513 case MotionNotify: 523 case MotionNotify:
514 setiv (is_hint, xe->xmotion.is_hint); 524 setiv (is_hint, xe->xmotion.is_hint);
515 break; 525 break;
516 } 526 }
517 527
518 break; 528 break;
519 529
520 case MapNotify: 530 case MapNotify:
521 case UnmapNotify: 531 case UnmapNotify:
522 case ConfigureNotify: 532 case ConfigureNotify:
523 setuv (event, xe->xconfigure.event); 533 setuv (event, xe->xconfigure.event);
524 setuv (window, xe->xconfigure.window); 534 setuv (window, xe->xconfigure.window);
525 535
526 switch (xe->type) 536 switch (xe->type)
527 { 537 {
528 case ConfigureNotify: 538 case ConfigureNotify:
529 setiv (x, xe->xconfigure.x); 539 setiv (x, xe->xconfigure.x);
530 setiv (y, xe->xconfigure.y); 540 setiv (y, xe->xconfigure.y);
531 setiv (width, xe->xconfigure.width); 541 setiv (width, xe->xconfigure.width);
532 setiv (height, xe->xconfigure.height); 542 setiv (height, xe->xconfigure.height);
533 setuv (above, xe->xconfigure.above); 543 setuv (above, xe->xconfigure.above);
534 break; 544 break;
535 } 545 }
536 546
537 break; 547 break;
538 548
539 case PropertyNotify: 549 case PropertyNotify:
540 setuv (window, xe->xproperty.window); 550 setuv (window, xe->xproperty.window);
541 setuv (atom, xe->xproperty.atom); 551 setuv (atom, xe->xproperty.atom);
542 setuv (time, xe->xproperty.time); 552 setuv (time, xe->xproperty.time);
543 setiv (state, xe->xproperty.state); 553 setiv (state, xe->xproperty.state);
544 break; 554 break;
545 555
546 case ClientMessage: 556 case ClientMessage:
547 setuv (window, xe->xclient.window); 557 setuv (window, xe->xclient.window);
548 setuv (message_type, xe->xclient.message_type); 558 setuv (message_type, xe->xclient.message_type);
549 setuv (format, xe->xclient.format); 559 setuv (format, xe->xclient.format);
550 setuv (l0, xe->xclient.data.l[0]); 560 setuv (l0, xe->xclient.data.l[0]);
551 setuv (l1, xe->xclient.data.l[1]); 561 setuv (l1, xe->xclient.data.l[1]);
552 setuv (l2, xe->xclient.data.l[2]); 562 setuv (l2, xe->xclient.data.l[2]);
553 setuv (l3, xe->xclient.data.l[3]); 563 setuv (l3, xe->xclient.data.l[3]);
554 setuv (l4, xe->xclient.data.l[4]); 564 setuv (l4, xe->xclient.data.l[4]);
555 break; 565 break;
556 } 566 }
557 567
558 XPUSHs (sv_2mortal (newRV_noinc ((SV *)hv))); 568 XPUSHs (sv_2mortal (newRV_noinc ((SV *)hv)));
559 } 569 }
560 break; 570 break;
561 571
562 case DT_END: 572 case DT_END:
563 goto call; 573 goto call;
564 574
565 default: 575 default:
566 rxvt_fatal ("FATAL: unable to pass data type %d\n", dt); 576 rxvt_fatal ("FATAL: unable to pass data type %d\n", dt);
567 } 577 }
578 }
579
580 call:
581 va_end (ap);
582
583 PUTBACK;
584 int count = call_pv ("urxvt::invoke", G_ARRAY | G_EVAL);
585 SPAGAIN;
586
587 if (count)
588 {
589 SV *status = POPs;
590 count = SvTRUE (status);
568 } 591 }
569 592
570 call:
571 va_end (ap);
572
573 PUTBACK; 593 PUTBACK;
574 int count = call_pv ("urxvt::invoke", G_ARRAY | G_EVAL);
575 SPAGAIN;
576
577 if (count)
578 {
579 SV *status = POPs;
580 count = SvTRUE (status);
581 }
582
583 PUTBACK;
584 FREETMPS; 594 FREETMPS;
585 LEAVE; 595 LEAVE;
586 596
587 if (SvTRUE (ERRSV)) 597 if (SvTRUE (ERRSV))
588 { 598 {
589 rxvt_warn ("perl hook %d evaluation error: %s", htype, SvPV_nolen (ERRSV)); 599 rxvt_warn ("perl hook %d evaluation error: %s", htype, SvPVbyte_nolen (ERRSV));
590 ungrab (term); // better lose the grab than the session 600 ungrab (term); // better lose the grab than the session
591 } 601 }
592 602
593 event_consumed = !!count; 603 event_consumed = !!count;
594 } 604 }
595 catch (...)
596 {
597 swap (perl_environ, environ);
598 throw;
599 }
600 else 605 else
601 event_consumed = false; 606 event_consumed = false;
602 607
603 // post-handling of some events 608 // post-handling of some events
604 if (htype == HOOK_REFRESH_BEGIN) 609 if (htype == HOOK_REFRESH_BEGIN)
615 620
616 // don't allow further calls 621 // don't allow further calls
617 term->perl.self = 0; 622 term->perl.self = 0;
618 } 623 }
619 624
620 swap (perl_environ, environ);
621
622 return event_consumed; 625 return event_consumed;
626}
627
628void
629rxvt_perl_interp::selection_finish (rxvt_selection *sel, char *data, unsigned int len)
630{
631 localise_env set_environ (perl_environ);
632
633 ENTER;
634 SAVETMPS;
635
636 dSP;
637 XPUSHs (sv_2mortal (newSVpvn (data, len)));
638 call_sv ((SV *)sel->cb_sv, G_VOID | G_DISCARD | G_EVAL);
639
640 if (SvTRUE (ERRSV))
641 rxvt_warn ("perl selection callback evaluation error: %s", SvPVbyte_nolen (ERRSV));
642
643 FREETMPS;
644 LEAVE;
623} 645}
624 646
625///////////////////////////////////////////////////////////////////////////// 647/////////////////////////////////////////////////////////////////////////////
626 648
627MODULE = urxvt PACKAGE = urxvt 649MODULE = urxvt PACKAGE = urxvt
778 const_iv (XIMDontChange), 800 const_iv (XIMDontChange),
779# endif 801# endif
780# endif 802# endif
781 }; 803 };
782 804
783 for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); civ-- > const_iv; ) 805 for (civ = const_iv + ecb_array_length (const_iv); civ > const_iv; civ--)
784 newCONSTSUB (stash, (char *)civ->name, newSViv (civ->iv)); 806 newCONSTSUB (stash, (char *)civ[-1].name, newSViv (civ[-1].iv));
785} 807}
786 808
787void 809void
788warn (const char *msg) 810warn (const char *msg)
789 CODE: 811 CODE:
861 for (rxvt_term **t = rxvt_term::termlist.begin (); t < rxvt_term::termlist.end (); t++) 883 for (rxvt_term **t = rxvt_term::termlist.begin (); t < rxvt_term::termlist.end (); t++)
862 if ((*t)->perl.self) 884 if ((*t)->perl.self)
863 PUSHs (sv_2mortal (newSVterm (*t))); 885 PUSHs (sv_2mortal (newSVterm (*t)));
864} 886}
865 887
888IV
889_new_selection_request (rxvt_term *term, int selnum, Time tm, Window win, Atom prop, SV *cb)
890 CODE:
891 rxvt_selection *req = new rxvt_selection (term->display, selnum, tm, win, prop, term);
892 req->cb_sv = newSVsv (cb);
893 AV *av = (AV *)SvRV (*hv_fetch ((HV *)SvRV ((SV *)term->perl.self), "_selection", 10, 0));
894 av_push (av, newSViv ((IV)req));
895 RETVAL = (IV)req;
896 OUTPUT:
897 RETVAL
898
899void
900_delete_selection_request (IV req_)
901 CODE:
902 rxvt_selection *req = (rxvt_selection *)req_;
903 AV *av = (AV *)SvRV (*hv_fetch ((HV *)SvRV ((SV *)req->term->perl.self), "_selection", 10, 0));
904 int i;
905
906 for (i = AvFILL (av); i >= 0; i--)
907 if (SvIV (*av_fetch (av, i, 1)) == req_)
908 break;
909
910 for (; i < AvFILL (av); i++)
911 av_store (av, i, SvREFCNT_inc (*av_fetch (av, i + 1, 0)));
912
913 av_pop (av);
914
915 delete req;
916
866MODULE = urxvt PACKAGE = urxvt::term 917MODULE = urxvt PACKAGE = urxvt::term
867 918
868SV * 919SV *
869_new (AV *env, AV *arg) 920_new (AV *env, AV *arg)
870 CODE: 921 CODE:
871{ 922{
872 rxvt_term *term = new rxvt_term; 923 rxvt_term *term = new rxvt_term;
873 924
874 stringvec *argv = new stringvec; 925 stringvec *argv = new stringvec;
875 stringvec *envv = new stringvec;
876
877 for (int i = 0; i <= AvFILL (arg); i++) 926 for (int i = 0; i <= AvFILL (arg); i++)
878 argv->push_back (strdup (SvPVbyte_nolen (*av_fetch (arg, i, 1)))); 927 argv->push_back (strdup (SvPVbyte_nolen (*av_fetch (arg, i, 1))));
879 928
929 stringvec *envv = new stringvec;
880 for (int i = AvFILL (env) + 1; i--; ) 930 for (int i = AvFILL (env) + 1; i--; )
881 envv->push_back (strdup (SvPVbyte_nolen (*av_fetch (env, i, 1)))); 931 envv->push_back (strdup (SvPVbyte_nolen (*av_fetch (env, i, 1))));
882
883 envv->push_back (0);
884 932
885 try 933 try
886 { 934 {
887 term->init (argv, envv); 935 term->init (argv, envv);
888 } 936 }
928 976
929void 977void
930rxvt_term::XUngrabKey (int keycode, U32 modifiers, Window window = THIS->vt) 978rxvt_term::XUngrabKey (int keycode, U32 modifiers, Window window = THIS->vt)
931 CODE: 979 CODE:
932 XUngrabKey (THIS->dpy, keycode, modifiers, window); 980 XUngrabKey (THIS->dpy, keycode, modifiers, window);
933
934void
935rxvt_term::XUngrabKeyboard (Time eventtime)
936 CODE:
937 XUngrabKeyboard (THIS->dpy, eventtime);
938 981
939bool 982bool
940rxvt_term::grab (Time eventtime, int sync = 0) 983rxvt_term::grab (Time eventtime, int sync = 0)
941 CODE: 984 CODE:
942{ 985{
1054 rxvt_pop_locale (); 1097 rxvt_pop_locale ();
1055 1098
1056 RETVAL = wcs2sv (wstr); 1099 RETVAL = wcs2sv (wstr);
1057 free (wstr); 1100 free (wstr);
1058} 1101}
1059 OUTPUT:
1060 RETVAL
1061
1062char *
1063rxvt_term::locale ()
1064 CODE:
1065 RETVAL = THIS->locale;
1066 OUTPUT: 1102 OUTPUT:
1067 RETVAL 1103 RETVAL
1068 1104
1069#define TERM_OFFSET(sym) offsetof (TermWin_t, sym) 1105#define TERM_OFFSET(sym) offsetof (TermWin_t, sym)
1070 1106
1177 RETVAL 1213 RETVAL
1178 1214
1179Window 1215Window
1180rxvt_term::parent () 1216rxvt_term::parent ()
1181 CODE: 1217 CODE:
1182 RETVAL = THIS->parent [0]; 1218 RETVAL = THIS->parent;
1183 OUTPUT: 1219 OUTPUT:
1184 RETVAL 1220 RETVAL
1185 1221
1186Window 1222Window
1187rxvt_term::vt () 1223rxvt_term::vt ()
1214 if (newval <= 0) 1250 if (newval <= 0)
1215 THIS->scr_changeview (max (newval, THIS->top_row)); 1251 THIS->scr_changeview (max (newval, THIS->top_row));
1216} 1252}
1217 OUTPUT: 1253 OUTPUT:
1218 RETVAL 1254 RETVAL
1255
1256void
1257rxvt_term::set_urgency (bool enable)
1219 1258
1220void 1259void
1221rxvt_term::focus_in () 1260rxvt_term::focus_in ()
1222 1261
1223void 1262void
1456# include "rsinc.h" 1495# include "rsinc.h"
1457# undef def 1496# undef def
1458# undef reserve 1497# undef reserve
1459 }; 1498 };
1460 1499
1461 rs = rslist + sizeof (rslist) / sizeof (rslist [0]); 1500 rs = rslist + ecb_array_length (rslist);
1462 1501
1463 if (*name) 1502 if (*name)
1464 { 1503 {
1465 do { 1504 do {
1466 if (rs-- == rslist) 1505 if (rs-- == rslist)
1505 1544
1506 if (set >= 0) 1545 if (set >= 0)
1507 { 1546 {
1508 THIS->set_option (optval, set); 1547 THIS->set_option (optval, set);
1509 1548
1510 if (THIS->env_colorfgbg [0]) // avoid doing this before START 1549 if (THIS->init_done) // avoid doing this before START
1511 switch (optval) 1550 switch (optval)
1512 { 1551 {
1513 case Opt_skipBuiltinGlyphs: 1552 case Opt_skipBuiltinGlyphs:
1514 THIS->set_fonts (); 1553 THIS->set_fonts ();
1515 THIS->scr_remap_chars (); 1554 THIS->scr_remap_chars ();
1538 CODE: 1577 CODE:
1539 RETVAL = 0 < THIS->parse_keysym (keysym, str); 1578 RETVAL = 0 < THIS->parse_keysym (keysym, str);
1540 THIS->keyboard->register_done (); 1579 THIS->keyboard->register_done ();
1541 OUTPUT: 1580 OUTPUT:
1542 RETVAL 1581 RETVAL
1582
1583void
1584rxvt_term::register_command (int keysym, unsigned int state, SV *str)
1585 CODE:
1586 wchar_t *wstr = sv2wcs (str);
1587 THIS->keyboard->register_user_translation (keysym, state, wstr);
1588 free (wstr);
1543 1589
1544void 1590void
1545rxvt_term::screen_cur (...) 1591rxvt_term::screen_cur (...)
1546 PROTOTYPE: $;$$ 1592 PROTOTYPE: $;$$
1547 ALIAS: 1593 ALIAS:

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines