changeset 12571:c960e63751ec

(mouse_moved): Variable deleted. (kbd_buffer_get_event, readable_events): Check mouse_moved in all frames. Check do_mouse_tracking for non-nil ness. (Ftrack_mouse): Set do_mouse_tracking to t. (kbd_buffer_get_event): Discard a selection_clear_event before processing it.
author Karl Heuer <kwzh@gnu.org>
date Mon, 17 Jul 1995 23:42:42 +0000
parents 5e531668336e
children 80bf29e6e978
files src/keyboard.c
diffstat 1 files changed, 25 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/src/keyboard.c	Mon Jul 17 23:24:57 1995 +0000
+++ b/src/keyboard.c	Mon Jul 17 23:42:42 1995 +0000
@@ -398,20 +398,11 @@
    dequeuing functions?  Such a flag could be screwed up by interrupts
    at inopportune times.  */
 
-/* If this flag is a frame, we check mouse_moved to see when the
+/* If this flag is non-nil, we check mouse_moved to see when the
    mouse moves, and motion events will appear in the input stream.
    Otherwise, mouse motion is ignored.  */
 static Lisp_Object do_mouse_tracking;
 
-#ifdef HAVE_MOUSE
-/* The window system handling code should set this if the mouse has
-   moved since the last call to the mouse_position_hook.  Calling that
-   hook should clear this.  Code assumes that if this is set, it can
-   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;
-#endif /* HAVE_MOUSE */
-
 /* Symbols to head events.  */
 Lisp_Object Qmouse_movement;
 Lisp_Object Qscroll_bar_movement;
@@ -2273,12 +2264,29 @@
 
   record_unwind_protect (tracking_off, do_mouse_tracking);
 
-  XSETFRAME (do_mouse_tracking, selected_frame);
+  do_mouse_tracking = Qt;
 
   val = Fprogn (args);
   return unbind_to (count, val);
 }
 
+/* If mouse has moved on some frame, return one of those frames.
+   Return 0 otherwise.  */
+
+static FRAME_PTR
+some_mouse_moved ()
+{
+  Lisp_Object tail, frame;
+
+  FOR_EACH_FRAME (tail, frame)
+    {
+      if (XFRAME (frame)->mouse_moved)
+	return XFRAME (frame);
+    }
+
+  return 0;
+}
+
 #endif	/* HAVE_MOUSE */
 
 /* Low level keyboard/mouse input.
@@ -2295,7 +2303,7 @@
   if (kbd_fetch_ptr != kbd_store_ptr)
     return 1;
 #ifdef HAVE_MOUSE
-  if (FRAMEP (do_mouse_tracking) && mouse_moved)
+  if (!NILP (do_mouse_tracking) && some_mouse_moved ())
     return 1;
 #endif
   if (single_kboard)
@@ -2480,7 +2488,7 @@
       if (kbd_fetch_ptr != kbd_store_ptr)
 	break;
 #ifdef HAVE_MOUSE
-      if (FRAMEP (do_mouse_tracking) && mouse_moved)
+      if (!NILP (do_mouse_tracking) && some_mouse_moved ())
 	break;
 #endif
 
@@ -2502,7 +2510,7 @@
       if (kbd_fetch_ptr != kbd_store_ptr)
 	break;
 #ifdef HAVE_MOUSE
-      if (FRAMEP (do_mouse_tracking) && mouse_moved)
+      if (!NILP (do_mouse_tracking) && some_mouse_moved ())
 	break;
 #endif
       {
@@ -2565,8 +2573,8 @@
       else if (event->kind == selection_clear_event)
 	{
 #ifdef HAVE_X11
+	  kbd_fetch_ptr = event + 1;
 	  x_handle_selection_clear (event);
-	  kbd_fetch_ptr = event + 1;
 #else
 	  /* We're getting selection request events, but we don't have
              a window system.  */
@@ -2663,9 +2671,9 @@
     }
 #ifdef HAVE_MOUSE
   /* Try generating a mouse motion event.  */
-  else if (FRAMEP (do_mouse_tracking) && mouse_moved)
+  else if (!NILP (do_mouse_tracking) && some_mouse_moved ())
     {
-      FRAME_PTR f = XFRAME (do_mouse_tracking);
+      FRAME_PTR f = some_mouse_moved ();
       Lisp_Object bar_window;
       enum scroll_bar_part part;
       Lisp_Object x, y;