]> git.eshelyaron.com Git - emacs.git/commitdiff
(internal_last_event_frame, Vlast_event_frame): Deleted; now part of
authorKarl Heuer <kwzh@gnu.org>
Tue, 7 Feb 1995 02:07:03 +0000 (02:07 +0000)
committerKarl Heuer <kwzh@gnu.org>
Tue, 7 Feb 1995 02:07:03 +0000 (02:07 +0000)
perdisplay.  All uses changed.
(MOUSE_ACTIVITY_AVAILABLE) Deleted.
(find_active_event_queue): New arg check_mouse.  All callers changed.
(Vlast_event_frame): Change from DEFVAR_LISP to DEFVAR_DISPLAY.

src/keyboard.c

index c9aec9d07795c5744ba737ab3a3b03f22c8f2542..df2c372f44148cf7cc561c38e8aeadc6f686df2a 100644 (file)
@@ -259,20 +259,6 @@ int last_point_position;
 /* The buffer that was current when the last command was started.  */
 Lisp_Object last_point_position_buffer;
 
-#ifdef MULTI_FRAME
-/* The frame in which the last input event occurred, or Qmacro if the
-   last event came from a macro.  We use this to determine when to
-   generate switch-frame events.  This may be cleared by functions
-   like Fselect_frame, to make sure that a switch-frame event is
-   generated by the next character.  */
-Lisp_Object internal_last_event_frame;
-#endif
-
-/* A user-visible version of the above, intended to allow users to
-   figure out where the last event came from, if the event doesn't
-   carry that information itself (i.e. if it was a character).  */
-Lisp_Object Vlast_event_frame;
-
 /* The timestamp of the last input event we received from the X server.
    X Windows wants this for selection ownership.  */
 unsigned long last_event_timestamp;
@@ -344,10 +330,6 @@ static Lisp_Object do_mouse_tracking;
    call mouse_position_hook to get the promised position, so don't set
    it unless you're prepared to substantiate the claim!  */
 int mouse_moved;
-
-#define MOUSE_ACTIVITY_AVAILABLE (FRAMEP (do_mouse_tracking) && mouse_moved)
-#else /* Not HAVE_MOUSE.  */
-#define MOUSE_ACTIVITY_AVAILABLE 0
 #endif /* HAVE_MOUSE.  */
 
 /* Symbols to head events.  */
@@ -1489,7 +1471,10 @@ read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu)
         internal_last_event_frame after each command is read, but
         events read from a macro should never cause a new frame to be
         selected. */
-      Vlast_event_frame = internal_last_event_frame = Qmacro;
+      if (!current_perdisplay)
+       abort ();
+      current_perdisplay->internal_last_event_frame = Qmacro;
+      current_perdisplay->Vlast_event_frame = Qmacro;
 #endif
 
       /* Exit the macro if we are at the end.
@@ -1540,8 +1525,10 @@ read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu)
     {
       XSETINT (c, quit_char);
 #ifdef MULTI_FRAME
-      XSETFRAME (internal_last_event_frame, selected_frame);
-      Vlast_event_frame = internal_last_event_frame;
+      XSETFRAME (current_perdisplay->internal_last_event_frame,
+                selected_frame);
+      current_perdisplay->Vlast_event_frame
+       = current_perdisplay->internal_last_event_frame;
 #endif
       /* If we report the quit char as an event,
         don't do so more than once.  */
@@ -1953,7 +1940,8 @@ Normally, mouse motion is ignored.")
    *mouse_position_hook provides the mouse position.  */
 
 static PERDISPLAY *
-find_active_event_queue ()
+find_active_event_queue (check_mouse)
+     int check_mouse;
 {
   PERDISPLAY *perd;
 
@@ -1961,6 +1949,10 @@ find_active_event_queue ()
     {
       if (perd->kbd_fetch_ptr != perd->kbd_store_ptr)
        return perd;
+#ifdef HAVE_MOUSE
+      if (check_mouse && FRAMEP (do_mouse_tracking) && mouse_moved)
+       return perd;
+#endif
     }
   return 0;
 }
@@ -1970,7 +1962,7 @@ find_active_event_queue ()
 static int
 readable_events ()
 {
-  return find_active_event_queue () != NULL || MOUSE_ACTIVITY_AVAILABLE;
+  return find_active_event_queue (1) != NULL;
 }
 
 /* Set this for debugging, to have a way to get out */
@@ -2012,10 +2004,10 @@ kbd_buffer_store_event (event)
 
            focus = FRAME_FOCUS_FRAME (XFRAME (event->frame_or_window));
            if (NILP (focus))
-             internal_last_event_frame = event->frame_or_window;
+             perd->internal_last_event_frame = event->frame_or_window;
            else
-             internal_last_event_frame = focus;
-           Vlast_event_frame = internal_last_event_frame;
+             perd->internal_last_event_frame = focus;
+           perd->Vlast_event_frame = perd->internal_last_event_frame;
          }
 #endif
 
