ecore_cocoa: better naming of events

Lost and got focused have been renamed FOCUSED and UNFOCUSED to mirror
the focus API in Elementary.

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
This commit is contained in:
Jean Guyomarc'h 2016-01-06 21:56:09 +01:00 committed by Cedric BAIL
parent 84bbe500c5
commit 3b61c2e07c
4 changed files with 33 additions and 25 deletions

View File

@ -61,27 +61,27 @@ typedef struct _Ecore_Cocoa_Screen Ecore_Cocoa_Screen;
typedef void Ecore_Cocoa_Object;
/**
* @typedef Ecore_Cocoa_Event_Video_Resize
* Type of event thrown when a window is resized
* @typedef Ecore_Cocoa_Event_Window_Resize_Request
* Type of event thrown when a Cocoa window is resized
*/
typedef struct _Ecore_Cocoa_Event_Video_Resize Ecore_Cocoa_Event_Video_Resize;
typedef struct _Ecore_Cocoa_Event_Window_Resize_Request Ecore_Cocoa_Event_Window_Resize_Request;
/** Event triggered when a window receives focus */
EAPI extern int ECORE_COCOA_EVENT_GOT_FOCUS;
EAPI extern int ECORE_COCOA_EVENT_WINDOW_FOCUSED;
/** Event triggered when a window loses focus */
EAPI extern int ECORE_COCOA_EVENT_LOST_FOCUS;
EAPI extern int ECORE_COCOA_EVENT_WINDOW_UNFOCUSED;
/** Event triggered when a window is resized */
EAPI extern int ECORE_COCOA_EVENT_RESIZE;
EAPI extern int ECORE_COCOA_EVENT_WINDOW_RESIZE_REQUEST;
EAPI extern int ECORE_COCOA_EVENT_WINDOW_DESTROY;
/**
* @struct _Ecore_Cocoa_Event_Video_Resize
* @struct _Ecore_Cocoa_Event_Window_Resize_Request
* Data available when a window is resized
*/
struct _Ecore_Cocoa_Event_Video_Resize
struct _Ecore_Cocoa_Event_Window_Resize_Request
{
int w; /**< Current width of the window */
int h; /**< Current height of the window */

View File

@ -19,9 +19,9 @@
#include "ecore_cocoa_private.h"
EAPI int ECORE_COCOA_EVENT_GOT_FOCUS = 0;
EAPI int ECORE_COCOA_EVENT_LOST_FOCUS = 0;
EAPI int ECORE_COCOA_EVENT_RESIZE = 0;
EAPI int ECORE_COCOA_EVENT_WINDOW_UNFOCUSED = 0;
EAPI int ECORE_COCOA_EVENT_WINDOW_FOCUSED = 0;
EAPI int ECORE_COCOA_EVENT_WINDOW_RESIZE_REQUEST = 0;
EAPI int ECORE_COCOA_EVENT_WINDOW_DESTROY = 0;
static int _ecore_cocoa_init_count = 0;
@ -51,9 +51,9 @@ ecore_cocoa_init(void)
DBG("");
ECORE_COCOA_EVENT_GOT_FOCUS = ecore_event_type_new();
ECORE_COCOA_EVENT_LOST_FOCUS = ecore_event_type_new();
ECORE_COCOA_EVENT_RESIZE = ecore_event_type_new();
ECORE_COCOA_EVENT_WINDOW_UNFOCUSED = ecore_event_type_new();
ECORE_COCOA_EVENT_WINDOW_FOCUSED = ecore_event_type_new();
ECORE_COCOA_EVENT_WINDOW_RESIZE_REQUEST = ecore_event_type_new();
ECORE_COCOA_EVENT_WINDOW_DESTROY = ecore_event_type_new();

View File

@ -70,20 +70,20 @@ static NSCursor *_cursors[__ECORE_COCOA_CURSOR_LAST];
- (void)windowDidResize:(NSNotification *) notif
{
Ecore_Cocoa_Event_Video_Resize *event;
Ecore_Cocoa_Event_Window_Resize_Request *event;
NSSize size = self.frame.size;
event = malloc(sizeof(*event));
if (EINA_UNLIKELY(event == NULL))
{
CRI("Failed to allocate Ecore_Cocoa_Event_Video_Resize");
CRI("Failed to allocate Ecore_Cocoa_Event_Window_Resize_Request");
return;
}
event->w = size.width;
event->h = size.height -
(([self isFullScreen] == YES) ? 0 : ecore_cocoa_titlebar_height_get());
event->cocoa_window = [notif object];
ecore_event_add(ECORE_COCOA_EVENT_RESIZE, event, NULL, NULL);
ecore_event_add(ECORE_COCOA_EVENT_WINDOW_RESIZE_REQUEST, event, NULL, NULL);
/*
* During live resize, NSRunLoop blocks, and prevent the ecore_main_loop
@ -108,7 +108,7 @@ static NSCursor *_cursors[__ECORE_COCOA_CURSOR_LAST];
return;
}
e->cocoa_window = [notification object];
ecore_event_add(ECORE_COCOA_EVENT_GOT_FOCUS, e, NULL, NULL);
ecore_event_add(ECORE_COCOA_EVENT_WINDOW_FOCUSED, e, NULL, NULL);
}
- (void) windowWillStartLiveResize:(NSNotification *) EINA_UNUSED notification
@ -132,7 +132,7 @@ static NSCursor *_cursors[__ECORE_COCOA_CURSOR_LAST];
return;
}
e->cocoa_window = [notification object];
ecore_event_add(ECORE_COCOA_EVENT_LOST_FOCUS, e, NULL, NULL);
ecore_event_add(ECORE_COCOA_EVENT_WINDOW_UNFOCUSED, e, NULL, NULL);
}
- (void) mouseDown:(NSEvent*) event

View File

@ -234,9 +234,9 @@ _ecore_evas_resize_common(Ecore_Evas *ee,
}
static Eina_Bool
_ecore_evas_cocoa_event_video_resize(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
_ecore_evas_cocoa_event_window_resize(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
{
Ecore_Cocoa_Event_Video_Resize *e = event;
Ecore_Cocoa_Event_Window_Resize_Request *e = event;
Ecore_Evas *ee;
DBG("");
@ -287,10 +287,18 @@ _ecore_evas_cocoa_init(void)
ecore_event_evas_init();
ecore_evas_event_handlers[0] = ecore_event_handler_add(ECORE_COCOA_EVENT_GOT_FOCUS, _ecore_evas_cocoa_event_got_focus, NULL);
ecore_evas_event_handlers[1] = ecore_event_handler_add(ECORE_COCOA_EVENT_LOST_FOCUS, _ecore_evas_cocoa_event_lost_focus, NULL);
ecore_evas_event_handlers[2] = ecore_event_handler_add(ECORE_COCOA_EVENT_RESIZE, _ecore_evas_cocoa_event_video_resize, NULL);
ecore_evas_event_handlers[3] = ecore_event_handler_add(ECORE_COCOA_EVENT_WINDOW_DESTROY, _ecore_evas_cocoa_event_window_destroy, NULL);
ecore_evas_event_handlers[0] =
ecore_event_handler_add(ECORE_COCOA_EVENT_WINDOW_UNFOCUSED,
_ecore_evas_cocoa_event_got_focus, NULL);
ecore_evas_event_handlers[1] =
ecore_event_handler_add(ECORE_COCOA_EVENT_WINDOW_FOCUSED,
_ecore_evas_cocoa_event_lost_focus, NULL);
ecore_evas_event_handlers[2] =
ecore_event_handler_add(ECORE_COCOA_EVENT_WINDOW_RESIZE_REQUEST,
_ecore_evas_cocoa_event_window_resize, NULL);
ecore_evas_event_handlers[3] =
ecore_event_handler_add(ECORE_COCOA_EVENT_WINDOW_DESTROY,
_ecore_evas_cocoa_event_window_destroy, NULL);
return _ecore_evas_init_count;
}