Revision c78f7137 ui/console.c

b/ui/console.c
664 664
            }
665 665
        }
666 666
        console_show_cursor(s, 1);
667
        dpy_gfx_update(s->ds, 0, 0, ds_get_width(s->ds), ds_get_height(s->ds));
667
        dpy_gfx_update(s, 0, 0, ds_get_width(s->ds), ds_get_height(s->ds));
668 668
    }
669 669
}
670 670

  
......
1101 1101
        if (ds->have_gfx) {
1102 1102
            DisplaySurface *surface;
1103 1103
            surface = qemu_create_displaysurface(s->g_width, s->g_height);
1104
            dpy_gfx_replace_surface(ds, surface);
1104
            dpy_gfx_replace_surface(s, surface);
1105 1105
        }
1106 1106
        if (ds->have_text) {
1107
            dpy_text_resize(ds, s->width, s->height);
1107
            dpy_text_resize(s, s->width, s->height);
1108 1108
        }
1109 1109
        if (s->cursor_timer) {
1110 1110
            qemu_mod_timer(s->cursor_timer,
......
1129 1129
    }
1130 1130
    console_show_cursor(s, 1);
1131 1131
    if (s->ds->have_gfx && s->update_x0 < s->update_x1) {
1132
        dpy_gfx_update(s->ds, s->update_x0, s->update_y0,
1132
        dpy_gfx_update(s, s->update_x0, s->update_y0,
1133 1133
                       s->update_x1 - s->update_x0,
1134 1134
                       s->update_y1 - s->update_y0);
1135 1135
    }
......
1239 1239
                                (s->cells[src].t_attrib.fgcol << 12) |
1240 1240
                                (s->cells[src].t_attrib.bgcol << 8) |
1241 1241
                                (s->cells[src].t_attrib.bold << 21));
1242
        dpy_text_update(s->ds, s->text_x[0], s->text_y[0],
1242
        dpy_text_update(s, s->text_x[0], s->text_y[0],
1243 1243
                        s->text_x[1] - s->text_x[0], i - s->text_y[0]);
1244 1244
        s->text_x[0] = s->width;
1245 1245
        s->text_y[0] = s->height;
......
1247 1247
        s->text_y[1] = 0;
1248 1248
    }
1249 1249
    if (s->cursor_invalidate) {
1250
        dpy_text_cursor(s->ds, s->x, s->y);
1250
        dpy_text_cursor(s, s->x, s->y);
1251 1251
        s->cursor_invalidate = 0;
1252 1252
    }
1253 1253
}
1254 1254

  
1255
static QemuConsole *get_graphic_console(DisplayState *ds)
1256
{
1257
    int i;
1258
    QemuConsole *s;
1259
    for (i = 0; i < nb_consoles; i++) {
1260
        s = consoles[i];
1261
        if (s->console_type == GRAPHIC_CONSOLE && s->ds == ds)
1262
            return s;
1263
    }
1264
    return NULL;
1265
}
1266

  
1267 1255
static QemuConsole *new_console(DisplayState *ds, console_type_t console_type)
1268 1256
{
1269 1257
    QemuConsole *s;
......
1385 1373
    gui_setup_refresh(ds);
1386 1374
}
1387 1375

  
1388
void dpy_gfx_update(DisplayState *s, int x, int y, int w, int h)
1376
void dpy_gfx_update(QemuConsole *con, int x, int y, int w, int h)
1389 1377
{
1378
    DisplayState *s = con->ds;
1390 1379
    struct DisplayChangeListener *dcl;
1391 1380
    int width = pixman_image_get_width(s->surface->image);
1392 1381
    int height = pixman_image_get_height(s->surface->image);
......
1405 1394
    }
