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.287 by ayin, Tue Dec 18 01:26:42 2007 UTC vs.
Revision 1.291 by root, Mon Dec 24 06:51:37 2007 UTC

170#endif 170#endif
171#if defined(MOUSE_WHEEL) && defined(MOUSE_SLIP_WHEELING) 171#if defined(MOUSE_WHEEL) && defined(MOUSE_SLIP_WHEELING)
172 slip_wheel_ev.set <rxvt_term, &rxvt_term::slip_wheel_cb> (this); 172 slip_wheel_ev.set <rxvt_term, &rxvt_term::slip_wheel_cb> (this);
173#endif 173#endif
174#if ENABLE_TRANSPARENCY || ENABLE_PERL 174#if ENABLE_TRANSPARENCY || ENABLE_PERL
175 rootwin_ev.set <rxvt_term, &rxvt_term::x_cb> (this), 175 rootwin_ev.set <rxvt_term, &rxvt_term::rootwin_cb> (this),
176#endif 176#endif
177#ifdef HAVE_SCROLLBARS 177#ifdef HAVE_SCROLLBARS
178 scrollbar_ev.set <rxvt_term, &rxvt_term::x_cb> (this), 178 scrollbar_ev.set <rxvt_term, &rxvt_term::x_cb> (this),
179#endif 179#endif
180#ifdef USE_XIM 180#ifdef USE_XIM
521 521
522#ifdef ENABLE_TRANSPARENCY 522#ifdef ENABLE_TRANSPARENCY
523 if (option (Opt_transparent)) 523 if (option (Opt_transparent))
524 { 524 {
525 bgPixmap.set_transparent (); 525 bgPixmap.set_transparent ();
526
526#ifdef HAVE_AFTERIMAGE 527#ifdef HAVE_AFTERIMAGE
527 if (rs [Rs_blurradius]) 528 if (rs [Rs_blurradius])
528 bgPixmap.set_blur_radius (rs [Rs_blurradius]); 529 bgPixmap.set_blur_radius (rs [Rs_blurradius]);
529#endif 530#endif
530 if (ISSET_PIXCOLOR (Color_tint)) 531 if (ISSET_PIXCOLOR (Color_tint))
531 bgPixmap.set_tint (pix_colors_focused [Color_tint]); 532 bgPixmap.set_tint (pix_colors_focused [Color_tint]);
533
532 if (rs [Rs_shade]) 534 if (rs [Rs_shade])
533 bgPixmap.set_shade (rs [Rs_shade]); 535 bgPixmap.set_shade (rs [Rs_shade]);
534 536
535 bgPixmap.set_root_pixmap (); 537 bgPixmap.set_root_pixmap ();
536 XSelectInput (dpy, display->root, PropertyChangeMask); 538 XSelectInput (dpy, display->root, PropertyChangeMask);
537 rootwin_ev.start (display, display->root); 539 rootwin_ev.start (display, display->root);
538 } 540 }
539#endif 541#endif
540 542
541#ifdef BG_IMAGE_FROM_FILE 543#ifdef BG_IMAGE_FROM_FILE
542 if (rs[Rs_backgroundPixmap] != NULL) 544 if (rs[Rs_backgroundPixmap])
543 { 545 {
544 const char *p = rs[Rs_backgroundPixmap]; 546 const char *p = rs[Rs_backgroundPixmap];
545 547
546 if ((p = strchr (p, ';')) != NULL) 548 if ((p = strchr (p, ';')) != 0)
547 { 549 {
548 p++; 550 p++;
549 bgPixmap.set_geometry (p); 551 bgPixmap.set_geometry (p);
550 } 552 }
551 else 553 else
636 old_xerror_handler = XSetErrorHandler ((XErrorHandler) rxvt_xerror_handler); 638 old_xerror_handler = XSetErrorHandler ((XErrorHandler) rxvt_xerror_handler);
637 // TODO: handle this with exceptions and tolerate the memory loss 639 // TODO: handle this with exceptions and tolerate the memory loss
638 XSetIOErrorHandler (rxvt_xioerror_handler); 640 XSetIOErrorHandler (rxvt_xioerror_handler);
639 641
640 XrmInitialize (); 642 XrmInitialize ();
641}
642
643/* ------------------------------------------------------------------------- *
644 * MEMORY ALLOCATION WRAPPERS *
645 * ------------------------------------------------------------------------- */
646void *
647rxvt_malloc (size_t size)
648{
649 void *p = malloc (size);
650
651 if (!p)
652 rxvt_fatal ("memory allocation failure. aborting.\n");
653
654 return p;
655}
656
657void *
658rxvt_calloc (size_t number, size_t size)
659{
660 void *p = calloc (number, size);
661
662 if (!p)
663 rxvt_fatal ("memory allocation failure. aborting.\n");
664
665 return p;
666}
667
668void *
669rxvt_realloc (void *ptr, size_t size)
670{
671 void *p = realloc (ptr, size);
672
673 if (!p)
674 rxvt_fatal ("memory allocation failure. aborting.\n");
675
676 return p;
677} 643}
678 644
679/*----------------------------------------------------------------------*/ 645/*----------------------------------------------------------------------*/
680/* 646/*
681 * window size/position calculations for XSizeHint and other storage. 647 * window size/position calculations for XSizeHint and other storage.
1713void 1679void
1714rxvt_term::get_window_origin (int &x, int &y) 1680rxvt_term::get_window_origin (int &x, int &y)
1715{ 1681{
1716 Window cr; 1682 Window cr;
1717 XTranslateCoordinates (dpy, parent[0], display->root, 0, 0, &x, &y, &cr); 1683 XTranslateCoordinates (dpy, parent[0], display->root, 0, 0, &x, &y, &cr);
1718/* fprintf( stderr, "origin is %+d%+d\n", x, y);*/ 1684/* fprintf (stderr, "origin is %+d%+d\n", x, y);*/
1719} 1685}
1720 1686
1721Pixmap 1687Pixmap
1722rxvt_term::get_pixmap_property (int prop_id) 1688rxvt_term::get_pixmap_property (int prop_id)
1723{ 1689{
1740} 1706}
1741 1707
1742#ifdef HAVE_BG_PIXMAP 1708#ifdef HAVE_BG_PIXMAP
1743# if TRACE_PIXMAPS 1709# if TRACE_PIXMAPS
1744# undef update_background 1710# undef update_background
1711void
1745int rxvt_term::trace_update_background (const char *file, int line) 1712rxvt_term::trace_update_background (const char *file, int line)
1746{ 1713{
1747 fprintf (stderr, "%s:%d:update_background()\n", file, line); 1714 fprintf (stderr, "%s:%d:update_background()\n", file, line);
1748 update_background (); 1715 update_background ();
1749} 1716}
1750# endif 1717# endif
1751 1718
1752int 1719void
1753rxvt_term::update_background () 1720rxvt_term::update_background ()
1754{ 1721{
1755 bgPixmap.invalidate (); 1722 bgPixmap.invalidate ();
1756 1723
1757 /* no chance of real time refresh if we are blurring! */ 1724 /* no chance of real time refresh if we are blurring! */
1758 if (bgPixmap.invalid_since + 0.5 < ev::now () && !(bgPixmap.flags & bgPixmap_t::blurNeeded)) 1725 if (bgPixmap.invalid_since + 0.50 < ev::now ()
1726 && !(bgPixmap.flags & bgPixmap_t::blurNeeded))
1727 {
1728 update_background_ev.stop ();
1759 bgPixmap.render (); 1729 bgPixmap.render ();
1730 }
1760 else 1731 else
1761 { 1732 {
1762 ev_tstamp refresh; 1733 ev_tstamp refresh;
1763 update_background_ev.stop ();
1764 1734
1765 if (!bgPixmap.need_client_side_rendering ()) 1735 if (!bgPixmap.need_client_side_rendering ())
1766 refresh = .05; 1736 refresh = .05;
1767 else if (bgPixmap.flags & bgPixmap_t::blurNeeded) 1737 else if (bgPixmap.flags & bgPixmap_t::blurNeeded)
1768 refresh = .20; /* very slow !!! */ 1738 refresh = .20; /* very slow !!! */
1769 else 1739 else
1770 refresh = .07; 1740 refresh = .07;
1741
1771 update_background_ev.start (refresh); 1742 update_background_ev.start (refresh);
1772 } 1743 }
1773
1774 return 0;
1775} 1744}
1776 1745
1777void 1746void
1778rxvt_term::update_background_cb (ev::timer &w, int revents) 1747rxvt_term::update_background_cb (ev::timer &w, int revents)
1779{ 1748{

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines