From: Anthony Liguori <anthony@codemonkey.ws>
To: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] Update cocoa.m to match new DisplayState code
Date: Sat, 24 Jan 2009 11:41:59 -0600 [thread overview]
Message-ID: <497B52E7.9050405@codemonkey.ws> (raw)
In-Reply-To: <3A471E0D-F371-46C4-B0FB-A476D69845CD@digitalescape.info>
Samuel Benson wrote:
> Hello all,
>
> Attached patch is an attempt to update cocoa.m to be in sync with the new
> displaystate changes committed a few weeks back.
>
> Tested working on OS X 10.5.6 on G4 and G5 PPC machines.
>
> Tests and comments welcome.
Can you add a signed-off-by?
Regards,
Anthony Liguori
> ---
>
> cocoa.m | 44 +++++++++++++++++++++++++-------------------
> 1 files changed, 25 insertions(+), 19 deletions(-)
>
> diff --git a/cocoa.m b/cocoa.m
> index fe13952..d4b3df0 100644
> --- a/cocoa.m
> +++ b/cocoa.m
> @@ -58,6 +58,7 @@ int qemu_main(int argc, char **argv); // main
> defined in qemu/vl.c
> NSWindow *normalWindow;
> id cocoaView;
> static void *screenBuffer;
> +static DisplayChangeListener *dcl;
>
> int gArgc;
> char **gArgv;
> @@ -293,7 +294,7 @@ int cocoa_keycode_to_qemu(int keycode)
> COCOA_DEBUG("QemuCocoaView: dealloc\n");
>
> if (screenBuffer)
> - free(screenBuffer);
> + qemu_free(screenBuffer);
>
> if (dataProviderRef)
> CGDataProviderRelease(dataProviderRef);
> @@ -396,18 +397,18 @@ int cocoa_keycode_to_qemu(int keycode)
> if (dataProviderRef)
> CGDataProviderRelease(dataProviderRef);
> if (screenBuffer)
> - free(screenBuffer);
> - screenBuffer = malloc( w * 4 * h );
> -
> - ds->data = screenBuffer;
> - ds->linesize = (w * 4);
> - ds->depth = 32;
> - ds->width = w;
> - ds->height = h;
> + qemu_free(screenBuffer);
> + screenBuffer = qemu_mallocz( w * 4 * h );
> +
> + ds->surface->data = screenBuffer;
> + ds->surface->linesize = (w * 4);
> + ds->surface->pf.depth = 32;
> + ds->surface->width = w;
> + ds->surface->height = h;
> #ifdef __LITTLE_ENDIAN__
> - ds->bgr = 1;
> + ds->surface->flags = 0x00;
> #else
> - ds->bgr = 0;
> + ds->surface->flags = QEMU_BIG_ENDIAN_FLAG;
> #endif
>
> dataProviderRef = CGDataProviderCreateWithData(NULL,
> screenBuffer, w * 4 * h, NULL);
> @@ -939,11 +940,11 @@ static void cocoa_update(DisplayState *ds, int
> x, int y, int w, int h)
> [cocoaView displayRect:rect];
> }
>
> -static void cocoa_resize(DisplayState *ds, int w, int h)
> +static void cocoa_resize(DisplayState *ds)
> {
> COCOA_DEBUG("qemu_cocoa: cocoa_resize\n");
>
> - [cocoaView resizeContentToWidth:w height:h displayState:ds];
> + [cocoaView resizeContentToWidth:(ds_get_width(ds))
> height:(ds_get_height(ds)) displayState:ds];
> }
>
> static void cocoa_refresh(DisplayState *ds)
> @@ -969,26 +970,31 @@ static void cocoa_refresh(DisplayState *ds)
> [cocoaView handleEvent:event];
> }
> } while(event != nil);
> + COCOA_DEBUG("qemu_cocoa: vga_hw_update()\n");
> vga_hw_update();
> }
>
> static void cocoa_cleanup(void)
> {
> COCOA_DEBUG("qemu_cocoa: cocoa_cleanup\n");
> -
> + qemu_free(dcl);
> }
>
> void cocoa_display_init(DisplayState *ds, int full_screen)
> {
> COCOA_DEBUG("qemu_cocoa: cocoa_display_init\n");
>
> - // register vga outpu callbacks
> - ds->dpy_update = cocoa_update;
> - ds->dpy_resize = cocoa_resize;
> - ds->dpy_refresh = cocoa_refresh;
> + dcl = qemu_mallocz(sizeof(DisplayChangeListener));
> +
> + // register vga output callbacks
> + dcl->dpy_update = cocoa_update;
> + dcl->dpy_resize = cocoa_resize;
> + dcl->dpy_refresh = cocoa_refresh;
>
> + register_displaychangelistener(ds, dcl);
> +
> // give window a initial Size
> - cocoa_resize(ds, 640, 400);
> + cocoa_resize(ds);
>
> // register cleanup function
> atexit(cocoa_cleanup);
>
>
>
next prev parent reply other threads:[~2009-01-24 17:42 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-23 22:41 [Qemu-devel] [PATCH] Update cocoa.m to match new DisplayState code Samuel Benson
2009-01-24 15:36 ` Stefano Stabellini
2009-01-24 19:16 ` Samuel Benson
2009-01-24 21:22 ` Alexander Graf
2009-01-25 6:34 ` Samuel Benson
2009-01-26 11:14 ` Stefano Stabellini
2009-01-24 17:41 ` Anthony Liguori [this message]
2009-01-25 21:14 ` C.W. Betts
2009-01-25 21:14 ` C.W. Betts
2009-01-25 21:48 ` Samuel Benson
-- strict thread matches above, loose matches on Subject: below --
2009-01-25 12:25 Christian Brunschen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=497B52E7.9050405@codemonkey.ws \
--to=anthony@codemonkey.ws \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.