evas: lock and unlock focus on Cocoa view when drawing surface
authorRomain Perier <romain.perier@openwide.fr>
Thu, 22 Jan 2015 12:28:47 +0000 (13:28 +0100)
committerCedric BAIL <cedric@osg.samsung.com>
Thu, 12 Mar 2015 06:43:58 +0000 (07:43 +0100)
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
src/modules/evas/engines/gl_cocoa/evas_engine.c
src/modules/evas/engines/gl_cocoa/evas_engine.h
src/modules/evas/engines/gl_cocoa/evas_gl_cocoa_main.m

index ea6dcf6..e0a0111 100644 (file)
@@ -173,6 +173,7 @@ eng_output_redraws_rect_add(void *data, int x, int y, int w, int h)
 
    DBG("Redraw rect %d %d %d %d", x, y, w, h);
    re = (Render_Engine *)data;
+   eng_window_lock_focus(re->win);
    evas_gl_common_context_resize(re->win->gl_context, re->win->width, re->win->height, 0);
    /* simple bounding box */
    RECTS_CLIP_TO_RECT(x, y, w, h, 0, 0, re->win->width, re->win->height);
@@ -300,7 +301,7 @@ eng_output_flush(void *data, Evas_Render_Mode render_mode)
 #endif
 
    eng_window_swap_buffers(re->win);
-
+   eng_window_unlock_focus(re->win);
 }
 
 static void
index b578aae..473ed7d 100644 (file)
@@ -65,5 +65,7 @@ void eng_window_use(Evas_GL_Cocoa_Window *gw);
 void eng_window_swap_buffers(Evas_GL_Cocoa_Window *gw);
 void eng_window_vsync_set(int on);
 void eng_window_resize(Evas_GL_Cocoa_Window *gw, int width, int height);
+void eng_window_lock_focus(Evas_GL_Cocoa_Window *gw);
+void eng_window_unlock_focus(Evas_GL_Cocoa_Window *gw);
 
 #endif /* __EVAS_ENGINE_H__ */
index 13bc5e3..22eecf9 100644 (file)
@@ -140,3 +140,15 @@ eng_window_resize(Evas_GL_Cocoa_Window *gw, int width, int height)
   [(EvasGLView*)gw->view setFrame:view_frame];
   [[(NSOpenGLView*)gw->view openGLContext] flushBuffer];
 }
+
+void
+eng_window_lock_focus(Evas_GL_Cocoa_Window *gw)
+{
+  [(NSOpenGLView*)gw->view lockFocus];
+}
+
+void
+eng_window_unlock_focus(Evas_GL_Cocoa_Window *gw)
+{
+  [(NSOpenGLView*)gw->view unlockFocus];
+}