All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gerd Hoffmann <kraxel@redhat.com>
To: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v2] ui/curses: Fix color attribute of monitor for curses
Date: Tue, 15 Dec 2015 11:37:19 +0100	[thread overview]
Message-ID: <1450175839.24446.3.camel@redhat.com> (raw)
In-Reply-To: <87fuzm57qg.fsf_-_@mail.parknet.co.jp>

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,
> 
> [WRONG]
> 	bold << 21 | fg << 12 | bg << 8 | char
> 	fg == 3bits curses color number
> 	bg == 3bits curses color number
> 
> I can't see this format is where come from. Anyway, this doesn't work
> at all.
> 
> What curses expects is actually (and vga.c is using),
> 
> [RIGHT]
> 	bold << 21 | bg << 11 | fg << 8 | char
> 	fg == 3bits vga color number
> 	bg == 3bits vga color number
> 
> And curses set COLOR_PAIR() up to match this format, and curses's
> chtype. I.e,
> 
> 	bold | color_pair | char
> 	color_pair == (bg << 3 | fg)
> 
> 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).
> 
> [Tested the first line is displayed as white on blue back for monitor
> in curses console]

Added to ui patch queue.

thanks,
  Gerd

      reply	other threads:[~2015-12-15 10:37 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-29 13:28 [Qemu-devel] [PATCH] ui/curses: Fix color attribute of monitor for curses OGAWA Hirofumi
2015-12-01 14:11 ` Gerd Hoffmann
2015-12-01 18:43   ` OGAWA Hirofumi
2015-12-01 18:44     ` [Qemu-devel] [PATCH v2] " OGAWA Hirofumi
2015-12-15 10:37       ` Gerd Hoffmann [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1450175839.24446.3.camel@redhat.com \
    --to=kraxel@redhat.com \
    --cc=hirofumi@mail.parknet.co.jp \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.