Bug fix #84: Root window not repainted sometimes on wallpaper change
- Fix a bug that root window is not repainted on wallpaper change unless an Expose X event is received. Seemingly, if there's no mapped window on a screen, X will not send an Expose event when the wallpaper changes. Thanks to baskerville for reporting. - Fix a X Pixmap leak when there's no existing wallpaper pixmap found. - Fix a bug in mstrncpy() that null character is not added to the end of the copied string. - Make VSYNC_STRS public, for use in src/dbus.c. Adjust the type of WINTYPES array. Add NUM_VSYNC. - Add more targets for various D-Bus methods. Add "bad_target" D-Bus error. Improve error handling. Add more helper functions to append arguments to a D-Bus message. Add Introspect method to D-Bus introspection reply. - Add public declarations of things in the new condition format code to common.h. Move definitions of some inline functions from compton.h to common.h. Make some functions public. Move wid_get_prop_adv() to compton.c. The primary code files of the new format src/c2.{c,h} will be published when ready. - Add support for dumping version string in Makefile (make version), to make snapshot generation easier. - Add repeated inclusion protection to common.h. - Update documentation. - Use gsed instead of sed in dbus-examples/cdbus-driver.sh if possible, as some BSD systems does not come with GNU sed by default. Thanks to DaChiChang for reporting. - Code clean-up. Small type changes in register_cm() to silence warnings. Quit on failure in parse_vsync(). Apply stricter checks in force_repaint().
This commit is contained in:
128
src/compton.h
128
src/compton.h
@ -52,14 +52,6 @@ set_ignore_next(session_t *ps) {
|
||||
static int
|
||||
should_ignore(session_t *ps, unsigned long sequence);
|
||||
|
||||
/**
|
||||
* Wrapper of XInternAtom() for convenience.
|
||||
*/
|
||||
static inline Atom
|
||||
get_atom(session_t *ps, const char *atom_name) {
|
||||
return XInternAtom(ps->dpy, atom_name, False);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the painting target window.
|
||||
*/
|
||||
@ -291,122 +283,6 @@ static Picture
|
||||
solid_picture(session_t *ps, bool argb, double a,
|
||||
double r, double g, double b);
|
||||
|
||||
/**
|
||||
* Determine if a window has a specific property.
|
||||
*
|
||||
* @param session_t current session
|
||||
* @param w window to check
|
||||
* @param atom atom of property to check
|
||||
* @return 1 if it has the attribute, 0 otherwise
|
||||
*/
|
||||
static inline bool
|
||||
wid_has_prop(const session_t *ps, Window w, Atom atom) {
|
||||
Atom type = None;
|
||||
int format;
|
||||
unsigned long nitems, after;
|
||||
unsigned char *data;
|
||||
|
||||
if (Success == XGetWindowProperty(ps->dpy, w, atom, 0, 0, False,
|
||||
AnyPropertyType, &type, &format, &nitems, &after, &data)) {
|
||||
XFree(data);
|
||||
if (type) return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a specific attribute of a window.
|
||||
*
|
||||
* Returns a blank structure if the returned type and format does not
|
||||
* match the requested type and format.
|
||||
*
|
||||
* @param session_t current session
|
||||
* @param w window
|
||||
* @param atom atom of attribute to fetch
|
||||
* @param length length to read
|
||||
* @param rtype atom of the requested type
|
||||
* @param rformat requested format
|
||||
* @return a <code>winprop_t</code> structure containing the attribute
|
||||
* and number of items. A blank one on failure.
|
||||
*/
|
||||
// TODO: Move to compton.c
|
||||
static winprop_t
|
||||
wid_get_prop_adv(const session_t *ps, Window w, Atom atom, long offset,
|
||||
long length, Atom rtype, int rformat) {
|
||||
Atom type = None;
|
||||
int format = 0;
|
||||
unsigned long nitems = 0, after = 0;
|
||||
unsigned char *data = NULL;
|
||||
|
||||
if (Success == XGetWindowProperty(ps->dpy, w, atom, offset, length,
|
||||
False, rtype, &type, &format, &nitems, &after, &data)
|
||||
&& nitems && (AnyPropertyType == type || type == rtype)
|
||||
&& (!format || format == rformat)
|
||||
&& (8 == format || 16 == format || 32 == format)) {
|
||||
return (winprop_t) {
|
||||
.data.p8 = data,
|
||||
.nitems = nitems,
|
||||
.type = type,
|
||||
.format = format,
|
||||
};
|
||||
}
|
||||
|
||||
XFree(data);
|
||||
|
||||
return (winprop_t) {
|
||||
.data.p8 = NULL,
|
||||
.nitems = 0,
|
||||
.type = AnyPropertyType,
|
||||
.format = 0
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrapper of wid_get_prop_adv().
|
||||
*/
|
||||
static inline winprop_t
|
||||
wid_get_prop(const session_t *ps, Window wid, Atom atom, long length,
|
||||
Atom rtype, int rformat) {
|
||||
return wid_get_prop_adv(ps, wid, atom, 0L, length, rtype, rformat);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the numeric property value from a win_prop_t.
|
||||
*/
|
||||
static inline long
|
||||
winprop_get_int(winprop_t prop) {
|
||||
long tgt = 0;
|
||||
|
||||
if (!prop.nitems)
|
||||
return 0;
|
||||
|
||||
switch (prop.format) {
|
||||
case 8: tgt = *(prop.data.p8); break;
|
||||
case 16: tgt = *(prop.data.p16); break;
|
||||
case 32: tgt = *(prop.data.p32); break;
|
||||
default: assert(0);
|
||||
break;
|
||||
}
|
||||
|
||||
return tgt;
|
||||
}
|
||||
|
||||
/**
|
||||
* Free a <code>winprop_t</code>.
|
||||
*
|
||||
* @param pprop pointer to the <code>winprop_t</code> to free.
|
||||
*/
|
||||
static inline void
|
||||
free_winprop(winprop_t *pprop) {
|
||||
// Empty the whole structure to avoid possible issues
|
||||
if (pprop->data.p8) {
|
||||
XFree(pprop->data.p8);
|
||||
pprop->data.p8 = NULL;
|
||||
}
|
||||
pprop->nitems = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Stop listening for events on a particular window.
|
||||
*/
|
||||
@ -768,10 +644,6 @@ error(Display *dpy, XErrorEvent *ev);
|
||||
static void
|
||||
expose_root(session_t *ps, XRectangle *rects, int nrects);
|
||||
|
||||
static bool
|
||||
wid_get_text_prop(session_t *ps, Window wid, Atom prop,
|
||||
char ***pstrlst, int *pnstr);
|
||||
|
||||
static Window
|
||||
wid_get_prop_window(session_t *ps, Window wid, Atom aprop);
|
||||
|
||||
|
Reference in New Issue
Block a user