aboutsummaryrefslogtreecommitdiff
path: root/bts.c
diff options
context:
space:
mode:
authorrodri <rgl@antares-labs.eu>2024-11-16 14:10:47 +0000
committerrodri <rgl@antares-labs.eu>2024-11-16 14:10:47 +0000
commit28cacde37de17e1f471b215e55d644b53881a24b (patch)
tree16d257978016261d81e400daeb0827546d79e5a6 /bts.c
parent8f1306dfeadd090819c1257d2d4c244e52f98614 (diff)
downloadbattleship-28cacde37de17e1f471b215e55d644b53881a24b.tar.gz
battleship-28cacde37de17e1f471b215e55d644b53881a24b.tar.bz2
battleship-28cacde37de17e1f471b215e55d644b53881a24b.zip
bts: fix confirmdone().
Diffstat (limited to 'bts.c')
-rw-r--r--bts.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/bts.c b/bts.c
index 8dba409..7a1d17a 100644
--- a/bts.c
+++ b/bts.c
@@ -708,15 +708,16 @@ confirmdone(Mousectl *mc)
};
csetcursor(mc, &anchor);
- readmouse(mc);
- while(mc->buttons == 0)
+ while(mc->buttons != 0) /* ignore any buttons already pressed */
+ readmouse(mc);
+ while(mc->buttons == 0) /* wait for a button press */
readmouse(mc);
if(mc->buttons != 4){
while(nbrecv(kctl->c, nil)) /* flush key presses */
csetcursor(mc, nil);
return 0;
}
- while(mc->buttons){
+ while(mc->buttons){ /* commit action on button release */
if(mc->buttons != 4){
while(nbrecv(kctl->c, nil));
csetcursor(mc, nil);