From patchwork Wed Oct 14 11:36:38 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: OGAWA Hirofumi X-Patchwork-Id: 530181 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id E922F1412DB for ; Thu, 15 Oct 2015 00:39:03 +1100 (AEDT) Received: from localhost ([::1]:42514 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZmMGj-0008DG-Kq for incoming@patchwork.ozlabs.org; Wed, 14 Oct 2015 09:39:01 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54903) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZmKMP-0003uJ-El for qemu-devel@nongnu.org; Wed, 14 Oct 2015 07:36:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZmKML-0003mQ-8G for qemu-devel@nongnu.org; Wed, 14 Oct 2015 07:36:45 -0400 Received: from mail.parknet.co.jp ([210.171.160.6]:48002) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZmKMK-0003mL-Vc for qemu-devel@nongnu.org; Wed, 14 Oct 2015 07:36:41 -0400 Received: from ibmpc.myhome.or.jp (unknown [210.171.168.39]) by mail.parknet.co.jp (Postfix) with ESMTP id 4D7641E0049 for ; Wed, 14 Oct 2015 20:36:40 +0900 (JST) Received: from devron.myhome.or.jp (root@devron.myhome.or.jp [192.168.0.3]) by ibmpc.myhome.or.jp (8.14.9/8.14.9/Debian-4) with ESMTP id t9EBadox007985 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 14 Oct 2015 20:36:40 +0900 Received: from devron.myhome.or.jp (hirofumi@localhost [127.0.0.1]) by devron.myhome.or.jp (8.14.9/8.14.9/Debian-4) with ESMTP id t9EBacHJ021745 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 14 Oct 2015 20:36:39 +0900 Received: (from hirofumi@localhost) by devron.myhome.or.jp (8.14.9/8.14.9/Submit) id t9EBacli021744; Wed, 14 Oct 2015 20:36:38 +0900 From: OGAWA Hirofumi To: qemu-devel@nongnu.org References: <87k2qp8yxv.fsf@mail.parknet.co.jp> Date: Wed, 14 Oct 2015 20:36:38 +0900 In-Reply-To: <87k2qp8yxv.fsf@mail.parknet.co.jp> (OGAWA Hirofumi's message of "Wed, 14 Oct 2015 20:35:56 +0900") Message-ID: <87fv1d8ywp.fsf@mail.parknet.co.jp> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 210.171.160.6 X-Mailman-Approved-At: Wed, 14 Oct 2015 09:38:22 -0400 Subject: [Qemu-devel] [PATCH 1/3] ui/curses: Fix monitor color with -curses when 256 colors 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org If TERM=xterm-256color, COLOR_PAIRS==256 and monitor passes chtype like 0x74xx. Then, the code uses uninitialized color pair. As result, monitor uses black for both of fg and bg color, i.e. terminal is filled by black. To fix, this initialize above than 64 with default color (fg=white,bg=black). FIXME: on 256 color, curses may be possible better vga color emulation. Signed-off-by: OGAWA Hirofumi --- ui/curses.c | 3 +++ 1 file changed, 3 insertions(+) diff -puN ui/curses.c~support-curses-256color ui/curses.c --- qemu/ui/curses.c~support-curses-256color 2015-10-14 20:12:06.311051365 +0900 +++ qemu-hirofumi/ui/curses.c 2015-10-14 20:27:39.417674271 +0900 @@ -343,6 +343,9 @@ static void curses_setup(void) for (i = 0; i < 64; i ++) init_pair(i, colour_default[i & 7], colour_default[i >> 3]); + /* Set default color for more than 64. (monitor uses 0x74xx for example) */ + for (i = 64; i < COLOR_PAIRS; i ++) + init_pair(i, COLOR_WHITE, COLOR_BLACK); } static void curses_keyboard_setup(void)