break;
case ConfigureNotify:
+/* fprintf (stderr, "ConfigureNotify for %X, parent is %X, geom is %dx%d%+d%+d, old geom was %dx%d\n",
+ ev.xconfigure.window, parent[0], ev.xconfigure.width, ev.xconfigure.height, ev.xconfigure.x, ev.xconfigure.y,
+ szHint.width, szHint.height);*/
if (ev.xconfigure.window == parent[0])
{
while (XCheckTypedWindowEvent (dpy, ev.xconfigure.window, ConfigureNotify, &ev))
{
#ifdef ENABLE_TRANSPARENCY
if (option (Opt_transparent))
- if (bgPixmap.render ())
- scr_touch (false);
+ update_background ();
#endif
}
HOOK_INVOKE ((this, HOOK_CONFIGURE_NOTIFY, DT_XEVENT, &ev, DT_END));
|| ev.xproperty.atom == xa[XA_ESETROOT_PMAP_ID])
{
bgPixmap.set_root_pixmap ();
- bgPixmap.render ();
+ update_background ();
}
break;
}
else
changed = bgPixmap.unset_tint ();
if (changed)
- bgPixmap.render ();
+ update_background ();
}
break;
str = strchr (str, ';');
}
if (changed)
- {
- bgPixmap.render ();
- scr_touch (true);
- }
+ update_background ();
}
break;
#endif
#if ENABLE_TRANSPARENCY || ENABLE_PERL
rootwin_ev (this, &rxvt_term::rootwin_cb),
#endif
-#if ENABLE_TRANSPARENCY
- check_our_parents_ev(this, &rxvt_term::check_our_parents_cb),
+#if HAVE_BG_PIXMAP
+ update_background_ev(this, &rxvt_term::update_background_cb),
#endif
#ifdef HAVE_SCROLLBARS
scrollbar_ev (this, &rxvt_term::x_cb),
#endif
#ifdef HAVE_BG_PIXMAP
{
- bool changed = false;
bgPixmap.set_target (this);
#ifdef ENABLE_TRANSPARENCY
bgPixmap.set_tint (pix_colors_focused [Color_tint]);
if (rs [Rs_shade])
bgPixmap.set_shade (rs [Rs_shade]);
- changed = true;
bgPixmap.set_root_pixmap ();
XSelectInput (dpy, display->root, PropertyChangeMask);
else
bgPixmap.set_defaultGeometry ();
- changed = bgPixmap.set_file (rs[Rs_backgroundPixmap]);
+ bgPixmap.set_file (rs[Rs_backgroundPixmap]);
}
+ /* do not want to render Pixmap yet if we are size/position dependant -
+ * wait for ConfigureNotify at least */
+ if (!bgPixmap.window_size_sensitive ())
+ update_background();
#endif
- if (changed)
- {
- bgPixmap.render ();
- scr_touch (true);
- }
}
#endif
#ifdef XPM_BACKGROUND
/* TODO: replace with update_pixmap() that should unify transparency and bg image handling ! */
if (bgPixmap.window_size_sensitive ())
- bgPixmap.render ();
+ update_background ();
#endif
scr_clear ();
};
unsigned long make_transparency_pixmap ();/* returns combination of the above flags */
# endif
+ double invalid_since;
Pixmap pixmap;
unsigned int pmap_width, pmap_height;
unsigned int pmap_depth;
bool window_size_sensitive ();
+ bool need_client_side_rendering ();
void apply ();
bool render ();
- void invalidate () { flags |= isInvalid; };
+ void invalidate () {
+ if (!(flags & isInvalid))
+ {
+ flags |= isInvalid;
+ invalid_since = NOW;
+ }
+ };
};
#else
# undef HAVE_BG_PIXMAP
void rootwin_cb (XEvent &xev);
xevent_watcher rootwin_ev;
#endif
-#if ENABLE_TRANSPARENCY
- int check_our_parents ();
- void check_our_parents_cb (time_watcher &w);
- time_watcher check_our_parents_ev;
+#ifdef HAVE_BG_PIXMAP
+ int update_background ();
+ void update_background_cb (time_watcher &w);
+ time_watcher update_background_ev;
#endif
void x_cb (XEvent &xev);
return false;
}
+bool bgPixmap_t::need_client_side_rendering ()
+{
+# ifdef HAVE_AFTERIMAGE
+ if (original_asim != NULL)
+ return true;
+#endif
+# ifdef ENABLE_TRANSPARENCY
+ if (flags & isTransparent)
+ {
+ if ((flags & blurNeeded)
+ || ((flags & tintNeeded) && !(flags & tintServerSide)))
+ return true;
+ }
+# endif
+ return false;
+}
+
# ifdef XPM_BACKGROUND
static inline bool
check_set_scale_value (int geom_flags, int flag, unsigned int &scale, unsigned int new_value)
++changed;
v_blurRadius = vr;
}
+ if (v_blurRadius == 0 && h_blurRadius == 0)
+ flags &= ~blurNeeded;
+ else
+ flags |= blurNeeded;
return (changed>0);
}
as_tint = shading2tint32 (&as_shade);
}
+
+ if (!(background_flags & transpPmapBlured) && (flags & blurNeeded) && background != NULL)
+ {
+ ASImage* tmp = blur_asimage_gauss (target->asv, background, h_blurRadius, v_blurRadius, 0xFFFFFFFF,
+ (original_asim == NULL || tint == TINT_LEAVE_SAME)?ASA_XImage:ASA_ASImage,
+ 100, ASIMAGE_QUALITY_DEFAULT);
+ if (tmp)
+ {
+ destroy_asimage (&background);
+ background = tmp;
+ }
+ }
+
if (render_asim (background, as_tint))
flags = flags & ~isInvalid;
if (background)
{
Window cr;
XTranslateCoordinates (dpy, parent[0], display->root, 0, 0, &x, &y, &cr);
+/* fprintf( stderr, "origin is %+d%+d\n", x, y);*/
}
Pixmap
* Do transparency updates if required
*/
int
-rxvt_term::check_our_parents ()
+rxvt_term::update_background ()
{
- check_our_parents_ev.stop ();
- check_our_parents_ev.start (NOW + .1);
+ bgPixmap.invalidate();
+ /* no chance of real time refresh if we are blurring ! */
+ if (bgPixmap.invalid_since + 0.5 < NOW && !(bgPixmap.flags & bgPixmap_t::blurNeeded))
+ bgPixmap.render();
+ else
+ {
+ update_background_ev.stop ();
+ if (!bgPixmap.need_client_side_rendering())
+ update_background_ev.start (NOW + .05);
+ else if (bgPixmap.flags & bgPixmap_t::blurNeeded)
+ update_background_ev.start (NOW + .2); /* very slow !!! */
+ else
+ update_background_ev.start (NOW + .07);
+ }
return 0;
}
void
-rxvt_term::check_our_parents_cb (time_watcher &w)
+rxvt_term::update_background_cb (time_watcher &w)
{
+ bgPixmap.render ();
+}
+#endif /* HAVE_BG_PIXMAP */
+
+
#if 0 /* replaced by a bgPixmap_t::render() - leve here temporarily for reference */
+void
+rxvt_term::check_our_parents_cb (time_watcher &w)
+{
int i, aformat, rootdepth;
unsigned long nitems, bytes_after;
flush ();
}
}
-#endif
}
-#endif
+#endif