1406 1395
}
1407 1396

  
1408
void dpy_gfx_replace_surface(DisplayState *s,
1397
void dpy_gfx_replace_surface(QemuConsole *con,
1409 1398
                             DisplaySurface *surface)
1410 1399
{
1400
    DisplayState *s = con->ds;
1411 1401
    DisplaySurface *old_surface = s->surface;
1412 1402
    struct DisplayChangeListener *dcl;
1413 1403

  
......
1430 1420
    }
1431 1421
}
1432 1422

  
1433
void dpy_gfx_copy(struct DisplayState *s, int src_x, int src_y,
1434
                             int dst_x, int dst_y, int w, int h)
1423
void dpy_gfx_copy(QemuConsole *con, int src_x, int src_y,
1424
                  int dst_x, int dst_y, int w, int h)
1435 1425
{
1426
    DisplayState *s = con->ds;
1436 1427
    struct DisplayChangeListener *dcl;
1437 1428
    QLIST_FOREACH(dcl, &s->listeners, next) {
1438 1429
        if (dcl->ops->dpy_gfx_copy) {
......
1443 1434
    }
1444 1435
}
1445 1436

  
1446
void dpy_text_cursor(struct DisplayState *s, int x, int y)
1437
void dpy_text_cursor(QemuConsole *con, int x, int y)
1447 1438
{
1439
    DisplayState *s = con->ds;
1448 1440
    struct DisplayChangeListener *dcl;
1449 1441
    QLIST_FOREACH(dcl, &s->listeners, next) {
1450 1442
        if (dcl->ops->dpy_text_cursor) {
......
1453 1445
    }
1454 1446
}
1455 1447

  
1456
void dpy_text_update(DisplayState *s, int x, int y, int w, int h)
1448
void dpy_text_update(QemuConsole *con, int x, int y, int w, int h)
1457 1449
{
1450
    DisplayState *s = con->ds;
1458 1451
    struct DisplayChangeListener *dcl;
1459 1452
    QLIST_FOREACH(dcl, &s->listeners, next) {
1460 1453
        if (dcl->ops->dpy_text_update) {
......
1463 1456
    }
1464 1457
}
1465 1458

  
1466
void dpy_text_resize(DisplayState *s, int w, int h)
1459
void dpy_text_resize(QemuConsole *con, int w, int h)
1467 1460
{
1461
    DisplayState *s = con->ds;
1468 1462
    struct DisplayChangeListener *dcl;
1469 1463
    QLIST_FOREACH(dcl, &s->listeners, next) {
1470 1464
        if (dcl->ops->dpy_text_resize) {
......
1473 1467
    }
1474 1468
}
1475 1469

  
1476
void dpy_mouse_set(struct DisplayState *s, int x, int y, int on)
1470
void dpy_mouse_set(QemuConsole *con, int x, int y, int on)
1477 1471
{
1472
    DisplayState *s = con->ds;
1478 1473
    struct DisplayChangeListener *dcl;
1479 1474
    QLIST_FOREACH(dcl, &s->listeners, next) {
1480 1475
        if (dcl->ops->dpy_mouse_set) {
......
1483 1478
    }
1484 1479
}
1485 1480

  
1486
void dpy_cursor_define(struct DisplayState *s, QEMUCursor *cursor)
1481
void dpy_cursor_define(QemuConsole *con, QEMUCursor *cursor)
1487 1482
{
1483
    DisplayState *s = con->ds;
1488 1484
    struct DisplayChangeListener *dcl;
1489 1485
    QLIST_FOREACH(dcl, &s->listeners, next) {
1490 1486
        if (dcl->ops->dpy_cursor_define) {
......
1493 1489
    }
1494 1490
}
1495 1491

  
1496
bool dpy_cursor_define_supported(struct DisplayState *s)
1492
bool dpy_cursor_define_supported(QemuConsole *con)
1497 1493
{
1494
    DisplayState *s = con->ds;
1498 1495
    struct DisplayChangeListener *dcl;
1499 1496
    QLIST_FOREACH(dcl, &s->listeners, next) {
1500 1497
        if (dcl->ops->dpy_cursor_define) {
......
1507 1504
static void dumb_display_init(void)
1508 1505
{
1509 1506
    DisplayState *ds = g_malloc0(sizeof(DisplayState));
1510
    DisplaySurface *surface;
1511 1507
    int width = 640;
1512 1508
    int height = 480;
1513 1509

  
......
1515 1511
        width = active_console->g_width;
1516 1512
        height = active_console->g_height;
1517 1513
    }
1518
    surface = qemu_create_displaysurface(width, height);
1519
    dpy_gfx_replace_surface(ds, surface);
1514
    ds->surface = qemu_create_displaysurface(width, height);
1520 1515

  
1521 1516
    register_displaystate(ds);
1522 1517
}
......
1542 1537
    return display_state;
1543 1538
}
1544 1539

  
1545
DisplayState *graphic_console_init(vga_hw_update_ptr update,
1546
                                   vga_hw_invalidate_ptr invalidate,
1547
                                   vga_hw_screen_dump_ptr screen_dump,
1548
                                   vga_hw_text_update_ptr text_update,
1549
                                   void *opaque)
1540
QemuConsole *graphic_console_init(vga_hw_update_ptr update,
1541
                                  vga_hw_invalidate_ptr invalidate,
1542
                                  vga_hw_screen_dump_ptr screen_dump,
1543
                                  vga_hw_text_update_ptr text_update,
1544
                                  void *opaque)
1550 1545
{
1551 1546
    QemuConsole *s;
1552 1547
    DisplayState *ds;
1553
    DisplaySurface *surface;
1554 1548

  
1555 1549
    ds = (DisplayState *) g_malloc0(sizeof(DisplayState));
1556 1550
    s = new_console(ds, GRAPHIC_CONSOLE);
......
1560 1554
    s->hw_text_update = text_update;
1561 1555
    s->hw = opaque;
1562 1556

  
1563
    surface = qemu_create_displaysurface(640, 480);
1564
    dpy_gfx_replace_surface(ds, surface);
1557
    ds->surface = qemu_create_displaysurface(640, 480);
1565 1558

  
1566 1559
    register_displaystate(ds);
1567
    return ds;
1560
    return s;
1568 1561
}
1569 1562

  
1570 1563
int is_graphic_console(void)
......
1730 1723
    }
1731 1724
}
1732 1725

  
1733
void qemu_console_resize(DisplayState *ds, int width, int height)
1726
void qemu_console_resize(QemuConsole *s, int width, int height)
1734 1727
{
1735
    QemuConsole *s = get_graphic_console(ds);
1736
    if (!s) return;
1737

  
1738 1728
    s->g_width = width;
1739 1729
    s->g_height = height;
1740 1730
    if (is_graphic_console()) {
1741 1731
        DisplaySurface *surface;
1742 1732
        surface = qemu_create_displaysurface(width, height);
1743
        dpy_gfx_replace_surface(ds, surface);
1733
        dpy_gfx_replace_surface(s, surface);
1744 1734
    }
1745 1735
}
1746 1736

  
1747
void qemu_console_copy(DisplayState *ds, int src_x, int src_y,
1737
void qemu_console_copy(QemuConsole *con, int src_x, int src_y,
1748 1738
                       int dst_x, int dst_y, int w, int h)
1749 1739
{
1750 1740
    if (is_graphic_console()) {
1751
        dpy_gfx_copy(ds, src_x, src_y, dst_x, dst_y, w, h);
1741
        dpy_gfx_copy(con, src_x, src_y, dst_x, dst_y, w, h);
1752 1742
    }
1753 1743
}
1754 1744

  
1745
DisplaySurface *qemu_console_surface(QemuConsole *console)
1746
{
1747
    return console->ds->surface;
1748
}
1749

  
1750
DisplayState *qemu_console_displaystate(QemuConsole *console)
1751
{
1752
    return console->ds;
1753
}
1754

  
1755 1755
PixelFormat qemu_different_endianness_pixelformat(int bpp)
1756 1756
{
1757 1757
    PixelFormat pf;

Also available in: Unified diff