Turn off screen and backlight on state change only.

This commit is contained in:
ikolokolnikov committed 2026-09-26 19:26:28 -07:00
1 parent c771e2d2e6
commit c47f7668df
1 file changed
+14 -8
+14 -8
View File
@@ -734,7 +734,8 @@ readpw(struct arena *arena,
{ {
XRRScreenChangeNotifyEvent *rre; XRRScreenChangeNotifyEvent *rre;
char buf[32], passwd[256], *inputhash; char buf[32], passwd[256], *inputhash;
int num, screen, running, failure, locked, oldc, i, passing, dson, tfd, xfd; int num, screen, running, failure, locked, oldc, i, passing,
dson, dson_saved, tfd, xfd;
unsigned int len, color; unsigned int len, color;
struct timeval tv; struct timeval tv;
KeySym ksym; KeySym ksym;
@@ -751,7 +752,9 @@ readpw(struct arena *arena,
failure = 0; failure = 0;
locked = 1; locked = 1;
oldc = INIT; oldc = INIT;
dson = 1;
dson = 1;
dson_saved = 1;
xfd = ConnectionNumber(dpy); xfd = ConnectionNumber(dpy);
tfd = timerfd_create(CLOCK_REALTIME, 0); tfd = timerfd_create(CLOCK_REALTIME, 0);
@@ -905,13 +908,16 @@ readpw(struct arena *arena,
} }
} }
if(dson) { if(dson_saved != dson) {
reset_keyboard_backlight(bl_state); if(dson) {
set_screen_on(dpy); reset_keyboard_backlight(bl_state);
} else { set_screen_on(dpy);
set_keyboard_backlight_off(bl_state); } else {
set_screen_off(dpy); set_keyboard_backlight_off(bl_state);
set_screen_off(dpy);
}
} }
dson_saved = dson;
render_screen(arena, render_screen(arena,
dpy, locks, dpy, locks,