2014-06-08 12:50:42 -07:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include <config.h>
|
|
|
|
#endif
|
|
|
|
|
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
|
|
|
#include <Ecore_Input.h>
|
|
|
|
|
2014-07-10 11:04:24 -07:00
|
|
|
#include <Ecore.h>
|
|
|
|
#include <Ecore_Cocoa.h>
|
2014-06-08 12:50:42 -07:00
|
|
|
#import "ecore_cocoa_window.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
|
|
|
#include "ecore_cocoa_private.h"
|
2014-06-08 12:50:42 -07:00
|
|
|
|
|
|
|
@implementation EcoreCocoaWindow
|
|
|
|
|
|
|
|
@synthesize ecore_window_data;
|
|
|
|
|
|
|
|
- (id) initWithContentRect: (NSRect) contentRect
|
|
|
|
styleMask: (unsigned int) aStyle
|
|
|
|
backing: (NSBackingStoreType) bufferingType
|
|
|
|
defer: (BOOL) flag
|
|
|
|
{
|
2014-07-23 07:56:16 -07:00
|
|
|
if (![super initWithContentRect: contentRect
|
|
|
|
styleMask: aStyle
|
|
|
|
backing: bufferingType
|
2014-06-08 12:50:42 -07:00
|
|
|
defer: flag]) return nil;
|
|
|
|
|
|
|
|
[self setBackgroundColor: [NSColor whiteColor]];
|
|
|
|
[self makeKeyWindow];
|
|
|
|
[self setDelegate:self];
|
|
|
|
[self setAcceptsMouseMovedEvents:YES];
|
|
|
|
|
2014-07-23 07:56:16 -07:00
|
|
|
[self setCollectionBehavior:NSWindowCollectionBehaviorFullScreenPrimary];
|
|
|
|
|
2014-06-08 12:50:42 -07:00
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
2014-07-23 07:56:16 -07:00
|
|
|
- (BOOL)isFullScreen
|
|
|
|
{
|
|
|
|
return (([self styleMask] & NSFullScreenWindowMask) == NSFullScreenWindowMask);
|
|
|
|
}
|
|
|
|
|
2014-06-08 12:50:42 -07:00
|
|
|
- (BOOL)acceptsFirstResponder
|
|
|
|
{
|
|
|
|
return YES;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (BOOL)canBecomeKeyWindow
|
|
|
|
{
|
|
|
|
return YES;
|
|
|
|
}
|
|
|
|
|
2014-07-23 07:56:16 -07:00
|
|
|
- (void)windowWillClose:(NSNotification *) EINA_UNUSED notification
|
2014-06-08 12:50:42 -07:00
|
|
|
{
|
2014-07-10 11:04:24 -07:00
|
|
|
NSLog(@"window is going to be closed");
|
2015-01-30 08:15:55 -08:00
|
|
|
Ecore_Cocoa_Event_Window *event;
|
|
|
|
|
|
|
|
event = malloc(sizeof(Ecore_Cocoa_Event_Window));
|
|
|
|
if (event == NULL)
|
|
|
|
{
|
|
|
|
// FIXME Use Eina_Log
|
|
|
|
printf("Failed to allocate Ecore_Cocoa_Event_Window_destroy\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
event->wid = [notification object];
|
|
|
|
ecore_event_add(ECORE_COCOA_EVENT_WINDOW_DESTROY, event, NULL, NULL);
|
2014-07-10 11:04:24 -07:00
|
|
|
}
|
|
|
|
|
2014-07-23 07:56:16 -07:00
|
|
|
- (void)windowDidResize:(NSNotification *) EINA_UNUSED notif
|
2014-07-10 11:04:24 -07:00
|
|
|
{
|
|
|
|
Ecore_Cocoa_Event_Video_Resize *event;
|
|
|
|
NSSize size = self.frame.size;
|
|
|
|
|
|
|
|
event = malloc(sizeof(Ecore_Cocoa_Event_Video_Resize));
|
|
|
|
if (event == NULL)
|
|
|
|
{
|
2015-01-29 08:08:23 -08:00
|
|
|
DBG("Failed to allocate Ecore_Cocoa_Event_Video_Resize\n");
|
2014-07-10 11:04:24 -07:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
event->w = size.width;
|
2014-07-23 07:56:16 -07:00
|
|
|
event->h = size.height -
|
|
|
|
(([self isFullScreen] == YES) ? 0 : ecore_cocoa_titlebar_height_get());
|
2015-01-15 07:45:32 -08:00
|
|
|
event->wid = [notif object];
|
2014-07-10 11:04:24 -07:00
|
|
|
ecore_event_add(ECORE_COCOA_EVENT_RESIZE, event, NULL, NULL);
|
2014-06-08 12:50:42 -07:00
|
|
|
}
|
|
|
|
|
2015-01-15 08:20:16 -08:00
|
|
|
- (void)windowDidBecomeKey:(NSNotification *)notification
|
|
|
|
{
|
|
|
|
Ecore_Cocoa_Event_Window *e;
|
|
|
|
|
|
|
|
e = malloc(sizeof(Ecore_Cocoa_Event_Window));
|
|
|
|
if (!e)
|
|
|
|
{
|
2015-01-29 08:08:23 -08:00
|
|
|
DBG("GOT_FOCUS: Failed to allocate Ecore_Cocoa_Event_Window\n");
|
2015-01-15 08:20:16 -08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
e->wid = [notification object];
|
|
|
|
ecore_event_add(ECORE_COCOA_EVENT_GOT_FOCUS, e, NULL, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void)windowDidResignKey:(NSNotification *)notification
|
|
|
|
{
|
|
|
|
Ecore_Cocoa_Event_Window *e;
|
|
|
|
|
|
|
|
e = malloc(sizeof(Ecore_Cocoa_Event_Window));
|
|
|
|
if (!e)
|
|
|
|
{
|
2015-01-29 08:08:23 -08:00
|
|
|
DBG("LOST_FOCUS: Failed to allocate Ecore_Cocoa_Event_Window\n");
|
2015-01-15 08:20:16 -08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
e->wid = [notification object];
|
|
|
|
ecore_event_add(ECORE_COCOA_EVENT_LOST_FOCUS, e, NULL, NULL);
|
|
|
|
}
|
|
|
|
|
2015-02-18 05:11:00 -08:00
|
|
|
- (void) mouseDown:(NSEvent*) event
|
|
|
|
{
|
|
|
|
unsigned int time = (unsigned int)((unsigned long long)(ecore_time_get() * 1000.0) & 0xffffffff);
|
|
|
|
|
|
|
|
NSView *view = [self contentView];
|
|
|
|
NSPoint event_location = [event locationInWindow];
|
|
|
|
NSPoint pt = [view convertPoint:event_location fromView:nil];
|
|
|
|
|
|
|
|
int h = [view frame].size.height;
|
|
|
|
int x = pt.x;
|
|
|
|
int y = h - pt.y;
|
|
|
|
|
|
|
|
Ecore_Event_Mouse_Button * ev = calloc(1, sizeof(Ecore_Event_Mouse_Button));
|
|
|
|
if (!ev) return;
|
|
|
|
|
2015-03-03 08:11:08 -08:00
|
|
|
ev->x = x;
|
2015-02-18 05:11:00 -08:00
|
|
|
ev->y = y;
|
|
|
|
ev->root.x = ev->x;
|
|
|
|
ev->root.y = ev->y;
|
|
|
|
ev->timestamp = time;
|
|
|
|
switch ([event buttonNumber])
|
|
|
|
{
|
|
|
|
case 0: ev->buttons = 1; break;
|
|
|
|
case 1: ev->buttons = 3; break;
|
|
|
|
case 2: ev->buttons = 2; break;
|
|
|
|
default: ev->buttons = 0; break;
|
|
|
|
}
|
|
|
|
ev->window = (Ecore_Window)self.ecore_window_data;
|
|
|
|
ev->event_window = ev->window;
|
|
|
|
|
|
|
|
if ([event clickCount] == 2)
|
|
|
|
ev->double_click = 1;
|
|
|
|
else
|
|
|
|
ev->double_click = 0;
|
|
|
|
|
|
|
|
if ([event clickCount] >= 3)
|
|
|
|
ev->triple_click = 1;
|
|
|
|
else
|
|
|
|
ev->triple_click = 0;
|
|
|
|
|
|
|
|
ecore_event_add(ECORE_EVENT_MOUSE_BUTTON_DOWN, ev, NULL, NULL);
|
|
|
|
}
|
|
|
|
|
2015-02-19 01:25:00 -08:00
|
|
|
- (void) rightMouseDown:(NSEvent*) event
|
|
|
|
{
|
|
|
|
[self mouseDown: event];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void) otherMouseDown:(NSEvent*) event
|
|
|
|
{
|
|
|
|
[self mouseDown: event];
|
|
|
|
}
|
|
|
|
|
2015-02-18 05:11:00 -08:00
|
|
|
- (void) mouseUp:(NSEvent*) event
|
|
|
|
{
|
|
|
|
unsigned int time = (unsigned int)((unsigned long long)(ecore_time_get() * 1000.0) & 0xffffffff);
|
|
|
|
|
|
|
|
NSView *view = [self contentView];
|
|
|
|
NSPoint event_location = [event locationInWindow];
|
|
|
|
NSPoint pt = [view convertPoint:event_location fromView:nil];
|
|
|
|
|
|
|
|
int h = [view frame].size.height;
|
|
|
|
int x = pt.x;
|
|
|
|
int y = h - pt.y;
|
|
|
|
|
|
|
|
Ecore_Event_Mouse_Button * ev = calloc(1, sizeof(Ecore_Event_Mouse_Button));
|
|
|
|
if (!ev) return;
|
|
|
|
|
2015-03-03 08:11:08 -08:00
|
|
|
ev->x = x;
|
2015-02-18 05:11:00 -08:00
|
|
|
ev->y = y;
|
|
|
|
ev->root.x = ev->x;
|
|
|
|
ev->root.y = ev->y;
|
|
|
|
ev->timestamp = time;
|
|
|
|
switch ([event buttonNumber])
|
|
|
|
{
|
|
|
|
case 0: ev->buttons = 1; break;
|
|
|
|
case 1: ev->buttons = 3; break;
|
|
|
|
case 2: ev->buttons = 2; break;
|
|
|
|
default: ev->buttons = 0; break;
|
|
|
|
}
|
|
|
|
ev->window = (Ecore_Window)self.ecore_window_data;
|
|
|
|
ev->event_window = ev->window;
|
|
|
|
|
|
|
|
if ([event clickCount] == 2)
|
|
|
|
ev->double_click = 1;
|
|
|
|
else
|
|
|
|
ev->double_click = 0;
|
|
|
|
|
|
|
|
if ([event clickCount] >= 3)
|
|
|
|
ev->triple_click = 1;
|
|
|
|
else
|
|
|
|
ev->triple_click = 0;
|
|
|
|
|
|
|
|
ecore_event_add(ECORE_EVENT_MOUSE_BUTTON_UP, ev, NULL, NULL);
|
|
|
|
}
|
|
|
|
|
2015-02-19 01:25:00 -08:00
|
|
|
- (void) rightMouseUp:(NSEvent*) event
|
|
|
|
{
|
|
|
|
[self mouseUp: event];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void) otherMouseUp:(NSEvent*) event
|
|
|
|
{
|
|
|
|
[self mouseUp: event];
|
|
|
|
}
|
|
|
|
|
2015-02-18 05:11:00 -08:00
|
|
|
- (void) mouseMoved:(NSEvent*) event
|
|
|
|
{
|
|
|
|
Ecore_Event_Mouse_Move * ev = calloc(1, sizeof(Ecore_Event_Mouse_Move));
|
|
|
|
if (!ev) return;
|
|
|
|
|
|
|
|
NSView *view = [self contentView];
|
|
|
|
NSPoint event_location = [event locationInWindow];
|
|
|
|
NSPoint pt = [view convertPoint:event_location fromView:nil];
|
|
|
|
|
|
|
|
ev->x = pt.x;
|
|
|
|
ev->y = [view frame].size.height - pt.y;
|
|
|
|
ev->root.x = ev->x;
|
|
|
|
ev->root.y = ev->y;
|
|
|
|
ev->timestamp = time;
|
|
|
|
ev->window = (Ecore_Window)self.ecore_window_data;
|
|
|
|
ev->event_window = ev->window;
|
|
|
|
ev->modifiers = 0; /* FIXME: keep modifier around. */
|
|
|
|
|
|
|
|
ecore_event_add(ECORE_EVENT_MOUSE_MOVE, ev, NULL, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void) mouseDragged: (NSEvent*) event
|
|
|
|
{
|
|
|
|
[self mouseMoved:event];
|
|
|
|
}
|
|
|
|
|
2014-06-08 12:50:42 -07:00
|
|
|
@end
|
|
|
|
|
|
|
|
Ecore_Cocoa_Window *
|
|
|
|
ecore_cocoa_window_new(int x,
|
|
|
|
int y,
|
|
|
|
int width,
|
|
|
|
int height)
|
|
|
|
{
|
|
|
|
Ecore_Cocoa_Window *w;
|
|
|
|
|
2014-07-23 07:56:16 -07:00
|
|
|
EcoreCocoaWindow *window = [[EcoreCocoaWindow alloc] initWithContentRect:NSMakeRect(x, y, width, height)
|
|
|
|
styleMask:(NSTitledWindowMask |
|
|
|
|
NSClosableWindowMask |
|
|
|
|
NSResizableWindowMask |
|
|
|
|
NSMiniaturizableWindowMask)
|
|
|
|
backing:NSBackingStoreBuffered
|
|
|
|
defer:NO];
|
2014-06-08 12:50:42 -07:00
|
|
|
|
|
|
|
if (!window)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
//Set the process to be a foreground process,
|
|
|
|
//without that it prevents the window to become the key window and
|
2014-07-23 07:56:16 -07:00
|
|
|
//receive all mouse mouve events.
|
|
|
|
[NSApp setActivationPolicy:NSApplicationActivationPolicyRegular];
|
|
|
|
[NSApp activateIgnoringOtherApps:YES];
|
|
|
|
|
2014-06-08 12:50:42 -07:00
|
|
|
|
|
|
|
w = calloc(1, sizeof(Ecore_Cocoa_Window));
|
2014-07-23 07:56:16 -07:00
|
|
|
if (w == NULL)
|
|
|
|
{
|
|
|
|
return NULL;
|
|
|
|
}
|
2014-06-08 12:50:42 -07:00
|
|
|
w->window = window;
|
|
|
|
w->borderless = 0;
|
|
|
|
|
|
|
|
window.ecore_window_data = w;
|
|
|
|
|
|
|
|
return w;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
ecore_cocoa_window_free(Ecore_Cocoa_Window *window)
|
|
|
|
{
|
|
|
|
if (!window)
|
|
|
|
return;
|
|
|
|
|
|
|
|
[window->window release];
|
|
|
|
free(window);
|
|
|
|
}
|
|
|
|
|
2015-03-11 07:31:36 -07:00
|
|
|
void
|
|
|
|
ecore_cocoa_window_size_min_set(Ecore_Cocoa_Window *window,
|
|
|
|
unsigned int w,
|
|
|
|
unsigned int h)
|
|
|
|
{
|
|
|
|
if (!window)
|
|
|
|
return;
|
|
|
|
NSSize size = {w,h};
|
|
|
|
window->window.contentMinSize = size;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
ecore_cocoa_window_size_max_set(Ecore_Cocoa_Window *window,
|
|
|
|
unsigned int w,
|
|
|
|
unsigned int h)
|
|
|
|
{
|
|
|
|
if (!window)
|
|
|
|
return;
|
|
|
|
NSSize size = {w,h};
|
|
|
|
window->window.contentMaxSize = size;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
ecore_cocoa_window_size_step_set(Ecore_Cocoa_Window *window,
|
|
|
|
unsigned int w,
|
|
|
|
unsigned int h)
|
|
|
|
{
|
|
|
|
if (!window)
|
|
|
|
return;
|
|
|
|
NSSize size = {w,h};
|
|
|
|
window->window.contentResizeIncrements = size;
|
|
|
|
}
|
|
|
|
|
2014-06-08 12:50:42 -07:00
|
|
|
void
|
|
|
|
ecore_cocoa_window_move(Ecore_Cocoa_Window *window,
|
|
|
|
int x,
|
|
|
|
int y)
|
|
|
|
{
|
|
|
|
NSRect win_frame;
|
|
|
|
|
|
|
|
if (!window)
|
|
|
|
return;
|
|
|
|
|
|
|
|
win_frame = [window->window frame];
|
|
|
|
win_frame.origin.x = x;
|
|
|
|
win_frame.origin.y = y;
|
|
|
|
|
|
|
|
[window->window setFrame:win_frame display:YES];
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
ecore_cocoa_window_resize(Ecore_Cocoa_Window *window,
|
|
|
|
int width,
|
|
|
|
int height)
|
|
|
|
{
|
2014-07-10 11:04:24 -07:00
|
|
|
if (!window) return;
|
2014-06-08 12:50:42 -07:00
|
|
|
|
|
|
|
NSRect win_frame;
|
|
|
|
|
|
|
|
win_frame = [window->window frame];
|
2014-07-23 07:56:16 -07:00
|
|
|
win_frame.size.height = height +
|
|
|
|
(([window->window isFullScreen] == YES) ? 0 : ecore_cocoa_titlebar_height_get());
|
2014-06-08 12:50:42 -07:00
|
|
|
win_frame.size.width = width;
|
|
|
|
|
|
|
|
[window->window setFrame:win_frame display:YES];
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
ecore_cocoa_window_move_resize(Ecore_Cocoa_Window *window,
|
|
|
|
int x,
|
|
|
|
int y,
|
|
|
|
int width,
|
|
|
|
int height)
|
|
|
|
{
|
2014-07-23 07:56:16 -07:00
|
|
|
if (!window) return;
|
2014-06-08 12:50:42 -07:00
|
|
|
|
|
|
|
NSRect win_frame;
|
|
|
|
|
|
|
|
win_frame = [window->window frame];
|
2014-07-23 07:56:16 -07:00
|
|
|
win_frame.size.height = height +
|
|
|
|
(([window->window isFullScreen] == YES) ? 0 : ecore_cocoa_titlebar_height_get());
|
2014-06-08 12:50:42 -07:00
|
|
|
win_frame.size.width = width;
|
|
|
|
win_frame.origin.x = x;
|
|
|
|
win_frame.origin.y = y;
|
|
|
|
|
|
|
|
[window->window setFrame:win_frame display:YES];
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
ecore_cocoa_window_title_set(Ecore_Cocoa_Window *window, const char *title)
|
|
|
|
{
|
|
|
|
if (!window || !title)
|
|
|
|
return;
|
|
|
|
|
|
|
|
[window->window setTitle:[NSString stringWithUTF8String:title]];
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
ecore_cocoa_window_show(Ecore_Cocoa_Window *window)
|
|
|
|
{
|
|
|
|
if (!window || [window->window isVisible])
|
|
|
|
{
|
2015-01-29 08:08:23 -08:00
|
|
|
DBG("Window(%p) is not visible\n", window->window);
|
2014-06-08 12:50:42 -07:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
[window->window makeKeyAndOrderFront:NSApp];
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
ecore_cocoa_window_hide(Ecore_Cocoa_Window *window)
|
|
|
|
{
|
|
|
|
if (!window || ![window->window isVisible])
|
|
|
|
return;
|
|
|
|
|
|
|
|
[window->window orderOut:NSApp];
|
|
|
|
}
|
|
|
|
|
2015-03-12 04:13:08 -07:00
|
|
|
void ecore_cocoa_window_raise(Ecore_Cocoa_Window *window)
|
|
|
|
{
|
|
|
|
if (!window)
|
|
|
|
return;
|
|
|
|
|
|
|
|
[window->window orderFront:nil];
|
|
|
|
}
|
|
|
|
|
|
|
|
void ecore_cocoa_window_lower(Ecore_Cocoa_Window *window)
|
|
|
|
{
|
|
|
|
if (!window)
|
|
|
|
return;
|
|
|
|
|
|
|
|
[window->window orderBack:nil];
|
|
|
|
}
|
|
|
|
|
|
|
|
void ecore_cocoa_window_activate(Ecore_Cocoa_Window *window)
|
|
|
|
{
|
|
|
|
if (!window)
|
|
|
|
return;
|
|
|
|
|
|
|
|
[window->window makeKeyAndOrderFront:nil];
|
|
|
|
}
|
|
|
|
|
|
|
|
void ecore_cocoa_window_iconified_set(Ecore_Cocoa_Window *window,
|
|
|
|
int on)
|
|
|
|
{
|
|
|
|
if (!window)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (on)
|
|
|
|
{
|
|
|
|
[window->window miniaturize:nil];
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
[window->window deminiaturize:nil];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-06-08 12:50:42 -07:00
|
|
|
void
|
|
|
|
ecore_cocoa_window_borderless_set(Ecore_Cocoa_Window *window,
|
|
|
|
int on)
|
|
|
|
{
|
|
|
|
if (!window)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (on)
|
|
|
|
[window->window setContentBorderThickness:0.0
|
2014-07-10 11:04:24 -07:00
|
|
|
forEdge:NSMinXEdge | NSMinYEdge | NSMaxXEdge | NSMaxYEdge];
|
2014-06-08 12:50:42 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
ecore_cocoa_window_view_set(Ecore_Cocoa_Window *window,
|
|
|
|
void *view)
|
|
|
|
{
|
|
|
|
if (!window || !view)
|
|
|
|
return;
|
|
|
|
|
|
|
|
//[[window->window contentView] addSubview:view];
|
2014-07-23 07:56:16 -07:00
|
|
|
NSView *v = view;
|
2014-06-08 12:50:42 -07:00
|
|
|
[window->window setContentView:view];
|
|
|
|
|
2014-07-23 07:56:16 -07:00
|
|
|
NSTrackingArea *area = [[NSTrackingArea alloc] initWithRect:[v frame]
|
|
|
|
options:NSTrackingMouseMoved |
|
2014-06-08 12:50:42 -07:00
|
|
|
NSTrackingActiveInActiveApp |
|
|
|
|
NSTrackingInVisibleRect
|
2014-07-23 07:56:16 -07:00
|
|
|
owner:v
|
2014-06-08 12:50:42 -07:00
|
|
|
userInfo:nil];
|
2014-07-23 07:56:16 -07:00
|
|
|
[v addTrackingArea:area];
|
|
|
|
|
2014-06-08 12:50:42 -07:00
|
|
|
[area release];
|
|
|
|
}
|
2015-01-15 07:45:32 -08:00
|
|
|
|
|
|
|
Ecore_Cocoa_Window_Id ecore_cocoa_window_get_window_id(Ecore_Cocoa_Window *window)
|
|
|
|
{
|
|
|
|
if (!window)
|
|
|
|
return 0;
|
2015-01-29 08:08:23 -08:00
|
|
|
|
|
|
|
DBG("Return : %p", window->window);
|
|
|
|
|
2015-01-15 07:45:32 -08:00
|
|
|
return window->window;
|
|
|
|
}
|