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.257 by root, Sun Nov 11 17:10:45 2007 UTC vs.
Revision 1.269 by root, Tue Dec 4 14:50:42 2007 UTC

153} 153}
154#endif 154#endif
155 155
156rxvt_term::rxvt_term () 156rxvt_term::rxvt_term ()
157 : 157 :
158#if ENABLE_TRANSPARENCY || ENABLE_PERL
159 rootwin_ev (this, &rxvt_term::rootwin_cb),
160#endif
161#if HAVE_BG_PIXMAP 158#if HAVE_BG_PIXMAP
162 update_background_ev(this, &rxvt_term::update_background_cb), 159 update_background_ev(this, &rxvt_term::update_background_cb),
163#endif 160#endif
164#ifdef HAVE_SCROLLBARS
165 scrollbar_ev (this, &rxvt_term::x_cb),
166#endif
167#ifdef CURSOR_BLINK 161#ifdef CURSOR_BLINK
168 cursor_blink_ev (this, &rxvt_term::cursor_blink_cb), 162 cursor_blink_ev (this, &rxvt_term::cursor_blink_cb),
169#endif 163#endif
170#ifdef TEXT_BLINK 164#ifdef TEXT_BLINK
171 text_blink_ev (this, &rxvt_term::text_blink_cb), 165 text_blink_ev (this, &rxvt_term::text_blink_cb),
180 slip_wheel_ev (this, &rxvt_term::slip_wheel_cb), 174 slip_wheel_ev (this, &rxvt_term::slip_wheel_cb),
181#endif 175#endif
182#ifdef POINTER_BLANK 176#ifdef POINTER_BLANK
183 pointer_ev (this, &rxvt_term::pointer_cb), 177 pointer_ev (this, &rxvt_term::pointer_cb),
184#endif 178#endif
179#ifndef NO_BELL
180 bell_ev (this, &rxvt_term::bell_cb),
181#endif
182 child_ev (this, &rxvt_term::child_cb),
183 prepare_ev (this, &rxvt_term::prepare_cb),
184 flush_ev (this, &rxvt_term::flush_cb),
185 destroy_ev (this, &rxvt_term::destroy_cb),
186 pty_ev (this, &rxvt_term::pty_cb),
187 incr_ev (this, &rxvt_term::incr_cb)
188{
189#if ENABLE_TRANSPARENCY || ENABLE_PERL
190 callback_set (rootwin_ev , this, rxvt_term, rootwin_cb);
191#endif
192#ifdef HAVE_SCROLLBARS
193 callback_set (scrollbar_ev, this, rxvt_term, x_cb);
194#endif
185#ifdef USE_XIM 195#ifdef USE_XIM
186 im_ev (this, &rxvt_term::im_cb), 196 callback_set (im_ev , this, rxvt_term, im_cb);
187#endif 197#endif
188#ifndef NO_BELL 198 callback_set (termwin_ev , this, rxvt_term, x_cb);
189 bell_ev (this, &rxvt_term::bell_cb), 199 callback_set (vt_ev , this, rxvt_term, x_cb);
190#endif 200
191 termwin_ev (this, &rxvt_term::x_cb),
192 vt_ev (this, &rxvt_term::x_cb),
193 child_ev (this, &rxvt_term::child_cb),
194 prepare_ev (this, &rxvt_term::prepare_cb),
195 flush_ev (this, &rxvt_term::flush_cb),
196 destroy_ev (this, &rxvt_term::destroy_cb),
197 pty_ev (this, &rxvt_term::pty_cb),
198 incr_ev (this, &rxvt_term::incr_cb)
199{
200 cmdbuf_ptr = cmdbuf_endp = cmdbuf_base; 201 cmdbuf_ptr = cmdbuf_endp = cmdbuf_base;
201 202
202 termlist.push_back (this); 203 termlist.push_back (this);
203 204
204#ifdef KEYSYM_RESOURCE 205#ifdef KEYSYM_RESOURCE
284 delete [] pix_colors_focused; 285 delete [] pix_colors_focused;
285#if OFF_FOCUS_FADING 286#if OFF_FOCUS_FADING
286 delete [] pix_colors_unfocused; 287 delete [] pix_colors_unfocused;
287#endif 288#endif
288 289
290#ifdef HAVE_BG_PIXMAP
291 bgPixmap.destroy ();
292#endif
289 displays.put (display); 293 displays.put (display);
290 294
291 scr_release (); 295 scr_release ();
292 296
293 /* clear all resources */ 297 /* clear all resources */
306 delete argv; 310 delete argv;
307 311
308#ifdef KEYSYM_RESOURCE 312#ifdef KEYSYM_RESOURCE
309 delete keyboard; 313 delete keyboard;
310#endif 314#endif
315#ifndef NO_RESOURCES
316 XrmDestroyDatabase (option_db);
317#endif
311} 318}
312 319
313// child has exited, usually destroys 320// child has exited, usually destroys
314void 321void
315rxvt_term::child_cb (ev::child &w, int status) 322rxvt_term::child_cb (ev::child &w, int status)
370 377
371 destroy_ev.start (); 378 destroy_ev.start ();
372} 379}
373 380
374void 381void
375rxvt_term::destroy_cb (ev::check &w, int revents) 382rxvt_term::destroy_cb (ev::idle &w, int revents)
376{ 383{
377 make_current (); 384 make_current ();
378 385
379 delete this; 386 delete this;
380} 387}
616void 623void
617rxvt_init () 624rxvt_init ()
618{ 625{
619 ptytty::init (); 626 ptytty::init ();
620 627
621 if (!ev::ev_default_loop (0)) 628 if (!ev_default_loop (0))
622 rxvt_fatal ("cannot initialise libev (bad value for LIBEV_METHODS?)\n"); 629 rxvt_fatal ("cannot initialise libev (bad value for LIBEV_METHODS?)\n");
623 630
624 rxvt_environ = environ; 631 rxvt_environ = environ;
625 632
626 signal (SIGHUP, SIG_IGN); 633 signal (SIGHUP, SIG_IGN);
627 signal (SIGPIPE, SIG_IGN); 634 signal (SIGPIPE, SIG_IGN);
628 635
629 sig_handlers.sw_term.start (SIGTERM); ev::ev_unref (); 636 sig_handlers.sw_term.start (SIGTERM); ev_unref ();
630 sig_handlers.sw_int.start (SIGINT); ev::ev_unref (); 637 sig_handlers.sw_int.start (SIGINT); ev_unref ();
631 638
632 /* need to trap SIGURG for SVR4 (Unixware) rlogin */ 639 /* need to trap SIGURG for SVR4 (Unixware) rlogin */
633 /* signal (SIGURG, SIG_DFL); */ 640 /* signal (SIGURG, SIG_DFL); */
634 641
635 old_xerror_handler = XSetErrorHandler ((XErrorHandler) rxvt_xerror_handler); 642 old_xerror_handler = XSetErrorHandler ((XErrorHandler) rxvt_xerror_handler);
973 if (isdigit (*color)) 980 if (isdigit (*color))
974 { 981 {
975 i = atoi (color); 982 i = atoi (color);
976 983
977 if (i >= 8 && i <= 15) 984 if (i >= 8 && i <= 15)
985 {
978 { /* bright colors */ 986 /* bright colors */
979 i -= 8;
980 pix_colors_focused[idx] = pix_colors_focused[minBrightCOLOR + i]; 987 pix_colors_focused[idx] = pix_colors_focused[minBrightCOLOR + i - 8];
981 goto done; 988 goto done;
982 } 989 }
983 990
984 if (i >= 0 && i <= 7) 991 if (i >= 0 && i <= 7)
992 {
985 { /* normal colors */ 993 /* normal colors */
986 pix_colors_focused[idx] = pix_colors_focused[minCOLOR + i]; 994 pix_colors_focused[idx] = pix_colors_focused[minCOLOR + i];
987 goto done; 995 goto done;
988 } 996 }
989 } 997 }
990 998
995 * so just keep gobbling up the colormap 1003 * so just keep gobbling up the colormap
996 */ 1004 */
997 1005
998 pix_colors_focused[idx] = xcol; 1006 pix_colors_focused[idx] = xcol;
999 1007
1000 /* XSetWindowAttributes attr; */
1001 /* Cursor cursor; */
1002done: 1008done:
1003 /*TODO: handle Color_BD, scrollbar background, etc. */ 1009 /*TODO: handle Color_BD, scrollbar background, etc. */
1004 1010
1005 update_fade_color (idx); 1011 update_fade_color (idx);
1006 recolour_cursor (); 1012 recolour_cursor ();
1007 scr_recolour (); 1013 scr_recolour ();
1008#endif /* XTERM_COLOR_CHANGE */ 1014#endif /* XTERM_COLOR_CHANGE */
1009} 1015}
1010 1016
1011void 1017void
1012rxvt_term::recolour_cursor () 1018rxvt_term::recolour_cursor ()
1013{ 1019{
1030 */ 1036 */
1031void 1037void
1032rxvt_term::set_colorfgbg () 1038rxvt_term::set_colorfgbg ()
1033{ 1039{
1034 unsigned int i; 1040 unsigned int i;
1035 const char *xpmb = "\0"; 1041 const char *xpmb = "";
1036 char fstr[sizeof ("default") + 1], bstr[sizeof ("default") + 1]; 1042 char fstr[sizeof ("default") + 1], bstr[sizeof ("default") + 1];
1037 1043
1038 strcpy (fstr, "default"); 1044 strcpy (fstr, "default");
1039 strcpy (bstr, "default"); 1045 strcpy (bstr, "default");
1040 for (i = Color_Black; i <= Color_White; i++) 1046 for (i = Color_Black; i <= Color_White; i++)
1706 XFree (status_attr); 1712 XFree (status_attr);
1707 } 1713 }
1708 1714
1709 XFree (preedit_attr); 1715 XFree (preedit_attr);
1710} 1716}
1711#endif /* USE_XIM */ 1717#endif /* USE_XIM */
1712 1718
1713void 1719void
1714rxvt_term::get_window_origin (int &x, int &y) 1720rxvt_term::get_window_origin (int &x, int &y)
1715{ 1721{
1716 Window cr; 1722 Window cr;
1738 } 1744 }
1739 return None; 1745 return None;
1740} 1746}
1741 1747
1742#ifdef HAVE_BG_PIXMAP 1748#ifdef HAVE_BG_PIXMAP
1749# if TRACE_PIXMAPS
1750# undef update_background
1751int rxvt_term::trace_update_background (const char *file, int line)
1752{
1753 fprintf (stderr, "%s:%d:update_background()\n", file, line);
1754 update_background ();
1755}
1756# endif
1757
1743int 1758int
1744rxvt_term::update_background () 1759rxvt_term::update_background ()
1745{ 1760{
1746 bgPixmap.invalidate (); 1761 bgPixmap.invalidate ();
1747 1762

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines