jayji pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=7397b9fbe9d9fb3b810c287de8d48051c368bd8b

commit 7397b9fbe9d9fb3b810c287de8d48051c368bd8b
Author: Jean Guyomarc'h <jean.guyoma...@openwide.fr>
Date:   Fri Aug 26 16:35:31 2016 +0200

    ecore_cocoa: refactor resizing request
---
 src/lib/ecore_cocoa/ecore_cocoa_window.h |  2 ++
 src/lib/ecore_cocoa/ecore_cocoa_window.m | 37 +++++++++++++++++++-------------
 2 files changed, 24 insertions(+), 15 deletions(-)

diff --git a/src/lib/ecore_cocoa/ecore_cocoa_window.h 
b/src/lib/ecore_cocoa/ecore_cocoa_window.h
index a30240f..6eee03f 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 0843614..5908b59 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

-- 


Reply via email to