From: Dave Airlie <airlied@gmail.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH 2/8] console: add state notifiers for ui<->display
Date: Wed, 20 Nov 2013 15:52:35 +1000 [thread overview]
Message-ID: <1384926761-9962-3-git-send-email-airlied@gmail.com> (raw)
In-Reply-To: <1384926761-9962-1-git-send-email-airlied@gmail.com>
From: Dave Airlie <airlied@redhat.com>
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 <airlied@redhat.com>
---
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
next prev parent reply other threads:[~2013-11-20 5:53 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-20 5:52 [Qemu-devel] [RFC] virtio-gpu and sdl2 so far Dave Airlie
2013-11-20 5:52 ` [Qemu-devel] [PATCH 1/8] ui/sdl2 : initial port to SDL 2.0 (v1.2) Dave Airlie
2013-11-20 10:52 ` Gerd Hoffmann
2013-11-20 5:52 ` Dave Airlie [this message]
2013-11-20 11:04 ` [Qemu-devel] [PATCH 2/8] console: add state notifiers for ui<->display Gerd Hoffmann
2013-11-20 5:52 ` [Qemu-devel] [PATCH 3/8] console: add information retrival wrappers Dave Airlie
2013-11-20 11:12 ` Gerd Hoffmann
2013-11-20 5:52 ` [Qemu-devel] [PATCH 4/8] console: add ability to wrap a console Dave Airlie
2013-11-20 5:52 ` [Qemu-devel] [PATCH 5/8] sdl2: update for multihead support Dave Airlie
2013-11-20 5:52 ` [Qemu-devel] [PATCH 6/8] virtio-gpu: v0.1 of the virtio based GPU code Dave Airlie
2013-11-20 11:26 ` Gerd Hoffmann
2013-11-20 5:52 ` [Qemu-devel] [PATCH 7/8] virtio-vga: v1 Dave Airlie
2013-11-20 12:02 ` Gerd Hoffmann
2013-11-21 3:12 ` Dave Airlie
2013-11-21 6:17 ` Paolo Bonzini
2013-11-21 11:06 ` Gerd Hoffmann
2013-12-06 5:24 ` Dave Airlie
2013-12-06 8:24 ` Gerd Hoffmann
2013-12-06 8:58 ` Dave Airlie
2014-01-07 23:35 ` Dave Airlie
2014-01-13 8:01 ` Gerd Hoffmann
2013-11-20 5:52 ` [Qemu-devel] [PATCH 8/8] HACK: just to make things start easier with libvirt Dave Airlie
-- strict thread matches above, loose matches on Subject: below --
2013-12-10 4:05 [Qemu-devel] [RFC] sdl2 + virtio-gpu repost Dave Airlie
2013-12-10 4:05 ` [Qemu-devel] [PATCH 2/8] console: add state notifiers for ui<->display Dave Airlie
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1384926761-9962-3-git-send-email-airlied@gmail.com \
--to=airlied@gmail.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).