From patchwork Mon Jun 30 12:49:52 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 32718 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ie0-f200.google.com (mail-ie0-f200.google.com [209.85.223.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 9260E203F4 for ; Mon, 30 Jun 2014 12:54:54 +0000 (UTC) Received: by mail-ie0-f200.google.com with SMTP id tr6sf52545871ieb.7 for ; Mon, 30 Jun 2014 05:54:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:date :message-id:in-reply-to:references:subject:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:list-subscribe :errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list; bh=IPMFj21Nnsk8bpC9TMElTgOSJdTQATZAhrS3/8xvXVs=; b=fL/P0hcJ7RiKU22WI5Con9YS+drZkvTfaqH6Ny9HJAvA4KMxcky4PV5OD+r3mRBJSR L3WdTs7ZV8+fe047pRrkNyXI+F/U5qkAVmJFMQ6RnAQIqdE56ynjDwahqNRxnTC9EERF pDiLDzxtjIiey6+oDFeV15uJYTBUEAPzL7z+YrlrbzHLGRUzmMpjM4tPUnHMJeR7Khrb YsX4i2FJ6WiVayAvPh3iDYe7fA7XPheQVP2MK6THtr8ccRS2jrL3k8WdX2IbL4CceJfe oen+Mh9c8hOFtB+OaJqbYVper75oC/oV16D0YhoBMFfttNyoJ6HChUIuqfkWFoymtSie sqrg== X-Gm-Message-State: ALoCoQnH6c5aNEJbeE5J0KPgrg0lcKYoOCk6FfrzkC1jQCPpxVp7vxbIRTcZSPY2ldRci6G/HMmw X-Received: by 10.42.39.140 with SMTP id h12mr20365682ice.9.1404132894137; Mon, 30 Jun 2014 05:54:54 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.49.193 with SMTP id q59ls1474879qga.91.gmail; Mon, 30 Jun 2014 05:54:54 -0700 (PDT) X-Received: by 10.58.122.196 with SMTP id lu4mr425291veb.52.1404132894058; Mon, 30 Jun 2014 05:54:54 -0700 (PDT) Received: from mail-vc0-f180.google.com (mail-vc0-f180.google.com [209.85.220.180]) by mx.google.com with ESMTPS id un15si9990465veb.69.2014.06.30.05.54.54 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 30 Jun 2014 05:54:54 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.180 as permitted sender) client-ip=209.85.220.180; Received: by mail-vc0-f180.google.com with SMTP id im17so7443561vcb.39 for ; Mon, 30 Jun 2014 05:54:54 -0700 (PDT) X-Received: by 10.221.26.71 with SMTP id rl7mr202975vcb.69.1404132894001; Mon, 30 Jun 2014 05:54:54 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.221.37.5 with SMTP id tc5csp136225vcb; Mon, 30 Jun 2014 05:54:53 -0700 (PDT) X-Received: by 10.140.47.173 with SMTP id m42mr33372092qga.9.1404132893593; Mon, 30 Jun 2014 05:54:53 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id d1si3158311qcd.28.2014.06.30.05.54.53 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 30 Jun 2014 05:54:53 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Received: from localhost ([::1]:34128 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X1b6j-0006IN-Ac for patch@linaro.org; Mon, 30 Jun 2014 08:54:53 -0400 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 To: qemu-devel@nongnu.org Date: Mon, 30 Jun 2014 13:49:52 +0100 Message-Id: <1404132595-32651-2-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1404132595-32651-1-git-send-email-peter.maydell@linaro.org> References: <1404132595-32651-1-git-send-email-peter.maydell@linaro.org> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:8b0:1d0::1 Subject: [Qemu-devel] [PULL 1/4] ui/cocoa: Cope with first surface being same as initial window size X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: peter.maydell@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.180 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 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) {