Feature: Issue #2: Support dim inactive windows

- Add a switch --inactive-dim that dims inactive windows.

- The window dimming feature is implemented in a pretty ugly way.
  Improve it if possible.
This commit is contained in:
Richard Grenville
2012-09-12 10:52:52 +08:00
parent f280750a03
commit e9cfa49c86
2 changed files with 59 additions and 8 deletions

View File

@ -108,6 +108,8 @@ typedef struct _win {
opacity_t opacity;
/// Cached value of opacity window attribute.
opacity_t opacity_prop;
/// Whether the window is to be dimmed.
Bool dim;
wintype window_type;
/// Whether the window is focused.
Bool focused;
@ -363,6 +365,8 @@ void set_opacity(Display *dpy, win *w, opacity_t opacity);
void calc_opacity(Display *dpy, win *w, Bool refetch_prop);
void calc_dim(Display *dpy, win *w);
static void
add_win(Display *dpy, Window id, Window prev, Bool override_redirect);
@ -488,6 +492,17 @@ inline static XserverRegion copy_region(Display *dpy,
return region;
}
/**
* Add a window to damaged area.
*
* @param dpy display in use
* @param w struct _win element representing the window
*/
static inline void add_damage_win(Display *dpy, win *w) {
if (w->extents)
add_damage(dpy, copy_region(dpy, w->extents));
}
inline static void
ev_handle(XEvent *ev);