|
From: Ben A. <bpa...@ma...> - 2009-02-12 12:24:05
|
On Jan 29, 2009, at 4:13 PM, Ethan Merritt wrote: > On Thursday 29 January 2009 12:32:29 Ben Abbott wrote: >> >> On Dec 29, 2008, at 12:15 AM, Ethan A Merritt wrote: >> >>> On Sunday 28 December 2008, Ben Abbott wrote: >>>> >>>> On Dec 28, 2008, at 9:10 PM, Ethan A Merritt wrote: >>>> >>>>> On Sunday 28 December 2008, Ben Abbott wrote: >>>>> >>>> >>>>>> *SNIP* >>>>>> By the way, it would really be cool if there was a method by >>>>>> which >>>>>> the >>>>>> size and position of a plot window could be determined. That way >>>>>> if a >>>>>> user moves or resizes a window Octave could do some checking and >>>>>> have >>>>>> some awareness of such (I'd be stunned if such were possible, but >>>>>> thought I'd ask). >>>>> >>>>> You can do that with a call into xlib; you don't need any special >>>>> code in gnuplot for that. You should be able to get all the info >>>>> you'd get from the command line using "xwininfo" >>>> >>>> hmmm ... that may be quite useful. >>>> >>>> xwininfo: Window id: 0xc00008 "Figure 1" >>>> >>>> Absolute upper-left X: 440 >>>> Absolute upper-left Y: 128 >>>> Relative upper-left X: 0 >>>> Relative upper-left Y: 22 >>>> Width: 560 >>>> Height: 493 >>>> Depth: 24 >>>> Visual Class: TrueColor >>>> Border width: 0 >>>> Class: InputOutput >>>> Colormap: 0x21 (installed) >>>> Bit Gravity State: ForgetGravity >>>> Window Gravity State: NorthWestGravity >>>> Backing Store State: NotUseful >>>> Save Under State: no >>>> Map State: IsViewable >>>> Override Redirect State: no >>>> Corners: +440+128 -440+128 -440-279 +440-279 >>>> -geometry 560x493+440+106 >>>> >>>> Unfortunately, the height includes the portion needed to display >>>> the >>>> cursor's coordinates ... sigh :-( >>> >>> That extra height is equal to term->v_char. This quantity is not >>> currently exported as a user variable, but it would be trivial to do >>> so. >>> Do you want it? Its name would be GPVAL_TERM_VCHAR. >> >> I'm back hoping to better understand what is needed to determine the >> position of a specific gnuplot x11 window. I can see how xwininfo can >> be used, but how do I determine the window id (0xc00008 in the >> instance above)? Would it be necessary to patch gnuplot? > > The usual way is to make successive requests to the window mananger > asking it to step through all the current windows on the display, > and check each one to see if it is the one you want. That does not > require any cooperation or modification of the program that created > the window in the first place. > > It would also be possible to modify gnuplot_x11 so that it reports > back the id of each new plot window that it opens. The would involve > modifying gplt_x11.c, mouse.c, and perhaps x11.trm, but I think it > would not be difficult. > >> Regarding the proposed GPVAL_TERM_VCHAR, how would be be accessed? > > It would be just like any of the other internally-maintained > variables. > The two obvious ones are > > show GPVAL_TERM_VCHAR > or > set print "my/named/pipe/or/other/file" > print "term->char =", GPVAL_TERM_VCHAR > unset print To properly interpret the "size" information I'll get from x11 using the GPVAL_TERM_WINDOWID, I'll need the value for GPVAL_TERM_VCHAR. Temporarily I can assume it is 13 pixels. However, as I'll be using the window size obtained from x11 to determine if the mouse was used to change its size, and subsequently update the figures' size property on the octave end, I'd like to make sure I get his correct. TiA Ben |