From: Ethan M. <merritt@u.washington.edu> - 2004-06-18 16:43:17
|
On Friday 18 June 2004 06:09 am, you wrote: > > If user closes gnuplot_x11, If a user kills gnuplot_x11 then all bets are off. Killing it (SIGTERM etc) will bypass any code that I add. So I assume you mean: if a user closes the plot window... > then "show variables" should have define all > usual mousing variables, obviously with zero values, and the MOUSE_KEY > should be set to -1: I do not like this idea at all. zero is a legal coordinate value, so setting coordinates to zero is not a safe way of indicating an abnormal return. > This is absolutely important in order not to break scripts for > bidirectional communication of other programs with gnuplo, which get > feedback from mousing by writing the above MOUSE_* values to pipe / > fifo. But a script should not assume that any of these variables are defined. In fact they are not defined to begin with, and only become defined at the time a mouse click is first requested and successfully recognized. I suggest that the proper fix is to modify your scripts to test for the existence of the variable before trying to print it. This is simply a specific example of the more general case of user-defined variables. Scripts are free to define and use variables via gnuplot, but they cannot assume the variables are defined. Or else they must be very careful to insure that a variable becomes defined before trying to use it, but that strikes me as a dangerous programming style. > Finally, what do you think about this: "q" hotkey is disabled when > "pause mouse key" comes to action; I have been unable to figure out how to do this. The "q" hotkey is handled directly by gnuplot_x11, which doesn't know anything about "pause mouse". I think it would take a separate communication channel and a new set of driver calls to implement this, since gnuplot would have to inform gnuplot_x11 asynchronously that it is requested to change how it is handling X11 input events. Frankly, I think it would be a huge headache to get this working. The only alternative I have been able to come up with is to move the "q" processing for the current plot window out of gnuplot_x11 altogether, and make it equivalent to bind 'q' '<some command related to set term x11 close>' If you have any better ideas, please speak up. > thus, command.c should call > "x11_hotkeys(0)" and afterwards "x11_hotkeys(1)" to enable them again. x11_hotkeys()? Is this a new driver primitive that you have designed? I agree it would be possible to do this sort of thing by adding a new set of driver primitives. But that's a big job and I don't have time to tackle it. -- Ethan A Merritt merritt@u.washington.edu Biomolecular Structure Center Mailstop 357742 University of Washington, Seattle, WA 98195 |