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.284 by root, Fri Dec 14 06:29:28 2007 UTC vs.
Revision 1.292 by root, Mon Dec 24 10:58:09 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
284#endif 284#endif
285 285
286#ifdef HAVE_BG_PIXMAP 286#ifdef HAVE_BG_PIXMAP
287 bgPixmap.destroy (); 287 bgPixmap.destroy ();
288#endif 288#endif
289 display->flush (); /* ideally .put should do this */
289 displays.put (display); 290 displays.put (display);
290 291
291 scr_release (); 292 scr_release ();
292 293
293 /* clear all resources */ 294 /* clear all resources */
520 521
521#ifdef ENABLE_TRANSPARENCY 522#ifdef ENABLE_TRANSPARENCY
522 if (option (Opt_transparent)) 523 if (option (Opt_transparent))
523 { 524 {
524 bgPixmap.set_transparent (); 525 bgPixmap.set_transparent ();
526
525#ifdef HAVE_AFTERIMAGE 527#ifdef HAVE_AFTERIMAGE
526 if (rs [Rs_blurradius]) 528 if (rs [Rs_blurradius])
527 bgPixmap.set_blur_radius (rs [Rs_blurradius]); 529 bgPixmap.set_blur_radius (rs [Rs_blurradius]);
528#endif 530#endif
529 if (ISSET_PIXCOLOR (Color_tint)) 531 if (ISSET_PIXCOLOR (Color_tint))
530 bgPixmap.set_tint (pix_colors_focused [Color_tint]); 532 bgPixmap.set_tint (pix_colors_focused [Color_tint]);
533
531 if (rs [Rs_shade]) 534 if (rs [Rs_shade])
532 bgPixmap.set_shade (rs [Rs_shade]); 535 bgPixmap.set_shade (rs [Rs_shade]);
533 536
534 bgPixmap.set_root_pixmap (); 537 bgPixmap.set_root_pixmap ();
535 XSelectInput (dpy, display->root, PropertyChangeMask); 538 XSelectInput (dpy, display->root, PropertyChangeMask);
536 rootwin_ev.start (display, display->root); 539 rootwin_ev.start (display, display->root);
537 } 540 }
538#endif 541#endif
539 542
540#ifdef BG_IMAGE_FROM_FILE 543#ifdef BG_IMAGE_FROM_FILE
541 if (rs[Rs_backgroundPixmap] != NULL) 544 if (rs[Rs_backgroundPixmap])
542 { 545 {
543 const char *p = rs[Rs_backgroundPixmap]; 546 const char *p = rs[Rs_backgroundPixmap];
544 547
545 if ((p = strchr (p, ';')) != NULL) 548 if ((p = strchr (p, ';')) != 0)
546 { 549 {
547 p++; 550 p++;
548 bgPixmap.set_geometry (p); 551 bgPixmap.set_geometry (p);
549 } 552 }
550 else 553 else
635 old_xerror_handler = XSetErrorHandler ((XErrorHandler) rxvt_xerror_handler); 638 old_xerror_handler = XSetErrorHandler ((XErrorHandler) rxvt_xerror_handler);
636 // TODO: handle this with exceptions and tolerate the memory loss 639 // TODO: handle this with exceptions and tolerate the memory loss
637 XSetIOErrorHandler (rxvt_xioerror_handler); 640 XSetIOErrorHandler (rxvt_xioerror_handler);
638 641
639 XrmInitialize (); 642 XrmInitialize ();
640}
641
642/* ------------------------------------------------------------------------- *
643 * MEMORY ALLOCATION WRAPPERS *
644 * ------------------------------------------------------------------------- */
645void *
646rxvt_malloc (size_t size)
647{
648 void *p = malloc (size);
649
650 if (!p)
651 rxvt_fatal ("memory allocation failure. aborting.\n");
652
653 return p;
654}
655
656void *
657rxvt_calloc (size_t number, size_t size)
658{
659 void *p = calloc (number, size);
660
661 if (!p)
662 rxvt_fatal ("memory allocation failure. aborting.\n");
663
664 return p;
665}
666
667void *
668rxvt_realloc (void *ptr, size_t size)
669{
670 void *p = realloc (ptr, size);
671
672 if (!p)
673 rxvt_fatal ("memory allocation failure. aborting.\n");
674
675 return p;
676} 643}
677 644
678/*----------------------------------------------------------------------*/ 645/*----------------------------------------------------------------------*/
679/* 646/*
680 * window size/position calculations for XSizeHint and other storage. 647 * window size/position calculations for XSizeHint and other storage.
1712void 1679void
1713rxvt_term::get_window_origin (int &x, int &y) 1680rxvt_term::get_window_origin (int &x, int &y)
1714{ 1681{
1715 Window cr; 1682 Window cr;
1716 XTranslateCoordinates (dpy, parent[0], display->root, 0, 0, &x, &y, &cr); 1683 XTranslateCoordinates (dpy, parent[0], display->root, 0, 0, &x, &y, &cr);
1717/* fprintf( stderr, "origin is %+d%+d\n", x, y);*/ 1684/* fprintf (stderr, "origin is %+d%+d\n", x, y);*/
1718} 1685}
1719 1686
1720Pixmap 1687Pixmap
1721rxvt_term::get_pixmap_property (int prop_id) 1688rxvt_term::get_pixmap_property (int prop_id)
1722{ 1689{
1729 unsigned char *prop = NULL; 1696 unsigned char *prop = NULL;
1730 int result = XGetWindowProperty (dpy, display->root, xa[prop_id], 1697 int result = XGetWindowProperty (dpy, display->root, xa[prop_id],
1731 0L, 1L, False, XA_PIXMAP, &atype, &aformat, 1698 0L, 1L, False, XA_PIXMAP, &atype, &aformat,
1732 &nitems, &bytes_after, &prop); 1699 &nitems, &bytes_after, &prop);
1733 if (result == Success && prop && atype == XA_PIXMAP) 1700 if (result == Success && prop && atype == XA_PIXMAP)
1734 {
1735 return *(Pixmap *)prop; 1701 return *(Pixmap *)prop;
1736 }
1737 } 1702 }
1703
1738 return None; 1704 return None;
1739} 1705}
1740 1706
1741#ifdef HAVE_BG_PIXMAP 1707#ifdef HAVE_BG_PIXMAP
1742# if TRACE_PIXMAPS 1708# if TRACE_PIXMAPS
1743# undef update_background 1709# undef update_background
1710void
1744int rxvt_term::trace_update_background (const char *file, int line) 1711rxvt_term::trace_update_background (const char *file, int line)
1745{ 1712{
1746 fprintf (stderr, "%s:%d:update_background()\n", file, line); 1713 fprintf (stderr, "%s:%d:update_background()\n", file, line);
1747 update_background (); 1714 update_background ();
1748} 1715}
1749# endif 1716# endif
1750 1717
1751int 1718void
1752rxvt_term::update_background () 1719rxvt_term::update_background ()
1753{ 1720{
1754 bgPixmap.invalidate (); 1721 bgPixmap.invalidate ();
1755 1722
1756 /* no chance of real time refresh if we are blurring! */ 1723 /* no chance of real time refresh if we are blurring! */
1757 if (bgPixmap.invalid_since + 0.5 < ev::now () && !(bgPixmap.flags & bgPixmap_t::blurNeeded)) 1724 if (bgPixmap.invalid_since + 0.50 < ev::now ()
1725 && !(bgPixmap.flags & bgPixmap_t::blurNeeded))
1726 {
1727 update_background_ev.stop ();
1758 bgPixmap.render (); 1728 bgPixmap.render ();
1729 }
1759 else 1730 else
1760 { 1731 {
1761 update_background_ev.stop (); 1732 ev_tstamp refresh;
1762 1733
1763 if (!bgPixmap.need_client_side_rendering()) 1734 if (!bgPixmap.need_client_side_rendering ())
1764 update_background_ev.start (.05); 1735 refresh = .05;
1765 else if (bgPixmap.flags & bgPixmap_t::blurNeeded) 1736 else if (bgPixmap.flags & bgPixmap_t::blurNeeded)
1766 update_background_ev.start (.20); /* very slow !!! */ 1737 refresh = .20; /* very slow !!! */
1767 else 1738 else
1739 refresh = .07;
1740
1768 update_background_ev.start (.07); 1741 update_background_ev.start (refresh);
1769 } 1742 }
1770
1771 return 0;
1772} 1743}
1773 1744
1774void 1745void
1775rxvt_term::update_background_cb (ev::timer &w, int revents) 1746rxvt_term::update_background_cb (ev::timer &w, int revents)
1776{ 1747{

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines