Revision 1472a95b vl.c

b/vl.c
1555 1555
    }
1556 1556
}
1557 1557

  
1558
static DisplayType select_display(const char *p)
1559
{
1560
    const char *opts;
1561
    DisplayType display = DT_DEFAULT;
1562

  
1563
    if (strstart(p, "sdl", &opts)) {
1564
#ifdef CONFIG_SDL
1565
        display = DT_SDL;
1566
        while (*opts) {
1567
            const char *nextopt;
1568

  
1569
            if (strstart(opts, ",frame=", &nextopt)) {
1570
                opts = nextopt;
1571
                if (strstart(opts, "on", &nextopt)) {
1572
                    no_frame = 0;
1573
                } else if (strstart(opts, "off", &nextopt)) {
1574
                    no_frame = 1;
1575
                } else {
1576
                    goto invalid_display;
1577
                }
1578
            } else if (strstart(opts, ",alt_grab=", &nextopt)) {
1579
                opts = nextopt;
1580
                if (strstart(opts, "on", &nextopt)) {
1581
                    alt_grab = 1;
1582
                } else if (strstart(opts, "off", &nextopt)) {
1583
                    alt_grab = 0;
1584
                } else {
1585
                    goto invalid_display;
1586
                }
1587
            } else if (strstart(opts, ",ctrl_grab=", &nextopt)) {
1588
                opts = nextopt;
1589
                if (strstart(opts, "on", &nextopt)) {
1590
                    ctrl_grab = 1;
1591
                } else if (strstart(opts, "off", &nextopt)) {
1592
                    ctrl_grab = 0;
1593
                } else {
1594
                    goto invalid_display;
1595
                }
1596
            } else if (strstart(opts, ",window_close=", &nextopt)) {
1597
                opts = nextopt;
1598
                if (strstart(opts, "on", &nextopt)) {
1599
                    no_quit = 0;
1600
                } else if (strstart(opts, "off", &nextopt)) {
1601
                    no_quit = 1;
1602
                } else {
1603
                    goto invalid_display;
1604
                }
1605
            } else {
1606
                goto invalid_display;
1607
            }
1608
            opts = nextopt;
1609
        }
1610
#else
1611
        fprintf(stderr, "SDL support is disabled\n");
1612
        exit(1);
1613
#endif
1614
    } else if (strstart(p, "curses", &opts)) {
1615
#ifdef CONFIG_CURSES
1616
        display = DT_CURSES;
1617
#else
1618
        fprintf(stderr, "Curses support is disabled\n");
1619
        exit(1);
1620
#endif
1621
    } else {
1622
    invalid_display:
1623
        fprintf(stderr, "Unknown display type: %s\n", p);
1624
        exit(1);
1625
    }
1626

  
1627
    return display;
1628
}
1629

  
1558 1630
static int balloon_parse(const char *arg)
1559 1631
{
1560 1632
    QemuOpts *opts;
......
2153 2225
                }
2154 2226
                numa_add(optarg);
2155 2227
                break;
2228
            case QEMU_OPTION_display:
2229
                display_type = select_display(optarg);
2230
                break;
2156 2231
            case QEMU_OPTION_nographic:
2157 2232
                display_type = DT_NOGRAPHIC;
2158 2233
                break;

Also available in: Unified diff