GTK+ Forums

Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
It is currently Wed Sep 03, 2014 4:43 am

All times are UTC




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: missing colors gdk-pixbuf/pango, need help submitting patch
PostPosted: Thu Jul 19, 2012 7:04 pm 
Offline
GTK+ Guru

Joined: Fri Mar 25, 2011 5:16 pm
Posts: 177
Location: USA
While experimenting with GTK+3 and CSS I discovered several colors that don't work when referring to them by name. I mention this in the "Colors:" subsection of my post here in the tutorials:
http://www.gtkforums.com/viewtopic.php?f=3&t=988&p=72088=GTK3+with+CSS#p72088

These colors are "Basic color keywords" or "Extended color keywords" as defined by w3.org. Since the names don't work, you must use the RGB, RGBA or hex representations instead. A grep search of the libraries revealed the missing definitions in pango-color-table.h and xpm-color-table.h.

I filed a bug for both these and received a request from a Pango developer for a patch. I have never submitted a patch. This area is totally new to me. What is the proper way to do this? The entries are in alphabetic order in static const char color_names[] =. Then the matching RGBA values are in static const ColorEntry color_entries[] = These are where the new colors should be places.
Code:
static const char color_names[] =
Line:      
16       "aqua\0"                                    
178      "fuchsia\0"
510      "lime\0"
571      "olive\0"
681      "silver\0"
723      "teal\0"

static const ColorEntry color_entries[] = {
Line:
777       { 0, 255, 255, 1 },
939       { 255, 0, 255, 1 ),
1271      { 0, 255, 0, 1 ),
1332      { 128, 128, 0, 1 ),
1442      { 192, 192, 192, 1 ),
1484      { 0, 128, 128, 1 ),


Top
 Profile  
 
 Post subject: Re: missing colors gdk-pixbuf/pango, need help submitting pa
PostPosted: Thu Jul 19, 2012 8:58 pm 
Offline
Never Seen the Sunlight

Joined: Wed Jul 23, 2008 10:31 am
Posts: 2406
Location: Slovenia
Hi.

The usual way of producing patches for GTK+ and friends can be a bit tricky if you've never used git before. Standard procedure is:
  • clone a git repo you want to produce patch for
  • create a new branch for you changes
  • make and commit changes
  • create diff against master's HEAD

In your case, series of commands would probably look something like this (one command per line for easy copy-paste;):
Code:
git clone git://git.gnome.org/pango # This will create pango folder and download sources
cd pango # Move into pango folder
git checkout -b add-missing-colors # create "add-missing-colors" branch and make it active
# now fix bad code and save changes
git diff # See what you have done (not needed, but I always check my changes)
git add pango/pango-color-table.h # stage file for commit
git commit # commit changes (this command will open editor where you'll write your commit message)
git format-patch master # this will (finally;) produce bugzilla-ready patch;)


I assumed here that you have git up-and-ready (search for pro git if you need help with that).

And that's the usual procedure. But in this case, I'm not sure things will go as smoothly, since that color table header file is auto-generated from X11 rgb.txt file (you can probably find it under /usr/share/X11/rgb.txt). and patching auto-generated file is something you should really not be doing. And if I remember correctly, there is some name-clash between X11 and CSS colors (not sure though, since I'm really not that interested in web-related stuff).

Good luck with your first patch;)
Tadej


Top
 Profile  
 
 Post subject: Re: missing colors gdk-pixbuf/pango, need help submitting pa
PostPosted: Fri Jul 20, 2012 2:26 am 
Offline
GTK+ Guru

Joined: Fri Mar 25, 2011 5:16 pm
Posts: 177
Location: USA
There was a link to rgb.txt in /usr/share/X11 but the file was in ect/X11.
Yes, you're right about the auto-gen. I completely missed that. Both header files say at the top:
Generated by gen-color-table.pl from rgb.txt

The name-clash between X11 and CSS colors that you mentioned appears to be the spaces in the names. W3.org names have no spaces. So It works for "aliceblue" but using "alice blue" I get:

(btn1:2910): Gtk-WARNING **: Theme parsing error: btn1.css:6:13: 'alice' is not a valid color name

rgb.txt appears to address this by having duplicates of each color. There are versions with and without spaces but it's missing the colors I mentioned entirely.
Since the problem originates with rgb.txt I just submitted a bug to freedesktop.
https://bugs.freedesktop.org/show_bug.cgi?id=52289

Thanks for your help.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC


Who is online

Users browsing this forum: Google Adsense [Bot], ldries46 and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group