enabled cairo
[monky] / src / x11.c
index 6f29d4f..ba65fcb 100644 (file)
--- a/src/x11.c
+++ b/src/x11.c
@@ -44,7 +44,7 @@
 
 #ifdef XFT
 #include <X11/Xft/Xft.h>
-int use_xft = 0;
+int use_xft;
 #endif
 
 #ifdef HAVE_XDBE
@@ -53,9 +53,9 @@ int use_xdbe;
 
 #ifdef USE_ARGB
 int use_argb_visual;
-int own_window_argb_value;
 int have_argb_visual;
 #endif /* USE_ARGB */
+int own_window_argb_value;
 
 /* some basic X11 stuff */
 Display *display = NULL;
@@ -177,11 +177,11 @@ static Window find_desktop_window(Window *p_root, Window *p_desktop)
        return win;
 }
 
+static int colour_set = -1;
 /* if no argb visual is configured sets background to ParentRelative for the Window and all parents,
    else real transparency is used */
 void set_transparent_background(Window win, int alpha)
 {
-       static int colour_set = -1;
        (void)alpha; /* disable warnings when unused */
 
 #ifdef USE_ARGB
@@ -197,7 +197,7 @@ void set_transparent_background(Window win, int alpha)
        } else {
 #endif /* USE_ARGB */
        // pseudo transparency
-       
+
        if (set_transparent) {
                Window parent = win;
                unsigned int i;
@@ -226,7 +226,7 @@ static int get_argb_visual(Visual** visual, int *depth) {
        XVisualInfo visual_template;
        XVisualInfo *visual_list;
        int nxvisuals = 0, i;
-       
+
        visual_template.screen = screen;
        visual_list = XGetVisualInfo (display, VisualScreenMask,
                                &visual_template, &nxvisuals);
@@ -238,11 +238,13 @@ static int get_argb_visual(Visual** visual, int *depth) {
                        *visual = visual_list[i].visual;
                        *depth = visual_list[i].depth;
                        DBGP("Found ARGB Visual");
+                       XFree(visual_list);
                        return 1;
                }
        }
        // no argb visual available
        DBGP("No ARGB Visual found");
+       XFree(visual_list);
        return 0;
 }
 #endif /* USE_ARGB */
@@ -258,6 +260,7 @@ void destroy_window(void)
                XFreeGC(display, window.gc);
        }
        memset(&window, 0, sizeof(struct conky_window));
+       colour_set = -1;
 }
 
 void init_window(int own_window, int w, int h, int set_trans, int back_colour,
@@ -274,11 +277,11 @@ void init_window(int own_window, int w, int h, int set_trans, int back_colour,
        if (own_window) {
                int depth = 0, flags;
                Visual *visual = NULL;
-               
+
                if (!find_desktop_window(&window.root, &window.desktop)) {
                        return;
                }
-               
+
 #ifdef USE_ARGB
                if (use_argb_visual && get_argb_visual(&visual, &depth)) {
                        have_argb_visual = 1;
@@ -333,7 +336,7 @@ void init_window(int own_window, int w, int h, int set_trans, int back_colour,
                        XClassHint classHint;
                        XWMHints wmHint;
                        Atom xa;
-                       
+
 #ifdef USE_ARGB
                        if (have_argb_visual) {
                                attrs.colormap = window.colourmap;
@@ -500,13 +503,13 @@ void init_window(int own_window, int w, int h, int set_trans, int back_colour,
                        }
 
                        /* Skip pager */
-                       if (TEST_HINT(window.hints, HINT_SKIP_PAGER)) {
+                       if (TEST_HINT(window.hints, HINT_FULLSCREEN)) {
                                /* fprintf(stderr, PACKAGE_NAME": hint - skip_pager\n");
                                   fflush(stderr); */
 
                                xa = ATOM(_NET_WM_STATE);
                                if (xa != None) {
-                                       Atom xa_prop = ATOM(_NET_WM_STATE_SKIP_PAGER);
+                                       Atom xa_prop = ATOM(_NET_WM_STATE_FULLSCREEN);
 
                                        XChangeProperty(display, window.window, xa, XA_ATOM, 32,
                                                        PropModeAppend, (unsigned char *) &xa_prop, 1);
@@ -528,6 +531,8 @@ void init_window(int own_window, int w, int h, int set_trans, int back_colour,
                if (!window.window) {
                        window.window = find_desktop_window(&window.root, &window.desktop);
                }
+               window.visual = DefaultVisual(display, screen);
+               window.colourmap = DefaultColormap(display, screen);
 
                if (XGetWindowAttributes(display, window.window, &attrs)) {
                        window.width = attrs.width;
@@ -770,13 +775,14 @@ void get_x11_desktop_info(Display *current_display, Atom atom)
        }
 }
 
-void update_x11info(void)
+int update_x11info(void)
 {
        struct information *current_info = &info;
-       if (!x_initialised == YES)
-               return;
+       if (x_initialised != YES)
+               return 0;
        current_info->x11.monitor.number = XScreenCount(display);
        current_info->x11.monitor.current = XDefaultScreen(display);
+       return 0;
 }
 
 #ifdef OWN_WINDOW