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

From: Jan Djärv <[email-masked]>
Date: Fri, 16 Jul 2010 08:38:44 +0200

YAMAMOTO Mitsuharu skrev 2010-07-16 02.35:
>>>>>> 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.

AFAIK, there is no pos-at-x-y function.  Did you mean posn-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.

You left out Nextstep/OSX.

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

Why should it?  The titlebar isn't an Emacs window in X, it belongs to the 
window manager.  Top/left does not point at it, it points at the Emacs frame.

	Jan D.