You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1647 lines
53 KiB

#include "e.h"
#define E_RANDR_CONFIG_VERSION 3
/////////////////////////////////////////////////////////////////////////
static Eina_Bool _screen_closed(E_Randr2_Screen *s);
static void _animated_apply_abort(void);
static void _cb_delay_init_save(void *data);
static Eina_Bool _cb_delay_timer(void *data);
static Eina_Bool _cb_fade_animator(void *data);
static void _animated_apply(void);
static void _do_apply(void);
static void _info_free(E_Randr2 *r);
static E_Config_Randr2 *_config_load(void);
static void _config_free(E_Config_Randr2 *cfg);
static Eina_Bool _config_save(E_Randr2 *r, E_Config_Randr2 *cfg);
static Eina_Bool _config_update(E_Randr2 *r, E_Config_Randr2 *cfg, Eina_Bool );
static void _config_apply(E_Randr2 *r, E_Config_Randr2 *cfg);
static int _config_screen_match_count(E_Randr2 *r, E_Config_Randr2 *cfg);
static char *_screens_fingerprint(E_Randr2 *r);
static Eina_Bool _screens_differ(E_Randr2 *r1, E_Randr2 *r2);
static Eina_Bool _cb_screen_change_delay(void *data);
static E_Randr2_Screen *_screen_output_find(const char *out);
static E_Randr2_Screen *_screen_id_find(const char *id);
static void _screen_config_takeover(void);
static void _screen_config_do(E_Randr2_Screen *s);
static void _screen_config_eval(void);
static void _screen_config_maxsize(void);
/////////////////////////////////////////////////////////////////////////
static E_Config_DD *_e_randr2_cfg_edd = NULL;
static E_Config_DD *_e_randr2_cfg_screen_edd = NULL;
static Eina_List *_ev_handlers = NULL;
static Ecore_Timer *_screen_delay_timer = NULL;
static Eina_Bool event_screen = EINA_FALSE;
static Eina_Bool event_ignore = EINA_FALSE;
static Eina_Bool initted = EINA_FALSE;
static Eina_Bool blocked = EINA_FALSE;
/////////////////////////////////////////////////////////////////////////
E_API E_Config_Randr2 *e_randr2_cfg = NULL;
E_API E_Randr2 *e_randr2 = NULL;
E_API int E_EVENT_RANDR_CHANGE = 0;
static void
_cb_delay_init_save(void *data EINA_UNUSED)
{
e_randr2_config_save();
}
/////////////////////////////////////////////////////////////////////////
EINTERN Eina_Bool
e_randr2_init(void)
{
int count;
if (!E_EVENT_RANDR_CHANGE) E_EVENT_RANDR_CHANGE = ecore_event_type_new();
if (blocked) return EINA_FALSE;
if ((!e_comp->screen) || (!e_comp->screen->available) || (!e_comp->screen->available())) return EINA_FALSE;
initted = EINA_TRUE;
// create data descriptors for config storage
_e_randr2_cfg_screen_edd =
E_CONFIG_DD_NEW("E_Config_Randr2_Screen", E_Config_Randr2_Screen);
#undef T
#undef D
#define T E_Config_Randr2_Screen
#define D _e_randr2_cfg_screen_edd
E_CONFIG_VAL(D, T, id, STR);
E_CONFIG_VAL(D, T, rel_to, STR);
E_CONFIG_VAL(D, T, rel_align, DOUBLE);
E_CONFIG_VAL(D, T, mode_refresh, DOUBLE);
E_CONFIG_VAL(D, T, mode_w, UINT);
E_CONFIG_VAL(D, T, mode_h, INT);
E_CONFIG_VAL(D, T, rotation, INT);
E_CONFIG_VAL(D, T, priority, INT);
E_CONFIG_VAL(D, T, rel_mode, UCHAR);
E_CONFIG_VAL(D, T, enabled, UCHAR);
E_CONFIG_VAL(D, T, ignore_disconnect, UCHAR);
E_CONFIG_VAL(D, T, custom_label_screen, STR);
E_CONFIG_VAL(D, T, profile, STR);
E_CONFIG_VAL(D, T, scale_multiplier, DOUBLE);
_e_randr2_cfg_edd = E_CONFIG_DD_NEW("E_Config_Randr2", E_Config_Randr2);
#undef T
#undef D
#define T E_Config_Randr2
#define D _e_randr2_cfg_edd
E_CONFIG_VAL(D, T, version, INT);
E_CONFIG_LIST(D, T, screens, _e_randr2_cfg_screen_edd);
E_CONFIG_VAL(D, T, hotplug_response, DOUBLE);
E_CONFIG_VAL(D, T, restore, UCHAR);
E_CONFIG_VAL(D, T, ignore_hotplug_events, UCHAR);
E_CONFIG_VAL(D, T, ignore_acpi_events, UCHAR);
E_CONFIG_VAL(D, T, default_policy, UINT);
// set up events from the driver
if (e_comp->screen->init)
e_comp->screen->init();
// get current screen info
e_randr2 = e_comp->screen->create();
// from screen info calculate screen max dimensions
_screen_config_maxsize();
// load config and apply it
e_randr2_cfg = _config_load();
// only apply if restore is set AND at least one configured screen
// matches one we have
count = _config_screen_match_count(e_randr2, e_randr2_cfg);
if (e_randr2_cfg->restore && count)
{
if (count != (int)eina_list_count(e_randr2->screens))
{
if (_config_update(e_randr2, e_randr2_cfg, 1))
e_randr2_config_save();
}
_do_apply();
}
else
{
_config_update(e_randr2, e_randr2_cfg, 0);
ecore_job_add(_cb_delay_init_save, NULL);
}
ecore_event_add(E_EVENT_RANDR_CHANGE, NULL, NULL, NULL);
return EINA_TRUE;
}
EINTERN int
e_randr2_shutdown(void)
{
if (!initted) return 0;
initted = EINA_FALSE;
_animated_apply_abort();
// nuke any screen config delay handler
if (_screen_delay_timer) ecore_timer_del(_screen_delay_timer);
_screen_delay_timer = NULL;
// stop listening to driver info
if (e_comp->screen && e_comp->screen->shutdown)
e_comp->screen->shutdown();
// clear up all event handlers
E_FREE_LIST(_ev_handlers, ecore_event_handler_del);
// free up screen info
_info_free(e_randr2);
e_randr2 = NULL;
_config_free(e_randr2_cfg);
e_randr2_cfg = NULL;
// free up data descriptors
E_CONFIG_DD_FREE(_e_randr2_cfg_edd);
E_CONFIG_DD_FREE(_e_randr2_cfg_screen_edd)
return 1;
}
E_API void
e_randr2_stop(void)
{
blocked = EINA_TRUE;
if (initted) e_randr2_shutdown();
}
E_API Eina_Bool
e_randr2_config_save(void)
{
// save our config
return _config_save(e_randr2, e_randr2_cfg);
}
E_API void
e_randr2_config_apply(void)
{
_animated_apply();
}
static E_Randr2_Screen *
_randr_screen_find(E_Randr2 *r, E_Randr2_Screen *src)
{
Eina_List *l;
E_Randr2_Screen *s;
EINA_LIST_FOREACH(r->screens, l, s)
{
if ((s->info.name) && (src->info.name) &&
(!strcmp(s->info.name, src->info.name)))
return s;
}
return NULL;
}
static void
_randr_screen_props_copyover(E_Randr2 *rold, E_Randr2 *rnew)
{
Eina_List *l;
E_Randr2_Screen *s, *s2;
// copy s->config.ignore_disconnect over from tr to e_randr2
EINA_LIST_FOREACH(rnew->screens, l, s)
{
s2 = _randr_screen_find(rold, s);
if (s2) s->config.ignore_disconnect = s2->config.ignore_disconnect;
}
}
E_API void
e_randr2_screeninfo_update(void)
{
E_Randr2 *tr = e_randr2;
// re-fetch/update current screen info
e_randr2 = e_comp->screen->create();
if ((tr) && (e_randr2))
{
_randr_screen_props_copyover(tr, e_randr2);
_info_free(tr);
}
_screen_config_maxsize();
}
/////////////////////////////////////////////////////////////////////////
static double _start_time = 0.0;
static Ecore_Animator *_fade_animator = NULL;
static Ecore_Timer *_apply_delay = NULL;
Eina_Bool _applying = EINA_FALSE;
static int _target_from = 0;
static int _target_to = 0;
static Evas_Object *_fade_obj = NULL;
static Eina_Bool
_screen_closed(E_Randr2_Screen *s)
{
printf("RRR: check lid for %s...\n", s->info.name);
if (!e_acpi_lid_is_closed()) return EINA_FALSE;
if (s->info.is_lid)
{
printf("RRR: is closed lid\n");
return EINA_TRUE;
}
return EINA_FALSE;
}
static void
_animated_apply_abort(void)
{
if (_apply_delay) ecore_timer_del(_apply_delay);
if (_fade_animator) ecore_animator_del(_fade_animator);
_apply_delay = NULL;
_fade_animator = NULL;
_applying = EINA_FALSE;
_fade_obj = NULL;
}
static Eina_Bool
_cb_delay_timer(void *data EINA_UNUSED)
{
_apply_delay = NULL;
_target_from = 255;
_target_to = 0;
_start_time = ecore_loop_time_get();
_fade_animator = ecore_animator_add(_cb_fade_animator, NULL);
return EINA_FALSE;
}
static Eina_Bool
_cb_fade_animator(void *data EINA_UNUSED)
{
double t = ecore_loop_time_get() - _start_time;
const double duration = 0.5;
int v;
if (t < 0.0) t = 0.0;
t = t / duration;
if (t > 1.0) t = 1.0;
t = ecore_animator_pos_map(t, ECORE_POS_MAP_SINUSOIDAL, 0.0, 0.0);
v = _target_from + ((_target_to - _target_from) * t);
if (t >= 1.0) v = _target_to;
evas_object_color_set(_fade_obj, 0, 0, 0, v);
if (v == _target_to)
{
if (_target_to == 255)
{
_apply_delay = ecore_timer_loop_add(1.0, _cb_delay_timer, NULL);
_do_apply();
}
else
{
evas_object_del(_fade_obj);
_fade_obj = NULL;
_applying = EINA_FALSE;
}
_fade_animator = NULL;
return EINA_FALSE;
}
return EINA_TRUE;
}
static void
_animated_apply(void)
{
Evas *e;
// fade out, config, wait 3 seconds, fade back in
if (_applying) return;
_applying = EINA_TRUE;
_start_time = ecore_loop_time_get();
e = e_comp->evas;
_fade_obj = evas_object_rectangle_add(e);
evas_object_pass_events_set(_fade_obj, EINA_TRUE);
evas_object_color_set(_fade_obj, 0, 0, 0, 0);
evas_object_move(_fade_obj, 0, 0);
evas_object_resize(_fade_obj, 999999, 999999);
evas_object_layer_set(_fade_obj, EVAS_LAYER_MAX);
evas_object_show(_fade_obj);
_target_from = 0;
_target_to = 255;
_fade_animator = ecore_animator_add(_cb_fade_animator, NULL);
}
static void
_do_apply(void)
{
E_Randr2 *tr = e_randr2;
// take current screen config and apply it to the driver
printf("RRR: re-get info before applying..\n");
tr = e_randr2;
e_randr2 = e_comp->screen->create();
if ((tr) && (e_randr2))
{
_randr_screen_props_copyover(tr, e_randr2);
_info_free(tr);
}
_screen_config_maxsize();
printf("RRR: apply config...\n");
_config_apply(e_randr2, e_randr2_cfg);
printf("RRR: takeover config...\n");
_screen_config_takeover();
printf("RRR: eval config...\n");
_screen_config_eval();
printf("RRR: really apply config...\n");
e_comp->screen->apply();
printf("RRR: done config...\n");
}
static void
_info_free(E_Randr2 *r)
{
E_Randr2_Screen *s;
E_Randr2_Mode *m;
if (!r) return;
// free up our randr screen data
EINA_LIST_FREE(r->screens, s)
{
free(s->id);
free(s->info.screen);
free(s->info.name);
free(s->info.edid);
EINA_LIST_FREE(s->info.modes, m) free(m);
free(s->config.relative.to);
free(s->config.profile);
free(s);
}
free(r);
}
static void
_config_upgrade(E_Config_Randr2 *cfg)
{
if (cfg->version < 2)
cfg->default_policy = E_RANDR2_POLICY_EXTEND;
if (cfg->version < 3)
cfg->hotplug_response = 1.0;
cfg->version = E_RANDR_CONFIG_VERSION;
}
static E_Config_Randr2 *
_config_load(void)
{
E_Config_Randr2 *cfg;
// load config and check if version is up to date
cfg = e_config_domain_load("e_randr2", _e_randr2_cfg_edd);
if (cfg)
{
if (cfg->version < E_RANDR_CONFIG_VERSION)
_config_upgrade(cfg);
if (cfg->hotplug_response < 0.2)
cfg->hotplug_response = 0.2;
else if (cfg->hotplug_response > 9.0)
cfg->hotplug_response = 9.0;
printf("RRR: loaded existing config\n");
return cfg;
}
// need new config
cfg = calloc(1, sizeof(E_Config_Randr2));
cfg->version = E_RANDR_CONFIG_VERSION;
cfg->screens = NULL;
cfg->restore = 1;
cfg->ignore_hotplug_events = 0;
cfg->ignore_acpi_events = 0;
cfg->default_policy = E_RANDR2_POLICY_EXTEND;
cfg->hotplug_response = 1.0;
printf("RRR: fresh config\n");
return cfg;
}
static void
_config_free(E_Config_Randr2 *cfg)
{
E_Config_Randr2_Screen *cs;
if (!cfg) return;
// free config data
EINA_LIST_FREE(cfg->screens, cs)
{
eina_stringshare_del(cs->id);
eina_stringshare_del(cs->rel_to);
eina_stringshare_del(cs->custom_label_screen);
eina_stringshare_del(cs->profile);
free(cs);
}
free(cfg);
}
static Eina_Bool
_config_save(E_Randr2 *r, E_Config_Randr2 *cfg)
{
if ((!r) || (!cfg)) return EINA_FALSE;
// save config struct to cfg file
return e_config_domain_save("e_randr2", _e_randr2_cfg_edd, cfg);
}
static Eina_Bool
_config_ask_dialog(void *data)
{
e_configure_registry_call("screen/screen_setup", NULL, data);
free(data);
return EINA_FALSE;
}
static Eina_Bool
_config_update(E_Randr2 *r, E_Config_Randr2 *cfg, Eina_Bool update_only)
{
Eina_List *l;
E_Randr2_Screen *s;
E_Config_Randr2_Screen *cs;
Eina_Bool ret = EINA_FALSE;
printf("--------------------------------------------------\n");
EINA_LIST_FOREACH(r->screens, l, s)
{
printf("RRR: out id=%s: connected=%i enabled=%i configured=%i\n",
s->id, s->info.connected,
s->config.enabled, s->config.configured);
if (!s->id) continue;
if (!s->info.connected) continue;
if (_screen_closed(s)) continue;
cs = e_randr2_config_screen_find(s, cfg);
if (cs && update_only) continue;
if (!cs)
{
cs = calloc(1, sizeof(E_Config_Randr2_Screen));
if (cs)
{
cs->id = eina_stringshare_add(s->id);
cfg->screens = eina_list_prepend(cfg->screens, cs);
}
}
if (cs)
{
if (update_only)
{
switch (cfg->default_policy)
{
case E_RANDR2_POLICY_EXTEND:
if (s->config.relative.mode < E_RANDR2_RELATIVE_TO_LEFT)
cs->rel_mode = E_RANDR2_RELATIVE_TO_RIGHT;
else
cs->rel_mode = s->config.relative.mode;
break;
case E_RANDR2_POLICY_CLONE:
cs->rel_mode = E_RANDR2_RELATIVE_CLONE;
break;
case E_RANDR2_POLICY_ASK:
if (starting)
ecore_timer_loop_add(2, _config_ask_dialog, eina_strdup(s->info.name));
else
ecore_timer_loop_add(0.01, _config_ask_dialog, eina_strdup(s->info.name));
EINA_FALLTHROUGH;
/* no break */
case E_RANDR2_POLICY_NONE:
cs->rel_mode = E_RANDR2_RELATIVE_NONE;
break;
}
}
else
cs->rel_mode = s->config.relative.mode;
if (update_only &&
((cfg->default_policy == E_RANDR2_POLICY_CLONE) ||
(cfg->default_policy == E_RANDR2_POLICY_EXTEND)))
{
E_Randr2_Mode *m = eina_list_data_get(s->info.modes);
cs->enabled = 1;
cs->mode_refresh = m->refresh;
cs->mode_w = m->w;
cs->mode_h = m->h;
if (s->config.relative.to)
cs->rel_to = eina_stringshare_add(s->config.relative.to);
else
{
/* find right-most screen */
E_Zone *zone = eina_list_last_data_get(e_comp->zones);
if (zone)
eina_stringshare_replace(&cs->rel_to, zone->randr2_id);
}
cs->rel_align = 0;
}
else
{
cs->enabled = s->config.enabled;
cs->mode_refresh = s->config.mode.refresh;
cs->mode_w = s->config.mode.w;
cs->mode_h = s->config.mode.h;
if (s->config.relative.to)
cs->rel_to = eina_stringshare_add(s->config.relative.to);
cs->rel_align = s->config.relative.align;
}
cs->rotation = s->config.rotation;
cs->priority = s->config.priority;
if (cs->profile)
{
printf("RRR: store config profile '%s'\n", cs->profile);
free(s->config.profile);
s->config.profile = strdup(cs->profile);
}
else
{
free(s->config.profile);
s->config.profile = NULL;
}
printf("RRR: store scale mul %1.5f\n", cs->scale_multiplier);
s->config.scale_multiplier = cs->scale_multiplier;
s->config.ignore_disconnect = cs->ignore_disconnect;
ret = EINA_TRUE;
}
}
printf("--------------------------------------------------\n");
return ret;
}
static void
_config_really_apply(E_Randr2_Screen *s, E_Config_Randr2_Screen *cs)
{
if (cs)
{
s->config.enabled = EINA_TRUE;
s->config.mode.w = cs->mode_w;
s->config.mode.h = cs->mode_h;
s->config.mode.refresh = cs->mode_refresh;
s->config.mode.preferred = EINA_FALSE;
printf("RRR: really apply rotation=%i\n", cs->rotation);
s->config.rotation = cs->rotation;
s->config.priority = cs->priority;
free(s->config.relative.to);
if (cs->rel_to) s->config.relative.to = strdup(cs->rel_to);
else s->config.relative.to = NULL;
s->config.relative.mode = cs->rel_mode;
s->config.relative.align = cs->rel_align;
free(s->config.profile);
if (cs->profile) s->config.profile = strdup(cs->profile);
else s->config.profile = NULL;
s->config.scale_multiplier = cs->scale_multiplier;
s->config.ignore_disconnect = cs->ignore_disconnect;
printf("RRR: really apply '%s' ignore discon %i\n", s->info.name, s->config.ignore_disconnect);
}
else
{
s->config.enabled = EINA_FALSE;
s->config.geom.x = 0;
s->config.geom.y = 0;
s->config.geom.w = 0;
s->config.geom.h = 0;
s->config.mode.w = 0;
s->config.mode.h = 0;
s->config.mode.refresh = 0.0;
s->config.mode.preferred = EINA_FALSE;
s->config.rotation = 0;
s->config.priority = 0;
free(s->config.relative.to);
s->config.relative.to = NULL;
s->config.relative.mode = E_RANDR2_RELATIVE_NONE;
s->config.relative.align = 0.0;
free(s->config.profile);
s->config.profile = NULL;
s->config.scale_multiplier = 0.0;
s->config.ignore_disconnect = EINA_FALSE;
}
}
static void
_config_apply(E_Randr2 *r, E_Config_Randr2 *cfg)
{
Eina_List *l;
E_Randr2_Screen *s;
E_Config_Randr2_Screen *cs;
if ((!r) || (!cfg)) return;
EINA_LIST_FOREACH(r->screens, l, s)
{
printf("RRR: apply '%s'...\n", s->info.name);
cs = NULL;
if ((!_screen_closed(s)) && (s->info.connected))
cs = e_randr2_config_screen_find(s, cfg);
printf("RRR: connected = %i\n", s->info.connected);
if ((cs) && (cs->enabled))
{
printf("RRR: ... enabled\n");
printf("RRR: ... priority = %i\n", cs->priority);
_config_really_apply(s, cs);
}
else
{
printf("RRR: ... disabled\n");
if (!s->config.ignore_disconnect)
_config_really_apply(s, NULL);
else
printf("RRR: ... ignore disconnected\n");
}
s->config.configured = EINA_TRUE;
}
}
static int
_config_screen_match_count(E_Randr2 *r, E_Config_Randr2 *cfg)
{
Eina_List *l, *ll;
E_Randr2_Screen *s;
E_Config_Randr2_Screen *cs;
int count = 0;
EINA_LIST_FOREACH(cfg->screens, l, cs)
{
if (!cs->id) continue;
EINA_LIST_FOREACH(r->screens, ll, s)
{
if ((!s->id) || (!s->info.connected) ||
(_screen_closed(s))) continue;
if (!strcmp(cs->id, s->id)) count++;
}
}
return count;
}
static char *
_screens_fingerprint(E_Randr2 *r)
{
Eina_List *l;
E_Randr2_Screen *s;
Eina_Strbuf *buf;
char *str;
buf = eina_strbuf_new();
if (!buf) return NULL;
EINA_LIST_FOREACH(r->screens, l, s)
{
if (!s->id) eina_strbuf_append(buf, ":NULL:");
else
{
eina_strbuf_append(buf, ":");
eina_strbuf_append(buf, s->id);
eina_strbuf_append(buf, ":");
e laptop lid fixes to bring back behavior and trim down glitches so i spent a few days lopening and closing the lids of a few laptops, plugging and unplugging external screens in, plugging and unplugging ac power and doing lots of combinations of these. this led to a whole slew of interrealted issues that were pretty hard to detangle into just single issues, so this is all one blob. this fixes: 1. if a lid close gets a monitor unplug from x or e's randr wants to unplug then this lead to slow unsuspend or lid open times as e was reconfirguring the screens entireluy on lid open. dont do that. just keep things as is, unless we have an external display, then reconfigure. 2. we had 2 systems monitoring for a wake. a poller and a systemd event. this was redundant and lead to interesting things in the debug output, so clean that up and on systemd systsems use the systemd wake events 3. some systems dont shut down their screens on lid close, so they stay open until screensaver timeouts kick in. bad. so also force the screen to go off on lid close (if the lid screen is the only one we have). 4. x seems to have a bug where if you force dpms off etc. to turn the screen on, it still thinks it's of and wont dpms off again after that until you eother give some input to have the wake event make the dpms system in x think its now time to go on, or you toggle dpms on and off, so i found toggling tricks x into thinking the right thing. this makes some debugging also be consistent with printfs. all in all i have a pretty well supported laptop doing swimmingly with e and a not so well designed (acpi dsdt - missing many events like acpi battery ones, ac power change acpi events, missing logic to power off a closed screen in firmware or hardware and leaving it to sw... not this laptop has a tocuh panel and extra fun points awarded since the touch panel doesnt shut off on lid close... AND it reprots touch events when it closes as it touches the keys/case... hooray! that has another work-around local to my system, as efl has no mechanism to do this). @fix
5 years ago
// Don't do this asbecause this forces a screen replug when you open and
// close your laptop lid and if that is the only thing you open or close...
// if (s->info.lid_closed) eina_strbuf_append(buf, ":LC:");
// else eina_strbuf_append(buf, ":LO:");
}
}
str = eina_strbuf_string_steal(buf);
eina_strbuf_free(buf);
return str;
}
static Eina_Bool
_screens_differ(E_Randr2 *r1, E_Randr2 *r2)
{
char *s1, *s2;
Eina_Bool changed = EINA_FALSE;
Eina_List *l, *ll;
E_Randr2_Screen *s, *ss;
e laptop lid fixes to bring back behavior and trim down glitches so i spent a few days lopening and closing the lids of a few laptops, plugging and unplugging external screens in, plugging and unplugging ac power and doing lots of combinations of these. this led to a whole slew of interrealted issues that were pretty hard to detangle into just single issues, so this is all one blob. this fixes: 1. if a lid close gets a monitor unplug from x or e's randr wants to unplug then this lead to slow unsuspend or lid open times as e was reconfirguring the screens entireluy on lid open. dont do that. just keep things as is, unless we have an external display, then reconfigure. 2. we had 2 systems monitoring for a wake. a poller and a systemd event. this was redundant and lead to interesting things in the debug output, so clean that up and on systemd systsems use the systemd wake events 3. some systems dont shut down their screens on lid close, so they stay open until screensaver timeouts kick in. bad. so also force the screen to go off on lid close (if the lid screen is the only one we have). 4. x seems to have a bug where if you force dpms off etc. to turn the screen on, it still thinks it's of and wont dpms off again after that until you eother give some input to have the wake event make the dpms system in x think its now time to go on, or you toggle dpms on and off, so i found toggling tricks x into thinking the right thing. this makes some debugging also be consistent with printfs. all in all i have a pretty well supported laptop doing swimmingly with e and a not so well designed (acpi dsdt - missing many events like acpi battery ones, ac power change acpi events, missing logic to power off a closed screen in firmware or hardware and leaving it to sw... not this laptop has a tocuh panel and extra fun points awarded since the touch panel doesnt shut off on lid close... AND it reprots touch events when it closes as it touches the keys/case... hooray! that has another work-around local to my system, as efl has no mechanism to do this). @fix
5 years ago
int r1_screen_num = 0, r2_screen_num = 0;
// check monitor outputs and edids, plugged in things
s1 = _screens_fingerprint(r1);
s2 = _screens_fingerprint(r2);
if ((!s1) && (!s2)) return EINA_FALSE;
printf("RRR: check fingerprint...\n");
if ((s1) && (s2) && (strcmp(s1, s2))) changed = EINA_TRUE;
printf("RRR: ... fingerprint says %i\n", changed);
free(s1);
free(s2);