bug#81193: 31.0.90; Wrong offsets in 'set-frame-size-and-position'
Sean Whitton <[email protected]> Tue, 04 Aug 2026 13:43:48 +0100
| Newsgroups | gmane.emacs.bugs |
|---|---|
| Message-ID | <[email protected]> |
martin rudalics via "Bug reports for GNU Emacs, the Swiss army knife of text editors" [06/Jun 11:28am +02] wrote: > In its current version, 'set-frame-size-and-position' adds the > differences between outer and text rectangle twice when calculating the > frame size and subsequently offsets. As a consequence, one can't align > a frame versus the left or bottom edge of its display or workarea > correctly. With emacs -Q evaluate the following form: > > (let ((bottom (- (nth 3 (cdr (assq 'geometry (frame-monitor-attributes)))) > (nth 3 (cdr (assq 'workarea (frame-monitor-attributes))))))) > (set-frame-size-and-position nil 80 20 '- `(- ,bottom))) > > The attached patch should fix that. Since 'set-frame-size-and-position' > is new in Emacs 31 I intend to fix this on the release branch if there > are no objections. > > Thanks, martin > diff --git a/lisp/frame.el b/lisp/frame.el > index 85b58cee070..36c14304ec7 100644 > --- a/lisp/frame.el > +++ b/lisp/frame.el > @@ -1782,11 +1782,7 @@ set-frame-size-and-position > (when negative > (setq gravity 3) > (setq left (- parent-or-display-width (- left) > - (+ text-width > - (frame-scroll-bar-width frame) > - (frame-fringe-width frame) > - (* 2 (frame-internal-border-width frame)) > - outer-minus-text-width)))) > + text-width outer-minus-text-width))) > > (setq negative nil) > (cond > @@ -1813,9 +1809,7 @@ set-frame-size-and-position > ;; This should get us 7 or 9. > (setq gravity (+ gravity 6)) > (setq top (- parent-or-display-height (- top) > - (+ text-height > - (* 2 (frame-internal-border-width frame))) > - outer-minus-text-height))) > + text-height outer-minus-text-height))) > > (set-frame-size-and-position-pixelwise > frame text-width text-height left top gravity))) This patch was installed, but there was a lot of additional discussion. Were further serious problems revealed that still aren't fixed? -- Sean Whitton