public inbox for guile-gtk@sourceware.org
 help / color / mirror / Atom feed
From: Kevin Ryde <user42@zip.com.au>
To: guile-gtk@sources.redhat.com
Subject: gtk-color-selection-get-color opacity
Date: Tue, 05 Aug 2003 01:10:00 -0000	[thread overview]
Message-ID: <87ispc29kh.fsf@zip.com.au> (raw)

[-- Attachment #1: Type: text/plain, Size: 883 bytes --]

I noticed gtk-color-selection-get/set-color don't take into account
the opacity array element which the C functions expect (when enabled
in the widget).

        * gtk-compat.c (gtk_color_selection_set_color_interp): Don't change
        opacity, when in use.
        (gtk_color_selection_get_color_interp): Use 4 doubles to allow for
        opacity return, but ignore that value.

Leaving the opacity unchanged in the set is what gtk 2
gtk_color_selection_set_current_color does with a GdkColor, and seems
fairly sensible.

(These guile-gtk functions are rather unfortunately named, it would
have been better for them to take/return doubles like the C functions
do, and introduce "current-color" functions operating on GdkColor like
gtk 2.  But I think it's too late to do anything about this now.
Maybe "-d" or some such name variants could be introduced to get at
the doubles.)


[-- Attachment #2: gtk-compat.c.colorsel.diff --]
[-- Type: text/plain, Size: 719 bytes --]

--- gtk-compat.c.~1.4.~	2003-08-05 10:08:35.000000000 +1000
+++ gtk-compat.c	2003-08-05 11:04:32.000000000 +1000
@@ -115,8 +115,11 @@
 void 
 gtk_color_selection_set_color_interp (GtkColorSelection *selection, GdkColor *color)
 {
-  gdouble vals[3];
+  gdouble vals[4];
   
+  /* get current opacity into vals[3], when in use */
+  gtk_color_selection_get_color (selection, vals);
+
   vals[0] = color->red / 65535.0; 
   vals[1] = color->green / 65535.0; 
   vals[2] = color->blue / 65535.0; 
@@ -128,7 +131,7 @@
 GdkColor *
 gtk_color_selection_get_color_interp (GtkColorSelection *selection)
 {
-  gdouble vals[3];
+  gdouble vals[4];
   GdkColor dummy, *color;
 
   gtk_color_selection_get_color (selection, vals);

                 reply	other threads:[~2003-08-05  1:10 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=87ispc29kh.fsf@zip.com.au \
    --to=user42@zip.com.au \
    --cc=guile-gtk@sources.redhat.com \
    /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 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).