diff options
author | Nicolas Aguirre <aguirre.nicolas@gmail.com> | 2015-01-29 17:08:23 +0100 |
---|---|---|
committer | Cedric BAIL <cedric@osg.samsung.com> | 2015-02-05 16:38:07 +0100 |
commit | 72baccaf4494f1661aca762a26597d78a717c6ef (patch) | |
tree | 1497f0edd2e82fdf15a9714ee68943c7374ae71f /src/lib/ecore_cocoa | |
parent | 61fbb2ffd9e2b197041a776ec2e629b6cda7c97e (diff) |
ecore_cocoa: create a log domain and use Eina_Log.
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
Diffstat (limited to 'src/lib/ecore_cocoa')
-rw-r--r-- | src/lib/ecore_cocoa/ecore_cocoa.m | 18 | ||||
-rw-r--r-- | src/lib/ecore_cocoa/ecore_cocoa_private.h | 30 | ||||
-rw-r--r-- | src/lib/ecore_cocoa/ecore_cocoa_window.m | 13 |
3 files changed, 52 insertions, 9 deletions
diff --git a/src/lib/ecore_cocoa/ecore_cocoa.m b/src/lib/ecore_cocoa/ecore_cocoa.m index 1a094bcbc7..cfae44d982 100644 --- a/src/lib/ecore_cocoa/ecore_cocoa.m +++ b/src/lib/ecore_cocoa/ecore_cocoa.m | |||
@@ -25,6 +25,8 @@ static int _ecore_cocoa_init_count = 0; | |||
25 | 25 | ||
26 | static int old_flags; | 26 | static int old_flags; |
27 | 27 | ||
28 | static int _ecore_cocoa_log_domain = -1; | ||
29 | |||
28 | EAPI int | 30 | EAPI int |
29 | ecore_cocoa_init(void) | 31 | ecore_cocoa_init(void) |
30 | { | 32 | { |
@@ -37,6 +39,13 @@ ecore_cocoa_init(void) | |||
37 | if (!ecore_event_init()) | 39 | if (!ecore_event_init()) |
38 | return --_ecore_cocoa_init_count; | 40 | return --_ecore_cocoa_init_count; |
39 | 41 | ||
42 | _ecore_cocoa_log_domain = eina_log_domain_register("ecore_cocoa", ECORE_DEFAULT_LOG_COLOR); | ||
43 | if(_ecore_cocoa_log_domain < 0) | ||
44 | { | ||
45 | EINA_LOG_ERR("Unable to create a log domain for ecore_cocoa."); | ||
46 | return 0; | ||
47 | } | ||
48 | |||
40 | ECORE_COCOA_EVENT_GOT_FOCUS = ecore_event_type_new(); | 49 | ECORE_COCOA_EVENT_GOT_FOCUS = ecore_event_type_new(); |
41 | ECORE_COCOA_EVENT_LOST_FOCUS = ecore_event_type_new(); | 50 | ECORE_COCOA_EVENT_LOST_FOCUS = ecore_event_type_new(); |
42 | ECORE_COCOA_EVENT_RESIZE = ecore_event_type_new(); | 51 | ECORE_COCOA_EVENT_RESIZE = ecore_event_type_new(); |
@@ -64,6 +73,7 @@ ecore_cocoa_shutdown(void) | |||
64 | if (--_ecore_cocoa_init_count != 0) | 73 | if (--_ecore_cocoa_init_count != 0) |
65 | return _ecore_cocoa_init_count; | 74 | return _ecore_cocoa_init_count; |
66 | 75 | ||
76 | eina_log_domain_unregister(_ecore_cocoa_log_domain); | ||
67 | ecore_event_shutdown(); | 77 | ecore_event_shutdown(); |
68 | 78 | ||
69 | return _ecore_cocoa_init_count; | 79 | return _ecore_cocoa_init_count; |
@@ -80,7 +90,7 @@ _ecore_cocoa_event_modifiers(unsigned int mod) | |||
80 | if(mod & NSCommandKeyMask) modifiers |= ECORE_EVENT_MODIFIER_WIN; | 90 | if(mod & NSCommandKeyMask) modifiers |= ECORE_EVENT_MODIFIER_WIN; |
81 | if(mod & NSNumericPadKeyMask) modifiers |= ECORE_EVENT_LOCK_NUM; | 91 | if(mod & NSNumericPadKeyMask) modifiers |= ECORE_EVENT_LOCK_NUM; |
82 | 92 | ||
83 | printf("key modifiers: %d, %d\n", mod, modifiers); | 93 | DBG("key modifiers: %d, %d\n", mod, modifiers); |
84 | return modifiers; | 94 | return modifiers; |
85 | } | 95 | } |
86 | 96 | ||
@@ -286,7 +296,7 @@ ecore_cocoa_feed_events(void *anEvent) | |||
286 | { | 296 | { |
287 | if (keystable[i].code == [keychar characterAtIndex:0]) | 297 | if (keystable[i].code == [keychar characterAtIndex:0]) |
288 | { | 298 | { |
289 | printf("Key pressed : %s\n", keystable[i].name); | 299 | DBG("Key pressed : %s\n", keystable[i].name); |
290 | ev->keyname = keystable[i].name; | 300 | ev->keyname = keystable[i].name; |
291 | ev->key = keystable[i].name; | 301 | ev->key = keystable[i].name; |
292 | ev->string = keystable[i].compose; | 302 | ev->string = keystable[i].compose; |
@@ -311,7 +321,7 @@ ecore_cocoa_feed_events(void *anEvent) | |||
311 | EcoreCocoaWindow *window = (EcoreCocoaWindow *)[event window]; | 321 | EcoreCocoaWindow *window = (EcoreCocoaWindow *)[event window]; |
312 | NSString *keychar = [event characters]; | 322 | NSString *keychar = [event characters]; |
313 | 323 | ||
314 | printf("Key Up\n"); | 324 | DBG("Key Up\n"); |
315 | 325 | ||
316 | ev = calloc(1, sizeof (Ecore_Event_Key)); | 326 | ev = calloc(1, sizeof (Ecore_Event_Key)); |
317 | if (!ev) return pass; | 327 | if (!ev) return pass; |
@@ -432,7 +442,7 @@ ecore_cocoa_feed_events(void *anEvent) | |||
432 | } | 442 | } |
433 | case NSScrollWheel: | 443 | case NSScrollWheel: |
434 | { | 444 | { |
435 | printf("Scroll Wheel\n"); | 445 | DBG("Scroll Wheel\n"); |
436 | break; | 446 | break; |
437 | } | 447 | } |
438 | default: | 448 | default: |
diff --git a/src/lib/ecore_cocoa/ecore_cocoa_private.h b/src/lib/ecore_cocoa/ecore_cocoa_private.h index 41310d43d5..9127de15c6 100644 --- a/src/lib/ecore_cocoa/ecore_cocoa_private.h +++ b/src/lib/ecore_cocoa/ecore_cocoa_private.h | |||
@@ -1,6 +1,36 @@ | |||
1 | #ifndef _ECORE_COCOA_PRIVATE_H | 1 | #ifndef _ECORE_COCOA_PRIVATE_H |
2 | #define _ECORE_COCOA_PRIVATE_H | 2 | #define _ECORE_COCOA_PRIVATE_H |
3 | 3 | ||
4 | #include "ecore_cocoa_window.h" | ||
5 | |||
6 | extern int _ecore_cocoa_log_domain; | ||
7 | |||
8 | #ifdef ERR | ||
9 | # undef ERR | ||
10 | #endif | ||
11 | #define ERR(...) EINA_LOG_DOM_ERR(_ecore_cocoa_log_domain, __VA_ARGS__) | ||
12 | |||
13 | #ifdef DBG | ||
14 | # undef DBG | ||
15 | #endif | ||
16 | #define DBG(...) EINA_LOG_DOM_DBG(_ecore_cocoa_log_domain, __VA_ARGS__) | ||
17 | |||
18 | #ifdef INF | ||
19 | # undef INF | ||
20 | #endif | ||
21 | #define INF(...) EINA_LOG_DOM_INFO(_ecore_cocoa_log_domain, __VA_ARGS__) | ||
22 | |||
23 | #ifdef WRN | ||
24 | # undef WRN | ||
25 | #endif | ||
26 | #define WRN(...) EINA_LOG_DOM_WARN(_ecore_cocoa_log_domain, __VA_ARGS__) | ||
27 | |||
28 | #ifdef CRI | ||
29 | # undef CRI | ||
30 | #endif | ||
31 | #define CRI(...) EINA_LOG_DOM_CRIT(_ecore_cocoa_log_domain, __VA_ARGS__) | ||
32 | |||
33 | |||
4 | struct _Ecore_Cocoa_Window | 34 | struct _Ecore_Cocoa_Window |
5 | { | 35 | { |
6 | EcoreCocoaWindow *window; | 36 | EcoreCocoaWindow *window; |
diff --git a/src/lib/ecore_cocoa/ecore_cocoa_window.m b/src/lib/ecore_cocoa/ecore_cocoa_window.m index 8300fbba3a..5e8a2052fd 100644 --- a/src/lib/ecore_cocoa/ecore_cocoa_window.m +++ b/src/lib/ecore_cocoa/ecore_cocoa_window.m | |||
@@ -4,6 +4,7 @@ | |||
4 | 4 | ||
5 | #include <Ecore.h> | 5 | #include <Ecore.h> |
6 | #include <Ecore_Cocoa.h> | 6 | #include <Ecore_Cocoa.h> |
7 | #include "ecore_cocoa_private.h" | ||
7 | #import "ecore_cocoa_window.h" | 8 | #import "ecore_cocoa_window.h" |
8 | 9 | ||
9 | @implementation EcoreCocoaWindow | 10 | @implementation EcoreCocoaWindow |
@@ -58,8 +59,7 @@ | |||
58 | event = malloc(sizeof(Ecore_Cocoa_Event_Video_Resize)); | 59 | event = malloc(sizeof(Ecore_Cocoa_Event_Video_Resize)); |
59 | if (event == NULL) | 60 | if (event == NULL) |
60 | { | 61 | { |
61 | // FIXME Use Eina_Log | 62 | DBG("Failed to allocate Ecore_Cocoa_Event_Video_Resize\n"); |
62 | printf("Failed to allocate Ecore_Cocoa_Event_Video_Resize\n"); | ||
63 | return; | 63 | return; |
64 | } | 64 | } |
65 | event->w = size.width; | 65 | event->w = size.width; |
@@ -77,7 +77,7 @@ | |||
77 | e = malloc(sizeof(Ecore_Cocoa_Event_Window)); | 77 | e = malloc(sizeof(Ecore_Cocoa_Event_Window)); |
78 | if (!e) | 78 | if (!e) |
79 | { | 79 | { |
80 | printf("GOT_FOCUS: Failed to allocate Ecore_Cocoa_Event_Window\n"); | 80 | DBG("GOT_FOCUS: Failed to allocate Ecore_Cocoa_Event_Window\n"); |
81 | return; | 81 | return; |
82 | } | 82 | } |
83 | e->wid = [notification object]; | 83 | e->wid = [notification object]; |
@@ -91,7 +91,7 @@ | |||
91 | e = malloc(sizeof(Ecore_Cocoa_Event_Window)); | 91 | e = malloc(sizeof(Ecore_Cocoa_Event_Window)); |
92 | if (!e) | 92 | if (!e) |
93 | { | 93 | { |
94 | printf("LOST_FOCUS: Failed to allocate Ecore_Cocoa_Event_Window\n"); | 94 | DBG("LOST_FOCUS: Failed to allocate Ecore_Cocoa_Event_Window\n"); |
95 | return; | 95 | return; |
96 | } | 96 | } |
97 | e->wid = [notification object]; | 97 | e->wid = [notification object]; |
@@ -222,7 +222,7 @@ ecore_cocoa_window_show(Ecore_Cocoa_Window *window) | |||
222 | { | 222 | { |
223 | if (!window || [window->window isVisible]) | 223 | if (!window || [window->window isVisible]) |
224 | { | 224 | { |
225 | printf("Window(%p) is not visible\n", window->window); | 225 | DBG("Window(%p) is not visible\n", window->window); |
226 | return; | 226 | return; |
227 | } | 227 | } |
228 | 228 | ||
@@ -276,5 +276,8 @@ Ecore_Cocoa_Window_Id ecore_cocoa_window_get_window_id(Ecore_Cocoa_Window *windo | |||
276 | { | 276 | { |
277 | if (!window) | 277 | if (!window) |
278 | return 0; | 278 | return 0; |
279 | |||
280 | DBG("Return : %p", window->window); | ||
281 | |||
279 | return window->window; | 282 | return window->window; |
280 | } | 283 | } |