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.241 by sasha, Mon Aug 13 22:41:34 2007 UTC vs.
Revision 1.249 by sasha, Wed Sep 12 20:29:24 2007 UTC

151rxvt_term::rxvt_term () 151rxvt_term::rxvt_term ()
152 : 152 :
153#if ENABLE_TRANSPARENCY || ENABLE_PERL 153#if ENABLE_TRANSPARENCY || ENABLE_PERL
154 rootwin_ev (this, &rxvt_term::rootwin_cb), 154 rootwin_ev (this, &rxvt_term::rootwin_cb),
155#endif 155#endif
156#if ENABLE_TRANSPARENCY 156#if HAVE_BG_PIXMAP
157 check_our_parents_ev(this, &rxvt_term::check_our_parents_cb), 157 update_background_ev(this, &rxvt_term::update_background_cb),
158#endif 158#endif
159#ifdef HAVE_SCROLLBARS 159#ifdef HAVE_SCROLLBARS
160 scrollbar_ev (this, &rxvt_term::x_cb), 160 scrollbar_ev (this, &rxvt_term::x_cb),
161#endif 161#endif
162#ifdef CURSOR_BLINK 162#ifdef CURSOR_BLINK
506 if (option (Opt_scrollBar)) 506 if (option (Opt_scrollBar))
507 resize_scrollbar (); /* create and map scrollbar */ 507 resize_scrollbar (); /* create and map scrollbar */
508#endif 508#endif
509#ifdef HAVE_BG_PIXMAP 509#ifdef HAVE_BG_PIXMAP
510 { 510 {
511 bool changed = false;
512 bgPixmap.set_target (this); 511 bgPixmap.set_target (this);
513 512
514#ifdef ENABLE_TRANSPARENCY 513#ifdef ENABLE_TRANSPARENCY
515 if (option (Opt_transparent)) 514 if (option (Opt_transparent))
516 { 515 {
521#endif 520#endif
522 if (ISSET_PIXCOLOR (Color_tint)) 521 if (ISSET_PIXCOLOR (Color_tint))
523 bgPixmap.set_tint (pix_colors_focused [Color_tint]); 522 bgPixmap.set_tint (pix_colors_focused [Color_tint]);
524 if (rs [Rs_shade]) 523 if (rs [Rs_shade])
525 bgPixmap.set_shade (rs [Rs_shade]); 524 bgPixmap.set_shade (rs [Rs_shade]);
526 changed = true;
527 525
528 bgPixmap.set_root_pixmap (); 526 bgPixmap.set_root_pixmap ();
529 XSelectInput (dpy, display->root, PropertyChangeMask); 527 XSelectInput (dpy, display->root, PropertyChangeMask);
530 rootwin_ev.start (display, display->root); 528 rootwin_ev.start (display, display->root);
531 } 529 }
542 bgPixmap.set_geometry (p); 540 bgPixmap.set_geometry (p);
543 } 541 }
544 else 542 else
545 bgPixmap.set_defaultGeometry (); 543 bgPixmap.set_defaultGeometry ();
546 544
547 changed = bgPixmap.set_file (rs[Rs_backgroundPixmap]); 545 if (bgPixmap.set_file (rs[Rs_backgroundPixmap]))
546 if (!bgPixmap.window_position_sensitive ())
547 update_background ();
548 } 548 }
549#endif 549#endif
550 if (changed)
551 {
552 bgPixmap.render ();
553 scr_touch (true);
554 }
555 } 550 }
556#endif 551#endif
557 552
558#if ENABLE_PERL 553#if ENABLE_PERL
559 rootwin_ev.start (display, display->root); 554 rootwin_ev.start (display, display->root);
1149 1144
1150 XMoveResizeWindow (dpy, vt, 1145 XMoveResizeWindow (dpy, vt,
1151 window_vt_x, window_vt_y, 1146 window_vt_x, window_vt_y,
1152 width, height); 1147 width, height);
1153 1148
1149#ifdef HAVE_BG_PIXMAP
1150 if (bgPixmap.window_size_sensitive ())
1151 update_background ();
1152#endif
1153
1154 scr_clear (); 1154 scr_clear ();
1155#ifdef XPM_BACKGROUND
1156 /* TODO: should that really be here ? */
1157 bgPixmap.render ();
1158#endif
1159 } 1155 }
1160 1156
1161 if (fix_screen || old_height == 0) 1157 if (fix_screen || old_height == 0)
1162 scr_reset (); 1158 scr_reset ();
1163 1159
1164 // TODO, with nvidia-8178, resizes kill the alpha channel, report if not fixed in newer version 1160 // TODO, with nvidia-8178, resizes kill the alpha channel, report if not fixed in newer version
1165 //scr_touch (false); 1161 //scr_touch (false);
1166 1162
1167#ifdef HAVE_BG_PIXMAP 1163#ifdef HAVE_BG_PIXMAP
1164// TODO: this don't seem to have any effect - do we still need it ? If so - in which case exactly ?
1168 if (bgPixmap.pixmap) 1165// if (bgPixmap.pixmap)
1169 scr_touch (false); 1166// scr_touch (false);
1170#endif 1167#endif
1171 1168
1172#ifdef USE_XIM 1169#ifdef USE_XIM
1173 IMSetPosition (); 1170 IMSetPosition ();
1174#endif 1171#endif
1703 1700
1704 XFree (preedit_attr); 1701 XFree (preedit_attr);
1705} 1702}
1706#endif /* USE_XIM */ 1703#endif /* USE_XIM */
1707 1704
1705void
1706rxvt_term::get_window_origin (int &x, int &y)
1707{
1708 Window cr;
1709 XTranslateCoordinates (dpy, parent[0], display->root, 0, 0, &x, &y, &cr);
1710/* fprintf( stderr, "origin is %+d%+d\n", x, y);*/
1711}
1712
1713Pixmap
1714rxvt_term::get_pixmap_property (int prop_id)
1715{
1716 if (prop_id > 0 && prop_id < NUM_XA)
1717 if (xa[prop_id])
1718 {
1719 int aformat;
1720 unsigned long nitems, bytes_after;
1721 Atom atype;
1722 unsigned char *prop = NULL;
1723 int result = XGetWindowProperty (dpy, display->root, xa[prop_id],
1724 0L, 1L, False, XA_PIXMAP, &atype, &aformat,
1725 &nitems, &bytes_after, &prop);
1726 if (result == Success && prop && atype == XA_PIXMAP)
1727 {
1728 return *(Pixmap *)prop;
1729 }
1730 }
1731 return None;
1732}
1733
1734#ifdef HAVE_BG_PIXMAP
1735int
1736rxvt_term::update_background ()
1737{
1738 bgPixmap.invalidate();
1739
1740 /* no chance of real time refresh if we are blurring ! */
1741 if (bgPixmap.invalid_since + 0.5 < NOW && !(bgPixmap.flags & bgPixmap_t::blurNeeded))
1742 bgPixmap.render();
1743 else
1744 {
1745 update_background_ev.stop ();
1746 if (!bgPixmap.need_client_side_rendering())
1747 update_background_ev.start (NOW + .05);
1748 else if (bgPixmap.flags & bgPixmap_t::blurNeeded)
1749 update_background_ev.start (NOW + .2); /* very slow !!! */
1750 else
1751 update_background_ev.start (NOW + .07);
1752 }
1753 return 0;
1754}
1755
1756void
1757rxvt_term::update_background_cb (time_watcher &w)
1758{
1759 bgPixmap.render ();
1760}
1761
1762#endif /* HAVE_BG_PIXMAP */
1763
1708/*----------------------- end-of-file (C source) -----------------------*/ 1764/*----------------------- end-of-file (C source) -----------------------*/

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines