aboutsummaryrefslogtreecommitdiff
path: root/ui/cocoa.m
diff options
context:
space:
mode:
authorFathi Boudra <fathi.boudra@linaro.org>2013-03-30 21:18:24 +0200
committerFathi Boudra <fathi.boudra@linaro.org>2013-03-30 21:18:24 +0200
commit050a840ead5e51a1a9f3bffe89cc89077b2f35ed (patch)
tree36d8e48e23b64a07a914b3b34d568c747915b560 /ui/cocoa.m
parent17d4e9b1e2d6d32da51278a4165621af99bade02 (diff)
Imported Upstream version 1.4.0-2013.03upstream/1.4.0-2013.03
Diffstat (limited to 'ui/cocoa.m')
-rw-r--r--ui/cocoa.m31
1 files changed, 26 insertions, 5 deletions
diff --git a/ui/cocoa.m b/ui/cocoa.m
index 87d2e44..ca42413 100644
--- a/ui/cocoa.m
+++ b/ui/cocoa.m
@@ -26,8 +26,8 @@
#include <crt_externs.h>
#include "qemu-common.h"
-#include "console.h"
-#include "sysemu.h"
+#include "ui/console.h"
+#include "sysemu/sysemu.h"
#ifndef MAC_OS_X_VERSION_10_4
#define MAC_OS_X_VERSION_10_4 1040
@@ -265,6 +265,7 @@ static int cocoa_keycode_to_qemu(int keycode)
BOOL isTabletEnabled;
}
- (void) resizeContentToWidth:(int)w height:(int)h displayState:(DisplayState *)ds;
+- (void) updateDataOffset:(DisplayState *)ds;
- (void) grabMouse;
- (void) ungrabMouse;
- (void) toggleFullScreen:(id)sender;
@@ -429,6 +430,20 @@ QemuCocoaView *cocoaView;
[self setFrame:NSMakeRect(cx, cy, cw, ch)];
}
+- (void) updateDataOffset:(DisplayState *)ds
+{
+ COCOA_DEBUG("QemuCocoaView: UpdateDataOffset\n");
+
+ // update screenBuffer
+ if (dataProviderRef) {
+ CGDataProviderRelease(dataProviderRef);
+ }
+
+ size_t size = ds_get_width(ds) * 4 * ds_get_height(ds);
+ dataProviderRef = CGDataProviderCreateWithData(NULL, ds_get_data(ds),
+ size, NULL);
+}
+
- (void) toggleFullScreen:(id)sender
{
COCOA_DEBUG("QemuCocoaView: toggleFullScreen\n");
@@ -813,9 +828,9 @@ QemuCocoaView *cocoaView;
[sheet close];
- asprintf(&argv[0], "%s", bin);
- asprintf(&argv[1], "-hda");
- asprintf(&argv[2], "%s", img);
+ argv[0] = g_strdup_printf("%s", bin);
+ argv[1] = g_strdup_printf("-hda");
+ argv[2] = g_strdup_printf("%s", img);
printf("Using argc %d argv %s -hda %s\n", 3, bin, img);
@@ -1004,6 +1019,11 @@ static void cocoa_refresh(DisplayState *ds)
vga_hw_update();
}
+static void cocoa_setdata(DisplayState *ds)
+{
+ [cocoaView updateDataOffset:ds];
+}
+
static void cocoa_cleanup(void)
{
COCOA_DEBUG("qemu_cocoa: cocoa_cleanup\n");
@@ -1020,6 +1040,7 @@ void cocoa_display_init(DisplayState *ds, int full_screen)
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);