Improve transparency detection for blur

Previously, only the WM windows (window manager usually reparents the
application windows under its own window so it can manage them) are
checked for alpha channels. Some of the window managers (e.g. awesome)
acquire alpha channels for all of the WM windows, whether the underlying
application windows have alpha channel or not.

With this change, the application windows are also checked for alpha
channels. If a WM window has alpha but its child doesn't, only the WM
frame will be considered to be semi-transparent. Thus preventing some
unnecessary blurring.

Closes #191

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
Yuxuan Shui
2019-07-13 12:29:39 +01:00
parent 7d28309a47
commit 426043baa7
5 changed files with 71 additions and 32 deletions

View File

@ -180,8 +180,10 @@ struct managed_win {
xcb_get_geometry_reply_t g;
/// Xinerama screen this window is on.
int xinerama_scr;
/// Window visual pict format;
/// Window visual pict format
const xcb_render_pictforminfo_t *pictfmt;
/// Client window visual pict format
const xcb_render_pictforminfo_t *client_pictfmt;
/// Window painting mode.
winmode_t mode;
/// Whether the window has been damaged at least once.
@ -343,7 +345,6 @@ void win_set_shadow(session_t *ps, struct managed_win *w, bool shadow_new);
void win_determine_shadow(session_t *ps, struct managed_win *w);
void win_set_invert_color(session_t *ps, struct managed_win *w, bool invert_color_new);
void win_determine_invert_color(session_t *ps, struct managed_win *w);
void win_set_blur_background(session_t *ps, struct managed_win *w, bool blur_background_new);
void win_determine_blur_background(session_t *ps, struct managed_win *w);
void win_on_wtype_change(session_t *ps, struct managed_win *w);
void win_on_factor_change(session_t *ps, struct managed_win *w);
@ -466,10 +467,6 @@ struct managed_win *find_toplevel2(session_t *ps, xcb_window_t wid);
*/
bool attr_pure win_is_fullscreen(const session_t *ps, const struct managed_win *w);
/**
* Check if a window will be painted solid.
*/
bool attr_pure win_is_solid(const session_t *ps, const struct managed_win *w);
/**
* Check if a window is really focused.
*/