ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/main.C
(Generate patch)

Comparing rxvt-unicode/src/main.C (file contents):
Revision 1.121 by root, Wed Dec 15 00:12:58 2004 UTC vs.
Revision 1.132 by root, Thu Feb 3 07:18:30 2005 UTC

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
49vector<rxvt_term *> rxvt_term::termlist; 52vector<rxvt_term *> rxvt_term::termlist;
50 53
51static char curlocale[128]; 54static char curlocale[128];
52 55
156#endif 159#endif
157#ifdef USE_XIM 160#ifdef USE_XIM
158 im_ev (this, &rxvt_term::im_cb), 161 im_ev (this, &rxvt_term::im_cb),
159#endif 162#endif
160 sw_term (this, &rxvt_term::sig_term), 163 sw_term (this, &rxvt_term::sig_term),
164 sw_int (this, &rxvt_term::sig_term),
161 sw_chld (this, &rxvt_term::sig_chld), 165 sw_chld (this, &rxvt_term::sig_chld),
162 termwin_ev (this, &rxvt_term::x_cb), 166 termwin_ev (this, &rxvt_term::x_cb),
163 vt_ev (this, &rxvt_term::x_cb), 167 vt_ev (this, &rxvt_term::x_cb),
164 check_ev (this, &rxvt_term::check_cb), 168 check_ev (this, &rxvt_term::check_cb),
165 flush_ev (this, &rxvt_term::flush_cb), 169 flush_ev (this, &rxvt_term::flush_cb),
168 incr_ev (this, &rxvt_term::incr_cb) 172 incr_ev (this, &rxvt_term::incr_cb)
169{ 173{
170 cmdbuf_ptr = cmdbuf_endp = cmdbuf_base; 174 cmdbuf_ptr = cmdbuf_endp = cmdbuf_base;
171 175
172 termlist.push_back (this); 176 termlist.push_back (this);
177
178#ifdef KEYSYM_RESOURCE
179 keyboard = new keyboard_manager;
180
181 if (!keyboard)
182 rxvt_fatal ("out of memory, aborting.\n");
183#endif
173} 184}
174 185
175rxvt_term::~rxvt_term () 186rxvt_term::~rxvt_term ()
176{ 187{
177 termlist.erase (find (termlist.begin (), termlist.end(), this)); 188 termlist.erase (find (termlist.begin (), termlist.end(), this));
178 189
179 if (cmd_pid) 190 if (cmd_pid)
180 kill (-cmd_pid, SIGHUP); 191 kill (-cmd_pid, SIGHUP);
181 192
182 pty.put ();
183
184#ifdef UTMP_SUPPORT 193#ifdef UTMP_SUPPORT
185 privileged_utmp (RESTORE); 194 privileged_utmp (RESTORE);
186#endif 195#endif
196
197 pty.put ();
187 198
188#if ENABLE_STYLES 199#if ENABLE_STYLES
189 for (int i = RS_styleCount; --i; ) 200 for (int i = RS_styleCount; --i; )
190 if (TermWin.fontset[i] != TermWin.fontset[0]) 201 if (TermWin.fontset[i] != TermWin.fontset[0])
191 delete TermWin.fontset[i]; 202 delete TermWin.fontset[i];
264 free (v_buffer); 275 free (v_buffer);
265 free (incr_buf); 276 free (incr_buf);
266 277
267 delete envv; 278 delete envv;
268 delete argv; 279 delete argv;
280
281#ifdef KEYSYM_RESOURCE
282 delete keyboard;
283#endif
269} 284}
270 285
271void 286void
272rxvt_term::destroy () 287rxvt_term::destroy ()
273{ 288{
331bool 346bool
332rxvt_term::init (int argc, const char *const *argv) 347rxvt_term::init (int argc, const char *const *argv)
333{ 348{
334 SET_R (this); 349 SET_R (this);
335 350
351 set_locale ("");
352
336 if (!init_vars ()) 353 if (!init_vars ())
337 return false; 354 return false;
338 355
339 init_secondary (); 356 init_secondary ();
340 357
341 const char **cmd_argv = init_resources (argc, argv); 358 const char **cmd_argv = init_resources (argc, argv);
342 359
343 set_locale (""); 360#ifdef KEYSYM_RESOURCE
361 keyboard->register_done ();
362#endif
344 363
345#if MENUBAR_MAX 364#if MENUBAR_MAX
346 menubar_read (rs[Rs_menu]); 365 menubar_read (rs[Rs_menu]);
347#endif 366#endif
348#ifdef HAVE_SCROLLBARS 367#ifdef HAVE_SCROLLBARS
381 XMapWindow (display->display, TermWin.parent[0]); 400 XMapWindow (display->display, TermWin.parent[0]);
382 401
383 set_colorfgbg (); 402 set_colorfgbg ();
384 403
385 init_command (cmd_argv); 404 init_command (cmd_argv);
405
406 free (cmd_argv);
386 407
387 pty_ev.start (pty.pty, EVENT_READ); 408 pty_ev.start (pty.pty, EVENT_READ);
388 409
389 check_ev.start (); 410 check_ev.start ();
390 411
782 803
783 delete TermWin.fontset[0]; 804 delete TermWin.fontset[0];
784 TermWin.fontset[0] = fs; 805 TermWin.fontset[0] = fs;
785 806
786 prop = (*fs)[1]->properties (); 807 prop = (*fs)[1]->properties ();
808 prop.height += TermWin.lineSpace;
787 fs->set_prop (prop); 809 fs->set_prop (prop);
788 810
789 TermWin.fwidth = prop.width; 811 TermWin.fwidth = prop.width;
790 TermWin.fheight = prop.height; 812 TermWin.fheight = prop.height;
791 TermWin.fweight = prop.weight; 813 TermWin.fweight = prop.weight;
998 1020
999 sprintf (env_colorfgbg, "COLORFGBG=%s;%s%s", fstr, xpmb, bstr); 1021 sprintf (env_colorfgbg, "COLORFGBG=%s;%s%s", fstr, xpmb, bstr);
1000} 1022}
1001 1023
1002/*----------------------------------------------------------------------*/ 1024/*----------------------------------------------------------------------*/
1003/*
1004 * Colour determination for low colour displays, routine from
1005 * Hans de Goede <hans@highrise.nl>
1006 */
1007 1025
1008int 1026int
1009rxvt_term::rXParseAllocColor (rxvt_color *screen_in_out, const char *colour) 1027rxvt_term::rXParseAllocColor (rxvt_color *screen_in_out, const char *colour)
1010{ 1028{
1011 if (!screen_in_out->set (display, colour)) 1029 if (!screen_in_out->set (display, colour))
1098 TermWin_TotalWidth (), menuBar_TotalHeight ()); 1116 TermWin_TotalWidth (), menuBar_TotalHeight ());
1099 1117
1100 XMoveResizeWindow (display->display, TermWin.vt, 1118 XMoveResizeWindow (display->display, TermWin.vt,
1101 window_vt_x, window_vt_y, 1119 window_vt_x, window_vt_y,
1102 TermWin_TotalWidth (), TermWin_TotalHeight ()); 1120 TermWin_TotalWidth (), TermWin_TotalHeight ());
1121
1103 scr_clear (); 1122 scr_clear ();
1104#ifdef XPM_BACKGROUND 1123#ifdef XPM_BACKGROUND
1105 resize_pixmap (); 1124 resize_pixmap ();
1106#endif 1125#endif
1107 } 1126 }
1129 } 1148 }
1130 } 1149 }
1131 1150
1132 old_width = szHint.width; 1151 old_width = szHint.width;
1133 old_height = szHint.height; 1152 old_height = szHint.height;
1153
1154#ifdef XPM_BACKGROUND
1155 if (TermWin.pixmap)
1156 scr_touch (false);
1157#endif
1134 1158
1135#ifdef USE_XIM 1159#ifdef USE_XIM
1136 IMSetStatusPosition (); 1160 IMSetStatusPosition ();
1137#endif 1161#endif
1138} 1162}
1368 "*", 1392 "*",
1369 TermWin.fheight, 1393 TermWin.fheight,
1370 TermWin.fheight + 1, TermWin.fheight - 1, 1394 TermWin.fheight + 1, TermWin.fheight - 1,
1371 TermWin.fheight - 2, TermWin.fheight + 2); 1395 TermWin.fheight - 2, TermWin.fheight + 2);
1372 1396
1373 fs = XCreateFontSet (display->display, pat, 1397 fs = XCreateFontSet (display->display, rs[Rs_imFont] ? rs[Rs_imFont] : pat,
1374 &missing_charset_list, &missing_charset_count, &def_string); 1398 &missing_charset_list, &missing_charset_count, &def_string);
1375 1399
1376 if (missing_charset_list) 1400 if (missing_charset_list)
1377 XFreeStringList (missing_charset_list); 1401 XFreeStringList (missing_charset_list);
1378 1402

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines