diff options
author | Jean Guyomarc'h <jean.guyomarch@gmail.com> | 2014-09-03 20:34:52 +0200 |
---|---|---|
committer | Cedric BAIL <cedric@osg.samsung.com> | 2014-09-03 20:34:57 +0200 |
commit | c03876d611fca41d02513fb07d3d275f64bcf0cd (patch) | |
tree | 63285bde05db0b2f116b5e4b8c268b58f01d7681 /src/lib/ecore_cocoa | |
parent | 8f40c291cabb790354ac87f053845429096011d3 (diff) |
ecore_cocoa: NSRunLoop integration
Summary: Get rid of the old NSApplicationLoad() which was aimed to be use with Carbon. Unless the NSRunLoop is strictly integrated to the ecore_main_loop() (where cocoa events would be checked when entering the ecore_main_loop) I think the poller is the only option left.
Reviewers: raster, naguirre, raoulh, stefan_schmidt, cedric
@feature
Subscribers: cedric
Differential Revision: https://phab.enlightenment.org/D1222
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 | 4 | ||||
-rw-r--r-- | src/lib/ecore_cocoa/ecore_cocoa.m | 70 | ||||
-rw-r--r-- | src/lib/ecore_cocoa/ecore_cocoa_app.h | 28 | ||||
-rw-r--r-- | src/lib/ecore_cocoa/ecore_cocoa_app.m | 125 | ||||
-rw-r--r-- | src/lib/ecore_cocoa/ecore_cocoa_window.m | 1 |
5 files changed, 193 insertions, 35 deletions
diff --git a/src/lib/ecore_cocoa/Ecore_Cocoa.h b/src/lib/ecore_cocoa/Ecore_Cocoa.h index 0bd8dd27f7..4f76f39882 100644 --- a/src/lib/ecore_cocoa/Ecore_Cocoa.h +++ b/src/lib/ecore_cocoa/Ecore_Cocoa.h | |||
@@ -25,6 +25,8 @@ | |||
25 | # define EAPI | 25 | # define EAPI |
26 | #endif | 26 | #endif |
27 | 27 | ||
28 | #include <Eina.h> | ||
29 | |||
28 | #ifdef __cplusplus | 30 | #ifdef __cplusplus |
29 | extern "C" { | 31 | extern "C" { |
30 | #endif | 32 | #endif |
@@ -53,7 +55,7 @@ struct _Ecore_Cocoa_Screen | |||
53 | 55 | ||
54 | EAPI int ecore_cocoa_init(void); | 56 | EAPI int ecore_cocoa_init(void); |
55 | EAPI int ecore_cocoa_shutdown(void); | 57 | EAPI int ecore_cocoa_shutdown(void); |
56 | EAPI void ecore_cocoa_feed_events(void); | 58 | EAPI Eina_Bool ecore_cocoa_feed_events(void *anEvent); |
57 | 59 | ||
58 | /* Screen */ | 60 | /* Screen */ |
59 | 61 | ||
diff --git a/src/lib/ecore_cocoa/ecore_cocoa.m b/src/lib/ecore_cocoa/ecore_cocoa.m index 2b1bf08946..f02601bb5d 100644 --- a/src/lib/ecore_cocoa/ecore_cocoa.m +++ b/src/lib/ecore_cocoa/ecore_cocoa.m | |||
@@ -4,6 +4,7 @@ | |||
4 | 4 | ||
5 | #import <Cocoa/Cocoa.h> | 5 | #import <Cocoa/Cocoa.h> |
6 | #import "ecore_cocoa_window.h" | 6 | #import "ecore_cocoa_window.h" |
7 | #import "ecore_cocoa_app.h" | ||
7 | 8 | ||
8 | #include <Eina.h> | 9 | #include <Eina.h> |
9 | 10 | ||
@@ -30,16 +31,24 @@ ecore_cocoa_init(void) | |||
30 | if (++_ecore_cocoa_init_count != 1) | 31 | if (++_ecore_cocoa_init_count != 1) |
31 | return _ecore_cocoa_init_count; | 32 | return _ecore_cocoa_init_count; |
32 | 33 | ||
33 | if (!ecore_event_init()) | 34 | if (!ecore_init()) |
34 | return --_ecore_cocoa_init_count; | 35 | return --_ecore_cocoa_init_count; |
35 | 36 | ||
36 | NSApplicationLoad(); | 37 | if (!ecore_event_init()) |
38 | return --_ecore_cocoa_init_count; | ||
37 | 39 | ||
38 | ECORE_COCOA_EVENT_GOT_FOCUS = ecore_event_type_new(); | 40 | ECORE_COCOA_EVENT_GOT_FOCUS = ecore_event_type_new(); |
39 | ECORE_COCOA_EVENT_LOST_FOCUS = ecore_event_type_new(); | 41 | ECORE_COCOA_EVENT_LOST_FOCUS = ecore_event_type_new(); |
40 | ECORE_COCOA_EVENT_RESIZE = ecore_event_type_new(); | 42 | ECORE_COCOA_EVENT_RESIZE = ecore_event_type_new(); |
41 | ECORE_COCOA_EVENT_EXPOSE = ecore_event_type_new(); | 43 | ECORE_COCOA_EVENT_EXPOSE = ecore_event_type_new(); |
42 | 44 | ||
45 | /* Init the Application handler */ | ||
46 | [Ecore_Cocoa_Application sharedApplication]; | ||
47 | [NSApp setDelegate:[Ecore_Cocoa_AppDelegate appDelegate]]; | ||
48 | |||
49 | /* Start events monitoring */ | ||
50 | [NSApp run]; | ||
51 | |||
43 | return _ecore_cocoa_init_count; | 52 | return _ecore_cocoa_init_count; |
44 | } | 53 | } |
45 | 54 | ||
@@ -89,21 +98,16 @@ _has_ecore_cocoa_window(NSEvent *event) | |||
89 | return _nsevent_window_is_type_of(event, [EcoreCocoaWindow class]); | 98 | return _nsevent_window_is_type_of(event, [EcoreCocoaWindow class]); |
90 | } | 99 | } |
91 | 100 | ||
92 | EAPI void | 101 | EAPI Eina_Bool |
93 | ecore_cocoa_feed_events(void) | 102 | ecore_cocoa_feed_events(void *anEvent) |
94 | { | 103 | { |
95 | Ecore_Event *ev; | 104 | EINA_SAFETY_ON_NULL_RETURN_VAL(anEvent, EINA_FALSE); |
96 | NSDate *date = [NSDate dateWithTimeIntervalSinceNow:0.001]; | ||
97 | NSEvent *event = [NSApp nextEventMatchingMask:NSAnyEventMask | ||
98 | untilDate:date | ||
99 | inMode:NSDefaultRunLoopMode | ||
100 | dequeue:YES]; | ||
101 | [date release]; | ||
102 | if (!event) return; // SDL loops until null; maybe we should do that too. or not. | ||
103 | 105 | ||
106 | NSEvent *event = anEvent; | ||
104 | unsigned int time = (unsigned int)((unsigned long long)(ecore_time_get() * 1000.0) & 0xffffffff); | 107 | unsigned int time = (unsigned int)((unsigned long long)(ecore_time_get() * 1000.0) & 0xffffffff); |
108 | Eina_Bool pass = EINA_FALSE; | ||
105 | 109 | ||
106 | switch([event type]) | 110 | switch ([event type]) |
107 | { | 111 | { |
108 | case NSMouseMoved: | 112 | case NSMouseMoved: |
109 | case NSLeftMouseDragged: | 113 | case NSLeftMouseDragged: |
@@ -113,7 +117,7 @@ ecore_cocoa_feed_events(void) | |||
113 | if (_has_ecore_cocoa_window(event)) | 117 | if (_has_ecore_cocoa_window(event)) |
114 | { | 118 | { |
115 | Ecore_Event_Mouse_Move * ev = calloc(1, sizeof(Ecore_Event_Mouse_Move)); | 119 | Ecore_Event_Mouse_Move * ev = calloc(1, sizeof(Ecore_Event_Mouse_Move)); |
116 | if (!ev) return; | 120 | if (!ev) return pass; |
117 | 121 | ||
118 | EcoreCocoaWindow *window = (EcoreCocoaWindow *)[event window]; | 122 | EcoreCocoaWindow *window = (EcoreCocoaWindow *)[event window]; |
119 | NSView *view = [window contentView]; | 123 | NSView *view = [window contentView]; |
@@ -124,7 +128,7 @@ ecore_cocoa_feed_events(void) | |||
124 | ev->root.x = ev->x; | 128 | ev->root.x = ev->x; |
125 | ev->root.y = ev->y; | 129 | ev->root.y = ev->y; |
126 | ev->timestamp = time; | 130 | ev->timestamp = time; |
127 | ev->window = window.ecore_window_data; | 131 | ev->window = (Ecore_Window)window.ecore_window_data; |
128 | ev->event_window = ev->window; | 132 | ev->event_window = ev->window; |
129 | ev->modifiers = 0; /* FIXME: keep modifier around. */ | 133 | ev->modifiers = 0; /* FIXME: keep modifier around. */ |
130 | 134 | ||
@@ -135,7 +139,7 @@ ecore_cocoa_feed_events(void) | |||
135 | // We might want to handle cases such as events on the menubar. | 139 | // We might want to handle cases such as events on the menubar. |
136 | // If so, let's do it here. | 140 | // If so, let's do it here. |
137 | } | 141 | } |
138 | [NSApp sendEvent:event]; // pass along mouse events, for window manager | 142 | pass = EINA_TRUE; |
139 | break; | 143 | break; |
140 | } | 144 | } |
141 | case NSLeftMouseDown: | 145 | case NSLeftMouseDown: |
@@ -145,7 +149,7 @@ ecore_cocoa_feed_events(void) | |||
145 | if (_has_ecore_cocoa_window(event)) | 149 | if (_has_ecore_cocoa_window(event)) |
146 | { | 150 | { |
147 | Ecore_Event_Mouse_Button * ev = calloc(1, sizeof(Ecore_Event_Mouse_Button)); | 151 | Ecore_Event_Mouse_Button * ev = calloc(1, sizeof(Ecore_Event_Mouse_Button)); |
148 | if (!ev) return; | 152 | if (!ev) return pass; |
149 | 153 | ||
150 | EcoreCocoaWindow *window = (EcoreCocoaWindow *)[event window]; | 154 | EcoreCocoaWindow *window = (EcoreCocoaWindow *)[event window]; |
151 | NSView *view = [window contentView]; | 155 | NSView *view = [window contentView]; |
@@ -163,7 +167,7 @@ ecore_cocoa_feed_events(void) | |||
163 | case 2: ev->buttons = 2; break; | 167 | case 2: ev->buttons = 2; break; |
164 | default: ev->buttons = 0; break; | 168 | default: ev->buttons = 0; break; |
165 | } | 169 | } |
166 | ev->window = window.ecore_window_data; | 170 | ev->window = (Ecore_Window)window.ecore_window_data; |
167 | ev->event_window = ev->window; | 171 | ev->event_window = ev->window; |
168 | 172 | ||
169 | if ([event clickCount] == 2) | 173 | if ([event clickCount] == 2) |
@@ -183,7 +187,7 @@ ecore_cocoa_feed_events(void) | |||
183 | // We might want to handle cases such as events on the menubar. | 187 | // We might want to handle cases such as events on the menubar. |
184 | // If so, let's do it here. | 188 | // If so, let's do it here. |
185 | } | 189 | } |
186 | [NSApp sendEvent:event]; // pass along mouse events, for window manager | 190 | pass = EINA_TRUE; |
187 | break; | 191 | break; |
188 | } | 192 | } |
189 | case NSLeftMouseUp: | 193 | case NSLeftMouseUp: |
@@ -191,7 +195,7 @@ ecore_cocoa_feed_events(void) | |||
191 | case NSOtherMouseUp: | 195 | case NSOtherMouseUp: |
192 | { | 196 | { |
193 | Ecore_Event_Mouse_Button * ev = calloc(1, sizeof(Ecore_Event_Mouse_Button)); | 197 | Ecore_Event_Mouse_Button * ev = calloc(1, sizeof(Ecore_Event_Mouse_Button)); |
194 | if (!ev) return; | 198 | if (!ev) return pass; |
195 | 199 | ||
196 | if (_has_ecore_cocoa_window(event)) | 200 | if (_has_ecore_cocoa_window(event)) |
197 | { | 201 | { |
@@ -211,7 +215,7 @@ ecore_cocoa_feed_events(void) | |||
211 | case 2: ev->buttons = 2; break; | 215 | case 2: ev->buttons = 2; break; |
212 | default: ev->buttons = 0; break; | 216 | default: ev->buttons = 0; break; |
213 | } | 217 | } |
214 | ev->window = window.ecore_window_data; | 218 | ev->window = (Ecore_Window)window.ecore_window_data; |
215 | ev->event_window = ev->window; | 219 | ev->event_window = ev->window; |
216 | 220 | ||
217 | if ([event clickCount] == 2) | 221 | if ([event clickCount] == 2) |
@@ -231,7 +235,7 @@ ecore_cocoa_feed_events(void) | |||
231 | // We might want to handle cases such as events on the menubar. | 235 | // We might want to handle cases such as events on the menubar. |
232 | // If so, let's do it here. | 236 | // If so, let's do it here. |
233 | } | 237 | } |
234 | [NSApp sendEvent:event]; // pass along mouse events, for window manager | 238 | pass = EINA_TRUE; |
235 | break; | 239 | break; |
236 | } | 240 | } |
237 | case NSKeyDown: | 241 | case NSKeyDown: |
@@ -241,7 +245,7 @@ ecore_cocoa_feed_events(void) | |||
241 | EcoreCocoaWindow *window = (EcoreCocoaWindow *)[event window]; | 245 | EcoreCocoaWindow *window = (EcoreCocoaWindow *)[event window]; |
242 | 246 | ||
243 | ev = calloc(1, sizeof (Ecore_Event_Key)); | 247 | ev = calloc(1, sizeof (Ecore_Event_Key)); |
244 | if (!ev) return; | 248 | if (!ev) return pass; |
245 | ev->timestamp = time; | 249 | ev->timestamp = time; |
246 | ev->modifiers = _ecore_cocoa_event_modifiers([event modifierFlags]); | 250 | ev->modifiers = _ecore_cocoa_event_modifiers([event modifierFlags]); |
247 | 251 | ||
@@ -253,10 +257,10 @@ ecore_cocoa_feed_events(void) | |||
253 | ev->keyname = keystable[i].name; | 257 | ev->keyname = keystable[i].name; |
254 | ev->key = keystable[i].name; | 258 | ev->key = keystable[i].name; |
255 | ev->string = keystable[i].compose; | 259 | ev->string = keystable[i].compose; |
256 | ev->window = window.ecore_window_data; | 260 | ev->window = (Ecore_Window)window.ecore_window_data; |
257 | ev->event_window = ev->window; | 261 | ev->event_window = ev->window; |
258 | ecore_event_add(ECORE_EVENT_KEY_DOWN, ev, NULL, NULL); | 262 | ecore_event_add(ECORE_EVENT_KEY_DOWN, ev, NULL, NULL); |
259 | return; | 263 | return pass; |
260 | } | 264 | } |
261 | } | 265 | } |
262 | 266 | ||
@@ -271,7 +275,7 @@ ecore_cocoa_feed_events(void) | |||
271 | printf("Key Up\n"); | 275 | printf("Key Up\n"); |
272 | 276 | ||
273 | ev = calloc(1, sizeof (Ecore_Event_Key)); | 277 | ev = calloc(1, sizeof (Ecore_Event_Key)); |
274 | if (!ev) return; | 278 | if (!ev) return pass; |
275 | ev->timestamp = time; | 279 | ev->timestamp = time; |
276 | ev->modifiers = _ecore_cocoa_event_modifiers([event modifierFlags]); | 280 | ev->modifiers = _ecore_cocoa_event_modifiers([event modifierFlags]); |
277 | 281 | ||
@@ -282,10 +286,10 @@ ecore_cocoa_feed_events(void) | |||
282 | ev->keyname = keystable[i].name; | 286 | ev->keyname = keystable[i].name; |
283 | ev->key = keystable[i].name; | 287 | ev->key = keystable[i].name; |
284 | ev->string = keystable[i].compose; | 288 | ev->string = keystable[i].compose; |
285 | ev->window = window.ecore_window_data; | 289 | ev->window = (Ecore_Window)window.ecore_window_data; |
286 | ev->event_window = ev->window; | 290 | ev->event_window = ev->window; |
287 | ecore_event_add(ECORE_EVENT_KEY_UP, ev, NULL, NULL); | 291 | ecore_event_add(ECORE_EVENT_KEY_UP, ev, NULL, NULL); |
288 | return; | 292 | return pass; |
289 | } | 293 | } |
290 | } | 294 | } |
291 | 295 | ||
@@ -299,13 +303,13 @@ ecore_cocoa_feed_events(void) | |||
299 | Ecore_Event_Key *evUp = NULL; | 303 | Ecore_Event_Key *evUp = NULL; |
300 | 304 | ||
301 | evDown = calloc(1, sizeof (Ecore_Event_Key)); | 305 | evDown = calloc(1, sizeof (Ecore_Event_Key)); |
302 | if (!evDown) return; | 306 | if (!evDown) return pass; |
303 | 307 | ||
304 | evUp = calloc(1, sizeof (Ecore_Event_Key)); | 308 | evUp = calloc(1, sizeof (Ecore_Event_Key)); |
305 | if (!evUp) | 309 | if (!evUp) |
306 | { | 310 | { |
307 | free(evDown); | 311 | free(evDown); |
308 | return; | 312 | return pass; |
309 | } | 313 | } |
310 | 314 | ||
311 | // Turn special key flags on | 315 | // Turn special key flags on |
@@ -360,7 +364,7 @@ ecore_cocoa_feed_events(void) | |||
360 | ecore_event_add(ECORE_COCOA_EVENT_GOT_FOCUS, NULL, NULL, NULL); | 364 | ecore_event_add(ECORE_COCOA_EVENT_GOT_FOCUS, NULL, NULL, NULL); |
361 | else if ([event subtype] == NSApplicationDeactivatedEventType) | 365 | else if ([event subtype] == NSApplicationDeactivatedEventType) |
362 | ecore_event_add(ECORE_COCOA_EVENT_LOST_FOCUS, NULL, NULL, NULL); | 366 | ecore_event_add(ECORE_COCOA_EVENT_LOST_FOCUS, NULL, NULL, NULL); |
363 | [NSApp sendEvent:event]; // pass along AppKit events, for window manager | 367 | pass = EINA_TRUE; // pass along AppKit events, for window manager |
364 | break; | 368 | break; |
365 | } | 369 | } |
366 | case NSScrollWheel: | 370 | case NSScrollWheel: |
@@ -370,12 +374,12 @@ ecore_cocoa_feed_events(void) | |||
370 | } | 374 | } |
371 | default: | 375 | default: |
372 | { | 376 | { |
373 | [NSApp sendEvent:event]; | 377 | pass = EINA_TRUE; |
374 | break; | 378 | break; |
375 | } | 379 | } |
376 | } | 380 | } |
377 | 381 | ||
378 | [event release]; | 382 | return pass; |
379 | } | 383 | } |
380 | 384 | ||
381 | EAPI void | 385 | EAPI void |
diff --git a/src/lib/ecore_cocoa/ecore_cocoa_app.h b/src/lib/ecore_cocoa/ecore_cocoa_app.h new file mode 100644 index 0000000000..eac6aa85a2 --- /dev/null +++ b/src/lib/ecore_cocoa/ecore_cocoa_app.h | |||
@@ -0,0 +1,28 @@ | |||
1 | #import <Cocoa/Cocoa.h> | ||
2 | #include "Ecore_Cocoa.h" | ||
3 | #include <Ecore.h> | ||
4 | |||
5 | @interface Ecore_Cocoa_Application : NSApplication | ||
6 | { | ||
7 | Ecore_Poller *_poller; | ||
8 | NSDate *_expiration; | ||
9 | } | ||
10 | |||
11 | - (NSDate *)eventExpirationDate; | ||
12 | |||
13 | + (Ecore_Cocoa_Application *)sharedApplication; | ||
14 | - (void)run; | ||
15 | - (void)sendEvent:(NSEvent *)anEvent; | ||
16 | - (id)init; | ||
17 | - (void)internalUpdate; | ||
18 | |||
19 | @end | ||
20 | |||
21 | |||
22 | @interface Ecore_Cocoa_AppDelegate : NSObject <NSApplicationDelegate> | ||
23 | |||
24 | + (Ecore_Cocoa_AppDelegate *)appDelegate; | ||
25 | - (id)init; | ||
26 | |||
27 | @end | ||
28 | |||
diff --git a/src/lib/ecore_cocoa/ecore_cocoa_app.m b/src/lib/ecore_cocoa/ecore_cocoa_app.m new file mode 100644 index 0000000000..3aeda02ba2 --- /dev/null +++ b/src/lib/ecore_cocoa/ecore_cocoa_app.m | |||
@@ -0,0 +1,125 @@ | |||
1 | #import "ecore_cocoa_app.h" | ||
2 | |||
3 | static Eina_Bool | ||
4 | _ecore_cocoa_run_loop_cb(void *data EINA_UNUSED) | ||
5 | { | ||
6 | @autoreleasepool { | ||
7 | @try { | ||
8 | NSEvent *e; | ||
9 | do { | ||
10 | e = [NSApp nextEventMatchingMask:NSAnyEventMask | ||
11 | untilDate:[NSApp eventExpirationDate] | ||
12 | inMode:NSDefaultRunLoopMode | ||
13 | dequeue:YES]; | ||
14 | if (e != nil) { | ||
15 | //NSLog(@"Catching event %@", e); | ||
16 | |||
17 | [NSApp sendEvent:e]; | ||
18 | |||
19 | /* Update (en/disable) the services menu's items */ | ||
20 | NSEventType type = [e type]; | ||
21 | if (type != NSPeriodic && type != NSMouseMoved) { | ||
22 | [NSApp internalUpdate]; | ||
23 | } | ||
24 | } | ||
25 | } while (e != nil); | ||
26 | } | ||
27 | @catch (NSException *except) { | ||
28 | NSLog(@"EXCEPTION: %@: %@", [except name], [except reason]); | ||
29 | /* Show the "fancy" annoying report panel */ | ||
30 | [NSApp reportException:except]; | ||
31 | // XXX Maybe use Eina_Log to report the error instead | ||
32 | } | ||
33 | } | ||
34 | |||
35 | return ECORE_CALLBACK_RENEW; | ||
36 | } | ||
37 | |||
38 | @implementation Ecore_Cocoa_Application | ||
39 | |||
40 | + (Ecore_Cocoa_Application *)sharedApplication | ||
41 | { | ||
42 | return (Ecore_Cocoa_Application *)[super sharedApplication]; | ||
43 | } | ||
44 | |||
45 | - (void)internalUpdate | ||
46 | { | ||
47 | [_mainMenu update]; | ||
48 | // FIXME Will not compile with GNUStep (member is named "_main_menu") | ||
49 | } | ||
50 | |||
51 | - (id)init | ||
52 | { | ||
53 | self = [super init]; | ||
54 | if (self == nil) { | ||
55 | // XXX Critical error. Abort right now! Log? | ||
56 | return nil; | ||
57 | } | ||
58 | NSApp = self; // NSApp is used EVERYWHERE! Set it right now! | ||
59 | return NSApp; | ||
60 | } | ||
61 | |||
62 | - (NSDate *)eventExpirationDate | ||
63 | { | ||
64 | return _expiration; | ||
65 | } | ||
66 | |||
67 | - (void)run | ||
68 | { | ||
69 | [self finishLaunching]; | ||
70 | |||
71 | _running = 1; | ||
72 | _expiration = [NSDate distantPast]; | ||
73 | |||
74 | _poller = ecore_poller_add(ECORE_POLLER_CORE, | ||
75 | ecore_poller_poll_interval_get(ECORE_POLLER_CORE), | ||
76 | _ecore_cocoa_run_loop_cb, NULL); | ||
77 | if (_poller == NULL) { | ||
78 | // XXX ERROR | ||
79 | } | ||
80 | } | ||
81 | |||
82 | |||
83 | - (void)sendEvent:(NSEvent *)anEvent | ||
84 | { | ||
85 | Eina_Bool to_super; | ||
86 | |||
87 | /* Some events shall be handled by Ecore (like single non-command keys). | ||
88 | * If we dispatch all events right to NSApplication, it will complain | ||
89 | * with NSBeep() when an event is not authorized */ | ||
90 | to_super = ecore_cocoa_feed_events(anEvent); | ||
91 | if (to_super) | ||
92 | [super sendEvent:anEvent]; | ||
93 | } | ||
94 | |||
95 | |||
96 | @end | ||
97 | |||
98 | |||
99 | |||
100 | static Ecore_Cocoa_AppDelegate *_appDelegate = nil; | ||
101 | |||
102 | @implementation Ecore_Cocoa_AppDelegate | ||
103 | |||
104 | + (Ecore_Cocoa_AppDelegate *)appDelegate | ||
105 | { | ||
106 | if (_appDelegate == nil) { | ||
107 | _appDelegate = [[self alloc] init]; | ||
108 | } | ||
109 | return _appDelegate; | ||
110 | } | ||
111 | |||
112 | - (id)init | ||
113 | { | ||
114 | self = [super init]; | ||
115 | return self; | ||
116 | } | ||
117 | |||
118 | - (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)sender | ||
119 | { | ||
120 | // XXX This should be alterable (by Elm_Window policy) | ||
121 | return YES; | ||
122 | } | ||
123 | |||
124 | @end | ||
125 | |||
diff --git a/src/lib/ecore_cocoa/ecore_cocoa_window.m b/src/lib/ecore_cocoa/ecore_cocoa_window.m index ab4a78ce13..dc636fdb41 100644 --- a/src/lib/ecore_cocoa/ecore_cocoa_window.m +++ b/src/lib/ecore_cocoa/ecore_cocoa_window.m | |||
@@ -65,7 +65,6 @@ | |||
65 | event->w = size.width; | 65 | event->w = size.width; |
66 | event->h = size.height - | 66 | event->h = size.height - |
67 | (([self isFullScreen] == YES) ? 0 : ecore_cocoa_titlebar_height_get()); | 67 | (([self isFullScreen] == YES) ? 0 : ecore_cocoa_titlebar_height_get()); |
68 | printf("Is fullscreen: %i\n", [self isFullScreen]); | ||
69 | ecore_event_add(ECORE_COCOA_EVENT_RESIZE, event, NULL, NULL); | 68 | ecore_event_add(ECORE_COCOA_EVENT_RESIZE, event, NULL, NULL); |
70 | } | 69 | } |
71 | 70 | ||