Link to home
Start Free TrialLog in
Avatar of themuppeteer
themuppeteerFlag for Belgium

asked on

X11 color problem

Hello experts,

Red Hat 8, program written in c.

I have a nagging problem. I work on a program which runs using a plain X11 environment. Everything works fine. Now I have to do some bugfixes in an older released version (I'll talk about the new version and old version (where the problem is) from here on.). So what do I do, I check out all of my code, do a clean build and run the program. Now I notice that the program can not initialize its colors. In fact, XAllocNamedColor returns 1 on every color (and rgb.cfg is in place), working with XAllocColor also gives 1 as return value. Consequentely all the colors look terrible (since black gives some kind of pink now).

Also strange is: when the old version starts, it puts a logo on screen with xv, ans also the logo looks bad now. It is less bright as it supposed to be (8-bit colors perhaps ?). Nothing is wrong with my x-server since the newest version of the program works fine, and when the old version with the lousy colors is running, I can still put an x-clock on screen manually with a white background for instance. But, I do have the feeling that the old version does something with the x-server because,when it is running, and I put manually the logo on the screen with xv, it also look bad.

Anyone has a clue ? because I'm really stuck on this.

thnx,
themuppeteer
Avatar of themuppeteer
themuppeteer
Flag of Belgium image

ASKER

some new info:
apperantly a return value different of zero is ok for xallaocnamedcolor. I misunderstood the man. I printed out the colors and they seem ok for r,g,b values. But still the colors look terrible.
what you describe is the "private color map" problem of the X server and/or its applications
xdpyinfo may give you some informations
sorry, my X-programming is way to long gone, but ther is a function or a parameter somewhere in your x-calls where you can request a private color map for your application
But if I do that, my application will still have bad colors, but the other applications will have good colors right? Thats not what I want, I want all applications to have good colors.
I use XDefaultColorMap to get my colormap..

Anyway, some new info...

Since the application was released before, working fine, we figured that  we should be able to build the same code again on our build system. So we did. And everything worked fine. Strange because we are talking about the same code! Then we copied the code with scp from the build machine to my machine and compiled and everything worked fine also. So apperantly if I check out the code it goes wrong, and if the build machine checks out the code it goes fine. I have no idea whats going on, but I'm working on the 'working' code now, since there is a deadline...as usual..
So the problem isn't solved but we have a 'workaround'.

I'm gonna let this question open for a while, if someone finds an explanation I'd be happy to give the points.

br,
themuppeteer
>  But if I do that, my application will still have bad colors, but the other applications will have good colors right?
no
the application with the focus will have "good colours", all other application will have "bad colours" but only if they use a completely different colormap
there is no filickering if 2 or more applications use the same colormap, even if defined as "private colormap".
That's 30 or so year old X, not anything modern :-))

If it was working before, your X server probably changed, check its configuration, for example with xdpyinfo
thanks for the answer ahoffman,

Wel it was working before, and if I start the latest version of the program, I have good colors. Thats why I think it has nothing to do with the X-server. xdpyinfo gives only correct info as far as I understand it. We already used that command over here.
What is so strange is :

versioning system --> my machine (compile)--> bad colors
versioning system --> build system (compile) -->my machine --> good colors
versioning system --> build system --> my machine (compile) -->good colors

it simply doesn't make sense.

Just curious, Is it 'good practice' to create your own colormap ?


sounds like your systems has different include files for X
if so , how comes simply checking out  on the build system and scp'ing the code and building on my machine gives good colors ?
versioning system --> build system --scp-> my machine (compile) -->good colors
which versioning system do you use? SCCS, RCS, CVS, ...
did you just checkout the sources or Makefile etc. also?
have no idea so far, just in case ...
We use MKS.
I also check out the Makefile.
I guess the only possible explanation could be that the code is checked out differently on the build system then on my machine. Which should be impossible no ?
agreed
ASKER CERTIFIED SOLUTION
Avatar of modulo
modulo

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial