Function: internal-handle-focus-in

internal-handle-focus-in is a function defined in keyboard.c.

Signature

(internal-handle-focus-in EVENT)

Documentation

Internally handle focus-in events.

This function potentially generates an artificial switch-frame event.

Source Code

// Defined in /usr/src/emacs/src/keyboard.c
{
  Lisp_Object frame;
  if (!EQ (CAR_SAFE (event), Qfocus_in) ||
      !CONSP (XCDR (event)) ||
      !FRAMEP ((frame = XCAR (XCDR (event)))))
    error ("Invalid focus-in event");

  /* Conceptually, the concept of window manager focus on a particular
     frame and the Emacs selected frame shouldn't be related, but for
     a long time, we automatically switched the selected frame in
     response to focus events, so let's keep doing that.  */
  bool switching = (!EQ (frame, internal_last_event_frame)
                    && !EQ (frame, selected_frame));
  internal_last_event_frame = frame;
  if (switching || !NILP (unread_switch_frame))
    unread_switch_frame = make_lispy_switch_frame (frame);

  return Qnil;
}