From: Daniel J S. <dan...@ie...> - 2004-08-17 23:10:08
|
Ethan Merritt wrote: >On Monday 16 August 2004 01:42 pm, Dave Denholm wrote: > > >>(Come to think of it - I may not even have the latest sources, in >> which case what I just wrote may have been rubbish) >> >> > >The particular code bit you posted applies to line colors, not >to pm3d rectangles. But there is a similar bit of code in >PaletteSetColor(plot_struct * plot, double gray) that applies >to pm3d: > > index = gray * (plot->cmap->allocated - 1); > if (index >= plot->cmap->allocated) > index = plot->cmap->allocated -1; > XSetForeground(dpy, gc_pm3d, plot->cmap->pixels[index]); > >I don't really have a grasp of the big picture. >I *think* the problem is that plot->cmap itself is still only >a list of color indices, and since the time it was first set up the >true colormap stored in the gc has changed. So the above >code updates the index, but it is an index into an obsolete table. >That's why I thought we might have to store a copy of the gc >in use at the time the original color mapping was set up. > I believe this is correct. I looked at the array of GC values, it doesn't look to have anything to do with the color map. In process_configure_notify_event(XEvent *event) is where the mouse event comes for resizing the window. Now, I'm pretty sure that a problem here is that in this routine is plot = Find_Plot_In_Linked_List_By_Window(event->xconfigure.window); near the top and if there is a change in the window size and a few other things, eventually there is a display(plot); So, nothing in that code looks as though a window color scheme was activated or reinstalled between those two commands. My thinking is that the fix should be as simple as that attached diff file. But there is that "small" detail that Ethan describes. The complete color map needs to be stored as part of the structure. That is, plot->cmap needs to point at something that is dynamically allocated independent of the current color map. I'll work on that fix, but if this doesn't sound correct, let me know. Also, maybe think if what I've added in this patch is adequate to fix the problem when I have the plot->cmap problem fixed. That is, are there any other details about the GC that also must be updated? Dan |