summaryrefslogtreecommitdiffstats
path: root/misplays.c
diff options
context:
space:
mode:
Diffstat (limited to 'misplays.c')
-rw-r--r--misplays.c29
1 files changed, 21 insertions, 8 deletions
diff --git a/misplays.c b/misplays.c
index a2535c3..3e3ae20 100644
--- a/misplays.c
+++ b/misplays.c
@@ -193,10 +193,12 @@ static void info_update(struct thread *th, PANEL *pan) {
disasm(th, pan);
}
-static void wait_all_threads(struct list *processes) {
+static int wait_all_threads(struct list *processes) {
+ int action = 0;
for (struct process *proc = processes->head; proc != processes->end; proc = proc->next) {
- dbg_sync(proc);
+ action |= dbg_sync(proc);
}
+ return action;
}
static void layout(struct list *processes, struct thread *th) {
@@ -286,14 +288,11 @@ int main(int argc, char **argv) {
int quit = 0;
int mode = 0;
+ int dirty = 1;
+ int pressed = 0;
while (!quit) {
- wait_all_threads(&processes);
- layout(&processes, th);
- console_update(&cons, right);
- info_update(th, left);
- cursupdate();
-
int ch = getch();
+ pressed = 1;
if (mode == 0) {
switch (ch) {
@@ -406,6 +405,9 @@ int main(int argc, char **argv) {
b->enabled = en;
b->tid = tid;
break;
+ case ERR:
+ pressed = 0;
+ break;
}
} else {
switch (ch) {
@@ -417,12 +419,23 @@ int main(int argc, char **argv) {
console_leave(&cons, right);
break;
case ERR:
+ pressed = 0;
break;
default:
console_input(&cons, ch);
break;
}
}
+
+ dirty |= wait_all_threads(&processes);
+ dirty |= console_update(&cons, right);
+
+ if (dirty || pressed) {
+ layout(&processes, th);
+ info_update(th, left);
+ cursupdate();
+ dirty = 0;
+ }
}
for (struct process *p = processes.head; p != processes.end; p = p->next) {