forked from enlightenment/enlightenment
randr: Don't track active outputs
Remove tracking of active outputs to reduce code complexity.
This commit is contained in:
parent
d265a1b289
commit
01f43e3618
|
@ -36,6 +36,7 @@ static Eina_Bool _e_randr_output_mode_valid(Ecore_X_Randr_Mode mode, Ecore_X_Ran
|
||||||
static void _e_randr_output_active_set(E_Randr_Output *output, Eina_Bool connected);
|
static void _e_randr_output_active_set(E_Randr_Output *output, Eina_Bool connected);
|
||||||
//static int _e_randr_config_output_cmp(const void *a, const void *b);
|
//static int _e_randr_config_output_cmp(const void *a, const void *b);
|
||||||
static char *_e_randr_output_name_get(Ecore_X_Window root, Ecore_X_Randr_Output output);
|
static char *_e_randr_output_name_get(Ecore_X_Window root, Ecore_X_Randr_Output output);
|
||||||
|
static int _e_randr_active_get(void);
|
||||||
|
|
||||||
/* local variables */
|
/* local variables */
|
||||||
static Eina_List *_randr_event_handlers = NULL;
|
static Eina_List *_randr_event_handlers = NULL;
|
||||||
|
@ -622,10 +623,13 @@ _e_randr_apply(void)
|
||||||
/* if the output does not fit, disable it */
|
/* if the output does not fit, disable it */
|
||||||
if (((x + w) > maxw) || ((y + h) > maxh) || (mode == 0))
|
if (((x + w) > maxw) || ((y + h) > maxh) || (mode == 0))
|
||||||
{
|
{
|
||||||
|
Eina_List *ln;
|
||||||
|
|
||||||
printf("RRR2: crtc does not fit - off\n");
|
printf("RRR2: crtc does not fit - off\n");
|
||||||
/* TODO: This is wrong, should remove output from crtc->outputs */
|
|
||||||
ecore_x_randr_crtc_settings_set(root, crtc->xid, NULL, 0, 0, 0, 0,
|
ecore_x_randr_crtc_settings_set(root, crtc->xid, NULL, 0, 0, 0, 0,
|
||||||
ECORE_X_RANDR_ORIENTATION_ROT_0);
|
ECORE_X_RANDR_ORIENTATION_ROT_0);
|
||||||
|
EINA_LIST_FOREACH_SAFE(crtc->outputs, ll, ln, output)
|
||||||
|
_e_randr_output_active_set(output, EINA_FALSE);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -791,7 +795,7 @@ _e_randr_event_cb_output_change(void *data EINA_UNUSED, int type EINA_UNUSED, vo
|
||||||
/* forget out crtc */
|
/* forget out crtc */
|
||||||
output->crtc = NULL;
|
output->crtc = NULL;
|
||||||
}
|
}
|
||||||
if ((!output->active) && (output->cfg->connect))
|
if (output->cfg && output->cfg->connect)
|
||||||
{
|
{
|
||||||
/* connect to crtc */
|
/* connect to crtc */
|
||||||
_e_randr_output_active_set(output, EINA_TRUE);
|
_e_randr_output_active_set(output, EINA_TRUE);
|
||||||
|
@ -822,12 +826,9 @@ _e_randr_event_cb_output_change(void *data EINA_UNUSED, int type EINA_UNUSED, vo
|
||||||
else if (ev->connection == ECORE_X_RANDR_CONNECTION_STATUS_DISCONNECTED)
|
else if (ev->connection == ECORE_X_RANDR_CONNECTION_STATUS_DISCONNECTED)
|
||||||
{
|
{
|
||||||
/* disconnected */
|
/* disconnected */
|
||||||
if (output->active)
|
|
||||||
{
|
|
||||||
_e_randr_output_active_set(output, EINA_FALSE);
|
_e_randr_output_active_set(output, EINA_FALSE);
|
||||||
changed = EINA_TRUE;
|
changed = EINA_TRUE;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/* save the config if anything changed or we added a new one */
|
/* save the config if anything changed or we added a new one */
|
||||||
if (changed)
|
if (changed)
|
||||||
|
@ -1249,12 +1250,12 @@ _e_randr_lid_update(void)
|
||||||
{
|
{
|
||||||
if (!output->is_lid) continue;
|
if (!output->is_lid) continue;
|
||||||
/* only disable lid if we got more than 1 connected output */
|
/* only disable lid if we got more than 1 connected output */
|
||||||
if ((_e_randr_lid_is_closed) && (output->active) && (e_randr->active > 1))
|
if ((_e_randr_lid_is_closed) && (_e_randr_active_get() > 1))
|
||||||
{
|
{
|
||||||
_e_randr_output_active_set(output, EINA_FALSE);
|
_e_randr_output_active_set(output, EINA_FALSE);
|
||||||
changed = EINA_TRUE;
|
changed = EINA_TRUE;
|
||||||
}
|
}
|
||||||
else if (!output->active)
|
else
|
||||||
{
|
{
|
||||||
_e_randr_output_active_set(output, EINA_TRUE);
|
_e_randr_output_active_set(output, EINA_TRUE);
|
||||||
changed = EINA_TRUE;
|
changed = EINA_TRUE;
|
||||||
|
@ -1290,22 +1291,21 @@ _e_randr_output_active_set(E_Randr_Output *output, Eina_Bool active)
|
||||||
{
|
{
|
||||||
_e_randr_output_crtc_find(output);
|
_e_randr_output_crtc_find(output);
|
||||||
}
|
}
|
||||||
|
output->active = EINA_FALSE;
|
||||||
if (output->crtc)
|
if (output->crtc)
|
||||||
{
|
{
|
||||||
output->active = active;
|
|
||||||
printf("RR: ... found crtc %i\n", active);
|
printf("RR: ... found crtc %i\n", active);
|
||||||
if (active)
|
if (active)
|
||||||
{
|
{
|
||||||
output->crtc->outputs =
|
output->crtc->outputs =
|
||||||
eina_list_append(output->crtc->outputs, output);
|
eina_list_append(output->crtc->outputs, output);
|
||||||
e_randr->active++;
|
|
||||||
printf("RR: ... add active output for crtc now\n");
|
printf("RR: ... add active output for crtc now\n");
|
||||||
|
output->active = EINA_TRUE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
output->crtc->outputs =
|
output->crtc->outputs =
|
||||||
eina_list_remove(output->crtc->outputs, output);
|
eina_list_remove(output->crtc->outputs, output);
|
||||||
e_randr->active--;
|
|
||||||
output->crtc = NULL;
|
output->crtc = NULL;
|
||||||
printf("RR: ... remove output for crtc now\n");
|
printf("RR: ... remove output for crtc now\n");
|
||||||
}
|
}
|
||||||
|
@ -1338,3 +1338,18 @@ _e_randr_output_name_get(Ecore_X_Window root, Ecore_X_Randr_Output output)
|
||||||
}
|
}
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
_e_randr_active_get(void)
|
||||||
|
{
|
||||||
|
int active = 0;
|
||||||
|
E_Randr_Output *output;
|
||||||
|
Eina_List *l;
|
||||||
|
|
||||||
|
EINA_LIST_FOREACH(e_randr->outputs, l, output)
|
||||||
|
{
|
||||||
|
if (output->active)
|
||||||
|
active++;
|
||||||
|
}
|
||||||
|
return active;
|
||||||
|
}
|
||||||
|
|
|
@ -70,7 +70,6 @@ struct _E_Randr_Crtc
|
||||||
|
|
||||||
struct _E_Randr
|
struct _E_Randr
|
||||||
{
|
{
|
||||||
int active; // number of active outputs
|
|
||||||
Eina_List *crtcs; // list of crtcs
|
Eina_List *crtcs; // list of crtcs
|
||||||
Eina_List *outputs; // list of outputs
|
Eina_List *outputs; // list of outputs
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue