help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Frame shifted upwards upon changing font size


From: Pascal Quesseveur
Subject: Re: Frame shifted upwards upon changing font size
Date: Thu, 15 Sep 2022 17:09:24 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.1 (windows-nt)

FWIW I have defined those functions to position a frame in case of
multiple monitors.

--8<---------------cut here---------------start------------->8---
(defun qsr/move-frame-pos (frame pos &optional xoffset yoffset)
  "Move FRAME at POS (x . y) and apply XOFFSET to x coordinate and
YOFFSET to y coordinate."
  (let* ((left (car pos))
         (top (cdr pos))
         (width (frame-outer-width frame))
         (height (frame-outer-height frame))
         (monitor-workarea
          (cdr (assq 'workarea (frame-monitor-attributes frame))))
         nleft ntop)
    (if (and monitor-workarea (< left 0))
        (setq nleft (- (+ left width xoffset) (nth 2 monitor-workarea)))
      (setq nleft (+ left xoffset)))
    (if (and monitor-workarea (< top 0))
        (setq ntop (- (+ top height yoffset) (nth 3 monitor-workarea)))
      (setq ntop (+ top yoffset)))
    (set-frame-position frame nleft ntop)
    frame))
(defun qsr/move-current-frame-offset()
  "Move selected frame by offset (32 24)."
  (interactive)
  (qsr/move-frame-pos (selected-frame) (frame-position) 32 24))
--8<---------------cut here---------------end--------------->8---

HTH


-- 
Pascal Quesseveur
pquessev@gmail.com




reply via email to

[Prev in Thread] Current Thread [Next in Thread]