mirror of
https://github.com/Llewellynvdm/conky.git
synced 2025-01-29 01:58:26 +00:00
Merge branch 'master' of git.omp.am:/home/omp/git/conky
This commit is contained in:
commit
1e5bc370e4
10
src/conky.c
10
src/conky.c
@ -7478,14 +7478,22 @@ void clean_up(void)
|
|||||||
}
|
}
|
||||||
#ifdef X11
|
#ifdef X11
|
||||||
if (x_initialised == YES) {
|
if (x_initialised == YES) {
|
||||||
|
destroy_window();
|
||||||
free_fonts();
|
free_fonts();
|
||||||
if(x11_stuff.region) {
|
if(x11_stuff.region) {
|
||||||
XDestroyRegion(x11_stuff.region);
|
XDestroyRegion(x11_stuff.region);
|
||||||
x11_stuff.region = NULL;
|
x11_stuff.region = NULL;
|
||||||
}
|
}
|
||||||
destroy_window();
|
|
||||||
XClearWindow(display, RootWindow(display, screen));
|
XClearWindow(display, RootWindow(display, screen));
|
||||||
XCloseDisplay(display);
|
XCloseDisplay(display);
|
||||||
|
if(info.x11.desktop.all_names) {
|
||||||
|
free(info.x11.desktop.all_names);
|
||||||
|
info.x11.desktop.all_names = NULL;
|
||||||
|
}
|
||||||
|
if (info.x11.desktop.name) {
|
||||||
|
free(info.x11.desktop.name);
|
||||||
|
info.x11.desktop.name = NULL;
|
||||||
|
}
|
||||||
}else{
|
}else{
|
||||||
free(fonts); //in set_default_configurations a font is set but not loaded
|
free(fonts); //in set_default_configurations a font is set but not loaded
|
||||||
}
|
}
|
||||||
|
35
src/x11.c
35
src/x11.c
@ -194,7 +194,6 @@ void set_transparent_background(Window win)
|
|||||||
|
|
||||||
void destroy_window(void)
|
void destroy_window(void)
|
||||||
{
|
{
|
||||||
XDestroyWindow(display, window.window);
|
|
||||||
XFreeGC(display, window.gc);
|
XFreeGC(display, window.gc);
|
||||||
memset(&window, 0, sizeof(struct conky_window));
|
memset(&window, 0, sizeof(struct conky_window));
|
||||||
}
|
}
|
||||||
@ -560,7 +559,7 @@ void create_gc(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Get current desktop number
|
//Get current desktop number
|
||||||
static inline void get_x11_desktop_current(Display *display, Window root, Atom atom)
|
static inline void get_x11_desktop_current(Display *current_display, Window root, Atom atom)
|
||||||
{
|
{
|
||||||
Atom actual_type;
|
Atom actual_type;
|
||||||
int actual_format;
|
int actual_format;
|
||||||
@ -569,7 +568,7 @@ static inline void get_x11_desktop_current(Display *display, Window root, Atom a
|
|||||||
unsigned char *prop = NULL;
|
unsigned char *prop = NULL;
|
||||||
struct information *current_info = &info;
|
struct information *current_info = &info;
|
||||||
|
|
||||||
if ( (XGetWindowProperty( display, root, atom,
|
if ( (XGetWindowProperty( current_display, root, atom,
|
||||||
0, 1L, False, XA_CARDINAL,
|
0, 1L, False, XA_CARDINAL,
|
||||||
&actual_type, &actual_format, &nitems,
|
&actual_type, &actual_format, &nitems,
|
||||||
&bytes_after, &prop ) == Success ) &&
|
&bytes_after, &prop ) == Success ) &&
|
||||||
@ -583,7 +582,7 @@ static inline void get_x11_desktop_current(Display *display, Window root, Atom a
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Get total number of available desktops
|
//Get total number of available desktops
|
||||||
static inline void get_x11_desktop_number(Display *display, Window root, Atom atom)
|
static inline void get_x11_desktop_number(Display *current_display, Window root, Atom atom)
|
||||||
{
|
{
|
||||||
Atom actual_type;
|
Atom actual_type;
|
||||||
int actual_format;
|
int actual_format;
|
||||||
@ -592,7 +591,7 @@ static inline void get_x11_desktop_number(Display *display, Window root, Atom at
|
|||||||
unsigned char *prop = NULL;
|
unsigned char *prop = NULL;
|
||||||
struct information *current_info = &info;
|
struct information *current_info = &info;
|
||||||
|
|
||||||
if ( (XGetWindowProperty( display, root, atom,
|
if ( (XGetWindowProperty( current_display, root, atom,
|
||||||
0, 1L, False, XA_CARDINAL,
|
0, 1L, False, XA_CARDINAL,
|
||||||
&actual_type, &actual_format, &nitems,
|
&actual_type, &actual_format, &nitems,
|
||||||
&bytes_after, &prop ) == Success ) &&
|
&bytes_after, &prop ) == Success ) &&
|
||||||
@ -606,7 +605,7 @@ static inline void get_x11_desktop_number(Display *display, Window root, Atom at
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Get all desktop names
|
//Get all desktop names
|
||||||
static inline void get_x11_desktop_names(Display *display, Window root, Atom atom)
|
static inline void get_x11_desktop_names(Display *current_display, Window root, Atom atom)
|
||||||
{
|
{
|
||||||
Atom actual_type;
|
Atom actual_type;
|
||||||
int actual_format;
|
int actual_format;
|
||||||
@ -615,7 +614,7 @@ static inline void get_x11_desktop_names(Display *display, Window root, Atom ato
|
|||||||
unsigned char *prop = NULL;
|
unsigned char *prop = NULL;
|
||||||
struct information *current_info = &info;
|
struct information *current_info = &info;
|
||||||
|
|
||||||
if ( (XGetWindowProperty( display, root, atom,
|
if ( (XGetWindowProperty( current_display, root, atom,
|
||||||
0, (~0L), False, ATOM(UTF8_STRING),
|
0, (~0L), False, ATOM(UTF8_STRING),
|
||||||
&actual_type, &actual_format, &nitems,
|
&actual_type, &actual_format, &nitems,
|
||||||
&bytes_after, &prop ) == Success ) &&
|
&bytes_after, &prop ) == Success ) &&
|
||||||
@ -659,22 +658,22 @@ static inline void get_x11_desktop_current_name(char *names)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void get_x11_desktop_info(Display *display, Atom atom)
|
void get_x11_desktop_info(Display *current_display, Atom atom)
|
||||||
{
|
{
|
||||||
Window root;
|
Window root;
|
||||||
static Atom atom_current, atom_number, atom_names;
|
static Atom atom_current, atom_number, atom_names;
|
||||||
struct information *current_info = &info;
|
struct information *current_info = &info;
|
||||||
|
|
||||||
root = RootWindow(display, current_info->x11.monitor.current);
|
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) {
|
if (atom == 0) {
|
||||||
atom_current = XInternAtom(display, "_NET_CURRENT_DESKTOP", True);
|
atom_current = XInternAtom(current_display, "_NET_CURRENT_DESKTOP", True);
|
||||||
atom_number = XInternAtom(display, "_NET_NUMBER_OF_DESKTOPS", True);
|
atom_number = XInternAtom(current_display, "_NET_NUMBER_OF_DESKTOPS", True);
|
||||||
atom_names = XInternAtom(display, "_NET_DESKTOP_NAMES", True);
|
atom_names = XInternAtom(current_display, "_NET_DESKTOP_NAMES", True);
|
||||||
get_x11_desktop_current(display, root, atom_current);
|
get_x11_desktop_current(current_display, root, atom_current);
|
||||||
get_x11_desktop_number(display, root, atom_number);
|
get_x11_desktop_number(current_display, root, atom_number);
|
||||||
get_x11_desktop_names(display, root, atom_names);
|
get_x11_desktop_names(current_display, root, atom_names);
|
||||||
get_x11_desktop_current_name(current_info->x11.desktop.all_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
|
||||||
@ -688,12 +687,12 @@ void get_x11_desktop_info(Display *display, Atom atom)
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (atom == atom_current) {
|
if (atom == atom_current) {
|
||||||
get_x11_desktop_current(display, root, atom_current);
|
get_x11_desktop_current(current_display, root, atom_current);
|
||||||
get_x11_desktop_current_name(current_info->x11.desktop.all_names);
|
get_x11_desktop_current_name(current_info->x11.desktop.all_names);
|
||||||
} else if (atom == atom_number) {
|
} else if (atom == atom_number) {
|
||||||
get_x11_desktop_number(display, root, atom_number);
|
get_x11_desktop_number(current_display, root, atom_number);
|
||||||
} else if (atom == atom_names) {
|
} else if (atom == atom_names) {
|
||||||
get_x11_desktop_names(display, root, atom_names);
|
get_x11_desktop_names(current_display, root, atom_names);
|
||||||
get_x11_desktop_current_name(current_info->x11.desktop.all_names);
|
get_x11_desktop_current_name(current_info->x11.desktop.all_names);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user