aboutsummaryrefslogtreecommitdiff
path: root/monitor.c
diff options
context:
space:
mode:
Diffstat (limited to 'monitor.c')
-rw-r--r--monitor.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/monitor.c b/monitor.c
index 10562d5..a6d2ea9 100644
--- a/monitor.c
+++ b/monitor.c
@@ -2722,12 +2722,19 @@ void monitor_readline(const char *prompt, int is_password,
char *buf, int buf_size)
{
int i;
+ int old_focus[MAX_MON];
if (is_password) {
- for (i = 0; i < MAX_MON; i++)
- if (monitor_hd[i] && monitor_hd[i]->focus == 0)
+ for (i = 0; i < MAX_MON; i++) {
+ old_focus[i] = 0;
+ if (monitor_hd[i]) {
+ old_focus[i] = monitor_hd[i]->focus;
+ monitor_hd[i]->focus = 0;
qemu_chr_send_event(monitor_hd[i], CHR_EVENT_FOCUS);
+ }
+ }
}
+
readline_start(prompt, is_password, monitor_readline_cb, NULL);
monitor_readline_buf = buf;
monitor_readline_buf_size = buf_size;
@@ -2735,4 +2742,10 @@ void monitor_readline(const char *prompt, int is_password,
while (monitor_readline_started) {
main_loop_wait(10);
}
+ /* restore original focus */
+ if (is_password) {
+ for (i = 0; i < MAX_MON; i++)
+ if (old_focus[i])
+ monitor_hd[i]->focus = old_focus[i];
+ }
}