diff options
| author | Stefan Monnier | 2013-11-24 21:41:02 -0500 |
|---|---|---|
| committer | Stefan Monnier | 2013-11-24 21:41:02 -0500 |
| commit | 511fa0d3963313274ae2b74fc26fde52ddbddb42 (patch) | |
| tree | c423a0c4ec9e29b2a3dd344f008e4a10832f9f72 /lisp | |
| parent | 310294a38369db86610e5f5ab82860ce6451eada (diff) | |
| download | emacs-511fa0d3963313274ae2b74fc26fde52ddbddb42.tar.gz emacs-511fa0d3963313274ae2b74fc26fde52ddbddb42.zip | |
* lisp/frame.el (handle-focus-in, handle-focus-out): Move from frame.c.
Remove blink-cursor code.
(blink-cursor-timer-function, blink-cursor-suspend): Don't special-case GUIs.
(blink-cursor-mode): Use focus-in/out-hook.
* src/frame.c (Fhandle_focus_in, Fhandle_focus_out): Move to frame.el.
(syms_of_frame): Don't defsubr them.
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/ChangeLog | 16 | ||||
| -rw-r--r-- | lisp/frame.el | 45 |
2 files changed, 42 insertions, 19 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index f2d2f732222..d8b176fad65 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,11 @@ | |||
| 1 | 2013-11-25 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 2 | |||
| 3 | * frame.el (handle-focus-in, handle-focus-out): Move from frame.c. | ||
| 4 | Remove blink-cursor code. | ||
| 5 | (blink-cursor-timer-function, blink-cursor-suspend): | ||
| 6 | Don't special-case GUIs. | ||
| 7 | (blink-cursor-mode): Use focus-in/out-hook. | ||
| 8 | |||
| 1 | 2013-11-25 Dmitry Gutov <dgutov@yandex.ru> | 9 | 2013-11-25 Dmitry Gutov <dgutov@yandex.ru> |
| 2 | 10 | ||
| 3 | * vc/vc-git.el (vc-git-annotate-extract-revision-at-line): Make it | 11 | * vc/vc-git.el (vc-git-annotate-extract-revision-at-line): Make it |
| @@ -86,13 +94,13 @@ | |||
| 86 | 94 | ||
| 87 | 2013-11-21 Leo Liu <sdl.web@gmail.com> | 95 | 2013-11-21 Leo Liu <sdl.web@gmail.com> |
| 88 | 96 | ||
| 89 | * progmodes/octave.el (octave-mode, inferior-octave-mode): Fix | 97 | * progmodes/octave.el (octave-mode, inferior-octave-mode): |
| 90 | obsolete variable comment-use-global-state. | 98 | Fix obsolete variable comment-use-global-state. |
| 91 | 99 | ||
| 92 | 2013-11-21 RĂ¼diger Sonderfeld <ruediger@c-plusplus.de> | 100 | 2013-11-21 RĂ¼diger Sonderfeld <ruediger@c-plusplus.de> |
| 93 | 101 | ||
| 94 | * progmodes/octave.el (octave-mode-map, octave-mode-menu): Add | 102 | * progmodes/octave.el (octave-mode-map, octave-mode-menu): |
| 95 | `octave-source-file'. | 103 | Add `octave-source-file'. |
| 96 | (octave-source-file): New function. (Bug#15935) | 104 | (octave-source-file): New function. (Bug#15935) |
| 97 | 105 | ||
| 98 | 2013-11-21 Kenjiro Nakayama <nakayamakenjiro@gmail.com> (tiny change) | 106 | 2013-11-21 Kenjiro Nakayama <nakayamakenjiro@gmail.com> (tiny change) |
diff --git a/lisp/frame.el b/lisp/frame.el index 87756f78f1c..57f9395b935 100644 --- a/lisp/frame.el +++ b/lisp/frame.el | |||
| @@ -120,6 +120,21 @@ appended when the minibuffer frame is created." | |||
| 120 | (delete-frame frame t) | 120 | (delete-frame frame t) |
| 121 | ;; Gildea@x.org says it is ok to ask questions before terminating. | 121 | ;; Gildea@x.org says it is ok to ask questions before terminating. |
| 122 | (save-buffers-kill-emacs)))) | 122 | (save-buffers-kill-emacs)))) |
| 123 | |||
| 124 | (defun handle-focus-in (_event) | ||
| 125 | "Handle a focus-in event. | ||
| 126 | Focus-in events are usually bound to this function. | ||
| 127 | Focus-in events occur when a frame has focus, but a switch-frame event | ||
| 128 | is not generated. | ||
| 129 | This function runs the hook `focus-in-hook'." | ||
| 130 | (run-hooks 'focus-in-hook)) | ||
| 131 | |||
| 132 | (defun handle-focus-out (_event) | ||
| 133 | "Handle a focus-out event. | ||
| 134 | Focus-out events are usually bound to this function. | ||
| 135 | Focus-out events occur when no frame has focus. | ||
| 136 | This function runs the hook `focus-out-hook'." | ||
| 137 | (run-hooks 'focus-out-hook)) | ||
| 123 | 138 | ||
| 124 | ;;;; Arrangement of frames at startup | 139 | ;;;; Arrangement of frames at startup |
| 125 | 140 | ||
| @@ -1727,12 +1742,11 @@ command starts, by installing a pre-command hook." | |||
| 1727 | "Timer function of timer `blink-cursor-timer'." | 1742 | "Timer function of timer `blink-cursor-timer'." |
| 1728 | (internal-show-cursor nil (not (internal-show-cursor-p))) | 1743 | (internal-show-cursor nil (not (internal-show-cursor-p))) |
| 1729 | ;; Each blink is two calls to this function. | 1744 | ;; Each blink is two calls to this function. |
| 1730 | (when (memq window-system '(x ns w32)) | 1745 | (setq blink-cursor-blinks-done (1+ blink-cursor-blinks-done)) |
| 1731 | (setq blink-cursor-blinks-done (1+ blink-cursor-blinks-done)) | 1746 | (when (and (> blink-cursor-blinks 0) |
| 1732 | (when (and (> blink-cursor-blinks 0) | 1747 | (<= (* 2 blink-cursor-blinks) blink-cursor-blinks-done)) |
| 1733 | (<= (* 2 blink-cursor-blinks) blink-cursor-blinks-done)) | 1748 | (blink-cursor-suspend) |
| 1734 | (blink-cursor-suspend) | 1749 | (add-hook 'post-command-hook 'blink-cursor-check))) |
| 1735 | (add-hook 'post-command-hook 'blink-cursor-check)))) | ||
| 1736 | 1750 | ||
| 1737 | 1751 | ||
| 1738 | (defun blink-cursor-end () | 1752 | (defun blink-cursor-end () |
| @@ -1747,15 +1761,14 @@ itself as a pre-command hook." | |||
| 1747 | (setq blink-cursor-timer nil))) | 1761 | (setq blink-cursor-timer nil))) |
| 1748 | 1762 | ||
| 1749 | (defun blink-cursor-suspend () | 1763 | (defun blink-cursor-suspend () |
| 1750 | "Suspend cursor blinking on NS, X and W32. | 1764 | "Suspend cursor blinking. |
| 1751 | This is called when no frame has focus and timers can be suspended. | 1765 | This is called when no frame has focus and timers can be suspended. |
| 1752 | Timers are restarted by `blink-cursor-check', which is called when a | 1766 | Timers are restarted by `blink-cursor-check', which is called when a |
| 1753 | frame receives focus." | 1767 | frame receives focus." |
| 1754 | (when (memq window-system '(x ns w32)) | 1768 | (blink-cursor-end) |
| 1755 | (blink-cursor-end) | 1769 | (when blink-cursor-idle-timer |
| 1756 | (when blink-cursor-idle-timer | 1770 | (cancel-timer blink-cursor-idle-timer) |
| 1757 | (cancel-timer blink-cursor-idle-timer) | 1771 | (setq blink-cursor-idle-timer nil))) |
| 1758 | (setq blink-cursor-idle-timer nil)))) | ||
| 1759 | 1772 | ||
| 1760 | (defun blink-cursor-check () | 1773 | (defun blink-cursor-check () |
| 1761 | "Check if cursor blinking shall be restarted. | 1774 | "Check if cursor blinking shall be restarted. |
| @@ -1789,13 +1802,15 @@ terminals, cursor blinking is controlled by the terminal." | |||
| 1789 | (if blink-cursor-idle-timer (cancel-timer blink-cursor-idle-timer)) | 1802 | (if blink-cursor-idle-timer (cancel-timer blink-cursor-idle-timer)) |
| 1790 | (setq blink-cursor-idle-timer nil) | 1803 | (setq blink-cursor-idle-timer nil) |
| 1791 | (blink-cursor-end) | 1804 | (blink-cursor-end) |
| 1805 | (remove-hook 'focus-in-hook #'blink-cursor-check) | ||
| 1806 | (remove-hook 'focus-out-hook #'blink-cursor-suspend) | ||
| 1792 | (when blink-cursor-mode | 1807 | (when blink-cursor-mode |
| 1793 | ;; Hide the cursor. | 1808 | (add-hook 'focus-in-hook #'blink-cursor-check) |
| 1794 | ;;(internal-show-cursor nil nil) | 1809 | (add-hook 'focus-out-hook #'blink-cursor-suspend) |
| 1795 | (setq blink-cursor-idle-timer | 1810 | (setq blink-cursor-idle-timer |
| 1796 | (run-with-idle-timer blink-cursor-delay | 1811 | (run-with-idle-timer blink-cursor-delay |
| 1797 | blink-cursor-delay | 1812 | blink-cursor-delay |
| 1798 | 'blink-cursor-start)))) | 1813 | #'blink-cursor-start)))) |
| 1799 | 1814 | ||
| 1800 | 1815 | ||
| 1801 | ;; Frame maximization/fullscreen | 1816 | ;; Frame maximization/fullscreen |