elm config - init wl if env vars indicate we should 50/39850/2 accepted/tizen/common/20150526.130335 accepted/tizen/mobile/20150526.234801 accepted/tizen/tv/20150526.234730 accepted/tizen/wearable/20150526.234740 submit/tizen/20150526.080204
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>
Fri, 22 May 2015 03:12:36 +0000 (12:12 +0900)
committerJaehwan Kim <jae.hwan.kim@samsung.com>
Sun, 24 May 2015 08:41:40 +0000 (01:41 -0700)
this ensures event id's are initted and more if we are in wl mode like
in x11 mode

@fix

Change-Id: I37435f2bf3e7ee8b9b9f21ffc2dc8c3f2674e175
origin: upstream

src/lib/elm_config.c

index ea12934..7a8cd2d 100644 (file)
@@ -3251,9 +3251,12 @@ _elm_config_sub_shutdown(void)
 void
 _elm_config_sub_init(void)
 {
-#ifdef HAVE_ELEMENTARY_X
-   Eina_Bool init_x;
+#if defined(HAVE_ELEMENTARY_X) || defined(HAVE_ELEMENTARY_WAYLAND)
    const char *ev = getenv("ELM_DISPLAY");
+#endif
+
+#ifdef HAVE_ELEMENTARY_X
+   Eina_Bool init_x = EINA_FALSE;
    Eina_Bool have_display = !!getenv("DISPLAY");
 
    if (ev) /* If ELM_DISPLAY is specified */
@@ -3333,6 +3336,37 @@ _elm_config_sub_init(void)
         else ERR("Cannot connect to X11 display. check $DISPLAY variable");
      }
 #endif
+#ifdef HAVE_ELEMENTARY_WAYLAND
+   Eina_Bool init_wl = EINA_FALSE;
+   Eina_Bool have_wl_display = !!getenv("WAYLAND_DISPLAY");
+
+   if (ev) /* If ELM_DISPLAY is specified */
+     {
+        if (!strcmp(ev, "wl")) /* and it is X11 */
+          {
+             if (!have_wl_display) /* if there is no $DISPLAY */
+               {
+                  ERR("$ELM_DISPLAY is set to wl but $WAYLAND_DISPLAY is not set");
+                  init_wl = EINA_FALSE;
+               }
+             else /* if there is */
+               init_wl = EINA_TRUE;
+          }
+        else /* not wl */
+          init_wl = EINA_FALSE;
+     }
+   else /* ELM_DISPLAY not specified */
+     {
+        if (have_wl_display) /* If there is a $WAYLAND_DISPLAY */
+          init_wl = EINA_TRUE;
+        else /* No $WAYLAND_DISPLAY */
+          init_wl = EINA_FALSE;
+     }
+   if (init_wl)
+     {
+        ecore_wl_init(NULL);
+     }
+#endif
    _config_sub_apply();
 }