From patchwork Mon Jun 23 09:35:22 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 32340 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 87BF623B18 for ; Mon, 23 Jun 2014 09:36:35 +0000 (UTC) Received: by mail-ie0-f200.google.com with SMTP id tr6sf42814523ieb.3 for ; Mon, 23 Jun 2014 02:36:35 -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:cc: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=xTbXiAaHgduQyYBrJEVjWlNAg18RiDc5zf6JVpzt2tk=; b=PM5sNA6rmgZ2f+OQr+Mx8kP4L1uxwRHDE4TnaP+2I8uGb1F4xI4adfA9i4X6WSD6HT zaMcA8bBY/ptl6x3oZskcJrHK7pTnfssRBFowUVtxsYZxdAffnKVjsmpBoJiR73zuepU UwVsttkvC5t9KkzxXHcJtdaSJknOC7T1NL4r0Atfl05YyEM/1VVrY1zbRMj0MOAKWrNi haAX+ivyYJKXi4LWm4wEmFl6PUMzPdecj4W/gUkyGvkbbgbQeCXjd3jtD7KReSukRFYk m1XaUc2vzan6azSY5ajg0K1CqQ6uhCTDYonom49WHAYA58sCDfzS02uyXnp7S1gQGtgB dmsA== X-Gm-Message-State: ALoCoQkHEMmGnpfj6RvVVYptn2xjipzorh+lEc2ibdNFXWPjEyC0h3ZfASBeECVA6CyDeaSBhpWY X-Received: by 10.50.131.228 with SMTP id op4mr9225980igb.2.1403516195102; Mon, 23 Jun 2014 02:36:35 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.92.68 with SMTP id a62ls1773071qge.79.gmail; Mon, 23 Jun 2014 02:36:35 -0700 (PDT) X-Received: by 10.220.114.140 with SMTP id e12mr868626vcq.37.1403516194973; Mon, 23 Jun 2014 02:36:34 -0700 (PDT) Received: from mail-vc0-f181.google.com (mail-vc0-f181.google.com [209.85.220.181]) by mx.google.com with ESMTPS id ru2si8668212vcb.19.2014.06.23.02.36.34 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 23 Jun 2014 02:36:34 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.181 as permitted sender) client-ip=209.85.220.181; Received: by mail-vc0-f181.google.com with SMTP id il7so5604991vcb.40 for ; Mon, 23 Jun 2014 02:36:34 -0700 (PDT) X-Received: by 10.58.8.12 with SMTP id n12mr18581901vea.28.1403516194905; Mon, 23 Jun 2014 02:36:34 -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 tc5csp117433vcb; Mon, 23 Jun 2014 02:36:34 -0700 (PDT) X-Received: by 10.229.112.5 with SMTP id u5mr29999601qcp.3.1403516194429; Mon, 23 Jun 2014 02:36:34 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id f16si21937736qaq.15.2014.06.23.02.36.34 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 23 Jun 2014 02:36:34 -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]:52331 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wz0fy-0007q2-1T for patch@linaro.org; Mon, 23 Jun 2014 05:36:34 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60154) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wz0f4-0006zz-7K for qemu-devel@nongnu.org; Mon, 23 Jun 2014 05:35:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Wz0f1-00062u-Lj for qemu-devel@nongnu.org; Mon, 23 Jun 2014 05:35:37 -0400 Received: from mnementh.archaic.org.uk ([2001:8b0:1d0::1]:48670) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wz0f1-00061e-9E for qemu-devel@nongnu.org; Mon, 23 Jun 2014 05:35:35 -0400 Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.80) (envelope-from ) id 1Wz0er-0003nU-4x; Mon, 23 Jun 2014 10:35:25 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Date: Mon, 23 Jun 2014 10:35:22 +0100 Message-Id: <1403516125-14568-2-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1403516125-14568-1-git-send-email-peter.maydell@linaro.org> References: <1403516125-14568-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 Cc: =?UTF-8?q?Andreas=20F=C3=A4rber?= , Gerd Hoffmann Subject: [Qemu-devel] [PATCH 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.181 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 --- 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) {