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.77 by root, Tue Aug 10 20:39:19 2004 UTC

155 cursor_blink_ev (this, &rxvt_term::cursor_blink_cb), 155 cursor_blink_ev (this, &rxvt_term::cursor_blink_cb),
156#endif 156#endif
157#ifdef TEXT_BLINK 157#ifdef TEXT_BLINK
158 text_blink_ev (this, &rxvt_term::text_blink_cb), 158 text_blink_ev (this, &rxvt_term::text_blink_cb),
159#endif 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
160#ifdef POINTER_BLANK 169#ifdef POINTER_BLANK
161 pointer_ev (this, &rxvt_term::pointer_cb), 170 pointer_ev (this, &rxvt_term::pointer_cb),
162#endif 171#endif
163#ifdef USE_XIM 172#ifdef USE_XIM
164 im_ev (this, &rxvt_term::im_cb), 173 im_ev (this, &rxvt_term::im_cb),
165#endif 174#endif
166 check_ev (this, &rxvt_term::check_cb), 175 check_ev (this, &rxvt_term::check_cb),
176 flush_ev (this, &rxvt_term::flush_cb),
167 destroy_ev (this, &rxvt_term::destroy_cb), 177 destroy_ev (this, &rxvt_term::destroy_cb),
168 pty_ev (this, &rxvt_term::pty_cb), 178 pty_ev (this, &rxvt_term::pty_cb),
169 incr_ev (this, &rxvt_term::incr_cb) 179 incr_ev (this, &rxvt_term::incr_cb)
170{ 180{
171 cmdbuf_ptr = cmdbuf_endp = cmdbuf_base; 181 cmdbuf_ptr = cmdbuf_endp = cmdbuf_base;
191 201
192 if (display) 202 if (display)
193 { 203 {
194 selection_clear (); 204 selection_clear ();
195 205
206#ifdef USE_XIM
207 im_destroy ();
208#endif
196#ifdef MENUBAR 209#ifdef MENUBAR
197 if (menubarGC) XFreeGC (display->display, menubarGC); 210 if (menubarGC) XFreeGC (display->display, menubarGC);
198#endif 211#endif
199#ifdef XTERM_SCROLLBAR 212#ifdef XTERM_SCROLLBAR
200 if (xscrollbarGC) XFreeGC (display->display, xscrollbarGC); 213 if (xscrollbarGC) XFreeGC (display->display, xscrollbarGC);
233 XDestroyWindow (display->display, TermWin.parent[0]); 246 XDestroyWindow (display->display, TermWin.parent[0]);
234 } 247 }
235 248
236 // TODO: free pixcolours, colours should become part of rxvt_display 249 // TODO: free pixcolours, colours should become part of rxvt_display
237 250
238 delete PixColors; 251 delete PixColorsFocused;
252#ifdef OFF_FOCUS_FADING
253 delete PixColorsUnFocused;
254#endif
239 255
240 displays.put (display); 256 displays.put (display);
241 257
242 scr_release (); 258 scr_release ();
243 259
261} 277}
262 278
263void 279void
264rxvt_term::destroy () 280rxvt_term::destroy ()
265{ 281{
282 if (destroy_ev.active)
283 return;
284
266 if (display) 285 if (display)
267 { 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
268 rootwin_ev.stop (display); 296 rootwin_ev.stop (display);
269 termwin_ev.stop (display); 297 termwin_ev.stop (display);
270 vt_ev.stop (display); 298 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 } 299 }
282 300
283 check_ev.stop (); 301 check_ev.stop ();
284 pty_ev.stop (); 302 pty_ev.stop ();
285#ifdef CURSOR_BLINK 303#ifdef CURSOR_BLINK
286 cursor_blink_ev.stop (); 304 cursor_blink_ev.stop ();
287#endif 305#endif
288#ifdef TEXT_BLINK 306#ifdef TEXT_BLINK
289 text_blink_ev.stop (); 307 text_blink_ev.stop ();
308#endif
309#ifndef NO_SCROLLBAR_BUTTON_CONTINUAL_SCROLLING
310 cont_scroll_ev.stop ();
311#endif
312#ifdef SELECTION_SCROLLING
313 sel_scroll_ev.stop ();
290#endif 314#endif
291#ifdef POINTER_BLANK 315#ifdef POINTER_BLANK
292 pointer_ev.stop (); 316 pointer_ev.stop ();
293#endif 317#endif
294 318
740 max_height = MAX_ROWS * TermWin.fheight; 764 max_height = MAX_ROWS * TermWin.fheight;
741 765
742 szHint.base_width = szHint.base_height = 2 * TermWin.int_bwidth; 766 szHint.base_width = szHint.base_height = 2 * TermWin.int_bwidth;
743 767
744 sb_w = mb_h = 0; 768 sb_w = mb_h = 0;
745 window_vt_x = window_vt_y = 0; 769 window_vt_x = window_vt_y = TermWin.int_bwidth;
746 770
747 if (scrollbar_visible ()) 771 if (scrollbar_visible ())
748 { 772 {
749 sb_w = scrollbar_TotalWidth (); 773 sb_w = scrollbar_TotalWidth ();
750 szHint.base_width += sb_w; 774 szHint.base_width += sb_w;
751 if (! (Options & Opt_scrollBar_right)) 775 if (!(Options & Opt_scrollBar_right))
752 window_vt_x = sb_w; 776 window_vt_x += sb_w;
753 } 777 }
754 778
755 if (menubar_visible ()) 779 if (menubar_visible ())
756 { 780 {
757 mb_h = menuBar_TotalHeight (); 781 mb_h = menuBar_TotalHeight ();
758 szHint.base_height += mb_h; 782 szHint.base_height += mb_h;
759 window_vt_y = mb_h; 783 window_vt_y += mb_h;
760 } 784 }
761 785
762 szHint.width_inc = TermWin.fwidth; 786 szHint.width_inc = TermWin.fwidth;
763 szHint.height_inc = TermWin.fheight; 787 szHint.height_inc = TermWin.fheight;
764 szHint.min_width = szHint.base_width + szHint.width_inc; 788 szHint.min_width = szHint.base_width + szHint.width_inc;
868 resize_all_windows (0, 0, 0); 892 resize_all_windows (0, 0, 0);
869 scr_remap_chars (); 893 scr_remap_chars ();
870 scr_touch (true); 894 scr_touch (true);
871 } 895 }
872 896
897 for (unicode_t ch = 0x20; ch <= 0x7f; ch++)
898 TermWin.ascii_map [ch - 0x20] = fs->find_font (ch);
899
873 return true; 900 return true;
874 } 901 }
875 } 902 }
876 903
877 return false; 904 return false;
940 i = atoi (color); 967 i = atoi (color);
941 if (i >= 8 && i <= 15) 968 if (i >= 8 && i <= 15)
942 { /* bright colors */ 969 { /* bright colors */
943 i -= 8; 970 i -= 8;
944# ifndef NO_BRIGHTCOLOR 971# ifndef NO_BRIGHTCOLOR
945 PixColors[idx] = PixColors[minBrightCOLOR + i]; 972 PixColorsFocused[idx] = PixColorsFocused[minBrightCOLOR + i];
946 SET_PIXCOLOR (idx); 973 SET_PIXCOLOR (idx);
947 goto Done; 974 goto Done;
948# endif 975# endif
949 976
950 } 977 }
951 if (i >= 0 && i <= 7) 978 if (i >= 0 && i <= 7)
952 { /* normal colors */ 979 { /* normal colors */
953 PixColors[idx] = PixColors[minCOLOR + i]; 980 PixColorsFocused[idx] = PixColorsFocused[minCOLOR + i];
954 SET_PIXCOLOR (idx); 981 SET_PIXCOLOR (idx);
955 goto Done; 982 goto Done;
956 } 983 }
957 } 984 }
958 985
959 if (!rXParseAllocColor (& xcol, color)) 986 if (!rXParseAllocColor (& xcol, color))
960 return; 987 return;
961 988
962 /* XStoreColor (display->display, XCMAP, XColor*); */ 989 /* XStoreColor (display->display, display->cmap, XColor*); */
963 990
964 /* 991 /*
965 * 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,
966 * so just keep gobbling up the colormap 993 * so just keep gobbling up the colormap
967 */ 994 */
970 if (PixColors[idx] == PixColors[i]) 997 if (PixColors[idx] == PixColors[i])
971 break; 998 break;
972 if (i > Color_White) 999 if (i > Color_White)
973 { 1000 {
974 /* fprintf (stderr, "XFreeColors: PixColors [%d] = %lu\n", idx, PixColors [idx]); */ 1001 /* fprintf (stderr, "XFreeColors: PixColors [%d] = %lu\n", idx, PixColors [idx]); */
975 XFreeColors (display->display, XCMAP, (PixColors + idx), 1, 1002 XFreeColors (display->display, display->cmap, (PixColors + idx), 1,
976 DisplayPlanes (display->display, display->screen)); 1003 DisplayPlanes (display->display, display->screen));
977 } 1004 }
978# endif 1005# endif
979 1006
980 PixColors[idx] = xcol; 1007 PixColorsFocused[idx] = xcol;
981 SET_PIXCOLOR (idx); 1008 SET_PIXCOLOR (idx);
982 1009
983 /* XSetWindowAttributes attr; */ 1010 /* XSetWindowAttributes attr; */
984 /* Cursor cursor; */ 1011 /* Cursor cursor; */
985Done: 1012Done:
1013#ifdef OFF_FOCUS_FADING
1014 PixColorsUnFocused[idx] = PixColorsFocused[idx].fade (display, atoi (rs[Rs_fade]));
1015#endif
986 if (idx == Color_bg && ! (Options & Opt_transparent)) 1016 if (idx == Color_bg && ! (Options & Opt_transparent))
987 XSetWindowBackground (display->display, TermWin.vt, 1017 XSetWindowBackground (display->display, TermWin.vt, PixColors[Color_bg]);
988 PixColors[Color_bg]);
989 1018
990 /* handle Color_BD, scrollbar background, etc. */ 1019 /* handle Color_BD, scrollbar background, etc. */
991 1020
992 set_colorfgbg (); 1021 set_colorfgbg ();
993 recolour_cursor (); 1022 recolour_cursor ();
1001void 1030void
1002rxvt_term::recolour_cursor () 1031rxvt_term::recolour_cursor ()
1003{ 1032{
1004 XColor xcol[2]; 1033 XColor xcol[2];
1005 1034
1006 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];
1007 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];
1008 XQueryColors (display->display, XCMAP, xcol, 2); 1037 XQueryColors (display->display, display->cmap, xcol, 2);
1009 XRecolorCursor (display->display, TermWin_cursor, xcol + 0, xcol + 1); 1038 XRecolorCursor (display->display, TermWin_cursor, xcol + 0, xcol + 1);
1010} 1039}
1011 1040
1012/*----------------------------------------------------------------------*/ 1041/*----------------------------------------------------------------------*/
1013/* 1042/*

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines