From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39783) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bzLHK-0007r8-Tj for qemu-devel@nongnu.org; Wed, 26 Oct 2016 06:17:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bzLHH-0004wj-RC for qemu-devel@nongnu.org; Wed, 26 Oct 2016 06:17:50 -0400 Received: from mx1.redhat.com ([209.132.183.28]:37572) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1bzLHH-0004wa-Lo for qemu-devel@nongnu.org; Wed, 26 Oct 2016 06:17:47 -0400 Message-ID: <1477477064.18984.39.camel@redhat.com> From: Gerd Hoffmann Date: Wed, 26 Oct 2016 12:17:44 +0200 In-Reply-To: <20161023195433.20102-4-samuel.thibault@ens-lyon.org> References: <20161023195433.20102-1-samuel.thibault@ens-lyon.org> <20161023195433.20102-4-samuel.thibault@ens-lyon.org> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH 3/3] Move getting XWindow ID from baum driver to graphical backend List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Samuel Thibault Cc: qemu-devel@nongnu.org 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. >=20 > 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 =3D 0; i < nb_consoles; i++) { > + if (consoles[i]->console_type =3D=3D GRAPHIC_CONSOLE) { > + return consoles[i]->window_id; > + } > + } > + return -1; > +} No loop needed here. qemu sorts consoles so the graphic ones come first. > + gdk_window =3D gtk_widget_get_window(s->window); > +#ifdef GDK_WINDOWING_X11 > + window_id =3D GDK_WINDOW_XID(gdk_window); > +#elif defined(GDK_WINDOWING_WIN32) > + window_id =3D gdk_win32_window_get_impl_hwnd(gdk_window); > +#endif > + for (i =3D 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