summaryrefslogtreecommitdiff
path: root/src/lib/ecore_cocoa
diff options
context:
space:
mode:
authorJean Guyomarc'h <jean.guyomarch@gmail.com>2016-01-06 22:13:42 +0100
committerCedric BAIL <cedric@osg.samsung.com>2016-03-02 13:56:28 -0800
commitdeb553d55e8b1964709ef8923f6bcdfbe848471f (patch)
tree3b8323f809c6896d236475e0a544274d36fe1f94 /src/lib/ecore_cocoa
parente7dc1491a2a93e274c122b6a7236e0278980f5e2 (diff)
ecore_cocoa: remove Ecore_Cocoa_Event_Window
Create specific structures for each event: - Ecore_Cocoa_Event_Window_Focused - Ecore_Cocoa_Event_Window_Unfocused - Ecore_Cocoa_Event_Window_Destroy They are currently hold the same data, but this will allow not to break the event protocol when future extensions will be needed. 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.h40
-rw-r--r--src/lib/ecore_cocoa/ecore_cocoa_window.m6
2 files changed, 37 insertions, 9 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 @@
40extern "C" { 40extern "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
48typedef struct _Ecore_Cocoa_Window Ecore_Cocoa_Window; 48typedef 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 */
67typedef struct _Ecore_Cocoa_Event_Window_Resize_Request Ecore_Cocoa_Event_Window_Resize_Request; 67typedef 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 */
73typedef 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 */
79typedef 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 */
85typedef struct _Ecore_Cocoa_Event_Window_Destroy Ecore_Cocoa_Event_Window_Destroy;
86
87/** Event triggered when a Cocoa window receives focus */
70EAPI extern int ECORE_COCOA_EVENT_WINDOW_FOCUSED; 88EAPI 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 */
73EAPI extern int ECORE_COCOA_EVENT_WINDOW_UNFOCUSED; 91EAPI 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 */
76EAPI extern int ECORE_COCOA_EVENT_WINDOW_RESIZE_REQUEST; 94EAPI extern int ECORE_COCOA_EVENT_WINDOW_RESIZE_REQUEST;
77 95
96/** Event triggered when a Cocoa window get destroyed */
78EAPI extern int ECORE_COCOA_EVENT_WINDOW_DESTROY; 97EAPI 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
91typedef struct _Ecore_Cocoa_Event_Window Ecore_Cocoa_Event_Window; 110struct _Ecore_Cocoa_Event_Window_Focused
92struct _Ecore_Cocoa_Event_Window 111{
112 Ecore_Cocoa_Object *cocoa_window;
113};
114
115struct _Ecore_Cocoa_Event_Window_Unfocused
116{
117 Ecore_Cocoa_Object *cocoa_window;
118};
119
120struct _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))