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