summaryrefslogtreecommitdiff
path: root/ui/cocoa.m
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2012-11-13 14:51:41 +0100
committerGerd Hoffmann <kraxel@redhat.com>2013-03-18 10:21:58 +0100
commit7c20b4a374d0016e3fce005690fb428354a56621 (patch)
treee2cd1af910a6e226a1cc8d4d3f6d933a02e58c58 /ui/cocoa.m
parent225dc991b03f0f034aa348f5cf499de9d0979107 (diff)
downloadqemu-7c20b4a374d0016e3fce005690fb428354a56621.tar.gz
console: fix displaychangelisteners interface
Split callbacks into separate Ops struct. Pass DisplayChangeListener pointer as first argument to all callbacks. Uninline a bunch of display functions and move them from console.h to console.c Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'ui/cocoa.m')
-rw-r--r--ui/cocoa.m26
1 files changed, 17 insertions, 9 deletions
diff --git a/ui/cocoa.m b/ui/cocoa.m
index ca42413b34..b1fb30e7f9 100644
--- a/ui/cocoa.m
+++ b/ui/cocoa.m
@@ -969,7 +969,9 @@ int main (int argc, const char * argv[]) {
#pragma mark qemu
-static void cocoa_update(DisplayState *ds, int x, int y, int w, int h)
+static void cocoa_update(DisplayChangeListener *dcl,
+ DisplayState *ds,
+ int x, int y, int w, int h)
{
COCOA_DEBUG("qemu_cocoa: cocoa_update\n");
@@ -986,14 +988,16 @@ static void cocoa_update(DisplayState *ds, int x, int y, int w, int h)
[cocoaView setNeedsDisplayInRect:rect];
}
-static void cocoa_resize(DisplayState *ds)
+static void cocoa_resize(DisplayChangeListener *dcl,
+ DisplayState *ds)
{
COCOA_DEBUG("qemu_cocoa: cocoa_resize\n");
[cocoaView resizeContentToWidth:(int)(ds_get_width(ds)) height:(int)(ds_get_height(ds)) displayState:ds];
}
-static void cocoa_refresh(DisplayState *ds)
+static void cocoa_refresh(DisplayChangeListener *dcl,
+ DisplayState *ds)
{
COCOA_DEBUG("qemu_cocoa: cocoa_refresh\n");
@@ -1030,6 +1034,14 @@ static void cocoa_cleanup(void)
g_free(dcl);
}
+static const DisplayChangeListenerOps dcl_ops = {
+ .dpy_name = "cocoa",
+ .dpy_gfx_update = cocoa_update;
+ .dpy_gfx_resize = cocoa_resize;
+ .dpy_gfx_setdata = cocoa_setdata;
+ .dpy_refresh = cocoa_refresh;
+};
+
void cocoa_display_init(DisplayState *ds, int full_screen)
{
COCOA_DEBUG("qemu_cocoa: cocoa_display_init\n");
@@ -1037,12 +1049,8 @@ void cocoa_display_init(DisplayState *ds, int full_screen)
dcl = g_malloc0(sizeof(DisplayChangeListener));
// register vga output callbacks
- dcl->dpy_gfx_update = cocoa_update;
- dcl->dpy_gfx_resize = cocoa_resize;
- dcl->dpy_refresh = cocoa_refresh;
- dcl->dpy_gfx_setdata = cocoa_setdata;
-
- register_displaychangelistener(ds, dcl);
+ dcl->ops = &dcl_ops;
+ register_displaychangelistener(ds, dcl);
// register cleanup function
atexit(cocoa_cleanup);