mirror of
https://github.com/Llewellynvdm/conky.git
synced 2024-11-18 02:55:12 +00:00
Fix problem with invalid window props?
We should check to make sure the atom actually exists before trying to retrieve the property.
This commit is contained in:
parent
73eaf0cfc3
commit
6c6711aa6d
10
src/x11.c
10
src/x11.c
@ -574,6 +574,8 @@ static inline void get_x11_desktop_current(Display *current_display, Window root
|
||||
unsigned char *prop = NULL;
|
||||
struct information *current_info = &info;
|
||||
|
||||
if (atom == None) return;
|
||||
|
||||
if ( (XGetWindowProperty( current_display, root, atom,
|
||||
0, 1L, False, XA_CARDINAL,
|
||||
&actual_type, &actual_format, &nitems,
|
||||
@ -597,6 +599,8 @@ static inline void get_x11_desktop_number(Display *current_display, Window root,
|
||||
unsigned char *prop = NULL;
|
||||
struct information *current_info = &info;
|
||||
|
||||
if (atom == None) return;
|
||||
|
||||
if ( (XGetWindowProperty( current_display, root, atom,
|
||||
0, 1L, False, XA_CARDINAL,
|
||||
&actual_type, &actual_format, &nitems,
|
||||
@ -620,6 +624,8 @@ static inline void get_x11_desktop_names(Display *current_display, Window root,
|
||||
unsigned char *prop = NULL;
|
||||
struct information *current_info = &info;
|
||||
|
||||
if (atom == None) return;
|
||||
|
||||
if ( (XGetWindowProperty( current_display, root, atom,
|
||||
0, (~0L), False, ATOM(UTF8_STRING),
|
||||
&actual_type, &actual_format, &nitems,
|
||||
@ -673,7 +679,7 @@ void get_x11_desktop_info(Display *current_display, Atom atom)
|
||||
|
||||
root = RootWindow(current_display, current_info->x11.monitor.current);
|
||||
|
||||
//Check if we initialise else retrieve changed property
|
||||
/* Check if we initialise else retrieve changed property */
|
||||
if (atom == 0) {
|
||||
atom_current = XInternAtom(current_display, "_NET_CURRENT_DESKTOP", True);
|
||||
atom_number = XInternAtom(current_display, "_NET_NUMBER_OF_DESKTOPS", True);
|
||||
@ -683,7 +689,7 @@ void get_x11_desktop_info(Display *current_display, Atom atom)
|
||||
get_x11_desktop_names(current_display, root, atom_names);
|
||||
get_x11_desktop_current_name(current_info->x11.desktop.all_names);
|
||||
|
||||
//Set the PropertyChangeMask on the root window, if not set
|
||||
/* Set the PropertyChangeMask on the root window, if not set */
|
||||
XGetWindowAttributes(display, root, &window_attributes);
|
||||
if (!(window_attributes.your_event_mask & PropertyChangeMask)) {
|
||||
XSetWindowAttributes attributes;
|
||||
|
Loading…
Reference in New Issue
Block a user