Merge lp:~bregma/ginn/build-with-werror into lp:ginn

Proposed by Stephen M. Webb on 2011-09-02
Status: Needs review
Proposed branch: lp:~bregma/ginn/build-with-werror
Merge into: lp:ginn
Diff against target: 550 lines (+204/-72)
11 files modified
Makefile.am (+2/-0)
configure.ac (+6/-1)
src/Makefile.am (+2/-2)
src/bamf.c (+7/-9)
src/bamf.h (+27/-0)
src/config.c (+58/-35)
src/config.h (+8/-0)
src/ginn.c (+31/-24)
src/ginn.h (+28/-0)
src/xt.c (+1/-1)
src/xt.h (+34/-0)
To merge this branch: bzr merge lp:~bregma/ginn/build-with-werror
Reviewer Review Type Date Requested Status
Chase Douglas (community) 2011-09-02 Approve on 2011-09-02
Review via email: mp+73887@code.launchpad.net

Description of the change

Changes to make GINN build with -Wall -Wextra -pedantic -Werror.

Lots of changes, in fact.

I think GINN is in need of a rewrite for the next cycle.

To post a comment you must log in.
Mohamed IKBEL Boulabiar (boulabiar) wrote :

I confirm that the code needs to be refactored.
But Stephen, which things you think they need to be rewritten ?

Stephen M. Webb (bregma) wrote :

> I confirm that the code needs to be refactored.
> But Stephen, which things you think they need to be rewritten ?

I think the att and wish structures should be modularized further, the functions for handling them are too distributed across source files.

Some changes are necessary to support device-specific wishes.

I would like to see it rewritten using the GEISv2 API (for efficiency reasons).

Note that, other than the GEISv2 rewrite, most of the changes i would like to see are organizational rather than fundamental. By and large, the program does what it should do in a sensible way, but the way it expressed could be improved.

Any rewrite is not as important as extending an effort to provide more wishes. I think the wish mechanism is solid and does not need a change.

Chase Douglas (chasedouglas) wrote :

Looks great!

review: Approve
Jussi Pakkanen (jpakkane) wrote :

Looks good. The only comment I have is that a __attribute__((unused)) is a GCCism, it should be used through a #define. Something like this:

---- some header ----

#define UNUSED __attribute__((unused))

---------------------

---- Elsewhere -----

gesture_match(GeisGestureType gesture_type,
 GeisGestureId gesture_id UNUSED,
 GeisSize attr_count UNUSED,
 GeisGestureAttr * attrs, int state)

--------------------

Chase Douglas (chasedouglas) wrote :

There's a point at which abstractions get in the way instead of helping. We don't have any plans even in the really really far future of building any of utouch with a different compiler, so I would prefer to leave gccisms until we decide to change that. OS X uses gcc (and/or llvm which probably uses the same attribute), and I'm sure one can use gcc on windows too.

Unmerged revisions

94. By Stephen M. Webb on 2011-09-02

More fixes under Oneriric builds.

93. By Stephen M. Webb on 2011-09-02

tagged range initializers as GNU extensions.

92. By Stephen M. Webb on 2011-09-02

More fixin's for FTBFS with -Werror.

91. By Stephen M. Webb on 2011-09-02

Adjusted build flags to pick up higher warning level.

90. By Stephen M. Webb on 2011-09-02

