|
From: Daniel J S. <dan...@ie...> - 2003-10-24 22:52:45
|
Ethan Merritt wrote:
>On Friday 24 October 2003 14:01, Daniel J Sebald wrote:
>
>
>>Ethan Merritt wrote>
>>
>>
>>>I did try to add that feature a while ago, but it turned out to
>>>be harder than it sounded at first blush. So it remains on the
>>>list of things that would be nice but are non-trivial.
>>>
>>>
>>It did take a while to figure out exactly where to
>>put the code, but after that not bad. From gplt_x11's
>>perspective it would be one line of code to close
>>the window in question.
>>
>>
>
>You are missing the hard part. The gplt_x11
>process you currently have a pipe to may or may not
>be the same process that opened the window you
>want to close. How do you communicate with the
>original gnuplot_x11 process to tell it to close the
>window?
>
>Of course it's possible. You could keep a list of old
>pipe descriptors, being careful of course never to
>close any of them. But it's non-trivial.
>
>Or you could just give up and not handle this case,
>but it seems a pity to do a half-baked job.
>
Well, I've programmed a simple close statement and it works
fine over a single pipe, i.e., single instance of gplt_x11. On the
x11.trm side of things it is
if (set_number && !set_close && X11_ipc) {
fprintf(X11_ipc, "N%d\n", X11_plot_number);
fflush(X11_ipc);
} else if (set_close && X11_ipc) {
fprintf(X11_ipc, (set_number ? "C%d\n" : "C\n"), X11_plot_number);
fflush(X11_ipc);
}
[Any objection to using the conditional inside the fprintf
in that way? I think the argument is just ignored if
set_number is not true.]
As for the issue with different processes, I'm wondering
how this situation comes about. That would mean the
user is opening different pipes intentionally. (Let's
rule out the accidental destroying of the pipe and a
new one being created...) So if there are multiple pipes each
one running a version of gplt_x11, what would be the
sense of having built a multiwindow gplt_x11 in the first
place? x11.trm could have handled the various windows
on its own. Also, if this is an issue with "close", it is also
an issue with the current "set term x11 #" because that
could be other pipes as well.
From gplt_x11's side of things, everything is fine, I believe.
I'd say it is worth having because in most situations it will
work as expected. So instead of half-baked, it's
nine-tenths-baked. :)
Dan
--
Dan Sebald
email: daniel . sebald @ ie ee . o rg
URL: ht tp://acer-access.c om/~dsebald @ acer-access.c om/
|