summaryrefslogtreecommitdiff
path: root/src/lib/ecore_cocoa
diff options
context:
space:
mode:
authorpierre lamot <pierre.lamot@openwide.fr>2015-01-30 17:15:55 +0100
committerCedric BAIL <cedric@osg.samsung.com>2015-03-17 10:42:51 +0100
commit6ea9b476ad50bf218f3b0ca46df47b1a40517882 (patch)
tree2fc992df748ef87e8015945f4e4aa69f6f8a0fa3 /src/lib/ecore_cocoa
parent358bd3eb256c537afbc1606cef2be0233f076e1b (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.h1
-rw-r--r--src/lib/ecore_cocoa/ecore_cocoa.m2
-rw-r--r--src/lib/ecore_cocoa/ecore_cocoa_window.m11
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;
38EAPI extern int ECORE_COCOA_EVENT_LOST_FOCUS; 38EAPI extern int ECORE_COCOA_EVENT_LOST_FOCUS;
39EAPI extern int ECORE_COCOA_EVENT_RESIZE; 39EAPI extern int ECORE_COCOA_EVENT_RESIZE;
40EAPI extern int ECORE_COCOA_EVENT_EXPOSE; 40EAPI extern int ECORE_COCOA_EVENT_EXPOSE;
41EAPI extern int ECORE_COCOA_EVENT_WINDOW_DESTROY;
41 42
42typedef void * Ecore_Cocoa_Window_Id; 43typedef void * Ecore_Cocoa_Window_Id;
43typedef struct _Ecore_Cocoa_Event_Video_Resize Ecore_Cocoa_Event_Video_Resize; 44typedef 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;
20EAPI int ECORE_COCOA_EVENT_LOST_FOCUS = 0; 20EAPI int ECORE_COCOA_EVENT_LOST_FOCUS = 0;
21EAPI int ECORE_COCOA_EVENT_RESIZE = 0; 21EAPI int ECORE_COCOA_EVENT_RESIZE = 0;
22EAPI int ECORE_COCOA_EVENT_EXPOSE = 0; 22EAPI int ECORE_COCOA_EVENT_EXPOSE = 0;
23EAPI int ECORE_COCOA_EVENT_WINDOW_DESTROY = 0;
23 24
24static int _ecore_cocoa_init_count = 0; 25static 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