… | |
… | |
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); |
… | |
… | |
242 | XDestroyWindow (display->display, TermWin.parent[0]); |
248 | XDestroyWindow (display->display, TermWin.parent[0]); |
243 | } |
249 | } |
244 | |
250 | |
245 | // TODO: free pixcolours, colours should become part of rxvt_display |
251 | // TODO: free pixcolours, colours should become part of rxvt_display |
246 | |
252 | |
247 | delete PixColors; |
253 | delete PixColorsFocused; |
|
|
254 | #ifdef OFF_FOCUS_FADING |
|
|
255 | delete PixColorsUnFocused; |
|
|
256 | #endif |
248 | |
257 | |
249 | displays.put (display); |
258 | displays.put (display); |
250 | |
259 | |
251 | scr_release (); |
260 | scr_release (); |
252 | |
261 | |
… | |
… | |
270 | } |
279 | } |
271 | |
280 | |
272 | void |
281 | void |
273 | rxvt_term::destroy () |
282 | rxvt_term::destroy () |
274 | { |
283 | { |
|
|
284 | if (destroy_ev.active) |
|
|
285 | return; |
|
|
286 | |
275 | if (display) |
287 | if (display) |
276 | { |
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 |
277 | rootwin_ev.stop (display); |
299 | rootwin_ev.stop (display); |
|
|
300 | #endif |
|
|
301 | incr_ev.stop (); |
278 | termwin_ev.stop (display); |
302 | termwin_ev.stop (display); |
279 | vt_ev.stop (display); |
303 | 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 | } |
304 | } |
291 | |
305 | |
292 | check_ev.stop (); |
306 | check_ev.stop (); |
293 | pty_ev.stop (); |
307 | pty_ev.stop (); |
294 | #ifdef CURSOR_BLINK |
308 | #ifdef CURSOR_BLINK |
… | |
… | |
373 | #ifdef TRANSPARENT |
387 | #ifdef TRANSPARENT |
374 | if (Options & Opt_transparent) |
388 | if (Options & Opt_transparent) |
375 | { |
389 | { |
376 | XSelectInput (display->display, display->root, PropertyChangeMask); |
390 | XSelectInput (display->display, display->root, PropertyChangeMask); |
377 | check_our_parents (); |
391 | check_our_parents (); |
378 | } |
|
|
379 | #endif |
|
|
380 | |
|
|
381 | rootwin_ev.start (display, display->root); |
392 | rootwin_ev.start (display, display->root); |
|
|
393 | } |
|
|
394 | #endif |
382 | |
395 | |
383 | XMapWindow (display->display, TermWin.vt); |
396 | XMapWindow (display->display, TermWin.vt); |
384 | XMapWindow (display->display, TermWin.parent[0]); |
397 | XMapWindow (display->display, TermWin.parent[0]); |
385 | |
398 | |
386 | init_command (cmd_argv); |
399 | init_command (cmd_argv); |
… | |
… | |
883 | resize_all_windows (0, 0, 0); |
896 | resize_all_windows (0, 0, 0); |
884 | scr_remap_chars (); |
897 | scr_remap_chars (); |
885 | scr_touch (true); |
898 | scr_touch (true); |
886 | } |
899 | } |
887 | |
900 | |
|
|
901 | for (unicode_t ch = 0x20; ch <= 0x7f; ch++) |
|
|
902 | TermWin.ascii_map [ch - 0x20] = fs->find_font (ch); |
|
|
903 | |
888 | return true; |
904 | return true; |
889 | } |
905 | } |
890 | } |
906 | } |
891 | |
907 | |
892 | return false; |
908 | return false; |
… | |
… | |
955 | i = atoi (color); |
971 | i = atoi (color); |
956 | if (i >= 8 && i <= 15) |
972 | if (i >= 8 && i <= 15) |
957 | { /* bright colors */ |
973 | { /* bright colors */ |
958 | i -= 8; |
974 | i -= 8; |
959 | # ifndef NO_BRIGHTCOLOR |
975 | # ifndef NO_BRIGHTCOLOR |
960 | PixColors[idx] = PixColors[minBrightCOLOR + i]; |
976 | PixColorsFocused[idx] = PixColorsFocused[minBrightCOLOR + i]; |
961 | SET_PIXCOLOR (idx); |
977 | SET_PIXCOLOR (idx); |
962 | goto Done; |
978 | goto Done; |
963 | # endif |
979 | # endif |
964 | |
980 | |
965 | } |
981 | } |
966 | if (i >= 0 && i <= 7) |
982 | if (i >= 0 && i <= 7) |
967 | { /* normal colors */ |
983 | { /* normal colors */ |
968 | PixColors[idx] = PixColors[minCOLOR + i]; |
984 | PixColorsFocused[idx] = PixColorsFocused[minCOLOR + i]; |
969 | SET_PIXCOLOR (idx); |
985 | SET_PIXCOLOR (idx); |
970 | goto Done; |
986 | goto Done; |
971 | } |
987 | } |
972 | } |
988 | } |
973 | |
989 | |
974 | if (!rXParseAllocColor (& xcol, color)) |
990 | if (!rXParseAllocColor (& xcol, color)) |
975 | return; |
991 | return; |
976 | |
992 | |
977 | /* XStoreColor (display->display, XCMAP, XColor*); */ |
993 | /* XStoreColor (display->display, display->cmap, XColor*); */ |
978 | |
994 | |
979 | /* |
995 | /* |
980 | * 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, |
981 | * so just keep gobbling up the colormap |
997 | * so just keep gobbling up the colormap |
982 | */ |
998 | */ |
… | |
… | |
985 | if (PixColors[idx] == PixColors[i]) |
1001 | if (PixColors[idx] == PixColors[i]) |
986 | break; |
1002 | break; |
987 | if (i > Color_White) |
1003 | if (i > Color_White) |
988 | { |
1004 | { |
989 | /* fprintf (stderr, "XFreeColors: PixColors [%d] = %lu\n", idx, PixColors [idx]); */ |
1005 | /* fprintf (stderr, "XFreeColors: PixColors [%d] = %lu\n", idx, PixColors [idx]); */ |
990 | XFreeColors (display->display, XCMAP, (PixColors + idx), 1, |
1006 | XFreeColors (display->display, display->cmap, (PixColors + idx), 1, |
991 | DisplayPlanes (display->display, display->screen)); |
1007 | DisplayPlanes (display->display, display->screen)); |
992 | } |
1008 | } |
993 | # endif |
1009 | # endif |
994 | |
1010 | |
995 | PixColors[idx] = xcol; |
1011 | PixColorsFocused[idx] = xcol; |
996 | SET_PIXCOLOR (idx); |
1012 | SET_PIXCOLOR (idx); |
997 | |
1013 | |
998 | /* XSetWindowAttributes attr; */ |
1014 | /* XSetWindowAttributes attr; */ |
999 | /* Cursor cursor; */ |
1015 | /* Cursor cursor; */ |
1000 | Done: |
1016 | Done: |
|
|
1017 | #ifdef OFF_FOCUS_FADING |
|
|
1018 | PixColorsUnFocused[idx] = PixColorsFocused[idx].fade (display, atoi (rs[Rs_fade])); |
|
|
1019 | #endif |
1001 | if (idx == Color_bg && ! (Options & Opt_transparent)) |
1020 | if (idx == Color_bg && ! (Options & Opt_transparent)) |
1002 | XSetWindowBackground (display->display, TermWin.vt, |
1021 | XSetWindowBackground (display->display, TermWin.vt, PixColors[Color_bg]); |
1003 | PixColors[Color_bg]); |
|
|
1004 | |
1022 | |
1005 | /* handle Color_BD, scrollbar background, etc. */ |
1023 | /* handle Color_BD, scrollbar background, etc. */ |
1006 | |
1024 | |
1007 | set_colorfgbg (); |
1025 | set_colorfgbg (); |
1008 | recolour_cursor (); |
1026 | recolour_cursor (); |
… | |
… | |
1016 | void |
1034 | void |
1017 | rxvt_term::recolour_cursor () |
1035 | rxvt_term::recolour_cursor () |
1018 | { |
1036 | { |
1019 | XColor xcol[2]; |
1037 | XColor xcol[2]; |
1020 | |
1038 | |
1021 | xcol[0].pixel = ISSET_PIXCOLOR (Color_pointer_fg) ? PixColors[Color_pointer_fg] : PixColors[Color_fg]; |
1039 | 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]; |
1040 | xcol[1].pixel = ISSET_PIXCOLOR (Color_pointer_bg) ? PixColorsFocused[Color_pointer_bg] : PixColorsFocused[Color_bg]; |
1023 | XQueryColors (display->display, XCMAP, xcol, 2); |
1041 | XQueryColors (display->display, display->cmap, xcol, 2); |
1024 | XRecolorCursor (display->display, TermWin_cursor, xcol + 0, xcol + 1); |
1042 | XRecolorCursor (display->display, TermWin_cursor, xcol + 0, xcol + 1); |
1025 | } |
1043 | } |
1026 | |
1044 | |
1027 | /*----------------------------------------------------------------------*/ |
1045 | /*----------------------------------------------------------------------*/ |
1028 | /* |
1046 | /* |
… | |
… | |
1222 | if (width == 0) |
1240 | if (width == 0) |
1223 | width = wattr.width - szHint.base_width; |
1241 | width = wattr.width - szHint.base_width; |
1224 | if (height == 0) |
1242 | if (height == 0) |
1225 | height = wattr.height - szHint.base_height; |
1243 | height = wattr.height - szHint.base_height; |
1226 | } |
1244 | } |
|
|
1245 | |
1227 | if (width != TermWin.width || height != TermWin.height) |
1246 | if (width != TermWin.width || height != TermWin.height) |
1228 | { |
1247 | { |
1229 | width += szHint.base_width; |
1248 | width += szHint.base_width; |
1230 | height += szHint.base_height; |
1249 | height += szHint.base_height; |
1231 | resize_all_windows (width, height, 0); |
1250 | resize_all_windows (width, height, 0); |