From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59797) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a8myy-0006Yb-Os for qemu-devel@nongnu.org; Tue, 15 Dec 2015 05:37:25 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a8myv-0006tB-JV for qemu-devel@nongnu.org; Tue, 15 Dec 2015 05:37:24 -0500 Received: from mx1.redhat.com ([209.132.183.28]:52696) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a8myv-0006t6-EF for qemu-devel@nongnu.org; Tue, 15 Dec 2015 05:37:21 -0500 Message-ID: <1450175839.24446.3.camel@redhat.com> From: Gerd Hoffmann Date: Tue, 15 Dec 2015 11:37:19 +0100 In-Reply-To: <87fuzm57qg.fsf_-_@mail.parknet.co.jp> References: <87r3j95407.fsf@mail.parknet.co.jp> <1448979081.26005.10.camel@redhat.com> <87mvtu57sk.fsf@mail.parknet.co.jp> <87fuzm57qg.fsf_-_@mail.parknet.co.jp> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH v2] ui/curses: Fix color attribute of monitor for curses List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: OGAWA Hirofumi Cc: qemu-devel@nongnu.org On Mi, 2015-12-02 at 03:44 +0900, OGAWA Hirofumi wrote: > Current text_console_update() writes totally broken color attributes > to console_write_ch(). The format now is writing, >=20 > [WRONG] > bold << 21 | fg << 12 | bg << 8 | char > fg =3D=3D 3bits curses color number > bg =3D=3D 3bits curses color number >=20 > I can't see this format is where come from. Anyway, this doesn't work > at all. >=20 > What curses expects is actually (and vga.c is using), >=20 > [RIGHT] > bold << 21 | bg << 11 | fg << 8 | char > fg =3D=3D 3bits vga color number > bg =3D=3D 3bits vga color number >=20 > And curses set COLOR_PAIR() up to match this format, and curses's > chtype. I.e, >=20 > bold | color_pair | char > color_pair =3D=3D (bg << 3 | fg) >=20 > To fix, this simply uses VGA color number everywhere except curses.c > internal. Then, convert it to above [RIGHT] format to write by > console_write_ch(). And as bonus, this reduces to expose curses define > to other parts (removes COLOR_* from console.c). >=20 > [Tested the first line is displayed as white on blue back for monitor > in curses console] Added to ui patch queue. thanks, Gerd