unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: "Jan Djärv" <jan.h.d@swipnet.se>
To: "Łukasz Stelmach" <stlman@poczta.fm>
Cc: 15837-done@debbugs.gnu.org
Subject: bug#15837: [PATCH] Pass colours using rgb: instead of rgbi:
Date: Sat, 9 Nov 2013 12:20:57 +0100	[thread overview]
Message-ID: <71BA90C3-DC75-47A7-8F70-2E37EC0072D9@swipnet.se> (raw)
In-Reply-To: <1383936065-16824-1-git-send-email-stlman@poczta.fm>

Applied, thanks.

	Jan D.

8 nov 2013 kl. 19:41 skrev Łukasz Stelmach <stlman@poczta.fm>:

> X procedures apply gamma correction to RGBi values which makes colours
> obtained from Gtk+ 3.0 and displayed by Emacs look different than in
> other Gtk applications.
> 
> Signed-off-by: Łukasz Stelmach <stlman@poczta.fm>
> ---
> src/gtkutil.c | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/src/gtkutil.c b/src/gtkutil.c
> index 7e304d4..b8d8610 100644
> --- a/src/gtkutil.c
> +++ b/src/gtkutil.c
> @@ -596,14 +596,17 @@ xg_check_special_colors (struct frame *f,
>     GtkStyleContext *gsty
>       = gtk_widget_get_style_context (FRAME_GTK_OUTER_WIDGET (f));
>     GdkRGBA col;
> -    char buf[sizeof "rgbi://" + 3 * (DBL_MAX_10_EXP + sizeof "-1.000000" - 1)];
> +    char buf[sizeof "rgb:rrrr/gggg/bbbb" ];
>     int state = GTK_STATE_FLAG_SELECTED|GTK_STATE_FLAG_FOCUSED;
>     if (get_fg)
>       gtk_style_context_get_color (gsty, state, &col);
>     else
>       gtk_style_context_get_background_color (gsty, state, &col);
> 
> -    sprintf (buf, "rgbi:%lf/%lf/%lf", col.red, col.green, col.blue);
> +    sprintf (buf, "rgb:%04x/%04x/%04x",
> +             (int)(col.red * 65535),
> +             (int)(col.green * 65535),
> +             (int)(col.blue * 65535));
>     success_p = (XParseColor (FRAME_X_DISPLAY (f), FRAME_X_COLORMAP (f),
> 			      buf, color)
> 		 != 0);
> -- 
> 1.8.1.5
> 
> 
> 






      reply	other threads:[~2013-11-09 11:20 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-08 18:16 bug#15837: 24.3; invalid colour conversion from Gtk+3 to X11 Łukasz Stelmach
2013-11-08 18:41 ` bug#15837: [PATCH] Pass colours using rgb: instead of rgbi: Łukasz Stelmach
2013-11-09 11:20   ` Jan Djärv [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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=71BA90C3-DC75-47A7-8F70-2E37EC0072D9@swipnet.se \
    --to=jan.h.d@swipnet.se \
    --cc=15837-done@debbugs.gnu.org \
    --cc=stlman@poczta.fm \
    /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.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).