emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] trunk r115221: * lisp/frame.el (handle-focus-in, handle-fo


From: Stefan Monnier
Subject: [Emacs-diffs] trunk r115221: * lisp/frame.el (handle-focus-in, handle-focus-out): Move from frame.c.
Date: Mon, 25 Nov 2013 02:41:12 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 115221
revision-id: address@hidden
parent: address@hidden
committer: Stefan Monnier <address@hidden>
branch nick: trunk
timestamp: Sun 2013-11-24 21:41:02 -0500
message:
  * 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.
modified:
  lisp/ChangeLog                 changelog-20091113204419-o5vbwnq5f7feedwu-1432
  lisp/frame.el                  frame.el-20091113204419-o5vbwnq5f7feedwu-275
  src/ChangeLog                  changelog-20091113204419-o5vbwnq5f7feedwu-1438
  src/frame.c                    frame.c-20091113204419-o5vbwnq5f7feedwu-243
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2013-11-25 02:28:02 +0000
+++ b/lisp/ChangeLog    2013-11-25 02:41:02 +0000
@@ -1,3 +1,11 @@
+2013-11-25  Stefan Monnier  <address@hidden>
+
+       * 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.
+
 2013-11-25  Dmitry Gutov  <address@hidden>
 
        * vc/vc-git.el (vc-git-annotate-extract-revision-at-line): Make it
@@ -86,13 +94,13 @@
 
 2013-11-21  Leo Liu  <address@hidden>
 
-       * progmodes/octave.el (octave-mode, inferior-octave-mode): Fix
-       obsolete variable comment-use-global-state.
+       * progmodes/octave.el (octave-mode, inferior-octave-mode):
+       Fix obsolete variable comment-use-global-state.
 
 2013-11-21  RĂ¼diger Sonderfeld  <address@hidden>
 
-       * progmodes/octave.el (octave-mode-map, octave-mode-menu): Add
-       `octave-source-file'.
+       * progmodes/octave.el (octave-mode-map, octave-mode-menu):
+       Add `octave-source-file'.
        (octave-source-file): New function.  (Bug#15935)
 
 2013-11-21  Kenjiro Nakayama <address@hidden>  (tiny change)

=== modified file 'lisp/frame.el'
--- a/lisp/frame.el     2013-10-22 08:07:51 +0000
+++ b/lisp/frame.el     2013-11-25 02:41:02 +0000
@@ -120,6 +120,21 @@
        (delete-frame frame t)
       ;; address@hidden says it is ok to ask questions before terminating.
       (save-buffers-kill-emacs))))
