Using non-default visuals/colormaps

This forum is read only. No new submissions are accepted.

Questions about motif? Contact us

3 posts / 0 new
Last post
Using non-default visuals/colormaps

Submitted by Anonymous on Fri, 10/03/2003 - 21:37.

Hello, I am currently working on porting several X/Motif applications from X11R5 Motif 1.2 running on HP-UX 10.20 workstations to X11R6 OpenMotif 2.2 running on HP/Compaq PC workstations with Red Hat Linux 9.0. One of these applications uses cyclic colormap modification to cause symbols within an
XmDrawingArea to blink. The default visual on the old HP workstations was Psuedocolor with a depth of 8. Since the Psuedocolor visual supports read/write colormaps, we were able to use XAllocColorCells to create a few writable color cells to support our blink functionality. On Linux, the default visual is TrueColor, which provides a read-only colormap. The only other visual supported on Linux is DirectColor, which does provide a writable colormap. So, I changed the default visual to DirectColor and that solved the problem with my application (blinking works fine), but other Linux applications,
namely Gnome related apps, show strange coloring. After a little research, I found that Gnome applications prefer the TrueColor visual. So, then I looked into using a non-default visual (DirectColor) for my application and set the default visual back to TrueColor. This is where I have some questions. First off, I do understand that I have to use a call like XGetVisualInfo to get the DirectColor visual info and then create a colormap, using XCreateColormap, using the DirectColor visual. Then I need to use a call like XtVaSetValues to set the values of visual, colormap, and depth
for my toplevel widget before it is realized. When I create the colormap, do I need to load color values into it, just like the Xserver does when it creates the default colormap? Also, I am concerned about color flashing. On our Linux workstations, only one hardware colormap is supported. So, if I use a non-default visual and create a private colormap what would be the risk of getting color flashing as focus moves from window to window? Also, would it make sense to create a custom standard colormap so that I would only have to create it once, and it could be reused until the workstation is rebooted? Finally, do I have any other options as far as implementing the blink effect that we desire on these new workstations?


Tony Rossomano

Sun, 08/20/2006 - 18:14#1

Sun, 08/20/2006 - 18:14#1


Would dual heads solve your problem ?

Hi Tony --

I'm also using an X/Motif application designed for depth=8 PseudoColor that manipulates the color map (as an essential feature of the application, in this case image processing). The solution I've settled on is to configure my Linux hardware with two video boards (or a single dual monitor board) and then in XF86Config-4, set the two screens as separate displays (not xinerama), which under X are 0.0 and 0.1, and then set default depth to 24 on screen 0 (the default, login screen) and meanwhile set the default depth to 8 on screen 1. Then I simply display my special application on screen 1 (while screen 0 handles most everything else).

Fortunately Open Motif (unlike KDE and GNOME etc) is frugal when it comes to not consuming all of the system default color table itself, so my application can still allocate a majority of the 256 colors in the system default color table, without needing to resort to a private color table.

Caveats -- I've found that some linux video drivers no longer support depth=8. So I stick with video boards based on Permedia-2 or -3 chipsets (the linux "glint" driver does support depth=8).

Actually, my MotifZone visit today was prompted by OpenMotif 2.2.2 no longer allowing my application on display 0.1 to allocate >100 colors in the system default color table, after I upgraded to XFree86 version 4.2.1 ... not sure whether an upgrade to OM 2.3 or reverting back to my earlier XFree86 version is the better approach for me under Red Hat 7.3

Anyway, good luck with your application.

-- Jim

Sat, 11/04/2006 - 19:18#2

Sat, 11/04/2006 - 19:18#2


give me code examples of how to use non default color map on

Dear Sir.
I support Motif application which must run any
Linux,Unix platform, but from 32 bit Linux laptop
and 64 bit IRIX on SGI colors of my application
changes. I want to use some custom color map.
I think it is similar to what you do, porting
your app, can you provide some code examples
of how to make custom color map, I am novice
in Motif. Can you help me.