[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[AUCTeX-diffs] [elpa] externals/auctex 67bd5ff 02/11: Use frame-monitor-
From: |
Tassilo Horn |
Subject: |
[AUCTeX-diffs] [elpa] externals/auctex 67bd5ff 02/11: Use frame-monitor-attributes for computing DPI if avail (bug#45596) |
Date: |
Fri, 8 Jan 2021 14:24:29 -0500 (EST) |
branch: externals/auctex
commit 67bd5ffe4fe9d0e0af96f145e098ba1c632f680b
Author: Tassilo Horn <tsdh@gnu.org>
Commit: Tassilo Horn <tsdh@gnu.org>
Use frame-monitor-attributes for computing DPI if avail (bug#45596)
* preview.el.in (preview-get-dpi): New defun.
(preview-get-geometry): Use it for computing the screen DPI (bug#45596)
---
preview.el.in | 24 ++++++++++++++++++++----
1 file changed, 20 insertions(+), 4 deletions(-)
diff --git a/preview.el.in b/preview.el.in
index 58c2741..eb40ae5 100644
--- a/preview.el.in
+++ b/preview.el.in
@@ -3603,6 +3603,25 @@ name(\\([^)]+\\))\\)\\|\
snippet)) "Parser"))))))))
(preview-call-hook 'close (car open-data) close-data))))))
+(defun preview-get-dpi ()
+ ;; TODO: Remove false-case when required emacs version is bumped to
+ ;; 24.4 or newer as this is the version where
+ ;; `frame-monitor-attributes' has been introduced.
+ (if (fboundp 'frame-monitor-attributes)
+ (let* ((monitor-attrs (frame-monitor-attributes))
+ (mm-dims (cdr (assoc 'mm-size monitor-attrs)))
+ (mm-width (nth 0 mm-dims))
+ (mm-height (nth 1 mm-dims))
+ (pixel-dims (cdddr (assoc 'geometry monitor-attrs)))
+ (pixel-width (nth 0 pixel-dims))
+ (pixel-height (nth 1 pixel-dims)))
+ (cons (/ (* 25.4 pixel-width) mm-width)
+ (/ (* 25.4 pixel-height) mm-height)))
+ (cons (/ (* 25.4 (display-pixel-width))
+ (display-mm-width))
+ (/ (* 25.4 (display-pixel-height))
+ (display-mm-height)))))
+
(defun preview-get-geometry ()
"Transfer display geometry parameters from current display.
Returns list of scale, resolution and colors. Calculation
@@ -3610,10 +3629,7 @@ is done in current buffer."
(condition-case err
(let* ((geometry
(list (preview-hook-enquiry preview-scale-function)
- (cons (/ (* 25.4 (display-pixel-width))
- (display-mm-width))
- (/ (* 25.4 (display-pixel-height))
- (display-mm-height)))
+ (preview-get-dpi)
(preview-get-colors)))
(preview-min-spec
(* (cdr (nth 1 geometry))
- [AUCTeX-diffs] [elpa] externals/auctex updated (ab09ac9 -> eb98493), Tassilo Horn, 2021/01/08
- [AUCTeX-diffs] [elpa] externals/auctex eb117f2 01/11: Remove support for \swshape, Tassilo Horn, 2021/01/08
- [AUCTeX-diffs] [elpa] externals/auctex 67bd5ff 02/11: Use frame-monitor-attributes for computing DPI if avail (bug#45596),
Tassilo Horn <=
- [AUCTeX-diffs] [elpa] externals/auctex c5cd145 04/11: ; Fix typo., Tassilo Horn, 2021/01/08
- [AUCTeX-diffs] [elpa] externals/auctex db2236e 06/11: ; Revert silencing the compiler (commit 07b79fca8b), Tassilo Horn, 2021/01/08
- [AUCTeX-diffs] [elpa] externals/auctex 98ff870 05/11: ; Update copyright year, Tassilo Horn, 2021/01/08
- [AUCTeX-diffs] [elpa] externals/auctex ee00f56 08/11: Use proper name rather than obsolete alias, Tassilo Horn, 2021/01/08
- [AUCTeX-diffs] [elpa] externals/auctex fcb1aec 07/11: Update style/eso-pic.el to package version 3.0a, Tassilo Horn, 2021/01/08
- [AUCTeX-diffs] [elpa] externals/auctex 9100b87 03/11: Use `write-contents-functions' instead of `write-file-functions', Tassilo Horn, 2021/01/08
- [AUCTeX-diffs] [elpa] externals/auctex 73e90ba 09/11: Declare formerly free vars accessible in TeX-translate-location-hook, Tassilo Horn, 2021/01/08
- [AUCTeX-diffs] [elpa] externals/auctex 0eabe75 10/11: Merge remote-tracking branch 'origin/master' into externals/auctex, Tassilo Horn, 2021/01/08
- [AUCTeX-diffs] [elpa] externals/auctex eb98493 11/11: Regenerate info docs, Tassilo Horn, 2021/01/08