emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[elpa] externals/posframe 428d471 2/2: * posframe.el (posframe-run-posha


From: ELPA Syncer
Subject: [elpa] externals/posframe 428d471 2/2: * posframe.el (posframe-run-poshandler): Fix position calcuation
Date: Thu, 8 Apr 2021 21:57:15 -0400 (EDT)

branch: externals/posframe
commit 428d471bbc224db38a554006d30c38bdd3407ce4
Author: Feng Shu <tumashu@163.com>
Commit: Feng Shu <tumashu@163.com>

    * posframe.el (posframe-run-poshandler): Fix position calcuation
---
 posframe.el | 24 +++++++++++++-----------
 1 file changed, 13 insertions(+), 11 deletions(-)

diff --git a/posframe.el b/posframe.el
index 38fae83..b814dae 100644
--- a/posframe.el
+++ b/posframe.el
@@ -1050,11 +1050,7 @@ of `posframe-show'."
   (if (equal info posframe--last-poshandler-info)
       posframe--last-posframe-pixel-position
     (setq posframe--last-poshandler-info info)
-    (let* ((posframe-width (plist-get info :posframe-width))
-           (posframe-height (plist-get info :posframe-height))
-           (ref-position (plist-get info :ref-position))
-           (ref-x (or (car ref-position) 0))
-           (ref-y (or (cdr ref-position) 0))
+    (let* ((ref-position (plist-get info :ref-position))
            (position (funcall
                       (or (plist-get info :poshandler)
                           (let ((position (plist-get info :position)))
@@ -1071,12 +1067,18 @@ of `posframe-show'."
            (y (cdr position)))
       (if (not ref-position)
           position
-        (when (< x 0)
-          (setq x (+ posframe-width x)))
-        (when (< y 0)
-          (setq y (+ posframe-height y)))
-        (cons (+ ref-x x)
-              (+ ref-y y))))))
+        (let* ((parent-frame-width (plist-get info :parent-frame-width))
+               (parent-frame-height (plist-get info :parent-frame-height))
+               (posframe-width (plist-get info :posframe-width))
+               (posframe--height (plist-get info :posframe-height))
+               (ref-x (or (car ref-position) 0))
+               (ref-y (or (cdr ref-position) 0)))
+          (when (< x 0)
+            (setq x (- (+ x parent-frame-width) posframe-width)))
+          (when (< y 0)
+            (setq y (- (+ y parent-frame-height) posframe--height)))
+          (cons (+ ref-x x)
+                (+ ref-y y)))))))
 
 (cl-defun posframe-poshandler-argbuilder (&optional
                                           child-frame



reply via email to

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