From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27806 invoked by alias); 5 Aug 2003 01:10:54 -0000 Mailing-List: contact guile-gtk-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: guile-gtk-owner@sources.redhat.com Received: (qmail 27770 invoked from network); 5 Aug 2003 01:10:53 -0000 Received: from unknown (HELO snoopy.pacific.net.au) (61.8.0.36) by sources.redhat.com with SMTP; 5 Aug 2003 01:10:53 -0000 Received: from sunny.pacific.net.au (sunny.pacific.net.au [203.2.228.40]) by snoopy.pacific.net.au (8.12.3/8.12.3/Debian-6.4) with ESMTP id h751ApdK014812 for ; Tue, 5 Aug 2003 11:10:52 +1000 Received: from wisma.pacific.net.au (wisma.pacific.net.au [210.23.129.72]) by sunny.pacific.net.au with ESMTP id h751ApCh006383 for ; Tue, 5 Aug 2003 11:10:51 +1000 (EST) Received: from localhost (ppp64.dyn228.pacific.net.au [203.143.228.64]) by wisma.pacific.net.au (8.12.9/8.12.9) with ESMTP id h751AnPs019024 for ; Tue, 5 Aug 2003 11:10:50 +1000 (EST) Received: from gg by localhost with local (Exim 3.35 #1 (Debian)) id 19jqLZ-0001Ys-00; Tue, 05 Aug 2003 11:10:41 +1000 To: guile-gtk@sources.redhat.com Subject: gtk-color-selection-get-color opacity From: Kevin Ryde Mail-Copies-To: never Date: Tue, 05 Aug 2003 01:10:00 -0000 Message-ID: <87ispc29kh.fsf@zip.com.au> User-Agent: Gnus/5.090019 (Oort Gnus v0.19) Emacs/21.2 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-SW-Source: 2003-q3/txt/msg00026.txt.bz2 --=-=-= Content-length: 883 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.) --=-=-= Content-Disposition: attachment; filename=gtk-compat.c.colorsel.diff Content-length: 719 --- 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); --=-=-=--