diff options
author | David Walter Seikel | 2012-01-23 23:30:42 +1000 |
---|---|---|
committer | David Walter Seikel | 2012-01-23 23:30:42 +1000 |
commit | 825a3d837a33f226c879cd02ad15c3fba57e8b2c (patch) | |
tree | 75f57bd9c4253508d338dc79ba8e57a7abc42255 /libraries/ecore/src/lib/ecore_x/xlib/ecore_x_selection.c | |
parent | Add ability to disable the test harness, or the Lua compile test. (diff) | |
download | SledjHamr-825a3d837a33f226c879cd02ad15c3fba57e8b2c.zip SledjHamr-825a3d837a33f226c879cd02ad15c3fba57e8b2c.tar.gz SledjHamr-825a3d837a33f226c879cd02ad15c3fba57e8b2c.tar.bz2 SledjHamr-825a3d837a33f226c879cd02ad15c3fba57e8b2c.tar.xz |
Update the EFL to what I'm actually using, coz I'm using some stuff not yet released.
Diffstat (limited to '')
-rw-r--r-- | libraries/ecore/src/lib/ecore_x/xlib/ecore_x_selection.c | 333 |
1 files changed, 167 insertions, 166 deletions
diff --git a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_selection.c b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_selection.c index b1aa611..fa177c3 100644 --- a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_selection.c +++ b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_selection.c | |||
@@ -15,29 +15,29 @@ static Ecore_X_Selection_Intern selections[4]; | |||
15 | static Ecore_X_Selection_Converter *converters = NULL; | 15 | static Ecore_X_Selection_Converter *converters = NULL; |
16 | static Ecore_X_Selection_Parser *parsers = NULL; | 16 | static Ecore_X_Selection_Parser *parsers = NULL; |
17 | 17 | ||
18 | static Eina_Bool _ecore_x_selection_converter_text(char *target, | 18 | static Eina_Bool _ecore_x_selection_converter_text(char *target, |
19 | void *data, | 19 | void *data, |
20 | int size, | 20 | int size, |
21 | void **data_ret, | 21 | void **data_ret, |
22 | int *size_ret, | 22 | int *size_ret, |
23 | Ecore_X_Atom *tprop, | 23 | Ecore_X_Atom *tprop, |
24 | int *); | 24 | int *); |
25 | static int _ecore_x_selection_data_default_free(void *data); | 25 | static int _ecore_x_selection_data_default_free(void *data); |
26 | static void *_ecore_x_selection_parser_files(const char *target, | 26 | static void *_ecore_x_selection_parser_files(const char *target, |
27 | void *data, | 27 | void *data, |
28 | int size, | 28 | int size, |
29 | int format); | 29 | int format); |
30 | static int _ecore_x_selection_data_files_free(void *data); | 30 | static int _ecore_x_selection_data_files_free(void *data); |
31 | static void *_ecore_x_selection_parser_text(const char *target, | 31 | static void *_ecore_x_selection_parser_text(const char *target, |
32 | void *data, | 32 | void *data, |
33 | int size, | 33 | int size, |
34 | int format); | 34 | int format); |
35 | static int _ecore_x_selection_data_text_free(void *data); | 35 | static int _ecore_x_selection_data_text_free(void *data); |
36 | static void *_ecore_x_selection_parser_targets(const char *target, | 36 | static void *_ecore_x_selection_parser_targets(const char *target, |
37 | void *data, | 37 | void *data, |
38 | int size, | 38 | int size, |
39 | int format); | 39 | int format); |
40 | static int _ecore_x_selection_data_targets_free(void *data); | 40 | static int _ecore_x_selection_data_targets_free(void *data); |
41 | 41 | ||
42 | #define ECORE_X_SELECTION_DATA(x) ((Ecore_X_Selection_Data *)(x)) | 42 | #define ECORE_X_SELECTION_DATA(x) ((Ecore_X_Selection_Data *)(x)) |
43 | 43 | ||
@@ -45,32 +45,32 @@ void | |||
45 | _ecore_x_selection_data_init(void) | 45 | _ecore_x_selection_data_init(void) |
46 | { | 46 | { |
47 | /* Initialize global data */ | 47 | /* Initialize global data */ |
48 | memset(selections, 0, sizeof(selections)); | 48 | memset(selections, 0, sizeof(selections)); |
49 | 49 | ||
50 | /* Initialize converters */ | 50 | /* Initialize converters */ |
51 | ecore_x_selection_converter_atom_add(ECORE_X_ATOM_TEXT, | 51 | ecore_x_selection_converter_atom_add(ECORE_X_ATOM_TEXT, |
52 | _ecore_x_selection_converter_text); | 52 | _ecore_x_selection_converter_text); |
53 | #ifdef X_HAVE_UTF8_STRING | 53 | #ifdef X_HAVE_UTF8_STRING |
54 | ecore_x_selection_converter_atom_add(ECORE_X_ATOM_UTF8_STRING, | 54 | ecore_x_selection_converter_atom_add(ECORE_X_ATOM_UTF8_STRING, |
55 | _ecore_x_selection_converter_text); | 55 | _ecore_x_selection_converter_text); |
56 | #endif /* ifdef X_HAVE_UTF8_STRING */ | 56 | #endif /* ifdef X_HAVE_UTF8_STRING */ |
57 | ecore_x_selection_converter_atom_add(ECORE_X_ATOM_COMPOUND_TEXT, | 57 | ecore_x_selection_converter_atom_add(ECORE_X_ATOM_COMPOUND_TEXT, |
58 | _ecore_x_selection_converter_text); | 58 | _ecore_x_selection_converter_text); |
59 | ecore_x_selection_converter_atom_add(ECORE_X_ATOM_STRING, | 59 | ecore_x_selection_converter_atom_add(ECORE_X_ATOM_STRING, |
60 | _ecore_x_selection_converter_text); | 60 | _ecore_x_selection_converter_text); |
61 | 61 | ||
62 | /* Initialize parsers */ | 62 | /* Initialize parsers */ |
63 | ecore_x_selection_parser_add("text/plain", | 63 | ecore_x_selection_parser_add("text/plain", |
64 | _ecore_x_selection_parser_text); | 64 | _ecore_x_selection_parser_text); |
65 | ecore_x_selection_parser_add(ECORE_X_SELECTION_TARGET_UTF8_STRING, | 65 | ecore_x_selection_parser_add(ECORE_X_SELECTION_TARGET_UTF8_STRING, |
66 | _ecore_x_selection_parser_text); | 66 | _ecore_x_selection_parser_text); |
67 | ecore_x_selection_parser_add("text/uri-list", | 67 | ecore_x_selection_parser_add("text/uri-list", |
68 | _ecore_x_selection_parser_files); | 68 | _ecore_x_selection_parser_files); |
69 | ecore_x_selection_parser_add("_NETSCAPE_URL", | 69 | ecore_x_selection_parser_add("_NETSCAPE_URL", |
70 | _ecore_x_selection_parser_files); | 70 | _ecore_x_selection_parser_files); |
71 | ecore_x_selection_parser_add(ECORE_X_SELECTION_TARGET_TARGETS, | 71 | ecore_x_selection_parser_add(ECORE_X_SELECTION_TARGET_TARGETS, |
72 | _ecore_x_selection_parser_targets); | 72 | _ecore_x_selection_parser_targets); |
73 | } /* _ecore_x_selection_data_init */ | 73 | } |
74 | 74 | ||
75 | void | 75 | void |
76 | _ecore_x_selection_shutdown(void) | 76 | _ecore_x_selection_shutdown(void) |
@@ -102,7 +102,7 @@ _ecore_x_selection_shutdown(void) | |||
102 | free(tmp); | 102 | free(tmp); |
103 | } | 103 | } |
104 | parsers = NULL; | 104 | parsers = NULL; |
105 | } /* _ecore_x_selection_shutdown */ | 105 | } |
106 | 106 | ||
107 | Ecore_X_Selection_Intern * | 107 | Ecore_X_Selection_Intern * |
108 | _ecore_x_selection_get(Ecore_X_Atom selection) | 108 | _ecore_x_selection_get(Ecore_X_Atom selection) |
@@ -117,12 +117,12 @@ _ecore_x_selection_get(Ecore_X_Atom selection) | |||
117 | return &selections[3]; | 117 | return &selections[3]; |
118 | else | 118 | else |
119 | return NULL; | 119 | return NULL; |
120 | } /* _ecore_x_selection_get */ | 120 | } |
121 | 121 | ||
122 | Eina_Bool | 122 | Eina_Bool |
123 | _ecore_x_selection_set(Window w, | 123 | _ecore_x_selection_set(Window w, |
124 | const void *data, | 124 | const void *data, |
125 | int size, | 125 | int size, |
126 | Ecore_X_Atom selection) | 126 | Ecore_X_Atom selection) |
127 | { | 127 | { |
128 | int in; | 128 | int in; |
@@ -162,7 +162,7 @@ _ecore_x_selection_set(Window w, | |||
162 | } | 162 | } |
163 | 163 | ||
164 | return EINA_TRUE; | 164 | return EINA_TRUE; |
165 | } /* _ecore_x_selection_set */ | 165 | } |
166 | 166 | ||
167 | /** | 167 | /** |
168 | * Claim ownership of the PRIMARY selection and set its data. | 168 | * Claim ownership of the PRIMARY selection and set its data. |
@@ -174,12 +174,12 @@ _ecore_x_selection_set(Window w, | |||
174 | */ | 174 | */ |
175 | EAPI Eina_Bool | 175 | EAPI Eina_Bool |
176 | ecore_x_selection_primary_set(Ecore_X_Window w, | 176 | ecore_x_selection_primary_set(Ecore_X_Window w, |
177 | const void *data, | 177 | const void *data, |
178 | int size) | 178 | int size) |
179 | { | 179 | { |
180 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | 180 | LOGFN(__FILE__, __LINE__, __FUNCTION__); |
181 | return _ecore_x_selection_set(w, data, size, ECORE_X_ATOM_SELECTION_PRIMARY); | 181 | return _ecore_x_selection_set(w, data, size, ECORE_X_ATOM_SELECTION_PRIMARY); |
182 | } /* ecore_x_selection_primary_set */ | 182 | } |
183 | 183 | ||
184 | /** | 184 | /** |
185 | * Release ownership of the primary selection | 185 | * Release ownership of the primary selection |
@@ -192,7 +192,7 @@ ecore_x_selection_primary_clear(void) | |||
192 | { | 192 | { |
193 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | 193 | LOGFN(__FILE__, __LINE__, __FUNCTION__); |
194 | return _ecore_x_selection_set(None, NULL, 0, ECORE_X_ATOM_SELECTION_PRIMARY); | 194 | return _ecore_x_selection_set(None, NULL, 0, ECORE_X_ATOM_SELECTION_PRIMARY); |
195 | } /* ecore_x_selection_primary_clear */ | 195 | } |
196 | 196 | ||
197 | /** | 197 | /** |
198 | * Claim ownership of the SECONDARY selection and set its data. | 198 | * Claim ownership of the SECONDARY selection and set its data. |
@@ -204,15 +204,15 @@ ecore_x_selection_primary_clear(void) | |||
204 | */ | 204 | */ |
205 | EAPI Eina_Bool | 205 | EAPI Eina_Bool |
206 | ecore_x_selection_secondary_set(Ecore_X_Window w, | 206 | ecore_x_selection_secondary_set(Ecore_X_Window w, |
207 | const void *data, | 207 | const void *data, |
208 | int size) | 208 | int size) |
209 | { | 209 | { |
210 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | 210 | LOGFN(__FILE__, __LINE__, __FUNCTION__); |
211 | return _ecore_x_selection_set(w, | 211 | return _ecore_x_selection_set(w, |
212 | data, | 212 | data, |
213 | size, | 213 | size, |
214 | ECORE_X_ATOM_SELECTION_SECONDARY); | 214 | ECORE_X_ATOM_SELECTION_SECONDARY); |
215 | } /* ecore_x_selection_secondary_set */ | 215 | } |
216 | 216 | ||
217 | /** | 217 | /** |
218 | * Release ownership of the secondary selection | 218 | * Release ownership of the secondary selection |
@@ -228,7 +228,7 @@ ecore_x_selection_secondary_clear(void) | |||
228 | NULL, | 228 | NULL, |
229 | 0, | 229 | 0, |
230 | ECORE_X_ATOM_SELECTION_SECONDARY); | 230 | ECORE_X_ATOM_SELECTION_SECONDARY); |
231 | } /* ecore_x_selection_secondary_clear */ | 231 | } |
232 | 232 | ||
233 | /** | 233 | /** |
234 | * Claim ownership of the XDND selection and set its data. | 234 | * Claim ownership of the XDND selection and set its data. |
@@ -240,12 +240,12 @@ ecore_x_selection_secondary_clear(void) | |||
240 | */ | 240 | */ |
241 | EAPI Eina_Bool | 241 | EAPI Eina_Bool |
242 | ecore_x_selection_xdnd_set(Ecore_X_Window w, | 242 | ecore_x_selection_xdnd_set(Ecore_X_Window w, |
243 | const void *data, | 243 | const void *data, |
244 | int size) | 244 | int size) |
245 | { | 245 | { |
246 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | 246 | LOGFN(__FILE__, __LINE__, __FUNCTION__); |
247 | return _ecore_x_selection_set(w, data, size, ECORE_X_ATOM_SELECTION_XDND); | 247 | return _ecore_x_selection_set(w, data, size, ECORE_X_ATOM_SELECTION_XDND); |
248 | } /* ecore_x_selection_xdnd_set */ | 248 | } |
249 | 249 | ||
250 | /** | 250 | /** |
251 | * Release ownership of the XDND selection | 251 | * Release ownership of the XDND selection |
@@ -258,7 +258,7 @@ ecore_x_selection_xdnd_clear(void) | |||
258 | { | 258 | { |
259 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | 259 | LOGFN(__FILE__, __LINE__, __FUNCTION__); |
260 | return _ecore_x_selection_set(None, NULL, 0, ECORE_X_ATOM_SELECTION_XDND); | 260 | return _ecore_x_selection_set(None, NULL, 0, ECORE_X_ATOM_SELECTION_XDND); |
261 | } /* ecore_x_selection_xdnd_clear */ | 261 | } |
262 | 262 | ||
263 | /** | 263 | /** |
264 | * Claim ownership of the CLIPBOARD selection and set its data. | 264 | * Claim ownership of the CLIPBOARD selection and set its data. |
@@ -273,15 +273,15 @@ ecore_x_selection_xdnd_clear(void) | |||
273 | */ | 273 | */ |
274 | EAPI Eina_Bool | 274 | EAPI Eina_Bool |
275 | ecore_x_selection_clipboard_set(Ecore_X_Window w, | 275 | ecore_x_selection_clipboard_set(Ecore_X_Window w, |
276 | const void *data, | 276 | const void *data, |
277 | int size) | 277 | int size) |
278 | { | 278 | { |
279 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | 279 | LOGFN(__FILE__, __LINE__, __FUNCTION__); |
280 | return _ecore_x_selection_set(w, | 280 | return _ecore_x_selection_set(w, |
281 | data, | 281 | data, |
282 | size, | 282 | size, |
283 | ECORE_X_ATOM_SELECTION_CLIPBOARD); | 283 | ECORE_X_ATOM_SELECTION_CLIPBOARD); |
284 | } /* ecore_x_selection_clipboard_set */ | 284 | } |
285 | 285 | ||
286 | /** | 286 | /** |
287 | * Release ownership of the clipboard selection | 287 | * Release ownership of the clipboard selection |
@@ -297,7 +297,7 @@ ecore_x_selection_clipboard_clear(void) | |||
297 | NULL, | 297 | NULL, |
298 | 0, | 298 | 0, |
299 | ECORE_X_ATOM_SELECTION_CLIPBOARD); | 299 | ECORE_X_ATOM_SELECTION_CLIPBOARD); |
300 | } /* ecore_x_selection_clipboard_clear */ | 300 | } |
301 | 301 | ||
302 | Ecore_X_Atom | 302 | Ecore_X_Atom |
303 | _ecore_x_selection_target_atom_get(const char *target) | 303 | _ecore_x_selection_target_atom_get(const char *target) |
@@ -318,29 +318,29 @@ _ecore_x_selection_target_atom_get(const char *target) | |||
318 | x_target = ecore_x_atom_get(target); | 318 | x_target = ecore_x_atom_get(target); |
319 | 319 | ||
320 | return x_target; | 320 | return x_target; |
321 | } /* _ecore_x_selection_target_atom_get */ | 321 | } |
322 | 322 | ||
323 | char * | 323 | char * |
324 | _ecore_x_selection_target_get(Ecore_X_Atom target) | 324 | _ecore_x_selection_target_get(Ecore_X_Atom target) |
325 | { | 325 | { |
326 | /* FIXME: Should not return mem allocated with strdup or X mixed, | 326 | /* FIXME: Should not return mem allocated with strdup or X mixed, |
327 | * one should use free to free, the other XFree */ | 327 | * one should use free to free, the other XFree */ |
328 | if (target == ECORE_X_ATOM_FILE_NAME) | 328 | if (target == ECORE_X_ATOM_FILE_NAME) |
329 | return strdup(ECORE_X_SELECTION_TARGET_FILENAME); | 329 | return strdup(ECORE_X_SELECTION_TARGET_FILENAME); |
330 | else if (target == ECORE_X_ATOM_STRING) | 330 | else if (target == ECORE_X_ATOM_STRING) |
331 | return strdup(ECORE_X_SELECTION_TARGET_STRING); | 331 | return strdup(ECORE_X_SELECTION_TARGET_STRING); |
332 | else if (target == ECORE_X_ATOM_UTF8_STRING) | 332 | else if (target == ECORE_X_ATOM_UTF8_STRING) |
333 | return strdup(ECORE_X_SELECTION_TARGET_UTF8_STRING); | 333 | return strdup(ECORE_X_SELECTION_TARGET_UTF8_STRING); |
334 | else if (target == ECORE_X_ATOM_TEXT) | 334 | else if (target == ECORE_X_ATOM_TEXT) |
335 | return strdup(ECORE_X_SELECTION_TARGET_TEXT); | 335 | return strdup(ECORE_X_SELECTION_TARGET_TEXT); |
336 | else | 336 | else |
337 | return XGetAtomName(_ecore_x_disp, target); | 337 | return XGetAtomName(_ecore_x_disp, target); |
338 | } /* _ecore_x_selection_target_get */ | 338 | } |
339 | 339 | ||
340 | static void | 340 | static void |
341 | _ecore_x_selection_request(Ecore_X_Window w, | 341 | _ecore_x_selection_request(Ecore_X_Window w, |
342 | Ecore_X_Atom selection, | 342 | Ecore_X_Atom selection, |
343 | const char *target_str) | 343 | const char *target_str) |
344 | { | 344 | { |
345 | Ecore_X_Atom target, prop; | 345 | Ecore_X_Atom target, prop; |
346 | 346 | ||
@@ -357,27 +357,27 @@ _ecore_x_selection_request(Ecore_X_Window w, | |||
357 | 357 | ||
358 | XConvertSelection(_ecore_x_disp, selection, target, prop, | 358 | XConvertSelection(_ecore_x_disp, selection, target, prop, |
359 | w, CurrentTime); | 359 | w, CurrentTime); |
360 | } /* _ecore_x_selection_request */ | 360 | } |
361 | 361 | ||
362 | EAPI void | 362 | EAPI void |
363 | ecore_x_selection_primary_request(Ecore_X_Window w, | 363 | ecore_x_selection_primary_request(Ecore_X_Window w, |
364 | const char *target) | 364 | const char *target) |
365 | { | 365 | { |
366 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | 366 | LOGFN(__FILE__, __LINE__, __FUNCTION__); |
367 | _ecore_x_selection_request(w, ECORE_X_ATOM_SELECTION_PRIMARY, target); | 367 | _ecore_x_selection_request(w, ECORE_X_ATOM_SELECTION_PRIMARY, target); |
368 | } /* ecore_x_selection_primary_request */ | 368 | } |
369 | 369 | ||
370 | EAPI void | 370 | EAPI void |
371 | ecore_x_selection_secondary_request(Ecore_X_Window w, | 371 | ecore_x_selection_secondary_request(Ecore_X_Window w, |
372 | const char *target) | 372 | const char *target) |
373 | { | 373 | { |
374 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | 374 | LOGFN(__FILE__, __LINE__, __FUNCTION__); |
375 | _ecore_x_selection_request(w, ECORE_X_ATOM_SELECTION_SECONDARY, target); | 375 | _ecore_x_selection_request(w, ECORE_X_ATOM_SELECTION_SECONDARY, target); |
376 | } /* ecore_x_selection_secondary_request */ | 376 | } |
377 | 377 | ||
378 | EAPI void | 378 | EAPI void |
379 | ecore_x_selection_xdnd_request(Ecore_X_Window w, | 379 | ecore_x_selection_xdnd_request(Ecore_X_Window w, |
380 | const char *target) | 380 | const char *target) |
381 | { | 381 | { |
382 | Ecore_X_Atom atom; | 382 | Ecore_X_Atom atom; |
383 | Ecore_X_DND_Target *_target; | 383 | Ecore_X_DND_Target *_target; |
@@ -388,25 +388,25 @@ ecore_x_selection_xdnd_request(Ecore_X_Window w, | |||
388 | XConvertSelection(_ecore_x_disp, ECORE_X_ATOM_SELECTION_XDND, atom, | 388 | XConvertSelection(_ecore_x_disp, ECORE_X_ATOM_SELECTION_XDND, atom, |
389 | ECORE_X_ATOM_SELECTION_PROP_XDND, w, | 389 | ECORE_X_ATOM_SELECTION_PROP_XDND, w, |
390 | _target->time); | 390 | _target->time); |
391 | } /* ecore_x_selection_xdnd_request */ | 391 | } |
392 | 392 | ||
393 | EAPI void | 393 | EAPI void |
394 | ecore_x_selection_clipboard_request(Ecore_X_Window w, | 394 | ecore_x_selection_clipboard_request(Ecore_X_Window w, |
395 | const char *target) | 395 | const char *target) |
396 | { | 396 | { |
397 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | 397 | LOGFN(__FILE__, __LINE__, __FUNCTION__); |
398 | _ecore_x_selection_request(w, ECORE_X_ATOM_SELECTION_CLIPBOARD, target); | 398 | _ecore_x_selection_request(w, ECORE_X_ATOM_SELECTION_CLIPBOARD, target); |
399 | } /* ecore_x_selection_clipboard_request */ | 399 | } |
400 | 400 | ||
401 | EAPI void | 401 | EAPI void |
402 | ecore_x_selection_converter_atom_add(Ecore_X_Atom target, | 402 | ecore_x_selection_converter_atom_add(Ecore_X_Atom target, |
403 | Eina_Bool (*func)(char *target, | 403 | Eina_Bool (*func)(char *target, |
404 | void *data, | 404 | void *data, |
405 | int size, | 405 | int size, |
406 | void **data_ret, | 406 | void **data_ret, |
407 | int *size_ret, | 407 | int *size_ret, |
408 | Ecore_X_Atom *ttype, | 408 | Ecore_X_Atom *ttype, |
409 | int *tsize)) | 409 | int *tsize)) |
410 | { | 410 | { |
411 | Ecore_X_Selection_Converter *cnv; | 411 | Ecore_X_Selection_Converter *cnv; |
412 | 412 | ||
@@ -441,17 +441,17 @@ ecore_x_selection_converter_atom_add(Ecore_X_Atom | |||
441 | 441 | ||
442 | cnv->target = target; | 442 | cnv->target = target; |
443 | cnv->convert = func; | 443 | cnv->convert = func; |
444 | } /* ecore_x_selection_converter_atom_add */ | 444 | } |
445 | 445 | ||
446 | EAPI void | 446 | EAPI void |
447 | ecore_x_selection_converter_add(char *target, | 447 | ecore_x_selection_converter_add(char *target, |
448 | Eina_Bool (*func)(char *target, | 448 | Eina_Bool (*func)(char *target, |
449 | void *data, | 449 | void *data, |
450 | int size, | 450 | int size, |
451 | void **data_ret, | 451 | void **data_ret, |
452 | int *size_ret, | 452 | int *size_ret, |
453 | Ecore_X_Atom *, | 453 | Ecore_X_Atom *, |
454 | int *)) | 454 | int *)) |
455 | { | 455 | { |
456 | Ecore_X_Atom x_target; | 456 | Ecore_X_Atom x_target; |
457 | 457 | ||
@@ -462,7 +462,7 @@ ecore_x_selection_converter_add(char *target, | |||
462 | x_target = _ecore_x_selection_target_atom_get(target); | 462 | x_target = _ecore_x_selection_target_atom_get(target); |
463 | 463 | ||
464 | ecore_x_selection_converter_atom_add(x_target, func); | 464 | ecore_x_selection_converter_atom_add(x_target, func); |
465 | } /* ecore_x_selection_converter_add */ | 465 | } |
466 | 466 | ||
467 | EAPI void | 467 | EAPI void |
468 | ecore_x_selection_converter_atom_del(Ecore_X_Atom target) | 468 | ecore_x_selection_converter_atom_del(Ecore_X_Atom target) |
@@ -492,7 +492,7 @@ ecore_x_selection_converter_atom_del(Ecore_X_Atom target) | |||
492 | prev_cnv = cnv; | 492 | prev_cnv = cnv; |
493 | cnv = cnv->next; | 493 | cnv = cnv->next; |
494 | } | 494 | } |
495 | } /* ecore_x_selection_converter_atom_del */ | 495 | } |
496 | 496 | ||
497 | EAPI void | 497 | EAPI void |
498 | ecore_x_selection_converter_del(char *target) | 498 | ecore_x_selection_converter_del(char *target) |
@@ -505,14 +505,14 @@ ecore_x_selection_converter_del(char *target) | |||
505 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | 505 | LOGFN(__FILE__, __LINE__, __FUNCTION__); |
506 | x_target = _ecore_x_selection_target_atom_get(target); | 506 | x_target = _ecore_x_selection_target_atom_get(target); |
507 | ecore_x_selection_converter_atom_del(x_target); | 507 | ecore_x_selection_converter_atom_del(x_target); |
508 | } /* ecore_x_selection_converter_del */ | 508 | } |
509 | 509 | ||
510 | EAPI Eina_Bool | 510 | EAPI Eina_Bool |
511 | ecore_x_selection_notify_send(Ecore_X_Window requestor, | 511 | ecore_x_selection_notify_send(Ecore_X_Window requestor, |
512 | Ecore_X_Atom selection, | 512 | Ecore_X_Atom selection, |
513 | Ecore_X_Atom target, | 513 | Ecore_X_Atom target, |
514 | Ecore_X_Atom property, | 514 | Ecore_X_Atom property, |
515 | Ecore_X_Time tim) | 515 | Ecore_X_Time tim) |
516 | { | 516 | { |
517 | XEvent xev; | 517 | XEvent xev; |
518 | XSelectionEvent xnotify; | 518 | XSelectionEvent xnotify; |
@@ -530,16 +530,16 @@ ecore_x_selection_notify_send(Ecore_X_Window requestor, | |||
530 | 530 | ||
531 | xev.xselection = xnotify; | 531 | xev.xselection = xnotify; |
532 | return (XSendEvent(_ecore_x_disp, requestor, False, 0, &xev) > 0) ? EINA_TRUE : EINA_FALSE; | 532 | return (XSendEvent(_ecore_x_disp, requestor, False, 0, &xev) > 0) ? EINA_TRUE : EINA_FALSE; |
533 | } /* ecore_x_selection_notify_send */ | 533 | } |
534 | 534 | ||
535 | /* Locate and run conversion callback for specified selection target */ | 535 | /* Locate and run conversion callback for specified selection target */ |
536 | EAPI Eina_Bool | 536 | EAPI Eina_Bool |
537 | ecore_x_selection_convert(Ecore_X_Atom selection, | 537 | ecore_x_selection_convert(Ecore_X_Atom selection, |
538 | Ecore_X_Atom target, | 538 | Ecore_X_Atom target, |
539 | void **data_ret, | 539 | void **data_ret, |
540 | int *size, | 540 | int *size, |
541 | Ecore_X_Atom *targtype, | 541 | Ecore_X_Atom *targtype, |
542 | int *typesize) | 542 | int *typesize) |
543 | { | 543 | { |
544 | Ecore_X_Selection_Intern *sel; | 544 | Ecore_X_Selection_Intern *sel; |
545 | Ecore_X_Selection_Converter *cnv; | 545 | Ecore_X_Selection_Converter *cnv; |
@@ -572,24 +572,24 @@ ecore_x_selection_convert(Ecore_X_Atom selection, | |||
572 | return EINA_FALSE; | 572 | return EINA_FALSE; |
573 | 573 | ||
574 | /* Default, just return the data | 574 | /* Default, just return the data |
575 | *data_ret = malloc(sel->length); | 575 | * data_ret = malloc(sel->length); |
576 | memcpy(*data_ret, sel->data, sel->length); | 576 | memcpy(*data_ret, sel->data, sel->length); |
577 | free(tgt_str); | 577 | free(tgt_str); |
578 | return 1; | 578 | return 1; |
579 | */ | 579 | */ |
580 | } /* ecore_x_selection_convert */ | 580 | } |
581 | 581 | ||
582 | /* TODO: We need to work out a mechanism for automatic conversion to any requested | 582 | /* TODO: We need to work out a mechanism for automatic conversion to any requested |
583 | * locale using Ecore_Txt functions */ | 583 | * locale using Ecore_Txt functions */ |
584 | /* Converter for standard non-utf8 text targets */ | 584 | /* Converter for standard non-utf8 text targets */ |
585 | static Eina_Bool | 585 | static Eina_Bool |
586 | _ecore_x_selection_converter_text(char *target, | 586 | _ecore_x_selection_converter_text(char *target, |
587 | void *data, | 587 | void *data, |
588 | int size, | 588 | int size, |
589 | void **data_ret, | 589 | void **data_ret, |
590 | int *size_ret, | 590 | int *size_ret, |
591 | Ecore_X_Atom *targprop __UNUSED__, | 591 | Ecore_X_Atom *targprop __UNUSED__, |
592 | int *s __UNUSED__) | 592 | int *s __UNUSED__) |
593 | { | 593 | { |
594 | XTextProperty text_prop; | 594 | XTextProperty text_prop; |
595 | char *mystr; | 595 | char *mystr; |
@@ -651,7 +651,7 @@ _ecore_x_selection_converter_text(char *target, | |||
651 | { | 651 | { |
652 | return EINA_TRUE; | 652 | return EINA_TRUE; |
653 | } | 653 | } |
654 | } /* _ecore_x_selection_converter_text */ | 654 | } |
655 | 655 | ||
656 | EAPI void | 656 | EAPI void |
657 | ecore_x_selection_parser_add(const char *target, | 657 | ecore_x_selection_parser_add(const char *target, |
@@ -692,7 +692,7 @@ ecore_x_selection_parser_add(const char *target, | |||
692 | 692 | ||
693 | prs->target = strdup(target); | 693 | prs->target = strdup(target); |
694 | prs->parse = func; | 694 | prs->parse = func; |
695 | } /* ecore_x_selection_parser_add */ | 695 | } |
696 | 696 | ||
697 | EAPI void | 697 | EAPI void |
698 | ecore_x_selection_parser_del(const char *target) | 698 | ecore_x_selection_parser_del(const char *target) |
@@ -726,19 +726,19 @@ ecore_x_selection_parser_del(const char *target) | |||
726 | prev_prs = prs; | 726 | prev_prs = prs; |
727 | prs = prs->next; | 727 | prs = prs->next; |
728 | } | 728 | } |
729 | } /* ecore_x_selection_parser_del */ | 729 | } |
730 | 730 | ||
731 | /** | 731 | /** |
732 | * Change the owner and last-change time for the specified selection. | 732 | * Change the owner and last-change time for the specified selection. |
733 | * @param win The owner of the specified atom. | 733 | * @param win The owner of the specified atom. |
734 | * @param atom The selection atom | 734 | * @param atom The selection atom |
735 | * @param time Specifies the time | 735 | * @param tim Specifies the time |
736 | * @since 1.1.0 | 736 | * @since 1.1.0 |
737 | */ | 737 | */ |
738 | EAPI void | 738 | EAPI void |
739 | ecore_x_selection_owner_set(Ecore_X_Window win, | 739 | ecore_x_selection_owner_set(Ecore_X_Window win, |
740 | Ecore_X_Atom atom, | 740 | Ecore_X_Atom atom, |
741 | Ecore_X_Time tim) | 741 | Ecore_X_Time tim) |
742 | { | 742 | { |
743 | XSetSelectionOwner(_ecore_x_disp, atom, win, tim); | 743 | XSetSelectionOwner(_ecore_x_disp, atom, win, tim); |
744 | } | 744 | } |
@@ -760,9 +760,9 @@ ecore_x_selection_owner_get(Ecore_X_Atom atom) | |||
760 | /* Locate and run conversion callback for specified selection target */ | 760 | /* Locate and run conversion callback for specified selection target */ |
761 | void * | 761 | void * |
762 | _ecore_x_selection_parse(const char *target, | 762 | _ecore_x_selection_parse(const char *target, |
763 | void *data, | 763 | void *data, |
764 | int size, | 764 | int size, |
765 | int format) | 765 | int format) |
766 | { | 766 | { |
767 | Ecore_X_Selection_Parser *prs; | 767 | Ecore_X_Selection_Parser *prs; |
768 | Ecore_X_Selection_Data *sel; | 768 | Ecore_X_Selection_Data *sel; |
@@ -784,7 +784,7 @@ _ecore_x_selection_parse(const char *target, | |||
784 | sel->format = format; | 784 | sel->format = format; |
785 | sel->data = data; | 785 | sel->data = data; |
786 | return sel; | 786 | return sel; |
787 | } /* _ecore_x_selection_parse */ | 787 | } |
788 | 788 | ||
789 | static int | 789 | static int |
790 | _ecore_x_selection_data_default_free(void *data) | 790 | _ecore_x_selection_data_default_free(void *data) |
@@ -795,13 +795,13 @@ _ecore_x_selection_data_default_free(void *data) | |||
795 | free(sel->data); | 795 | free(sel->data); |
796 | free(sel); | 796 | free(sel); |
797 | return 1; | 797 | return 1; |
798 | } /* _ecore_x_selection_data_default_free */ | 798 | } |
799 | 799 | ||
800 | static void * | 800 | static void * |
801 | _ecore_x_selection_parser_files(const char *target, | 801 | _ecore_x_selection_parser_files(const char *target, |
802 | void *_data, | 802 | void *_data, |
803 | int size, | 803 | int size, |
804 | int format __UNUSED__) | 804 | int format __UNUSED__) |
805 | { | 805 | { |
806 | Ecore_X_Selection_Data_Files *sel; | 806 | Ecore_X_Selection_Data_Files *sel; |
807 | char *t, *data = _data; | 807 | char *t, *data = _data; |
@@ -820,15 +820,15 @@ _ecore_x_selection_parser_files(const char *target, | |||
820 | if (data[size - 1]) | 820 | if (data[size - 1]) |
821 | { | 821 | { |
822 | /* Isn't nul terminated */ | 822 | /* Isn't nul terminated */ |
823 | size++; | 823 | size++; |
824 | t = realloc(data, size); | 824 | t = realloc(data, size); |
825 | if (!t) | 825 | if (!t) |
826 | { | 826 | { |
827 | free(sel); | 827 | free(sel); |
828 | return NULL; | 828 | return NULL; |
829 | } | 829 | } |
830 | data = t; | 830 | data = t; |
831 | data[size - 1] = 0; | 831 | data[size - 1] = 0; |
832 | } | 832 | } |
833 | 833 | ||
834 | tmp = malloc(size); | 834 | tmp = malloc(size); |
@@ -850,7 +850,8 @@ _ecore_x_selection_parser_files(const char *target, | |||
850 | tmp[i++] = data[is++]; | 850 | tmp[i++] = data[is++]; |
851 | else | 851 | else |
852 | { | 852 | { |
853 | while ((data[is] == '\r') || (data[is] == '\n')) is++; | 853 | while ((data[is] == '\r') || (data[is] == '\n')) |
854 | is++; | ||
854 | tmp[i] = 0; | 855 | tmp[i] = 0; |
855 | sel->num_files++; | 856 | sel->num_files++; |
856 | t2 = realloc(sel->files, sel->num_files * sizeof(char *)); | 857 | t2 = realloc(sel->files, sel->num_files * sizeof(char *)); |
@@ -883,7 +884,7 @@ _ecore_x_selection_parser_files(const char *target, | |||
883 | ECORE_X_SELECTION_DATA(sel)->length = sel->num_files; | 884 | ECORE_X_SELECTION_DATA(sel)->length = sel->num_files; |
884 | 885 | ||
885 | return ECORE_X_SELECTION_DATA(sel); | 886 | return ECORE_X_SELECTION_DATA(sel); |
886 | } /* _ecore_x_selection_parser_files */ | 887 | } |
887 | 888 | ||
888 | static int | 889 | static int |
889 | _ecore_x_selection_data_files_free(void *data) | 890 | _ecore_x_selection_data_files_free(void *data) |
@@ -901,13 +902,13 @@ _ecore_x_selection_data_files_free(void *data) | |||
901 | 902 | ||
902 | free(sel); | 903 | free(sel); |
903 | return 0; | 904 | return 0; |
904 | } /* _ecore_x_selection_data_files_free */ | 905 | } |
905 | 906 | ||
906 | static void * | 907 | static void * |
907 | _ecore_x_selection_parser_text(const char *target __UNUSED__, | 908 | _ecore_x_selection_parser_text(const char *target __UNUSED__, |
908 | void *_data, | 909 | void *_data, |
909 | int size, | 910 | int size, |
910 | int format __UNUSED__) | 911 | int format __UNUSED__) |
911 | { | 912 | { |
912 | Ecore_X_Selection_Data_Text *sel; | 913 | Ecore_X_Selection_Data_Text *sel; |
913 | unsigned char *data = _data; | 914 | unsigned char *data = _data; |
@@ -918,15 +919,15 @@ _ecore_x_selection_parser_text(const char *target __UNUSED__, | |||
918 | if (data[size - 1]) | 919 | if (data[size - 1]) |
919 | { | 920 | { |
920 | /* Isn't nul terminated */ | 921 | /* Isn't nul terminated */ |
921 | size++; | 922 | size++; |
922 | t = realloc(data, size); | 923 | t = realloc(data, size); |
923 | if (!t) | 924 | if (!t) |
924 | { | 925 | { |
925 | free(sel); | 926 | free(sel); |
926 | return NULL; | 927 | return NULL; |
927 | } | 928 | } |
928 | data = t; | 929 | data = t; |
929 | data[size - 1] = 0; | 930 | data[size - 1] = 0; |
930 | } | 931 | } |
931 | 932 | ||
932 | sel->text = (char *)data; | 933 | sel->text = (char *)data; |
@@ -935,7 +936,7 @@ _ecore_x_selection_parser_text(const char *target __UNUSED__, | |||
935 | ECORE_X_SELECTION_DATA(sel)->data = data; | 936 | ECORE_X_SELECTION_DATA(sel)->data = data; |
936 | ECORE_X_SELECTION_DATA(sel)->free = _ecore_x_selection_data_text_free; | 937 | ECORE_X_SELECTION_DATA(sel)->free = _ecore_x_selection_data_text_free; |
937 | return sel; | 938 | return sel; |
938 | } /* _ecore_x_selection_parser_text */ | 939 | } |
939 | 940 | ||
940 | static int | 941 | static int |
941 | _ecore_x_selection_data_text_free(void *data) | 942 | _ecore_x_selection_data_text_free(void *data) |
@@ -946,13 +947,13 @@ _ecore_x_selection_data_text_free(void *data) | |||
946 | free(sel->text); | 947 | free(sel->text); |
947 | free(sel); | 948 | free(sel); |
948 | return 1; | 949 | return 1; |
949 | } /* _ecore_x_selection_data_text_free */ | 950 | } |
950 | 951 | ||
951 | static void * | 952 | static void * |
952 | _ecore_x_selection_parser_targets(const char *target __UNUSED__, | 953 | _ecore_x_selection_parser_targets(const char *target __UNUSED__, |
953 | void *data, | 954 | void *data, |
954 | int size, | 955 | int size, |
955 | int format __UNUSED__) | 956 | int format __UNUSED__) |
956 | { | 957 | { |
957 | Ecore_X_Selection_Data_Targets *sel; | 958 | Ecore_X_Selection_Data_Targets *sel; |
958 | unsigned long *targets; | 959 | unsigned long *targets; |
@@ -977,7 +978,7 @@ _ecore_x_selection_parser_targets(const char *target __UNUSED__, | |||
977 | ECORE_X_SELECTION_DATA(sel)->length = size; | 978 | ECORE_X_SELECTION_DATA(sel)->length = size; |
978 | ECORE_X_SELECTION_DATA(sel)->data = data; | 979 | ECORE_X_SELECTION_DATA(sel)->data = data; |
979 | return sel; | 980 | return sel; |
980 | } /* _ecore_x_selection_parser_targets */ | 981 | } |
981 | 982 | ||
982 | static int | 983 | static int |
983 | _ecore_x_selection_data_targets_free(void *data) | 984 | _ecore_x_selection_data_targets_free(void *data) |
@@ -997,5 +998,5 @@ _ecore_x_selection_data_targets_free(void *data) | |||
997 | free(ECORE_X_SELECTION_DATA(sel)->data); | 998 | free(ECORE_X_SELECTION_DATA(sel)->data); |
998 | free(sel); | 999 | free(sel); |
999 | return 1; | 1000 | return 1; |
1000 | } /* _ecore_x_selection_data_targets_free */ | 1001 | } |
1001 | 1002 | ||