summaryrefslogtreecommitdiff
path: root/ui/gtk.c
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2013-02-28 11:34:31 +0100
committerGerd Hoffmann <kraxel@redhat.com>2013-03-18 10:21:58 +0100
commit21ef45d71221b4577330fe3aacfb06afad91ad46 (patch)
tree80e7115e65cce66068a720a1247ad2939066bf57 /ui/gtk.c
parent7c20b4a374d0016e3fce005690fb428354a56621 (diff)
downloadqemu-21ef45d71221b4577330fe3aacfb06afad91ad46.tar.gz
console: kill DisplayState->opaque
It's broken by design. There can be multiple DisplayChangeListener instances, so they simply can't store state in the (single) DisplayState struct. Try 'qemu -display gtk -vnc :0', watch it crash & burn. With DisplayChangeListenerOps having a more sane interface now we can simply use the DisplayChangeListener pointer to get access to our private data instead. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'ui/gtk.c')
-rw-r--r--ui/gtk.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/ui/gtk.c b/ui/gtk.c
index 379107f0de..b21a94a335 100644
--- a/ui/gtk.c
+++ b/ui/gtk.c
@@ -230,7 +230,7 @@ static void gd_update_caption(GtkDisplayState *s)
static void gd_update(DisplayChangeListener *dcl,
DisplayState *ds, int x, int y, int w, int h)
{
- GtkDisplayState *s = ds->opaque;
+ GtkDisplayState *s = container_of(dcl, GtkDisplayState, dcl);
int x1, x2, y1, y2;
int mx, my;
int fbw, fbh;
@@ -269,7 +269,7 @@ static void gd_refresh(DisplayChangeListener *dcl,
static void gd_resize(DisplayChangeListener *dcl,
DisplayState *ds)
{
- GtkDisplayState *s = ds->opaque;
+ GtkDisplayState *s = container_of(dcl, GtkDisplayState, dcl);
cairo_format_t kind;
int stride;
@@ -1297,7 +1297,6 @@ void gtk_display_init(DisplayState *ds)
gtk_init(NULL, NULL);
- ds->opaque = s;
s->ds = ds;
s->dcl.ops = &dcl_ops;