wmbutton: Support for global conf file
[dockapps.git] / wmbutton / wmbutton.h
blob1b99abfad6b432f3de173659838332979c8ee732
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 /****** Version Number *************************************************/
23 #define VER 0 /* Version Number */
24 #define REL 6 /* Release Number */
26 /****** Define Error Codes *********************************************/
27 #define FAILDISP 20
28 #define FAILSWIN 21
29 #define FAILICON 22
30 #define FAILXPM 23
31 #define FAILWNAM 24
32 #define FAILGC 25
33 #define FAILCONF 26
34 #define FAILTMPL 27
35 #define FAILVIS 28
36 #define FAILBUT 29
38 /****** Define Other Options ****************************************/
39 #define VERB 0 /* Enable=1, Disable=0: Debugging (verbose) Mode*/
40 #define MIDMOUSE 1 /* Define Middle Mouse functionality */
41 #define LMASK 0 /* left button mask: run app # mask + button #*/
42 #define MMASK 10 /* middle button mask: run app # mask + button #*/
43 #define RMASK 20 /* right button mask: run app # mask + button #*/
44 #define NUMB_OF_APPS 9 /* Define number of apps */
46 #define EOLN '\n' /* Defines the new line character */
47 #define SIZE1 20 /* Defines the increment to increase the */
48 /* string by until a newline of EOF is found */
50 /****** Defines for Tool Tips ***************************************/
51 #define TOOLTIP_SUPPORT 1
52 #define TOOLTIP_FONT "-*-helvetica-medium-r-normal-*-10-*-*-*-*-*-*-*"
53 #define TOOLTIP_FONT_LEN 128
54 #define TOOLTIP_SHOW_DELAY 750
55 #define TOOLTIP_RESHOW_DELAY 1500
57 #define TOOLTIP_SPACE 12
58 #define TOOLTIP_TOP 0
59 #define TOOLTIP_BOTTOM 1
60 #define TOOLTIP_LEFT 0
61 #define TOOLTIP_RIGHT 2
63 #define BUTTON_SIZE 18
64 #define BUTTON_COLS 3
66 #define BUFFER_SIZE 1024
68 /****** Typedefs *******************************************/
70 struct Config_t {
71 char *configfile;
72 char *buttonfile;
73 char *Geometry_str;
74 char *Display_str;
75 int mmouse;
76 int Verbose;
77 char* szTooltipFont;
78 int bTooltipSwapColors;
79 int bTooltipDisable;
82 /****** Function Prototyes *******************************************/
83 void RunAppN(int app); // function to run app N as found in conf file
84 char *Parse(int app); // parse data in config file
85 void parseargs(int argc, char **argv);
86 char *readln(FILE *fp); // read line from file, return pointer to it
87 void err_mess(int err, char *str); // Error Handling Routine
88 void show_usage(void); // show usage message to stderr
89 int flush_expose(Window w);
92 /****** Tooltip Function Prototypes **********************************/
93 void initTooltip();
94 void destroyTooltip ();
95 int hasTooltipSupport ();
96 void showTooltip (int nButton, int nMouseX, int nMouseY);
97 void hideTooltip ();
98 int hasTooltip ();
99 void drawTooltipBalloon (Pixmap pix, GC gc, int x, int y, int w, int h, int side);
100 Pixmap createTooltipPixmap (int width, int height, int side, Pixmap *mask);
102 void initTime ();
103 long currentTimeMillis ();
104 void getWindowOrigin (Window w, int* nX, int* nY);
105 void getButtonLocation (int nButton, int* nLocationX, int* nLocationY);
106 char *getButtonAppNames (int nButton);
108 /**********************************************************************/