From patchwork Wed Mar 20 09:43:43 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 229285 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 487F32C0091 for ; Wed, 20 Mar 2013 20:47:59 +1100 (EST) Received: from localhost ([::1]:43218 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UIFcj-0001FU-GN for incoming@patchwork.ozlabs.org; Wed, 20 Mar 2013 05:47:57 -0400 Received: from eggs.gnu.org ([208.118.235.92]:38143) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UIFYr-0004AY-DB for qemu-devel@nongnu.org; Wed, 20 Mar 2013 05:44:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UIFYl-0005oB-Jb for qemu-devel@nongnu.org; Wed, 20 Mar 2013 05:43:57 -0400 Received: from mx1.redhat.com ([209.132.183.28]:31674) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UIFYl-0005nM-9d for qemu-devel@nongnu.org; Wed, 20 Mar 2013 05:43:51 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r2K9honu029805 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 20 Mar 2013 05:43:50 -0400 Received: from rincewind.home.kraxel.org (ovpn-116-26.ams2.redhat.com [10.36.116.26]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r2K9hld6029556; Wed, 20 Mar 2013 05:43:49 -0400 Received: by rincewind.home.kraxel.org (Postfix, from userid 500) id ECCB845BF6; Wed, 20 Mar 2013 10:43:47 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Wed, 20 Mar 2013 10:43:43 +0100 Message-Id: <1363772625-9182-22-git-send-email-kraxel@redhat.com> In-Reply-To: <1363772625-9182-1-git-send-email-kraxel@redhat.com> References: <1363772625-9182-1-git-send-email-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Anthony Liguori , Gerd Hoffmann Subject: [Qemu-devel] [PATCH 21/23] gtk: custom cursor support 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 Makes gtk ui play nicely with qxl (and vmware_svga) as you can actually see your pointer now ;) Signed-off-by: Gerd Hoffmann --- ui/gtk.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/ui/gtk.c b/ui/gtk.c index 7599ff4..512e974 100644 --- a/ui/gtk.c +++ b/ui/gtk.c @@ -303,6 +303,29 @@ static void gd_refresh(DisplayChangeListener *dcl) graphic_hw_update(dcl->con); } +static void gd_mouse_set(DisplayChangeListener *dcl, + int x, int y, int visible) +{ + /* should warp pointer to x, y here */ +} + +static void gd_cursor_define(DisplayChangeListener *dcl, + QEMUCursor *c) +{ + GtkDisplayState *s = container_of(dcl, GtkDisplayState, dcl); + GdkPixbuf *pixbuf; + GdkCursor *cursor; + + pixbuf = gdk_pixbuf_new_from_data((guchar *)(c->data), + GDK_COLORSPACE_RGB, true, 8, + c->width, c->height, c->width * 4, + NULL, NULL); + cursor = gdk_cursor_new_from_pixbuf(gdk_display_get_default(), + pixbuf, c->hot_x, c->hot_y); + gdk_window_set_cursor(s->drawing_area->window, cursor); + g_object_unref(pixbuf); +} + static void gd_switch(DisplayChangeListener *dcl, DisplaySurface *surface) { @@ -1309,6 +1332,8 @@ static const DisplayChangeListenerOps dcl_ops = { .dpy_gfx_update = gd_update, .dpy_gfx_switch = gd_switch, .dpy_refresh = gd_refresh, + .dpy_mouse_set = gd_mouse_set, + .dpy_cursor_define = gd_cursor_define, }; void gtk_display_init(DisplayState *ds)