mirror of
https://gitlab.com/qemu-project/qemu
synced 2024-09-06 18:05:37 +00:00
spice: zap sdpy global
DisplayChangeListener is passed now to all DisplayChangeListenerOps callbacks, so we can use that to access the spice display state and kill the sdpy global variable. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
This commit is contained in:
parent
21ef45d712
commit
9c80a315b4
|
@ -581,25 +581,26 @@ static const QXLInterface dpy_interface = {
|
||||||
.client_monitors_config = interface_client_monitors_config,
|
.client_monitors_config = interface_client_monitors_config,
|
||||||
};
|
};
|
||||||
|
|
||||||
static SimpleSpiceDisplay sdpy;
|
|
||||||
|
|
||||||
static void display_update(DisplayChangeListener *dcl,
|
static void display_update(DisplayChangeListener *dcl,
|
||||||
struct DisplayState *ds,
|
struct DisplayState *ds,
|
||||||
int x, int y, int w, int h)
|
int x, int y, int w, int h)
|
||||||
{
|
{
|
||||||
qemu_spice_display_update(&sdpy, x, y, w, h);
|
SimpleSpiceDisplay *ssd = container_of(dcl, SimpleSpiceDisplay, dcl);
|
||||||
|
qemu_spice_display_update(ssd, x, y, w, h);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void display_resize(DisplayChangeListener *dcl,
|
static void display_resize(DisplayChangeListener *dcl,
|
||||||
struct DisplayState *ds)
|
struct DisplayState *ds)
|
||||||
{
|
{
|
||||||
qemu_spice_display_resize(&sdpy);
|
SimpleSpiceDisplay *ssd = container_of(dcl, SimpleSpiceDisplay, dcl);
|
||||||
|
qemu_spice_display_resize(ssd);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void display_refresh(DisplayChangeListener *dcl,
|
static void display_refresh(DisplayChangeListener *dcl,
|
||||||
struct DisplayState *ds)
|
struct DisplayState *ds)
|
||||||
{
|
{
|
||||||
qemu_spice_display_refresh(&sdpy);
|
SimpleSpiceDisplay *ssd = container_of(dcl, SimpleSpiceDisplay, dcl);
|
||||||
|
qemu_spice_display_refresh(ssd);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const DisplayChangeListenerOps display_listener_ops = {
|
static const DisplayChangeListenerOps display_listener_ops = {
|
||||||
|
@ -611,16 +612,17 @@ static const DisplayChangeListenerOps display_listener_ops = {
|
||||||
|
|
||||||
void qemu_spice_display_init(DisplayState *ds)
|
void qemu_spice_display_init(DisplayState *ds)
|
||||||
{
|
{
|
||||||
assert(sdpy.ds == NULL);
|
SimpleSpiceDisplay *ssd = g_new0(SimpleSpiceDisplay, 1);
|
||||||
qemu_spice_display_init_common(&sdpy, ds);
|
|
||||||
|
|
||||||
sdpy.qxl.base.sif = &dpy_interface.base;
|
qemu_spice_display_init_common(ssd, ds);
|
||||||
qemu_spice_add_interface(&sdpy.qxl.base);
|
|
||||||
assert(sdpy.worker);
|
|
||||||
|
|
||||||
qemu_spice_create_host_memslot(&sdpy);
|
ssd->qxl.base.sif = &dpy_interface.base;
|
||||||
qemu_spice_create_host_primary(&sdpy);
|
qemu_spice_add_interface(&ssd->qxl.base);
|
||||||
|
assert(ssd->worker);
|
||||||
|
|
||||||
sdpy.dcl.ops = &display_listener_ops;
|
qemu_spice_create_host_memslot(ssd);
|
||||||
register_displaychangelistener(ds, &sdpy.dcl);
|
qemu_spice_create_host_primary(ssd);
|
||||||
|
|
||||||
|
ssd->dcl.ops = &display_listener_ops;
|
||||||
|
register_displaychangelistener(ds, &ssd->dcl);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue