elementary: Add ecore_cocoa backend to elementary
authorNicolas Aguirre <aguirre.nicolas@gmail.com>
Wed, 2 Nov 2011 19:26:29 +0000 (19:26 +0000)
committerNicolas Aguirre <aguirre.nicolas@gmail.com>
Wed, 2 Nov 2011 19:26:29 +0000 (19:26 +0000)
SVN revision: 64657

configure.ac
src/lib/elm_config.c
src/lib/elm_main.c
src/lib/elm_priv.h
src/lib/elm_win.c

index 9a46b0b..8e71657 100644 (file)
@@ -327,6 +327,29 @@ if test "x$want_elementary_sdl" = "xyes" -a "x$have_elementary_sdl" = "xno"; the
     AC_MSG_ERROR([ecore-sdl support requested, but not found by pkg-config.])
 fi
 
+have_elementary_cocoa="no"
+want_elementary_cocoa="auto"
+AC_ARG_ENABLE([ecore-cocoa],
+   [AC_HELP_STRING([--disable-ecore-cocoa], [disable ecore-cocoa support. @<:@default=detect@:>@])],
+   [want_elementary_cocoa=$enableval], [])
+
+if test "x$want_elementary_cocoa" != "xno"; then
+   PKG_CHECK_MODULES([ELEMENTARY_COCOA],
+      [ecore-cocoa >= 1.0.0],
+      [
+       AC_DEFINE(HAVE_ELEMENTARY_COCOA, 1, [COCOA support for Elementary])
+       have_elementary_cocoa="yes"
+       requirement_elm="ecore-cocoa >= 1.0.0 ${requirement_elm}"
+      ],
+      [have_elementary_cocoa="no"]
+   )
+else
+    have_elementary_cocoa="no"
+fi
+if test "x$want_elementary_cocoa" = "xyes" -a "x$have_elementary_cocoa" = "xno"; then
+    AC_MSG_ERROR([ecore-cocoa support requested, but not found by pkg-config.])
+fi
+
 have_elementary_win32="no"
 want_elementary_win32="auto"
 AC_ARG_ENABLE([ecore-win32],
@@ -666,6 +689,7 @@ echo "  Engines:"
 echo "    X11....................: ${have_elementary_x}"
 echo "    Framebuffer............: ${have_elementary_fb}"
 echo "    SDL....................: ${have_elementary_sdl}"
+echo "    Cocoa..................: ${have_elementary_cocoa}"
 echo "    Windows XP.............: ${have_elementary_win32}"
 echo "    Windows CE.............: ${have_elementary_wince}"
 echo
index f1246dc..9b90e27 100644 (file)
@@ -33,6 +33,7 @@ const char *_elm_engines[] = {
    "opengl_sdl",
    "buffer",
    "ews",
+   "opengl_cocoa",
    NULL
 };
 
@@ -1172,6 +1173,11 @@ _env_get(void)
                  (!strcasecmp(s, "gl-sdl")) ||
                  (!strcasecmp(s, "gl_sdl")))
           eina_stringshare_replace(&_elm_config->engine, ELM_OPENGL_SDL);
+        else if ((!strcasecmp(s, "opengl-cocoa")) ||
+                 (!strcasecmp(s, "opengl_cocoa")) ||
+                 (!strcasecmp(s, "gl-cocoa")) ||
+                 (!strcasecmp(s, "gl_cocoa")))
+          eina_stringshare_replace(&_elm_config->engine, ELM_OPENGL_COCOA);
         else if ((!strcasecmp(s, "gdi")) ||
                  (!strcasecmp(s, "software-gdi")) ||
                  (!strcasecmp(s, "software_gdi")))
@@ -1428,7 +1434,8 @@ _elm_config_sub_shutdown(void)
    if (ENGINE_COMPARE(ELM_SOFTWARE_X11) ||
        ENGINE_COMPARE(ELM_SOFTWARE_16_X11) ||
        ENGINE_COMPARE(ELM_XRENDER_X11) ||
-       ENGINE_COMPARE(ELM_OPENGL_X11))
+       ENGINE_COMPARE(ELM_OPENGL_X11) ||
+       ENGINE_COMPARE(ELM_OPENGL_COCOA))
 #undef ENGINE_COMPARE
      {
 #ifdef HAVE_ELEMENTARY_X
@@ -1444,7 +1451,8 @@ _elm_config_sub_init(void)
    if (ENGINE_COMPARE(ELM_SOFTWARE_X11) ||
        ENGINE_COMPARE(ELM_SOFTWARE_16_X11) ||
        ENGINE_COMPARE(ELM_XRENDER_X11) ||
-       ENGINE_COMPARE(ELM_OPENGL_X11))
+       ENGINE_COMPARE(ELM_OPENGL_X11) ||
+       ENGINE_COMPARE(ELM_OPENGL_COCOA))
 #undef ENGINE_COMPARE
      {
 #ifdef HAVE_ELEMENTARY_X
index 1fd4740..291544e 100644 (file)
@@ -462,6 +462,7 @@ elm_quicklaunch_sub_shutdown(void)
             ENGINE_COMPARE(ELM_SOFTWARE_SDL) ||
             ENGINE_COMPARE(ELM_SOFTWARE_16_SDL) ||
             ENGINE_COMPARE(ELM_OPENGL_SDL) ||
+            ENGINE_COMPARE(ELM_OPENGL_COCOA) ||
             ENGINE_COMPARE(ELM_SOFTWARE_WIN32) ||
             ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE) ||
             ENGINE_COMPARE(ELM_EWS))
index e84153b..a4459dd 100644 (file)
@@ -81,6 +81,7 @@ extern const char *_elm_engines[];
 #define ELM_OPENGL_SDL        (_elm_engines[11])
 #define ELM_BUFFER            (_elm_engines[12])
 #define ELM_EWS               (_elm_engines[13])
+#define ELM_OPENGL_COCOA      (_elm_engines[14])
 
 #define ELM_FONT_TOKEN_STYLE ":style="
 
index 8863a5e..b2c3bd4 100644 (file)
@@ -703,7 +703,8 @@ _elm_win_xwindow_get(Elm_Win *win)
             ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE) ||
             ENGINE_COMPARE(ELM_SOFTWARE_SDL) ||
             ENGINE_COMPARE(ELM_SOFTWARE_16_SDL) ||
-            ENGINE_COMPARE(ELM_OPENGL_SDL))
+            ENGINE_COMPARE(ELM_OPENGL_SDL) ||
+           ENGINE_COMPARE(ELM_OPENGL_COCOA))
      {
      }
    else if (ENGINE_COMPARE(ELM_SOFTWARE_16_X11))
@@ -1488,6 +1489,11 @@ elm_win_add(Evas_Object *parent, const char *name, Elm_Win_Type type)
              win->ee = ecore_evas_gl_sdl_new(NULL, 1, 1, 0, 0);
              FALLBACK_TRY("OpenGL SDL");
           }
+        else if (ENGINE_COMPARE(ELM_OPENGL_COCOA))
+          {
+             win->ee = ecore_evas_cocoa_new(NULL, 1, 1, 0, 0);
+             FALLBACK_TRY("OpenGL Cocoa");
+          }
         else if (ENGINE_COMPARE(ELM_BUFFER))
           {
              win->ee = ecore_evas_buffer_new(1, 1);