TextCell *c;
int y1, y2;
- if (s != active_console) {
+ if (!qemu_console_is_visible(s)) {
return;
}
int y, y1;
int x = s->x;
- if (s != active_console) {
+ if (!qemu_console_is_visible(s)) {
return;
}
TextCell *c;
int x, y, y1;
- if (s != active_console)
+ if (!qemu_console_is_visible(s)) {
return;
+ }
if (s->ds->have_text) {
s->text_x[0] = 0;
}
}
-static void console_scroll(int ydelta)
+static void console_scroll(QemuConsole *s, int ydelta)
{
- QemuConsole *s;
int i, y1;
- s = active_console;
- if (!s || (s->console_type == GRAPHIC_CONSOLE))
- return;
-
if (ydelta > 0) {
for(i = 0; i < ydelta; i++) {
if (s->y_displayed == s->y_base)
c->t_attrib = s->t_attrib_default;
c++;
}
- if (s == active_console && s->y_displayed == s->y_base) {
+ if (qemu_console_is_visible(s) && s->y_displayed == s->y_base) {
if (s->ds->have_text) {
s->text_x[0] = 0;
s->text_y[0] = 0;
switch(keysym) {
case QEMU_KEY_CTRL_UP:
- console_scroll(-1);
+ console_scroll(s, -1);
break;
case QEMU_KEY_CTRL_DOWN:
- console_scroll(1);
+ console_scroll(s, 1);
break;
case QEMU_KEY_CTRL_PAGEUP:
- console_scroll(-10);
+ console_scroll(s, -10);
break;
case QEMU_KEY_CTRL_PAGEDOWN:
- console_scroll(10);
+ console_scroll(s, 10);
break;
default:
/* convert the QEMU keysym to VT100 key string */
w = MIN(w, width - x);
h = MIN(h, height - y);
- if (con != active_console) {
+ if (!qemu_console_is_visible(con)) {
return;
}
QLIST_FOREACH(dcl, &s->listeners, next) {
DisplaySurface *old_surface = con->surface;
con->surface = surface;
- if (con == active_console) {
+ if (qemu_console_is_visible(con)) {
dpy_gfx_switch_surface(s, surface);
}
qemu_free_displaysurface(old_surface);
DisplayState *s = con->ds;
struct DisplayChangeListener *dcl;
- if (con != active_console) {
+ if (!qemu_console_is_visible(con)) {
return;
}
QLIST_FOREACH(dcl, &s->listeners, next) {
DisplayState *s = con->ds;
struct DisplayChangeListener *dcl;
- if (con != active_console) {
+ if (!qemu_console_is_visible(con)) {
return;
}
QLIST_FOREACH(dcl, &s->listeners, next) {
DisplayState *s = con->ds;
struct DisplayChangeListener *dcl;
- if (con != active_console) {
+ if (!qemu_console_is_visible(con)) {
return;
}
QLIST_FOREACH(dcl, &s->listeners, next) {
DisplayState *s = con->ds;
struct DisplayChangeListener *dcl;
- if (con != active_console) {
+ if (!qemu_console_is_visible(con)) {
return;
}
QLIST_FOREACH(dcl, &s->listeners, next) {
DisplayState *s = con->ds;
struct DisplayChangeListener *dcl;
- if (con != active_console) {
+ if (!qemu_console_is_visible(con)) {
return;
}
QLIST_FOREACH(dcl, &s->listeners, next) {
DisplayState *s = con->ds;
struct DisplayChangeListener *dcl;
- if (con != active_console) {
+ if (!qemu_console_is_visible(con)) {
return;
}
QLIST_FOREACH(dcl, &s->listeners, next) {
return s;
}
-int is_graphic_console(void)
+bool qemu_console_is_visible(QemuConsole *con)
{
- return active_console && active_console->console_type == GRAPHIC_CONSOLE;
+ return con == active_console;
}
-int is_fixedsize_console(void)
+bool qemu_console_is_graphic(QemuConsole *con)
{
- return active_console && active_console->console_type != TEXT_CONSOLE;
+ if (con == NULL) {
+ con = active_console;
+ }
+ return con && (con->console_type == GRAPHIC_CONSOLE);
+}
+
+bool qemu_console_is_fixedsize(QemuConsole *con)
+{
+ if (con == NULL) {
+ con = active_console;
+ }
+ return con && (con->console_type != TEXT_CONSOLE);
}
static void text_console_set_echo(CharDriverState *chr, bool echo)
if (!cursor_hide)
return;
- if (!kbd_mouse_is_absolute() || !is_graphic_console()) {
+ if (!kbd_mouse_is_absolute() || !qemu_console_is_graphic(NULL)) {
SDL_ShowCursor(1);
if (guest_cursor &&
(gui_grab || kbd_mouse_is_absolute() || absolute_enabled))
if (kbd_mouse_is_absolute()) {
if (!absolute_enabled) {
absolute_enabled = 1;
- if (is_graphic_console()) {
+ if (qemu_console_is_graphic(NULL)) {
absolute_mouse_grab();
}
}
} else {
do_sdl_resize(width, height, 0);
}
- if (!gui_saved_grab || !is_graphic_console()) {
+ if (!gui_saved_grab || !qemu_console_is_graphic(NULL)) {
sdl_grab_end();
}
}
if (gui_fullscreen) {
break;
}
- if (!is_graphic_console()) {
+ if (!qemu_console_is_graphic(NULL)) {
/* release grab if going to a text console */
if (gui_grab) {
sdl_grab_end();
default:
break;
}
- } else if (!is_graphic_console()) {
+ } else if (!qemu_console_is_graphic(NULL)) {
int keysym = 0;
if (ev->key.keysym.mod & (KMOD_LCTRL | KMOD_RCTRL)) {
kbd_put_keysym(ev->key.keysym.unicode);
}
}
- if (is_graphic_console() && !gui_keysym) {
+ if (qemu_console_is_graphic(NULL) && !gui_keysym) {
sdl_process_key(&ev->key);
}
}
if (gui_keysym == 0) {
/* exit/enter grab if pressing Ctrl-Alt */
if (!gui_grab) {
- if (is_graphic_console()) {
+ if (qemu_console_is_graphic(NULL)) {
sdl_grab_start();
}
} else if (!gui_fullscreen) {
}
gui_keysym = 0;
}
- if (is_graphic_console() && !gui_keysym) {
+ if (qemu_console_is_graphic(NULL) && !gui_keysym) {
sdl_process_key(&ev->key);
}
}
{
int max_x, max_y;
- if (is_graphic_console() &&
+ if (qemu_console_is_graphic(NULL) &&
(kbd_mouse_is_absolute() || absolute_enabled)) {
max_x = real_screen->w - 1;
max_y = real_screen->h - 1;
SDL_MouseButtonEvent *bev;
int dz;
- if (!is_graphic_console()) {
+ if (!qemu_console_is_graphic(NULL)) {
return;
}
sdl_grab_end();
}
#endif
- if (!gui_grab && ev->active.gain && is_graphic_console() &&
+ if (!gui_grab && ev->active.gain && qemu_console_is_graphic(NULL) &&
(kbd_mouse_is_absolute() || absolute_enabled)) {
absolute_mouse_grab();
}
}
graphic_hw_update(NULL);
- SDL_EnableUNICODE(!is_graphic_console());
+ SDL_EnableUNICODE(!qemu_console_is_graphic(NULL));
while (SDL_PollEvent(ev)) {
switch (ev->type) {