wmclockmon: handle fgets NULL returns and zero-length lines
[dockapps.git] / wmbutton / wmbutton.h
blobb0627d79202bed65d172e95e023ae7ba625fbf47
1 /* wmbutton.h - Edward H. Flora - ehf_dockapps@cox.net */
2 /* Last Modified 3/27/04 */
4 /****** Include Files ***************************************************/
5 #include <X11/Xlib.h>
6 #include <X11/Xutil.h>
7 #include <X11/xpm.h>
8 #include <X11/extensions/shape.h>
9 #include <X11/keysym.h>
10 #include <math.h>
11 #include <stdlib.h>
12 #include <string.h>
13 #include <ctype.h>
14 #include <sys/time.h>
15 #include <unistd.h>
17 /****** Define Config File Info ***************************************/
18 #define CONFFILENAME "/.wmbutton" /* Default conf filename $HOME/.wmbutton */
19 #define CONFIGGLOBAL "/etc/wmbutton.conf" /* system configuration */
20 #define BUTTONFILENAME "/.wmbutton.xpm"
22 /****** Define Error Codes *********************************************/
23 #define FAILDISP 20
24 #define FAILSWIN 21
25 #define FAILICON 22
26 #define FAILXPM 23
27 #define FAILWNAM 24
28 #define FAILGC 25
29 #define FAILCONF 26
30 #define FAILTMPL 27
31 #define FAILVIS 28
32 #define FAILBUT 29
34 /****** Define Other Options ****************************************/
35 #define VERB 0 /* Enable=1, Disable=0: Debugging (verbose) Mode*/
36 #define LMASK 0 /* left button mask: run app # mask + button #*/
37 #define MMASK 10 /* middle button mask: run app # mask + button #*/
38 #define RMASK 20 /* right button mask: run app # mask + button #*/
39 #define NUMB_OF_APPS 9 /* Define number of apps */
41 #define EOLN '\n' /* Defines the new line character */
42 #define SIZE1 20 /* Defines the increment to increase the */
43 /* string by until a newline of EOF is found */
45 /****** Defines for Tool Tips ***************************************/
46 #define TOOLTIP_SUPPORT 1
47 #define TOOLTIP_FONT "-*-helvetica-medium-r-normal-*-10-*-*-*-*-*-*-*"
48 #define TOOLTIP_FONT_LEN 128
49 #define TOOLTIP_SHOW_DELAY 750
50 #define TOOLTIP_RESHOW_DELAY 1500
52 #define TOOLTIP_SPACE 12
53 #define TOOLTIP_TOP 0
54 #define TOOLTIP_BOTTOM 1
55 #define TOOLTIP_LEFT 0
56 #define TOOLTIP_RIGHT 2
58 #define BUTTON_SIZE 18
59 #define BUTTON_COLS 3
61 #define BUFFER_SIZE 1024
63 /****** Typedefs *******************************************/
65 struct Config_t {
66 char *configfile;
67 char *buttonfile;
68 char *Geometry_str;
69 char *Display_str;
70 int mmouse;
71 int Verbose;
72 char* szTooltipFont;
73 int bTooltipSwapColors;
74 int bTooltipDisable;
77 /****** Function Prototyes *******************************************/
78 void RunAppN(int app); /* function to run app N as found in conf file */
79 char *Parse(int app); /* parse data in config file */
80 void parseargs(int argc, char **argv);
81 char *readln(FILE *fp); /* read line from file, return pointer to it */
82 void err_mess(int err, char *str); /* Error Handling Routine */
83 void show_usage(void); /* show usage message to stderr */
84 int canOpenFile(const char *path);
85 int flush_expose(Window w);
88 /****** Tooltip Function Prototypes **********************************/
89 void initTooltip(void);
90 void destroyTooltip(void);
91 int hasTooltipSupport(void);
92 void showTooltip(int nButton, int nMouseX, int nMouseY);
93 void hideTooltip(void);
94 int hasTooltip(void);
95 void drawTooltipBalloon(Pixmap pix, GC gc, int x, int y, int w, int h, int side);
96 Pixmap createTooltipPixmap(int width, int height, int side, Pixmap *mask);
98 void initTime(void);
99 long currentTimeMillis(void);
100 void getWindowOrigin(Window w, int *nX, int *nY);
101 void getButtonLocation(int nButton, int *nLocationX, int *nLocationY);
102 char *getButtonAppNames(int nButton);
104 /**********************************************************************/