Bug fix: Wrong file path being displayed on config file parsing error
- Fix a bug that causes wrong file path being displayed on configuration file parsing error. - Continue dropping unused parameters and silence clang warnings. - Add conky shadow exclusion rule to compton.sample.conf.
This commit is contained in:
parent
e912fcde7b
commit
9ca20e7e32
|
@ -10,7 +10,7 @@ shadow-offset-y = -7;
|
|||
# shadow-red = 0.0;
|
||||
# shadow-green = 0.0;
|
||||
# shadow-blue = 0.0;
|
||||
shadow-exclude = [ "n:e:Notification" ];
|
||||
shadow-exclude = [ "n:e:Notification", "g:e:Conky" ];
|
||||
# shadow-exclude = "n:e:Notification";
|
||||
shadow-ignore-shaped = false;
|
||||
|
||||
|
|
|
@ -970,7 +970,7 @@ root_tile_f(session_t *ps) {
|
|||
XInternAtom(ps->dpy, background_props_str[p], false),
|
||||
1L, XA_PIXMAP, 32);
|
||||
if (prop.nitems) {
|
||||
pixmap = *((long *) prop.data);
|
||||
pixmap = *prop.data.p32;
|
||||
fill = false;
|
||||
free_winprop(&prop);
|
||||
break;
|
||||
|
@ -1174,7 +1174,7 @@ get_frame_extents(session_t *ps, win *w, Window client) {
|
|||
4L, XA_CARDINAL, 32);
|
||||
|
||||
if (4 == prop.nitems) {
|
||||
long *extents = (long *) prop.data;
|
||||
const long * const extents = prop.data.p32;
|
||||
w->left_width = extents[0];
|
||||
w->right_width = extents[1];
|
||||
w->top_width = extents[2];
|
||||
|
@ -1192,8 +1192,9 @@ get_frame_extents(session_t *ps, win *w, Window client) {
|
|||
*/
|
||||
static inline Picture
|
||||
get_alpha_pict_d(session_t *ps, double o) {
|
||||
assert((lround(normalize_d(o) / ps->o.alpha_step)) <= lround(1.0 / ps->o.alpha_step));
|
||||
return ps->alpha_picts[lround(normalize_d(o) / ps->o.alpha_step)];
|
||||
assert((round(normalize_d(o) / ps->o.alpha_step)) <= round(1.0 / ps->o.alpha_step));
|
||||
return ps->alpha_picts[(int) (round(normalize_d(o)
|
||||
/ ps->o.alpha_step))];
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1754,7 +1755,7 @@ wid_get_prop_wintype(session_t *ps, Window wid) {
|
|||
|
||||
for (i = 0; i < prop.nitems; ++i) {
|
||||
for (j = 1; j < NUM_WINTYPES; ++j) {
|
||||
if (ps->atoms_wintypes[j] == (Atom) ((long *) prop.data)[i]) {
|
||||
if (ps->atoms_wintypes[j] == (Atom) prop.data.p32[i]) {
|
||||
free_winprop(&prop);
|
||||
return j;
|
||||
}
|
||||
|
@ -1767,7 +1768,7 @@ wid_get_prop_wintype(session_t *ps, Window wid) {
|
|||
}
|
||||
|
||||
static void
|
||||
map_win(session_t *ps, Window id, bool override_redirect) {
|
||||
map_win(session_t *ps, Window id) {
|
||||
win *w = find_win(ps, id);
|
||||
|
||||
// Don't care about window mapping if it's an InputOnly window
|
||||
|
@ -1938,7 +1939,7 @@ wid_get_opacity_prop(session_t *ps, Window wid, opacity_t def) {
|
|||
XA_CARDINAL, 32);
|
||||
|
||||
if (prop.nitems)
|
||||
val = *((long *) prop.data);
|
||||
val = *prop.data.p32;
|
||||
|
||||
free_winprop(&prop);
|
||||
|
||||
|
@ -2105,7 +2106,7 @@ win_update_attr_shadow_raw(session_t *ps, win *w) {
|
|||
w->attr_shadow = -1;
|
||||
}
|
||||
else {
|
||||
w->attr_shadow = *((long *) prop.data);
|
||||
w->attr_shadow = *prop.data.p32;
|
||||
}
|
||||
|
||||
free_winprop(&prop);
|
||||
|
@ -2216,7 +2217,7 @@ mark_client_win(session_t *ps, win *w, Window client) {
|
|||
}
|
||||
|
||||
static void
|
||||
add_win(session_t *ps, Window id, Window prev, bool override_redirect) {
|
||||
add_win(session_t *ps, Window id, Window prev) {
|
||||
// Reject overlay window and already added windows
|
||||
if (id == ps->overlay || find_win(ps, id)) {
|
||||
return;
|
||||
|
@ -2311,7 +2312,7 @@ add_win(session_t *ps, Window id, Window prev, bool override_redirect) {
|
|||
*p = new;
|
||||
|
||||
if (new->a.map_state == IsViewable) {
|
||||
map_win(ps, id, override_redirect);
|
||||
map_win(ps, id);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2550,7 +2551,7 @@ damage_win(session_t *ps, XDamageNotifyEvent *de) {
|
|||
* Xlib error handler function.
|
||||
*/
|
||||
static int
|
||||
error(Display *dpy, XErrorEvent *ev) {
|
||||
error(Display __attribute__((unused)) *dpy, XErrorEvent *ev) {
|
||||
session_t * const ps = ps_g;
|
||||
|
||||
int o;
|
||||
|
@ -2922,7 +2923,7 @@ ev_focus_out(session_t *ps, XFocusChangeEvent *ev) {
|
|||
inline static void
|
||||
ev_create_notify(session_t *ps, XCreateWindowEvent *ev) {
|
||||
assert(ev->parent == ps->root);
|
||||
add_win(ps, ev->window, 0, ev->override_redirect);
|
||||
add_win(ps, ev->window, 0);
|
||||
}
|
||||
|
||||
inline static void
|
||||
|
@ -2943,7 +2944,7 @@ ev_destroy_notify(session_t *ps, XDestroyWindowEvent *ev) {
|
|||
|
||||
inline static void
|
||||
ev_map_notify(session_t *ps, XMapEvent *ev) {
|
||||
map_win(ps, ev->window, ev->override_redirect);
|
||||
map_win(ps, ev->window);
|
||||
}
|
||||
|
||||
inline static void
|
||||
|
@ -2954,7 +2955,7 @@ ev_unmap_notify(session_t *ps, XUnmapEvent *ev) {
|
|||
inline static void
|
||||
ev_reparent_notify(session_t *ps, XReparentEvent *ev) {
|
||||
if (ev->parent == ps->root) {
|
||||
add_win(ps, ev->window, 0, ev->override_redirect);
|
||||
add_win(ps, ev->window, 0);
|
||||
} else {
|
||||
destroy_win(ps, ev->window);
|
||||
// Reset event mask in case something wrong happens
|
||||
|
@ -3019,7 +3020,7 @@ update_ewmh_active_win(session_t *ps) {
|
|||
}
|
||||
|
||||
// Search for the window
|
||||
Window wid = *((long *) prop.data);
|
||||
Window wid = *prop.data.p32;
|
||||
win *w = NULL;
|
||||
free_winprop(&prop);
|
||||
|
||||
|
@ -3144,7 +3145,8 @@ ev_shape_notify(session_t *ps, XShapeEvent *ev) {
|
|||
* Handle ScreenChangeNotify events from X RandR extension.
|
||||
*/
|
||||
static void
|
||||
ev_screen_change_notify(session_t *ps, XRRScreenChangeNotifyEvent *ev) {
|
||||
ev_screen_change_notify(session_t *ps,
|
||||
XRRScreenChangeNotifyEvent __attribute__((unused)) *ev) {
|
||||
if (!ps->o.refresh_rate) {
|
||||
update_refresh_rate(ps);
|
||||
if (!ps->refresh_rate) {
|
||||
|
@ -3270,7 +3272,7 @@ ev_handle(session_t *ps, XEvent *ev) {
|
|||
*/
|
||||
static void
|
||||
usage(void) {
|
||||
fputs(
|
||||
const static char *usage_text =
|
||||
"compton (development version)\n"
|
||||
"usage: compton [options]\n"
|
||||
"Options:\n"
|
||||
|
@ -3394,8 +3396,8 @@ usage(void) {
|
|||
" <flags> could be a series of flags. Currently the only defined\n"
|
||||
" flag is \"i\" (ignore case).\n"
|
||||
"\n"
|
||||
" <pattern> is the actual pattern string.\n"
|
||||
, stderr);
|
||||
" <pattern> is the actual pattern string.\n";
|
||||
fputs(usage_text , stderr);
|
||||
|
||||
exit(1);
|
||||
}
|
||||
|
@ -3642,9 +3644,17 @@ parse_config(session_t *ps, char *cpath, struct options_tmp *pcfgtmp) {
|
|||
|
||||
config_init(&cfg);
|
||||
#ifndef CONFIG_LIBCONFIG_LEGACY
|
||||
char *parent = dirname(path);
|
||||
if (parent)
|
||||
config_set_include_dir(&cfg, parent);
|
||||
{
|
||||
// dirname() could modify the original string, thus we must pass a
|
||||
// copy
|
||||
char *path2 = mstrcpy(path);
|
||||
char *parent = dirname(path2);
|
||||
|
||||
if (parent)
|
||||
config_set_include_dir(&cfg, parent);
|
||||
|
||||
free(path2);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (CONFIG_FALSE == config_read(&cfg, f)) {
|
||||
|
@ -4367,7 +4377,7 @@ vsync_wait(session_t *ps) {
|
|||
static void
|
||||
init_alpha_picts(session_t *ps) {
|
||||
int i;
|
||||
int num = lround(1.0 / ps->o.alpha_step) + 1;
|
||||
int num = round(1.0 / ps->o.alpha_step) + 1;
|
||||
|
||||
ps->alpha_picts = malloc(sizeof(Picture) * num);
|
||||
|
||||
|
@ -4620,8 +4630,6 @@ session_init(session_t *ps_old, int argc, char **argv) {
|
|||
.atoms_wintypes = { 0 }
|
||||
};
|
||||
|
||||
int i;
|
||||
|
||||
// Allocate a session and copy default values into it
|
||||
session_t *ps = malloc(sizeof(session_t));
|
||||
memcpy(ps, &s_def, sizeof(session_t));
|
||||
|
@ -4812,8 +4820,8 @@ session_init(session_t *ps_old, int argc, char **argv) {
|
|||
XQueryTree(ps->dpy, ps->root, &root_return,
|
||||
&parent_return, &children, &nchildren);
|
||||
|
||||
for (i = 0; i < nchildren; i++) {
|
||||
add_win(ps, children[i], i ? children[i-1] : None, false);
|
||||
for (unsigned i = 0; i < nchildren; i++) {
|
||||
add_win(ps, children[i], i ? children[i-1] : None);
|
||||
}
|
||||
|
||||
XFree(children);
|
||||
|
@ -4867,7 +4875,7 @@ session_destroy(session_t *ps) {
|
|||
|
||||
// Free alpha_picts
|
||||
{
|
||||
const int max = lround(1.0 / ps->o.alpha_step) + 1;
|
||||
const int max = round(1.0 / ps->o.alpha_step) + 1;
|
||||
for (int i = 0; i < max; ++i)
|
||||
free_picture(ps, &ps->alpha_picts[i]);
|
||||
free(ps->alpha_picts);
|
||||
|
|
|
@ -149,7 +149,13 @@ typedef enum {
|
|||
} winmode;
|
||||
|
||||
typedef struct {
|
||||
unsigned char *data;
|
||||
// All pointers have the same length, right?
|
||||
// I wanted to use anonymous union but it's a GNU extension...
|
||||
union {
|
||||
unsigned char *p8;
|
||||
short *p16;
|
||||
long *p32;
|
||||
} data;
|
||||
unsigned long nitems;
|
||||
} winprop_t;
|
||||
|
||||
|
@ -397,7 +403,7 @@ typedef struct {
|
|||
/// Currently used refresh rate.
|
||||
short refresh_rate;
|
||||
/// Interval between refresh in nanoseconds.
|
||||
unsigned long refresh_intv;
|
||||
long refresh_intv;
|
||||
/// Nanosecond offset of the first painting.
|
||||
long paint_tm_offset;
|
||||
|
||||
|
@ -844,13 +850,13 @@ timeval_subtract(struct timeval *result,
|
|||
struct timeval *y) {
|
||||
/* Perform the carry for the later subtraction by updating y. */
|
||||
if (x->tv_usec < y->tv_usec) {
|
||||
int nsec = (y->tv_usec - x->tv_usec) / 1000000 + 1;
|
||||
long nsec = (y->tv_usec - x->tv_usec) / 1000000 + 1;
|
||||
y->tv_usec -= 1000000 * nsec;
|
||||
y->tv_sec += nsec;
|
||||
}
|
||||
|
||||
if (x->tv_usec - y->tv_usec > 1000000) {
|
||||
int nsec = (x->tv_usec - y->tv_usec) / 1000000;
|
||||
long nsec = (x->tv_usec - y->tv_usec) / 1000000;
|
||||
y->tv_usec += 1000000 * nsec;
|
||||
y->tv_sec -= nsec;
|
||||
}
|
||||
|
@ -879,13 +885,13 @@ timespec_subtract(struct timespec *result,
|
|||
struct timespec *y) {
|
||||
/* Perform the carry for the later subtraction by updating y. */
|
||||
if (x->tv_nsec < y->tv_nsec) {
|
||||
int nsec = (y->tv_nsec - x->tv_nsec) / NS_PER_SEC + 1;
|
||||
long nsec = (y->tv_nsec - x->tv_nsec) / NS_PER_SEC + 1;
|
||||
y->tv_nsec -= NS_PER_SEC * nsec;
|
||||
y->tv_sec += nsec;
|
||||
}
|
||||
|
||||
if (x->tv_nsec - y->tv_nsec > NS_PER_SEC) {
|
||||
int nsec = (x->tv_nsec - y->tv_nsec) / NS_PER_SEC;
|
||||
long nsec = (x->tv_nsec - y->tv_nsec) / NS_PER_SEC;
|
||||
y->tv_nsec += NS_PER_SEC * nsec;
|
||||
y->tv_sec -= nsec;
|
||||
}
|
||||
|
@ -1036,7 +1042,8 @@ get_time_ms(void) {
|
|||
|
||||
gettimeofday(&tv, NULL);
|
||||
|
||||
return tv.tv_sec * 1000 + tv.tv_usec / 1000;
|
||||
return (unsigned long) tv.tv_sec * 1000
|
||||
+ (unsigned long) tv.tv_usec / 1000;
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -1144,7 +1151,7 @@ wid_get_prop(const session_t *ps, Window w, Atom atom, long length,
|
|||
rtype, &type, &format, &nitems, &after, &data)) {
|
||||
if (type == rtype && format == rformat) {
|
||||
return (winprop_t) {
|
||||
.data = data,
|
||||
.data.p8 = data,
|
||||
.nitems = nitems
|
||||
};
|
||||
}
|
||||
|
@ -1153,7 +1160,7 @@ wid_get_prop(const session_t *ps, Window w, Atom atom, long length,
|
|||
XFree(data);
|
||||
|
||||
return (winprop_t) {
|
||||
.data = NULL,
|
||||
.data.p8 = NULL,
|
||||
.nitems = 0
|
||||
};
|
||||
}
|
||||
|
@ -1166,9 +1173,9 @@ wid_get_prop(const session_t *ps, Window w, Atom atom, long length,
|
|||
static inline void
|
||||
free_winprop(winprop_t *pprop) {
|
||||
// Empty the whole structure to avoid possible issues
|
||||
if (pprop->data) {
|
||||
XFree(pprop->data);
|
||||
pprop->data = NULL;
|
||||
if (pprop->data.p8) {
|
||||
XFree(pprop->data.p8);
|
||||
pprop->data.p8 = NULL;
|
||||
}
|
||||
pprop->nitems = 0;
|
||||
}
|
||||
|
@ -1327,7 +1334,7 @@ static wintype_t
|
|||
wid_get_prop_wintype(session_t *ps, Window w);
|
||||
|
||||
static void
|
||||
map_win(session_t *ps, Window id, bool override_redirect);
|
||||
map_win(session_t *ps, Window id);
|
||||
|
||||
static void
|
||||
finish_map_win(session_t *ps, win *w);
|
||||
|
@ -1391,7 +1398,7 @@ static void
|
|||
mark_client_win(session_t *ps, win *w, Window client);
|
||||
|
||||
static void
|
||||
add_win(session_t *ps, Window id, Window prev, bool override_redirect);
|
||||
add_win(session_t *ps, Window id, Window prev);
|
||||
|
||||
static void
|
||||
restack_win(session_t *ps, win *w, Window new_above);
|
||||
|
|
Loading…
Reference in New Issue