raster pushed a commit to branch master.

http://git.enlightenment.org/core/enlightenment.git/commit/?id=b018ac1abc692e94c7b181672ef35ea25749cbd6

commit b018ac1abc692e94c7b181672ef35ea25749cbd6
Author: Carsten Haitzler (Rasterman) <ras...@rasterman.com>
Date:   Wed Nov 11 21:22:30 2015 +0900

    e screens/zones/randr - store randr2 id in xinerama and zones for lookup
    
    so e has a bit of a problem. we mostly deal with zones, BUt these
    zones come from our old xinerama code (this likely should just die
    some time) and THIS code gets fed info from e's randr code. we
    re-fill/modify as randr finds new screens or things get reconfigured.
    thus zones adapt. the problem is now all our zone code really has a
    hard time reverse mapping the zone back to where it came from -eg the
    randr screen data. you literally can't do a whole bunch of things like
    know if that zone was an internal laptop lid or an external screen, or
    if it was rotated or even what the dpi is... as you ave no deasy way
    to map it back other than by guessing geometry matches.
    
    this fixes that by storing the randr screen id (which should be
    unique) fromt he original src randr screen in the xinerama screen and
    then in the zone. with this you can do a quick lookup in the e randr
    data should you ever need to find the info. this should pave the way
    for some other fixes/improvements, but without this they cannot be done.
    
    @fix
---
 src/bin/e_comp_canvas.c |  8 +++++++-
 src/bin/e_randr2.c      |  2 ++
 src/bin/e_xinerama.c    | 13 ++++++++++---
 src/bin/e_xinerama.h    |  1 +
 src/bin/e_zone.c        |  2 +-
 src/bin/e_zone.h        |  1 +
 6 files changed, 22 insertions(+), 5 deletions(-)

diff --git a/src/bin/e_comp_canvas.c b/src/bin/e_comp_canvas.c
index 5f90c8c..97a2edc 100644
--- a/src/bin/e_comp_canvas.c
+++ b/src/bin/e_comp_canvas.c
@@ -263,7 +263,9 @@ e_comp_canvas_init(int w, int h)
 
         EINA_LIST_FOREACH(screens, l, scr)
           {
-             e_zone_new(scr->screen, scr->escreen, scr->x, scr->y, scr->w, 
scr->h);
+             E_Zone *zone = e_zone_new(scr->screen, scr->escreen,
+                                       scr->x, scr->y, scr->w, scr->h);
+             if (scr->id) zone->randr2_id = strdup(scr->id);
           }
      }
    else
@@ -474,11 +476,15 @@ e_comp_canvas_update(void)
                   zones = eina_list_remove(zones, zone);
                   e_comp->zones = eina_list_append(e_comp->zones, zone);
                   zone->num = scr->screen;
+                  free(zone->randr2_id);
+                  zone->randr2_id = NULL;
+                  if (scr->id) zone->randr2_id = strdup(scr->id);
                }
              else
                {
                   zone = e_zone_new(scr->screen, scr->escreen,
                                     scr->x, scr->y, scr->w, scr->h);
+                  if (scr->id) zone->randr2_id = strdup(scr->id);
                   printf("@@@ NEW ZONE = %p\n", zone);
                   changed = EINA_TRUE;
                }
diff --git a/src/bin/e_randr2.c b/src/bin/e_randr2.c
index 9d1d604..a2880c2 100644
--- a/src/bin/e_randr2.c
+++ b/src/bin/e_randr2.c
@@ -1194,6 +1194,8 @@ e_randr2_screens_setup(int rw, int rh)
         screen->y = s->config.geom.y;
         screen->w = s->config.geom.w;
         screen->h = s->config.geom.h;
+        if (s->id) screen->id = strdup(s->id);
+
         all_screens = eina_list_append(all_screens, screen);
         printf("xinerama screen %i %i %ix%i\n", screen->x, screen->y, 
screen->w, screen->h);
         INF("E INIT: XINERAMA SCREEN: [%i][%i], %ix%i+%i+%i",
diff --git a/src/bin/e_xinerama.c b/src/bin/e_xinerama.c
index 87462b1..540fafd 100644
--- a/src/bin/e_xinerama.c
+++ b/src/bin/e_xinerama.c
@@ -8,6 +8,13 @@ static Eina_List *all_screens = NULL;
 static Eina_List *chosen_screens = NULL;
 static Eina_List *fake_screens = NULL;
 
+static void
+_screen_free(E_Screen *scr)
+{
+   free(scr->id);
+   free(scr);
+}
+
 EINTERN int
 e_xinerama_init(void)
 {
@@ -45,7 +52,7 @@ e_xinerama_screens_all_get(void)
 E_API void
 e_xinerama_screens_set(Eina_List *screens)
 {
-   E_FREE_LIST(all_screens, free);
+   E_FREE_LIST(all_screens, _screen_free);
    chosen_screens = eina_list_free(chosen_screens);
    all_screens = screens;
    _e_xinerama_update();
@@ -76,9 +83,9 @@ e_xinerama_fake_screens_exist(void)
 static void
 _e_xinerama_clean(void)
 {
-   E_FREE_LIST(all_screens, free);
+   E_FREE_LIST(all_screens, _screen_free);
    chosen_screens = eina_list_free(chosen_screens);
-   E_FREE_LIST(fake_screens, free);
+   E_FREE_LIST(fake_screens, _screen_free);
 }
 
 static void
diff --git a/src/bin/e_xinerama.h b/src/bin/e_xinerama.h
index 53067cb..ea0037c 100644
--- a/src/bin/e_xinerama.h
+++ b/src/bin/e_xinerama.h
@@ -10,6 +10,7 @@ struct _E_Screen
 {
    int screen, escreen;
    int x, y, w, h;
+   char *id; // this is the same id we get from randr2 so look it up there
 };
 
 EINTERN int           e_xinerama_init(void);
diff --git a/src/bin/e_zone.c b/src/bin/e_zone.c
index 66c1ecf..00600e6 100644
--- a/src/bin/e_zone.c
+++ b/src/bin/e_zone.c
@@ -1492,7 +1492,7 @@ _e_zone_free(E_Zone *zone)
           e_object_del(E_OBJECT(zone->desks[x + (y * zone->desk_x_count)]));
      }
    free(zone->desks);
-
+   free(zone->randr2_id);
    free(zone);
 }
 
diff --git a/src/bin/e_zone.h b/src/bin/e_zone.h
index dec74c1..2314fdb 100644
--- a/src/bin/e_zone.h
+++ b/src/bin/e_zone.h
@@ -89,6 +89,7 @@ struct _E_Zone
       Eina_Bool dirty : 1;
    } useful_geometry;
    Eina_Bool      stowed : 1;
+   char *randr2_id; // same id we get from randr2 so look it up there
 };
 
 struct _E_Event_Zone_Generic

-- 


Reply via email to