
(defvar sm-mouse-edge-sensitivity 3 "\
*Number of characters from screen edges within which a click is considered at an edge.")

(defvar sm-mouse-side-sensitivity 1 "\
*Characters in either direction from window side within which a click is considered on the side.")

(defvar sm-mouse-x-drag-sensitivity 3 "\
*Number of chars mouse must move horizontally between depress/release to register a horizontal drag.")

(defvar sm-mouse-y-drag-sensitivity 2 "\
*Number of lines mouse must move vertically between depress/release to register a vertical drag.")

(defvar sm-mouse-x-diagonal-sensitivity 4 "\
*Number of chars mouse must move horizontally between depress/release to register a diagonal drag.")

(defvar sm-mouse-y-diagonal-sensitivity 3 "\
*Number of lines mouse must move vertically between depress/release to register a diagonal drag.")

(byte-code "ÁÀ!?ƒ ÂÃ!‚ ÄÅÆ\">† ÇÈ\"‰‡" [smart-key-mouse-alist boundp error "\"hui-modeln.el\": smart-key-mouse-alist must be defined before loading this." sm-mouse-drag-window-side mapcar (lambda (elt) (byte-code "	@<…
 @)‡" [pred elt] 1)) append (((sm-mouse-drag-window-side) (sm-mouse-resize-window-side) sm-mouse-resize-window-side (quote secondary)) ((setq smart-key-value (and (not (sm-mouse-drag-between-windows)) (sm-mouse-drag-horizontally))) (sm-mouse-horizontal) sm-mouse-horizontal-meta) ((sm-mouse-depress-in-modeline) (sm-mouse-modeline) sm-mouse-modeline-meta) ((sm-mouse-drag-between-windows) (hui:link-directly) sm-mouse-swap-buffers (quote secondary)) ((sm-mouse-drag-vertically) (sm-split-window-horizontally) sm-split-window-horizontally) ((setq smart-key-value (sm-mouse-drag-diagonally)) (wconfig-ring-save) wconfig-yank-pop (prefix-numeric-value current-prefix-arg)))] 6)

(defun sm-mouse-depress-in-modeline nil "\
Returns non-nil if Smart Key was depressed on a window mode line.
If free variable 'meta' is non-nil, uses secondary Smart Key." (byte-code "	ƒ 
‚	 …3 È!… ÉÊ!8SË!…2 …2 U+)‡" [args meta *smart-key-meta-depress-args* *smart-key-depress-args* hyperb:window-system w mode-ln last-press-y smart-window-of-coords 3 window-edges sm-mouse-y-coord] 5))

(defun sm-mouse-drag-between-windows nil "\
Returns non-nil if last Smart Key depress and release were in different windows.
If free variable 'meta' is non-nil, uses secondary Smart Key." (byte-code "ƒ 	… 
… 	
=?‚ … … =?‡" [meta smart-key-meta-depress-window smart-key-meta-release-window smart-key-depress-window smart-key-release-window] 2))

(defun sm-mouse-drag-diagonally nil "\
Returns non-nil iff last Smart Key use was a diagonal drag within a single window.
If free variable 'meta' is non-nil, uses secondary Smart Key.
Value returned is nil if not a diagonal drag, or one of the following symbols
depending on the direction of the drag: southeast, southwest, northwest, northeast." (byte-code "ÌÌÌÌƒ\" Í!Í!Î!Î!‰‚7 Í!Í!Î!Î!‰ˆ…� 	…� 
…� …� 	]	^Z	Y…� 
]
^Z
Y…� 	Wƒv 
Wƒr Ï‚s Ð‚� 
Wƒ€ Ñ‚� Ò,‡" [last-depress-x last-release-x last-depress-y last-release-y meta *smart-key-meta-depress-args* *smart-key-meta-release-args* *smart-key-depress-args* *smart-key-release-args* sm-mouse-x-diagonal-sensitivity sm-mouse-y-diagonal-sensitivity t nil sm-mouse-x-coord sm-mouse-y-coord southeast northeast southwest northwest] 11))

(defun sm-mouse-drag-horizontally nil "\
Returns non-nil iff last Smart Key use was a horizontal drag within a single window.
If free variable 'meta' is non-nil, uses secondary Smart Key.
Value returned is nil if not a horizontal drag, 'left if drag moved left or
'right otherwise." (byte-code "ËËËËƒ\" Ì!Ì!Í!Í!‰‚7 Ì!Ì!Í!Í!‰ˆ…m 	…m 
…m …m 	]	^Z	Y…m 
]
^Z
W…m 	Wƒl Î‚m Ï,‡" [last-depress-x last-release-x last-depress-y last-release-y meta *smart-key-meta-depress-args* *smart-key-meta-release-args* *smart-key-depress-args* *smart-key-release-args* sm-mouse-x-drag-sensitivity sm-mouse-y-drag-sensitivity nil sm-mouse-x-coord sm-mouse-y-coord right left] 11))

(defun sm-mouse-drag-vertically nil "\
Returns non-nil iff last Smart Key use was a vertical drag within a single window.
If free variable 'meta' is non-nil, uses secondary Smart Key.
Value returned is nil if not a vertical line drag, 'up if drag moved up or
'down otherwise." (byte-code "ËËËËƒ\" Ì!Ì!Í!Í!‰‚7 Ì!Ì!Í!Í!‰ˆ…m 	…m 
…m …m 
]
^Z	Y…m 	]	^Z
X…m 
Wƒl Î‚m Ï,‡" [last-depress-x last-release-x last-depress-y last-release-y meta *smart-key-meta-depress-args* *smart-key-meta-release-args* *smart-key-depress-args* *smart-key-release-args* sm-mouse-y-drag-sensitivity sm-mouse-x-drag-sensitivity nil sm-mouse-x-coord sm-mouse-y-coord down up] 11))

(or (fboundp (quote abs)) (defun abs (number) "Return the absolute value of NUMBER." (byte-code "ÂWƒ ÂZ‚ ‡" [number t 0] 2)))

(defun sm-mouse-drag-window-side nil "\
Returns non-nil if Smart Key was dragged from a window side divider.
If free variable 'meta' is non-nil, uses secondary Smart Key." (byte-code "…i 
ƒ ‚ 
ƒ ‚ Í	!…+ ÎÏ!8S	Ð	!
Ð!
…g …g 	…g Ñ
\"…g Ñ	TÒ \"…g 
	Z	
Z]X.‡" [hyperb:window-system depress-args meta *smart-key-meta-depress-args* *smart-key-depress-args* release-args *smart-key-meta-release-args* *smart-key-release-args* w side-ln last-press-x last-release-x sm-mouse-side-sensitivity smart-window-of-coords 2 window-edges sm-mouse-x-coord /= screen-width] 10))

(defun sm-split-window-horizontally nil "\
Splits current window in two evenly, side by side.
Beeps and prints message if can't split window further." (interactive) (let ((window-min-width 5)) (condition-case nil (split-window-horizontally nil) (error (beep) (message "(sm-split-window-horizontally): Can't split window further.")))))

(defun sm-split-window-vertically nil "\
Splits current window in two evenly, one above the other.
Beeps and prints message if can't split window further." (interactive) (let ((window-min-height 2)) (condition-case nil (byte-code "ÁÂ!ƒ ÂÀ!‚ ÃÀ!‡" [nil fboundp split-window-quietly split-window-vertically] 4) (error (beep) (message "(sm-split-window-vertically): Can't split window further.")))))

(defun smart-coords-in-window-p (coords window) "\
Tests if COORDS are in WINDOW.  Returns WINDOW if they are, nil otherwise." (byte-code "ƒ ÊË	!!
=‚O Ì
!Í8Î8Ï8Ð8Ñ	!Ò	!	X…M X…M 	X…M 	X…M 
.‡" [hyperb:emacs19-p coords window edges w-xmin w-ymin w-xmax w-ymax x y posn-window event-start window-edges 0 1 2 3 sm-mouse-x-coord sm-mouse-y-coord] 7))

(defun smart-window-of-coords (coords) "\
Returns window in which COORDS fall or nil if none.
Ignores minibuffer window." (byte-code "ƒ ÅÆ	!!‚0 ÇÈ!ÉÉ?… 
…- 
@
AÊ	\"‰ˆ‚ ˆ+‡" [hyperb:emacs19-p coords window-list window w posn-window event-start hypb:window-list no-minibuf nil smart-coords-in-window-p] 7))

(defun sm-mouse-horizontal nil "\
Goes to buffer end if drag was to the right, otherwise goes to beginning." (byte-code "Á=ƒ Â ‚ Ã ‡" [smart-key-value right end-of-buffer beginning-of-buffer] 3))

(defun sm-mouse-horizontal-meta nil "\
Splits window vertically if drag was to the right, otherwise deletes window." (byte-code "Á=ƒ Â ‚ Ã ‡" [smart-key-value right sm-split-window-vertically delete-window] 3))

(defun sm-mouse-modeline nil "\
Handles Smart Key depresses on a window mode line.
If key is:
 (1) clicked on left edge of a window's modeline,
     window's buffer is buried (placed at bottom of buffer list);
 (2) clicked on right edge of a window's modeline,
     the Info buffer is displayed, or if already displayed and the
     modeline clicked belongs to a window displaying Info, the Info
     buffer is hidden;
 (3) clicked anywhere in the middle of a window's modeline,
     a Smart Menu (if available) or a popup menu (if available)
     is displayed;
 (4) dragged vertically from modeline to within a window,
     the modeline is moved to point of key release, thereby resizing
     its window and potentially its vertical neighbors." (byte-code "Ä	!… Å!ˆÆ ƒ; Ç ƒ È ‚8 É ƒ0 
Ê=ƒ+ Ë ‚- Ì ‚8 ÍÎ!…8 Î ‚= Ï )‡" [w *smart-key-depress-args* major-mode t smart-window-of-coords select-window sm-mouse-modeline-click sm-mouse-release-left-edge bury-buffer sm-mouse-release-right-edge Info-mode Info-exit info fboundp smart-menu sm-mouse-modeline-resize-window] 12))

(defun sm-mouse-modeline-meta nil "\
Handles secondary Smart Key depresses on a window mode line.
If secondary key is:
 (1) clicked on left edge of a window's modeline,
     bottom buffer in buffer list is unburied and placed in window;
 (2) clicked on right edge of a window's modeline,
     the summary of Smart Key behavior is displayed, or if already
     displayed and the modeline clicked belongs to a window displaying
     the summary, the summary buffer is hidden;
 (3) clicked anywhere in the middle of a window's modeline,
     a popup menu (if available) is displayed;
 (4) dragged vertically from modeline to within a window,
     the modeline is moved to point of key release, thereby resizing
     its window and potentially its vertical neighbors." (byte-code "ÆÇ
!	… È	!ˆÉÊ!ƒf ËÊ!ƒG Ì GS8ÍÎ!ÏHÐ\"…1 ‰?…? S‰ˆ‚! ˆÑ!*‚c ÒÊ!ƒb ÓÎ ÔÕ!\"ƒ\\ Ö ‚_ ×Ø!‚c Æ‚i ÙÊ!*‡" [val w *smart-key-meta-depress-args* bufs entry t nil smart-window-of-coords select-window sm-mouse-modeline-click secondary sm-mouse-release-left-edge buffer-list /= buffer-name 0 32 switch-to-buffer sm-mouse-release-right-edge equal hypb:help-buf-name "Smart" smart-key-help-hide smart-key-summarize current-window sm-mouse-modeline-resize-window] 16))

(defun sm-mouse-modeline-click (&optional secondary) "\
Returns non-nil if last Smart Key depress and release was at same point in a modeline.
Optional SECONDARY non-nil means test for secondary Smart Key click instead." (sm-mouse-modeline-release secondary))

(defun sm-mouse-modeline-release (&optional secondary) "\
Returns non-nil if Smart Key was released on a window mode line.
Optional non-nil SECONDARY means test release of secondary Smart Key instead." (byte-code "	ƒ 
‚	 … …7 È!…  ÉÊ!8SË!…6 …6 U+)‡" [args secondary *smart-key-meta-release-args* *smart-key-release-args* hyperb:window-system w mode-ln last-press-y smart-window-of-coords 3 window-edges sm-mouse-y-coord] 5))

(defun sm-mouse-modeline-resize-window (&optional secondary) "\
Resizes window whose mode line was depressed upon by the Smart Key.
Optional arg SECONDARY non-nil means use values from secondary Smart Key instead.
Resize amount depends upon the vertical difference between press and release
of the Smart Key." (byte-code "?ƒ	 Á‚Š Ï Ðƒ ‚ !…# ÑÒ!8SÓƒ/ 	‚1 
!Z…R pÔŽÕ!qˆÖ!b))ˆ×\\Ø Yƒc ÙÚ!‚‰ ÛÜ!G×Wƒr ÙÝ!‚‰ ÞŽß!ˆà!ˆßáÁâ\"!ˆÁãä�)-‡" [hyperb:window-system nil owind window secondary *smart-key-meta-depress-args* *smart-key-depress-args* mode-ln last-release-y *smart-key-meta-release-args* *smart-key-release-args* shrink-amount smart-key-release-prev-point obuf t selected-window smart-window-of-coords 3 window-edges sm-mouse-y-coord ((set-buffer obuf)) marker-buffer marker-position 2 screen-height error "(sm-mouse-modeline-resize-window): Can't move bottom window on screen." hypb:window-list no-minibuf "(sm-mouse-modeline-resize-window): Can't resize sole window on screen." ((select-window owind)) select-window shrink-window next-window no-mini (scroll-down shrink-amount) ((error nil))] 17))

(defun sm-mouse-release-left-edge (&optional secondary) "\
Returns non-nil if last Smart Key release was at left window edge.
'sm-mouse-edge-sensitivity' value determines how near to actual edge the
release must be." (byte-code "Æ @Ç
ƒ ‚ !	…! 	ZW…! 	ZÈY*‡" [window-left last-release-x secondary *smart-key-meta-release-args* *smart-key-release-args* sm-mouse-edge-sensitivity window-edges sm-mouse-x-coord 0] 4))

(defun sm-mouse-release-right-edge (&optional secondary) "\
Returns non-nil if last Smart Key release was at right window edge.
'sm-mouse-edge-sensitivity' value determines how near to actual edge the
release must be." (byte-code "ÆÇ 8È
ƒ ‚ !	…\" 	\\Y…\" 	ZÉY*‡" [window-right last-release-x secondary *smart-key-meta-release-args* *smart-key-release-args* sm-mouse-edge-sensitivity 2 window-edges sm-mouse-x-coord 0] 4))

(defun sm-mouse-resize-window-side (&optional secondary) "\
Resizes window whose side was depressed upon by the Smart Key.
Optional arg SECONDARY non-nil means use values from secondary Smart Key instead.
Resize amount depends upon the horizontal difference between press and release
of the Smart Key." (byte-code "?ƒ	 Á‚~ Ï Ðƒ ‚ !…# ÑÒ!8SÓƒ/ 	‚1 
!Z…R pÔŽÕ!qˆÖ!b))ˆÑ\\× Yƒc ØÙ!‚} ÚÛ!GÑWƒr ØÜ!‚} ÝŽÞ!ˆß!)-‡" [hyperb:window-system nil owind window secondary *smart-key-meta-depress-args* *smart-key-depress-args* side-ln last-release-x *smart-key-meta-release-args* *smart-key-release-args* shrink-amount smart-key-release-prev-point obuf t selected-window smart-window-of-coords 2 window-edges sm-mouse-x-coord ((set-buffer obuf)) marker-buffer marker-position screen-width error "(sm-mouse-resize-window-side): Can't change width of full screen width window." hypb:window-list no-minibuf "(sm-mouse-resize-window-side): Can't resize sole window on screen." ((select-window owind)) select-window shrink-window-horizontally] 13))

(defun sm-mouse-swap-buffers (&optional secondary) "\
Swaps buffers in windows selected with last Smart Key depress and release.
If optional arg SECONDARY is non-nil, uses secondary Smart Key." (byte-code "	ƒ 
‚	 	ƒ ‚ … É!…% É!…, †2 ÊË!ˆÌ\"ˆÌ\",‡" [w1 secondary smart-key-meta-depress-window smart-key-depress-window w2 smart-key-meta-release-window smart-key-release-window w1-buf w2-buf window-buffer error "(sm-mouse-swap-buffers): Last depress or release not within a window." set-window-buffer] 7))

(defun sm-mouse-swap-windows (&optional secondary) "\
Swaps windows selected with last Smart Key depress and release.
If optional arg SECONDARY is non-nil, uses secondary Smart Key." (byte-code "	ƒ 
‚	 	ƒ ‚ … Ë!…% Ì!…. Ë!	…7 Ì!
…> †D ÍÎ!ˆÏŽÐ!ˆÑ U?…[ Ò
Z!ˆÓ U?…l Ô	Z!ˆÐ!ˆË!	Ì!‰
ˆ
Ñ U?…� Ò
Z!ˆ	Ó U?…ž Ô	Z!).‡" [w1 secondary smart-key-meta-depress-window smart-key-depress-window w2 smart-key-meta-release-window smart-key-release-window w1-width w1-height w2-width w2-height window-width window-height error "(sm-mouse-swap-windows): Last depress or release not within a window." ((select-window w2)) select-window screen-height shrink-window screen-width shrink-window-horizontally] 19))

(defun sm-mouse-x-coord (args) "\
Returns x coordinate in chars from window system dependent ARGS." (byte-code "ÂÃ	Ä\"A!Å!ƒ ‚ ÆÇ\")‡" [x hyperb:window-system eval assoc (("emacs19" if (eventp args) (+ (car (nth 2 (event-start args))) (nth 0 (window-edges (car (car (cdr args)))))) (car args)) ("lemacs" if (eventp args) (event-x args) (car args)) ("xterm" car args) ("epoch" nth 0 args) ("sun" nth 1 args) ("next" nth 1 args) ("apollo" car args)) integerp error "(sm-mouse-x-coord): invalid X coord: %s"] 6))

(defun sm-mouse-y-coord (args) "\
Returns y coordinate in screen lines from window system dependent ARGS." (byte-code "ÂÃ	Ä\"A!Å!ƒ ‚ ÆÇ\")‡" [y hyperb:window-system eval assoc (("emacs19" if (eventp args) (+ (cdr (nth 2 (event-start args))) (nth 1 (window-edges (car (car (cdr args)))))) (cdr args)) ("lemacs" if (eventp args) (event-y args) (cdr args)) ("xterm" nth 1 args) ("epoch" nth 1 args) ("sun" nth 2 args) ("next" nth 2 args) ("apollo" nth 1 args)) integerp error "(sm-mouse-y-coord): invalid Y coord: %s"] 6))

(provide (quote hui-window))
