… | |
… | |
30 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
30 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
31 | *---------------------------------------------------------------------*/ |
31 | *---------------------------------------------------------------------*/ |
32 | |
32 | |
33 | #include "../config.h" /* NECESSARY */ |
33 | #include "../config.h" /* NECESSARY */ |
34 | #include "rxvt.h" /* NECESSARY */ |
34 | #include "rxvt.h" /* NECESSARY */ |
|
|
35 | #include "keyboard.h" |
|
|
36 | #include "rxvtperl.h" |
35 | |
37 | |
36 | #include <limits> |
38 | #include <limits> |
37 | |
39 | |
38 | #include <csignal> |
40 | #include <csignal> |
39 | #include <cstring> |
41 | #include <cstring> |
… | |
… | |
44 | |
46 | |
45 | #ifdef HAVE_TERMIOS_H |
47 | #ifdef HAVE_TERMIOS_H |
46 | # include <termios.h> |
48 | # include <termios.h> |
47 | #endif |
49 | #endif |
48 | |
50 | |
49 | #ifdef KEYSYM_RESOURCE |
|
|
50 | # include "keyboard.h" |
|
|
51 | #endif |
|
|
52 | |
|
|
53 | vector<rxvt_term *> rxvt_term::termlist; |
51 | vector<rxvt_term *> rxvt_term::termlist; |
54 | |
52 | |
55 | static char curlocale[128]; |
53 | static char curlocale[128], savelocale[128]; |
56 | |
54 | |
57 | bool |
55 | bool |
58 | rxvt_set_locale (const char *locale) |
56 | rxvt_set_locale (const char *locale) |
59 | { |
57 | { |
60 | if (!locale || !strncmp (locale, curlocale, 128)) |
58 | if (!locale || !strncmp (locale, curlocale, 128)) |
61 | return false; |
59 | return false; |
62 | |
60 | |
63 | strncpy (curlocale, locale, 128); |
61 | strncpy (curlocale, locale, 128); |
64 | setlocale (LC_CTYPE, curlocale); |
62 | setlocale (LC_CTYPE, curlocale); |
65 | return true; |
63 | return true; |
|
|
64 | } |
|
|
65 | |
|
|
66 | bool |
|
|
67 | rxvt_push_locale (const char *locale) |
|
|
68 | { |
|
|
69 | strcpy (savelocale, curlocale); |
|
|
70 | rxvt_set_locale (locale); |
|
|
71 | } |
|
|
72 | |
|
|
73 | void |
|
|
74 | rxvt_pop_locale () |
|
|
75 | { |
|
|
76 | rxvt_set_locale (savelocale); |
66 | } |
77 | } |
67 | |
78 | |
68 | #if ENABLE_COMBINING |
79 | #if ENABLE_COMBINING |
69 | class rxvt_composite_vec rxvt_composite; |
80 | class rxvt_composite_vec rxvt_composite; |
70 | |
81 | |
… | |
… | |
195 | pty.put (); |
206 | pty.put (); |
196 | } |
207 | } |
197 | |
208 | |
198 | rxvt_term::~rxvt_term () |
209 | rxvt_term::~rxvt_term () |
199 | { |
210 | { |
|
|
211 | PERL_INVOKE ((this, HOOK_DESTROY, DT_END)); |
|
|
212 | |
200 | termlist.erase (find (termlist.begin (), termlist.end(), this)); |
213 | termlist.erase (find (termlist.begin (), termlist.end(), this)); |
201 | |
214 | |
202 | emergency_cleanup (); |
215 | emergency_cleanup (); |
203 | |
216 | |
204 | #if ENABLE_STYLES |
217 | #if ENABLE_STYLES |
… | |
… | |
293 | void |
306 | void |
294 | rxvt_term::child_exit () |
307 | rxvt_term::child_exit () |
295 | { |
308 | { |
296 | cmd_pid = 0; |
309 | cmd_pid = 0; |
297 | |
310 | |
298 | if (!(options & Opt_hold)) |
311 | if (!OPTION (Opt_hold)) |
299 | destroy (); |
312 | destroy (); |
300 | } |
313 | } |
301 | |
314 | |
302 | void |
315 | void |
303 | rxvt_term::destroy () |
316 | rxvt_term::destroy () |
… | |
… | |
469 | |
482 | |
470 | #if MENUBAR_MAX |
483 | #if MENUBAR_MAX |
471 | menubar_read (rs[Rs_menu]); |
484 | menubar_read (rs[Rs_menu]); |
472 | #endif |
485 | #endif |
473 | #ifdef HAVE_SCROLLBARS |
486 | #ifdef HAVE_SCROLLBARS |
474 | if (options & Opt_scrollBar) |
487 | if (OPTION (Opt_scrollBar)) |
475 | scrollBar.setIdle (); /* set existence for size calculations */ |
488 | scrollBar.setIdle (); /* set existence for size calculations */ |
476 | #endif |
489 | #endif |
|
|
490 | |
|
|
491 | #if ENABLE_PERL |
|
|
492 | rxvt_perl.init (); |
|
|
493 | #endif |
|
|
494 | |
|
|
495 | PERL_INVOKE ((this, HOOK_INIT, DT_END)); |
477 | |
496 | |
478 | create_windows (argc, argv); |
497 | create_windows (argc, argv); |
479 | |
498 | |
480 | dDisp; |
499 | dDisp; |
481 | |
500 | |
… | |
… | |
486 | #if 0 |
505 | #if 0 |
487 | XSynchronize (disp, True); |
506 | XSynchronize (disp, True); |
488 | #endif |
507 | #endif |
489 | |
508 | |
490 | #ifdef HAVE_SCROLLBARS |
509 | #ifdef HAVE_SCROLLBARS |
491 | if (options & Opt_scrollBar) |
510 | if (OPTION (Opt_scrollBar)) |
492 | resize_scrollbar (); /* create and map scrollbar */ |
511 | resize_scrollbar (); /* create and map scrollbar */ |
493 | #endif |
512 | #endif |
494 | #if (MENUBAR_MAX) |
513 | #if (MENUBAR_MAX) |
495 | if (menubar_visible ()) |
514 | if (menubar_visible ()) |
496 | XMapWindow (disp, menuBar.win); |
515 | XMapWindow (disp, menuBar.win); |
497 | #endif |
516 | #endif |
498 | #ifdef TRANSPARENT |
517 | #ifdef TRANSPARENT |
499 | if (options & Opt_transparent) |
518 | if (OPTION (Opt_transparent)) |
500 | { |
519 | { |
501 | XSelectInput (disp, display->root, PropertyChangeMask); |
520 | XSelectInput (disp, display->root, PropertyChangeMask); |
502 | check_our_parents (); |
521 | check_our_parents (); |
503 | rootwin_ev.start (display, display->root); |
522 | rootwin_ev.start (display, display->root); |
504 | } |
523 | } |
… | |
… | |
514 | free (cmd_argv); |
533 | free (cmd_argv); |
515 | |
534 | |
516 | pty_ev.start (pty.pty, EVENT_READ); |
535 | pty_ev.start (pty.pty, EVENT_READ); |
517 | |
536 | |
518 | check_ev.start (); |
537 | check_ev.start (); |
|
|
538 | |
|
|
539 | PERL_INVOKE ((this, HOOK_START, DT_END)); |
519 | |
540 | |
520 | return true; |
541 | return true; |
521 | } |
542 | } |
522 | |
543 | |
523 | static struct sig_handlers |
544 | static struct sig_handlers |
… | |
… | |
681 | |
702 | |
682 | #ifdef UTMP_SUPPORT |
703 | #ifdef UTMP_SUPPORT |
683 | void |
704 | void |
684 | rxvt_term::privileged_utmp (rxvt_privaction action) |
705 | rxvt_term::privileged_utmp (rxvt_privaction action) |
685 | { |
706 | { |
686 | if ((options & Opt_utmpInhibit) |
707 | if (OPTION (Opt_utmpInhibit) |
687 | || !pty.name || !*pty.name) |
708 | || !pty.name || !*pty.name) |
688 | return; |
709 | return; |
689 | |
710 | |
690 | rxvt_privileges (RESTORE); |
711 | rxvt_privileges (RESTORE); |
691 | |
712 | |
… | |
… | |
783 | |
804 | |
784 | if (scrollbar_visible ()) |
805 | if (scrollbar_visible ()) |
785 | { |
806 | { |
786 | sb_w = scrollbar_TotalWidth (); |
807 | sb_w = scrollbar_TotalWidth (); |
787 | szHint.base_width += sb_w; |
808 | szHint.base_width += sb_w; |
788 | if (!(options & Opt_scrollBar_right)) |
809 | if (!OPTION (Opt_scrollBar_right)) |
789 | window_vt_x += sb_w; |
810 | window_vt_x += sb_w; |
790 | } |
811 | } |
791 | |
812 | |
792 | if (menubar_visible ()) |
813 | if (menubar_visible ()) |
793 | { |
814 | { |
… | |
… | |
821 | { |
842 | { |
822 | min_it (height, max_height); |
843 | min_it (height, max_height); |
823 | szHint.height = szHint.base_height + height; |
844 | szHint.height = szHint.base_height + height; |
824 | } |
845 | } |
825 | |
846 | |
826 | if (scrollbar_visible () && (options & Opt_scrollBar_right)) |
847 | if (scrollbar_visible () && OPTION (Opt_scrollBar_right)) |
827 | window_sb_x = szHint.width - sb_w; |
848 | window_sb_x = szHint.width - sb_w; |
828 | |
849 | |
829 | if (recalc_x) |
850 | if (recalc_x) |
830 | szHint.x += DisplayWidth (disp, display->screen) - szHint.width - 2 * ext_bwidth; |
851 | szHint.x += DisplayWidth (disp, display->screen) - szHint.width - 2 * ext_bwidth; |
831 | if (recalc_y) |
852 | if (recalc_y) |