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

From: YAMAMOTO Mitsuharu <[email-masked]>
Date: Thu, 15 Jul 2010 18:27:26 +0900

>>>>> On Thu, 15 Jul 2010 10:59:52 +0200, Jan Djärv <[email-masked]> said:

>>> That would require unscaled everywhere, even in pos-x-y, window
>>> sizes, font sizes and so on.  I didin't think that was your
>>> suggestion.
>> 
>> No, they are all frame-relative, so scaled by the scaling factor.
>> 
>> The only places currently I can think of in the "absolute" category
>> are the frame parameters `left' and `top', and some screen
>> parameters such as `display-pixel-height', etc.  Most of the values
>> in Lisp are designed as frame-relative.

> But many operations add and subtract from frame top, left and
> display width/height.  How many?  I don't know, I just suspect that
> there are many based on what I've seen when editing existing lisp
> files in Emacs.  Not to mention C files.

Such operations are inherently relative-absolute conversions, and such
tasks should be done by a special conversion function we are
introducing.  For most such use cases, we must take window decorations
(including the title bar) by the window manager into account anyway,
and the relative-scaled <-> absolute-unscaled conversion function will
make it more accurate, concise, and makes the intention clear.

>>>> Again, if we used absolute scaled coordinates to specify `left'
>>>> and `top' frame parameters, we could only place the frame to the
>>>> position whose coordinates are multiples of the scale factor.
>> 
>>> As I said earlier, special functions to deal with that for those
>>> that care.
>> 
>> I don't understand.  What happens if a user moved the frame to
>> (101, 101) using the mouse under the scale factor 2, and he checked
>> (frame-parameter nil 'left)?

> Is 101 scaled or unscaled?  If scaled, left would be 101.  If not
> scaled, left would be 50.  Loss of precision? Sure, but does it
> matter in most cases?

Of course scaled.

> Another idea would be if Emacs had its own internal coordinate
> system, say 0.0 to 1.0 or some integer based one, that already is
> display independent.  It would fit nicely with the GnomeCanvas idea
> (see other thread).  A bunch of work though...

What would happen to the absolute scaled coordinate system if scaling
factors are different from frame to frame?

				     YAMAMOTO Mitsuharu
				[email-masked]