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.32 by pcg, Fri Feb 13 12:16:21 2004 UTC vs.
Revision 1.36 by pcg, Sat Feb 21 20:33:40 2004 UTC

1/*--------------------------------*-C-*---------------------------------* 1/*--------------------------------*-C-*---------------------------------*;
2 * File: main.c 2 * File: main.c
3 *----------------------------------------------------------------------* 3 *----------------------------------------------------------------------*
4 * 4 *
5 * All portions of code are copyright by their respective author/s. 5 * All portions of code are copyright by their respective author/s.
6 * Copyright (c) 1992 John Bovey, University of Kent at Canterbury <jdb@ukc.ac.uk> 6 * Copyright (c) 1992 John Bovey, University of Kent at Canterbury <jdb@ukc.ac.uk>
90 text_blink_ev (this, &rxvt_term::text_blink_cb), 90 text_blink_ev (this, &rxvt_term::text_blink_cb),
91#endif 91#endif
92#ifdef POINTER_BLANK 92#ifdef POINTER_BLANK
93 pointer_ev (this, &rxvt_term::pointer_cb), 93 pointer_ev (this, &rxvt_term::pointer_cb),
94#endif 94#endif
95#ifdef USE_XIM
96 im_ev (this, &rxvt_term::im_cb),
97#endif
95 check_ev (this, &rxvt_term::check_cb), 98 check_ev (this, &rxvt_term::check_cb),
96 destroy_ev (this, &rxvt_term::destroy_cb), 99 destroy_ev (this, &rxvt_term::destroy_cb),
97 pty_ev (this, &rxvt_term::pty_cb), 100 pty_ev (this, &rxvt_term::pty_cb),
98 incr_ev (this, &rxvt_term::incr_cb), 101 incr_ev (this, &rxvt_term::incr_cb)
99#ifdef USE_XIM
100 im_ev (this, &rxvt_term::im_cb)
101#endif
102{ 102{
103 cmdbuf_ptr = cmdbuf_endp = cmdbuf_base; 103 cmdbuf_ptr = cmdbuf_endp = cmdbuf_base;
104} 104}
105 105
106rxvt_term::~rxvt_term () 106rxvt_term::~rxvt_term ()
107{ 107{
108 if (cmd_fd >= 0) 108 if (cmd_fd >= 0)
109 close (cmd_fd); 109 close (cmd_fd);
110 110
111#ifndef NO_SETOWNER_TTYDEV
112 privileged_ttydev (RESTORE);
113#endif
114#ifdef UTMP_SUPPORT
115 privileged_utmp (RESTORE);
116#endif
117
118 delete TermWin.fontset;
119
120 if (display)
121 if (TermWin.parent[0])
122 XDestroyWindow (display->display, TermWin.parent[0]);
123
124 // TODO: free pixcolours, colours should become part of rxvt_display
125
126 delete PixColors;
127
128 displays.put (display);
129
111 scr_release (); 130 scr_release ();
112 131
132 free (env_windowid);
133 free (env_display);
134 free (env_term);
135 free (env_colorfgbg);
113 free (locale); 136 free (locale);
114 free (codeset); 137 free (codeset);
115 138
116#ifndef NO_SETOWNER_TTYDEV 139 delete envv;
117 privileged_ttydev (RESTORE); 140 delete argv;
118#endif
119#ifdef UTMP_SUPPORT
120 privileged_utmp (RESTORE);
121#endif
122
123 // TODO: free pixcolours, colours should become part of rxvt_display
124
125 delete PixColors;
126 delete TermWin.fontset;
127
128 displays.put (display);
129} 141}
130 142
131void 143void
132rxvt_term::destroy () 144rxvt_term::destroy ()
133{ 145{
134 if (display) 146 if (display)
135 { 147 {
136 if (TermWin.parent[0])
137 XDestroyWindow (display->display, TermWin.parent[0]);
138
139 rootwin_ev.stop (display); 148 rootwin_ev.stop (display);
140 termwin_ev.stop (display); 149 termwin_ev.stop (display);
141 vt_ev.stop (display); 150 vt_ev.stop (display);
142
143#ifdef USE_XIM 151#ifdef USE_XIM
144 im_destroy (); 152 im_destroy ();
145 im_ev.stop (display); 153 im_ev.stop (display);
146#endif 154#endif
147#ifdef HAVE_SCROLLBARS 155#ifdef HAVE_SCROLLBARS
257 scr_reset (); /* initialize screen */ 265 scr_reset (); /* initialize screen */
258#ifdef RXVT_GRAPHICS 266#ifdef RXVT_GRAPHICS
259 Gr_reset (); /* reset graphics */ 267 Gr_reset (); /* reset graphics */
260#endif 268#endif
261 269
262#if 0 270#if 1
263#ifdef DEBUG_X
264 XSynchronize (display->display, True); 271 XSynchronize (display->display, True);
265#endif
266#endif 272#endif
267 273
268#ifdef HAVE_SCROLLBARS 274#ifdef HAVE_SCROLLBARS
269 if (Options & Opt_scrollBar) 275 if (Options & Opt_scrollBar)
270 resize_scrollbar (); /* create and map scrollbar */ 276 resize_scrollbar (); /* create and map scrollbar */
284 rootwin_ev.start (display, display->root); 290 rootwin_ev.start (display, display->root);
285 291
286 XMapWindow (display->display, TermWin.vt); 292 XMapWindow (display->display, TermWin.vt);
287 XMapWindow (display->display, TermWin.parent[0]); 293 XMapWindow (display->display, TermWin.parent[0]);
288 294
289 init_env ();
290 init_command (cmd_argv); 295 init_command (cmd_argv);
291 296
292 pty_ev.start (cmd_fd, EVENT_READ); 297 pty_ev.start (cmd_fd, EVENT_READ);
293 298
294 check_ev.start (); 299 check_ev.start ();
873#ifdef XPM_BACKGROUND 878#ifdef XPM_BACKGROUND
874 xpmb = "default;"; 879 xpmb = "default;";
875#endif 880#endif
876 break; 881 break;
877 } 882 }
883
878 sprintf (env_colorfgbg, "COLORFGBG=%s;%s%s", fstr, xpmb, bstr); 884 sprintf (env_colorfgbg, "COLORFGBG=%s;%s%s", fstr, xpmb, bstr);
879 putenv (env_colorfgbg);
880 885
881#ifndef NO_BRIGHTCOLOR 886#ifndef NO_BRIGHTCOLOR
882 colorfgbg = DEFAULT_RSTYLE; 887 colorfgbg = DEFAULT_RSTYLE;
883 for (i = minCOLOR; i <= maxCOLOR; i++) 888 for (i = minCOLOR; i <= maxCOLOR; i++)
884 { 889 {
1309 if (Input_Context) 1314 if (Input_Context)
1310 return; 1315 return;
1311 1316
1312#if defined(HAVE_XSETLOCALE) || defined(HAVE_SETLOCALE) 1317#if defined(HAVE_XSETLOCALE) || defined(HAVE_SETLOCALE)
1313 if (rs[Rs_imLocale]) 1318 if (rs[Rs_imLocale])
1314 setlocale (LC_CTYPE, rs[Rs_imLocale]); 1319 rxvt_set_locale (rs[Rs_imLocale]);
1315#endif 1320#endif
1316 1321
1317 p = rs[Rs_inputMethod]; 1322 p = rs[Rs_inputMethod];
1318 if (p && *p) 1323 if (p && *p)
1319 { 1324 {
1350 goto done; 1355 goto done;
1351 1356
1352done: 1357done:
1353#if defined(HAVE_XSETLOCALE) || defined(HAVE_SETLOCALE) 1358#if defined(HAVE_XSETLOCALE) || defined(HAVE_SETLOCALE)
1354 if (rs[Rs_imLocale]) 1359 if (rs[Rs_imLocale])
1355 setlocale (LC_CTYPE, locale); 1360 rxvt_set_locale (locale);
1356#endif 1361#endif
1357} 1362}
1358 1363
1359void 1364void
1360rxvt_term::IMSetStatusPosition () 1365rxvt_term::IMSetStatusPosition ()

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines