qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Gerd Hoffmann <kraxel@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Andreas Färber" <andreas.faerber@web.de>,
	"Gerd Hoffmann" <kraxel@redhat.com>,
	"Anthony Liguori" <aliguori@us.ibm.com>
Subject: [Qemu-devel] [PATCH 14/18] cocoa: stop using DisplayState
Date: Tue, 12 Mar 2013 11:32:45 +0100	[thread overview]
Message-ID: <1363084369-27517-15-git-send-email-kraxel@redhat.com> (raw)
In-Reply-To: <1363084369-27517-1-git-send-email-kraxel@redhat.com>

Rework DisplayStateListener callbacks to not use the DisplayState
any more.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 ui/cocoa.m |   35 ++++++++++-------------------------
 1 file changed, 10 insertions(+), 25 deletions(-)

diff --git a/ui/cocoa.m b/ui/cocoa.m
index 73843f4..9a56fb8 100644
--- a/ui/cocoa.m
+++ b/ui/cocoa.m
@@ -264,8 +264,7 @@ static int cocoa_keycode_to_qemu(int keycode)
     BOOL isAbsoluteEnabled;
     BOOL isTabletEnabled;
 }
-- (void) resizeContentToWidth:(int)w height:(int)h displayState:(DisplayState *)ds;
-- (void) updateDataOffset:(DisplayState *)ds;
+- (void) switchSurface:(DisplaySurface *)surface;
 - (void) grabMouse;
 - (void) ungrabMouse;
 - (void) toggleFullScreen:(id)sender;
@@ -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
     if (dataProviderRef)
         CGDataProviderRelease(dataProviderRef);
 
     //sync host window color space with guests
-	screen.bitsPerPixel = ds_get_bits_per_pixel(ds);
-	screen.bitsPerComponent = ds_get_bytes_per_pixel(ds) * 2;
+	screen.bitsPerPixel = surface_bits_per_pixel(surface);
+	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
     if (isFullscreen) {
@@ -430,20 +429,6 @@ 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");
@@ -970,7 +955,7 @@ int main (int argc, const char * argv[]) {
 
 #pragma mark qemu
 static void cocoa_update(DisplayChangeListener *dcl,
-                         DisplayState *ds,
+                         DisplayState *dontuse,
                          int x, int y, int w, int h)
 {
     COCOA_DEBUG("qemu_cocoa: cocoa_update\n");
@@ -989,16 +974,16 @@ static void cocoa_update(DisplayChangeListener *dcl,
 }
 
 static void cocoa_switch(DisplayChangeListener *dcl,
-                         DisplayState *ds,
+                         DisplayState *dontuse,
                          DisplaySurface *surface)
 {
     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,
-                          DisplayState *ds)
+                          DisplayState *dontuse)
 {
     COCOA_DEBUG("qemu_cocoa: cocoa_refresh\n");
 
-- 
1.7.9.7

  parent reply	other threads:[~2013-03-12 10:34 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-12 10:32 [Qemu-devel] [PATCH 00/18] console: data structures overhaul Gerd Hoffmann
2013-03-12 10:32 ` [Qemu-devel] [PATCH 01/18] console: fix displaychangelisteners interface Gerd Hoffmann
2013-03-18 17:49   ` Niel van der Westhuizen
2013-03-18 18:00   ` Peter Maydell
2013-03-12 10:32 ` [Qemu-devel] [PATCH 02/18] console: kill DisplayState->opaque Gerd Hoffmann
2013-03-12 10:32 ` [Qemu-devel] [PATCH 03/18] spice: zap sdpy global Gerd Hoffmann
2013-03-12 10:32 ` [Qemu-devel] [PATCH 04/18] qxl: zap qxl0 global Gerd Hoffmann
2013-03-12 10:32 ` [Qemu-devel] [PATCH 05/18] qxl: better vga init in enter_vga_mode Gerd Hoffmann
2013-03-12 10:32 ` [Qemu-devel] [PATCH 06/18] sdl: drop dead code Gerd Hoffmann
2013-03-12 10:32 ` [Qemu-devel] [PATCH 07/18] console: rework DisplaySurface handling [vga emu side] Gerd Hoffmann
2013-03-12 10:32 ` [Qemu-devel] [PATCH 08/18] console: rework DisplaySurface handling [dcl/ui side] Gerd Hoffmann
2013-03-12 10:32 ` [Qemu-devel] [PATCH 09/18] console: add surface_*() getters Gerd Hoffmann
2013-03-12 10:32 ` [Qemu-devel] [PATCH 10/18] gtk: stop using DisplayState Gerd Hoffmann
2013-03-12 10:32 ` [Qemu-devel] [PATCH 11/18] vnc: " Gerd Hoffmann
2013-03-12 10:32 ` [Qemu-devel] [PATCH 12/18] sdl: " Gerd Hoffmann
2013-03-12 10:32 ` [Qemu-devel] [PATCH 13/18] spice: " Gerd Hoffmann
2013-03-12 10:32 ` Gerd Hoffmann [this message]
2013-03-12 10:32 ` [Qemu-devel] [PATCH 15/18] console: zap displaystate from dcl callbacks Gerd Hoffmann
2013-03-12 10:32 ` [Qemu-devel] [PATCH 16/18] console: stop using DisplayState in gfx hardware emulation Gerd Hoffmann
2013-03-25  7:50   ` Jan Kiszka
2013-03-25  7:55     ` Gerd Hoffmann
2013-03-25  7:59       ` Jan Kiszka
2013-03-25  8:21         ` Gerd Hoffmann
2013-03-25  8:28           ` Jan Kiszka
2013-03-25  8:39             ` Gerd Hoffmann
2013-03-25  8:40               ` Jan Kiszka
2013-03-25  9:10                 ` Gerd Hoffmann
2013-03-25  9:32                   ` Jan Kiszka
2013-03-25  9:48                     ` Gerd Hoffmann
2013-03-25  9:55                       ` Jan Kiszka
2013-03-25 10:00                         ` Jan Kiszka
2013-03-25 10:37                           ` Gerd Hoffmann
     [not found]                             ` <5150572D.6090201@gmail.com>
2013-03-25 13:56                               ` Igor Mitsyanko
2013-03-25 20:30                                 ` Gerd Hoffmann
2013-03-26  0:02                                   ` BALATON Zoltan
2013-03-26  8:26                                   ` Jan Kiszka
2013-04-03 11:50                                     ` Gerd Hoffmann
2013-04-10  8:31                                       ` Jan Kiszka
2013-04-16  7:42                                         ` Gerd Hoffmann
2013-04-20 14:04                                           ` Jan Kiszka
2013-03-12 10:32 ` [Qemu-devel] [PATCH 17/18] console: zap color_table Gerd Hoffmann
2013-03-12 10:32 ` [Qemu-devel] [PATCH 18/18] console: remove ds_get_* helper functions Gerd Hoffmann

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=1363084369-27517-15-git-send-email-kraxel@redhat.com \
    --to=kraxel@redhat.com \
    --cc=aliguori@us.ibm.com \
    --cc=andreas.faerber@web.de \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).