ecore animator, x, vsync ecore evas restore x vsync to work again
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>
Wed, 25 Apr 2018 09:22:56 +0000 (18:22 +0900)
committerWonki Kim <wonki_.kim@samsung.com>
Thu, 31 May 2018 05:49:23 +0000 (14:49 +0900)
so i found the work with wayland and having animator sources broke
that same source from ecore_x that was there from long ago, so i've
put in an exception if there are x based engines from restting to a
timer animator because ecore_x would have switched toa custom ticker
already, and this just resets it. also just set the source after
setting the tick callbacks and ensure tick cb's are null before going
to timer source as well. this cleans up this little but of animaatior
vsync modification to properly vsync in both x and wayland too now.

@fix

src/lib/ecore_evas/ecore_evas.c

index e8bc250..4d179a2 100644 (file)
@@ -3292,16 +3292,26 @@ _ecore_evas_tick_source_find(void)
 {
    Ecore_Evas *ee;
    Eina_Bool source = EINA_FALSE;
+   Eina_Bool have_x = EINA_FALSE;
 
    // Check if we do have a potential tick source for legacy
    EINA_INLIST_FOREACH(ecore_evases, ee)
-     if (!ee->deleted &&
-         ee->engine.func->fn_animator_register &&
-         ee->engine.func->fn_animator_unregister)
-       {
-          source = EINA_TRUE;
-          break;
-       }
+     {
+        if (!ee->deleted)
+          {
+             if ((ee->engine.func->fn_animator_register) &&
+                 (ee->engine.func->fn_animator_unregister))
+               {
+                  source = EINA_TRUE;
+               }
+             if (ee->driver)
+               {
+                  if ((!strcmp(ee->driver, "software_x11")) ||
+                      (!strcmp(ee->driver, "opengl_x11")))
+                    have_x = EINA_TRUE;
+               }
+          }
+     }
 
    // If just one source require fallback, we can't be sure that
    // we are not running enlightenment and that this source might
@@ -3318,16 +3328,21 @@ _ecore_evas_tick_source_find(void)
 
    if (!source)
      {
-        ecore_animator_source_set(ECORE_ANIMATOR_SOURCE_TIMER);
+        if (!have_x)
+          {
+             ecore_animator_custom_source_tick_begin_callback_set(NULL, NULL);
+             ecore_animator_custom_source_tick_end_callback_set(NULL, NULL);
+             ecore_animator_source_set(ECORE_ANIMATOR_SOURCE_TIMER);
+          }
      }
    else
      {
         // Source set will trigger the previous tick end registered and then the new begin.
         // As we don't what was in behind, better first begin and end after source is set.
         ecore_animator_custom_source_tick_begin_callback_set(_ecore_evas_custom_tick_begin, NULL);
-        ecore_animator_source_set(ECORE_ANIMATOR_SOURCE_CUSTOM);
         ecore_animator_custom_source_tick_end_callback_set(_ecore_evas_custom_tick_end, NULL);
-     }
+        ecore_animator_source_set(ECORE_ANIMATOR_SOURCE_CUSTOM);
+    }
 }
 
 static Eina_Bool