|
From: Ethan M. <merritt@u.washington.edu> - 2009-02-06 20:39:43
|
On Friday 06 February 2009 09:38:10 Petr Mikulik wrote: > > https://sourceforge.net/tracker/index.php?func=detail&aid=2570385&group_id=2055&atid=302055 > > [ 2570385 ] GPVAL_X11_WINDOWID > > > > > > 3. New global variable current_x11_windowid should be placed in an .h + .c > > > > file. Which one? > > > > > > > That will probably not work. There can be multiple x11 windows open at > > > > the same time, so there is no "current" one. Since you can associate a > > > > window number with each one, however, we might be able to do: > > > > set term x11 5 > > > > print TERM_X11_WINDOW_5_ID > > > > > > The current one is the current active one. It is the last one from "set term > > > x11". The value of GPVAL_TERM_WINDOWID is to be used by a front-end (such as > > > Octave) using gnuplot for drawings; thus, it can fetch the Window ID just > > > after the plot command. > > > > But "set term x11 5" will not necessarily open a new window; it will re-use > > the old window #5 if there is one. So it will not necessarily trigger a > > window creation event, and thus would not automatically update your proposed > > *_CURRENT_* variable. I suppose the terminal driver could maintain a list > > of previously-created window ids. > > It does update the GPVAL_TERM_WINDOWID variable, please try the proposed > patch. The intent is to update GPVAL_TERM_WINDOWID when the main program receives a "new window" event from gnuplot_x11, right? I am trying to point out that not every command "set term x11 <num>" creates a new window. If an old window is re-used, you won't receive this event and therefore GPVAL_TERM_WINDOWID will not be updated. The patch currently has the event generated each time the buffered command list is re-executed, which I think is not right. Probably it should go in pr_window(), immediately after the call to XCreateWindow(). -- Ethan A Merritt |