diff --git a/mode-icons.el b/mode-icons.el index 5dbe49d..8269947 100644 --- a/mode-icons.el +++ b/mode-icons.el @@ -455,6 +455,11 @@ This only works with xpm files." ACTIVE tells if current window is active." (or face (and active 'mode-line) 'mode-line-inactive)) +(defun mode-icons-line-height (&optional window) + "Gets the height in pixels of WINDOW's mode-line, if accessible. +This uses `window-mode-line-height' on emacs 24.4+. Otherwise it assumes 16." + (or (and (fboundp 'window-mode-line-height) (window-mode-line-height window)) 16)) + (defun mode-icons-get-icon-display (icon type &optional face active) "Get the value for the display property of ICON having TYPE. @@ -488,14 +493,14 @@ ACTIVE is an indicator that the current window is active." t :ascent 'center :face face :xpm-bw t - :height (window-mode-line-height) + :height (mode-icons-line-height) :icon icon)) ((eq type 'xpm-bw) (create-image icon-path (or (and (fboundp 'imagemagick-types) (memq 'png (imagemagick-types)) 'imagemagick) 'xpm) - :height (window-mode-line-height) + :height (mode-icons-line-height) :ascent 'center :face face :icon icon)) @@ -507,7 +512,7 @@ ACTIVE is an indicator that the current window is active." (memq 'png (imagemagick-types)) 'imagemagick) 'xpm) t :ascent 'center - :height (window-mode-line-height) + :height (mode-icons-line-height) :face face :icon icon)) (t (create-image icon-path @@ -516,7 +521,7 @@ ACTIVE is an indicator that the current window is active." 'imagemagick) (or (and (eq type 'jpg) 'jpeg) type)) nil - :height (window-mode-line-height) + :height (mode-icons-line-height) :ascent 'center :face face :icon icon))))) ((and (eq type 'emoji) (setq tmp (mode-icons--get-emoji " " (list "" icon type) face))) (get-text-property 0 'display tmp)) @@ -1059,7 +1064,7 @@ ACTIVE is a flag telling if the current window is active." (memq 'png (imagemagick-types))) 'imagemagick) 'png) nil - :height (window-mode-line-height) + :height (mode-icons-line-height) :ascent 'center :heuristic-mask t :face face) @@ -1117,7 +1122,7 @@ ACTIVE is a flag for if the current window is active." :face face ;; :background (emojify--get-image-background beg end) ;; no-op if imagemagick is not available - :height (window-mode-line-height)) + :height (mode-icons-line-height)) 'face face 'mode-icons-p icon-spec))))))