minor
[monky] / src / conky.h
index a9d39fe..fb949ee 100644 (file)
@@ -9,6 +9,7 @@
 #ifndef _conky_h_
 #define _conky_h_
 
+#include <pthread.h>
 #if defined(HAS_MCHECK_H)
 #include <mcheck.h>
 #endif /* HAS_MCHECK_H */
@@ -19,8 +20,8 @@
 #include <locale.h>
 #include <langinfo.h>
 #include <wchar.h>
-#if defined(__FreeBSD__)
 #include <sys/param.h>
+#if defined(__FreeBSD__)
 #include <sys/mount.h>
 #include <sys/ucred.h>
 #endif /* __FreeBSD__ */
 #include <machine/apm_bios.h>
 #endif /* __FreeBSD__ */
 
+#if defined(XMMS) || defined(BMP) || defined(AUDACIOUS) || defined(INFOPIPE)
+#include "xmms.h"
+#endif
+
 #define TOP_CPU 1
 #define TOP_NAME 2
 #define TOP_PID 3
 #define TOP_MEM 4
 
-#define TEXT_BUFFER_SIZE 1024
+#define TEXT_BUFFER_SIZE 1280
 #define P_MAX_SIZE ((TEXT_BUFFER_SIZE * 4) - 2) 
 
 #include <sys/socket.h>
@@ -56,12 +61,14 @@ fprintf(stderr, "Conky: " s "\n", ##varargs)
 #define CRIT_ERR(s, varargs...) \
 { fprintf(stderr, "Conky: " s "\n", ##varargs);  exit(EXIT_FAILURE); }
 
+/* in sys/param.h
 #ifndef MIN
 #define MIN(a,b) (a>b ? b : a)
 #endif
 #ifndef MAX
 #define MAX(a,b) (a<b ? b : a)
 #endif
+*/
 
 struct i8k_struct {
        char *version;
@@ -112,9 +119,12 @@ struct mpd_s {
        char *random;
        char *repeat;
        char *track;
+       char *name;
+       char *file;
        int volume;
        unsigned int port;
        char host[128];
+       char password[128];
        float progress;
        int bitrate;
        int length;
@@ -122,7 +132,21 @@ struct mpd_s {
 };
 #endif
 
+#if defined(XMMS) || defined(BMP) || defined(AUDACIOUS) || defined(INFOPIPE)
+struct xmms_s {
+       unsigned int project_mask;
+       unsigned int current_project;
+       xmms_t items;                   /* e.g. items[XMMS_STATUS] yields char[] */
+       int runnable;                   /* used to signal worker thread to stop */
+       pthread_t thread;               /* worker thread for xmms updating */
+       pthread_attr_t thread_attr;     /* thread attributes */
+       pthread_mutex_t item_mutex;     /* mutex for item array */
+       pthread_mutex_t runnable_mutex; /* mutex for runnable flag */
+};
+#endif
+
 #ifdef BMPX
+void update_bmpx();
 struct bmpx_s {
        char *title;
        char *artist;
@@ -170,8 +194,11 @@ enum {
 #ifdef TCP_PORT_MONITOR
         INFO_TCP_PORT_MONITOR = 22,
 #endif
+#if defined(XMMS) || defined(BMP) || defined(AUDACIOUS) || defined(INFOPIPE)
+       INFO_XMMS = 23,
+#endif
 #ifdef BMPX
-       INFO_BMPX = 23,
+       INFO_BMPX = 24,
 #endif
 };
 
@@ -216,6 +243,9 @@ struct information {
        struct mpd_s mpd;
        mpd_Connection *conn;
 #endif
+#if defined(XMMS) || defined(BMP) || defined(AUDACIOUS) || defined(INFOPIPE)
+       struct xmms_s xmms;
+#endif
 #ifdef BMPX
        struct bmpx_s bmpx;
 #endif
@@ -269,8 +299,20 @@ char tmpstring2[TEXT_BUFFER_SIZE];
 
 #define ATOM(a) XInternAtom(display, #a, False)
 
+#ifdef OWN_WINDOW
+enum _window_hints {
+       HINT_UNDECORATED = 0,
+       HINT_BELOW,
+       HINT_ABOVE,
+       HINT_STICKY,
+       HINT_SKIP_TASKBAR,
+       HINT_SKIP_PAGER
+};
+#define SET_HINT(mask,hint)    (mask |= (1<<hint))
+#define TEST_HINT(mask,hint)   (mask & (1<<hint))
+#endif
 struct conky_window {
-       Window window;
+       Window root,window;
        Drawable drawable;
        GC gc;
 #ifdef XDBE
@@ -283,8 +325,10 @@ struct conky_window {
        int width;
        int height;
 #ifdef OWN_WINDOW
+       char wm_class_name[256];
        int x;
        int y;
+       unsigned long hints;
 #endif
 };
 
@@ -307,11 +351,8 @@ extern int workarea[4];
 extern struct conky_window window;
 
 void init_X11();
-#if defined OWN_WINDOW
-void init_window(int use_own_window, char* wm_class_name, int width, int height, int on_bottom, int fixed_pos, int set_trans, int back_colour, char * nodename);
-#else
-void init_window(int use_own_window, int width, int height, int on_bottom, int set_trans, int back_colour, char * nodename);
-#endif
+void init_window(int use_own_window, int width, int height, int set_trans, int back_colour, char * nodename,
+                char **argv, int argc);
 void create_gc();
 void set_transparent_background(Window win);
 long get_x11_color(const char *);