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