diff options
author | aliguori <aliguori@c046a42c-6fe2-441c-8c8c-71466251a162> | 2008-08-01 15:12:34 +0000 |
---|---|---|
committer | aliguori <aliguori@c046a42c-6fe2-441c-8c8c-71466251a162> | 2008-08-01 15:12:34 +0000 |
commit | bc0129d97804615fbcf3281fe30361ab8aa8f4ab (patch) | |
tree | 4a95887937dbaa33886e0cc42058bffec4c302d3 /monitor.c | |
parent | e94f3a609eb96471af2e4122ddfa1384b93b4ba8 (diff) |
Set focus to monitor to ask password if line is multiplexed (Laurent Vivier)
This patch allows to display the "Password:" prompt if we use encrypted
disk with "-nographic" option.
It also modifies management of "-nographic" to not override user's
choices for "-serial", "-parallel" and "-monitor".
When qemu has to ask a password with "-nographic" with a multiplexed
serial interface, it forces the focus to the monitor and restore
original focus after.
Signed-off-by: Laurent Vivier <Laurent.Vivier@bull.net>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4979 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'monitor.c')
-rw-r--r-- | monitor.c | 17 |
1 files changed, 15 insertions, 2 deletions
@@ -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]; + } } |