From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:43532) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UBLph-0003nz-UK for qemu-devel@nongnu.org; Fri, 01 Mar 2013 04:00:58 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UBLpf-00030n-IS for qemu-devel@nongnu.org; Fri, 01 Mar 2013 04:00:49 -0500 Received: from mx1.redhat.com ([209.132.183.28]:64459) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UBLpf-00030Z-9N for qemu-devel@nongnu.org; Fri, 01 Mar 2013 04:00:47 -0500 From: Gerd Hoffmann Date: Fri, 1 Mar 2013 10:00:34 +0100 Message-Id: <1362128443-15687-4-git-send-email-kraxel@redhat.com> In-Reply-To: <1362128443-15687-1-git-send-email-kraxel@redhat.com> References: <1362128443-15687-1-git-send-email-kraxel@redhat.com> Subject: [Qemu-devel] [RfC PATCH 03/12] spice: zap sdpy global List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Anthony Liguori , Gerd Hoffmann DisplayChangeListener is passed now to all DisplayChangeListenerOps callbacks, so we can use that to access the spice display state and kill the sdpy global variable. Signed-off-by: Gerd Hoffmann --- ui/spice-display.c | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/ui/spice-display.c b/ui/spice-display.c index b6528fa..b2bda23 100644 --- a/ui/spice-display.c +++ b/ui/spice-display.c @@ -581,25 +581,26 @@ static const QXLInterface dpy_interface = { .client_monitors_config = interface_client_monitors_config, }; -static SimpleSpiceDisplay sdpy; - static void display_update(DisplayChangeListener *dcl, struct DisplayState *ds, int x, int y, int w, int h) { - qemu_spice_display_update(&sdpy, x, y, w, h); + SimpleSpiceDisplay *ssd = container_of(dcl, SimpleSpiceDisplay, dcl); + qemu_spice_display_update(ssd, x, y, w, h); } static void display_resize(DisplayChangeListener *dcl, struct DisplayState *ds) { - qemu_spice_display_resize(&sdpy); + SimpleSpiceDisplay *ssd = container_of(dcl, SimpleSpiceDisplay, dcl); + qemu_spice_display_resize(ssd); } static void display_refresh(DisplayChangeListener *dcl, struct DisplayState *ds) { - qemu_spice_display_refresh(&sdpy); + SimpleSpiceDisplay *ssd = container_of(dcl, SimpleSpiceDisplay, dcl); + qemu_spice_display_refresh(ssd); } static const DisplayChangeListenerOps display_listener_ops = { @@ -611,16 +612,17 @@ static const DisplayChangeListenerOps display_listener_ops = { void qemu_spice_display_init(DisplayState *ds) { - assert(sdpy.ds == NULL); - qemu_spice_display_init_common(&sdpy, ds); + SimpleSpiceDisplay *ssd = g_new0(SimpleSpiceDisplay, 1); + + qemu_spice_display_init_common(ssd, ds); - sdpy.qxl.base.sif = &dpy_interface.base; - qemu_spice_add_interface(&sdpy.qxl.base); - assert(sdpy.worker); + ssd->qxl.base.sif = &dpy_interface.base; + qemu_spice_add_interface(&ssd->qxl.base); + assert(ssd->worker); - qemu_spice_create_host_memslot(&sdpy); - qemu_spice_create_host_primary(&sdpy); + qemu_spice_create_host_memslot(ssd); + qemu_spice_create_host_primary(ssd); - sdpy.dcl.ops = &display_listener_ops; - register_displaychangelistener(ds, &sdpy.dcl); + ssd->dcl.ops = &display_listener_ops; + register_displaychangelistener(ds, &ssd->dcl); } -- 1.7.9.7