Feature #69: Blur window background

- Add window background blur support (--blur-background &
  --blur-background-frame), with X Render convolution filter.
  The performance sucks. The performance when the window is opaque but
  frame is transparent could be improved, but there are two possible
  ways and I'm hesitating.

- Known issue: The blurring effect looks very ungraceful during fading.
  I could partially fix the problem, but it probably isn't easy to fix
  it completely.
This commit is contained in:
Richard Grenville
2012-12-14 20:32:46 +08:00
parent a77aaf0718
commit 22cabf7c89
3 changed files with 155 additions and 2 deletions

View File

@ -116,6 +116,10 @@
#define US_PER_SEC 1000000L
#define MS_PER_SEC 1000
#define XRFILTER_CONVOLUTION "convolution"
#define XRFILTER_GUASSIAN "gaussian"
#define XRFILTER_BINOMIAL "binomial"
// Window flags
// Window size is changed
@ -326,6 +330,11 @@ typedef struct {
bool inactive_dim_fixed;
/// Step for pregenerating alpha pictures. 0.01 - 1.0.
double alpha_step;
/// Whether to blur background of semi-transparent / ARGB windows.
bool blur_background;
/// Whether to blur background when the window frame is not opaque.
/// Implies blur_background.
bool blur_background_frame;
// === Focus related ===
/// Consider windows of specific types to be always focused.
@ -519,6 +528,8 @@ typedef struct {
#endif
/// Whether X DBE extension exists.
bool dbe_exists;
/// Whether X Render convolution filter exists.
bool xrfilter_convolution_exists;
// === Atoms ===
/// Atom of property <code>_NET_WM_OPACITY</code>.
@ -778,6 +789,22 @@ set_ignore_next(session_t *ps) {
static int
should_ignore(session_t *ps, unsigned long sequence);
/**
* Return the painting target window.
*/
static inline Window
get_tgt_window(session_t *ps) {
return ps->o.paint_on_overlay ? ps->overlay: ps->root;
}
/**
* Reset filter on a <code>Picture</code>.
*/
static inline void
xrfilter_reset(session_t *ps, Picture p) {
XRenderSetPictureFilter(ps->dpy, p, "Nearest", NULL, 0);
}
/**
* Subtract two unsigned long values.
*