|
From: Daniel J S. <dan...@ie...> - 2003-10-25 23:04:59
|
I believe I have a few simple mods to address points
1 and 2 below. Point 1 is simply a matter of breaking
out of a loop when a number change code 'N' is seen
by Gnuplot. It is then possible to resize all windows
after a "set term x11".
2c below I've ruled out as an alternative. It is confusing
when the windows behave that way. This is accomplished
by doing an X11_init() in the X11_options() of x11.trm.
The ramification of doing this is that the X11 window
must be created even if just a "set term x11" is called.
Why? Looking through the gplt_x11.c code there are
many many places where a pointer in the plot table
called "plot->window" of type Window is used without
testing first if it is valid. Rather than touch up all these
occurrences, I've just made sure the windows are
initialized whenever a new window number is used in some way.
[But really, the proper thing to do would be to check the
sanity of the "plot->window" variable before using it.
The reason is that if the plot being drawn to is destroyed
in some way and "plot->window" gets set back to
zero, gplt_x11 will not crash. E.g., if a slow graph is
drawing and the "destroy" button is pressed.]
The alternatives 2a and 2b are achieved by a simple
mod of:
#define DISPLAY_WINDOW_UPON_CREATION 0
#if DISPLAY_WINDOW_UPON_CREATION
XMapWindow(dpy, plot->window);
#endif
inside the pr_window() routine of gplt_x11.c. If the defined
value is 0 the window is not made visible until something
is actually plotted to it. If the defined value is 1, the empty
window is displayed upon creation, i.e., a "set term x11"
As for issue 3, I may go through and make sure some
reasonable tests for duplicated options is done.
Dan
Daniel J Sebald wrote:
> My original message must have been lost by SF, but I
> don't think it needs resending to clarify the issue. The
> points up to this point are
>
> 1) I think the problem of x11 windows getting stuck
> when only a "set term x11 #" should be fixed at some
> point. Nobody needs to change this, I can do so with
> Petr's help. But, feel free to comment.
>
> 2) If you think the above problem should be modified,
> do you feel that
>
> a) graphics windows should not appear until something
> is actually plotted to them
>
> b) graphics windows should _always_ appear when
> "set term x11 ..." is entered
>
> c) the first x11 window should not appear until something
> is actually plotted, but after that "set term x11 ..." will
> cause a new blank window to appear.
>
> With regard to 2, note that if one types "set output 'name'"
> followed by no plot commands, but then "set output", the
> file 'name' will be created. Is there an analogy here between
> a file and a window?
>
> The next point is
>
> 3) Looking at the X11_options() in x11.trm it is very similar
> to other parsing/interpretting schemes, however it doesn't have
> the many checks for repeated entry, valid entry, etc. Some
> commands are sent to gplt_x11 even before the end of parsing.
> So even if there is something bogus in the "set term x11"
> command, a portion of the command could have been processed.
> Should it do that? Or should it wait until it is known that the whole
> command is valid? For example,
>
> "set term x11 3 "TimesFont""
>
> will show an error message because "font" is missing before
> the font name, but it will in fact change the x11 window to 3.
>
> If you feel point 2b above should be the case, then
>
> "set term x11 1 2 noraise"
>
> where someone mistypes the 12 will cause window 1 and window
> 2 to show on the desktop. In fact, as it currently is
>
> "set term x11 1 2 noraise reset 3 4 raise"
>
> is fine by Gnuplot. Should there be some checks to prevent
> this kind of thing?
>
> Dan
>
>
> Daniel J Sebald wrote:
>
>>
>>
>> Daniel J Sebald wrote:
>>
>>> In other words, from a fresh invocation
>>>
>>> set term x11 3
>>>
>>> creates no window. But
>>>
>>> plot sin(x)
>>> set term x11 3
>>>
>>> creates _two_ windows.
>>
>>
>>
>>
>> You are probably wondering what I mean because the
>> current version doesn't do this, as I just realized. What
>> I am speaking of the system's behavior after an alteration
>> to the 'N' option for changing the X11 window via
>>
>> "set term x11 5"
>>
>> [If you type the following, you'll notice you are unable
>> to resize the first plot... that should be fixed at some
>> point.
>>
>> plot sin(x)
>> set term x11 4
>> {try resizing first plot}]
>>
>> I guess the question boils down to should the command
>>
>> set term x11 7
>>
>> cause an empty X11 window to appear on the desktop
>> if it didn't already exist? Or should it be until after something
>> is actually plotted to the window that it appears on the
>> desktop?
>>
>> Dan
>>
>
--
Dan Sebald
email: daniel . sebald @ ie ee . o rg
URL: ht tp://acer-access.c om/~dsebald @ acer-access.c om/
--
Dan Sebald
email: daniel . sebald @ ie ee . o rg
URL: ht tp://acer-access.c om/~dsebald @ acer-access.c om/
|