… | |
… | |
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 size = strlen (locale) + 1; |
|
|
62 | |
|
|
63 | if (size > sizeof (curlocale)) |
|
|
64 | rxvt_fatal ("locale string too long, aborting.\n"); |
|
|
65 | |
61 | if (!locale || !strncmp (locale, curlocale, 128)) |
66 | if (!locale || !memcmp (locale, curlocale, size)) |
62 | return false; |
67 | return false; |
63 | |
68 | |
64 | strncpy (curlocale, locale, 128); |
69 | memcpy (curlocale, locale, size); |
65 | setlocale (LC_CTYPE, curlocale); |
70 | setlocale (LC_CTYPE, curlocale); |
66 | return true; |
71 | return true; |
67 | } |
72 | } |
68 | |
73 | |
69 | void |
74 | void |
… | |
… | |
143 | } |
148 | } |
144 | #endif |
149 | #endif |
145 | |
150 | |
146 | rxvt_term::rxvt_term () |
151 | rxvt_term::rxvt_term () |
147 | : |
152 | : |
148 | #if TRANSPARENT |
153 | #if TRANSPARENT || ENABLE_PERL |
149 | rootwin_ev (this, &rxvt_term::rootwin_cb), |
154 | rootwin_ev (this, &rxvt_term::rootwin_cb), |
150 | #endif |
155 | #endif |
151 | #ifdef HAVE_SCROLLBARS |
156 | #ifdef HAVE_SCROLLBARS |
152 | scrollbar_ev (this, &rxvt_term::x_cb), |
157 | scrollbar_ev (this, &rxvt_term::x_cb), |
153 | #endif |
158 | #endif |
… | |
… | |
265 | } |
270 | } |
266 | |
271 | |
267 | clear (); |
272 | clear (); |
268 | } |
273 | } |
269 | |
274 | |
270 | delete pix_colors_focused; |
275 | delete [] pix_colors_focused; |
271 | #if OFF_FOCUS_FADING |
276 | #if OFF_FOCUS_FADING |
272 | delete pix_colors_unfocused; |
277 | delete [] pix_colors_unfocused; |
273 | #endif |
278 | #endif |
274 | |
279 | |
275 | displays.put (display); |
280 | displays.put (display); |
276 | |
281 | |
277 | scr_release (); |
282 | scr_release (); |
… | |
… | |
326 | im_ev.stop (display); |
331 | im_ev.stop (display); |
327 | #endif |
332 | #endif |
328 | #if HAVE_SCROLLBARS |
333 | #if HAVE_SCROLLBARS |
329 | scrollbar_ev.stop (display); |
334 | scrollbar_ev.stop (display); |
330 | #endif |
335 | #endif |
331 | #if TRANSPARENT |
336 | #if TRANSPARENT || ENABLE_PERL |
332 | rootwin_ev.stop (display); |
337 | rootwin_ev.stop (display); |
333 | #endif |
338 | #endif |
334 | incr_ev.stop (); |
339 | incr_ev.stop (); |
335 | termwin_ev.stop (display); |
340 | termwin_ev.stop (display); |
336 | vt_ev.stop (display); |
341 | vt_ev.stop (display); |
… | |
… | |
504 | XSelectInput (dpy, display->root, PropertyChangeMask); |
509 | XSelectInput (dpy, display->root, PropertyChangeMask); |
505 | check_our_parents (); |
510 | check_our_parents (); |
506 | rootwin_ev.start (display, display->root); |
511 | rootwin_ev.start (display, display->root); |
507 | } |
512 | } |
508 | #endif |
513 | #endif |
|
|
514 | #if ENABLE_PERL |
|
|
515 | rootwin_ev.start (display, display->root); |
|
|
516 | #endif |
509 | |
517 | |
510 | set_colorfgbg (); |
518 | set_colorfgbg (); |
511 | |
519 | |
512 | init_command (cmd_argv); |
520 | init_command (cmd_argv); |
513 | |
521 | |
… | |
… | |
804 | delete fontset[0]; |
812 | delete fontset[0]; |
805 | fontset[0] = fs; |
813 | fontset[0] = fs; |
806 | |
814 | |
807 | prop = (*fs)[1]->properties (); |
815 | prop = (*fs)[1]->properties (); |
808 | prop.height += lineSpace; |
816 | prop.height += lineSpace; |
|
|
817 | |
809 | fs->set_prop (prop); |
818 | fs->set_prop (prop, false); |
810 | |
819 | |
811 | fwidth = prop.width; |
820 | fwidth = prop.width; |
812 | fheight = prop.height; |
821 | fheight = prop.height; |
813 | fbase = prop.ascent; |
822 | fbase = prop.ascent; |
814 | |
823 | |
… | |
… | |
823 | { |
832 | { |
824 | fontset[style] = fs = new rxvt_fontset (this); |
833 | fontset[style] = fs = new rxvt_fontset (this); |
825 | rxvt_fontprop prop2 = prop; |
834 | rxvt_fontprop prop2 = prop; |
826 | |
835 | |
827 | if (res) |
836 | if (res) |
828 | prop2.weight = prop2.slant = rxvt_fontprop::unset; |
837 | { |
|
|
838 | fs->populate (res); |
|
|
839 | fs->set_prop (prop2, false); |
|
|
840 | } |
829 | else |
841 | else |
830 | { |
842 | { |
831 | res = fontset[0]->fontdesc; |
843 | fs->populate (fontset[0]->fontdesc); |
832 | |
844 | |
833 | if (SET_STYLE (0, style) & RS_Bold) prop2.weight = rxvt_fontprop::bold; |
845 | if (SET_STYLE (0, style) & RS_Bold) prop2.weight = rxvt_fontprop::bold; |
834 | if (SET_STYLE (0, style) & RS_Italic) prop2.slant = rxvt_fontprop::italic; |
846 | if (SET_STYLE (0, style) & RS_Italic) prop2.slant = rxvt_fontprop::italic; |
|
|
847 | |
|
|
848 | fs->set_prop (prop2, true); |
835 | } |
849 | } |
836 | |
850 | |
837 | fs->populate (res); |
|
|
838 | fs->set_prop (prop2); |
|
|
839 | } |
851 | } |
840 | #else |
852 | #else |
841 | fontset[style] = fontset[0]; |
853 | fontset[style] = fontset[0]; |
842 | #endif |
854 | #endif |
843 | } |
855 | } |