Subject: bug#5721: Feature request: Function that returns absolute coordinates

From: YAMAMOTO Mitsuharu <[email-masked]>
Date: Fri, 16 Jul 2010 09:35:54 +0900

>>>>> On Thu, 15 Jul 2010 12:56:38 +0200, Jan Djärv <[email-masked]> said:

>> It seems to be difficult to reach agreement about absolete unscaled
>> vs. absolute scaled.  Fortunately, that doesn't matter for X11
>> currently, and we agree with the necessity of a special function
>> that returns absolute unscaled coordinates to pass to an external
>> program.  Why don't we start discussing the specification of that
>> special function, letting absolute unscaled vs. absolute scaled
>> aside for now?
>> 
>> My proposal was to make it parallel to posn-at-x-y, as I mentioned.
>> 
>> (posn-at-x-y x y &optional frame-or-window whole)
>> 

> Sure.  Please check the ifdefs in the window absolute functions I
> made to see the various differences w.r.t tool bar and menu bar.

I don't think such ifdefs are necessary.  The strategy I'm thinking of
is:

  1) Convert window coordinates to frame coordinates if the third
     argument is not a frame.  This should be similar to the code in
     pos-at-x-y.
  2) Call a terminal-specific function that converts frame-relative
     coordinates to absolute coordinates.  That can be done by the
     following "idiom".

       x += f->left_pos + FRAME_OUTER_TO_INNER_DIFF_X (f);
       y += f->top_pos + FRAME_OUTER_TO_INNER_DIFF_Y (f);

     on X11 and

       ClientToScreen (FRAME_W32_WINDOW (f), &pt)

     on W32, I guess.

By the way, window-(inside-)absolute-pixel-edges doesn't seem to take
account of title bar height.  Is that correct?

				     YAMAMOTO Mitsuharu
				[email-masked]