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
This commit is contained in:
Carsten Haitzler 2015-11-11 21:22:30 +09:00 committed by Mike Blumenkrantz
parent e54f4fd67f
commit 98bb7f8431
6 changed files with 22 additions and 5 deletions

View File

@ -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;
}

View File

@ -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",

View File

@ -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

View File

@ -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);

View File

@ -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);
}

View File

@ -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