diff --git a/src/lib/ecore_cocoa/ecore_cocoa_window.h b/src/lib/ecore_cocoa/ecore_cocoa_window.h index a30240fc69..6eee03f52b 100644 --- a/src/lib/ecore_cocoa/ecore_cocoa_window.h +++ b/src/lib/ecore_cocoa/ecore_cocoa_window.h @@ -15,5 +15,7 @@ - (BOOL)isFullScreen; +- (BOOL) requestResize: (NSSize) size; + @end diff --git a/src/lib/ecore_cocoa/ecore_cocoa_window.m b/src/lib/ecore_cocoa/ecore_cocoa_window.m index 08436148ca..5908b596cb 100644 --- a/src/lib/ecore_cocoa/ecore_cocoa_window.m +++ b/src/lib/ecore_cocoa/ecore_cocoa_window.m @@ -54,6 +54,26 @@ static NSCursor *_cursors[__ECORE_COCOA_CURSOR_LAST]; return YES; } +- (BOOL) requestResize: (NSSize) size +{ + Ecore_Cocoa_Event_Window_Resize_Request *event; + + event = malloc(sizeof(*event)); + if (EINA_UNLIKELY(event == NULL)) + { + CRI("Failed to allocate Ecore_Cocoa_Event_Window_Resize_Request"); + return NO; + } + + event->w = size.width; + event->h = size.height - + (([self isFullScreen] == YES) ? 0 : ecore_cocoa_titlebar_height_get()); + event->cocoa_window = self; + ecore_event_add(ECORE_COCOA_EVENT_WINDOW_RESIZE_REQUEST, event, NULL, NULL); + + return YES; +} + - (void)windowWillClose:(NSNotification *) notification { Ecore_Cocoa_Event_Window_Destroy *event; @@ -68,11 +88,8 @@ static NSCursor *_cursors[__ECORE_COCOA_CURSOR_LAST]; ecore_event_add(ECORE_COCOA_EVENT_WINDOW_DESTROY, event, NULL, NULL); } -- (void)windowDidResize:(NSNotification *) notif +- (void)windowDidResize:(NSNotification *) EINA_UNUSED notif { - Ecore_Cocoa_Event_Window_Resize_Request *event; - NSSize size = self.frame.size; - /* * Only throw a resize event and manipulate the main loop when * we are 100% sure we are in a live resize, and the main loop @@ -80,17 +97,7 @@ static NSCursor *_cursors[__ECORE_COCOA_CURSOR_LAST]; */ if (_live_resize > 0) { - event = malloc(sizeof(*event)); - if (EINA_UNLIKELY(event == NULL)) - { - 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_WINDOW_RESIZE_REQUEST, event, NULL, NULL); + [self requestResize: self.frame.size]; /* * During live resize, NSRunLoop blocks, and prevent the ecore_main_loop