From 64a9b80f3b29af29c4b8fc7e6981ac1f321f768c Mon Sep 17 00:00:00 2001 From: Richard Grenville Date: Fri, 14 Dec 2012 20:32:46 +0800 Subject: 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. --- compton.h | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'compton.h') diff --git a/compton.h b/compton.h index 16272e6f5..8aecaa762 100644 --- a/compton.h +++ b/compton.h @@ -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 _NET_WM_OPACITY. @@ -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 Picture. + */ +static inline void +xrfilter_reset(session_t *ps, Picture p) { + XRenderSetPictureFilter(ps->dpy, p, "Nearest", NULL, 0); +} + /** * Subtract two unsigned long values. * -- cgit v1.2.1