提交 2854c549 编写于 作者: A Anthony Liguori

Merge remote-tracking branch 'afaerber-or/cocoa-for-upstream' into staging

# By Henry Harrington (1) and Stefan Weil (1)
# Via Andreas Färber
* afaerber-or/cocoa-for-upstream:
  cocoa: Replace non-portable asprintf() by g_strdup_printf()
  cocoa: Fix VBE function Set Display Start
...@@ -265,6 +265,7 @@ static int cocoa_keycode_to_qemu(int keycode) ...@@ -265,6 +265,7 @@ static int cocoa_keycode_to_qemu(int keycode)
BOOL isTabletEnabled; BOOL isTabletEnabled;
} }
- (void) resizeContentToWidth:(int)w height:(int)h displayState:(DisplayState *)ds; - (void) resizeContentToWidth:(int)w height:(int)h displayState:(DisplayState *)ds;
- (void) updateDataOffset:(DisplayState *)ds;
- (void) grabMouse; - (void) grabMouse;
- (void) ungrabMouse; - (void) ungrabMouse;
- (void) toggleFullScreen:(id)sender; - (void) toggleFullScreen:(id)sender;
...@@ -429,6 +430,20 @@ QemuCocoaView *cocoaView; ...@@ -429,6 +430,20 @@ QemuCocoaView *cocoaView;
[self setFrame:NSMakeRect(cx, cy, cw, ch)]; [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 - (void) toggleFullScreen:(id)sender
{ {
COCOA_DEBUG("QemuCocoaView: toggleFullScreen\n"); COCOA_DEBUG("QemuCocoaView: toggleFullScreen\n");
...@@ -813,9 +828,9 @@ QemuCocoaView *cocoaView; ...@@ -813,9 +828,9 @@ QemuCocoaView *cocoaView;
[sheet close]; [sheet close];
asprintf(&argv[0], "%s", bin); argv[0] = g_strdup_printf("%s", bin);
asprintf(&argv[1], "-hda"); argv[1] = g_strdup_printf("-hda");
asprintf(&argv[2], "%s", img); argv[2] = g_strdup_printf("%s", img);
printf("Using argc %d argv %s -hda %s\n", 3, bin, img); printf("Using argc %d argv %s -hda %s\n", 3, bin, img);
...@@ -1004,6 +1019,11 @@ static void cocoa_refresh(DisplayState *ds) ...@@ -1004,6 +1019,11 @@ static void cocoa_refresh(DisplayState *ds)
vga_hw_update(); vga_hw_update();
} }
static void cocoa_setdata(DisplayState *ds)
{
[cocoaView updateDataOffset:ds];
}
static void cocoa_cleanup(void) static void cocoa_cleanup(void)
{ {
COCOA_DEBUG("qemu_cocoa: cocoa_cleanup\n"); COCOA_DEBUG("qemu_cocoa: cocoa_cleanup\n");
...@@ -1020,6 +1040,7 @@ void cocoa_display_init(DisplayState *ds, int full_screen) ...@@ -1020,6 +1040,7 @@ void cocoa_display_init(DisplayState *ds, int full_screen)
dcl->dpy_gfx_update = cocoa_update; dcl->dpy_gfx_update = cocoa_update;
dcl->dpy_gfx_resize = cocoa_resize; dcl->dpy_gfx_resize = cocoa_resize;
dcl->dpy_refresh = cocoa_refresh; dcl->dpy_refresh = cocoa_refresh;
dcl->dpy_gfx_setdata = cocoa_setdata;
register_displaychangelistener(ds, dcl); register_displaychangelistener(ds, dcl);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册