On So, 2016-10-23 at 21:54 +0200, Samuel Thibault wrote: > This adds two console functions, qemu_console_set_window_id and > qemu_graphic_console_get_window_id, to let graphical backend record the > window id in the QemuConsole structure, and let the baum driver read it. > > We can then move the SDL code from the baum driver to the sdl ui code, > and add SDL2 and Gtk versions of the code.
Patches 1+2 look good to me, but I don't feel like rushing this one before the freeze. Also splitting this up would be nice. > +int qemu_graphic_console_get_window_id(void) > +{ > + int i; > + for (i = 0; i < nb_consoles; i++) { > + if (consoles[i]->console_type == GRAPHIC_CONSOLE) { > + return consoles[i]->window_id; > + } > + } > + return -1; > +} No loop needed here. qemu sorts consoles so the graphic ones come first. > + gdk_window = gtk_widget_get_window(s->window); > +#ifdef GDK_WINDOWING_X11 > + window_id = GDK_WINDOW_XID(gdk_window); > +#elif defined(GDK_WINDOWING_WIN32) > + window_id = gdk_win32_window_get_impl_hwnd(gdk_window); > +#endif > + for (i = 0; ; i++) { > + /* All consoles share the same window */ No. That is the default setup, but try "View / Detach tab". Window ID changing at runtime ... cheers, Gerd