Commit 6fcfafb742459e29e29fd61ed174108064643915

Authored by bellard
1 parent af8ffdfd

console focus support


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1032 c046a42c-6fe2-441c-8c8c-71466251a162
Showing 1 changed file with 17 additions and 0 deletions
console.c
... ... @@ -599,6 +599,21 @@ static void console_chr_add_read_handler(CharDriverState *chr,
599 599 s->fd_opaque = opaque;
600 600 }
601 601  
  602 +static void console_send_event(CharDriverState *chr, int event)
  603 +{
  604 + TextConsole *s = chr->opaque;
  605 + int i;
  606 +
  607 + if (event == CHR_EVENT_FOCUS) {
  608 + for(i = 0; i < nb_consoles; i++) {
  609 + if (consoles[i] == s) {
  610 + console_select(i);
  611 + break;
  612 + }
  613 + }
  614 + }
  615 +}
  616 +
602 617 /* called when an ascii key is pressed */
603 618 void kbd_put_keysym(int keysym)
604 619 {
... ... @@ -689,6 +704,8 @@ CharDriverState *text_console_init(DisplayState *ds)
689 704 chr->opaque = s;
690 705 chr->chr_write = console_puts;
691 706 chr->chr_add_read_handler = console_chr_add_read_handler;
  707 + chr->chr_send_event = console_send_event;
  708 +
692 709 if (!color_inited) {
693 710 color_inited = 1;
694 711 for(i = 0; i < 8; i++) {
... ...