diff options
-rw-r--r-- | src/lib/ecore_cocoa/Ecore_Cocoa.h | 40 | ||||
-rw-r--r-- | src/lib/ecore_cocoa/ecore_cocoa_window.m | 6 | ||||
-rw-r--r-- | src/modules/ecore_evas/engines/cocoa/ecore_evas_cocoa.c | 12 |
3 files changed, 43 insertions, 15 deletions
diff --git a/src/lib/ecore_cocoa/Ecore_Cocoa.h b/src/lib/ecore_cocoa/Ecore_Cocoa.h index 079500a355..f479e3d3c6 100644 --- a/src/lib/ecore_cocoa/Ecore_Cocoa.h +++ b/src/lib/ecore_cocoa/Ecore_Cocoa.h | |||
@@ -40,11 +40,11 @@ | |||
40 | extern "C" { | 40 | extern "C" { |
41 | #endif | 41 | #endif |
42 | 42 | ||
43 | #ifndef _ECORE_COCOA_WINDOW_PREDEF | ||
43 | /** | 44 | /** |
44 | * @typedef Ecore_Cocoa_Window | 45 | * @typedef Ecore_Cocoa_Window |
45 | * Opaque handler to manipulate a Cocoa Window through Ecore | 46 | * Opaque handler to manipulate a Cocoa Window through Ecore |
46 | */ | 47 | */ |
47 | #ifndef _ECORE_COCOA_WINDOW_PREDEF | ||
48 | typedef struct _Ecore_Cocoa_Window Ecore_Cocoa_Window; | 48 | typedef struct _Ecore_Cocoa_Window Ecore_Cocoa_Window; |
49 | #endif /* ! _ECORE_COCOA_WINDOW_PREDEF */ | 49 | #endif /* ! _ECORE_COCOA_WINDOW_PREDEF */ |
50 | 50 | ||
@@ -66,15 +66,34 @@ typedef void Ecore_Cocoa_Object; | |||
66 | */ | 66 | */ |
67 | typedef struct _Ecore_Cocoa_Event_Window_Resize_Request Ecore_Cocoa_Event_Window_Resize_Request; | 67 | typedef struct _Ecore_Cocoa_Event_Window_Resize_Request Ecore_Cocoa_Event_Window_Resize_Request; |
68 | 68 | ||
69 | /** Event triggered when a window receives focus */ | 69 | /** |
70 | * @typedef Ecore_Cocoa_Event_Window_Focused | ||
71 | * Type of event thrown when a Cocoa window receives focus | ||
72 | */ | ||
73 | typedef struct _Ecore_Cocoa_Event_Window_Focused Ecore_Cocoa_Event_Window_Focused; | ||
74 | |||
75 | /** | ||
76 | * @typedef Ecore_Cocoa_Event_Window_Unfocused | ||
77 | * Type of event thrown when a Cocoa window loses the focus | ||
78 | */ | ||
79 | typedef struct _Ecore_Cocoa_Event_Window_Unfocused Ecore_Cocoa_Event_Window_Unfocused; | ||
80 | |||
81 | /** | ||
82 | * @typedef Ecore_Cocoa_Event_Window_Destroy | ||
83 | * Type of event thrown when a Cocoa window gets destoyed | ||
84 | */ | ||
85 | typedef struct _Ecore_Cocoa_Event_Window_Destroy Ecore_Cocoa_Event_Window_Destroy; | ||
86 | |||
87 | /** Event triggered when a Cocoa window receives focus */ | ||
70 | EAPI extern int ECORE_COCOA_EVENT_WINDOW_FOCUSED; | 88 | EAPI extern int ECORE_COCOA_EVENT_WINDOW_FOCUSED; |
71 | 89 | ||
72 | /** Event triggered when a window loses focus */ | 90 | /** Event triggered when a Cocoa window loses focus */ |
73 | EAPI extern int ECORE_COCOA_EVENT_WINDOW_UNFOCUSED; | 91 | EAPI extern int ECORE_COCOA_EVENT_WINDOW_UNFOCUSED; |
74 | 92 | ||
75 | /** Event triggered when a window is resized */ | 93 | /** Event triggered when a Cocoa window is resized */ |
76 | EAPI extern int ECORE_COCOA_EVENT_WINDOW_RESIZE_REQUEST; | 94 | EAPI extern int ECORE_COCOA_EVENT_WINDOW_RESIZE_REQUEST; |
77 | 95 | ||
96 | /** Event triggered when a Cocoa window get destroyed */ | ||
78 | EAPI extern int ECORE_COCOA_EVENT_WINDOW_DESTROY; | 97 | EAPI extern int ECORE_COCOA_EVENT_WINDOW_DESTROY; |
79 | 98 | ||
80 | /** | 99 | /** |
@@ -88,8 +107,17 @@ struct _Ecore_Cocoa_Event_Window_Resize_Request | |||
88 | Ecore_Cocoa_Object *cocoa_window; /**< Handler of the Cocoa window */ | 107 | Ecore_Cocoa_Object *cocoa_window; /**< Handler of the Cocoa window */ |
89 | }; | 108 | }; |
90 | 109 | ||
91 | typedef struct _Ecore_Cocoa_Event_Window Ecore_Cocoa_Event_Window; | 110 | struct _Ecore_Cocoa_Event_Window_Focused |
92 | struct _Ecore_Cocoa_Event_Window | 111 | { |
112 | Ecore_Cocoa_Object *cocoa_window; | ||
113 | }; | ||
114 | |||
115 | struct _Ecore_Cocoa_Event_Window_Unfocused | ||
116 | { | ||
117 | Ecore_Cocoa_Object *cocoa_window; | ||
118 | }; | ||
119 | |||
120 | struct _Ecore_Cocoa_Event_Window_Destroy | ||
93 | { | 121 | { |
94 | Ecore_Cocoa_Object *cocoa_window; | 122 | Ecore_Cocoa_Object *cocoa_window; |
95 | }; | 123 | }; |
diff --git a/src/lib/ecore_cocoa/ecore_cocoa_window.m b/src/lib/ecore_cocoa/ecore_cocoa_window.m index b57df81448..aef18da06e 100644 --- a/src/lib/ecore_cocoa/ecore_cocoa_window.m +++ b/src/lib/ecore_cocoa/ecore_cocoa_window.m | |||
@@ -56,7 +56,7 @@ static NSCursor *_cursors[__ECORE_COCOA_CURSOR_LAST]; | |||
56 | - (void)windowWillClose:(NSNotification *) notification | 56 | - (void)windowWillClose:(NSNotification *) notification |
57 | { | 57 | { |
58 | NSLog(@"window is going to be closed"); | 58 | NSLog(@"window is going to be closed"); |
59 | Ecore_Cocoa_Event_Window *event; | 59 | Ecore_Cocoa_Event_Window_Destroy *event; |
60 | 60 | ||
61 | event = malloc(sizeof(*event)); | 61 | event = malloc(sizeof(*event)); |
62 | if (EINA_UNLIKELY(event == NULL)) | 62 | if (EINA_UNLIKELY(event == NULL)) |
@@ -99,7 +99,7 @@ static NSCursor *_cursors[__ECORE_COCOA_CURSOR_LAST]; | |||
99 | 99 | ||
100 | - (void)windowDidBecomeKey:(NSNotification *)notification | 100 | - (void)windowDidBecomeKey:(NSNotification *)notification |
101 | { | 101 | { |
102 | Ecore_Cocoa_Event_Window *e; | 102 | Ecore_Cocoa_Event_Window_Focused *e; |
103 | 103 | ||
104 | e = malloc(sizeof(*e)); | 104 | e = malloc(sizeof(*e)); |
105 | if (EINA_UNLIKELY(e == NULL)) | 105 | if (EINA_UNLIKELY(e == NULL)) |
@@ -123,7 +123,7 @@ static NSCursor *_cursors[__ECORE_COCOA_CURSOR_LAST]; | |||
123 | 123 | ||
124 | - (void)windowDidResignKey:(NSNotification *)notification | 124 | - (void)windowDidResignKey:(NSNotification *)notification |
125 | { | 125 | { |
126 | Ecore_Cocoa_Event_Window *e; | 126 | Ecore_Cocoa_Event_Window_Unfocused *e; |
127 | 127 | ||
128 | e = malloc(sizeof(*e)); | 128 | e = malloc(sizeof(*e)); |
129 | if (EINA_UNLIKELY(e == NULL)) | 129 | if (EINA_UNLIKELY(e == NULL)) |
diff --git a/src/modules/ecore_evas/engines/cocoa/ecore_evas_cocoa.c b/src/modules/ecore_evas/engines/cocoa/ecore_evas_cocoa.c index 7069079329..2fc1914783 100644 --- a/src/modules/ecore_evas/engines/cocoa/ecore_evas_cocoa.c +++ b/src/modules/ecore_evas/engines/cocoa/ecore_evas_cocoa.c | |||
@@ -180,8 +180,8 @@ _ecore_evas_cocoa_match(Ecore_Cocoa_Object *cocoa_win) | |||
180 | static Eina_Bool | 180 | static Eina_Bool |
181 | _ecore_evas_cocoa_event_got_focus(void *data EINA_UNUSED, int type EINA_UNUSED, void *event) | 181 | _ecore_evas_cocoa_event_got_focus(void *data EINA_UNUSED, int type EINA_UNUSED, void *event) |
182 | { | 182 | { |
183 | Ecore_Cocoa_Event_Window *e = event; | 183 | Ecore_Cocoa_Event_Window_Focused *e = event; |
184 | Ecore_Evas *ee; | 184 | Ecore_Evas *ee; |
185 | 185 | ||
186 | ee = _ecore_evas_cocoa_match(e->cocoa_window); | 186 | ee = _ecore_evas_cocoa_match(e->cocoa_window); |
187 | if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON; | 187 | if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON; |
@@ -196,8 +196,8 @@ _ecore_evas_cocoa_event_got_focus(void *data EINA_UNUSED, int type EINA_UNUSED, | |||
196 | static Eina_Bool | 196 | static Eina_Bool |
197 | _ecore_evas_cocoa_event_lost_focus(void *data EINA_UNUSED, int type EINA_UNUSED, void *event) | 197 | _ecore_evas_cocoa_event_lost_focus(void *data EINA_UNUSED, int type EINA_UNUSED, void *event) |
198 | { | 198 | { |
199 | Ecore_Cocoa_Event_Window *e = event; | 199 | Ecore_Cocoa_Event_Window_Unfocused *e = event; |
200 | Ecore_Evas *ee; | 200 | Ecore_Evas *ee; |
201 | 201 | ||
202 | ee = _ecore_evas_cocoa_match(e->cocoa_window); | 202 | ee = _ecore_evas_cocoa_match(e->cocoa_window); |
203 | if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON; | 203 | if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON; |
@@ -257,8 +257,8 @@ _ecore_evas_cocoa_event_window_resize(void *data EINA_UNUSED, int type EINA_UNUS | |||
257 | static Eina_Bool | 257 | static Eina_Bool |
258 | _ecore_evas_cocoa_event_window_destroy(void *data EINA_UNUSED, int type EINA_UNUSED, void *event) | 258 | _ecore_evas_cocoa_event_window_destroy(void *data EINA_UNUSED, int type EINA_UNUSED, void *event) |
259 | { | 259 | { |
260 | Ecore_Cocoa_Event_Window *e = event; | 260 | Ecore_Cocoa_Event_Window_Destroy *e = event; |
261 | Ecore_Evas *ee; | 261 | Ecore_Evas *ee; |
262 | 262 | ||
263 | DBG(""); | 263 | DBG(""); |
264 | 264 | ||