+
+(defun handle-focus-in (_event)
+  "Handle a focus-in event.
+Focus-in events are usually bound to this function.
+Focus-in events occur when a frame has focus, but a switch-frame event
+is not generated.
+This function runs the hook `focus-in-hook'."
+  (run-hooks 'focus-in-hook))
+
+(defun handle-focus-out (_event)
+  "Handle a focus-out event.
+Focus-out events are usually bound to this function.
+Focus-out events occur when no frame has focus.
+This function runs the hook `focus-out-hook'."
+  (run-hooks 'focus-out-hook))
 
 ;;;; Arrangement of frames at startup
 
@@ -1727,12 +1742,11 @@
   "Timer function of timer `blink-cursor-timer'."
   (internal-show-cursor nil (not (internal-show-cursor-p)))
   ;; Each blink is two calls to this function.
-  (when (memq window-system '(x ns w32))
-    (setq blink-cursor-blinks-done (1+ blink-cursor-blinks-done))
-    (when (and (> blink-cursor-blinks 0)
-              (<= (* 2 blink-cursor-blinks) blink-cursor-blinks-done))
-      (blink-cursor-suspend)
-      (add-hook 'post-command-hook 'blink-cursor-check))))
+  (setq blink-cursor-blinks-done (1+ blink-cursor-blinks-done))
+  (when (and (> blink-cursor-blinks 0)
+             (<= (* 2 blink-cursor-blinks) blink-cursor-blinks-done))
+    (blink-cursor-suspend)
+    (add-hook 'post-command-hook 'blink-cursor-check)))
 
 
 (defun blink-cursor-end ()
@@ -1747,15 +1761,14 @@
     (setq blink-cursor-timer nil)))
 
 (defun blink-cursor-suspend ()
-  "Suspend cursor blinking on NS, X and W32.
+  "Suspend cursor blinking.
 This is called when no frame has focus and timers can be suspended.
 Timers are restarted by `blink-cursor-check', which is called when a
 frame receives focus."
-  (when (memq window-system '(x ns w32))
-    (blink-cursor-end)
-    (when blink-cursor-idle-timer
-      (cancel-timer blink-cursor-idle-timer)
-      (setq blink-cursor-idle-timer nil))))
+  (blink-cursor-end)
+  (when blink-cursor-idle-timer
+    (cancel-timer blink-cursor-idle-timer)
+    (setq blink-cursor-idle-timer nil)))
 
 (defun blink-cursor-check ()
   "Check if cursor blinking shall be restarted.
@@ -1789,13 +1802,15 @@
   (if blink-cursor-idle-timer (cancel-timer blink-cursor-idle-timer))
   (setq blink-cursor-idle-timer nil)
   (blink-cursor-end)
+  (remove-hook 'focus-in-hook #'blink-cursor-check)
+  (remove-hook 'focus-out-hook #'blink-cursor-suspend)
   (when blink-cursor-mode
-    ;; Hide the cursor.
-    ;;(internal-show-cursor nil nil)
+    (add-hook 'focus-in-hook #'blink-cursor-check)
+    (add-hook 'focus-out-hook #'blink-cursor-suspend)
     (setq blink-cursor-idle-timer
           (run-with-idle-timer blink-cursor-delay
                                blink-cursor-delay
-                               'blink-cursor-start))))
+                               #'blink-cursor-start))))
 
 
 ;; Frame maximization/fullscreen

=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2013-11-25 02:36:41 +0000
+++ b/src/ChangeLog     2013-11-25 02:41:02 +0000
@@ -1,3 +1,8 @@
+2013-11-25  Stefan Monnier  <address@hidden>
+
+       * frame.c (Fhandle_focus_in, Fhandle_focus_out): Move to frame.el.
+       (syms_of_frame): Don't defsubr them.
+
 2013-11-25  Glenn Morris  <address@hidden>
 
        * lread.c (load_path_default): Change the sense of the argument.

=== modified file 'src/frame.c'
--- a/src/frame.c       2013-11-19 02:32:26 +0000
+++ b/src/frame.c       2013-11-25 02:41:02 +0000
@@ -887,31 +887,6 @@
   return do_switch_frame (frame, 1, 0, norecord);
 }
 
-DEFUN ("handle-focus-in", Fhandle_focus_in, Shandle_focus_in, 1, 1, "e",
-       doc: /* Handle a focus-in event.
-Focus in events are usually bound to this function.
-Focus in events occur when a frame has focus, but a switch-frame event
-is not generated.
-This function runs the hook `focus-in-hook'.
-It also checks if blink-cursor timers should be turned on again.  */)
-  (Lisp_Object event)
-{
-  Frun_hooks (1, &Qfocus_in_hook);
-  return call0 (intern ("blink-cursor-check"));
-}
-
-DEFUN ("handle-focus-out", Fhandle_focus_out, Shandle_focus_out, 1, 1, "e",
-       doc: /* Handle a focus-out event.
-Focus out events are usually bound to this function.
-Focus out events occur when no frame has focus.
-This function runs the hook `focus-out-hook'.
-It also checks if blink-cursor timers should be turned off.  */)
-  (Lisp_Object event)
-{
-  Frun_hooks (1, &Qfocus_out_hook);
-  return call0 (intern ("blink-cursor-suspend"));
-}
-
 DEFUN ("handle-switch-frame", Fhandle_switch_frame, Shandle_switch_frame, 1, 
1, "e",
        doc: /* Handle a switch-frame event EVENT.
 Switch-frame events are usually bound to this function.
@@ -926,7 +901,8 @@
   /* Preserve prefix arg that the command loop just cleared.  */
   kset_prefix_arg (current_kboard, Vcurrent_prefix_arg);
   Frun_hooks (1, &Qmouse_leave_buffer_hook);
-  Fhandle_focus_in (event); // switch-frame implies a focus in.
+  /* `switch-frame' implies a focus in.  */
+  call1 (intern ("handle-focus-in"), event);
   return do_switch_frame (event, 0, 0, Qnil);
 }
 
@@ -4542,8 +4518,6 @@
   defsubr (&Swindow_system);
   defsubr (&Smake_terminal_frame);
   defsubr (&Shandle_switch_frame);
-  defsubr (&Shandle_focus_in);
-  defsubr (&Shandle_focus_out);
   defsubr (&Sselect_frame);
   defsubr (&Sselected_frame);
   defsubr (&Sframe_list);


reply via email to

[Prev in Thread] Current Thread [Next in Thread]