From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43828) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X1b1y-0007kY-GE for qemu-devel@nongnu.org; Mon, 30 Jun 2014 08:49:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X1b1x-0006rx-AI for qemu-devel@nongnu.org; Mon, 30 Jun 2014 08:49:58 -0400 Received: from mnementh.archaic.org.uk ([2001:8b0:1d0::1]:48767) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X1b1x-0006qf-2p for qemu-devel@nongnu.org; Mon, 30 Jun 2014 08:49:57 -0400 Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.80) (envelope-from ) id 1X1b1v-0008VA-2x for qemu-devel@nongnu.org; Mon, 30 Jun 2014 13:49:55 +0100 From: Peter Maydell Date: Mon, 30 Jun 2014 13:49:52 +0100 Message-Id: <1404132595-32651-2-git-send-email-peter.maydell@linaro.org> In-Reply-To: <1404132595-32651-1-git-send-email-peter.maydell@linaro.org> References: <1404132595-32651-1-git-send-email-peter.maydell@linaro.org> Subject: [Qemu-devel] [PULL 1/4] ui/cocoa: Cope with first surface being same as initial window size List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Do the recalculation of the content dimensions in switchSurface if the current cdx is zero as well as if the new surface is a different size to the current window. This catches the case where the first surface registered happens to be 640x480 (our current window size), and fixes a bug where we would always display a black screen until the first surface of a different size was registered. Signed-off-by: Peter Maydell Message-id: 1403516125-14568-2-git-send-email-peter.maydell@linaro.org --- ui/cocoa.m | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ui/cocoa.m b/ui/cocoa.m index f20fd1f..a270a46 100644 --- a/ui/cocoa.m +++ b/ui/cocoa.m @@ -404,7 +404,11 @@ QemuCocoaView *cocoaView; int w = surface_width(surface); int h = surface_height(surface); - bool isResize = (w != screen.width || h != screen.height); + /* cdx == 0 means this is our very first surface, in which case we need + * to recalculate the content dimensions even if it happens to be the size + * of the initial empty window. + */ + bool isResize = (w != screen.width || h != screen.height || cdx == 0.0); int oldh = screen.height; if (isResize) { -- 1.9.1