… | |
… | |
56 | static char curlocale[128], savelocale[128]; |
56 | static char curlocale[128], savelocale[128]; |
57 | |
57 | |
58 | bool |
58 | bool |
59 | rxvt_set_locale (const char *locale) NOTHROW |
59 | rxvt_set_locale (const char *locale) NOTHROW |
60 | { |
60 | { |
61 | int len = strlen (locale) + 1; |
61 | int size = strlen (locale) + 1; |
62 | |
62 | |
63 | if (len > sizeof (curlocale)) |
63 | if (size > sizeof (curlocale)) |
64 | rxvt_fatal ("locale string too long, aborting.\n"); |
64 | rxvt_fatal ("locale string too long, aborting.\n"); |
65 | |
65 | |
66 | if (!locale || !memcmp (locale, curlocale, len)) |
66 | if (!locale || !memcmp (locale, curlocale, size)) |
67 | return false; |
67 | return false; |
68 | |
68 | |
69 | memcpy (curlocale, locale, len); |
69 | memcpy (curlocale, locale, size); |
70 | setlocale (LC_CTYPE, curlocale); |
70 | setlocale (LC_CTYPE, curlocale); |
71 | return true; |
71 | return true; |
72 | } |
72 | } |
73 | |
73 | |
74 | void |
74 | void |
… | |
… | |
150 | |
150 | |
151 | rxvt_term::rxvt_term () |
151 | rxvt_term::rxvt_term () |
152 | : |
152 | : |
153 | #if TRANSPARENT || ENABLE_PERL |
153 | #if TRANSPARENT || ENABLE_PERL |
154 | rootwin_ev (this, &rxvt_term::rootwin_cb), |
154 | rootwin_ev (this, &rxvt_term::rootwin_cb), |
|
|
155 | check_our_parents_ev(this, &rxvt_term::check_our_parents_cb), |
155 | #endif |
156 | #endif |
156 | #ifdef HAVE_SCROLLBARS |
157 | #ifdef HAVE_SCROLLBARS |
157 | scrollbar_ev (this, &rxvt_term::x_cb), |
158 | scrollbar_ev (this, &rxvt_term::x_cb), |
158 | #endif |
159 | #endif |
159 | #ifdef CURSOR_BLINK |
160 | #ifdef CURSOR_BLINK |
… | |
… | |
270 | } |
271 | } |
271 | |
272 | |
272 | clear (); |
273 | clear (); |
273 | } |
274 | } |
274 | |
275 | |
275 | delete pix_colors_focused; |
276 | delete [] pix_colors_focused; |
276 | #if OFF_FOCUS_FADING |
277 | #if OFF_FOCUS_FADING |
277 | delete pix_colors_unfocused; |
278 | delete [] pix_colors_unfocused; |
278 | #endif |
279 | #endif |
279 | |
280 | |
280 | displays.put (display); |
281 | displays.put (display); |
281 | |
282 | |
282 | scr_release (); |
283 | scr_release (); |
… | |
… | |
307 | { |
308 | { |
308 | HOOK_INVOKE ((this, HOOK_CHILD_EXIT, DT_INT, status, DT_END)); |
309 | HOOK_INVOKE ((this, HOOK_CHILD_EXIT, DT_INT, status, DT_END)); |
309 | |
310 | |
310 | cmd_pid = 0; |
311 | cmd_pid = 0; |
311 | |
312 | |
312 | if (!OPTION (Opt_hold)) |
313 | if (!option (Opt_hold)) |
313 | destroy (); |
314 | destroy (); |
314 | } |
315 | } |
315 | |
316 | |
316 | void |
317 | void |
317 | rxvt_term::destroy () |
318 | rxvt_term::destroy () |
… | |
… | |
481 | #ifdef KEYSYM_RESOURCE |
482 | #ifdef KEYSYM_RESOURCE |
482 | keyboard->register_done (); |
483 | keyboard->register_done (); |
483 | #endif |
484 | #endif |
484 | |
485 | |
485 | #ifdef HAVE_SCROLLBARS |
486 | #ifdef HAVE_SCROLLBARS |
486 | if (OPTION (Opt_scrollBar)) |
487 | if (option (Opt_scrollBar)) |
487 | scrollBar.setIdle (); /* set existence for size calculations */ |
488 | scrollBar.setIdle (); /* set existence for size calculations */ |
488 | #endif |
489 | #endif |
489 | |
490 | |
490 | pty = ptytty::create (); |
491 | pty = ptytty::create (); |
491 | |
492 | |
… | |
… | |
498 | #if 0 |
499 | #if 0 |
499 | XSynchronize (dpy, True); |
500 | XSynchronize (dpy, True); |
500 | #endif |
501 | #endif |
501 | |
502 | |
502 | #ifdef HAVE_SCROLLBARS |
503 | #ifdef HAVE_SCROLLBARS |
503 | if (OPTION (Opt_scrollBar)) |
504 | if (option (Opt_scrollBar)) |
504 | resize_scrollbar (); /* create and map scrollbar */ |
505 | resize_scrollbar (); /* create and map scrollbar */ |
505 | #endif |
506 | #endif |
506 | #ifdef TRANSPARENT |
507 | #ifdef TRANSPARENT |
507 | if (OPTION (Opt_transparent)) |
508 | if (option (Opt_transparent)) |
508 | { |
509 | { |
509 | XSelectInput (dpy, display->root, PropertyChangeMask); |
510 | XSelectInput (dpy, display->root, PropertyChangeMask); |
510 | check_our_parents (); |
511 | check_our_parents (); |
511 | rootwin_ev.start (display, display->root); |
512 | rootwin_ev.start (display, display->root); |
512 | } |
513 | } |
… | |
… | |
709 | if (scrollBar.state) |
710 | if (scrollBar.state) |
710 | { |
711 | { |
711 | sb_w = scrollbar_TotalWidth (); |
712 | sb_w = scrollbar_TotalWidth (); |
712 | szHint.base_width += sb_w; |
713 | szHint.base_width += sb_w; |
713 | |
714 | |
714 | if (!OPTION (Opt_scrollBar_right)) |
715 | if (!option (Opt_scrollBar_right)) |
715 | window_vt_x += sb_w; |
716 | window_vt_x += sb_w; |
716 | } |
717 | } |
717 | |
718 | |
718 | szHint.width_inc = fwidth; |
719 | szHint.width_inc = fwidth; |
719 | szHint.height_inc = fheight; |
720 | szHint.height_inc = fheight; |
… | |
… | |
740 | { |
741 | { |
741 | min_it (height, max_height); |
742 | min_it (height, max_height); |
742 | szHint.height = szHint.base_height + height; |
743 | szHint.height = szHint.base_height + height; |
743 | } |
744 | } |
744 | |
745 | |
745 | if (scrollBar.state && OPTION (Opt_scrollBar_right)) |
746 | if (scrollBar.state && option (Opt_scrollBar_right)) |
746 | window_sb_x = szHint.width - sb_w; |
747 | window_sb_x = szHint.width - sb_w; |
747 | |
748 | |
748 | if (recalc_x) |
749 | if (recalc_x) |
749 | szHint.x += DisplayWidth (dpy, display->screen) - szHint.width - 2 * ext_bwidth; |
750 | szHint.x += DisplayWidth (dpy, display->screen) - szHint.width - 2 * ext_bwidth; |
750 | |
751 | |
… | |
… | |
812 | delete fontset[0]; |
813 | delete fontset[0]; |
813 | fontset[0] = fs; |
814 | fontset[0] = fs; |
814 | |
815 | |
815 | prop = (*fs)[1]->properties (); |
816 | prop = (*fs)[1]->properties (); |
816 | prop.height += lineSpace; |
817 | prop.height += lineSpace; |
|
|
818 | |
817 | fs->set_prop (prop); |
819 | fs->set_prop (prop, false); |
818 | |
820 | |
819 | fwidth = prop.width; |
821 | fwidth = prop.width; |
820 | fheight = prop.height; |
822 | fheight = prop.height; |
821 | fbase = prop.ascent; |
823 | fbase = prop.ascent; |
822 | |
824 | |
… | |
… | |
831 | { |
833 | { |
832 | fontset[style] = fs = new rxvt_fontset (this); |
834 | fontset[style] = fs = new rxvt_fontset (this); |
833 | rxvt_fontprop prop2 = prop; |
835 | rxvt_fontprop prop2 = prop; |
834 | |
836 | |
835 | if (res) |
837 | if (res) |
836 | prop2.weight = prop2.slant = rxvt_fontprop::unset; |
838 | { |
|
|
839 | fs->populate (res); |
|
|
840 | fs->set_prop (prop2, false); |
|
|
841 | } |
837 | else |
842 | else |
838 | { |
843 | { |
839 | res = fontset[0]->fontdesc; |
844 | fs->populate (fontset[0]->fontdesc); |
840 | |
845 | |
841 | if (SET_STYLE (0, style) & RS_Bold) prop2.weight = rxvt_fontprop::bold; |
846 | if (SET_STYLE (0, style) & RS_Bold) prop2.weight = rxvt_fontprop::bold; |
842 | if (SET_STYLE (0, style) & RS_Italic) prop2.slant = rxvt_fontprop::italic; |
847 | if (SET_STYLE (0, style) & RS_Italic) prop2.slant = rxvt_fontprop::italic; |
|
|
848 | |
|
|
849 | fs->set_prop (prop2, true); |
843 | } |
850 | } |
844 | |
851 | |
845 | fs->populate (res); |
|
|
846 | fs->set_prop (prop2); |
|
|
847 | } |
852 | } |
848 | #else |
853 | #else |
849 | fontset[style] = fontset[0]; |
854 | fontset[style] = fontset[0]; |
850 | #endif |
855 | #endif |
851 | } |
856 | } |