Function: bubbles--compute-offsets

bubbles--compute-offsets is a byte-compiled function defined in bubbles.el.gz.

Signature

(bubbles--compute-offsets)

Documentation

Update horizontal and vertical offsets for centering the bubbles grid.

Set bubbles--col-offset and bubbles--row-offset.

Source Code

;; Defined in /usr/src/emacs/lisp/play/bubbles.el.gz
(defun bubbles--compute-offsets ()
  "Update horizontal and vertical offsets for centering the bubbles grid.
Set `bubbles--col-offset' and `bubbles--row-offset'."
  (let* ((use-images-p (and (display-images-p)
                            bubbles--images-ok
                            (not (eq bubbles-graphics-theme 'ascii))))
         (bubbles--image-size
          (if use-images-p (car (image-size (car bubbles--images) t)) 1))
         ;; In GUI mode, leave thin margins around the images.
         (image-hor-size
          (if use-images-p (+ bubbles--image-size 2) bubbles--image-size))
         (image-vert-size
          (if use-images-p (1+ bubbles--image-size) bubbles--image-size)))
    (setq bubbles--col-offset
          (max 0 (/ (- (nth 2 (window-body-pixel-edges))
                       (nth 0 (window-body-pixel-edges))
                       (* image-hor-size (bubbles--grid-width)))
                    2)))
    (setq bubbles--row-offset
          (max 0 (/ (- (nth 3 (window-body-pixel-edges))
                       (nth 1 (window-body-pixel-edges))
                       (* image-vert-size (bubbles--grid-height)))
                    2)))))