diff options
author | pierre lamot <pierre.lamot@openwide.fr> | 2015-01-30 17:15:55 +0100 |
---|---|---|
committer | Cedric BAIL <cedric@osg.samsung.com> | 2015-03-17 10:42:51 +0100 |
commit | 6ea9b476ad50bf218f3b0ca46df47b1a40517882 (patch) | |
tree | 2fc992df748ef87e8015945f4e4aa69f6f8a0fa3 /src/lib/ecore_cocoa | |
parent | 358bd3eb256c537afbc1606cef2be0233f076e1b (diff) |
ecore_cocoa: release resources on window close event
@fix this patch:
catch the window close event from cocoa and send an ecore event
this event is catched by a handler in ecore_evas wich will
call the registered fn_delete_request (from elementary for instance)
/!\ this patch is currently incomplete and leads to a segv when
closing the last window
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.h | 1 | ||||
-rw-r--r-- | src/lib/ecore_cocoa/ecore_cocoa.m | 2 | ||||
-rw-r--r-- | src/lib/ecore_cocoa/ecore_cocoa_window.m | 11 |
3 files changed, 14 insertions, 0 deletions
diff --git a/src/lib/ecore_cocoa/Ecore_Cocoa.h b/src/lib/ecore_cocoa/Ecore_Cocoa.h index 50796f15ad..c081721c9e 100644 --- a/src/lib/ecore_cocoa/Ecore_Cocoa.h +++ b/src/lib/ecore_cocoa/Ecore_Cocoa.h | |||
@@ -38,6 +38,7 @@ EAPI extern int ECORE_COCOA_EVENT_GOT_FOCUS; | |||
38 | EAPI extern int ECORE_COCOA_EVENT_LOST_FOCUS; | 38 | EAPI extern int ECORE_COCOA_EVENT_LOST_FOCUS; |
39 | EAPI extern int ECORE_COCOA_EVENT_RESIZE; | 39 | EAPI extern int ECORE_COCOA_EVENT_RESIZE; |
40 | EAPI extern int ECORE_COCOA_EVENT_EXPOSE; | 40 | EAPI extern int ECORE_COCOA_EVENT_EXPOSE; |
41 | EAPI extern int ECORE_COCOA_EVENT_WINDOW_DESTROY; | ||
41 | 42 | ||
42 | typedef void * Ecore_Cocoa_Window_Id; | 43 | typedef void * Ecore_Cocoa_Window_Id; |
43 | typedef struct _Ecore_Cocoa_Event_Video_Resize Ecore_Cocoa_Event_Video_Resize; | 44 | typedef struct _Ecore_Cocoa_Event_Video_Resize Ecore_Cocoa_Event_Video_Resize; |
diff --git a/src/lib/ecore_cocoa/ecore_cocoa.m b/src/lib/ecore_cocoa/ecore_cocoa.m index 4f1b01fe91..a28dc99770 100644 --- a/src/lib/ecore_cocoa/ecore_cocoa.m +++ b/src/lib/ecore_cocoa/ecore_cocoa.m | |||
@@ -20,6 +20,7 @@ EAPI int ECORE_COCOA_EVENT_GOT_FOCUS = 0; | |||
20 | EAPI int ECORE_COCOA_EVENT_LOST_FOCUS = 0; | 20 | EAPI int ECORE_COCOA_EVENT_LOST_FOCUS = 0; |
21 | EAPI int ECORE_COCOA_EVENT_RESIZE = 0; | 21 | EAPI int ECORE_COCOA_EVENT_RESIZE = 0; |
22 | EAPI int ECORE_COCOA_EVENT_EXPOSE = 0; | 22 | EAPI int ECORE_COCOA_EVENT_EXPOSE = 0; |
23 | EAPI int ECORE_COCOA_EVENT_WINDOW_DESTROY = 0; | ||
23 | 24 | ||
24 | static int _ecore_cocoa_init_count = 0; | 25 | static int _ecore_cocoa_init_count = 0; |
25 | 26 | ||
@@ -50,6 +51,7 @@ ecore_cocoa_init(void) | |||
50 | ECORE_COCOA_EVENT_LOST_FOCUS = ecore_event_type_new(); | 51 | ECORE_COCOA_EVENT_LOST_FOCUS = ecore_event_type_new(); |
51 | ECORE_COCOA_EVENT_RESIZE = ecore_event_type_new(); | 52 | ECORE_COCOA_EVENT_RESIZE = ecore_event_type_new(); |
52 | ECORE_COCOA_EVENT_EXPOSE = ecore_event_type_new(); | 53 | ECORE_COCOA_EVENT_EXPOSE = ecore_event_type_new(); |
54 | ECORE_COCOA_EVENT_WINDOW_DESTROY = ecore_event_type_new(); | ||
53 | 55 | ||
54 | /* Init the Application handler */ | 56 | /* Init the Application handler */ |
55 | [Ecore_Cocoa_Application sharedApplication]; | 57 | [Ecore_Cocoa_Application sharedApplication]; |
diff --git a/src/lib/ecore_cocoa/ecore_cocoa_window.m b/src/lib/ecore_cocoa/ecore_cocoa_window.m index 4c5352fb65..62743d9ceb 100644 --- a/src/lib/ecore_cocoa/ecore_cocoa_window.m +++ b/src/lib/ecore_cocoa/ecore_cocoa_window.m | |||
@@ -50,6 +50,17 @@ | |||
50 | - (void)windowWillClose:(NSNotification *) EINA_UNUSED notification | 50 | - (void)windowWillClose:(NSNotification *) EINA_UNUSED notification |
51 | { | 51 | { |
52 | NSLog(@"window is going to be closed"); | 52 | NSLog(@"window is going to be closed"); |
53 | Ecore_Cocoa_Event_Window *event; | ||
54 | |||
55 | event = malloc(sizeof(Ecore_Cocoa_Event_Window)); | ||
56 | if (event == NULL) | ||
57 | { | ||
58 | // FIXME Use Eina_Log | ||
59 | printf("Failed to allocate Ecore_Cocoa_Event_Window_destroy\n"); | ||
60 | return; | ||
61 | } | ||
62 | event->wid = [notification object]; | ||
63 | ecore_event_add(ECORE_COCOA_EVENT_WINDOW_DESTROY, event, NULL, NULL); | ||
53 | } | 64 | } |
54 | 65 | ||
55 | - (void)windowDidResize:(NSNotification *) EINA_UNUSED notif | 66 | - (void)windowDidResize:(NSNotification *) EINA_UNUSED notif |