summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2020-06-10 12:34:21 +0000
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2020-06-10 12:34:21 +0000
commited1d9ea62c0a724344722842bc0d859145506fe3 (patch)
tree73980ae2b7c4cbe6474bba7bce95cf6f04be1037 /src
parent80f92ee486dd98ec3b72a1ab3d77f7472f35323e (diff)
e backlight - fix initial restore of backlight after previous fix
no edid fix broke initial restore. fix it.
Diffstat (limited to 'src')
-rw-r--r--src/bin/e_backlight.c31
1 files changed, 24 insertions, 7 deletions
diff --git a/src/bin/e_backlight.c b/src/bin/e_backlight.c
index fd6bce157..d2f9964a8 100644
--- a/src/bin/e_backlight.c
+++ b/src/bin/e_backlight.c
@@ -130,7 +130,7 @@ _backlight_devices_zone_device_find(E_Zone *zone)
130 const char *out, *edid, *id; 130 const char *out, *edid, *id;
131 131
132 id = zone->randr2_id; 132 id = zone->randr2_id;
133 if (!id) id = "xxx/yyy"; 133 if (!id) id = "/";
134 tmp = strdup(zone->randr2_id); 134 tmp = strdup(zone->randr2_id);
135 if (!tmp) return NULL; 135 if (!tmp) return NULL;
136 sep = strchr(tmp, '/'); 136 sep = strchr(tmp, '/');
@@ -262,8 +262,21 @@ _backlight_devices_device_zone_get(Backlight_Device *bd)
262 snprintf(buf, sizeof(buf), "%s/%s", bd->output? bd->output: "", bd->edid ? bd->edid : ""); 262 snprintf(buf, sizeof(buf), "%s/%s", bd->output? bd->output: "", bd->edid ? bd->edid : "");
263 EINA_LIST_FOREACH(e_comp->zones, l, zone) 263 EINA_LIST_FOREACH(e_comp->zones, l, zone)
264 { 264 {
265 if (!zone->randr2_id) continue; 265 const char *id = zone->randr2_id;
266 if (!strcmp(zone->randr2_id, buf)) return zone; 266 fprintf(stderr, "look at %p %s\n", zone, id);
267 if (!id)
268 {
269 const char *id2 = bd->edid;
270 if (!id2) id2 = "";
271 id = "";
272 fprintf(stderr, "cmp1 [%s] == [%s]\n", id, id2);
273 if (!strcmp(id, id2)) return zone;
274 }
275 else
276 {
277 fprintf(stderr, "cmp2 [%s] == [%s]\n", id, buf);
278 if (!strcmp(id, buf)) return zone;
279 }
267 } 280 }
268 return NULL; 281 return NULL;
269} 282}
@@ -351,7 +364,7 @@ _backlight_devices_screen_edid_get(const char *edid)
351 EINA_LIST_FOREACH(e_randr2->screens, l, sc) 364 EINA_LIST_FOREACH(e_randr2->screens, l, sc)
352 { 365 {
353 id = sc->info.edid; 366 id = sc->info.edid;
354 if (!id) id = "xxx"; 367 if (!id) id = "";
355 if (!strncmp(id, edid, strlen(edid))) return sc; 368 if (!strncmp(id, edid, strlen(edid))) return sc;
356 } 369 }
357 return NULL; 370 return NULL;
@@ -380,7 +393,7 @@ _backlight_devices_lid_register(const char *dev, Eina_Bool force)
380 393
381 if (!sc) return; 394 if (!sc) return;
382 id = sc->info.edid; 395 id = sc->info.edid;
383 if (!id) id = "xxx"; 396 if (!id) id = "";
384 bd = _backlight_devices_edid_find(id); 397 bd = _backlight_devices_edid_find(id);
385 if (!bd) 398 if (!bd)
386 { 399 {
@@ -426,7 +439,7 @@ _backlight_devices_edid_register(const char *dev, const char *edid)
426 bd = calloc(1, sizeof(Backlight_Device)); 439 bd = calloc(1, sizeof(Backlight_Device));
427 if (!bd) return; 440 if (!bd) return;
428 id = sc->info.edid; 441 id = sc->info.edid;
429 if (!id) id = "xxx"; 442 if (!id) id = "";
430 bd->edid = eina_stringshare_add(id); 443 bd->edid = eina_stringshare_add(id);
431 bd->output = eina_stringshare_add(sc->info.name); 444 bd->output = eina_stringshare_add(sc->info.name);
432 _devices = eina_list_append(_devices, bd); 445 _devices = eina_list_append(_devices, bd);
@@ -538,6 +551,7 @@ _backlight_devices_probe(Eina_Bool initial)
538 Ecore_X_Window root = e_comp->root; 551 Ecore_X_Window root = e_comp->root;
539 Ecore_X_Randr_Output *out; 552 Ecore_X_Randr_Output *out;
540 int i, num = 0; 553 int i, num = 0;
554 Eina_Bool found = EINA_FALSE;
541 555
542 bl_devs = eina_list_append(bl_devs, eina_stringshare_add("randr")); 556 bl_devs = eina_list_append(bl_devs, eina_stringshare_add("randr"));
543 out = ecore_x_randr_window_outputs_get(root, &num); 557 out = ecore_x_randr_window_outputs_get(root, &num);
@@ -561,6 +575,7 @@ _backlight_devices_probe(Eina_Bool initial)
561 bd->output = eina_stringshare_add(name); 575 bd->output = eina_stringshare_add(name);
562 bd->edid = edid_str; 576 bd->edid = edid_str;
563 _devices = eina_list_append(_devices, bd); 577 _devices = eina_list_append(_devices, bd);
578 found = EINA_TRUE;
564 } 579 }
565 else free(bd); 580 else free(bd);
566 } 581 }
@@ -569,6 +584,8 @@ _backlight_devices_probe(Eina_Bool initial)
569 } 584 }
570 } 585 }
571 free(out); 586 free(out);
587 if (found)
588 e_backlight_level_set(NULL, e_config->backlight.normal, -1.0);
572 } 589 }
573 } 590 }
574#endif 591#endif
@@ -713,9 +730,9 @@ e_backlight_level_set(E_Zone *zone, double val, double tim)
713 730
714 E_FREE_FUNC(bd->retry_timer, ecore_timer_del); 731 E_FREE_FUNC(bd->retry_timer, ecore_timer_del);
715 E_FREE_FUNC(bd->anim, ecore_animator_del); 732 E_FREE_FUNC(bd->anim, ecore_animator_del);
716 bd->anim = ecore_animator_timeline_add(tim, _bl_anim, bd);
717 bd->from_val = bl_now; 733 bd->from_val = bl_now;
718 bd->to_val = val; 734 bd->to_val = val;
735 bd->anim = ecore_animator_timeline_add(tim, _bl_anim, bd);
719} 736}
720 737
721E_API double 738E_API double