2014-09-03 11:34:52 -07:00
|
|
|
#import "ecore_cocoa_app.h"
|
ecore_cocoa,ethumb: fix compiling after EAPI policy changes
Summary:
I went through a lot of undefined symbols while compiling ecore_evas_cocoa
module and ethumb-related binaries. E.g.:
Undefined symbols for architecture x86_64:
"_ECORE_COCOA_EVENT_EXPOSE", referenced from:
_ecore_evas_cocoa_new_internal in modules_ecore_evas_engines_cocoa_module_la-ecore_evas_cocoa.o
"_ECORE_COCOA_EVENT_GOT_FOCUS", referenced from:
_ecore_evas_cocoa_new_internal in modules_ecore_evas_engines_cocoa_module_la-ecore_evas_cocoa.o
"_ECORE_COCOA_EVENT_LOST_FOCUS", referenced from:
_ecore_evas_cocoa_new_internal in modules_ecore_evas_engines_cocoa_module_la-ecore_evas_cocoa.o
"_ECORE_COCOA_EVENT_RESIZE", referenced from:
_ecore_evas_cocoa_new_internal in modules_ecore_evas_engines_cocoa_module_la-ecore_evas_cocoa.o
"_ECORE_COCOA_EVENT_WINDOW_DESTROY", referenced from:
_ecore_evas_cocoa_new_internal in modules_ecore_evas_engines_cocoa_module_la-ecore_evas_cocoa.o
"_ecore_cocoa_init", referenced from:
_ecore_evas_cocoa_new_internal in modules_ecore_evas_engines_cocoa_module_la-ecore_evas_cocoa.o
"_ecore_cocoa_screen_size_get", referenced from:
__ecore_evas_screen_geometry_get in modules_ecore_evas_engines_cocoa_module_la-ecore_evas_cocoa.o
"_ecore_cocoa_shutdown", referenced from:
_ecore_evas_cocoa_new_internal in modules_ecore_evas_engines_cocoa_module_la-ecore_evas_cocoa.o
__ecore_evas_cocoa_free in modules_ecore_evas_engines_cocoa_module_la-ecore_evas_cocoa.o
Undefined symbols for architecture x86_64:
"_ethumb_calculate_aspect_from_ratio", referenced from:
__resize_movie in modules_ethumb_emotion_module_la-emotion.o
"_ethumb_calculate_fill_from_ratio", referenced from:
__resize_movie in modules_ethumb_emotion_module_la-emotion.o
"_ethumb_ecore_evas_get", referenced from:
__frame_decode_cb in modules_ethumb_emotion_module_la-emotion.o
"_ethumb_evas_get", referenced from:
__thumb_generate in modules_ethumb_emotion_module_la-emotion.o
__finish_thumb_generation in modules_ethumb_emotion_module_la-emotion.o
"_ethumb_finished_callback_call", referenced from:
__thumb_generate in modules_ethumb_emotion_module_la-emotion.o
__frame_decode_cb in modules_ethumb_emotion_module_la-emotion.o
__finish_thumb_generation in modules_ethumb_emotion_module_la-emotion.o
"_ethumb_image_save", referenced from:
__frame_decode_cb in modules_ethumb_emotion_module_la-emotion.o
"_ethumb_plugin_image_resize", referenced from:
__resize_movie in modules_ethumb_emotion_module_la-emotion.o
"_ethumb_plugin_register", referenced from:
__module_init in modules_ethumb_emotion_module_la-emotion.o
"_ethumb_plugin_unregister", referenced from:
__module_shutdown in modules_ethumb_emotion_module_la-emotion.o
EAPI was not well re-defined in both cases. It has been handled in
ecore_cocoa_private.h and ethumb_private.h. These files must be included
after a main library header (because EAPI is undef there).
Reviewers: cedric
Subscribers: cedric
Differential Revision: https://phab.enlightenment.org/D2483
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-05-10 13:58:11 -07:00
|
|
|
#import "ecore_cocoa_window.h"
|
|
|
|
#include "ecore_cocoa_private.h"
|
2014-09-03 11:34:52 -07:00
|
|
|
|
|
|
|
static Eina_Bool
|
|
|
|
_ecore_cocoa_run_loop_cb(void *data EINA_UNUSED)
|
|
|
|
{
|
|
|
|
@try {
|
|
|
|
NSEvent *e;
|
|
|
|
do {
|
|
|
|
e = [NSApp nextEventMatchingMask:NSAnyEventMask
|
|
|
|
untilDate:[NSApp eventExpirationDate]
|
|
|
|
inMode:NSDefaultRunLoopMode
|
|
|
|
dequeue:YES];
|
|
|
|
if (e != nil) {
|
|
|
|
//NSLog(@"Catching event %@", e);
|
|
|
|
|
|
|
|
[NSApp sendEvent:e];
|
|
|
|
|
|
|
|
/* Update (en/disable) the services menu's items */
|
|
|
|
NSEventType type = [e type];
|
|
|
|
if (type != NSPeriodic && type != NSMouseMoved) {
|
|
|
|
[NSApp internalUpdate];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} while (e != nil);
|
|
|
|
}
|
|
|
|
@catch (NSException *except) {
|
|
|
|
NSLog(@"EXCEPTION: %@: %@", [except name], [except reason]);
|
|
|
|
/* Show the "fancy" annoying report panel */
|
|
|
|
[NSApp reportException:except];
|
|
|
|
// XXX Maybe use Eina_Log to report the error instead
|
|
|
|
}
|
|
|
|
|
|
|
|
return ECORE_CALLBACK_RENEW;
|
|
|
|
}
|
|
|
|
|
|
|
|
@implementation Ecore_Cocoa_Application
|
|
|
|
|
|
|
|
+ (Ecore_Cocoa_Application *)sharedApplication
|
|
|
|
{
|
|
|
|
return (Ecore_Cocoa_Application *)[super sharedApplication];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void)internalUpdate
|
|
|
|
{
|
|
|
|
[_mainMenu update];
|
|
|
|
// FIXME Will not compile with GNUStep (member is named "_main_menu")
|
|
|
|
}
|
|
|
|
|
|
|
|
- (id)init
|
|
|
|
{
|
|
|
|
self = [super init];
|
|
|
|
if (self == nil) {
|
|
|
|
// XXX Critical error. Abort right now! Log?
|
|
|
|
return nil;
|
|
|
|
}
|
|
|
|
NSApp = self; // NSApp is used EVERYWHERE! Set it right now!
|
|
|
|
return NSApp;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (NSDate *)eventExpirationDate
|
|
|
|
{
|
|
|
|
return _expiration;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void)run
|
|
|
|
{
|
|
|
|
[self finishLaunching];
|
|
|
|
|
|
|
|
_running = 1;
|
|
|
|
_expiration = [NSDate distantPast];
|
|
|
|
|
2015-08-06 14:33:24 -07:00
|
|
|
_timer = ecore_timer_add(ECORE_COCOA_MAINLOOP_PERIOD,
|
|
|
|
_ecore_cocoa_run_loop_cb, NULL);
|
2014-09-03 11:34:52 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
- (void)sendEvent:(NSEvent *)anEvent
|
|
|
|
{
|
|
|
|
Eina_Bool to_super;
|
|
|
|
|
|
|
|
/* Some events shall be handled by Ecore (like single non-command keys).
|
|
|
|
* If we dispatch all events right to NSApplication, it will complain
|
|
|
|
* with NSBeep() when an event is not authorized */
|
|
|
|
to_super = ecore_cocoa_feed_events(anEvent);
|
|
|
|
if (to_super)
|
|
|
|
[super sendEvent:anEvent];
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static Ecore_Cocoa_AppDelegate *_appDelegate = nil;
|
|
|
|
|
|
|
|
@implementation Ecore_Cocoa_AppDelegate
|
|
|
|
|
|
|
|
+ (Ecore_Cocoa_AppDelegate *)appDelegate
|
|
|
|
{
|
|
|
|
if (_appDelegate == nil) {
|
|
|
|
_appDelegate = [[self alloc] init];
|
|
|
|
}
|
|
|
|
return _appDelegate;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (id)init
|
|
|
|
{
|
|
|
|
self = [super init];
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)sender
|
|
|
|
{
|
|
|
|
// XXX This should be alterable (by Elm_Window policy)
|
|
|
|
return YES;
|
|
|
|
}
|
|
|
|
|
|
|
|
@end
|
|
|
|
|