diff options
-rw-r--r-- | compton.c | 369 | ||||
-rw-r--r-- | compton.h | 58 |
2 files changed, 232 insertions, 195 deletions
@@ -112,59 +112,38 @@ Bool win_type_fade[NUM_WINTYPES]; * Options */ -char *display = NULL; -int shadow_radius = 12; -int shadow_offset_x = -15; -int shadow_offset_y = -15; -double shadow_opacity = .75; - -/// How much to fade in in a single fading step. -opacity_t fade_in_step = 0.028 * OPAQUE; -/// How much to fade out in a single fading step. -opacity_t fade_out_step = 0.03 * OPAQUE; -unsigned long fade_delta = 10; -unsigned long fade_time = 0; -Bool fade_trans = False; - -Bool clear_shadow = False; - -/// Default opacity for inactive windows. -/// 32-bit integer with the format of _NET_WM_OPACITY. 0 stands for -/// not enabled, default. -opacity_t inactive_opacity = 0; -/// Whether inactive_opacity overrides the opacity set by window -/// attributes. -Bool inactive_opacity_override = False; -double frame_opacity = 0.0; -/// How much to dim an inactive window. 0.0 - 1.0, 0 to disable. -double inactive_dim = 0.0; - -/// Whether to try to detect WM windows and mark them as focused. -double mark_wmwin_focused = False; - -/// Whether compton needs to track focus changes. -Bool track_focus = False; -/// Whether compton needs to track window name and class. -Bool track_wdata = False; - -/// Shadow blacklist. A linked list of conditions. -wincond *shadow_blacklist = NULL; -/// Fading blacklist. A linked list of conditions. -wincond *fade_blacklist = NULL; - -/// Whether to fork to background. -Bool fork_after_register = False; -/// Red, green and blue tone of the shadow. -double shadow_red = 0.0, shadow_green = 0.0, shadow_blue = 0.0; - -Bool synchronize = False; - -// Temporary options -int shadow_enable = 0; -int fading_enable = 0; -Bool no_dock_shadow = False; -Bool no_dnd_shadow = False; -double menu_opacity = 1.0; +static options_t options = { + .display = NULL, + .shadow_radius = 12, + .shadow_offset_x = -15, + .shadow_offset_y = -15, + .shadow_opacity = .75, + .fade_in_step = 0.028 * OPAQUE, + .fade_out_step = 0.03 * OPAQUE, + .fade_delta = 10, + .fade_time = 0, + .fade_trans = False, + .clear_shadow = False, + .inactive_opacity = 0, + .inactive_opacity_override = False, + .frame_opacity = 0.0, + .inactive_dim = 0.0, + .mark_wmwin_focused = False, + .track_focus = False, + .track_wdata = False, + .shadow_blacklist = NULL, + .fade_blacklist = NULL, + .fork_after_register = False, + .shadow_red = 0.0, + .shadow_green = 0.0, + .shadow_blue = 0.0, + .synchronize = False, + .shadow_enable = 0, + .fading_enable = 0, + .no_dock_shadow = False, + .no_dnd_shadow = False, + .menu_opacity = 1.0 +}; /** * Fades @@ -192,7 +171,7 @@ get_time_in_milliseconds() { */ static int fade_timeout(void) { - int diff = fade_delta - get_time_in_milliseconds() + fade_time; + int diff = options.fade_delta - get_time_in_milliseconds() + options.fade_time; if (diff < 0) diff = 0; @@ -221,11 +200,11 @@ run_fade(Display *dpy, win *w, unsigned steps) { // calculations if (w->opacity < w->opacity_tgt) w->opacity = normalize_d_range( - (double) w->opacity + (double) fade_in_step * steps, + (double) w->opacity + (double) options.fade_in_step * steps, 0.0, w->opacity_tgt); else w->opacity = normalize_d_range( - (double) w->opacity - (double) fade_out_step * steps, + (double) w->opacity - (double) options.fade_out_step * steps, w->opacity_tgt, OPAQUE); } @@ -441,12 +420,12 @@ make_shadow(Display *dpy, double opacity, * center (fill the complete data array) */ - // If clear_shadow is enabled and the border & corner shadow (which + // If options.clear_shadow is enabled and the border & corner shadow (which // later will be filled) could entirely cover the area of the shadow // that will be displayed, do not bother filling other pixels. If it // can't, we must fill the other pixels here. - if (!(clear_shadow && shadow_offset_x <= 0 && shadow_offset_x >= -cgsize - && shadow_offset_y <= 0 && shadow_offset_y >= -cgsize)) { + if (!(options.clear_shadow && options.shadow_offset_x <= 0 && options.shadow_offset_x >= -cgsize + && options.shadow_offset_y <= 0 && options.shadow_offset_y >= -cgsize)) { if (cgsize > 0) { d = shadow_top[opacity_int * (cgsize + 1) + cgsize]; } else { @@ -517,14 +496,14 @@ make_shadow(Display *dpy, double opacity, } } - if (clear_shadow) { + if (options.clear_shadow) { // Clear the region in the shadow that the window would cover based // on shadow_offset_{x,y} user provides - int xstart = normalize_i_range(- (int) shadow_offset_x, 0, swidth); - int xrange = normalize_i_range(width - (int) shadow_offset_x, + int xstart = normalize_i_range(- (int) options.shadow_offset_x, 0, swidth); + int xrange = normalize_i_range(width - (int) options.shadow_offset_x, 0, swidth) - xstart; - int ystart = normalize_i_range(- (int) shadow_offset_y, 0, sheight); - int yend = normalize_i_range(height - (int) shadow_offset_y, + int ystart = normalize_i_range(- (int) options.shadow_offset_y, 0, sheight); + int yend = normalize_i_range(height - (int) options.shadow_offset_y, 0, sheight); int y; @@ -892,11 +871,11 @@ determine_evmask(Display *dpy, Window wid, win_evmode_t mode) { if (WIN_EVMODE_FRAME == mode || find_win(dpy, wid)) { evmask |= PropertyChangeMask; - if (track_focus) evmask |= FocusChangeMask; + if (options.track_focus) evmask |= FocusChangeMask; } if (WIN_EVMODE_CLIENT == mode || find_toplevel(dpy, wid)) { - if (frame_opacity || track_wdata) + if (options.frame_opacity || options.track_wdata) evmask |= PropertyChangeMask; } @@ -1198,10 +1177,10 @@ paint_preprocess(Display *dpy, win *list) { // Sounds like the timeout in poll() frequently does not work // accurately, asking it to wait to 20ms, and often it would wait for // 19ms, so the step value has to be rounded. - unsigned steps = roundl((double) (get_time_in_milliseconds() - fade_time) / fade_delta); + unsigned steps = roundl((double) (get_time_in_milliseconds() - options.fade_time) / options.fade_delta); - // Reset fade_time - fade_time = get_time_in_milliseconds(); + // Reset options.fade_time + options.fade_time = get_time_in_milliseconds(); for (w = list; w; w = next) { // In case calling the fade callback function destroys this window @@ -1276,9 +1255,9 @@ paint_preprocess(Display *dpy, win *list) { w->opacity_cur = w->opacity; } - // Calculate frame_opacity - if (frame_opacity && 1.0 != frame_opacity && w->top_width) - w->frame_opacity = get_opacity_percent(dpy, w) * frame_opacity; + // Calculate options.frame_opacity + if (options.frame_opacity && 1.0 != options.frame_opacity && w->top_width) + w->frame_opacity = get_opacity_percent(dpy, w) * options.frame_opacity; else w->frame_opacity = 0.0; @@ -1294,9 +1273,9 @@ paint_preprocess(Display *dpy, win *list) { // Calculate shadow opacity if (w->frame_opacity) - w->shadow_opacity = shadow_opacity * w->frame_opacity; + w->shadow_opacity = options.shadow_opacity * w->frame_opacity; else - w->shadow_opacity = shadow_opacity * get_opacity_percent(dpy, w); + w->shadow_opacity = options.shadow_opacity * get_opacity_percent(dpy, w); // Rebuild shadow_pict if necessary if (w->flags & WFLAG_SIZE_CHANGE) @@ -1582,7 +1561,7 @@ map_win(Display *dpy, Window id, mark_client_win(dpy, w, cw); } } - else if (frame_opacity) { + else if (options.frame_opacity) { // Refetch frame extents just in case it changes when the window is // unmapped get_frame_extents(dpy, w, w->client_win); @@ -1597,7 +1576,7 @@ map_win(Display *dpy, Window id, #endif // Get window name and class if we are tracking them - if (track_wdata) { + if (options.track_wdata) { win_get_name(dpy, w); win_get_class(dpy, w); } @@ -1608,11 +1587,11 @@ map_win(Display *dpy, Window id, * XSelectInput() is called too late. We have to recheck the focused * window here. */ - if (track_focus) { + if (options.track_focus) { recheck_focus(dpy); // Consider a window without client window a WM window and mark it - // focused if mark_wmwin_focused is on - if (mark_wmwin_focused && !w->client_win) + // focused if options.mark_wmwin_focused is on + if (options.mark_wmwin_focused && !w->client_win) w->focused = True; } @@ -1747,17 +1726,17 @@ determine_mode(Display *dpy, win *w) { /** * Calculate and set the opacity of a window. * - * If window is inactive and inactive_opacity_override is set, the + * If window is inactive and options.inactive_opacity_override is set, the * priority is: (Simulates the old behavior) * - * inactive_opacity > _NET_WM_WINDOW_OPACITY (if not opaque) + * options.inactive_opacity > _NET_WM_WINDOW_OPACITY (if not opaque) * > window type default opacity * * Otherwise: * * _NET_WM_WINDOW_OPACITY (if not opaque) * > window type default opacity (if not opaque) - * > inactive_opacity + * > options.inactive_opacity * * @param dpy X display to use * @param w struct _win object representing the window @@ -1785,10 +1764,10 @@ calc_opacity(Display *dpy, win *w, Bool refetch_prop) { } } - // Respect inactive_opacity in some cases - if (inactive_opacity && is_normal_win(w) && False == w->focused - && (OPAQUE == opacity || inactive_opacity_override)) { - opacity = inactive_opacity; + // Respect options.inactive_opacity in some cases + if (options.inactive_opacity && is_normal_win(w) && False == w->focused + && (OPAQUE == opacity || options.inactive_opacity_override)) { + opacity = options.inactive_opacity; } w->opacity_tgt = opacity; @@ -1798,7 +1777,7 @@ static void calc_dim(Display *dpy, win *w) { Bool dim; - if (inactive_dim && is_normal_win(w) && !(w->focused)) { + if (options.inactive_dim && is_normal_win(w) && !(w->focused)) { dim = True; } else { dim = False; @@ -1827,7 +1806,7 @@ determine_shadow(Display *dpy, win *w) { Bool shadow_old = w->shadow; w->shadow = (win_type_shadow[w->window_type] - && !win_match(w, shadow_blacklist, &w->cache_sblst)); + && !win_match(w, options.shadow_blacklist, &w->cache_sblst)); // Window extents need update on shadow state change if (w->shadow != shadow_old) { @@ -1864,8 +1843,8 @@ calc_win_size(Display *dpy, win *w) { */ static void calc_shadow_geometry(Display *dpy, win *w) { - w->shadow_dx = shadow_offset_x; - w->shadow_dy = shadow_offset_y; + w->shadow_dx = options.shadow_offset_x; + w->shadow_dy = options.shadow_offset_y; w->shadow_width = w->widthb + gaussian_map->size; w->shadow_height = w->heightb + gaussian_map->size; } @@ -1883,7 +1862,7 @@ mark_client_win(Display *dpy, win *w, Window client) { // Get the frame width and monitor further frame width changes on client // window if necessary - if (frame_opacity) { + if (options.frame_opacity) { get_frame_extents(dpy, w, client); } XSelectInput(dpy, client, determine_evmask(dpy, client, WIN_EVMODE_CLIENT)); @@ -2222,7 +2201,7 @@ damage_win(Display *dpy, XDamageNotifyEvent *de) { && w->a.height <= w->damage_bounds.y + w->damage_bounds.height) { if (win_type_fade[w->window_type]) { set_fade(dpy, w, 0, get_opacity_percent(dpy, w), - fade_in_step, 0, True, True); + options.fade_in_step, 0, True, True); } w->usable = True; } @@ -2707,7 +2686,7 @@ ev_property_notify(XPropertyEvent *ev) { } // If frame extents property changes - if (frame_opacity && ev->atom == extents_atom) { + if (options.frame_opacity && ev->atom == extents_atom) { win *w = find_toplevel(dpy, ev->window); if (w) { get_frame_extents(dpy, w, ev->window); @@ -2717,7 +2696,7 @@ ev_property_notify(XPropertyEvent *ev) { } // If name changes - if (track_wdata + if (options.track_wdata && (name_atom == ev->atom || name_ewmh_atom == ev->atom)) { win *w = find_toplevel(dpy, ev->window); if (w && 1 == win_get_name(dpy, w)) @@ -2725,7 +2704,7 @@ ev_property_notify(XPropertyEvent *ev) { } // If class changes - if (track_wdata && class_atom == ev->atom) { + if (options.track_wdata && class_atom == ev->atom) { win *w = find_toplevel(dpy, ev->window); if (w) { win_get_class(dpy, w); @@ -3105,63 +3084,63 @@ parse_config(char *cpath) { // Get options from the configuration file. We don't do range checking // right now. It will be done later - // -D (fade_delta) + // -D (options.fade_delta) if (config_lookup_int(&cfg, "fade-delta", &ival)) - fade_delta = ival; - // -I (fade_in_step) + options.fade_delta = ival; + // -I (options.fade_in_step) if (config_lookup_float(&cfg, "fade-in-step", &dval)) - fade_in_step = normalize_d(dval) * OPAQUE; - // -O (fade_out_step) + options.fade_in_step = normalize_d(dval) * OPAQUE; + // -O (options.fade_out_step) if (config_lookup_float(&cfg, "fade-out-step", &dval)) - fade_out_step = normalize_d(dval) * OPAQUE; - // -r (shadow_radius) - config_lookup_int(&cfg, "shadow-radius", &shadow_radius); - // -o (shadow_opacity) - config_lookup_float(&cfg, "shadow-opacity", &shadow_opacity); - // -l (shadow_offset_x) - config_lookup_int(&cfg, "shadow-offset-x", &shadow_offset_x); - // -t (shadow_offset_y) - config_lookup_int(&cfg, "shadow-offset-y", &shadow_offset_y); - // -i (inactive_opacity) + options.fade_out_step = normalize_d(dval) * OPAQUE; + // -r (options.shadow_radius) + config_lookup_int(&cfg, "shadow-radius", &options.shadow_radius); + // -o (options.shadow_opacity) + config_lookup_float(&cfg, "shadow-opacity", &options.shadow_opacity); + // -l (options.shadow_offset_x) + config_lookup_int(&cfg, "shadow-offset-x", &options.shadow_offset_x); + // -t (options.shadow_offset_y) + config_lookup_int(&cfg, "shadow-offset-y", &options.shadow_offset_y); + // -i (options.inactive_opacity) if (config_lookup_float(&cfg, "inactive-opacity", &dval)) - inactive_opacity = normalize_d(dval) * OPAQUE; - // -e (frame_opacity) - config_lookup_float(&cfg, "frame-opacity", &frame_opacity); - // -z (clear_shadow) + options.inactive_opacity = normalize_d(dval) * OPAQUE; + // -e (options.frame_opacity) + config_lookup_float(&cfg, "frame-opacity", &options.frame_opacity); + // -z (options.clear_shadow) if (config_lookup_bool(&cfg, "clear-shadow", &ival)) - clear_shadow = ival; - // -c (shadow_enable) + options.clear_shadow = ival; + // -c (options.shadow_enable) if (config_lookup_bool(&cfg, "shadow", &ival) && ival) { - shadow_enable = 2; + options.shadow_enable = 2; wintype_arr_enable(win_type_shadow); } - // -C (no_dock_shadow) + // -C (options.no_dock_shadow) if (config_lookup_bool(&cfg, "no-dock-shadow", &ival)) - no_dock_shadow = ival; - // -G (no_dnd_shadow) + options.no_dock_shadow = ival; + // -G (options.no_dnd_shadow) if (config_lookup_bool(&cfg, "no-dnd-shadow", &ival)) - no_dnd_shadow = ival; - // -m (menu_opacity) - config_lookup_float(&cfg, "menu-opacity", &menu_opacity); - // -f (fading_enable) + options.no_dnd_shadow = ival; + // -m (options.menu_opacity) + config_lookup_float(&cfg, "menu-opacity", &options.menu_opacity); + // -f (options.fading_enable) if (config_lookup_bool(&cfg, "fading", &ival) && ival) { - fading_enable = 2; + options.fading_enable = 2; wintype_arr_enable(win_type_fade); } // --shadow-red - config_lookup_float(&cfg, "shadow-red", &shadow_red); + config_lookup_float(&cfg, "shadow-red", &options.shadow_red); // --shadow-green - config_lookup_float(&cfg, "shadow-green", &shadow_green); + config_lookup_float(&cfg, "shadow-green", &options.shadow_green); // --shadow-blue - config_lookup_float(&cfg, "shadow-blue", &shadow_blue); + config_lookup_float(&cfg, "shadow-blue", &options.shadow_blue); // --inactive-opacity-override if (config_lookup_bool(&cfg, "inactive-opacity-override", &ival)) - inactive_opacity_override = ival; + options.inactive_opacity_override = ival; // --inactive-dim - config_lookup_float(&cfg, "inactive-dim", &inactive_dim); + config_lookup_float(&cfg, "inactive-dim", &options.inactive_dim); // --mark-wmwin-focused if (config_lookup_bool(&cfg, "mark-wmwin-focused", &ival)) - mark_wmwin_focused = ival; + options.mark_wmwin_focused = ival; // --shadow-exclude { config_setting_t *setting = @@ -3171,13 +3150,13 @@ parse_config(char *cpath) { if (config_setting_is_array(setting)) { int i = config_setting_length(setting); while (i--) { - condlst_add(&shadow_blacklist, + condlst_add(&options.shadow_blacklist, config_setting_get_string_elem(setting, i)); } } // Treat it as a single pattern if it's a string else if (CONFIG_TYPE_STRING == config_setting_type(setting)) { - condlst_add(&shadow_blacklist, + condlst_add(&options.shadow_blacklist, config_setting_get_string(setting)); } } @@ -3254,57 +3233,57 @@ get_cfg(int argc, char *const *argv) { switch (o) { // Short options case 'd': - display = optarg; + options.display = optarg; break; case 'D': - fade_delta = atoi(optarg); + options.fade_delta = atoi(optarg); break; case 'I': - fade_in_step = normalize_d(atof(optarg)) * OPAQUE; + options.fade_in_step = normalize_d(atof(optarg)) * OPAQUE; break; case 'O': - fade_out_step = normalize_d(atof(optarg)) * OPAQUE; + options.fade_out_step = normalize_d(atof(optarg)) * OPAQUE; break; case 'c': - if (2 != shadow_enable) - shadow_enable = 1; + if (2 != options.shadow_enable) + options.shadow_enable = 1; break; case 'C': - no_dock_shadow = True; + options.no_dock_shadow = True; break; case 'm': - menu_opacity = atof(optarg); + options.menu_opacity = atof(optarg); break; case 'f': - if (2 != fading_enable) - fading_enable = 1; + if (2 != options.fading_enable) + options.fading_enable = 1; break; case 'F': - fade_trans = True; + options.fade_trans = True; break; case 'S': - synchronize = True; + options.synchronize = True; break; case 'r': - shadow_radius = atoi(optarg); + options.shadow_radius = atoi(optarg); break; case 'o': - shadow_opacity = atof(optarg); + options.shadow_opacity = atof(optarg); break; case 'l': - shadow_offset_x = atoi(optarg); + options.shadow_offset_x = atoi(optarg); break; case 't': - shadow_offset_y = atoi(optarg); + options.shadow_offset_y = atoi(optarg); break; case 'i': - inactive_opacity = (normalize_d(atof(optarg)) * OPAQUE); + options.inactive_opacity = (normalize_d(atof(optarg)) * OPAQUE); break; case 'e': - frame_opacity = atof(optarg); + options.frame_opacity = atof(optarg); break; case 'z': - clear_shadow = True; + options.clear_shadow = True; break; case 'n': case 'a': @@ -3313,10 +3292,10 @@ get_cfg(int argc, char *const *argv) { "-n, -a, and -s have been removed.\n"); break; case 'G': - no_dnd_shadow = True; + options.no_dnd_shadow = True; break; case 'b': - fork_after_register = True; + options.fork_after_register = True; break; // Long options case 256: @@ -3324,31 +3303,31 @@ get_cfg(int argc, char *const *argv) { break; case 257: // --shadow-red - shadow_red = atof(optarg); + options.shadow_red = atof(optarg); break; case 258: // --shadow-green - shadow_green = atof(optarg); + options.shadow_green = atof(optarg); break; case 259: // --shadow-blue - shadow_blue = atof(optarg); + options.shadow_blue = atof(optarg); break; case 260: // --inactive-opacity-override - inactive_opacity_override = True; + options.inactive_opacity_override = True; break; case 261: // --inactive-dim - inactive_dim = atof(optarg); + options.inactive_dim = atof(optarg); break; case 262: // --mark-wmwin-focused - mark_wmwin_focused = True; + options.mark_wmwin_focused = True; break; case 263: // --shadow-exclude - condlst_add(&shadow_blacklist, optarg); + condlst_add(&options.shadow_blacklist, optarg); break; default: usage(); @@ -3357,43 +3336,43 @@ get_cfg(int argc, char *const *argv) { } // Range checking and option assignments - fade_delta = max_i(fade_delta, 1); - shadow_radius = max_i(shadow_radius, 1); - shadow_red = normalize_d(shadow_red); - shadow_green = normalize_d(shadow_green); - shadow_blue = normalize_d(shadow_blue); - inactive_dim = normalize_d(inactive_dim); - frame_opacity = normalize_d(frame_opacity); - shadow_opacity = normalize_d(shadow_opacity); - menu_opacity = normalize_d(menu_opacity); - if (OPAQUE == inactive_opacity) { - inactive_opacity = 0; - } - if (1 == shadow_enable) + options.fade_delta = max_i(options.fade_delta, 1); + options.shadow_radius = max_i(options.shadow_radius, 1); + options.shadow_red = normalize_d(options.shadow_red); + options.shadow_green = normalize_d(options.shadow_green); + options.shadow_blue = normalize_d(options.shadow_blue); + options.inactive_dim = normalize_d(options.inactive_dim); + options.frame_opacity = normalize_d(options.frame_opacity); + options.shadow_opacity = normalize_d(options.shadow_opacity); + options.menu_opacity = normalize_d(options.menu_opacity); + if (OPAQUE == options.inactive_opacity) { + options.inactive_opacity = 0; + } + if (1 == options.shadow_enable) wintype_arr_enable(win_type_shadow); win_type_shadow[WINTYPE_DESKTOP] = False; - if (no_dock_shadow) + if (options.no_dock_shadow) win_type_shadow[WINTYPE_DOCK] = False; - if (no_dnd_shadow) + if (options.no_dnd_shadow) win_type_shadow[WINTYPE_DND] = False; - if (1 == fading_enable) { + if (1 == options.fading_enable) { wintype_arr_enable(win_type_fade); } - if (1.0 != menu_opacity) { - win_type_opacity[WINTYPE_DROPDOWN_MENU] = menu_opacity; - win_type_opacity[WINTYPE_POPUP_MENU] = menu_opacity; + if (1.0 != options.menu_opacity) { + win_type_opacity[WINTYPE_DROPDOWN_MENU] = options.menu_opacity; + win_type_opacity[WINTYPE_POPUP_MENU] = options.menu_opacity; } // Other variables determined by options // Determine whether we need to track focus changes - if (inactive_opacity || inactive_dim) { - track_focus = True; + if (options.inactive_opacity || options.inactive_dim) { + options.track_focus = True; } // Determine whether we need to track window name and class - if (shadow_blacklist || fade_blacklist) - track_wdata = True; + if (options.shadow_blacklist || options.fade_blacklist) + options.track_wdata = True; } static void @@ -3459,16 +3438,16 @@ main(int argc, char **argv) { get_cfg(argc, argv); - fade_time = get_time_in_milliseconds(); + options.fade_time = get_time_in_milliseconds(); - dpy = XOpenDisplay(display); + dpy = XOpenDisplay(options.display); if (!dpy) { fprintf(stderr, "Can't open display\n"); exit(1); } XSetErrorHandler(error); - if (synchronize) { + if (options.synchronize) { XSynchronize(dpy, 1); } @@ -3510,13 +3489,13 @@ main(int argc, char **argv) { register_cm(scr); - if (fork_after_register) fork_after(); + if (options.fork_after_register) fork_after(); get_atoms(); pa.subwindow_mode = IncludeInferiors; - gaussian_map = make_gaussian_map(dpy, shadow_radius); + gaussian_map = make_gaussian_map(dpy, options.shadow_radius); presum_gaussian(gaussian_map); root_width = DisplayWidth(dpy, scr); @@ -3530,16 +3509,16 @@ main(int argc, char **argv) { // Generates another Picture for shadows if the color is modified by // user - if (!shadow_red && !shadow_green && !shadow_blue) { + if (!options.shadow_red && !options.shadow_green && !options.shadow_blue) { cshadow_picture = black_picture; } else { cshadow_picture = solid_picture(dpy, True, 1, - shadow_red, shadow_green, shadow_blue); + options.shadow_red, options.shadow_green, options.shadow_blue); } - // Generates a picture for inactive_dim - if (inactive_dim) { - dim_picture = solid_picture(dpy, True, inactive_dim, 0, 0, 0); + // Generates a picture for options.inactive_dim + if (options.inactive_dim) { + dim_picture = solid_picture(dpy, True, options.inactive_dim, 0, 0, 0); } all_damage = None; @@ -3563,7 +3542,7 @@ main(int argc, char **argv) { XFree(children); - if (track_focus) { + if (options.track_focus) { recheck_focus(dpy); } @@ -241,6 +241,64 @@ typedef struct _win { struct _win *prev_trans; } win; +typedef struct _options { + char *display; + int shadow_radius; + int shadow_offset_x; + int shadow_offset_y; + double shadow_opacity; + + /// How much to fade in in a single fading step. + opacity_t fade_in_step; + /// How much to fade out in a single fading step. + opacity_t fade_out_step; + unsigned long fade_delta; + unsigned long fade_time; + Bool fade_trans; + + Bool clear_shadow; + + /// Default opacity for inactive windows. + /// 32-bit integer with the format of _NET_WM_OPACITY. 0 stands for + /// not enabled, default. + opacity_t inactive_opacity; + /// Whether inactive_opacity overrides the opacity set by window + /// attributes. + Bool inactive_opacity_override; + double frame_opacity; + /// How much to dim an inactive window. 0.0 - 1.0, 0 to disable. + double inactive_dim; + + /// Whether to try to detect WM windows and mark them as focused. + double mark_wmwin_focused; + + /// Whether compton needs to track focus changes. + Bool track_focus; + /// Whether compton needs to track window name and class. + Bool track_wdata; + + /// Shadow blacklist. A linked list of conditions. + wincond *shadow_blacklist; + /// Fading blacklist. A linked list of conditions. + wincond *fade_blacklist; + + /// Whether to fork to background. + Bool fork_after_register; + /// Red, green and blue tone of the shadow. + double shadow_red; + double shadow_green; + double shadow_blue; + + Bool synchronize; + + // Temporary options + int shadow_enable; + int fading_enable; + Bool no_dock_shadow; + Bool no_dnd_shadow; + double menu_opacity; +} options_t; + typedef struct _conv { int size; double *data; |