Skip to content

Commit

Permalink
Avoid putting same key twice in case a monitor is connected through d…
Browse files Browse the repository at this point in the history
…ifferent connections. Refs #69.
  • Loading branch information
FedeDP committed Mar 11, 2021
1 parent adb439b commit 9238a96
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/modules/backlight.c
Original file line number Diff line number Diff line change
Expand Up @@ -607,6 +607,14 @@ static int method_setallbrightness(sd_bus_message *m, void *userdata, sd_bus_err
map_clear(running_clients);
add_backlight_sn(target_pct, is_smooth, smooth_step, smooth_wait, verse, backlight_interface, 1);
DDCUTIL_LOOP({
/*
* In case same monitor happens multiple times
* (ie: it is connected to eg: hdmpi and DisplayPort)
* skip it!
*/
if (map_has_key(running_clients, id)) {
continue;
}
add_backlight_sn(target_pct, is_smooth, smooth_step, smooth_wait, verse, id, 0);
smooth_client *sc = map_get(running_clients, id);
if (sc) {
Expand Down

0 comments on commit 9238a96

Please sign in to comment.