Subject: Re: bug#31031: 27.0; (elisp) `Position Parameters', floating-point values

From: martin rudalics <[email-masked]>
Date: Wed, 04 Apr 2018 09:49:26 +0200

>> Can you try fixing that in some consistent manner?  You can find the
 >> corresponding code in x_calc_absolute_position in xterm.c.  BTW, does
 >> it work right when you use the "(- POS)" specification?
 >
 > (modify-frame-parameters nil '((user-position . t) (left .   (- 0))))
 >
 > gives the same offset effect as
 >
 > (modify-frame-parameters nil '((user-position . t) (left .  1.0)))

So we should try fixing (or documenting) the misbehavior of the (- n)
notation first.

 > D'oh. Of course, top is the right parameter to use. With that the
 > frame switches monitor between top and bottom, so that would imply
 > that the same switching should happen for "left". Iʼm undecided so far
 > as to which I think is the "correct" behaviour.

I'm not sure I understand.  Do you mean that when you change the value
of 'left' the frame always stays within the left monitor while when
you change 'top' the frame moves from the upper to the lower monitor
and back?  That would be queer.

 >>> [1]  Not completely to the right, but thatʼs a different issue
 >>
 >> Probably a problem with calculating the decorations.  Does
 >> (frame-geometry) return "reasonable" values for your frame?
 >
 > (display-monitor-attributes-list)
 >    (((name . "XWAYLAND0") (geometry 0 540 3840 2160) (workarea 0 540 3840
 >    2094) (mm-size 350 190) (frames #<frame *unsent wide reply to martin
 >    rudalics* 0x3d5ce80> #<frame *info* 0x89f6ff0> #<frame *scratch* 0x87f1a00>)
 >    (source . "Gdk")))
 >
 > (modify-frame-parameters nil '((user-position . t) (left .  1.0)))
 >
 > (frame-geometry)
 >    ((outer-position 2340 . 1730) (outer-size 1480 . 824)

Hmm ... 2340 + 1480 gives 3820 which is obviously 20 pixels to the
left of 3840.  This clearly went wrong.  Did we _ask_ for 2340 or
2360?

 >    (external-border-size 20 . 20) (outer-border-width . 0)
 >    (title-bar-size 0 . 70) (menu-bar-external . t) (menu-bar-size 0 . 0)
 >    (tool-bar-external . t) (tool-bar-position . top) (tool-bar-size 0
 >    . 0) (internal-border-width . 0))
 >
 > (+ 2340 1480) => 3820, + external-border-size? In any case, visually
 > the frame is not flush right.

Do we anywhere add only one 'external-border-size' instead of two?

 > If I correct the visual aspect:
 >
 > (modify-frame-parameters nil '((left .   (+ 2400))))
 >
 > (frame-geometry)
 >    ((outer-position 2380 . 1586) (outer-size 1480 . 824)
 >    (external-border-size 20 . 20) (outer-border-width . 0)
 >    (title-bar-size 0 . 70) (menu-bar-external . t) (menu-bar-size 0 . 0)
 >    (tool-bar-external . t) (tool-bar-position . top) (tool-bar-size 0
 >    . 0) (internal-border-width . 0))
 >
 > which to me says thereʼs a (-20) error for the outer-position at
 > least.

Why did you ask for 2400 and not for 2360?  If the position value is
too large the window manager might try to fit the frame onto the
screen.  OTOH "correcting" this to 2380 means there are 20 pixels (the
full right external border) missing on the right if not I am missing
something.

BTW is this on a high resolution display?  Would/should we scale
external borders on such a display too?

martin

 > Iʼll take a look at x_calc_absolute_position.

Fine.

Thanks, martin