From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46416) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vj0id-000689-EG for qemu-devel@nongnu.org; Wed, 20 Nov 2013 00:53:01 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Vj0iW-0002QU-37 for qemu-devel@nongnu.org; Wed, 20 Nov 2013 00:52:55 -0500 Received: from mx1.redhat.com ([209.132.183.28]:51302) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vj0iV-0002QJ-RG for qemu-devel@nongnu.org; Wed, 20 Nov 2013 00:52:48 -0500 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id rAK5ql4C009746 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 20 Nov 2013 00:52:47 -0500 Received: from dreadlord-bne-redhat-com.bne.redhat.com (dhcp-40-7.bne.redhat.com [10.64.40.7]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id rAK5qgkG022518 for ; Wed, 20 Nov 2013 00:52:46 -0500 From: Dave Airlie Date: Wed, 20 Nov 2013 15:52:35 +1000 Message-Id: <1384926761-9962-3-git-send-email-airlied@gmail.com> In-Reply-To: <1384926761-9962-1-git-send-email-airlied@gmail.com> References: <1384926761-9962-1-git-send-email-airlied@gmail.com> Subject: [Qemu-devel] [PATCH 2/8] console: add state notifiers for ui<->display List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org From: Dave Airlie These are to be used for the UI to signal the video display, and vice-versa about changes in the state of a console, like size and offsets in relation to other consoles for input handling. Signed-off-by: Dave Airlie --- include/ui/console.h | 8 +++++++- ui/console.c | 26 ++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/include/ui/console.h b/include/ui/console.h index 98edf41..5731081 100644 --- a/include/ui/console.h +++ b/include/ui/console.h @@ -174,6 +174,9 @@ typedef struct DisplayChangeListenerOps { int x, int y, int on); void (*dpy_cursor_define)(DisplayChangeListener *dcl, QEMUCursor *cursor); + + void (*dpy_notify_state)(DisplayChangeListener *dcl, + int x, int y, uint32_t width, uint32_t height); } DisplayChangeListenerOps; struct DisplayChangeListener { @@ -224,7 +227,8 @@ void dpy_text_resize(QemuConsole *con, int w, int h); void dpy_mouse_set(QemuConsole *con, int x, int y, int on); void dpy_cursor_define(QemuConsole *con, QEMUCursor *cursor); bool dpy_cursor_define_supported(QemuConsole *con); - +void dpy_notify_state(QemuConsole *con, int x, int y, + uint32_t width, uint32_t height); static inline int surface_stride(DisplaySurface *s) { return pixman_image_get_stride(s->image); @@ -275,6 +279,7 @@ typedef struct GraphicHwOps { void (*gfx_update)(void *opaque); void (*text_update)(void *opaque, console_ch_t *text); void (*update_interval)(void *opaque, uint64_t interval); + void (*notify_state)(void *opaque, int idx, int x, int y, uint32_t width, uint32_t height); } GraphicHwOps; QemuConsole *graphic_console_init(DeviceState *dev, @@ -284,6 +289,7 @@ QemuConsole *graphic_console_init(DeviceState *dev, void graphic_hw_update(QemuConsole *con); void graphic_hw_invalidate(QemuConsole *con); void graphic_hw_text_update(QemuConsole *con, console_ch_t *chardata); +void graphic_hw_notify_state(QemuConsole *con, int x, int y, uint32_t width, uint32_t height); QemuConsole *qemu_console_lookup_by_index(unsigned int index); QemuConsole *qemu_console_lookup_by_device(DeviceState *dev); diff --git a/ui/console.c b/ui/console.c index aad4fc9..c20e336 100644 --- a/ui/console.c +++ b/ui/console.c @@ -265,6 +265,16 @@ void graphic_hw_invalidate(QemuConsole *con) } } +void graphic_hw_notify_state(QemuConsole *con, int x, int y, uint32_t width, uint32_t height) +{ + if (!con) { + con = active_console; + } + if (con && con->hw_ops->notify_state) { + con->hw_ops->notify_state(con->hw, con->index, x, y, width, height); + } +} + static void ppm_save(const char *filename, struct DisplaySurface *ds, Error **errp) { @@ -1562,6 +1572,22 @@ bool dpy_cursor_define_supported(QemuConsole *con) return false; } +void dpy_notify_state(QemuConsole *con, int x, int y, + uint32_t width, uint32_t height) +{ + DisplayState *s = con->ds; + DisplayChangeListener *dcl; + + QLIST_FOREACH(dcl, &s->listeners, next) { + if (con != (dcl->con ? dcl->con : active_console)) { + continue; + } + if (dcl->ops->dpy_notify_state) { + dcl->ops->dpy_notify_state(dcl, x, y, width, height); + } + } +} + /***********************************************************/ /* register display */ -- 1.8.3.1