handle rotations with fake xinerama screens

This commit is contained in:
Mike Blumenkrantz 2017-06-30 10:25:24 -04:00
parent 789eccf12f
commit 43dea93969
2 changed files with 27 additions and 20 deletions

View File

@ -1107,35 +1107,11 @@ _e_comp_wl_client_evas_init(E_Client *ec)
ec->comp_data->evas_init = EINA_TRUE;
}
static Eina_Bool
_e_comp_wl_cb_randr_change(void *data EINA_UNUSED, int type EINA_UNUSED, void *event EINA_UNUSED)
static inline int
_rotation_get(int rotation)
{
const Eina_List *l;
E_Randr2_Screen *screen;
unsigned int transform = WL_OUTPUT_TRANSFORM_NORMAL;
if (!e_randr2) return ECORE_CALLBACK_RENEW;
if (e_xinerama_fake_screens_exist())
{
E_Screen *scr;
EINA_LIST_FOREACH(e_xinerama_screens_get(), l, scr)
{
e_comp_wl_output_init(NULL, NULL, NULL,
scr->x, scr->y, scr->w, scr->h,
0, 0, 0, 0, 0, scr->escreen);
}
return ECORE_CALLBACK_RENEW;
}
EINA_LIST_FOREACH(e_randr2->screens, l, screen)
{
if (!screen->config.enabled)
{
e_comp_wl_output_remove(screen->id);
continue;
}
switch (screen->config.rotation)
int transform;
switch (rotation)
{
case 90:
transform = WL_OUTPUT_TRANSFORM_90;
@ -1151,13 +1127,43 @@ _e_comp_wl_cb_randr_change(void *data EINA_UNUSED, int type EINA_UNUSED, void *e
transform = WL_OUTPUT_TRANSFORM_NORMAL;
break;
}
return transform;
}
static Eina_Bool
_e_comp_wl_cb_randr_change(void *data EINA_UNUSED, int type EINA_UNUSED, void *event EINA_UNUSED)
{
const Eina_List *l;
E_Randr2_Screen *screen;
if (!e_randr2) return ECORE_CALLBACK_RENEW;
if (e_xinerama_fake_screens_exist())
{
E_Screen *scr;
EINA_LIST_FOREACH(e_xinerama_screens_get(), l, scr)
{
e_comp_wl_output_init(NULL, NULL, NULL,
scr->x, scr->y, scr->w, scr->h,
0, 0, 0, 0, _rotation_get(scr->rotation), scr->escreen);
}
return ECORE_CALLBACK_RENEW;
}
EINA_LIST_FOREACH(e_randr2->screens, l, screen)
{
if (!screen->config.enabled)
{
e_comp_wl_output_remove(screen->id);
continue;
}
if (!e_comp_wl_output_init(screen->id, screen->info.name,
screen->info.screen,
screen->config.geom.x, screen->config.geom.y,
screen->config.geom.w, screen->config.geom.h,
screen->info.size.w, screen->info.size.h,
screen->config.mode.refresh, screen->info.subpixel, transform, 0))
screen->config.mode.refresh, screen->info.subpixel,
_rotation_get(screen->config.rotation), 0))
ERR("Could not initialize screen %s", screen->info.name);
}

View File

@ -10,6 +10,7 @@ struct _E_Screen
{
int screen, escreen;
int x, y, w, h;
int rotation;
char *id; // this is the same id we get from randr2 so look it up there
};