Re: Need Workaroud for UNIX Color Bug [message #74956 is a reply to message #74879] |
Mon, 07 February 2011 09:34  |
Nigel Wade
Messages: 286 Registered: March 1998
|
Senior Member |
|
|
On 05/02/11 14:16, David Fanning wrote:
> C.E. Ordonez writes:
>
>> I'm running IDL 8.0.1 (linux x86_64 m64) in openSUSE 11.3.
>>
>> I have the following two lines in my IDL startup file:
>>
>> window, /FREE, /PIXMAP
>> if !D.WINDOW ge 0 then wdelete, !D.WINDOW
>>
>> Running your test program, the plot comes up fine the first time.
>
> Yes, this is the first thing I thought to try, too.
> But the problem is, running this code in *either*
> TEST or MAKEWIDGET (or both!) doesn't solve the
> problem. The window needs to be created outside
> the program I want to run!
It works here. It won't work in makewidget, it has to be done before you
set your values for the foreground/background colours.
The problem is the way IDL initializes colour tables, and the way it
handles X. Until IDL actually interrogates the X window manager for
visuals it doesn't know anything about what X visuals are available.
When IDL does eventually get around to initializing the display it has a
tendency to overwrite values which you have already set (like the
background and foreground colours) for those which it finds in the
selected visual. At least I think that's what it's doing, it's all done
very much behind closed doors.
The trick is to get IDL to initialize X before you set the colours. The
window command should initialize X, so when you actually create your own
window and plot to it the values you set for the colours won't get
overwritten.
Where did you place Caesar's example code?
This code works for me (I'm using IDL 7.1):
pro test2
device, decomposed=1
window, /FREE, /PIXMAP
if !D.WINDOW ge 0 then wdelete, !D.WINDOW
!p.background=16777215L
!p.color=0L
print, 'Before plot: ', !p.color, !p.background
plot, findgen(11)
print, 'After plot: ', !p.color, !p.background
end
Comment out lines 2 and 3 and you get your all white plot.
--
Nigel Wade
|
|
|