提交 5e00d3ac 编写于 作者: G Gerd Hoffmann

cocoa: stop using DisplayState

Rework DisplayStateListener callbacks to not use the DisplayState
any more.
Signed-off-by: NGerd Hoffmann <kraxel@redhat.com>
上级 71874c17
...@@ -264,8 +264,7 @@ static int cocoa_keycode_to_qemu(int keycode) ...@@ -264,8 +264,7 @@ static int cocoa_keycode_to_qemu(int keycode)
BOOL isAbsoluteEnabled; BOOL isAbsoluteEnabled;
BOOL isTabletEnabled; BOOL isTabletEnabled;
} }
- (void) resizeContentToWidth:(int)w height:(int)h displayState:(DisplayState *)ds; - (void) switchSurface:(DisplaySurface *)surface;
- (void) updateDataOffset:(DisplayState *)ds;
- (void) grabMouse; - (void) grabMouse;
- (void) ungrabMouse; - (void) ungrabMouse;
- (void) toggleFullScreen:(id)sender; - (void) toggleFullScreen:(id)sender;
...@@ -400,19 +399,19 @@ QemuCocoaView *cocoaView; ...@@ -400,19 +399,19 @@ QemuCocoaView *cocoaView;
} }
} }
- (void) resizeContentToWidth:(int)w height:(int)h displayState:(DisplayState *)ds - (void) switchSurface:(DisplaySurface *)surface
{ {
COCOA_DEBUG("QemuCocoaView: resizeContent\n"); COCOA_DEBUG("QemuCocoaView: switchSurface\n");
// update screenBuffer // update screenBuffer
if (dataProviderRef) if (dataProviderRef)
CGDataProviderRelease(dataProviderRef); CGDataProviderRelease(dataProviderRef);
//sync host window color space with guests //sync host window color space with guests
screen.bitsPerPixel = ds_get_bits_per_pixel(ds); screen.bitsPerPixel = surface_bits_per_pixel(surface);
screen.bitsPerComponent = ds_get_bytes_per_pixel(ds) * 2; screen.bitsPerComponent = surface_bytes_per_pixel(surface) * 2;
dataProviderRef = CGDataProviderCreateWithData(NULL, ds_get_data(ds), w * 4 * h, NULL); dataProviderRef = CGDataProviderCreateWithData(NULL, surface_data(surface), w * 4 * h, NULL);
// update windows // update windows
if (isFullscreen) { if (isFullscreen) {
...@@ -430,20 +429,6 @@ QemuCocoaView *cocoaView; ...@@ -430,20 +429,6 @@ 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");
...@@ -970,7 +955,7 @@ int main (int argc, const char * argv[]) { ...@@ -970,7 +955,7 @@ int main (int argc, const char * argv[]) {
#pragma mark qemu #pragma mark qemu
static void cocoa_update(DisplayChangeListener *dcl, static void cocoa_update(DisplayChangeListener *dcl,
DisplayState *ds, DisplayState *dontuse,
int x, int y, int w, int h) int x, int y, int w, int h)
{ {
COCOA_DEBUG("qemu_cocoa: cocoa_update\n"); COCOA_DEBUG("qemu_cocoa: cocoa_update\n");
...@@ -989,16 +974,16 @@ static void cocoa_update(DisplayChangeListener *dcl, ...@@ -989,16 +974,16 @@ static void cocoa_update(DisplayChangeListener *dcl,
} }
static void cocoa_switch(DisplayChangeListener *dcl, static void cocoa_switch(DisplayChangeListener *dcl,
DisplayState *ds, DisplayState *dontuse,
DisplaySurface *surface) DisplaySurface *surface)
{ {
COCOA_DEBUG("qemu_cocoa: cocoa_resize\n"); COCOA_DEBUG("qemu_cocoa: cocoa_resize\n");
[cocoaView resizeContentToWidth:(int)(ds_get_width(ds)) height:(int)(ds_get_height(ds)) displayState:ds]; [cocoaView switchSurface:surface];
} }
static void cocoa_refresh(DisplayChangeListener *dcl, static void cocoa_refresh(DisplayChangeListener *dcl,
DisplayState *ds) DisplayState *dontuse)
{ {
COCOA_DEBUG("qemu_cocoa: cocoa_refresh\n"); COCOA_DEBUG("qemu_cocoa: cocoa_refresh\n");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册