diff options
author | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2014-11-23 22:10:30 -0600 |
---|---|---|
committer | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2014-11-23 22:10:30 -0600 |
commit | f1baae5fff89ee638864f7d9b82f88b9dfa59796 (patch) | |
tree | 5aeaa80717474c234fe78eaadeb8f82673d2daa2 /twin | |
parent | 05194b2b6c4845e47f3d1c1468bb1b0764013e33 (diff) | |
download | tdebase-f1baae5fff89ee638864f7d9b82f88b9dfa59796.tar.gz tdebase-f1baae5fff89ee638864f7d9b82f88b9dfa59796.zip |
Fix greyscale filter
Diffstat (limited to 'twin')
-rw-r--r-- | twin/compton-tde/compton.c | 59 |
1 files changed, 46 insertions, 13 deletions
diff --git a/twin/compton-tde/compton.c b/twin/compton-tde/compton.c index aa7fbba0c..dea363f60 100644 --- a/twin/compton-tde/compton.c +++ b/twin/compton-tde/compton.c @@ -941,6 +941,9 @@ recheck_focus(session_t *ps) { } static Bool +determine_window_transparency_filter_greyscale(const session_t *ps, Window w); + +static Bool determine_window_transparent_to_black(const session_t *ps, Window w); static Bool @@ -1585,18 +1588,13 @@ xr_greyscale_dst(session_t *ps, Picture tgt_buffer, if (reg_clip && tmp_picture) XFixesSetPictureClipRegion(ps->dpy, tmp_picture, reg_clip, 0, 0); - Picture src_pict = tgt_buffer, dst_pict = tmp_picture; - - XRenderComposite(ps->dpy, PictOpHSLLuminosity, src_pict, None, - dst_pict, x, y, 0, 0, 0, 0, wid, hei); + XRenderComposite(ps->dpy, PictOpSrc, ps->black_picture, None, + tmp_picture, 0, 0, 0, 0, 0, 0, wid, hei); + XRenderComposite(ps->dpy, PictOpHSLLuminosity, tgt_buffer, None, + tmp_picture, x, y, 0, 0, 0, 0, wid, hei); - XserverRegion tmp = src_pict; - src_pict = dst_pict; - dst_pict = tmp; - - if (src_pict != tgt_buffer) - XRenderComposite(ps->dpy, PictOpSrc, src_pict, None, tgt_buffer, - 0, 0, 0, 0, x, y, wid, hei); + XRenderComposite(ps->dpy, PictOpSrc, tmp_picture, None, tgt_buffer, + 0, 0, 0, 0, x, y, wid, hei); free_picture(ps, &tmp_picture); @@ -2440,6 +2438,7 @@ map_win(session_t *ps, Window id) { /* This needs to be here since we don't get PropertyNotify when unmapped */ w->opacity = wid_get_opacity_prop(ps, w->id, OPAQUE); + w->greyscale_background = determine_window_transparency_filter_greyscale(ps, id); w->show_root_tile = determine_window_transparent_to_desktop(ps, id); w->show_black_background = determine_window_transparent_to_black(ps, id); @@ -2494,7 +2493,6 @@ map_win(session_t *ps, Window id) { } win_determine_blur_background(ps, w); - win_determine_greyscale_background(ps, w); w->damaged = false; @@ -2678,6 +2676,41 @@ get_window_transparent_to_black(const session_t *ps, Window w) } static Bool +determine_window_transparency_filter_greyscale (const session_t *ps, Window w) +{ + Window root_return, parent_return; + Window *children = NULL; + unsigned int nchildren, i; + Bool type; + + type = get_window_transparency_filter_greyscale (ps, w); + if (type == True) { + return True; + } + + if (!XQueryTree (ps->dpy, w, &root_return, &parent_return, &children, + &nchildren)) + { + /* XQueryTree failed. */ + if (children) + XFree ((void *)children); + return False; + } + + for (i = 0;i < nchildren;i++) + { + type = determine_window_transparency_filter_greyscale (ps, children[i]); + if (type == True) + return True; + } + + if (children) + XFree ((void *)children); + + return False; +} + +static Bool determine_window_transparent_to_desktop (const session_t *ps, Window w) { Window root_return, parent_return; @@ -3084,7 +3117,7 @@ win_determine_greyscale_background(session_t *ps, win *w) { if (IsViewable != w->a.map_state) return; - bool greyscale_background_new = (get_window_transparency_filter_greyscale(ps, w) || + bool greyscale_background_new = (determine_window_transparency_filter_greyscale(ps, w) || (ps->o.greyscale_background && !win_match(ps, w, ps->o.greyscale_background_blacklist, &w->cache_bbblst))); win_set_greyscale_background(ps, w, greyscale_background_new); |