… | |
… | |
171 | #endif |
171 | #endif |
172 | #ifdef USE_XIM |
172 | #ifdef USE_XIM |
173 | im_ev (this, &rxvt_term::im_cb), |
173 | im_ev (this, &rxvt_term::im_cb), |
174 | #endif |
174 | #endif |
175 | check_ev (this, &rxvt_term::check_cb), |
175 | check_ev (this, &rxvt_term::check_cb), |
|
|
176 | flush_ev (this, &rxvt_term::flush_cb), |
176 | destroy_ev (this, &rxvt_term::destroy_cb), |
177 | destroy_ev (this, &rxvt_term::destroy_cb), |
177 | pty_ev (this, &rxvt_term::pty_cb), |
178 | pty_ev (this, &rxvt_term::pty_cb), |
178 | incr_ev (this, &rxvt_term::incr_cb) |
179 | incr_ev (this, &rxvt_term::incr_cb) |
179 | { |
180 | { |
180 | cmdbuf_ptr = cmdbuf_endp = cmdbuf_base; |
181 | cmdbuf_ptr = cmdbuf_endp = cmdbuf_base; |
… | |
… | |
200 | |
201 | |
201 | if (display) |
202 | if (display) |
202 | { |
203 | { |
203 | selection_clear (); |
204 | selection_clear (); |
204 | |
205 | |
|
|
206 | #ifdef USE_XIM |
|
|
207 | im_destroy (); |
|
|
208 | #endif |
205 | #ifdef MENUBAR |
209 | #ifdef MENUBAR |
206 | if (menubarGC) XFreeGC (display->display, menubarGC); |
210 | if (menubarGC) XFreeGC (display->display, menubarGC); |
207 | #endif |
211 | #endif |
208 | #ifdef XTERM_SCROLLBAR |
212 | #ifdef XTERM_SCROLLBAR |
209 | if (xscrollbarGC) XFreeGC (display->display, xscrollbarGC); |
213 | if (xscrollbarGC) XFreeGC (display->display, xscrollbarGC); |
… | |
… | |
242 | XDestroyWindow (display->display, TermWin.parent[0]); |
246 | XDestroyWindow (display->display, TermWin.parent[0]); |
243 | } |
247 | } |
244 | |
248 | |
245 | // TODO: free pixcolours, colours should become part of rxvt_display |
249 | // TODO: free pixcolours, colours should become part of rxvt_display |
246 | |
250 | |
247 | delete PixColors; |
251 | delete PixColorsFocused; |
|
|
252 | #ifdef OFF_FOCUS_FADING |
|
|
253 | delete PixColorsUnFocused; |
|
|
254 | #endif |
248 | |
255 | |
249 | displays.put (display); |
256 | displays.put (display); |
250 | |
257 | |
251 | scr_release (); |
258 | scr_release (); |
252 | |
259 | |
… | |
… | |
270 | } |
277 | } |
271 | |
278 | |
272 | void |
279 | void |
273 | rxvt_term::destroy () |
280 | rxvt_term::destroy () |
274 | { |
281 | { |
|
|
282 | if (destroy_ev.active) |
|
|
283 | return; |
|
|
284 | |
275 | if (display) |
285 | if (display) |
276 | { |
286 | { |
|
|
287 | #ifdef USE_XIM |
|
|
288 | im_ev.stop (display); |
|
|
289 | #endif |
|
|
290 | #ifdef HAVE_SCROLLBARS |
|
|
291 | scrollbar_ev.stop (display); |
|
|
292 | #endif |
|
|
293 | #ifdef MENUBAR |
|
|
294 | menubar_ev.stop (display); |
|
|
295 | #endif |
277 | rootwin_ev.stop (display); |
296 | rootwin_ev.stop (display); |
278 | termwin_ev.stop (display); |
297 | termwin_ev.stop (display); |
279 | vt_ev.stop (display); |
298 | vt_ev.stop (display); |
280 | #ifdef USE_XIM |
|
|
281 | im_destroy (); |
|
|
282 | im_ev.stop (display); |
|
|
283 | #endif |
|
|
284 | #ifdef HAVE_SCROLLBARS |
|
|
285 | scrollbar_ev.stop (display); |
|
|
286 | #endif |
|
|
287 | #ifdef MENUBAR |
|
|
288 | menubar_ev.stop (display); |
|
|
289 | #endif |
|
|
290 | } |
299 | } |
291 | |
300 | |
292 | check_ev.stop (); |
301 | check_ev.stop (); |
293 | pty_ev.stop (); |
302 | pty_ev.stop (); |
294 | #ifdef CURSOR_BLINK |
303 | #ifdef CURSOR_BLINK |
… | |
… | |
883 | resize_all_windows (0, 0, 0); |
892 | resize_all_windows (0, 0, 0); |
884 | scr_remap_chars (); |
893 | scr_remap_chars (); |
885 | scr_touch (true); |
894 | scr_touch (true); |
886 | } |
895 | } |
887 | |
896 | |
|
|
897 | for (unicode_t ch = 0x20; ch <= 0x7f; ch++) |
|
|
898 | TermWin.ascii_map [ch - 0x20] = fs->find_font (ch); |
|
|
899 | |
888 | return true; |
900 | return true; |
889 | } |
901 | } |
890 | } |
902 | } |
891 | |
903 | |
892 | return false; |
904 | return false; |
… | |
… | |
955 | i = atoi (color); |
967 | i = atoi (color); |
956 | if (i >= 8 && i <= 15) |
968 | if (i >= 8 && i <= 15) |
957 | { /* bright colors */ |
969 | { /* bright colors */ |
958 | i -= 8; |
970 | i -= 8; |
959 | # ifndef NO_BRIGHTCOLOR |
971 | # ifndef NO_BRIGHTCOLOR |
960 | PixColors[idx] = PixColors[minBrightCOLOR + i]; |
972 | PixColorsFocused[idx] = PixColorsFocused[minBrightCOLOR + i]; |
961 | SET_PIXCOLOR (idx); |
973 | SET_PIXCOLOR (idx); |
962 | goto Done; |
974 | goto Done; |
963 | # endif |
975 | # endif |
964 | |
976 | |
965 | } |
977 | } |
966 | if (i >= 0 && i <= 7) |
978 | if (i >= 0 && i <= 7) |
967 | { /* normal colors */ |
979 | { /* normal colors */ |
968 | PixColors[idx] = PixColors[minCOLOR + i]; |
980 | PixColorsFocused[idx] = PixColorsFocused[minCOLOR + i]; |
969 | SET_PIXCOLOR (idx); |
981 | SET_PIXCOLOR (idx); |
970 | goto Done; |
982 | goto Done; |
971 | } |
983 | } |
972 | } |
984 | } |
973 | |
985 | |
974 | if (!rXParseAllocColor (& xcol, color)) |
986 | if (!rXParseAllocColor (& xcol, color)) |
975 | return; |
987 | return; |
976 | |
988 | |
977 | /* XStoreColor (display->display, XCMAP, XColor*); */ |
989 | /* XStoreColor (display->display, display->cmap, XColor*); */ |
978 | |
990 | |
979 | /* |
991 | /* |
980 | * FIXME: should free colors here, but no idea how to do it so instead, |
992 | * FIXME: should free colors here, but no idea how to do it so instead, |
981 | * so just keep gobbling up the colormap |
993 | * so just keep gobbling up the colormap |
982 | */ |
994 | */ |
… | |
… | |
985 | if (PixColors[idx] == PixColors[i]) |
997 | if (PixColors[idx] == PixColors[i]) |
986 | break; |
998 | break; |
987 | if (i > Color_White) |
999 | if (i > Color_White) |
988 | { |
1000 | { |
989 | /* fprintf (stderr, "XFreeColors: PixColors [%d] = %lu\n", idx, PixColors [idx]); */ |
1001 | /* fprintf (stderr, "XFreeColors: PixColors [%d] = %lu\n", idx, PixColors [idx]); */ |
990 | XFreeColors (display->display, XCMAP, (PixColors + idx), 1, |
1002 | XFreeColors (display->display, display->cmap, (PixColors + idx), 1, |
991 | DisplayPlanes (display->display, display->screen)); |
1003 | DisplayPlanes (display->display, display->screen)); |
992 | } |
1004 | } |
993 | # endif |
1005 | # endif |
994 | |
1006 | |
995 | PixColors[idx] = xcol; |
1007 | PixColorsFocused[idx] = xcol; |
996 | SET_PIXCOLOR (idx); |
1008 | SET_PIXCOLOR (idx); |
997 | |
1009 | |
998 | /* XSetWindowAttributes attr; */ |
1010 | /* XSetWindowAttributes attr; */ |
999 | /* Cursor cursor; */ |
1011 | /* Cursor cursor; */ |
1000 | Done: |
1012 | Done: |
|
|
1013 | #ifdef OFF_FOCUS_FADING |
|
|
1014 | PixColorsUnFocused[idx] = PixColorsFocused[idx].fade (display, atoi (rs[Rs_fade])); |
|
|
1015 | #endif |
1001 | if (idx == Color_bg && ! (Options & Opt_transparent)) |
1016 | if (idx == Color_bg && ! (Options & Opt_transparent)) |
1002 | XSetWindowBackground (display->display, TermWin.vt, |
1017 | XSetWindowBackground (display->display, TermWin.vt, PixColors[Color_bg]); |
1003 | PixColors[Color_bg]); |
|
|
1004 | |
1018 | |
1005 | /* handle Color_BD, scrollbar background, etc. */ |
1019 | /* handle Color_BD, scrollbar background, etc. */ |
1006 | |
1020 | |
1007 | set_colorfgbg (); |
1021 | set_colorfgbg (); |
1008 | recolour_cursor (); |
1022 | recolour_cursor (); |
… | |
… | |
1016 | void |
1030 | void |
1017 | rxvt_term::recolour_cursor () |
1031 | rxvt_term::recolour_cursor () |
1018 | { |
1032 | { |
1019 | XColor xcol[2]; |
1033 | XColor xcol[2]; |
1020 | |
1034 | |
1021 | xcol[0].pixel = ISSET_PIXCOLOR (Color_pointer_fg) ? PixColors[Color_pointer_fg] : PixColors[Color_fg]; |
1035 | xcol[0].pixel = ISSET_PIXCOLOR (Color_pointer_fg) ? PixColorsFocused[Color_pointer_fg] : PixColorsFocused[Color_fg]; |
1022 | xcol[1].pixel = ISSET_PIXCOLOR (Color_pointer_bg) ? PixColors[Color_pointer_bg] : PixColors[Color_bg]; |
1036 | xcol[1].pixel = ISSET_PIXCOLOR (Color_pointer_bg) ? PixColorsFocused[Color_pointer_bg] : PixColorsFocused[Color_bg]; |
1023 | XQueryColors (display->display, XCMAP, xcol, 2); |
1037 | XQueryColors (display->display, display->cmap, xcol, 2); |
1024 | XRecolorCursor (display->display, TermWin_cursor, xcol + 0, xcol + 1); |
1038 | XRecolorCursor (display->display, TermWin_cursor, xcol + 0, xcol + 1); |
1025 | } |
1039 | } |
1026 | |
1040 | |
1027 | /*----------------------------------------------------------------------*/ |
1041 | /*----------------------------------------------------------------------*/ |
1028 | /* |
1042 | /* |