forked from enlightenment/enlightenment
randr: improve code readability in lid update
Be sure we have active non-lids before deactivating lids.
This commit is contained in:
parent
0ec2bdfd52
commit
27c1f17984
|
@ -1291,22 +1291,43 @@ _e_randr_lid_update(void)
|
||||||
E_Randr_Output *output;
|
E_Randr_Output *output;
|
||||||
Eina_List *l;
|
Eina_List *l;
|
||||||
Eina_Bool changed = EINA_FALSE;
|
Eina_Bool changed = EINA_FALSE;
|
||||||
|
int active_nonlid = 0;
|
||||||
|
|
||||||
/* loop through connections to find lid */
|
|
||||||
changed = EINA_FALSE;
|
changed = EINA_FALSE;
|
||||||
|
/* Find all non-lids */
|
||||||
EINA_LIST_FOREACH(e_randr->outputs, l, output)
|
EINA_LIST_FOREACH(e_randr->outputs, l, output)
|
||||||
{
|
{
|
||||||
if (!output->is_lid) continue;
|
if (output->is_lid) continue;
|
||||||
/* only disable lid if we got more than 1 connected output */
|
if (!output->active) continue;
|
||||||
if ((_e_randr_lid_is_closed) && (output->active) && (e_randr->active > 1))
|
active_nonlid++;
|
||||||
|
}
|
||||||
|
if (_e_randr_lid_is_closed && (active_nonlid > 0))
|
||||||
|
{
|
||||||
|
/* Disable lids if closed and we have other monitors */
|
||||||
|
EINA_LIST_FOREACH(e_randr->outputs, l, output)
|
||||||
{
|
{
|
||||||
|
Eina_Bool active;
|
||||||
|
|
||||||
|
if (!output->is_lid) continue;
|
||||||
|
active = output->active;
|
||||||
_e_randr_output_active_set(output, EINA_FALSE);
|
_e_randr_output_active_set(output, EINA_FALSE);
|
||||||
changed = EINA_TRUE;
|
if (active != output->active) changed = EINA_TRUE;
|
||||||
}
|
}
|
||||||
else if (!output->active)
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Enable lids */
|
||||||
|
EINA_LIST_FOREACH(e_randr->outputs, l, output)
|
||||||
{
|
{
|
||||||
_e_randr_output_active_set(output, EINA_TRUE);
|
Eina_Bool active;
|
||||||
changed = EINA_TRUE;
|
|
||||||
|
if (!output->is_lid) continue;
|
||||||
|
if (output->cfg && output->cfg->connect)
|
||||||
|
{
|
||||||
|
active = output->active;
|
||||||
|
_e_randr_output_active_set(output, EINA_TRUE);
|
||||||
|
if (active != output->active) changed = EINA_TRUE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue