Function: hmouse-swap-windows

hmouse-swap-windows is a byte-compiled function defined in hui-window.el.

Signature

(hmouse-swap-windows)

Documentation

Swaps the sizes of 2 windows selected by the last Smart Key depress and release.

Source Code

;; Defined in ~/.emacs.d/elpa/hyperbole-20260414.325/hui-window.el
(defun hmouse-swap-windows ()
  "Swaps the sizes of 2 windows selected by the last Smart Key depress and release."
  (let* ((w1 (if assist-flag assist-key-depress-window
	       action-key-depress-window))
	 (w2 (if assist-flag assist-key-release-window
	       action-key-release-window))
	 (w1-width  (and w1 (window-width w1)))
	 (w1-height (and w1 (window-height w1)))
	 (w2-width  (and w2 (window-width w2)))
	 (w2-height (and w2 (window-height w2))))
    (or (and w1 w2)
	(error "(hmouse-swap-windows): Last depress or release was not within a window"))
    (unwind-protect
	(progn
	  (select-window w1)
	  (unless (= w1-height (frame-height))
	    (shrink-window (- w1-height w2-height)))
	  (unless (= w1-width (frame-width))
	    (shrink-window-horizontally (- w1-width w2-width)))
	  (select-window w2)
	  (setq w2-width (window-width w2)
		w2-height (window-height w2))
	  (unless (= w2-height (frame-height))
	    (shrink-window (- w2-height w1-height)))
	  (unless (= w2-width (frame-width))
	    (shrink-window-horizontally (- w2-width w1-width))))
      (select-window w2))))