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 | |
106 | rxvt_term::~rxvt_term () |
106 | rxvt_term::~rxvt_term () |
107 | { |
107 | { |
108 | if (cmd_fd >= 0) |
108 | if (cmd_fd >= 0) |
109 | close (cmd_fd); |
109 | close (cmd_fd); |
|
|
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); |
110 | |
129 | |
111 | scr_release (); |
130 | scr_release (); |
112 | |
131 | |
113 | free (env_windowid); |
132 | free (env_windowid); |
114 | free (env_display); |
133 | free (env_display); |
115 | free (env_term); |
134 | free (env_term); |
116 | free (env_colorfgbg); |
135 | free (env_colorfgbg); |
117 | free (locale); |
136 | free (locale); |
118 | free (codeset); |
137 | free (codeset); |
119 | |
138 | |
120 | #ifndef NO_SETOWNER_TTYDEV |
|
|
121 | privileged_ttydev (RESTORE); |
|
|
122 | #endif |
|
|
123 | #ifdef UTMP_SUPPORT |
|
|
124 | privileged_utmp (RESTORE); |
|
|
125 | #endif |
|
|
126 | |
|
|
127 | // TODO: free pixcolours, colours should become part of rxvt_display |
|
|
128 | |
|
|
129 | delete PixColors; |
|
|
130 | delete TermWin.fontset; |
|
|
131 | |
|
|
132 | displays.put (display); |
|
|
133 | |
|
|
134 | delete envv; |
139 | delete envv; |
135 | delete argv; |
140 | delete argv; |
136 | } |
141 | } |
137 | |
142 | |
138 | void |
143 | void |
139 | rxvt_term::destroy () |
144 | rxvt_term::destroy () |
140 | { |
145 | { |
141 | if (display) |
146 | if (display) |
142 | { |
147 | { |
143 | if (TermWin.parent[0]) |
|
|
144 | XDestroyWindow (display->display, TermWin.parent[0]); |
|
|
145 | |
|
|
146 | rootwin_ev.stop (display); |
148 | rootwin_ev.stop (display); |
147 | termwin_ev.stop (display); |
149 | termwin_ev.stop (display); |
148 | vt_ev.stop (display); |
150 | vt_ev.stop (display); |
149 | |
|
|
150 | #ifdef USE_XIM |
151 | #ifdef USE_XIM |
151 | im_destroy (); |
152 | im_destroy (); |
152 | im_ev.stop (display); |
153 | im_ev.stop (display); |
153 | #endif |
154 | #endif |
154 | #ifdef HAVE_SCROLLBARS |
155 | #ifdef HAVE_SCROLLBARS |
… | |
… | |
265 | #ifdef RXVT_GRAPHICS |
266 | #ifdef RXVT_GRAPHICS |
266 | Gr_reset (); /* reset graphics */ |
267 | Gr_reset (); /* reset graphics */ |
267 | #endif |
268 | #endif |
268 | |
269 | |
269 | #if 0 |
270 | #if 0 |
270 | #ifdef DEBUG_X |
|
|
271 | XSynchronize (display->display, True); |
271 | XSynchronize (display->display, True); |
272 | #endif |
|
|
273 | #endif |
272 | #endif |
274 | |
273 | |
275 | #ifdef HAVE_SCROLLBARS |
274 | #ifdef HAVE_SCROLLBARS |
276 | if (Options & Opt_scrollBar) |
275 | if (Options & Opt_scrollBar) |
277 | resize_scrollbar (); /* create and map scrollbar */ |
276 | resize_scrollbar (); /* create and map scrollbar */ |
… | |
… | |
1315 | if (Input_Context) |
1314 | if (Input_Context) |
1316 | return; |
1315 | return; |
1317 | |
1316 | |
1318 | #if defined(HAVE_XSETLOCALE) || defined(HAVE_SETLOCALE) |
1317 | #if defined(HAVE_XSETLOCALE) || defined(HAVE_SETLOCALE) |
1319 | if (rs[Rs_imLocale]) |
1318 | if (rs[Rs_imLocale]) |
1320 | setlocale (LC_CTYPE, rs[Rs_imLocale]); |
1319 | rxvt_set_locale (rs[Rs_imLocale]); |
1321 | #endif |
1320 | #endif |
1322 | |
1321 | |
1323 | p = rs[Rs_inputMethod]; |
1322 | p = rs[Rs_inputMethod]; |
1324 | if (p && *p) |
1323 | if (p && *p) |
1325 | { |
1324 | { |
… | |
… | |
1356 | goto done; |
1355 | goto done; |
1357 | |
1356 | |
1358 | done: |
1357 | done: |
1359 | #if defined(HAVE_XSETLOCALE) || defined(HAVE_SETLOCALE) |
1358 | #if defined(HAVE_XSETLOCALE) || defined(HAVE_SETLOCALE) |
1360 | if (rs[Rs_imLocale]) |
1359 | if (rs[Rs_imLocale]) |
1361 | setlocale (LC_CTYPE, locale); |
1360 | rxvt_set_locale (locale); |
1362 | #endif |
1361 | #endif |
1363 | } |
1362 | } |
1364 | |
1363 | |
1365 | void |
1364 | void |
1366 | rxvt_term::IMSetStatusPosition () |
1365 | rxvt_term::IMSetStatusPosition () |