qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 2/8] console: add state notifiers for ui<->display


From: Dave Airlie
Subject: [Qemu-devel] [PATCH 2/8] console: add state notifiers for ui<->display
Date: Tue, 10 Dec 2013 14:05:52 +1000

From: Dave Airlie <address@hidden>

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 <address@hidden>
---
 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 4156a87..f6e8957 100644
--- a/include/ui/console.h
+++ b/include/ui/console.h
@@ -173,6 +173,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 {
@@ -223,7 +226,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);
@@ -274,6 +278,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,
@@ -283,6 +288,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 502e160..def11ea 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)
 {
@@ -1525,6 +1535,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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]