qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] fix curses interface
@ 2009-01-21 18:10 Stefano Stabellini
  2009-01-21 19:00 ` Anthony Liguori
  0 siblings, 1 reply; 2+ messages in thread
From: Stefano Stabellini @ 2009-01-21 18:10 UTC (permalink / raw)
  To: qemu-devel

Hi all,
this patch fixes the curses interface: when we switch from one console
to another we need to change the displaystate width and height even
though in the curses case the backing buffer remains of the same size.
I am also putting back the call to text_console_resize in
text_console_invalidate so that resizeable text consoles can be properly
handled.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>


diff --git a/console.c b/console.c
index 6d0c1b3..4bc16e8 100644
--- a/console.c
+++ b/console.c
@@ -1067,8 +1067,13 @@ void console_select(unsigned int index)
     if (s) {
         DisplayState *ds = s->ds;
         active_console = s;
-        ds->surface = qemu_resize_displaysurface(ds->surface, s->g_width,
-                                                s->g_height, 32, 4 * s->g_width);
+        if (ds_get_bits_per_pixel(s->ds)) {
+            ds->surface = qemu_resize_displaysurface(ds->surface, s->g_width,
+                    s->g_height, 32, 4 * s->g_width);
+        } else {
+            s->ds->surface->width = s->width;
+            s->ds->surface->height = s->height;
+        }
         dpy_resize(s->ds);
         vga_hw_invalidate();
     }
@@ -1186,6 +1191,11 @@ void kbd_put_keysym(int keysym)
 static void text_console_invalidate(void *opaque)
 {
     TextConsole *s = (TextConsole *) opaque;
+    if (!ds_get_bits_per_pixel(s->ds) && s->console_type == TEXT_CONSOLE) {
+        s->g_width = ds_get_width(s->ds);
+        s->g_height = ds_get_height(s->ds);
+        text_console_resize(s);
+    }
     console_refresh(s);
 }
 
diff --git a/curses.c b/curses.c
index b3aa011..97ab412 100644
--- a/curses.c
+++ b/curses.c
@@ -106,6 +106,8 @@ static void curses_resize(DisplayState *ds)
     gheight = ds_get_height(ds);
 
     curses_calc_pad();
+    ds->surface->width = width * FONT_WIDTH;
+    ds->surface->height = height * FONT_HEIGHT;
 }
 
 #ifndef _WIN32
@@ -367,7 +369,7 @@ void curses_display_init(DisplayState *ds, int full_screen)
     dcl->dpy_text_cursor = curses_cursor_position;
     register_displaychangelistener(ds, dcl);
     qemu_free_displaysurface(ds->surface);
-    ds->surface = qemu_create_displaysurface_from(80, 25, 0, 0, (uint8_t*) screen);
+    ds->surface = qemu_create_displaysurface_from(640, 400, 0, 0, (uint8_t*) screen);
 
     invalidate = 1;
 

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Qemu-devel] [PATCH] fix curses interface
  2009-01-21 18:10 [Qemu-devel] [PATCH] fix curses interface Stefano Stabellini
@ 2009-01-21 19:00 ` Anthony Liguori
  0 siblings, 0 replies; 2+ messages in thread
From: Anthony Liguori @ 2009-01-21 19:00 UTC (permalink / raw)
  To: qemu-devel

Stefano Stabellini wrote:
> Hi all,
> this patch fixes the curses interface: when we switch from one console
> to another we need to change the displaystate width and height even
> though in the curses case the backing buffer remains of the same size.
> I am also putting back the call to text_console_resize in
> text_console_invalidate so that resizeable text consoles can be properly
> handled.
>   

Applied.  Thanks.

Regards,

Anthony Liguori

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-01-21 19:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-21 18:10 [Qemu-devel] [PATCH] fix curses interface Stefano Stabellini
2009-01-21 19:00 ` Anthony Liguori

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).