* gtk-color-selection-get-color opacity
@ 2003-08-05 1:10 Kevin Ryde
0 siblings, 0 replies; only message in thread
From: Kevin Ryde @ 2003-08-05 1:10 UTC (permalink / raw)
To: guile-gtk
[-- 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);
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2003-08-05 1:10 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-08-05 1:10 gtk-color-selection-get-color opacity Kevin Ryde
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).