From patchwork Mon Jan 16 22:36:34 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anthony Liguori X-Patchwork-Id: 136372 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id D186E1007D2 for ; Tue, 17 Jan 2012 09:36:53 +1100 (EST) Received: from localhost ([::1]:36688 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RmvAV-00025B-82 for incoming@patchwork.ozlabs.org; Mon, 16 Jan 2012 17:36:47 -0500 Received: from eggs.gnu.org ([140.186.70.92]:48660) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RmvAO-00024l-Uf for qemu-devel@nongnu.org; Mon, 16 Jan 2012 17:36:41 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RmvAN-0006hq-MO for qemu-devel@nongnu.org; Mon, 16 Jan 2012 17:36:40 -0500 Received: from cpe-70-123-132-139.austin.res.rr.com ([70.123.132.139]:44352 helo=localhost6.localdomain6) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RmvAN-0006hi-FI for qemu-devel@nongnu.org; Mon, 16 Jan 2012 17:36:39 -0500 Received: from localhost6.localdomain6 (localhost.localdomain [127.0.0.1]) by localhost6.localdomain6 (8.14.4/8.14.4/Debian-2ubuntu1) with ESMTP id q0GMab2D018513; Mon, 16 Jan 2012 16:36:37 -0600 Received: (from anthony@localhost) by localhost6.localdomain6 (8.14.4/8.14.4/Submit) id q0GMab7a018511; Mon, 16 Jan 2012 16:36:37 -0600 From: Anthony Liguori To: qemu-devel@nongnu.org Date: Mon, 16 Jan 2012 16:36:34 -0600 Message-Id: <1326753397-18476-1-git-send-email-aliguori@us.ibm.com> X-Mailer: git-send-email 1.7.4.1 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 70.123.132.139 Cc: Anthony Liguori Subject: [Qemu-devel] [PATCH 1/4] console: a few cleanups X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org We don't do anything with the list of registered DisplayState so get rid of it. That's one less list to deal with down the road. Also pass DisplayState to the callbacks in DisplayState so users can avoid global state references. Signed-off-by: Anthony Liguori --- console.c | 9 +++------ console.h | 6 ++---- hw/vmware_vga.c | 4 ++-- ui/sdl.c | 4 ++-- ui/spice-display.c | 4 ++-- ui/vnc.c | 4 ++-- 6 files changed, 13 insertions(+), 18 deletions(-) diff --git a/console.c b/console.c index 135394f..1085b07 100644 --- a/console.c +++ b/console.c @@ -1363,12 +1363,9 @@ static void dumb_display_init(void) void register_displaystate(DisplayState *ds) { - DisplayState **s; - s = &display_state; - while (*s != NULL) - s = &(*s)->next; - ds->next = NULL; - *s = ds; + if (display_state == NULL) { + display_state = ds; + } } DisplayState *get_displaystate(void) diff --git a/console.h b/console.h index 9466886..e78b359 100644 --- a/console.h +++ b/console.h @@ -179,10 +179,8 @@ struct DisplayState { struct DisplayAllocator* allocator; struct DisplayChangeListener* listeners; - void (*mouse_set)(int x, int y, int on); - void (*cursor_define)(QEMUCursor *cursor); - - struct DisplayState *next; + void (*mouse_set)(DisplayState *ds, int x, int y, int on); + void (*cursor_define)(DisplayState *ds, QEMUCursor *cursor); }; void register_displaystate(DisplayState *ds); diff --git a/hw/vmware_vga.c b/hw/vmware_vga.c index b1885c3..c379d72 100644 --- a/hw/vmware_vga.c +++ b/hw/vmware_vga.c @@ -480,7 +480,7 @@ static inline void vmsvga_cursor_define(struct vmsvga_state_s *s, } if (s->vga.ds->cursor_define) - s->vga.ds->cursor_define(qc); + s->vga.ds->cursor_define(s->vga.ds, qc); cursor_put(qc); } #endif @@ -905,7 +905,7 @@ static void vmsvga_value_write(void *opaque, uint32_t address, uint32_t value) s->cursor.on &= (value != SVGA_CURSOR_ON_HIDE); #ifdef HW_MOUSE_ACCEL if (s->vga.ds->mouse_set && value <= SVGA_CURSOR_ON_SHOW) - s->vga.ds->mouse_set(s->cursor.x, s->cursor.y, s->cursor.on); + s->vga.ds->mouse_set(s->vga.ds, s->cursor.x, s->cursor.y, s->cursor.on); #endif break; diff --git a/ui/sdl.c b/ui/sdl.c index 8cafc44..0040ad2 100644 --- a/ui/sdl.c +++ b/ui/sdl.c @@ -905,7 +905,7 @@ static void sdl_fill(DisplayState *ds, int x, int y, int w, int h, uint32_t c) SDL_FillRect(real_screen, &dst, c); } -static void sdl_mouse_warp(int x, int y, int on) +static void sdl_mouse_warp(DisplayState *ds, int x, int y, int on) { if (on) { if (!guest_cursor) @@ -921,7 +921,7 @@ static void sdl_mouse_warp(int x, int y, int on) guest_x = x, guest_y = y; } -static void sdl_mouse_define(QEMUCursor *c) +static void sdl_mouse_define(DisplayState *ds, QEMUCursor *c) { uint8_t *image, *mask; int bpl; diff --git a/ui/spice-display.c b/ui/spice-display.c index 6c302a3..3d1d5b0 100644 --- a/ui/spice-display.c +++ b/ui/spice-display.c @@ -328,12 +328,12 @@ void qemu_spice_display_refresh(SimpleSpiceDisplay *ssd) ssd->notify++; } if (ssd->cursor) { - ssd->ds->cursor_define(ssd->cursor); + ssd->ds->cursor_define(ssd->ds, ssd->cursor); cursor_put(ssd->cursor); ssd->cursor = NULL; } if (ssd->mouse_x != -1 && ssd->mouse_y != -1) { - ssd->ds->mouse_set(ssd->mouse_x, ssd->mouse_y, 1); + ssd->ds->mouse_set(ssd->ds->ssd->mouse_x, ssd->mouse_y, 1); ssd->mouse_x = -1; ssd->mouse_y = -1; } diff --git a/ui/vnc.c b/ui/vnc.c index 1869a7a..3f3d8c3 100644 --- a/ui/vnc.c +++ b/ui/vnc.c @@ -779,7 +779,7 @@ static void vnc_dpy_copy(DisplayState *ds, int src_x, int src_y, int dst_x, int } } -static void vnc_mouse_set(int x, int y, int visible) +static void vnc_mouse_set(DisplayState *ds, int x, int y, int visible) { /* can we ask the client(s) to move the pointer ??? */ } @@ -806,7 +806,7 @@ static int vnc_cursor_define(VncState *vs) return -1; } -static void vnc_dpy_cursor_define(QEMUCursor *c) +static void vnc_dpy_cursor_define(DisplayState *ds, QEMUCursor *c) { VncDisplay *vd = vnc_display; VncState *vs;