From 3b61c2e07c1ea354cf1255c3d83c14e2bc71e194 Mon Sep 17 00:00:00 2001 From: Jean Guyomarc'h Date: Wed, 6 Jan 2016 21:56:09 +0100 Subject: [PATCH] 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 --- src/lib/ecore_cocoa/Ecore_Cocoa.h | 16 +++++++-------- src/lib/ecore_cocoa/ecore_cocoa.m | 12 +++++------ src/lib/ecore_cocoa/ecore_cocoa_window.m | 10 +++++----- .../engines/cocoa/ecore_evas_cocoa.c | 20 +++++++++++++------ 4 files changed, 33 insertions(+), 25 deletions(-) diff --git a/src/lib/ecore_cocoa/Ecore_Cocoa.h b/src/lib/ecore_cocoa/Ecore_Cocoa.h index f97bd20d27..bd39b2e8b8 100644 --- a/src/lib/ecore_cocoa/Ecore_Cocoa.h +++ b/src/lib/ecore_cocoa/Ecore_Cocoa.h @@ -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 */ diff --git a/src/lib/ecore_cocoa/ecore_cocoa.m b/src/lib/ecore_cocoa/ecore_cocoa.m index 65960f2782..012fd11fe4 100644 --- a/src/lib/ecore_cocoa/ecore_cocoa.m +++ b/src/lib/ecore_cocoa/ecore_cocoa.m @@ -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(); diff --git a/src/lib/ecore_cocoa/ecore_cocoa_window.m b/src/lib/ecore_cocoa/ecore_cocoa_window.m index b1d7d6e59f..37d9173a8a 100644 --- a/src/lib/ecore_cocoa/ecore_cocoa_window.m +++ b/src/lib/ecore_cocoa/ecore_cocoa_window.m @@ -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 diff --git a/src/modules/ecore_evas/engines/cocoa/ecore_evas_cocoa.c b/src/modules/ecore_evas/engines/cocoa/ecore_evas_cocoa.c index b57a804848..7069079329 100644 --- a/src/modules/ecore_evas/engines/cocoa/ecore_evas_cocoa.c +++ b/src/modules/ecore_evas/engines/cocoa/ecore_evas_cocoa.c @@ -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; }