… | |
… | |
32 | |
32 | |
33 | #include "../config.h" /* NECESSARY */ |
33 | #include "../config.h" /* NECESSARY */ |
34 | #include "rxvt.h" /* NECESSARY */ |
34 | #include "rxvt.h" /* NECESSARY */ |
35 | #include "main.intpro" /* PROTOS for internal routines */ |
35 | #include "main.intpro" /* PROTOS for internal routines */ |
36 | |
36 | |
37 | #include <signal.h> |
37 | #include <csignal> |
|
|
38 | #include <cstring> |
38 | |
39 | |
39 | #ifdef TTY_GID_SUPPORT |
40 | #ifdef TTY_GID_SUPPORT |
40 | # include <grp.h> |
41 | # include <grp.h> |
41 | #endif |
42 | #endif |
42 | |
43 | |
43 | #ifdef HAVE_TERMIOS_H |
44 | #ifdef HAVE_TERMIOS_H |
44 | # include <termios.h> |
45 | # include <termios.h> |
45 | #endif |
46 | #endif |
46 | |
47 | |
47 | #include <cstring> |
48 | #ifdef KEYSYM_RESOURCE |
|
|
49 | # include "keyboard.h" |
|
|
50 | #endif |
48 | |
51 | |
49 | vector<rxvt_term *> rxvt_term::termlist; |
52 | vector<rxvt_term *> rxvt_term::termlist; |
50 | |
53 | |
51 | static char curlocale[128]; |
54 | static char curlocale[128]; |
52 | |
55 | |
… | |
… | |
168 | incr_ev (this, &rxvt_term::incr_cb) |
171 | incr_ev (this, &rxvt_term::incr_cb) |
169 | { |
172 | { |
170 | cmdbuf_ptr = cmdbuf_endp = cmdbuf_base; |
173 | cmdbuf_ptr = cmdbuf_endp = cmdbuf_base; |
171 | |
174 | |
172 | termlist.push_back (this); |
175 | termlist.push_back (this); |
|
|
176 | |
|
|
177 | #ifdef KEYSYM_RESOURCE |
|
|
178 | keyboard = new keyboard_manager; |
|
|
179 | |
|
|
180 | if (!keyboard) |
|
|
181 | rxvt_fatal ("out of memory, aborting.\n"); |
|
|
182 | #endif |
173 | } |
183 | } |
174 | |
184 | |
175 | rxvt_term::~rxvt_term () |
185 | rxvt_term::~rxvt_term () |
176 | { |
186 | { |
177 | termlist.erase (find (termlist.begin (), termlist.end(), this)); |
187 | termlist.erase (find (termlist.begin (), termlist.end(), this)); |
… | |
… | |
264 | free (v_buffer); |
274 | free (v_buffer); |
265 | free (incr_buf); |
275 | free (incr_buf); |
266 | |
276 | |
267 | delete envv; |
277 | delete envv; |
268 | delete argv; |
278 | delete argv; |
|
|
279 | |
|
|
280 | #ifdef KEYSYM_RESOURCE |
|
|
281 | delete keyboard; |
|
|
282 | #endif |
269 | } |
283 | } |
270 | |
284 | |
271 | void |
285 | void |
272 | rxvt_term::destroy () |
286 | rxvt_term::destroy () |
273 | { |
287 | { |
… | |
… | |
331 | bool |
345 | bool |
332 | rxvt_term::init (int argc, const char *const *argv) |
346 | rxvt_term::init (int argc, const char *const *argv) |
333 | { |
347 | { |
334 | SET_R (this); |
348 | SET_R (this); |
335 | |
349 | |
|
|
350 | set_locale (""); |
|
|
351 | |
336 | if (!init_vars ()) |
352 | if (!init_vars ()) |
337 | return false; |
353 | return false; |
338 | |
354 | |
339 | init_secondary (); |
355 | init_secondary (); |
340 | |
356 | |
341 | const char **cmd_argv = init_resources (argc, argv); |
357 | const char **cmd_argv = init_resources (argc, argv); |
342 | |
358 | |
343 | set_locale (""); |
359 | #ifdef KEYSYM_RESOURCE |
|
|
360 | keyboard->register_done (); |
|
|
361 | #endif |
344 | |
362 | |
345 | #if MENUBAR_MAX |
363 | #if MENUBAR_MAX |
346 | menubar_read (rs[Rs_menu]); |
364 | menubar_read (rs[Rs_menu]); |
347 | #endif |
365 | #endif |
348 | #ifdef HAVE_SCROLLBARS |
366 | #ifdef HAVE_SCROLLBARS |
… | |
… | |
381 | XMapWindow (display->display, TermWin.parent[0]); |
399 | XMapWindow (display->display, TermWin.parent[0]); |
382 | |
400 | |
383 | set_colorfgbg (); |
401 | set_colorfgbg (); |
384 | |
402 | |
385 | init_command (cmd_argv); |
403 | init_command (cmd_argv); |
|
|
404 | |
|
|
405 | free (cmd_argv); |
386 | |
406 | |
387 | pty_ev.start (pty.pty, EVENT_READ); |
407 | pty_ev.start (pty.pty, EVENT_READ); |
388 | |
408 | |
389 | check_ev.start (); |
409 | check_ev.start (); |
390 | |
410 | |
… | |
… | |
782 | |
802 | |
783 | delete TermWin.fontset[0]; |
803 | delete TermWin.fontset[0]; |
784 | TermWin.fontset[0] = fs; |
804 | TermWin.fontset[0] = fs; |
785 | |
805 | |
786 | prop = (*fs)[1]->properties (); |
806 | prop = (*fs)[1]->properties (); |
|
|
807 | prop.height += TermWin.lineSpace; |
787 | fs->set_prop (prop); |
808 | fs->set_prop (prop); |
788 | |
809 | |
789 | TermWin.fwidth = prop.width; |
810 | TermWin.fwidth = prop.width; |
790 | TermWin.fheight = prop.height; |
811 | TermWin.fheight = prop.height; |
791 | TermWin.fweight = prop.weight; |
812 | TermWin.fweight = prop.weight; |
… | |
… | |
860 | void |
881 | void |
861 | rxvt_term::set_title (const char *str) |
882 | rxvt_term::set_title (const char *str) |
862 | { |
883 | { |
863 | set_string_property (XA_WM_NAME, str); |
884 | set_string_property (XA_WM_NAME, str); |
864 | #if ENABLE_FRILLS |
885 | #if ENABLE_FRILLS |
865 | set_utf8_property (display->atom ("_NET_WM_NAME"), str); |
886 | set_utf8_property (xa[XA_NET_WM_NAME], str); |
866 | #endif |
887 | #endif |
867 | } |
888 | } |
868 | |
889 | |
869 | void |
890 | void |
870 | rxvt_term::set_icon_name (const char *str) |
891 | rxvt_term::set_icon_name (const char *str) |
871 | { |
892 | { |
872 | set_string_property (XA_WM_ICON_NAME, str); |
893 | set_string_property (XA_WM_ICON_NAME, str); |
873 | #if ENABLE_FRILLS |
894 | #if ENABLE_FRILLS |
874 | set_utf8_property (display->atom ("_NET_WM_ICON_NAME"), str); |
895 | set_utf8_property (xa[XA_NET_WM_ICON_NAME], str); |
875 | #endif |
896 | #endif |
876 | } |
897 | } |
877 | |
898 | |
878 | #ifdef XTERM_COLOR_CHANGE |
899 | #ifdef XTERM_COLOR_CHANGE |
879 | void |
900 | void |
… | |
… | |
998 | |
1019 | |
999 | sprintf (env_colorfgbg, "COLORFGBG=%s;%s%s", fstr, xpmb, bstr); |
1020 | sprintf (env_colorfgbg, "COLORFGBG=%s;%s%s", fstr, xpmb, bstr); |
1000 | } |
1021 | } |
1001 | |
1022 | |
1002 | /*----------------------------------------------------------------------*/ |
1023 | /*----------------------------------------------------------------------*/ |
1003 | /* |
|
|
1004 | * Colour determination for low colour displays, routine from |
|
|
1005 | * Hans de Goede <hans@highrise.nl> |
|
|
1006 | */ |
|
|
1007 | |
1024 | |
1008 | int |
1025 | int |
1009 | rxvt_term::rXParseAllocColor (rxvt_color *screen_in_out, const char *colour) |
1026 | rxvt_term::rXParseAllocColor (rxvt_color *screen_in_out, const char *colour) |
1010 | { |
1027 | { |
1011 | if (!screen_in_out->set (display, colour)) |
1028 | if (!screen_in_out->set (display, colour)) |