loose syncing option. in reality it will work fine. but not clean.
authorCarsten Haitzler <raster@rasterman.com>
Mon, 1 Feb 2010 14:38:00 +0000 (14:38 +0000)
committerCarsten Haitzler <raster@rasterman.com>
Mon, 1 Feb 2010 14:38:00 +0000 (14:38 +0000)
SVN revision: 45776

src/modules/comp/e_mod_comp.c
src/modules/comp/e_mod_config.c
src/modules/comp/e_mod_main.c
src/modules/comp/e_mod_main.h

index c6f66611ebf87f611c4cc2b3c6610fdaa62232c8..20ff829ac6330615d0b5da6a106d846a285fcd19 100644 (file)
@@ -38,7 +38,6 @@ struct _E_Comp
    int             render_overflow;
 
    Eina_Bool       gl : 1;
-   Eina_Bool       efl_sync : 1;
    Eina_Bool       grabbed : 1;
 };
 
@@ -317,8 +316,14 @@ _e_mod_comp_pre_swap(void *data, Evas *e)
 {
    E_Comp *c = data;
    
-//   ecore_x_ungrab();
-   c->grabbed = 0;
+   if (_comp_mod->conf->grab)
+     {
+        if (c->grabbed)
+          {
+             ecore_x_ungrab();
+             c->grabbed = 0;
+          }
+     }
 }
 
 static int
@@ -327,13 +332,16 @@ _e_mod_comp_cb_update(E_Comp *c)
    E_Comp_Win *cw;
    Eina_List *new_updates = NULL; // for failed pixmap fetches - get them next frame
    Eina_List *update_done = NULL;
