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.67 by pcg, Sun May 9 18:19:49 2004 UTC vs.
Revision 1.80 by root, Fri Aug 13 19:31:23 2004 UTC

140 free (p); 140 free (p);
141} 141}
142 142
143rxvt_term::rxvt_term () 143rxvt_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#ifdef POINTER_BLANK
161 pointer_ev (this, &rxvt_term::pointer_cb),
162#endif
163#ifdef USE_XIM
164 im_ev (this, &rxvt_term::im_cb),
165#endif
166 check_ev (this, &rxvt_term::check_cb), 177 check_ev (this, &rxvt_term::check_cb),
178 flush_ev (this, &rxvt_term::flush_cb),
167 destroy_ev (this, &rxvt_term::destroy_cb), 179 destroy_ev (this, &rxvt_term::destroy_cb),
168 pty_ev (this, &rxvt_term::pty_cb), 180 pty_ev (this, &rxvt_term::pty_cb),
169 incr_ev (this, &rxvt_term::incr_cb) 181 incr_ev (this, &rxvt_term::incr_cb)
170{ 182{
171 cmdbuf_ptr = cmdbuf_endp = cmdbuf_base; 183 cmdbuf_ptr = cmdbuf_endp = cmdbuf_base;
191 203
192 if (display) 204 if (display)
193 { 205 {
194 selection_clear (); 206 selection_clear ();
195 207
208#ifdef USE_XIM
209 im_destroy ();
210#endif
196#ifdef MENUBAR 211#ifdef MENUBAR
197 if (menubarGC) XFreeGC (display->display, menubarGC); 212 if (menubarGC) XFreeGC (display->display, menubarGC);
198#endif 213#endif
199#ifdef XTERM_SCROLLBAR 214#ifdef XTERM_SCROLLBAR
200 if (xscrollbarGC) XFreeGC (display->display, xscrollbarGC); 215 if (xscrollbarGC) XFreeGC (display->display, xscrollbarGC);
233 XDestroyWindow (display->display, TermWin.parent[0]); 248 XDestroyWindow (display->display, TermWin.parent[0]);
234 } 249 }
235 250
236 // TODO: free pixcolours, colours should become part of rxvt_display 251 // TODO: free pixcolours, colours should become part of rxvt_display
237 252
238 delete PixColors; 253 delete PixColorsFocused;
254#ifdef OFF_FOCUS_FADING
255 delete PixColorsUnFocused;
256#endif
239 257
240 displays.put (display); 258 displays.put (display);
241 259
242 scr_release (); 260 scr_release ();
243 261
261} 279}
262 280
263void 281void
264rxvt_term::destroy () 282rxvt_term::destroy ()
265{ 283{
284 if (destroy_ev.active)
285 return;
286
266 if (display) 287 if (display)
267 { 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
268 rootwin_ev.stop (display); 299 rootwin_ev.stop (display);
300#endif
301 incr_ev.stop ();
269 termwin_ev.stop (display); 302 termwin_ev.stop (display);
270 vt_ev.stop (display); 303 vt_ev.stop (display);
271#ifdef USE_XIM
272 im_destroy ();
273 im_ev.stop (display);
274#endif
275#ifdef HAVE_SCROLLBARS
276 scrollbar_ev.stop (display);
277#endif
278#ifdef MENUBAR
279 menubar_ev.stop (display);
280#endif
281 } 304 }
282 305
283 check_ev.stop (); 306 check_ev.stop ();
284 pty_ev.stop (); 307 pty_ev.stop ();
285#ifdef CURSOR_BLINK 308#ifdef CURSOR_BLINK
286 cursor_blink_ev.stop (); 309 cursor_blink_ev.stop ();
287#endif 310#endif
288#ifdef TEXT_BLINK 311#ifdef TEXT_BLINK
289 text_blink_ev.stop (); 312 text_blink_ev.stop ();
313#endif
314#ifndef NO_SCROLLBAR_BUTTON_CONTINUAL_SCROLLING
315 cont_scroll_ev.stop ();
316#endif
317#ifdef SELECTION_SCROLLING
318 sel_scroll_ev.stop ();
290#endif 319#endif
291#ifdef POINTER_BLANK 320#ifdef POINTER_BLANK
292 pointer_ev.stop (); 321 pointer_ev.stop ();
293#endif 322#endif
294 323
358#ifdef TRANSPARENT 387#ifdef TRANSPARENT
359 if (Options & Opt_transparent) 388 if (Options & Opt_transparent)
360 { 389 {
361 XSelectInput (display->display, display->root, PropertyChangeMask); 390 XSelectInput (display->display, display->root, PropertyChangeMask);
362 check_our_parents (); 391 check_our_parents ();
363 }
364#endif
365
366 rootwin_ev.start (display, display->root); 392 rootwin_ev.start (display, display->root);
393 }
394#endif
367 395
368 XMapWindow (display->display, TermWin.vt); 396 XMapWindow (display->display, TermWin.vt);
369 XMapWindow (display->display, TermWin.parent[0]); 397 XMapWindow (display->display, TermWin.parent[0]);
370 398
371 init_command (cmd_argv); 399 init_command (cmd_argv);
740 max_height = MAX_ROWS * TermWin.fheight; 768 max_height = MAX_ROWS * TermWin.fheight;
741 769
742 szHint.base_width = szHint.base_height = 2 * TermWin.int_bwidth; 770 szHint.base_width = szHint.base_height = 2 * TermWin.int_bwidth;
743 771
744 sb_w = mb_h = 0; 772 sb_w = mb_h = 0;
745 window_vt_x = window_vt_y = 0; 773 window_vt_x = window_vt_y = TermWin.int_bwidth;
746 774
747 if (scrollbar_visible ()) 775 if (scrollbar_visible ())
748 { 776 {
749 sb_w = scrollbar_TotalWidth (); 777 sb_w = scrollbar_TotalWidth ();
750 szHint.base_width += sb_w; 778 szHint.base_width += sb_w;
751 if (! (Options & Opt_scrollBar_right)) 779 if (!(Options & Opt_scrollBar_right))
752 window_vt_x = sb_w; 780 window_vt_x += sb_w;
753 } 781 }
754 782
755 if (menubar_visible ()) 783 if (menubar_visible ())
756 { 784 {
757 mb_h = menuBar_TotalHeight (); 785 mb_h = menuBar_TotalHeight ();
758 szHint.base_height += mb_h; 786 szHint.base_height += mb_h;
759 window_vt_y = mb_h; 787 window_vt_y += mb_h;
760 } 788 }
761 789
762 szHint.width_inc = TermWin.fwidth; 790 szHint.width_inc = TermWin.fwidth;
763 szHint.height_inc = TermWin.fheight; 791 szHint.height_inc = TermWin.fheight;
764 szHint.min_width = szHint.base_width + szHint.width_inc; 792 szHint.min_width = szHint.base_width + szHint.width_inc;
868 resize_all_windows (0, 0, 0); 896 resize_all_windows (0, 0, 0);
869 scr_remap_chars (); 897 scr_remap_chars ();
870 scr_touch (true); 898 scr_touch (true);
871 } 899 }
872 900
901 for (unicode_t ch = 0x20; ch <= 0x7f; ch++)
902 TermWin.ascii_map [ch - 0x20] = fs->find_font (ch);
903
873 return true; 904 return true;
874 } 905 }
875 } 906 }
876 907
877 return false; 908 return false;
940 i = atoi (color); 971 i = atoi (color);
941 if (i >= 8 && i <= 15) 972 if (i >= 8 && i <= 15)
942 { /* bright colors */ 973 { /* bright colors */
943 i -= 8; 974 i -= 8;
944# ifndef NO_BRIGHTCOLOR 975# ifndef NO_BRIGHTCOLOR
945 PixColors[idx] = PixColors[minBrightCOLOR + i]; 976 PixColorsFocused[idx] = PixColorsFocused[minBrightCOLOR + i];
946 SET_PIXCOLOR (idx); 977 SET_PIXCOLOR (idx);
947 goto Done; 978 goto Done;
948# endif 979# endif
949 980
950 } 981 }
951 if (i >= 0 && i <= 7) 982 if (i >= 0 && i <= 7)
952 { /* normal colors */ 983 { /* normal colors */
953 PixColors[idx] = PixColors[minCOLOR + i]; 984 PixColorsFocused[idx] = PixColorsFocused[minCOLOR + i];
954 SET_PIXCOLOR (idx); 985 SET_PIXCOLOR (idx);
955 goto Done; 986 goto Done;
956 } 987 }
957 } 988 }
958 989
959 if (!rXParseAllocColor (& xcol, color)) 990 if (!rXParseAllocColor (& xcol, color))
960 return; 991 return;
961 992
962 /* XStoreColor (display->display, XCMAP, XColor*); */ 993 /* XStoreColor (display->display, display->cmap, XColor*); */
963 994
964 /* 995 /*
965 * 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,
966 * so just keep gobbling up the colormap 997 * so just keep gobbling up the colormap
967 */ 998 */
970 if (PixColors[idx] == PixColors[i]) 1001 if (PixColors[idx] == PixColors[i])
971 break; 1002 break;
972 if (i > Color_White) 1003 if (i > Color_White)
973 { 1004 {
974 /* fprintf (stderr, "XFreeColors: PixColors [%d] = %lu\n", idx, PixColors [idx]); */ 1005 /* fprintf (stderr, "XFreeColors: PixColors [%d] = %lu\n", idx, PixColors [idx]); */
975 XFreeColors (display->display, XCMAP, (PixColors + idx), 1, 1006 XFreeColors (display->display, display->cmap, (PixColors + idx), 1,
976 DisplayPlanes (display->display, display->screen)); 1007 DisplayPlanes (display->display, display->screen));
977 } 1008 }
978# endif 1009# endif
979 1010
980 PixColors[idx] = xcol; 1011 PixColorsFocused[idx] = xcol;
981 SET_PIXCOLOR (idx); 1012 SET_PIXCOLOR (idx);
982 1013
983 /* XSetWindowAttributes attr; */ 1014 /* XSetWindowAttributes attr; */
984 /* Cursor cursor; */ 1015 /* Cursor cursor; */
985Done: 1016Done:
1017#ifdef OFF_FOCUS_FADING
1018 PixColorsUnFocused[idx] = PixColorsFocused[idx].fade (display, atoi (rs[Rs_fade]));
1019#endif
986 if (idx == Color_bg && ! (Options & Opt_transparent)) 1020 if (idx == Color_bg && ! (Options & Opt_transparent))
987 XSetWindowBackground (display->display, TermWin.vt, 1021 XSetWindowBackground (display->display, TermWin.vt, PixColors[Color_bg]);
988 PixColors[Color_bg]);
989 1022
990 /* handle Color_BD, scrollbar background, etc. */ 1023 /* handle Color_BD, scrollbar background, etc. */
991 1024
992 set_colorfgbg (); 1025 set_colorfgbg ();
993 recolour_cursor (); 1026 recolour_cursor ();
1001void 1034void
1002rxvt_term::recolour_cursor () 1035rxvt_term::recolour_cursor ()
1003{ 1036{
1004 XColor xcol[2]; 1037 XColor xcol[2];
1005 1038
1006 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];
1007 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];
1008 XQueryColors (display->display, XCMAP, xcol, 2); 1041 XQueryColors (display->display, display->cmap, xcol, 2);
1009 XRecolorCursor (display->display, TermWin_cursor, xcol + 0, xcol + 1); 1042 XRecolorCursor (display->display, TermWin_cursor, xcol + 0, xcol + 1);
1010} 1043}
1011 1044
1012/*----------------------------------------------------------------------*/ 1045/*----------------------------------------------------------------------*/
1013/* 1046/*
1207 if (width == 0) 1240 if (width == 0)
1208 width = wattr.width - szHint.base_width; 1241 width = wattr.width - szHint.base_width;
1209 if (height == 0) 1242 if (height == 0)
1210 height = wattr.height - szHint.base_height; 1243 height = wattr.height - szHint.base_height;
1211 } 1244 }
1245
1212 if (width != TermWin.width || height != TermWin.height) 1246 if (width != TermWin.width || height != TermWin.height)
1213 { 1247 {
1214 width += szHint.base_width; 1248 width += szHint.base_width;
1215 height += szHint.base_height; 1249 height += szHint.base_height;
1216 resize_all_windows (width, height, 0); 1250 resize_all_windows (width, height, 0);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines