Skip to content

Commit

Permalink
ui/gtk: force realization of drawing area
Browse files Browse the repository at this point in the history
Fixes the GL context creation from a widget that isn't yet realized (in
a hidden tab for example).

Resolves:
https://gitlab.com/qemu-project/qemu/-/issues/1727

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Antonio Caggiano <quic_acaggian@quicinc.com>
Message-Id: <20231017111642.1155545-1-marcandre.lureau@redhat.com>
(cherry picked from commit 565f85a)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
  • Loading branch information
elmarco authored and Michael Tokarev committed Nov 7, 2023
1 parent 091798a commit ad8457e
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions ui/gtk.c
Original file line number Diff line number Diff line change
Expand Up @@ -2317,6 +2317,7 @@ static void gtk_display_init(DisplayState *ds, DisplayOptions *opts)
GdkDisplay *window_display;
GtkIconTheme *theme;
char *dir;
int idx;

if (!gtkinit) {
fprintf(stderr, "gtk initialization failed\n");
Expand Down Expand Up @@ -2379,6 +2380,15 @@ static void gtk_display_init(DisplayState *ds, DisplayOptions *opts)
gtk_container_add(GTK_CONTAINER(s->window), s->vbox);

gtk_widget_show_all(s->window);

for (idx = 0;; idx++) {
QemuConsole *con = qemu_console_lookup_by_index(idx);
if (!con) {
break;
}
gtk_widget_realize(s->vc[idx].gfx.drawing_area);
}

if (opts->u.gtk.has_show_menubar &&
!opts->u.gtk.show_menubar) {
gtk_widget_hide(s->menu_bar);
Expand Down

0 comments on commit ad8457e

Please sign in to comment.