Cranked up compiler warning levels and fixed the subsequent build failures.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'Makefile.am'
2--- Makefile.am 2010-12-10 14:15:40 +0000
3+++ Makefile.am 2011-09-02 21:21:23 +0000
4@@ -1,3 +1,5 @@
5+AM_MAKEFLAGS = --no-print-directory
6+
7 SUBDIRS = src etc
8
9 pkgconfigdir = $(libdir)/pkgconfig
10
11=== modified file 'configure.ac'
12--- configure.ac 2011-05-17 12:46:31 +0000
13+++ configure.ac 2011-09-02 21:21:23 +0000
14@@ -10,13 +10,15 @@
15
16 # Initialize Automake
17 AM_INIT_AUTOMAKE([foreign dist-bzip2])
18+AM_SILENT_RULES([yes])
19 AM_MAINTAINER_MODE
20
21 LIB_VERSION=1:0:0
22 AC_SUBST([LIB_VERSION])
23
24 # Initialize libtool
25-AC_PROG_LIBTOOL
26+LT_PREREQ([2.2.6b])
27+LT_INIT
28
29 # Checks for programs.
30 AC_PROG_CC
31@@ -28,6 +30,9 @@
32 PKG_CHECK_MODULES([XTST], [xtst >= 1.1.0])
33 PKG_CHECK_MODULES([BAMF], [libbamf >= 0.2.53])
34
35+AC_SUBST(AM_CFLAGS,
36+ "-Wall -Wextra -Werror -pedantic -std=iso9899:1999 -D_GNU_SOURCE=1")
37+
38 AC_CONFIG_FILES([Makefile
39 src/Makefile
40 etc/Makefile
41
42=== modified file 'src/Makefile.am'
43--- src/Makefile.am 2011-02-04 16:04:30 +0000
44+++ src/Makefile.am 2011-09-02 21:21:23 +0000
45@@ -1,8 +1,8 @@
46 bin_PROGRAMS = ginn
47 man1_MANS = ginn.1
48
49-ginn_SOURCES = ginn.c config.h config.c xt.c bamf.c
50-ginn_CFLAGS = \
51+ginn_SOURCES = ginn.h ginn.c config.h config.c xt.h xt.c bamf.h bamf.c
52+ginn_CPPFLAGS = \
53 -DGINN_CONFIG_DIR=\"$(sysconfdir)/ginn\" \
54 $(GEIS_CFLAGS) $(XTST_CFLAGS) $(X11_CFLAGS) $(XML2_CFLAGS) $(BAMF_CFLAGS)
55 ginn_LDFLAGS = $(GEIS_LIBS) $(XTST_LIBS) $(X11_LIBS) $(XML2_LIBS) $(BAMF_LIBS)
56
57=== modified file 'src/bamf.c'
58--- src/bamf.c 2011-05-20 19:34:26 +0000
59+++ src/bamf.c 2011-09-02 21:21:23 +0000
60@@ -15,31 +15,29 @@
61 * this program; if not, write to the Free Software Foundation, Inc., 51
62 * Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
63 */
64+#include "bamf.h"
65
66 #include <libbamf/bamf-matcher.h>
67 #include <string.h>
68
69-char *getName(char *deskfile)
70+char *getName(const char *deskfile)
71 {
72- char *temp;
73- temp = strdup(strrchr(deskfile, '/'));
74+ char *temp = strdup(strrchr(deskfile, '/'));
75 return strndup(temp + 1, strlen(temp) - 9);
76 }
77
78-char *getCurrentApp()
79+char *getCurrentApp(void)
80 {
81 g_type_init();
82- char *deskfile, *appName;
83- char *temp;
84
85 BamfApplication *app =
86 bamf_matcher_get_active_application(bamf_matcher_get_default());
87 if (app) {
88- appName = (char *) bamf_view_get_name(BAMF_VIEW(app));
89- temp = bamf_application_get_desktop_file(app);
90+ char *appName = (char *) bamf_view_get_name(BAMF_VIEW(app));
91+ const char *temp = bamf_application_get_desktop_file(app);
92
93 if (strchr(appName, ' ') && temp && strlen(temp) > 1)
94- return getName((char *) temp);
95+ return getName(temp);
96 else
97 return appName;
98 } else
99
100=== added file 'src/bamf.h'
101--- src/bamf.h 1970-01-01 00:00:00 +0000
102+++ src/bamf.h 2011-09-02 21:21:23 +0000
103@@ -0,0 +1,27 @@
104+/**
105+ * @file bamf.h
106+ * @brief GINN bindings for the BAMF library.
107+ */
108+
109+/*
110+ * Copyright 2011 Canonical Ltd.
111+ *
112+ * This library is free software; you can redistribute it and/or modify it under
113+ * the terms of the GNU General Public License as published by the Free Software
114+ * Foundation; either version 3 of the License, or (at your option) any later
115+ * version.
116+ *
117+ * This library is distributed in the hope that it will be useful, but WITHOUT
118+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
119+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
120+ * details.
121+ *
122+ * You should have received a copy of the GNU General Public License
123+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
124+ */
125+#ifndef GINN_SRC_BAMF_H_
126+#define GINN_SRC_BAMF_H_
127+
128+char *getCurrentApp(void);
129+
130+#endif /* GINN_SRC_BAMF_H_ */
131
132=== modified file 'src/config.c'
133--- src/config.c 2011-03-16 16:19:13 +0000
134+++ src/config.c 2011-09-02 21:21:23 +0000
135@@ -17,8 +17,28 @@
136 */
137
138 #include "config.h"
139+#include "ginn.h"
140 #include <libxml/parser.h>
141
142+static const xmlChar *GINN_ACCUMULATE_TAG = (const xmlChar *)"accumulate";
143+static const xmlChar *GINN_ACTION_TAG = (const xmlChar *)"action";
144+static const xmlChar *GINN_APPLICATION_TAG = (const xmlChar *)"application";
145+static const xmlChar *GINN_BUTTON_TAG = (const xmlChar *)"button";
146+static const xmlChar *GINN_FINGERS_TAG = (const xmlChar *)"fingers";
147+static const xmlChar *GINN_GESTURE_TAG = (const xmlChar *)"gesture";
148+static const xmlChar *GINN_KEY_TAG = (const xmlChar *)"key";
149+static const xmlChar *GINN_MAX_TAG = (const xmlChar *)"max";
150+static const xmlChar *GINN_MIN_TAG = (const xmlChar *)"min";
151+static const xmlChar *GINN_MODIFIER1_TAG = (const xmlChar *)"modifier1";
152+static const xmlChar *GINN_MODIFIER2_TAG = (const xmlChar *)"modifier2";
153+static const xmlChar *GINN_MODIFIER3_TAG = (const xmlChar *)"modifier3";
154+static const xmlChar *GINN_MODIFIER4_TAG = (const xmlChar *)"modifier4";
155+static const xmlChar *GINN_NAME_TAG = (const xmlChar *)"name";
156+static const xmlChar *GINN_PROP_TAG = (const xmlChar *)"prop";
157+static const xmlChar *GINN_TRIGGER_TAG = (const xmlChar *)"trigger";
158+static const xmlChar *GINN_WHEN_TAG = (const xmlChar *)"when";
159+static const xmlChar *GINN_WISH_TAG = (const xmlChar *)"wish";
160+
161 void debugOut(struct wish *wp)
162 {
163 int i;
164@@ -31,7 +51,7 @@
165 printf("\t val : %.2f ", wp->config_attr[i].val);
166 printf("\t valMax : %.2f", wp->config_attr[i].valMax);
167 }
168- printf("\n pMe : %x pNext : %x ", wp, wp->next);
169+ printf("\n pMe : %p pNext : %p ", (void *)wp, (void *)wp->next);
170 printf("\n===================================================");
171 }
172
173@@ -53,7 +73,7 @@
174
175 static void print_node(const xmlNode * root, int depth)
176 {
177- xmlNode *node;
178+ const xmlNode *node;
179 for (node = root; node; node = node->next) {
180 int i;
181 if (node->type != XML_ELEMENT_NODE)
182@@ -94,10 +114,9 @@
183
184 void store_1config(xmlNode * node, struct wish *wp, int *position)
185 {
186- if (0 == strcmp(node->name, "wish")) {
187- // printf(" gesture %s fingers %s ",(xmlGetProp(node, "gesture")),(xmlGetProp(node, "fingers")));
188+ if (0 == xmlStrcmp(node->name, GINN_WISH_TAG)) {
189 wp->config_attr[0].attrName = "gesture name";
190- switch (xmlGetProp(node, "gesture")[0]) {
191+ switch (xmlGetProp(node, GINN_GESTURE_TAG)[0]) {
192 case 'D':
193 wp->config_attr[0].val = wp->config_attr[0].valMax = 0;
194 break;
195@@ -112,47 +131,51 @@
196 break;
197 }
198 wp->config_attr[1].attrName = "touches";
199- wp->config_attr[1].val = atoi(xmlGetProp(node, "fingers"));
200- wp->config_attr[1].valMax = atoi(xmlGetProp(node, "fingers"));
201+ wp->config_attr[1].val = atoi((const char *)xmlGetProp(node, GINN_FINGERS_TAG));
202+ wp->config_attr[1].valMax = atoi((const char *)xmlGetProp(node, GINN_FINGERS_TAG));
203 }
204- if (0 == strcmp(node->name, "action")) {
205- wp->when = ginn_str2state(xmlGetProp(node, "when"));
206+ if (0 == xmlStrcmp(node->name, GINN_ACTION_TAG)) {
207+ wp->when = ginn_str2state((const char *) xmlGetProp(node, GINN_WHEN_TAG));
208 if (wp->when < 0)
209 fprintf(stderr,
210 "ERROR: you must provide property 'when' to the action: %s\n",
211- xmlGetProp(node, "name"));
212+ xmlGetProp(node, GINN_NAME_TAG));
213 }
214- if (0 == strcmp(node->name, "trigger")) {
215- wp->config_attr[*position].attrName = xmlGetProp(node, "prop");
216- wp->config_attr[*position].val = atof(xmlGetProp(node, "min"));
217- wp->config_attr[*position].valMax = atof(xmlGetProp(node, "max"));
218- int acc = ginn_str2bool(xmlGetProp(node, "accumulate"));
219+ if (0 == xmlStrcmp(node->name, GINN_TRIGGER_TAG)) {
220+ wp->config_attr[*position].attrName = (char *)xmlGetProp(node,
221+ GINN_PROP_TAG);
222+ wp->config_attr[*position].val = atof((const char *) xmlGetProp(node,
223+ GINN_MIN_TAG));
224+ wp->config_attr[*position].valMax = atof((const char *) xmlGetProp(node,
225+ GINN_MAX_TAG));
226+ int acc = ginn_str2bool((const char *) xmlGetProp(node, GINN_ACCUMULATE_TAG));
227 wp->config_attr[*position].accumulate =
228 acc == -1 ? GINN_DEFAULT_ACCUMULATE : acc;
229 wp->config_attr[*position].accumVal = 0;
230 (*position)++;
231 }
232- if (0 == strcmp(node->name, "key")
233- || 0 == strcmp(node->name, "button")) {
234- if (xmlGetProp(node, "modifier1"))
235- wp->modifiers[0] = xmlGetProp(node, "modifier1");
236- if (xmlGetProp(node, "modifier2"))
237- wp->modifiers[1] = xmlGetProp(node, "modifier2");
238- if (xmlGetProp(node, "modifier3"))
239- wp->modifiers[2] = xmlGetProp(node, "modifier3");
240- if (xmlGetProp(node, "modifier4"))
241- wp->modifiers[3] = xmlGetProp(node, "modifier4");
242+ if (0 == xmlStrcmp(node->name, GINN_KEY_TAG)
243+ || 0 == xmlStrcmp(node->name, GINN_BUTTON_TAG)) {
244+ if (xmlGetProp(node, GINN_MODIFIER1_TAG))
245+ wp->modifiers[0] = (char *) xmlGetProp(node, GINN_MODIFIER1_TAG);
246+ if (xmlGetProp(node, GINN_MODIFIER2_TAG))
247+ wp->modifiers[1] = (char *) xmlGetProp(node, GINN_MODIFIER2_TAG);
248+ if (xmlGetProp(node, GINN_MODIFIER3_TAG))
249+ wp->modifiers[2] = (char *) xmlGetProp(node, GINN_MODIFIER3_TAG);
250+ if (xmlGetProp(node, GINN_MODIFIER4_TAG))
251+ wp->modifiers[3] = (char *) xmlGetProp(node, GINN_MODIFIER4_TAG);
252 }
253- if (0 == strcmp(node->name, "key"))
254- wp->key = xmlNodeGetContent(node);
255- if (0 == strcmp(node->name, "button"))
256- wp->button = atoi(xmlNodeGetContent(node));
257- if (0 == strcmp(node->name, "button"))
258+ if (0 == xmlStrcmp(node->name, GINN_KEY_TAG))
259+ wp->key = (char *) xmlNodeGetContent(node);
260+ if (0 == xmlStrcmp(node->name, GINN_BUTTON_TAG))
261+ {
262+ wp->button = atoi((const char *) xmlNodeGetContent(node));
263 printf("Button : %d ", wp->button);
264+ }
265 }
266
267 void
268-parse_node(const xmlNode * root, int depth, struct wish *wp,
269+parse_node(xmlNode * root, int depth, struct wish *wp,
270 struct apps *ap)
271 {
272 xmlNode *node;
273@@ -161,17 +184,17 @@
274 if (node->type != XML_ELEMENT_NODE)
275 continue;
276
277- if ((0 == strcmp(node->name, "application"))) {
278+ if ((0 == xmlStrcmp(node->name, GINN_APPLICATION_TAG))) {
279 if (0 != strcmp(ap->appName, "")) {
280 ap = ap->next =
281 (struct apps *) malloc(sizeof(struct apps));
282 inita(ap);
283 }
284- ap->appName = xmlGetProp(node, "name");
285+ ap->appName = (char *) xmlGetProp((xmlNodePtr)node, GINN_NAME_TAG);
286 wp = ap->wp = (struct wish *) malloc(sizeof(struct wish));
287 initw(wp);
288 }
289- if ((0 == strcmp(node->name, "wish"))
290+ if ((0 == xmlStrcmp(node->name, GINN_WISH_TAG))
291 && (0 == strcmp(wp->config_attr[0].attrName, "gesture name"))) {
292 if (!(wp->next)) {
293 wp->next = (struct wish *) malloc(sizeof(struct wish));
294@@ -189,7 +212,7 @@
295 ginn_config_store(const struct ginn_config *cfg, struct wish *w,
296 struct apps *a)
297 {
298- const xmlNode *root = xmlDocGetRootElement(cfg->doc);
299+ xmlNode *root = xmlDocGetRootElement(cfg->doc);
300 parse_node(root, 0, w, a);
301 }
302
303
304=== modified file 'src/config.h'
305--- src/config.h 2011-03-16 16:19:13 +0000
306+++ src/config.h 2011-09-02 21:21:23 +0000
307@@ -55,4 +55,12 @@
308 struct apps *next;
309 } apps;
310
311+int ginn_config_open(struct ginn_config *cfg, const char *path);
312+
313+void ginn_config_print(const struct ginn_config *cfg);
314+
315+void ginn_config_store(const struct ginn_config *cfg,
316+ struct wish *w,
317+ struct apps *a);
318+
319 #endif /* GINN_CONFIG_H */
320
321=== modified file 'src/ginn.c'
322--- src/ginn.c 2011-08-12 15:40:51 +0000
323+++ src/ginn.c 2011-09-02 21:21:23 +0000
324@@ -22,6 +22,9 @@
325 *
326 */
327 #include "config.h"
328+#include "bamf.h"
329+#include "ginn.h"
330+#include "xt.h"
331 #include <geis/geis.h>
332 #include <errno.h>
333 #include <stdio.h>
334@@ -33,15 +36,17 @@
335 #include <X11/Xlib.h>
336 #include <X11/keysym.h>
337
338-att config_attr[25] = {[0 ... 24] = {.attrName = "",.val = 0,.valMax = 0}
339+/*
340+ * Range initializers ar a GNU extension.
341+ */
342+__extension__ att config_attr[25] = {
343+ [0 ... 24] = {.attrName = "",.val = 0,.valMax = 0}
344 };
345
346-wish w1 = {.config_attr = {[0 ... 24] =
347- {.attrName = "",.val = 0,.valMax = 0}
348- }
349-,
350-.key = "",
351-.next = NULL
352+__extension__ wish w1 = {
353+ .config_attr = {[0 ... 24] = {.attrName = "",.val = 0,.valMax = 0}},
354+ .key = "",
355+ .next = NULL
356 };
357
358 wish *wp, *wpEnd;
359@@ -90,7 +95,7 @@
360 apps *tmpAp = ap;
361 int diff = 0;
362
363- activeApp = (char *) getCurrentApp();
364+ activeApp = getCurrentApp();
365 printf(" --ActiveApp %s\n", activeApp);
366 if (activeApp)
367 diff = strcmp(activeApp, ap->appName);
368@@ -110,8 +115,9 @@
369
370 static void
371 gesture_match(GeisGestureType gesture_type,
372- GeisGestureId gesture_id,
373- GeisSize attr_count, GeisGestureAttr * attrs, int state)
374+ GeisGestureId gesture_id __attribute__((unused)),
375+ GeisSize attr_count __attribute__((unused)),
376+ GeisGestureAttr * attrs, int state)
377 {
378 struct wish *topw;
379 topw = wp;
380@@ -220,36 +226,36 @@
381 }
382
383 static void
384-gesture_added(void *cookie,
385+gesture_added(void *cookie __attribute((unused)),
386 GeisGestureType gesture_type,
387- GeisGestureId gesture_id,
388+ GeisGestureId gesture_id __attribute__((unused)),
389 GeisSize attr_count, GeisGestureAttr * attrs)
390 {
391- int i = 0;
392+ GeisSize i = 0;
393 fprintf(stdout, "Gesture type %d added\n", gesture_type);
394 for (i = 0; i < attr_count; ++i)
395 print_attr(&attrs[i]);
396 }
397
398 static void
399-gesture_removed(void *cookie,
400+gesture_removed(void *cookie __attribute__((unused)),
401 GeisGestureType gesture_type,
402- GeisGestureId gesture_id,
403+ GeisGestureId gesture_id __attribute__((unused)),
404 GeisSize attr_count, GeisGestureAttr * attrs)
405 {
406- int i = 0;
407+ GeisSize i = 0;
408 fprintf(stdout, "Gesture type %d removed\n", gesture_type);
409 for (i = 0; i < attr_count; ++i)
410 print_attr(&attrs[i]);
411 }
412
413 static void
414-gesture_start(void *cookie,
415+gesture_start(void *cookie __attribute__((unused)),
416 GeisGestureType gesture_type,
417- GeisGestureId gesture_id,
418+ GeisGestureId gesture_id __attribute__((unused)),
419 GeisSize attr_count, GeisGestureAttr * attrs)
420 {
421- int i = 0;
422+ GeisSize i = 0;
423 fprintf(stdout, "Gesture type %d started\n", gesture_type);
424 for (i = 0; i < attr_count; ++i)
425 print_attr(&attrs[i]);
426@@ -259,12 +265,12 @@
427 }
428
429 static void
430-gesture_update(void *cookie,
431+gesture_update(void *cookie __attribute__((unused)),
432 GeisGestureType gesture_type,
433 GeisGestureId gesture_id,
434 GeisSize attr_count, GeisGestureAttr * attrs)
435 {
436- int i = 0;
437+ GeisSize i = 0;
438 fprintf(stdout, "Gesture type %d updated\n", gesture_type);
439 for (i = 0; i < attr_count; ++i)
440 print_attr(&attrs[i]);
441@@ -273,12 +279,12 @@
442 }
443
444 static void
445-gesture_finish(void *cookie,
446+gesture_finish(void *cookie __attribute__((unused)),
447 GeisGestureType gesture_type,
448 GeisGestureId gesture_id,
449 GeisSize attr_count, GeisGestureAttr * attrs)
450 {
451- int i = 0;
452+ GeisSize i = 0;
453 fprintf(stdout, "Gesture type %d finished\n", gesture_type);
454 for (i = 0; i < attr_count; ++i); //print_attr(&attrs[i]);
455 gesture_match(gesture_type, gesture_id, attr_count, attrs,
456@@ -560,7 +566,8 @@
457 return 1;
458 }
459
460- status = geis_subscribe(instance, GEIS_ALL_INPUT_DEVICES, sub_gestures_list, // GEIS_ALL_GESTURES,
461+ status = geis_subscribe(instance, GEIS_ALL_INPUT_DEVICES,
462+ (const char **)sub_gestures_list,
463 &gesture_funcs, NULL);
464 if (status != GEIS_STATUS_SUCCESS) {
465 fprintf(stderr, "error subscribing to gestures\n");
466
467=== added file 'src/ginn.h'
468--- src/ginn.h 1970-01-01 00:00:00 +0000
469+++ src/ginn.h 2011-09-02 21:21:23 +0000
470@@ -0,0 +1,28 @@
471+/**
472+ * @file ginn.h
473+ */
474+
475+/*
476+ * Copyright 2011 Canonical Ltd.
477+ *
478+ * This library is free software; you can redistribute it and/or modify it under
479+ * the terms of the GNU General Public License as published by the Free Software
480+ * Foundation; either version 3 of the License, or (at your option) any later
481+ * version.
482+ *
483+ * This library is distributed in the hope that it will be useful, but WITHOUT
484+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
485+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
486+ * details.
487+ *
488+ * You should have received a copy of the GNU General Public License
489+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
490+ */
491+#ifndef GINN_SRC_GINN_H_
492+#define GINN_SRC_GINN_H_
493+
494+void inita(struct apps *ap);
495+
496+void initw(struct wish *wp);
497+
498+#endif /* GINN_SRC_GINN_H_ */
499
500=== modified file 'src/xt.c'
501--- src/xt.c 2011-03-16 16:23:21 +0000
502+++ src/xt.c 2011-09-02 21:21:23 +0000
503@@ -17,7 +17,7 @@
504 * Author: Mohamed-Ikbel Boulabiar <boulabiar@gmail.com>
505 */
506
507-#include <X11/X.h>
508+#include <string.h>
509 #include <X11/extensions/XTest.h>
510 #include <X11/keysym.h>
511
512
513=== added file 'src/xt.h'
514--- src/xt.h 1970-01-01 00:00:00 +0000
515+++ src/xt.h 2011-09-02 21:21:23 +0000
516@@ -0,0 +1,34 @@
517+/**
518+ * @file xt.h
519+ * @brief GINN bindings for the X11 library.
520+ */
521+
522+/*
523+ * Copyright 2011 Canonical Ltd.
524+ *
525+ * This library is free software; you can redistribute it and/or modify it under
526+ * the terms of the GNU General Public License as published by the Free Software
527+ * Foundation; either version 3 of the License, or (at your option) any later
528+ * version.
529+ *
530+ * This library is distributed in the hope that it will be useful, but WITHOUT
531+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
532+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
533+ * details.
534+ *
535+ * You should have received a copy of the GNU General Public License
536+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
537+ */
538+#ifndef GINN_SRC_XT_H_
539+#define GINN_SRC_XT_H_
540+
541+#include <X11/X.h>
542+
543+void openDisplay();
544+void closeDisplay();
545+void movePointer(int x, int y);
546+void injKey(KeySym ks, char *modifiers[]);
547+void injButton(int btn, char *modifiers[]);
548+void injMixBtnKey(KeySym ks, int btn, char *modifiers[]);
549+
550+#endif /* GINN_SRC_XT_H_ */