From 60258cb82bc94eeebe8893e343d212414bd6a338 Mon Sep 17 00:00:00 2001 From: Igor Kolokolnikov Date: Thu, 17 Sep 2026 10:42:17 -0700 Subject: [PATCH] Added password status. --- Makefile | 3 ++- slock.c | 10 +++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index ed2378f..50ef0b5 100644 --- a/Makefile +++ b/Makefile @@ -56,7 +56,8 @@ ifeq ($(OS),OS_MACOS) LIBS = FRAMEWORKS = else ifeq ($(OS),OS_LINUX) - FLAGS = -O3 # -ggdb -DDEBUG=1 -DINTERNAL=1 + # FLAGS = -ggdb -DDEBUG=1 -DINTERNAL=1 + FLAGS = -O3 INCLUDE = -I/usr/include -I/usr/X11R6/include \ -I./libs/include/freetype2 LIBS = -lc -lcrypt -lX11 -lXext -lXrandr \ diff --git a/slock.c b/slock.c index e3d19e2..583d9e1 100644 --- a/slock.c +++ b/slock.c @@ -486,7 +486,7 @@ static void render_screen(struct arena *arena, Display *dpy, struct lock **locks, FT_Face main_font_face, FT_Face secondary_font_face, - unsigned int pass_len) + unsigned int pass_len, int failure) { XWindowAttributes attrs; if(XGetWindowAttributes(dpy, locks[0]->win, &attrs)) { @@ -532,7 +532,10 @@ render_screen(struct arena *arena, message_str_len = 32; message_str = (char *)arena_alloc(&temp_arena, message_str_len); - memset(message_str, 0, message_str_len); + if(failure) + memcpy(message_str, "wrong password", 15); + else + memcpy(message_str, "locked", 7); if(pass_len > 0) { unsigned int i; @@ -753,6 +756,7 @@ readpw(struct arena *arena, case XK_Escape: explicit_bzero(&passwd, sizeof(passwd)); len = 0; + failure = 0; break; case XK_BackSpace: if (len) @@ -803,7 +807,7 @@ readpw(struct arena *arena, render_screen(arena, dpy, locks, fonts.main_face, fonts.secondary_face, - len); + len, failure); if(millis() - rendering_timeout_millis >= 500) { needs_rendering = 0;