… | |
… | |
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 |
… | |
… | |
473 | #ifdef HAVE_SCROLLBARS |
486 | #ifdef HAVE_SCROLLBARS |
474 | if (OPTION (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 |
477 | |
490 | |
|
|
491 | #if ENABLE_PERL |
|
|
492 | if ((rs[Rs_perl_ext_1] && *rs[Rs_perl_ext_1]) |
|
|
493 | || (rs[Rs_perl_ext_2] && *rs[Rs_perl_ext_2]) |
|
|
494 | || (rs[Rs_perl_eval] && *rs[Rs_perl_eval])) |
|
|
495 | { |
|
|
496 | rxvt_perl.init (); |
|
|
497 | PERL_INVOKE ((this, HOOK_INIT, DT_END)); |
|
|
498 | } |
|
|
499 | #endif |
|
|
500 | |
478 | create_windows (argc, argv); |
501 | create_windows (argc, argv); |
479 | |
502 | |
480 | dDisp; |
503 | dDisp; |
481 | |
504 | |
482 | init_xlocale (); |
505 | init_xlocale (); |
… | |
… | |
514 | free (cmd_argv); |
537 | free (cmd_argv); |
515 | |
538 | |
516 | pty_ev.start (pty.pty, EVENT_READ); |
539 | pty_ev.start (pty.pty, EVENT_READ); |
517 | |
540 | |
518 | check_ev.start (); |
541 | check_ev.start (); |
|
|
542 | |
|
|
543 | PERL_INVOKE ((this, HOOK_START, DT_END)); |
519 | |
544 | |
520 | return true; |
545 | return true; |
521 | } |
546 | } |
522 | |
547 | |
523 | static struct sig_handlers |
548 | static struct sig_handlers |
… | |
… | |
900 | prop.height += lineSpace; |
925 | prop.height += lineSpace; |
901 | fs->set_prop (prop); |
926 | fs->set_prop (prop); |
902 | |
927 | |
903 | fwidth = prop.width; |
928 | fwidth = prop.width; |
904 | fheight = prop.height; |
929 | fheight = prop.height; |
905 | fbase = (*fs)[1]->ascent; |
930 | fbase = prop.ascent; |
906 | |
931 | |
907 | for (int style = 1; style < 4; style++) |
932 | for (int style = 1; style < 4; style++) |
908 | { |
933 | { |
909 | #if ENABLE_STYLES |
934 | #if ENABLE_STYLES |
910 | const char *res = rs[Rs_font + style]; |
935 | const char *res = rs[Rs_font + style]; |
… | |
… | |
1001 | i = atoi (color); |
1026 | i = atoi (color); |
1002 | |
1027 | |
1003 | if (i >= 8 && i <= 15) |
1028 | if (i >= 8 && i <= 15) |
1004 | { /* bright colors */ |
1029 | { /* bright colors */ |
1005 | i -= 8; |
1030 | i -= 8; |
1006 | # ifndef NO_BRIGHTCOLOR |
|
|
1007 | pix_colors_focused[idx] = pix_colors_focused[minBrightCOLOR + i]; |
1031 | pix_colors_focused[idx] = pix_colors_focused[minBrightCOLOR + i]; |
1008 | SET_PIXCOLOR (idx); |
1032 | SET_PIXCOLOR (idx); |
1009 | goto done; |
1033 | goto done; |
1010 | # endif |
|
|
1011 | } |
1034 | } |
1012 | |
1035 | |
1013 | if (i >= 0 && i <= 7) |
1036 | if (i >= 0 && i <= 7) |
1014 | { /* normal colors */ |
1037 | { /* normal colors */ |
1015 | pix_colors_focused[idx] = pix_colors_focused[minCOLOR + i]; |
1038 | pix_colors_focused[idx] = pix_colors_focused[minCOLOR + i]; |
… | |
… | |
1199 | } |
1222 | } |
1200 | |
1223 | |
1201 | if (menubar_visible ()) |
1224 | if (menubar_visible ()) |
1202 | XMoveResizeWindow (disp, menuBar.win, |
1225 | XMoveResizeWindow (disp, menuBar.win, |
1203 | window_vt_x, 0, |
1226 | window_vt_x, 0, |
1204 | TermWin_TotalWidth (), menuBar_TotalHeight ()); |
1227 | width, menuBar_TotalHeight ()); |
1205 | |
1228 | |
1206 | XMoveResizeWindow (disp, vt, |
1229 | XMoveResizeWindow (disp, vt, |
1207 | window_vt_x, window_vt_y, |
1230 | window_vt_x, window_vt_y, |
1208 | TermWin_TotalWidth (), TermWin_TotalHeight ()); |
1231 | width, height); |
1209 | |
1232 | |
1210 | scr_clear (); |
1233 | scr_clear (); |
1211 | #ifdef XPM_BACKGROUND |
1234 | #ifdef XPM_BACKGROUND |
1212 | resize_pixmap (); |
1235 | resize_pixmap (); |
1213 | #endif |
1236 | #endif |