… | |
… | |
140 | free (p); |
140 | free (p); |
141 | } |
141 | } |
142 | |
142 | |
143 | rxvt_term::rxvt_term () |
143 | rxvt_term::rxvt_term () |
144 | : |
144 | : |
|
|
145 | #if TRANSPARENT |
145 | rootwin_ev (this, &rxvt_term::rootwin_cb), |
146 | rootwin_ev (this, &rxvt_term::rootwin_cb), |
|
|
147 | #endif |
|
|
148 | #ifdef HAVE_SCROLLBARS |
|
|
149 | scrollbar_ev (this, &rxvt_term::x_cb), |
|
|
150 | #endif |
|
|
151 | #ifdef MENUBAR |
|
|
152 | menubar_ev (this, &rxvt_term::x_cb), |
|
|
153 | #endif |
|
|
154 | #ifdef CURSOR_BLINK |
|
|
155 | cursor_blink_ev (this, &rxvt_term::cursor_blink_cb), |
|
|
156 | #endif |
|
|
157 | #ifdef TEXT_BLINK |
|
|
158 | text_blink_ev (this, &rxvt_term::text_blink_cb), |
|
|
159 | #endif |
|
|
160 | #ifndef NO_SCROLLBAR_BUTTON_CONTINUAL_SCROLLING |
|
|
161 | cont_scroll_ev (this, &rxvt_term::cont_scroll_cb), |
|
|
162 | #endif |
|
|
163 | #ifdef SELECTION_SCROLLING |
|
|
164 | sel_scroll_ev (this, &rxvt_term::sel_scroll_cb), |
|
|
165 | #endif |
|
|
166 | #if defined(MOUSE_WHEEL) && defined(MOUSE_SLIP_WHEELING) |
|
|
167 | slip_wheel_ev (this, &rxvt_term::slip_wheel_cb), |
|
|
168 | #endif |
|
|
169 | #ifdef POINTER_BLANK |
|
|
170 | pointer_ev (this, &rxvt_term::pointer_cb), |
|
|
171 | #endif |
|
|
172 | #ifdef USE_XIM |
|
|
173 | im_ev (this, &rxvt_term::im_cb), |
|
|
174 | #endif |
146 | termwin_ev (this, &rxvt_term::x_cb), |
175 | termwin_ev (this, &rxvt_term::x_cb), |
147 | vt_ev (this, &rxvt_term::x_cb), |
176 | vt_ev (this, &rxvt_term::x_cb), |
148 | #ifdef HAVE_SCROLLBARS |
|
|
149 | scrollbar_ev (this, &rxvt_term::x_cb), |
|
|
150 | #endif |
|
|
151 | #ifdef MENUBAR |
|
|
152 | menubar_ev (this, &rxvt_term::x_cb), |
|
|
153 | #endif |
|
|
154 | #ifdef CURSOR_BLINK |
|
|
155 | cursor_blink_ev (this, &rxvt_term::cursor_blink_cb), |
|
|
156 | #endif |
|
|
157 | #ifdef TEXT_BLINK |
|
|
158 | text_blink_ev (this, &rxvt_term::text_blink_cb), |
|
|
159 | #endif |
|
|
160 | #ifndef NO_SCROLLBAR_BUTTON_CONTINUAL_SCROLLING |
|
|
161 | cont_scroll_ev (this, &rxvt_term::cont_scroll_cb), |
|
|
162 | #endif |
|
|
163 | #ifdef SELECTION_SCROLLING |
|
|
164 | sel_scroll_ev (this, &rxvt_term::sel_scroll_cb), |
|
|
165 | #endif |
|
|
166 | #if defined(MOUSE_WHEEL) && defined(MOUSE_SLIP_WHEELING) |
|
|
167 | slip_wheel_ev (this, &rxvt_term::slip_wheel_cb), |
|
|
168 | #endif |
|
|
169 | #ifdef POINTER_BLANK |
|
|
170 | pointer_ev (this, &rxvt_term::pointer_cb), |
|
|
171 | #endif |
|
|
172 | #ifdef USE_XIM |
|
|
173 | im_ev (this, &rxvt_term::im_cb), |
|
|
174 | #endif |
|
|
175 | check_ev (this, &rxvt_term::check_cb), |
177 | check_ev (this, &rxvt_term::check_cb), |
|
|
178 | flush_ev (this, &rxvt_term::flush_cb), |
176 | destroy_ev (this, &rxvt_term::destroy_cb), |
179 | destroy_ev (this, &rxvt_term::destroy_cb), |
177 | pty_ev (this, &rxvt_term::pty_cb), |
180 | pty_ev (this, &rxvt_term::pty_cb), |
178 | incr_ev (this, &rxvt_term::incr_cb) |
181 | incr_ev (this, &rxvt_term::incr_cb) |
179 | { |
182 | { |
180 | cmdbuf_ptr = cmdbuf_endp = cmdbuf_base; |
183 | cmdbuf_ptr = cmdbuf_endp = cmdbuf_base; |
… | |
… | |
200 | |
203 | |
201 | if (display) |
204 | if (display) |
202 | { |
205 | { |
203 | selection_clear (); |
206 | selection_clear (); |
204 | |
207 | |
|
|
208 | #ifdef USE_XIM |
|
|
209 | im_destroy (); |
|
|
210 | #endif |
205 | #ifdef MENUBAR |
211 | #ifdef MENUBAR |
206 | if (menubarGC) XFreeGC (display->display, menubarGC); |
212 | if (menubarGC) XFreeGC (display->display, menubarGC); |
207 | #endif |
213 | #endif |
208 | #ifdef XTERM_SCROLLBAR |
214 | #ifdef XTERM_SCROLLBAR |
209 | if (xscrollbarGC) XFreeGC (display->display, xscrollbarGC); |
215 | if (xscrollbarGC) XFreeGC (display->display, xscrollbarGC); |
… | |
… | |
273 | } |
279 | } |
274 | |
280 | |
275 | void |
281 | void |
276 | rxvt_term::destroy () |
282 | rxvt_term::destroy () |
277 | { |
283 | { |
|
|
284 | if (destroy_ev.active) |
|
|
285 | return; |
|
|
286 | |
278 | if (display) |
287 | if (display) |
279 | { |
288 | { |
|
|
289 | #if USE_XIM |
|
|
290 | im_ev.stop (display); |
|
|
291 | #endif |
|
|
292 | #if HAVE_SCROLLBARS |
|
|
293 | scrollbar_ev.stop (display); |
|
|
294 | #endif |
|
|
295 | #if MENUBAR |
|
|
296 | menubar_ev.stop (display); |
|
|
297 | #endif |
|
|
298 | #if TRANSPARENT |
280 | rootwin_ev.stop (display); |
299 | rootwin_ev.stop (display); |
|
|
300 | #endif |
|
|
301 | incr_ev.stop (); |
281 | termwin_ev.stop (display); |
302 | termwin_ev.stop (display); |
282 | vt_ev.stop (display); |
303 | vt_ev.stop (display); |
283 | #ifdef USE_XIM |
|
|
284 | im_destroy (); |
|
|
285 | im_ev.stop (display); |
|
|
286 | #endif |
|
|
287 | #ifdef HAVE_SCROLLBARS |
|
|
288 | scrollbar_ev.stop (display); |
|
|
289 | #endif |
|
|
290 | #ifdef MENUBAR |
|
|
291 | menubar_ev.stop (display); |
|
|
292 | #endif |
|
|
293 | } |
304 | } |
294 | |
305 | |
295 | check_ev.stop (); |
306 | check_ev.stop (); |
296 | pty_ev.stop (); |
307 | pty_ev.stop (); |
297 | #ifdef CURSOR_BLINK |
308 | #ifdef CURSOR_BLINK |
… | |
… | |
376 | #ifdef TRANSPARENT |
387 | #ifdef TRANSPARENT |
377 | if (Options & Opt_transparent) |
388 | if (Options & Opt_transparent) |
378 | { |
389 | { |
379 | XSelectInput (display->display, display->root, PropertyChangeMask); |
390 | XSelectInput (display->display, display->root, PropertyChangeMask); |
380 | check_our_parents (); |
391 | check_our_parents (); |
381 | } |
|
|
382 | #endif |
|
|
383 | |
|
|
384 | rootwin_ev.start (display, display->root); |
392 | rootwin_ev.start (display, display->root); |
|
|
393 | } |
|
|
394 | #endif |
385 | |
395 | |
386 | XMapWindow (display->display, TermWin.vt); |
396 | XMapWindow (display->display, TermWin.vt); |
387 | XMapWindow (display->display, TermWin.parent[0]); |
397 | XMapWindow (display->display, TermWin.parent[0]); |
388 | |
398 | |
389 | init_command (cmd_argv); |
399 | init_command (cmd_argv); |
… | |
… | |
886 | resize_all_windows (0, 0, 0); |
896 | resize_all_windows (0, 0, 0); |
887 | scr_remap_chars (); |
897 | scr_remap_chars (); |
888 | scr_touch (true); |
898 | scr_touch (true); |
889 | } |
899 | } |
890 | |
900 | |
|
|
901 | for (unicode_t ch = 0x20; ch <= 0x7f; ch++) |
|
|
902 | TermWin.ascii_map [ch - 0x20] = fs->find_font (ch); |
|
|
903 | |
891 | return true; |
904 | return true; |
892 | } |
905 | } |
893 | } |
906 | } |
894 | |
907 | |
895 | return false; |
908 | return false; |
… | |
… | |
975 | } |
988 | } |
976 | |
989 | |
977 | if (!rXParseAllocColor (& xcol, color)) |
990 | if (!rXParseAllocColor (& xcol, color)) |
978 | return; |
991 | return; |
979 | |
992 | |
980 | /* XStoreColor (display->display, XCMAP, XColor*); */ |
993 | /* XStoreColor (display->display, display->cmap, XColor*); */ |
981 | |
994 | |
982 | /* |
995 | /* |
983 | * FIXME: should free colors here, but no idea how to do it so instead, |
996 | * FIXME: should free colors here, but no idea how to do it so instead, |
984 | * so just keep gobbling up the colormap |
997 | * so just keep gobbling up the colormap |
985 | */ |
998 | */ |
… | |
… | |
988 | if (PixColors[idx] == PixColors[i]) |
1001 | if (PixColors[idx] == PixColors[i]) |
989 | break; |
1002 | break; |
990 | if (i > Color_White) |
1003 | if (i > Color_White) |
991 | { |
1004 | { |
992 | /* fprintf (stderr, "XFreeColors: PixColors [%d] = %lu\n", idx, PixColors [idx]); */ |
1005 | /* fprintf (stderr, "XFreeColors: PixColors [%d] = %lu\n", idx, PixColors [idx]); */ |
993 | XFreeColors (display->display, XCMAP, (PixColors + idx), 1, |
1006 | XFreeColors (display->display, display->cmap, (PixColors + idx), 1, |
994 | DisplayPlanes (display->display, display->screen)); |
1007 | DisplayPlanes (display->display, display->screen)); |
995 | } |
1008 | } |
996 | # endif |
1009 | # endif |
997 | |
1010 | |
998 | PixColorsFocused[idx] = xcol; |
1011 | PixColorsFocused[idx] = xcol; |
… | |
… | |
1023 | { |
1036 | { |
1024 | XColor xcol[2]; |
1037 | XColor xcol[2]; |
1025 | |
1038 | |
1026 | xcol[0].pixel = ISSET_PIXCOLOR (Color_pointer_fg) ? PixColorsFocused[Color_pointer_fg] : PixColorsFocused[Color_fg]; |
1039 | xcol[0].pixel = ISSET_PIXCOLOR (Color_pointer_fg) ? PixColorsFocused[Color_pointer_fg] : PixColorsFocused[Color_fg]; |
1027 | xcol[1].pixel = ISSET_PIXCOLOR (Color_pointer_bg) ? PixColorsFocused[Color_pointer_bg] : PixColorsFocused[Color_bg]; |
1040 | xcol[1].pixel = ISSET_PIXCOLOR (Color_pointer_bg) ? PixColorsFocused[Color_pointer_bg] : PixColorsFocused[Color_bg]; |
1028 | XQueryColors (display->display, XCMAP, xcol, 2); |
1041 | XQueryColors (display->display, display->cmap, xcol, 2); |
1029 | XRecolorCursor (display->display, TermWin_cursor, xcol + 0, xcol + 1); |
1042 | XRecolorCursor (display->display, TermWin_cursor, xcol + 0, xcol + 1); |
1030 | } |
1043 | } |
1031 | |
1044 | |
1032 | /*----------------------------------------------------------------------*/ |
1045 | /*----------------------------------------------------------------------*/ |
1033 | /* |
1046 | /* |
… | |
… | |
1227 | if (width == 0) |
1240 | if (width == 0) |
1228 | width = wattr.width - szHint.base_width; |
1241 | width = wattr.width - szHint.base_width; |
1229 | if (height == 0) |
1242 | if (height == 0) |
1230 | height = wattr.height - szHint.base_height; |
1243 | height = wattr.height - szHint.base_height; |
1231 | } |
1244 | } |
|
|
1245 | |
1232 | if (width != TermWin.width || height != TermWin.height) |
1246 | if (width != TermWin.width || height != TermWin.height) |
1233 | { |
1247 | { |
1234 | width += szHint.base_width; |
1248 | width += szHint.base_width; |
1235 | height += szHint.base_height; |
1249 | height += szHint.base_height; |
1236 | resize_all_windows (width, height, 0); |
1250 | resize_all_windows (width, height, 0); |