-   
-//   ecore_x_grab();
-//   ecore_x_sync();
-   c->grabbed = 1;
+
+   if (_comp_mod->conf->grab)
+     {
+        ecore_x_grab();
+        ecore_x_sync();
+        c->grabbed = 1;
+     }
    EINA_LIST_FREE(c->updates, cw)
      {
-        if (c->efl_sync)
+        if (_comp_mod->conf->efl_sync)
           {
              if (((cw->counter) && (cw->drawme)) || (!cw->counter))
                {
@@ -352,17 +360,20 @@ _e_mod_comp_cb_update(E_Comp *c)
      }
    if (_comp_mod->conf->lock_fps)
      ecore_evas_manual_render(c->ee);
-   if (c->efl_sync)
+   if (_comp_mod->conf->efl_sync)
      {  
         EINA_LIST_FREE(update_done, cw)
           {
              ecore_x_sync_counter_inc(cw->counter, 1);
           }
      }
-   if (c->grabbed)
+   if (_comp_mod->conf->grab)
      {
-        c->grabbed = 0;
-//        ecore_x_ungrab();
+        if (c->grabbed)
+          {
+             c->grabbed = 0;
+             ecore_x_ungrab();
+          }
      }
    if (new_updates) _e_mod_comp_render_queue(c);
    c->updates = new_updates;
@@ -698,9 +709,10 @@ _e_mod_comp_win_show(E_Comp_Win *cw)
         eina_hash_add(borders, e_util_winid_str_get(cw->bd->client.win), cw);
         cw->dfn = e_object_delfn_add(E_OBJECT(cw->bd), 
                                      _e_mod_comp_object_del, cw);
-        if (cw->c->efl_sync)
+        if (_comp_mod->conf->efl_sync)
           {
-             if (_e_mod_comp_win_is_borderless(cw))
+             if (_e_mod_comp_win_is_borderless(cw) ||
+                 (_comp_mod->conf->loose_sync))
                {
                   counter = ecore_x_e_comp_sync_counter_get(cw->bd->client.win);
                   if (counter)
@@ -790,7 +802,7 @@ _e_mod_comp_win_hide(E_Comp_Win *cw)
         ecore_timer_del(cw->update_timeout);
         cw->update_timeout = NULL;
      }
-   if (cw->c->efl_sync)
+   if (_comp_mod->conf->efl_sync)
      {
         if ((cw->bd) && (cw->counter))
           ecore_x_e_comp_sync_end_send(cw->bd->client.win);
@@ -959,7 +971,9 @@ _e_mod_comp_win_damage(E_Comp_Win *cw, int x, int y, int w, int h, Eina_Bool dmg
    if (cw->counter)
      {
         if (!cw->update_timeout)
-          cw->update_timeout = ecore_timer_add(0.25, _e_mod_comp_win_damage_timeout, cw);
+          cw->update_timeout = ecore_timer_add
+          (ecore_animator_frametime_get() * 2, 
+           _e_mod_comp_win_damage_timeout, cw);
         return;
      }
    if (!cw->update)
@@ -1175,8 +1189,7 @@ _e_mod_comp_add(E_Manager *man)
    c = calloc(1, sizeof(E_Comp));
    if (!c) return NULL;
 
-   c->efl_sync = _comp_mod->conf->efl_sync;
-   ecore_x_e_comp_sync_supported_set(man->root, c->efl_sync);
+   ecore_x_e_comp_sync_supported_set(man->root, _comp_mod->conf->efl_sync);
    
    c->man = man;
    c->win = ecore_x_composite_render_window_enable(man->root);
index 2cb7a544d49fb675b19587243e18e2fedcad594a..e29a19dca17584f5566db2b3db78020662d7d9ef 100644 (file)
@@ -11,6 +11,8 @@ struct _E_Config_Dialog_Data
    int texture_from_pixmap;
    int lock_fps;
    int efl_sync;
+   int loose_sync;
+   int grab;
 };
 
 /* Protos */
@@ -60,6 +62,8 @@ _create_data(E_Config_Dialog *cfd)
    cfdata->texture_from_pixmap = _comp_mod->conf->texture_from_pixmap;
    cfdata->lock_fps = _comp_mod->conf->lock_fps;
    cfdata->efl_sync = _comp_mod->conf->efl_sync;
+   cfdata->loose_sync = _comp_mod->conf->loose_sync;
+   cfdata->grab = _comp_mod->conf->grab;
    return cfdata;
 }
 
@@ -86,7 +90,11 @@ _basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cf
    e_widget_framelist_object_append(of, ob);
    ob = e_widget_check_add(evas, _("Limit FPS"), &(cfdata->lock_fps));
    e_widget_framelist_object_append(of, ob);
-   ob = e_widget_check_add(evas, _("Sync EFL Windows"), &(cfdata->efl_sync));
+   ob = e_widget_check_add(evas, _("Sync EFL windows"), &(cfdata->efl_sync));
+   e_widget_framelist_object_append(of, ob);
+   ob = e_widget_check_add(evas, _("Loose Sync"), &(cfdata->loose_sync));
+   e_widget_framelist_object_append(of, ob);
+   ob = e_widget_check_add(evas, _("Grab during composite"), &(cfdata->grab));
    e_widget_framelist_object_append(of, ob);
    e_widget_table_object_append(ot, of, 0, 0, 1, 1, 1, 1, 1, 1);
    
@@ -123,19 +131,23 @@ static int
 _basic_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata) 
 {
    if ((_comp_mod->conf->use_shadow != cfdata->use_shadow) ||
-       (cfdata->lock_fps != _comp_mod->conf->lock_fps))
+       (cfdata->lock_fps != _comp_mod->conf->lock_fps) ||
+       (cfdata->grab != _comp_mod->conf->grab))
      {
         _comp_mod->conf->use_shadow = cfdata->use_shadow;
         _comp_mod->conf->lock_fps = cfdata->lock_fps;
+        _comp_mod->conf->grab = cfdata->grab;
         e_mod_comp_shadow_set();
      }
    if ((_comp_mod->conf->engine != cfdata->engine) ||
        (cfdata->texture_from_pixmap != _comp_mod->conf->texture_from_pixmap) ||
-       (cfdata->efl_sync != _comp_mod->conf->efl_sync))
+       (cfdata->efl_sync != _comp_mod->conf->efl_sync) ||
+       (cfdata->loose_sync != _comp_mod->conf->loose_sync))
      {
         _comp_mod->conf->engine = cfdata->engine;
         _comp_mod->conf->texture_from_pixmap = cfdata->texture_from_pixmap;
         _comp_mod->conf->efl_sync = cfdata->efl_sync;
+        _comp_mod->conf->loose_sync = cfdata->loose_sync;
         e_mod_comp_shutdown();
         e_mod_comp_init();
      }
index c01173b1d8282571adafd951c8980e398f64bea2..4269be35f08ee6d627c9e7ed7fb289f3941f02a3 100644 (file)
@@ -36,6 +36,8 @@ e_modapi_init(E_Module *m)
    E_CONFIG_VAL(D, T, texture_from_pixmap, UCHAR);
    E_CONFIG_VAL(D, T, lock_fps, UCHAR);
    E_CONFIG_VAL(D, T, efl_sync, UCHAR);
+   E_CONFIG_VAL(D, T, loose_sync, UCHAR);
+   E_CONFIG_VAL(D, T, grab, UCHAR);
    
    mod->conf = e_config_domain_load("module.comp", mod->conf_edd);
    if (!mod->conf)
@@ -47,6 +49,8 @@ e_modapi_init(E_Module *m)
         mod->conf->texture_from_pixmap = 0;
         mod->conf->lock_fps = 1;
         mod->conf->efl_sync = 1;
+        mod->conf->loose_sync = 0;
+        mod->conf->grab = 0;
      }
    
    _comp_mod = mod;
index 71df019e04c2adb575ded68f27aabb1e69035880..65f7f476d43e0082ee993c77da82a3c0e0d5c27b 100644 (file)
@@ -12,7 +12,9 @@ struct _Config
    int              engine;
    unsigned char    texture_from_pixmap;
    unsigned char    lock_fps;
+   unsigned char    loose_sync;
    unsigned char    efl_sync;
+   unsigned char    grab;
 };
 
 struct _Mod