summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJussi Pakkanen <jussi.pakkanen@canonical.com>2011-04-28 14:46:17 +0200
committerHenrik Rydberg <rydberg@euromail.se>2011-04-28 15:19:03 +0200
commit753f11f3881eac51da49c5bb2c2eebc99bd47410 (patch)
treeb3a5906f6751116efd26fdd6951e7d2f82f0b38f
parentb2a967eea554fce9fdec21f5e19c9608406f530c (diff)
Use visibility macros instead of symbol map
Signed-off-by: Jussi Pakkanen <jussi.pakkanen@canonical.com> Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
-rw-r--r--configure.ac1
-rw-r--r--include/grail-bits.h33
-rw-r--r--include/grail.h25
-rw-r--r--src/Makefile.am5
-rw-r--r--src/grail-api.c14
-rw-r--r--src/grail-bits.c12
-rw-r--r--src/grail-event.c4
-rw-r--r--src/grail-inserter.c6
-rw-r--r--utouch-grail.sym.in13
9 files changed, 63 insertions, 50 deletions
diff --git a/configure.ac b/configure.ac
index 37fa429..f40631d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -36,6 +36,5 @@ AC_CONFIG_FILES([Makefile
36 src/Makefile 36 src/Makefile
37 tools/Makefile 37 tools/Makefile
38 test/Makefile 38 test/Makefile
39 utouch-grail.sym
40 utouch-grail.pc]) 39 utouch-grail.pc])
41AC_OUTPUT 40AC_OUTPUT
diff --git a/include/grail-bits.h b/include/grail-bits.h
index c151c11..dfe5367 100644
--- a/include/grail-bits.h
+++ b/include/grail-bits.h
@@ -27,6 +27,26 @@
27extern "C" { 27extern "C" {
28#endif 28#endif
29 29
30/* Macros that set symbol visibilities in shared libraries properly.
31 * Adapted from http://gcc.gnu.org/wiki/Visibility
32 */
33
34#if defined _WIN32 || defined __CYGWIN__
35 #ifdef BUILDING_GRAIL
36 #define GRAIL_PUBLIC __declspec(dllexport)
37 #else
38 #define GRAIL_PUBLIC __declspec(dllimport)
39 #endif
40 #define GRAIL_PRIVATE
41#else
42 #if defined __GNUC__
43 #define GRAIL_PUBLIC __attribute__ ((visibility("default")))
44 #define GRAIL_PRIVATE __attribute__ ((visibility("hidden")))
45 #else
46 #error "Unsupported compiler."
47 #endif
48#endif
49
30typedef unsigned char grail_mask_t; 50typedef unsigned char grail_mask_t;
31 51
32static inline void grail_mask_set(grail_mask_t *mask, int i) 52static inline void grail_mask_set(grail_mask_t *mask, int i)
@@ -52,12 +72,15 @@ static inline int grail_mask_get(const grail_mask_t *mask, int i)
52 return (mask[i >> 3] >> (i & 7)) & 1; 72 return (mask[i >> 3] >> (i & 7)) & 1;
53} 73}
54 74
55void grail_mask_set_mask(grail_mask_t *a, const grail_mask_t *b, int bytes); 75void GRAIL_PUBLIC grail_mask_set_mask(grail_mask_t *a, const grail_mask_t *b,
56void grail_mask_clear_mask(grail_mask_t *a, const grail_mask_t *b, int bytes); 76 int bytes);
77void GRAIL_PUBLIC grail_mask_clear_mask(grail_mask_t *a, const grail_mask_t *b,
78 int bytes);
57 79
58int grail_mask_count(const grail_mask_t *mask, int bytes); 80int GRAIL_PUBLIC grail_mask_count(const grail_mask_t *mask, int bytes);
59int grail_mask_get_first(const grail_mask_t *mask, int bytes); 81int GRAIL_PUBLIC grail_mask_get_first(const grail_mask_t *mask, int bytes);
60int grail_mask_get_next(int i, const grail_mask_t *mask, int bytes); 82int GRAIL_PUBLIC grail_mask_get_next(int i, const grail_mask_t *mask,
83 int bytes);
61 84
62#define grail_mask_foreach(i, mask, bytes) \ 85#define grail_mask_foreach(i, mask, bytes) \
63 for (i = grail_mask_get_first(mask, bytes); \ 86 for (i = grail_mask_get_first(mask, bytes); \
diff --git a/include/grail.h b/include/grail.h
index d61197d..d21d9e8 100644
--- a/include/grail.h
+++ b/include/grail.h
@@ -179,7 +179,7 @@ struct grail {
179 * 179 *
180 * Returns zero on success, negative error number otherwise. 180 * Returns zero on success, negative error number otherwise.
181 */ 181 */
182int grail_open(struct grail *ge, int fd); 182int GRAIL_PUBLIC grail_open(struct grail *ge, int fd);
183 183
184/** 184/**
185 * grail_idle - check state of kernel device 185 * grail_idle - check state of kernel device
@@ -190,7 +190,7 @@ int grail_open(struct grail *ge, int fd);
190 * Returns true if the device is idle, i.e., there are no fetched 190 * Returns true if the device is idle, i.e., there are no fetched
191 * events in the pipe and there is nothing to fetch from the device. 191 * events in the pipe and there is nothing to fetch from the device.
192 */ 192 */
193int grail_idle(struct grail *ge, int fd, int ms); 193int GRAIL_PUBLIC grail_idle(struct grail *ge, int fd, int ms);
194 194
195/** 195/**
196 * grail_pull - pull and process available events from the kernel device 196 * grail_pull - pull and process available events from the kernel device
@@ -206,7 +206,7 @@ int grail_idle(struct grail *ge, int fd, int ms);
206 * On success, returns the number of events read. Otherwise, 206 * On success, returns the number of events read. Otherwise,
207 * a standard negative error number is returned. 207 * a standard negative error number is returned.
208 */ 208 */
209int grail_pull(struct grail *ge, int fd); 209int GRAIL_PUBLIC grail_pull(struct grail *ge, int fd);
210 210
211/** 211/**
212 * grail_close - close the grail device 212 * grail_close - close the grail device
@@ -216,7 +216,7 @@ int grail_pull(struct grail *ge, int fd);
216 * Deallocates all memory associated with grail, and clears the grail 216 * Deallocates all memory associated with grail, and clears the grail
217 * structure. 217 * structure.
218 */ 218 */
219void grail_close(struct grail *ge, int fd); 219void GRAIL_PUBLIC grail_close(struct grail *ge, int fd);
220 220
221/** 221/**
222 * grail_set_bbox - set the grail unit bounding box 222 * grail_set_bbox - set the grail unit bounding box
@@ -226,9 +226,9 @@ void grail_close(struct grail *ge, int fd);
226 * 226 *
227 * Sets the box within which the device coordinates should be presented. 227 * Sets the box within which the device coordinates should be presented.
228 */ 228 */
229void grail_set_bbox(struct grail *ge, 229void GRAIL_PUBLIC grail_set_bbox(struct grail *ge,
230 const struct grail_coord *min, 230 const struct grail_coord *min,
231 const struct grail_coord *max); 231 const struct grail_coord *max);
232 232
233/** 233/**
234 * grail_filter_abs_events - filter kernel motion events 234 * grail_filter_abs_events - filter kernel motion events
@@ -241,7 +241,7 @@ void grail_set_bbox(struct grail *ge,
241 * stream. 241 * stream.
242 * 242 *
243 */ 243 */
244void grail_filter_abs_events(struct grail *ge, int usage); 244void GRAIL_PUBLIC grail_filter_abs_events(struct grail *ge, int usage);
245 245
246/** 246/**
247 * grail_get_units - get device coordinate ranges 247 * grail_get_units - get device coordinate ranges
@@ -255,8 +255,9 @@ void grail_filter_abs_events(struct grail *ge, int usage);
255 * function. This function reports the device coordinate ranges. 255 * function. This function reports the device coordinate ranges.
256 * 256 *
257 */ 257 */
258void grail_get_units(const struct grail *ge, 258void GRAIL_PUBLIC grail_get_units(const struct grail *ge,
259 struct grail_coord *min, struct grail_coord *max); 259 struct grail_coord *min,
260 struct grail_coord *max);
260 261
261/** 262/**
262 * grail_get_contacts - get current contact state 263 * grail_get_contacts - get current contact state
@@ -267,8 +268,8 @@ void grail_get_units(const struct grail *ge,
267 * Extract the contact state as currently seen by grail. 268 * Extract the contact state as currently seen by grail.
268 * 269 *
269 */ 270 */
270int grail_get_contacts(const struct grail *ge, 271int GRAIL_PUBLIC grail_get_contacts(const struct grail *ge,
271 struct grail_contact *touch, int max_touch); 272 struct grail_contact *touch, int max_touch);
272 273
273#ifdef __cplusplus 274#ifdef __cplusplus
274} 275}
diff --git a/src/Makefile.am b/src/Makefile.am
index da1a46e..c344342 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -2,7 +2,6 @@ lib_LTLIBRARIES = libutouch-grail.la
2 2
3libutouch_grail_la_LDFLAGS = \ 3libutouch_grail_la_LDFLAGS = \
4 -version-info @LIB_VERSION@ \ 4 -version-info @LIB_VERSION@ \
5 -export-symbols ../utouch-grail.sym \
6 -lm \ 5 -lm \
7 $(MTDEV_LIBS) \ 6 $(MTDEV_LIBS) \
8 $(EVEMU_LIBS) \ 7 $(EVEMU_LIBS) \
@@ -28,7 +27,9 @@ libutouch_grail_la_SOURCES = \
28 grail-impl.h \ 27 grail-impl.h \
29 grail-api.c 28 grail-api.c
30 29
31AM_CFLAGS = $(CWARNFLAGS) 30# These are flags required to properly set up
31# the build. -fvisibility requires GCC > 4 (or clang)
32AM_CFLAGS = $(CWARNFLAGS) -DBUILDING_GRAIL -fvisibility=hidden
32 33
33INCLUDES = -I$(top_srcdir)/include/ 34INCLUDES = -I$(top_srcdir)/include/
34 35
diff --git a/src/grail-api.c b/src/grail-api.c
index 5a0beb4..259f5a0 100644
--- a/src/grail-api.c
+++ b/src/grail-api.c
@@ -34,13 +34,13 @@
34#define DIM_FRAMES 100 34#define DIM_FRAMES 100
35#define FRAME_RATE 100 35#define FRAME_RATE 100
36 36
37void grail_filter_abs_events(struct grail *ge, int usage) 37void GRAIL_PUBLIC grail_filter_abs_events(struct grail *ge, int usage)
38{ 38{
39 struct grail_impl *x = ge->impl; 39 struct grail_impl *x = ge->impl;
40 x->filter_abs = usage; 40 x->filter_abs = usage;
41} 41}
42 42
43int grail_open(struct grail *ge, int fd) 43int GRAIL_PUBLIC grail_open(struct grail *ge, int fd)
44{ 44{
45 struct grail_impl *x; 45 struct grail_impl *x;
46 struct stat fs; 46 struct stat fs;
@@ -116,7 +116,7 @@ int grail_open(struct grail *ge, int fd)
116 return ret; 116 return ret;
117} 117}
118 118
119void grail_close(struct grail *ge, int fd) 119void GRAIL_PUBLIC grail_close(struct grail *ge, int fd)
120{ 120{
121 struct grail_impl *x = ge->impl; 121 struct grail_impl *x = ge->impl;
122 gru_destroy(ge); 122 gru_destroy(ge);
@@ -131,7 +131,7 @@ void grail_close(struct grail *ge, int fd)
131 ge->impl = 0; 131 ge->impl = 0;
132} 132}
133 133
134int grail_idle(struct grail *ge, int fd, int ms) 134int GRAIL_PUBLIC grail_idle(struct grail *ge, int fd, int ms)
135{ 135{
136 struct grail_impl *x = ge->impl; 136 struct grail_impl *x = ge->impl;
137 if (x->fptest) 137 if (x->fptest)
@@ -141,8 +141,8 @@ int grail_idle(struct grail *ge, int fd, int ms)
141 return 1; 141 return 1;
142} 142}
143 143
144void grail_get_units(const struct grail *ge, 144void GRAIL_PUBLIC grail_get_units(const struct grail *ge,
145 struct grail_coord *min, struct grail_coord *max) 145 struct grail_coord *min, struct grail_coord *max)
146{ 146{
147 struct utouch_surface *s = utouch_frame_get_surface(ge->impl->fh); 147 struct utouch_surface *s = utouch_frame_get_surface(ge->impl->fh);
148 min->x = s->min_x; 148 min->x = s->min_x;
@@ -287,7 +287,7 @@ static int grail_pull_fstest(struct grail *ge, int fd)
287 return count > 0 ? count : -1; 287 return count > 0 ? count : -1;
288} 288}
289 289
290int grail_pull(struct grail *ge, int fd) 290int GRAIL_PUBLIC grail_pull(struct grail *ge, int fd)
291{ 291{
292 struct grail_impl *impl = ge->impl; 292 struct grail_impl *impl = ge->impl;
293 struct input_event ev; 293 struct input_event ev;
diff --git a/src/grail-bits.c b/src/grail-bits.c
index 4c8b941..8ebfb18 100644
--- a/src/grail-bits.c
+++ b/src/grail-bits.c
@@ -46,19 +46,21 @@ static const int grail_first_set_bit[256] =
46 5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0, 46 5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,
47}; 47};
48 48
49void grail_mask_set_mask(grail_mask_t *a, const grail_mask_t *b, int bytes) 49void GRAIL_PUBLIC grail_mask_set_mask(grail_mask_t *a, const grail_mask_t *b,
50 int bytes)
50{ 51{
51 while (bytes--) 52 while (bytes--)
52 *a++ |= *b++; 53 *a++ |= *b++;
53} 54}
54 55
55void grail_mask_clear_mask(grail_mask_t *a, const grail_mask_t *b, int bytes) 56void GRAIL_PUBLIC grail_mask_clear_mask(grail_mask_t *a, const grail_mask_t *b,
57 int bytes)
56{ 58{
57 while (bytes--) 59 while (bytes--)
58 *a++ &= ~*b++; 60 *a++ &= ~*b++;
59} 61}
60 62
61int grail_mask_count(const grail_mask_t *mask, int bytes) 63int GRAIL_PUBLIC grail_mask_count(const grail_mask_t *mask, int bytes)
62{ 64{
63 int count = 0; 65 int count = 0;
64 while (bytes--) 66 while (bytes--)
@@ -66,7 +68,7 @@ int grail_mask_count(const grail_mask_t *mask, int bytes)
66 return count; 68 return count;
67} 69}
68 70
69int grail_mask_get_first(const grail_mask_t *mask, int bytes) 71int GRAIL_PUBLIC grail_mask_get_first(const grail_mask_t *mask, int bytes)
70{ 72{
71 int k; 73 int k;
72 for (k = 0; k < bytes; k++) 74 for (k = 0; k < bytes; k++)
@@ -75,7 +77,7 @@ int grail_mask_get_first(const grail_mask_t *mask, int bytes)
75 return -1; 77 return -1;
76} 78}
77 79
78int grail_mask_get_next(int i, const grail_mask_t *mask, int bytes) 80int GRAIL_PUBLIC grail_mask_get_next(int i, const grail_mask_t *mask, int bytes)
79{ 81{
80 int k = ++i >> 3; 82 int k = ++i >> 3;
81 if (k < bytes) { 83 if (k < bytes) {
diff --git a/src/grail-event.c b/src/grail-event.c
index 504ed10..bb75a06 100644
--- a/src/grail-event.c
+++ b/src/grail-event.c
@@ -118,8 +118,8 @@ void gin_send_event(struct grail *ge, struct slot_state *s,
118 } 118 }
119} 119}
120 120
121int grail_get_contacts(const struct grail *ge, 121int GRAIL_PUBLIC grail_get_contacts(const struct grail *ge,
122 struct grail_contact *touch, int max_touch) 122 struct grail_contact *touch, int max_touch)
123{ 123{
124 const struct gesture_inserter *gin = ge->gin; 124 const struct gesture_inserter *gin = ge->gin;
125 const struct utouch_frame *frame = ge->impl->frame; 125 const struct utouch_frame *frame = ge->impl->frame;
diff --git a/src/grail-inserter.c b/src/grail-inserter.c
index ab81ece..8a10b2e 100644
--- a/src/grail-inserter.c
+++ b/src/grail-inserter.c
@@ -288,9 +288,9 @@ void gin_gid_end(struct grail *ge, int gid,
288 s->status = GRAIL_STATUS_END; 288 s->status = GRAIL_STATUS_END;
289} 289}
290 290
291void grail_set_bbox(struct grail *ge, 291void GRAIL_PUBLIC grail_set_bbox(struct grail *ge,
292 const struct grail_coord *tmin, 292 const struct grail_coord *tmin,
293 const struct grail_coord *tmax) 293 const struct grail_coord *tmax)
294{ 294{
295 struct utouch_surface *s = utouch_frame_get_surface(ge->impl->fh); 295 struct utouch_surface *s = utouch_frame_get_surface(ge->impl->fh);
296 296
diff --git a/utouch-grail.sym.in b/utouch-grail.sym.in
deleted file mode 100644
index e2039ff..0000000
--- a/utouch-grail.sym.in
+++ /dev/null
@@ -1,13 +0,0 @@
1grail_close
2grail_filter_abs_events
3grail_get_contacts
4grail_get_units
5grail_idle
6grail_mask_clear_mask
7grail_mask_count
8grail_mask_get_first
9grail_mask_get_next
10grail_mask_set_mask
11grail_open
12grail_pull
13grail_set_bbox