aboutsummaryrefslogtreecommitdiffstats
path: root/curses.c
diff options
context:
space:
mode:
authorDavid 'Digit' Turner <digit@google.com>2009-09-14 14:32:27 -0700
committerDavid 'Digit' Turner <digit@google.com>2009-09-14 14:32:27 -0700
commit5d8f37ad78fc66901af50c762029a501561f3b23 (patch)
tree206790f8f21000850a98c4f9590a79e779106278 /curses.c
parentcd059b15f2c7df69f4a087bd66900eb172e41d1c (diff)
downloadexternal_qemu-5d8f37ad78fc66901af50c762029a501561f3b23.zip
external_qemu-5d8f37ad78fc66901af50c762029a501561f3b23.tar.gz
external_qemu-5d8f37ad78fc66901af50c762029a501561f3b23.tar.bz2
Merge upstream QEMU 10.0.50 into the Android source tree.
This change integrates many changes from the upstream QEMU sources. Its main purpose is to enable correct ARMv6 and ARMv7 support to the Android emulator. Due to the nature of the upstream code base, this unfortunately also required changes to many other parts of the source. Note that to ensure easier integrations in the future, some source files and directories that have heavy Android-specific customization have been renamed with an -android suffix. The original files are still there for easier integration tracking, but *never* compiled. For example: net.c net-android.c qemu-char.c qemu-char-android.c slirp/ slirp-android/ etc... Tested on linux-x86, darwin-x86 and windows host machines.
Diffstat (limited to 'curses.c')
-rw-r--r--curses.c52
1 files changed, 26 insertions, 26 deletions
diff --git a/curses.c b/curses.c
index 96b6e49..8aae818 100644
--- a/curses.c
+++ b/curses.c
@@ -21,11 +21,6 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-
-#include "qemu-common.h"
-#include "console.h"
-#include "sysemu.h"
-
#include <curses.h>
#ifndef _WIN32
@@ -38,6 +33,10 @@
#define resize_term resizeterm
#endif
+#include "qemu-common.h"
+#include "console.h"
+#include "sysemu.h"
+
#define FONT_HEIGHT 16
#define FONT_WIDTH 8
@@ -60,7 +59,7 @@ static void curses_update(DisplayState *ds, int x, int y, int w, int h)
static void curses_calc_pad(void)
{
- if (is_graphic_console()) {
+ if (is_fixedsize_console()) {
width = gwidth;
height = gheight;
} else {
@@ -97,15 +96,17 @@ static void curses_calc_pad(void)
}
}
-static void curses_resize(DisplayState *ds, int w, int h)
+static void curses_resize(DisplayState *ds)
{
- if (w == gwidth && h == gheight)
+ if (ds_get_width(ds) == gwidth && ds_get_height(ds) == gheight)
return;
- gwidth = w;
- gheight = h;
+ gwidth = ds_get_width(ds);
+ gheight = ds_get_height(ds);
curses_calc_pad();
+ ds->surface->width = width * FONT_WIDTH;
+ ds->surface->height = height * FONT_HEIGHT;
}
#ifndef _WIN32
@@ -156,7 +157,6 @@ static void curses_cursor_position(DisplayState *ds, int x, int y)
/* generic keyboard conversion */
#include "curses_keys.h"
-#include "keymaps.c"
static kbd_layout_t *kbd_layout = 0;
static int keycode2keysym[CURSES_KEYS];
@@ -169,8 +169,8 @@ static void curses_refresh(DisplayState *ds)
clear();
refresh();
curses_calc_pad();
- ds->width = FONT_WIDTH * width;
- ds->height = FONT_HEIGHT * height;
+ ds->surface->width = FONT_WIDTH * width;
+ ds->surface->height = FONT_HEIGHT * height;
vga_hw_invalidate();
invalidate = 0;
}
@@ -197,8 +197,8 @@ static void curses_refresh(DisplayState *ds)
refresh();
curses_calc_pad();
curses_update(ds, 0, 0, width, height);
- ds->width = FONT_WIDTH * width;
- ds->height = FONT_HEIGHT * height;
+ ds->surface->width = FONT_WIDTH * width;
+ ds->surface->height = FONT_HEIGHT * height;
continue;
}
#endif
@@ -309,7 +309,7 @@ static void curses_keyboard_setup(void)
keyboard_layout = "en-us";
#endif
if(keyboard_layout) {
- kbd_layout = init_keyboard_layout(keyboard_layout);
+ kbd_layout = init_keyboard_layout(name2keysym, keyboard_layout);
if (!kbd_layout)
exit(1);
}
@@ -338,6 +338,7 @@ static void curses_keyboard_setup(void)
void curses_display_init(DisplayState *ds, int full_screen)
{
+ DisplayChangeListener *dcl;
#ifndef _WIN32
if (!isatty(1)) {
fprintf(stderr, "We need a terminal output\n");
@@ -357,18 +358,17 @@ void curses_display_init(DisplayState *ds, int full_screen)
#endif
#endif
- ds->data = (void *) screen;
- ds->linesize = 0;
- ds->depth = 0;
- ds->width = 640;
- ds->height = 400;
- ds->dpy_update = curses_update;
- ds->dpy_resize = curses_resize;
- ds->dpy_refresh = curses_refresh;
- ds->dpy_text_cursor = curses_cursor_position;
+ dcl = (DisplayChangeListener *) qemu_mallocz(sizeof(DisplayChangeListener));
+ dcl->dpy_update = curses_update;
+ dcl->dpy_resize = curses_resize;
+ dcl->dpy_refresh = curses_refresh;
+ dcl->dpy_text_cursor = curses_cursor_position;
+ register_displaychangelistener(ds, dcl);
+ qemu_free_displaysurface(ds);
+ ds->surface = qemu_create_displaysurface_from(640, 400, 0, 0, (uint8_t*) screen);
invalidate = 1;
/* Standard VGA initial text mode dimensions */
- curses_resize(ds, 80, 25);
+ curses_resize(ds);
}