Supplementary message concering lack of source in packaged doc/ and the GPL
[adesklets.git] / src / adesklets.h
blobdb4bfcf1e335c41d90b1f4dafd0377eb6f31c0f7
1 /*--- adesklets.h --------------------------------------------------------------
2 Copyright (C) 2004, 2005 Sylvain Fourmanoit <syfou@users.sourceforge.net>
4 Permission is hereby granted, free of charge, to any person obtaining a copy
5 of this software and associated documentation files (the "Software"), to
6 deal in the Software without restriction, including without limitation the
7 rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8 sell copies of the Software, and to permit persons to whom the Software is
9 furnished to do so, subject to the following conditions:
11 The above copyright notice and this permission notice shall be included in
12 all copies of the Software and its documentation and acknowledgment shall be
13 given in the documentation and software packages that this Software was
14 used.
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
20 IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 ------------------------------------------------------------------------------*/
23 #ifndef HAVE_ADESKLETS_H
24 #define HAVE_ADESKLETS_H
26 #ifndef HAVE_CONFIG_H
27 #error Autogenerated config.h should be used.
28 #endif
30 /*----------------------------------------------------------------------------*/
31 #include "config.h" /* Autoconf */
33 #include "command.h" /* ID related includes */
34 #include "event.h"
36 #include "xwindow.h" /* All graphics-related includes */
38 #ifdef HAVE_SYS_TYPES_H /* stat() */
39 #include <sys/types.h>
40 #endif
42 #ifdef HAVE_SYS_STAT_H
43 #include <sys/stat.h>
44 #endif
46 #ifdef HAVE_UNISTD_H /* Fork(), exec*(), isatty(), */
47 #include <unistd.h> /* getppid() and other system calls */
48 #endif
50 #ifdef HAVE_SIGNAL_H /* kill() */
51 #include <signal.h>
52 #endif
54 #ifdef HAVE_TIME_H
55 #include <time.h>
56 #endif
58 #ifdef HAVE_LIBGEN_H /* basename() */
59 #include <libgen.h>
60 #endif
62 #ifdef HAVE_STRING_H /* strncpy(), strlen(), etc */
63 #include <string.h>
64 #endif
66 #ifdef HAVE_STDARG_H /* va_start(), va_arg(), etc */
67 #include <stdarg.h>
68 #endif
70 #ifdef HAVE_MATH_H /* lrint(), lrintf(), round() */
71 #include <math.h>
72 #endif
74 #include "types.h" /* Various typedef */
75 #include "error.h" /* Error wrapper */
76 #include "vector.h" /* Small vector API */
77 #include "vector_free.h" /* Vector free functions */
78 #include "tree.h" /* Small tree API */
80 #include "xmenu.h" /* X Windows menu API */
82 #include "cfgfile.h" /* Configuration file management */
83 #include "variable.h" /* Textual variable functions */
85 /*----------------------------------------------------------------------------*/
86 #define MENU(i) ((xmenu*)adesklets.menus->content[i])
88 /*----------------------------------------------------------------------------*/
89 typedef struct s_adesklets {
90 pid_t ppid; /* Parent process ID */
91 Display * display; /* Display handle */
92 Visual * visual; /* Visual handle */
93 Window root; /* Root window */
94 Window window; /* Window ID */
95 int depth; /* Visual depth */
96 int transparency; /* Set up auto transparency */
97 int background_grab; /* Set up auto background grab */
98 int user_background_image;/* Set up user background image */
99 int managed; /* Set up managed/unmanaged status */
100 long event_mask; /* Main window event mask */
101 long user_event_mask; /* Mask of events sent back to user */
102 cfgfile_item * params; /* Configuration information:
103 id, screen,x,y */
104 vector * menus; /* Vector of menus ref. */
105 vector * images; /* Vector of Imlib_Images ref. */
106 vector * fonts; /* Vector of Imlib_Font ref. */
107 vector * color_ranges; /* Vector of Imlib_Color_Range ref. */
108 vector * color_modifiers; /* Vector of Imlib_Color_Modifier */
109 vector * filters; /* Vector of Imlib_Filter */
110 vector * polygons; /* Vector of ImlibPolygon ref. */
111 vector * variables; /* Vector of var_item ref. */
112 char
113 lock_filename[CFGFILE_NAME_SIZE]; /* File name of the lock */
114 FILE * lock; /* Lock file */
115 int quit_flag; /* Signal urge to quit */
116 int restart_flag; /* Signal urge to restart */
117 int user_quit_flag; /* Signal quit was triggered
118 by the user */
119 } t_adesklets;
121 /*----------------------------------------------------------------------------*/
122 extern t_adesklets adesklets;
124 /*----------------------------------------------------------------------------*/
125 /* Global interpreter initialisation: display, window, fonts
127 int adesklets_init(int,char**);
129 /*----------------------------------------------------------------------------*/
130 /* Event loop for the main window.
131 NOTE: this function is espected to be run if an only if adesklets_init()
132 has been successful.
134 void adesklets_events_loop(void);
136 /*----------------------------------------------------------------------------*/
137 /* Global interpreter cleanup: display, lock file, window, fonts
138 The restart flag passed to this function makes adesklets
139 send a SIG_KILL to parent process if applicable (presence
140 of a lock file).
142 int adesklets_free(void);
144 /*----------------------------------------------------------------------------*/
145 /* Test if a given filename is referring to an existing,
146 executable file for current user; if integer flag is given,
147 also verify that filename is absolute.
148 Returns 1 on success, 0 on failure.
150 Warning: This function requires the file to be r+x for adesklets:
151 this is a simple way to avoid executable but unreadable scripts.
153 int adesklets_valid_desklet(char*,int);
155 /*----------------------------------------------------------------------------*/
156 #endif