@@ -2090,8 +2082,8 @@ kbd_buffer_get_event ()
   /* Wait until there is input available.  */
   for (;;)
     {
-      perd = find_active_event_queue ();
-      if (perd || MOUSE_ACTIVITY_AVAILABLE)
+      perd = find_active_event_queue (1);
+      if (perd)
        break;
 
       /* If the quit flag is set, then read_char will return
@@ -2109,15 +2101,15 @@ kbd_buffer_get_event ()
 #ifdef SIGIO
       gobble_input (0);
 #endif /* SIGIO */
-      perd = find_active_event_queue ();
-      if (!(perd || MOUSE_ACTIVITY_AVAILABLE))
+      perd = find_active_event_queue (1);
+      if (!perd)
        {
          Lisp_Object minus_one;
 
          XSETINT (minus_one, -1);
          wait_reading_process_input (0, 0, minus_one, 1);
 
-         if (!interrupt_input && find_active_event_queue () == NULL)
+         if (!interrupt_input && find_active_event_queue (0) == NULL)
            /* Pass 1 for EXPECT since we just waited to have input.  */
            read_avail_input (1);
        }
@@ -2127,7 +2119,7 @@ kbd_buffer_get_event ()
   /* At this point, we know that there is a readable event available
      somewhere.  If the event queue is empty, then there must be a
      mouse movement enabled and available.  */
-  if (perd)
+  if (perd->kbd_fetch_ptr != perd->kbd_store_ptr)
     {
       struct input_event *event;
 
@@ -2226,10 +2218,10 @@ kbd_buffer_get_event ()
          if (! NILP (focus))
            frame = focus;
 
-         if (! EQ (frame, internal_last_event_frame)
+         if (! EQ (frame, perd->internal_last_event_frame)
              && XFRAME (frame) != selected_frame)
            obj = make_lispy_switch_frame (frame);
-         internal_last_event_frame = frame;
+         perd->internal_last_event_frame = frame;
 #endif /* MULTI_FRAME */
 
          /* If we didn't decide to make a switch-frame event, go ahead
@@ -2277,10 +2269,10 @@ kbd_buffer_get_event ()
          if (NILP (frame))
            XSETFRAME (frame, f);
 
-         if (! EQ (frame, internal_last_event_frame)
+         if (! EQ (frame, perd->internal_last_event_frame)
              && XFRAME (frame) != selected_frame)
            obj = make_lispy_switch_frame (frame);
-         internal_last_event_frame = frame;
+         perd->internal_last_event_frame = frame;
        }
 #endif
 
@@ -2298,7 +2290,7 @@ kbd_buffer_get_event ()
   input_pending = readable_events ();
 
 #ifdef MULTI_FRAME
-  Vlast_event_frame = internal_last_event_frame;
+  perd->Vlast_event_frame = perd->internal_last_event_frame;
 #endif
 
   return (obj);
@@ -2311,7 +2303,7 @@ void
 swallow_events ()
 {
   PERDISPLAY *perd;
-  while ((perd = find_active_event_queue ()) != NULL)
+  while ((perd = find_active_event_queue (0)) != NULL)
     {
       struct input_event *event;
 
@@ -5938,9 +5930,15 @@ quit_throw_to_read_char ()
     abort ();
 #endif
 #ifdef MULTI_FRAME
-  if (FRAMEP (internal_last_event_frame)
-      && XFRAME (internal_last_event_frame) != selected_frame)
-    Fhandle_switch_frame (make_lispy_switch_frame (internal_last_event_frame));
+  {
+    Lisp_Object frame;
+
+    if (!current_perdisplay)
+      abort ();
+    frame = current_perdisplay->internal_last_event_frame;
+    if (FRAMEP (frame) && XFRAME (frame) != selected_frame)
+      Fhandle_switch_frame (make_lispy_switch_frame (frame));
+  }
 #endif
 
   _longjmp (getcjmp, 1);
@@ -6047,6 +6045,12 @@ init_perdisplay (perd)
   perd->kbd_store_ptr = perd->kbd_buffer;
   perd->kbd_buffer_frame_or_window
     = Fmake_vector (make_number (KBD_BUFFER_SIZE), Qnil);
+#ifdef MULTI_FRAME
+  /* This means that command_loop_1 won't try to select anything the first
+     time through.  */
+  perd->internal_last_event_frame = Qnil;
+#endif
+  perd->Vlast_event_frame = Qnil;
 }
 
 /*
@@ -6076,13 +6080,6 @@ init_keyboard ()
 #endif
   input_pending = 0;
 
-#ifdef MULTI_FRAME
-  /* This means that command_loop_1 won't try to select anything the first
-     time through.  */
-  internal_last_event_frame = Qnil;
-  Vlast_event_frame = internal_last_event_frame;
-#endif
-
 #ifndef MULTI_PERDISPLAY
   if (initialized)
     wipe_perdisplay (&the_only_perdisplay);
@@ -6380,11 +6377,6 @@ by position only.");
     "Number of complete keys read from the keyboard so far.");
   num_input_keys = 0;
 
-  DEFVAR_LISP ("last-event-frame", &Vlast_event_frame,
-    "The frame in which the most recently read event occurred.\n\
-If the last event came from a keyboard macro, this is set to `macro'.");
-  Vlast_event_frame = Qnil;
-
   DEFVAR_LISP ("help-char", &Vhelp_char,
     "Character to recognize as meaning Help.\n\
 When it is read, do `(eval help-form)', and display result if it's a string.\n\
@@ -6543,6 +6535,10 @@ It may be a number, or the symbol `-' for just a minus sign as arg,\n\
 or a list whose car is a number for just one or more C-U's\n\
 or nil if no argument has been specified.\n\
 This is what `(interactive \"P\")' returns.");
+
+  DEFVAR_DISPLAY ("last-event-frame", Vlast_event_frame,
+    "The frame in which the most recently read event occurred.\n\
+If the last event came from a keyboard macro, this is set to `macro'.");
 }
 
 keys_of_keyboard ()