9front - general discussion about 9front
 help / color / mirror / Atom feed
From: Stuart Morrow <morrow.stuart@gmail.com>
To: 9front@9front.org
Subject: [9front] screenlock
Date: Sun, 18 Jul 2021 17:04:48 +0100	[thread overview]
Message-ID: <CABB-WO_z5fmN2zpyyLMdW1Visgs_15FcShv5Wsj_vVkZUuYvhQ@mail.gmail.com> (raw)

Would like to get this in before release as it all-but-fixes the
horrible visual bug of the green border.

String becomes stringbg so we have guaranteed max contrast in case the
user changes the picture. (If you don't change the picture, it's
white-on-black-on-black (sic) and you would never notice the change.)

(Still puzzled and bothered by the getwindow'ing version.)

--- /mnt/git/object/be36c092ac061a04065720e98e5849130487be7f/tree/sys/src/cmd/screenlock.c
+++ sys/src/cmd/screenlock.c
@@ -119,14 +119,17 @@
 void
 top(void*)
 {
-	int fd;
+	int fd, n;
+	char buf[128];

-	if((fd = open("/dev/wctl", OWRITE)) < 0)
+	if((fd = open("/dev/wctl", ORDWR)) < 0)
 		return;

 	for(;;){
-		write(fd, "current", 7);
-		sleep(500);
+		n = read(fd, buf, sizeof buf);
+		if(n > 48)
+			if(strstr(buf+48, "notcurrent"))
+				write(fd, "current", 7);
 	}
 }

@@ -186,7 +189,7 @@
 		tm = localtime(time(&blank));
 		s = smprint("user %s at %d:%02.2d", getuser(), tm->hour, tm->min);
 		p = subpt(p, Pt(stringwidth(font, "m") * strlen(s) / 2, 0));
-		string(screen, p, screen->display->white, ZP, font, s);
+		stringbg(screen, p, display->white, ZP, font, s, display->black, ZP);
 	}
 	flushimage(display, 1);

             reply	other threads:[~2021-07-19  9:10 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-18 16:04 Stuart Morrow [this message]
2021-07-18 17:45 ` cinap_lenrek
2021-07-18 19:31   ` Stuart Morrow
2021-07-18 20:23     ` cinap_lenrek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CABB-WO_z5fmN2zpyyLMdW1Visgs_15FcShv5Wsj_vVkZUuYvhQ@mail.gmail.com \
    --to=morrow.stuart@gmail.com \
    --cc=9front@9front.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).