Add hooks to run on gaining/losing focus (tiny change)
* src/frame.c (Qfocus_in_hook, Qfocus_out_hook): New static lisp objects. (Fhandle_focus_in, Fhandle_focus_out): Run focus hooks. (syms_of_frame): Add focus-in-hook, focus-out-hook. Fixes: debbugs:15029
This commit is contained in:
parent
4ae3802fbf
commit
8e01570501
2 changed files with 21 additions and 0 deletions
|
@ -1,3 +1,10 @@
|
|||
2013-11-19 Brian Jenkins <brian@brianjenkins.org> (tiny change)
|
||||
|
||||
Add hooks to run on gaining/losing focus. (Bug#15029)
|
||||
* frame.c (Qfocus_in_hook, Qfocus_out_hook): New static lisp objects.
|
||||
(Fhandle_focus_in, Fhandle_focus_out): Run focus hooks.
|
||||
(syms_of_frame): Add focus-in-hook, focus-out-hook.
|
||||
|
||||
2013-11-18 Paul Eggert <eggert@cs.ucla.edu>
|
||||
|
||||
* data.c (bool_vector_binop_driver): Rename locals for sanity's sake.
|
||||
|
|
14
src/frame.c
14
src/frame.c
|
@ -109,6 +109,8 @@ Lisp_Object Qalpha;
|
|||
|
||||
Lisp_Object Qface_set_after_frame_default;
|
||||
|
||||
static Lisp_Object Qfocus_in_hook;
|
||||
static Lisp_Object Qfocus_out_hook;
|
||||
static Lisp_Object Qdelete_frame_functions;
|
||||
|
||||
static Lisp_Object Qgeometry, Qworkarea, Qmm_size, Qframes, Qsource;
|
||||
|
@ -893,6 +895,7 @@ is not generated.
|
|||
This function 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"));
|
||||
}
|
||||
|
||||
|
@ -903,6 +906,7 @@ Focus out events occur when no frame has focus.
|
|||
This function checks if blink-cursor timers should be turned off. */)
|
||||
(Lisp_Object event)
|
||||
{
|
||||
Frun_hooks (1, &Qfocus_out_hook);
|
||||
return call0 (intern ("blink-cursor-suspend"));
|
||||
}
|
||||
|
||||
|
@ -4465,6 +4469,16 @@ when the mouse is over clickable text. */);
|
|||
The pointer becomes visible again when the mouse is moved. */);
|
||||
Vmake_pointer_invisible = Qt;
|
||||
|
||||
DEFVAR_LISP ("focus-in-hook", Vfocus_in_hook,
|
||||
doc: /* Normal hook run when a frame gains input focus. */);
|
||||
Vfocus_in_hook = Qnil;
|
||||
DEFSYM (Qfocus_in_hook, "focus-in-hook");
|
||||
|
||||
DEFVAR_LISP ("focus-out-hook", Vfocus_out_hook,
|
||||
doc: /* Normal hook run when a frame loses input focus. */);
|
||||
Vfocus_out_hook = Qnil;
|
||||
DEFSYM (Qfocus_out_hook, "focus-out-hook");
|
||||
|
||||
DEFVAR_LISP ("delete-frame-functions", Vdelete_frame_functions,
|
||||
doc: /* Functions run before deleting a frame.
|
||||
The functions are run with one arg, the frame to be deleted.
|
||||
|
|
Loading…
Add table
Reference in a new issue