changeset 15042:c99dd01d9334

(note_mouse_movement): Don't call XQueryPointer. (x_scroll_bar_note_movement): Don't call XQueryPointer. (x_new_font): Intern FONT just once for finding full name.
author Richard M. Stallman <rms@gnu.org>
date Thu, 18 Apr 1996 04:03:16 +0000
parents 88d5940d524e
children a0716ac97a83
files src/xterm.c
diffstat 1 files changed, 12 insertions(+), 62 deletions(-) [+]
line wrap: on
line diff
--- a/src/xterm.c	Wed Apr 17 18:37:18 1996 +0000
+++ b/src/xterm.c	Thu Apr 18 04:03:16 1996 +0000
@@ -166,6 +166,13 @@
 
 /* Mouse movement.
 
+   Formerly, we used PointerMotionHintMask (in STANDARD_EVENT_MASK)
+   so that we would have to call XQueryPointer after each MotionNotify
+   event to ask for another such event.  However, this made mouse tracking
+   slow, and there was a bug that made it eventually stop.
+
+   Simply asking for MotionNotify all the time seems to work better.
+
    In order to avoid asking for motion events and then throwing most
    of them away or busy-polling the server for mouse positions, we ask
    the server for pointer motion hints.  This means that we get only
@@ -175,13 +182,7 @@
    get another MotionNotify event the next time the mouse moves.  This
    is at least as efficient as getting motion events when mouse
    tracking is on, and I suspect only negligibly worse when tracking
-   is off.
-
-   The silly O'Reilly & Associates Nutshell guides barely document
-   pointer motion hints at all (I think you have to infer how they
-   work from an example), and the description of XQueryPointer doesn't
-   mention that calling it causes you to get another motion hint from
-   the server, which is very important.  */
+   is off.  */
 
 /* Where the mouse was last time we reported a mouse event.  */
 static FRAME_PTR last_mouse_frame;
@@ -1837,17 +1838,6 @@
       last_mouse_scroll_bar = Qnil;
 
       note_mouse_highlight (frame, -1, -1);
-
-      /* Ask for another mouse motion event.  */
-      {
-	int dummy;
-	Window dummy_window;
-
-	XQueryPointer (event->display, FRAME_X_WINDOW (frame),
-		       &dummy_window, &dummy_window,
-		       &dummy, &dummy, &dummy, &dummy,
-		       (unsigned int *) &dummy);
-      }
     }
 
   /* Has the mouse moved off the glyph it was on at the last sighting?  */
@@ -1860,30 +1850,6 @@
       last_mouse_scroll_bar = Qnil;
 
       note_mouse_highlight (frame, event->x, event->y);
-
-      /* Ask for another mouse motion event.  */
-      {
-	int dummy;
-	Window dummy_window;
-
-	XQueryPointer (event->display, FRAME_X_WINDOW (frame),
-		       &dummy_window, &dummy_window,
-		       &dummy, &dummy, &dummy, &dummy,
-		       (unsigned int *) &dummy);
-      }
-    }
-  else
-    {
-      /* It's on the same glyph.  Call XQueryPointer so we'll get an
-	 event the next time the mouse moves and we can see if it's
-	 *still* on the same glyph.  */
-      int dummy;
-      Window dummy_window;
-
-      XQueryPointer (event->display, FRAME_X_WINDOW (frame),
-		     &dummy_window, &dummy_window,
-		     &dummy, &dummy, &dummy, &dummy,
-		     (unsigned int *) &dummy);
     }
 }
 
@@ -2258,9 +2224,7 @@
    Don't store anything if we don't have a valid set of values to report.
 
    This clears the mouse_moved flag, so we can wait for the next mouse
-   movement.  This also calls XQueryPointer, which will cause the
-   server to give us another MotionNotify when the mouse moves
-   again. */
+   movement.  */
 
 static void
 XTmouse_position (fp, insist, bar_window, part, x, y, time)
@@ -3001,18 +2965,6 @@
 	  x_scroll_bar_set_handle (bar, new_start, new_end, 0);
 	}
     }
-
-  /* Call XQueryPointer so we'll get an event the next time the mouse
-     moves and we can see *still* on the same position.  */
-  {
-    int dummy;
-    Window dummy_window;
-
-    XQueryPointer (event->xmotion.display, event->xmotion.window,
-		   &dummy_window, &dummy_window,
-		   &dummy, &dummy, &dummy, &dummy,
-		   (unsigned int *) &dummy);
-  }
 }
 
 /* Return information to the user about the current position of the mouse
@@ -4812,6 +4764,7 @@
       char *full_name;
       XFontStruct *font;
       int n_fonts;
+      Atom FONT_atom;
 
       /* Try to find a character-cell font in the list.  */
 #if 0
@@ -4857,11 +4810,10 @@
 
       /* Try to get the full name of FONT.  Put it in full_name.  */
       full_name = 0;
+      FONT_atom = XInternAtom (FRAME_X_DISPLAY (f), "FONT", False);
       for (i = 0; i < font->n_properties; i++)
 	{
-	  char *atom
-	    = XGetAtomName (FRAME_X_DISPLAY (f), font->properties[i].name);
-	  if (!strcmp (atom, "FONT"))
+	  if (FONT_atom == font->properties[i].name)
 	    {
 	      char *name = XGetAtomName (FRAME_X_DISPLAY (f),
 					 (Atom) (font->properties[i].card32));
@@ -4885,8 +4837,6 @@
 
 	      break;
 	    }
-
-	  XFree (atom);
 	}
 
       n_fonts = FRAME_X_DISPLAY_INFO (f)->n_fonts;