gtk: support text consoles without vte, bugfixes.
-----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) iQIcBAABAgAGBQJVPjrXAAoJEEy22O7T6HE4jj0P+wU5ukafTUnb0uONmi90QCnK Z9QUSWJKCQjOIZ8rOkFBxHoPbhqNQt73fXEFO4D0J4VodUjZlxhrq0edjJxgm9mi TcJC7y6tqyJWS7ei73vJuq2uzJvTsMq6PR73V2QhmL+uNQru0kWDadjwfWtXDII3 lGz13gOjWD8iMH7Nyx8WMd8+L1Gjl1pllLXyuO/PLCTigrAngpeb/MQlTj0NDbe6 AaGNCXiFzHR8S7SPTMrsphmoNRFDKImpqVzl5xlFQKReYVzLgeOKFn0AIb0JBKuZ kIE3+XJfXmGhliDphcaDwsXD7Qbbtch7Ew73nNPwgPKKP8IkBnqi/zVyq5tAXB8B BuUX+ggoPPog19DZg4q9V+fL5YYbusTUOt+VH69kKZhRxK6ntumDkgdj0tAjCQpT tSF4MeZnMLQ5mUhpmzgLBaDgrKz1vZSW8SzM2CaaghICrrncDTFKnGkUYTHBnNV9 RJUfbggvg+BpqXsj0hFaURU/81wsL8RlSLbS//mLfhB2UK5x3XsUS8Jxq5Nn/Nzs OBB/U7BaRV+PeXj8NNkqIBvgETP1tyfPdTwkRqY4W8pHNwQa66q2nr25+pRHJ/pX HWQazhPjUM5vLh1ozvUsD99mk1lWcjvbttIOHIbUKqNx4gHfOja7F+q7+5qMwP3U jmX6NLhTguUpWt4hPk+n =pn75 -----END PGP SIGNATURE----- Merge remote-tracking branch 'remotes/kraxel/tags/pull-gtk-20150427-1' into staging gtk: support text consoles without vte, bugfixes. # gpg: Signature made Mon Apr 27 14:34:15 2015 BST using RSA key ID D3E87138 # gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>" # gpg: aka "Gerd Hoffmann <gerd@kraxel.org>" # gpg: aka "Gerd Hoffmann (private) <kraxel@gmail.com>" * remotes/kraxel/tags/pull-gtk-20150427-1: gtk: Avoid accel key leakage into guest on console switch gtk: Fix VTE focus grabbing console/gtk: add qemu_console_get_label gtk: bind to text terminal consoles too gtk: handle switch_surface(NULL) properly Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
commit
3f9d69ba12
|
@ -307,6 +307,7 @@ QemuConsole *qemu_console_lookup_by_device(DeviceState *dev, uint32_t head);
|
||||||
bool qemu_console_is_visible(QemuConsole *con);
|
bool qemu_console_is_visible(QemuConsole *con);
|
||||||
bool qemu_console_is_graphic(QemuConsole *con);
|
bool qemu_console_is_graphic(QemuConsole *con);
|
||||||
bool qemu_console_is_fixedsize(QemuConsole *con);
|
bool qemu_console_is_fixedsize(QemuConsole *con);
|
||||||
|
char *qemu_console_get_label(QemuConsole *con);
|
||||||
int qemu_console_get_index(QemuConsole *con);
|
int qemu_console_get_index(QemuConsole *con);
|
||||||
uint32_t qemu_console_get_head(QemuConsole *con);
|
uint32_t qemu_console_get_head(QemuConsole *con);
|
||||||
QemuUIInfo *qemu_console_get_ui_info(QemuConsole *con);
|
QemuUIInfo *qemu_console_get_ui_info(QemuConsole *con);
|
||||||
|
|
15
ui/console.c
15
ui/console.c
|
@ -1788,6 +1788,21 @@ bool qemu_console_is_fixedsize(QemuConsole *con)
|
||||||
return con && (con->console_type != TEXT_CONSOLE);
|
return con && (con->console_type != TEXT_CONSOLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
char *qemu_console_get_label(QemuConsole *con)
|
||||||
|
{
|
||||||
|
if (con->console_type == GRAPHIC_CONSOLE) {
|
||||||
|
if (con->device) {
|
||||||
|
return g_strdup(object_get_typename(con->device));
|
||||||
|
}
|
||||||
|
return g_strdup("VGA");
|
||||||
|
} else {
|
||||||
|
if (con->chr && con->chr->label) {
|
||||||
|
return g_strdup(con->chr->label);
|
||||||
|
}
|
||||||
|
return g_strdup_printf("vc%d", con->index);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int qemu_console_get_index(QemuConsole *con)
|
int qemu_console_get_index(QemuConsole *con)
|
||||||
{
|
{
|
||||||
if (con == NULL) {
|
if (con == NULL) {
|
||||||
|
|
158
ui/gtk.c
158
ui/gtk.c
|
@ -170,6 +170,7 @@ typedef struct VirtualConsole {
|
||||||
GtkWidget *window;
|
GtkWidget *window;
|
||||||
GtkWidget *menu_item;
|
GtkWidget *menu_item;
|
||||||
GtkWidget *tab_item;
|
GtkWidget *tab_item;
|
||||||
|
GtkWidget *focus;
|
||||||
VirtualConsoleType type;
|
VirtualConsoleType type;
|
||||||
union {
|
union {
|
||||||
VirtualGfxConsole gfx;
|
VirtualGfxConsole gfx;
|
||||||
|
@ -230,6 +231,7 @@ struct GtkDisplayState {
|
||||||
|
|
||||||
bool modifier_pressed[ARRAY_SIZE(modifier_keycode)];
|
bool modifier_pressed[ARRAY_SIZE(modifier_keycode)];
|
||||||
bool has_evdev;
|
bool has_evdev;
|
||||||
|
bool ignore_keys;
|
||||||
};
|
};
|
||||||
|
|
||||||
static void gd_grab_pointer(VirtualConsole *vc);
|
static void gd_grab_pointer(VirtualConsole *vc);
|
||||||
|
@ -290,7 +292,8 @@ static void gd_update_cursor(VirtualConsole *vc)
|
||||||
GtkDisplayState *s = vc->s;
|
GtkDisplayState *s = vc->s;
|
||||||
GdkWindow *window;
|
GdkWindow *window;
|
||||||
|
|
||||||
if (vc->type != GD_VC_GFX) {
|
if (vc->type != GD_VC_GFX ||
|
||||||
|
!qemu_console_is_graphic(vc->gfx.dcl.con)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -363,6 +366,9 @@ static void gd_update_geometry_hints(VirtualConsole *vc)
|
||||||
GtkWindow *geo_window;
|
GtkWindow *geo_window;
|
||||||
|
|
||||||
if (vc->type == GD_VC_GFX) {
|
if (vc->type == GD_VC_GFX) {
|
||||||
|
if (!vc->gfx.ds) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (s->free_scale) {
|
if (s->free_scale) {
|
||||||
geo.min_width = surface_width(vc->gfx.ds) * VC_SCALE_MIN;
|
geo.min_width = surface_width(vc->gfx.ds) * VC_SCALE_MIN;
|
||||||
geo.min_height = surface_height(vc->gfx.ds) * VC_SCALE_MIN;
|
geo.min_height = surface_height(vc->gfx.ds) * VC_SCALE_MIN;
|
||||||
|
@ -427,7 +433,8 @@ static void gtk_release_modifiers(GtkDisplayState *s)
|
||||||
VirtualConsole *vc = gd_vc_find_current(s);
|
VirtualConsole *vc = gd_vc_find_current(s);
|
||||||
int i, keycode;
|
int i, keycode;
|
||||||
|
|
||||||
if (vc->type != GD_VC_GFX) {
|
if (vc->type != GD_VC_GFX ||
|
||||||
|
!qemu_console_is_graphic(vc->gfx.dcl.con)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (i = 0; i < ARRAY_SIZE(modifier_keycode); i++) {
|
for (i = 0; i < ARRAY_SIZE(modifier_keycode); i++) {
|
||||||
|
@ -455,6 +462,7 @@ static void gd_update(DisplayChangeListener *dcl,
|
||||||
int x, int y, int w, int h)
|
int x, int y, int w, int h)
|
||||||
{
|
{
|
||||||
VirtualConsole *vc = container_of(dcl, VirtualConsole, gfx.dcl);
|
VirtualConsole *vc = container_of(dcl, VirtualConsole, gfx.dcl);
|
||||||
|
GdkWindow *win;
|
||||||
int x1, x2, y1, y2;
|
int x1, x2, y1, y2;
|
||||||
int mx, my;
|
int mx, my;
|
||||||
int fbw, fbh;
|
int fbw, fbh;
|
||||||
|
@ -481,8 +489,11 @@ static void gd_update(DisplayChangeListener *dcl,
|
||||||
fbw = surface_width(vc->gfx.ds) * vc->gfx.scale_x;
|
fbw = surface_width(vc->gfx.ds) * vc->gfx.scale_x;
|
||||||
fbh = surface_height(vc->gfx.ds) * vc->gfx.scale_y;
|
fbh = surface_height(vc->gfx.ds) * vc->gfx.scale_y;
|
||||||
|
|
||||||
gdk_drawable_get_size(gtk_widget_get_window(vc->gfx.drawing_area),
|
win = gtk_widget_get_window(vc->gfx.drawing_area);
|
||||||
&ww, &wh);
|
if (!win) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
gdk_drawable_get_size(win, &ww, &wh);
|
||||||
|
|
||||||
mx = my = 0;
|
mx = my = 0;
|
||||||
if (ww > fbw) {
|
if (ww > fbw) {
|
||||||
|
@ -574,22 +585,28 @@ static void gd_switch(DisplayChangeListener *dcl,
|
||||||
VirtualConsole *vc = container_of(dcl, VirtualConsole, gfx.dcl);
|
VirtualConsole *vc = container_of(dcl, VirtualConsole, gfx.dcl);
|
||||||
bool resized = true;
|
bool resized = true;
|
||||||
|
|
||||||
trace_gd_switch(vc->label, surface_width(surface), surface_height(surface));
|
trace_gd_switch(vc->label,
|
||||||
|
surface ? surface_width(surface) : 0,
|
||||||
|
surface ? surface_height(surface) : 0);
|
||||||
|
|
||||||
if (vc->gfx.surface) {
|
if (vc->gfx.surface) {
|
||||||
cairo_surface_destroy(vc->gfx.surface);
|
cairo_surface_destroy(vc->gfx.surface);
|
||||||
|
vc->gfx.surface = NULL;
|
||||||
|
}
|
||||||
|
if (vc->gfx.convert) {
|
||||||
|
pixman_image_unref(vc->gfx.convert);
|
||||||
|
vc->gfx.convert = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (vc->gfx.ds &&
|
if (vc->gfx.ds && surface &&
|
||||||
surface_width(vc->gfx.ds) == surface_width(surface) &&
|
surface_width(vc->gfx.ds) == surface_width(surface) &&
|
||||||
surface_height(vc->gfx.ds) == surface_height(surface)) {
|
surface_height(vc->gfx.ds) == surface_height(surface)) {
|
||||||
resized = false;
|
resized = false;
|
||||||
}
|
}
|
||||||
vc->gfx.ds = surface;
|
vc->gfx.ds = surface;
|
||||||
|
|
||||||
if (vc->gfx.convert) {
|
if (!surface) {
|
||||||
pixman_image_unref(vc->gfx.convert);
|
return;
|
||||||
vc->gfx.convert = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (surface->format == PIXMAN_x8r8g8b8) {
|
if (surface->format == PIXMAN_x8r8g8b8) {
|
||||||
|
@ -690,6 +707,9 @@ static gboolean gd_draw_event(GtkWidget *widget, cairo_t *cr, void *opaque)
|
||||||
if (!gtk_widget_get_realized(widget)) {
|
if (!gtk_widget_get_realized(widget)) {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
if (!vc->gfx.ds) {
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
fbw = surface_width(vc->gfx.ds);
|
fbw = surface_width(vc->gfx.ds);
|
||||||
fbh = surface_height(vc->gfx.ds);
|
fbh = surface_height(vc->gfx.ds);
|
||||||
|
@ -771,6 +791,10 @@ static gboolean gd_motion_event(GtkWidget *widget, GdkEventMotion *motion,
|
||||||
int fbh, fbw;
|
int fbh, fbw;
|
||||||
int ww, wh;
|
int ww, wh;
|
||||||
|
|
||||||
|
if (!vc->gfx.ds) {
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
fbw = surface_width(vc->gfx.ds) * vc->gfx.scale_x;
|
fbw = surface_width(vc->gfx.ds) * vc->gfx.scale_x;
|
||||||
fbh = surface_height(vc->gfx.ds) * vc->gfx.scale_y;
|
fbh = surface_height(vc->gfx.ds) * vc->gfx.scale_y;
|
||||||
|
|
||||||
|
@ -945,6 +969,23 @@ static int gd_map_keycode(GtkDisplayState *s, GdkDisplay *dpy, int gdk_keycode)
|
||||||
return qemu_keycode;
|
return qemu_keycode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gboolean gd_text_key_down(GtkWidget *widget,
|
||||||
|
GdkEventKey *key, void *opaque)
|
||||||
|
{
|
||||||
|
VirtualConsole *vc = opaque;
|
||||||
|
QemuConsole *con = vc->gfx.dcl.con;
|
||||||
|
|
||||||
|
if (key->length) {
|
||||||
|
kbd_put_string_console(con, key->string, key->length);
|
||||||
|
} else {
|
||||||
|
int num = gd_map_keycode(vc->s, gtk_widget_get_display(widget),
|
||||||
|
key->hardware_keycode);
|
||||||
|
int qcode = qemu_input_key_number_to_qcode(num);
|
||||||
|
kbd_put_qcode_console(con, qcode);
|
||||||
|
}
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
static gboolean gd_key_event(GtkWidget *widget, GdkEventKey *key, void *opaque)
|
static gboolean gd_key_event(GtkWidget *widget, GdkEventKey *key, void *opaque)
|
||||||
{
|
{
|
||||||
VirtualConsole *vc = opaque;
|
VirtualConsole *vc = opaque;
|
||||||
|
@ -953,6 +994,11 @@ static gboolean gd_key_event(GtkWidget *widget, GdkEventKey *key, void *opaque)
|
||||||
int qemu_keycode;
|
int qemu_keycode;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
if (s->ignore_keys) {
|
||||||
|
s->ignore_keys = (key->type == GDK_KEY_PRESS);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
if (key->keyval == GDK_KEY_Pause) {
|
if (key->keyval == GDK_KEY_Pause) {
|
||||||
qemu_input_event_send_key_qcode(vc->gfx.dcl.con, Q_KEY_CODE_PAUSE,
|
qemu_input_event_send_key_qcode(vc->gfx.dcl.con, Q_KEY_CODE_PAUSE,
|
||||||
key->type == GDK_KEY_PRESS);
|
key->type == GDK_KEY_PRESS);
|
||||||
|
@ -1021,22 +1067,26 @@ static void gd_menu_switch_vc(GtkMenuItem *item, void *opaque)
|
||||||
GtkDisplayState *s = opaque;
|
GtkDisplayState *s = opaque;
|
||||||
VirtualConsole *vc = gd_vc_find_by_menu(s);
|
VirtualConsole *vc = gd_vc_find_by_menu(s);
|
||||||
GtkNotebook *nb = GTK_NOTEBOOK(s->notebook);
|
GtkNotebook *nb = GTK_NOTEBOOK(s->notebook);
|
||||||
GtkWidget *child;
|
|
||||||
gint page;
|
gint page;
|
||||||
|
|
||||||
gtk_release_modifiers(s);
|
gtk_release_modifiers(s);
|
||||||
if (vc) {
|
if (vc) {
|
||||||
page = gtk_notebook_page_num(nb, vc->tab_item);
|
page = gtk_notebook_page_num(nb, vc->tab_item);
|
||||||
gtk_notebook_set_current_page(nb, page);
|
gtk_notebook_set_current_page(nb, page);
|
||||||
child = gtk_notebook_get_nth_page(nb, page);
|
gtk_widget_grab_focus(vc->focus);
|
||||||
gtk_widget_grab_focus(child);
|
|
||||||
}
|
}
|
||||||
|
s->ignore_keys = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void gd_accel_switch_vc(void *opaque)
|
static void gd_accel_switch_vc(void *opaque)
|
||||||
{
|
{
|
||||||
VirtualConsole *vc = opaque;
|
VirtualConsole *vc = opaque;
|
||||||
|
|
||||||
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(vc->menu_item), TRUE);
|
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(vc->menu_item), TRUE);
|
||||||
|
#if !GTK_CHECK_VERSION(3, 0, 0)
|
||||||
|
/* GTK2 sends the accel key to the target console - ignore this until */
|
||||||
|
vc->s->ignore_keys = true;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static void gd_menu_show_tabs(GtkMenuItem *item, void *opaque)
|
static void gd_menu_show_tabs(GtkMenuItem *item, void *opaque)
|
||||||
|
@ -1086,7 +1136,8 @@ static void gd_menu_untabify(GtkMenuItem *item, void *opaque)
|
||||||
GtkDisplayState *s = opaque;
|
GtkDisplayState *s = opaque;
|
||||||
VirtualConsole *vc = gd_vc_find_current(s);
|
VirtualConsole *vc = gd_vc_find_current(s);
|
||||||
|
|
||||||
if (vc->type == GD_VC_GFX) {
|
if (vc->type == GD_VC_GFX &&
|
||||||
|
qemu_console_is_graphic(vc->gfx.dcl.con)) {
|
||||||
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(s->grab_item),
|
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(s->grab_item),
|
||||||
FALSE);
|
FALSE);
|
||||||
}
|
}
|
||||||
|
@ -1099,11 +1150,14 @@ static void gd_menu_untabify(GtkMenuItem *item, void *opaque)
|
||||||
G_CALLBACK(gd_tab_window_close), vc);
|
G_CALLBACK(gd_tab_window_close), vc);
|
||||||
gtk_widget_show_all(vc->window);
|
gtk_widget_show_all(vc->window);
|
||||||
|
|
||||||
GtkAccelGroup *ag = gtk_accel_group_new();
|
if (qemu_console_is_graphic(vc->gfx.dcl.con)) {
|
||||||
gtk_window_add_accel_group(GTK_WINDOW(vc->window), ag);
|
GtkAccelGroup *ag = gtk_accel_group_new();
|
||||||
|
gtk_window_add_accel_group(GTK_WINDOW(vc->window), ag);
|
||||||
|
|
||||||
GClosure *cb = g_cclosure_new_swap(G_CALLBACK(gd_win_grab), vc, NULL);
|
GClosure *cb = g_cclosure_new_swap(G_CALLBACK(gd_win_grab),
|
||||||
gtk_accel_group_connect(ag, GDK_KEY_g, HOTKEY_MODIFIERS, 0, cb);
|
vc, NULL);
|
||||||
|
gtk_accel_group_connect(ag, GDK_KEY_g, HOTKEY_MODIFIERS, 0, cb);
|
||||||
|
}
|
||||||
|
|
||||||
gd_update_geometry_hints(vc);
|
gd_update_geometry_hints(vc);
|
||||||
gd_update_caption(s);
|
gd_update_caption(s);
|
||||||
|
@ -1120,8 +1174,10 @@ static void gd_menu_full_screen(GtkMenuItem *item, void *opaque)
|
||||||
gtk_widget_hide(s->menu_bar);
|
gtk_widget_hide(s->menu_bar);
|
||||||
if (vc->type == GD_VC_GFX) {
|
if (vc->type == GD_VC_GFX) {
|
||||||
gtk_widget_set_size_request(vc->gfx.drawing_area, -1, -1);
|
gtk_widget_set_size_request(vc->gfx.drawing_area, -1, -1);
|
||||||
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(s->grab_item),
|
if (qemu_console_is_graphic(vc->gfx.dcl.con)) {
|
||||||
TRUE);
|
gtk_check_menu_item_set_active
|
||||||
|
(GTK_CHECK_MENU_ITEM(s->grab_item), TRUE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
gtk_window_fullscreen(GTK_WINDOW(s->window));
|
gtk_window_fullscreen(GTK_WINDOW(s->window));
|
||||||
s->full_screen = TRUE;
|
s->full_screen = TRUE;
|
||||||
|
@ -1370,7 +1426,8 @@ static void gd_change_page(GtkNotebook *nb, gpointer arg1, guint arg2,
|
||||||
#endif
|
#endif
|
||||||
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(vc->menu_item),
|
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(vc->menu_item),
|
||||||
TRUE);
|
TRUE);
|
||||||
on_vga = (vc->type == GD_VC_GFX);
|
on_vga = (vc->type == GD_VC_GFX &&
|
||||||
|
qemu_console_is_graphic(vc->gfx.dcl.con));
|
||||||
if (!on_vga) {
|
if (!on_vga) {
|
||||||
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(s->grab_item),
|
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(s->grab_item),
|
||||||
FALSE);
|
FALSE);
|
||||||
|
@ -1542,6 +1599,7 @@ static GSList *gd_vc_vte_init(GtkDisplayState *s, VirtualConsole *vc,
|
||||||
|
|
||||||
vc->type = GD_VC_VTE;
|
vc->type = GD_VC_VTE;
|
||||||
vc->tab_item = box;
|
vc->tab_item = box;
|
||||||
|
vc->focus = vc->vte.terminal;
|
||||||
gtk_notebook_append_page(GTK_NOTEBOOK(s->notebook), vc->tab_item,
|
gtk_notebook_append_page(GTK_NOTEBOOK(s->notebook), vc->tab_item,
|
||||||
gtk_label_new(vc->label));
|
gtk_label_new(vc->label));
|
||||||
|
|
||||||
|
@ -1577,25 +1635,30 @@ static void gd_connect_vc_gfx_signals(VirtualConsole *vc)
|
||||||
g_signal_connect(vc->gfx.drawing_area, "expose-event",
|
g_signal_connect(vc->gfx.drawing_area, "expose-event",
|
||||||
G_CALLBACK(gd_expose_event), vc);
|
G_CALLBACK(gd_expose_event), vc);
|
||||||
#endif
|
#endif
|
||||||
g_signal_connect(vc->gfx.drawing_area, "event",
|
if (qemu_console_is_graphic(vc->gfx.dcl.con)) {
|
||||||
G_CALLBACK(gd_event), vc);
|
g_signal_connect(vc->gfx.drawing_area, "event",
|
||||||
g_signal_connect(vc->gfx.drawing_area, "button-press-event",
|
G_CALLBACK(gd_event), vc);
|
||||||
G_CALLBACK(gd_button_event), vc);
|
g_signal_connect(vc->gfx.drawing_area, "button-press-event",
|
||||||
g_signal_connect(vc->gfx.drawing_area, "button-release-event",
|
G_CALLBACK(gd_button_event), vc);
|
||||||
G_CALLBACK(gd_button_event), vc);
|
g_signal_connect(vc->gfx.drawing_area, "button-release-event",
|
||||||
g_signal_connect(vc->gfx.drawing_area, "scroll-event",
|
G_CALLBACK(gd_button_event), vc);
|
||||||
G_CALLBACK(gd_scroll_event), vc);
|
g_signal_connect(vc->gfx.drawing_area, "scroll-event",
|
||||||
g_signal_connect(vc->gfx.drawing_area, "key-press-event",
|
G_CALLBACK(gd_scroll_event), vc);
|
||||||
G_CALLBACK(gd_key_event), vc);
|
g_signal_connect(vc->gfx.drawing_area, "key-press-event",
|
||||||
g_signal_connect(vc->gfx.drawing_area, "key-release-event",
|
G_CALLBACK(gd_key_event), vc);
|
||||||
G_CALLBACK(gd_key_event), vc);
|
g_signal_connect(vc->gfx.drawing_area, "key-release-event",
|
||||||
|
G_CALLBACK(gd_key_event), vc);
|
||||||
|
|
||||||
g_signal_connect(vc->gfx.drawing_area, "enter-notify-event",
|
g_signal_connect(vc->gfx.drawing_area, "enter-notify-event",
|
||||||
G_CALLBACK(gd_enter_event), vc);
|
G_CALLBACK(gd_enter_event), vc);
|
||||||
g_signal_connect(vc->gfx.drawing_area, "leave-notify-event",
|
g_signal_connect(vc->gfx.drawing_area, "leave-notify-event",
|
||||||
G_CALLBACK(gd_leave_event), vc);
|
G_CALLBACK(gd_leave_event), vc);
|
||||||
g_signal_connect(vc->gfx.drawing_area, "focus-out-event",
|
g_signal_connect(vc->gfx.drawing_area, "focus-out-event",
|
||||||
G_CALLBACK(gd_focus_out_event), vc);
|
G_CALLBACK(gd_focus_out_event), vc);
|
||||||
|
} else {
|
||||||
|
g_signal_connect(vc->gfx.drawing_area, "key-press-event",
|
||||||
|
G_CALLBACK(gd_text_key_down), vc);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void gd_connect_signals(GtkDisplayState *s)
|
static void gd_connect_signals(GtkDisplayState *s)
|
||||||
|
@ -1679,15 +1742,7 @@ static GSList *gd_vc_gfx_init(GtkDisplayState *s, VirtualConsole *vc,
|
||||||
QemuConsole *con, int idx,
|
QemuConsole *con, int idx,
|
||||||
GSList *group, GtkWidget *view_menu)
|
GSList *group, GtkWidget *view_menu)
|
||||||
{
|
{
|
||||||
Object *obj;
|
vc->label = qemu_console_get_label(con);
|
||||||
|
|
||||||
obj = object_property_get_link(OBJECT(con), "device", NULL);
|
|
||||||
if (obj) {
|
|
||||||
vc->label = g_strdup_printf("%s", object_get_typename(obj));
|
|
||||||
} else {
|
|
||||||
vc->label = g_strdup_printf("VGA");
|
|
||||||
}
|
|
||||||
|
|
||||||
vc->s = s;
|
vc->s = s;
|
||||||
vc->gfx.scale_x = 1.0;
|
vc->gfx.scale_x = 1.0;
|
||||||
vc->gfx.scale_y = 1.0;
|
vc->gfx.scale_y = 1.0;
|
||||||
|
@ -1706,16 +1761,17 @@ static GSList *gd_vc_gfx_init(GtkDisplayState *s, VirtualConsole *vc,
|
||||||
|
|
||||||
vc->type = GD_VC_GFX;
|
vc->type = GD_VC_GFX;
|
||||||
vc->tab_item = vc->gfx.drawing_area;
|
vc->tab_item = vc->gfx.drawing_area;
|
||||||
|
vc->focus = vc->gfx.drawing_area;
|
||||||
gtk_notebook_append_page(GTK_NOTEBOOK(s->notebook),
|
gtk_notebook_append_page(GTK_NOTEBOOK(s->notebook),
|
||||||
vc->tab_item, gtk_label_new(vc->label));
|
vc->tab_item, gtk_label_new(vc->label));
|
||||||
gd_connect_vc_gfx_signals(vc);
|
|
||||||
|
|
||||||
group = gd_vc_menu_init(s, vc, idx, group, view_menu);
|
|
||||||
|
|
||||||
vc->gfx.dcl.ops = &dcl_ops;
|
vc->gfx.dcl.ops = &dcl_ops;
|
||||||
vc->gfx.dcl.con = con;
|
vc->gfx.dcl.con = con;
|
||||||
register_displaychangelistener(&vc->gfx.dcl);
|
register_displaychangelistener(&vc->gfx.dcl);
|
||||||
|
|
||||||
|
gd_connect_vc_gfx_signals(vc);
|
||||||
|
group = gd_vc_menu_init(s, vc, idx, group, view_menu);
|
||||||
|
|
||||||
return group;
|
return group;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1787,7 +1843,7 @@ static GtkWidget *gd_create_menu_view(GtkDisplayState *s)
|
||||||
/* gfx */
|
/* gfx */
|
||||||
for (vc = 0;; vc++) {
|
for (vc = 0;; vc++) {
|
||||||
con = qemu_console_lookup_by_index(vc);
|
con = qemu_console_lookup_by_index(vc);
|
||||||
if (!con || !qemu_console_is_graphic(con)) {
|
if (!con) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
group = gd_vc_gfx_init(s, &s->vc[vc], con,
|
group = gd_vc_gfx_init(s, &s->vc[vc], con,
|
||||||
|
|
Loading…
Reference in a new issue