summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2015-11-11 21:22:30 +0900
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2015-11-11 21:22:30 +0900
commitb018ac1abc692e94c7b181672ef35ea25749cbd6 (patch)
tree637d958a20dacbce1bdf2617b33ded0e757c6a9f
parentb3d68ee828afe6590ce8ce8e8dd613664515bde8 (diff)
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
-rw-r--r--src/bin/e_comp_canvas.c8
-rw-r--r--src/bin/e_randr2.c2
-rw-r--r--src/bin/e_xinerama.c13
-rw-r--r--src/bin/e_xinerama.h1
-rw-r--r--src/bin/e_zone.c2
-rw-r--r--src/bin/e_zone.h1
6 files changed, 22 insertions, 5 deletions
diff --git a/src/bin/e_comp_canvas.c b/src/bin/e_comp_canvas.c
index 5f90c8c34..97a2edc94 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)
263 263
264 EINA_LIST_FOREACH(screens, l, scr) 264 EINA_LIST_FOREACH(screens, l, scr)
265 { 265 {
266 e_zone_new(scr->screen, scr->escreen, scr->x, scr->y, scr->w, scr->h); 266 E_Zone *zone = e_zone_new(scr->screen, scr->escreen,
267 scr->x, scr->y, scr->w, scr->h);
268 if (scr->id) zone->randr2_id = strdup(scr->id);
267 } 269 }
268 } 270 }
269 else 271 else
@@ -474,11 +476,15 @@ e_comp_canvas_update(void)
474 zones = eina_list_remove(zones, zone); 476 zones = eina_list_remove(zones, zone);
475 e_comp->zones = eina_list_append(e_comp->zones, zone); 477 e_comp->zones = eina_list_append(e_comp->zones, zone);
476 zone->num = scr->screen; 478 zone->num = scr->screen;
479 free(zone->randr2_id);
480 zone->randr2_id = NULL;
481 if (scr->id) zone->randr2_id = strdup(scr->id);
477 } 482 }
478 else 483 else
479 { 484 {
480 zone = e_zone_new(scr->screen, scr->escreen, 485 zone = e_zone_new(scr->screen, scr->escreen,
481 scr->x, scr->y, scr->w, scr->h); 486 scr->x, scr->y, scr->w, scr->h);
487 if (scr->id) zone->randr2_id = strdup(scr->id);
482 printf("@@@ NEW ZONE = %p\n", zone); 488 printf("@@@ NEW ZONE = %p\n", zone);
483 changed = EINA_TRUE; 489 changed = EINA_TRUE;
484 } 490 }
diff --git a/src/bin/e_randr2.c b/src/bin/e_randr2.c
index 9d1d604b5..a2880c245 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)
1194 screen->y = s->config.geom.y; 1194 screen->y = s->config.geom.y;
1195 screen->w = s->config.geom.w; 1195 screen->w = s->config.geom.w;
1196 screen->h = s->config.geom.h; 1196 screen->h = s->config.geom.h;
1197 if (s->id) screen->id = strdup(s->id);
1198
1197 all_screens = eina_list_append(all_screens, screen); 1199 all_screens = eina_list_append(all_screens, screen);
1198 printf("xinerama screen %i %i %ix%i\n", screen->x, screen->y, screen->w, screen->h); 1200 printf("xinerama screen %i %i %ix%i\n", screen->x, screen->y, screen->w, screen->h);
1199 INF("E INIT: XINERAMA SCREEN: [%i][%i], %ix%i+%i+%i", 1201 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 87462b1c5..540fafd0e 100644
--- a/src/bin/e_xinerama.c
+++ b/src/bin/e_xinerama.c
@@ -8,6 +8,13 @@ static Eina_List *all_screens = NULL;
8static Eina_List *chosen_screens = NULL; 8static Eina_List *chosen_screens = NULL;
9static Eina_List *fake_screens = NULL; 9static Eina_List *fake_screens = NULL;
10 10
11static void
12_screen_free(E_Screen *scr)
13{
14 free(scr->id);
15 free(scr);
16}
17
11EINTERN int 18EINTERN int
12e_xinerama_init(void) 19e_xinerama_init(void)
13{ 20{
@@ -45,7 +52,7 @@ e_xinerama_screens_all_get(void)
45E_API void 52E_API void
46e_xinerama_screens_set(Eina_List *screens) 53e_xinerama_screens_set(Eina_List *screens)
47{ 54{
48 E_FREE_LIST(all_screens, free); 55 E_FREE_LIST(all_screens, _screen_free);
49 chosen_screens = eina_list_free(chosen_screens); 56 chosen_screens = eina_list_free(chosen_screens);
50 all_screens = screens; 57 all_screens = screens;
51 _e_xinerama_update(); 58 _e_xinerama_update();
@@ -76,9 +83,9 @@ e_xinerama_fake_screens_exist(void)
76static void 83static void
77_e_xinerama_clean(void) 84_e_xinerama_clean(void)
78{ 85{
79 E_FREE_LIST(all_screens, free); 86 E_FREE_LIST(all_screens, _screen_free);
80 chosen_screens = eina_list_free(chosen_screens); 87 chosen_screens = eina_list_free(chosen_screens);
81 E_FREE_LIST(fake_screens, free); 88 E_FREE_LIST(fake_screens, _screen_free);
82} 89}
83 90
84static void 91static void
diff --git a/src/bin/e_xinerama.h b/src/bin/e_xinerama.h
index 53067cb33..ea0037cf1 100644
--- a/src/bin/e_xinerama.h
+++ b/src/bin/e_xinerama.h
@@ -10,6 +10,7 @@ struct _E_Screen
10{ 10{
11 int screen, escreen; 11 int screen, escreen;
12 int x, y, w, h; 12 int x, y, w, h;
13 char *id; // this is the same id we get from randr2 so look it up there
13}; 14};
14 15
15EINTERN int e_xinerama_init(void); 16EINTERN int e_xinerama_init(void);
diff --git a/src/bin/e_zone.c b/src/bin/e_zone.c
index 66c1ecf4d..00600e6f7 100644
--- a/src/bin/e_zone.c
+++ b/src/bin/e_zone.c
@@ -1492,7 +1492,7 @@ _e_zone_free(E_Zone *zone)
1492 e_object_del(E_OBJECT(zone->desks[x + (y * zone->desk_x_count)])); 1492 e_object_del(E_OBJECT(zone->desks[x + (y * zone->desk_x_count)]));
1493 } 1493 }
1494 free(zone->desks); 1494 free(zone->desks);
1495 1495 free(zone->randr2_id);
1496 free(zone); 1496 free(zone);
1497} 1497}
1498 1498
diff --git a/src/bin/e_zone.h b/src/bin/e_zone.h
index dec74c1c7..2314fdb37 100644
--- a/src/bin/e_zone.h
+++ b/src/bin/e_zone.h
@@ -89,6 +89,7 @@ struct _E_Zone
89 Eina_Bool dirty : 1; 89 Eina_Bool dirty : 1;
90 } useful_geometry; 90 } useful_geometry;
91 Eina_Bool stowed : 1; 91 Eina_Bool stowed : 1;
92 char *randr2_id; // same id we get from randr2 so look it up there
92}; 93};
93 94
94struct _E_Event_Zone_Generic 95struct _E_Event_Zone_Generic