aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRichard M. Stallman1996-04-18 04:03:16 +0000
committerRichard M. Stallman1996-04-18 04:03:16 +0000
commitf5bb65ecabb3b2979bae4d55d829c4e7e0653ba5 (patch)
tree1ff476e343a8667f5570cd6d176023a0a3ea3078 /src
parent092191c69d015fc1f69d3255bd5dd8967e43d7be (diff)
downloademacs-f5bb65ecabb3b2979bae4d55d829c4e7e0653ba5.tar.gz
emacs-f5bb65ecabb3b2979bae4d55d829c4e7e0653ba5.zip
(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.
Diffstat (limited to 'src')
-rw-r--r--src/xterm.c74
1 files changed, 12 insertions, 62 deletions
diff --git a/src/xterm.c b/src/xterm.c
index 62deeeb1e55..1eba18213d5 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -166,6 +166,13 @@ static int curs_y;
166 166
167/* Mouse movement. 167/* Mouse movement.
168 168
169 Formerly, we used PointerMotionHintMask (in STANDARD_EVENT_MASK)
170 so that we would have to call XQueryPointer after each MotionNotify
171 event to ask for another such event. However, this made mouse tracking
172 slow, and there was a bug that made it eventually stop.
173
174 Simply asking for MotionNotify all the time seems to work better.
175
169 In order to avoid asking for motion events and then throwing most 176 In order to avoid asking for motion events and then throwing most
170 of them away or busy-polling the server for mouse positions, we ask 177 of them away or busy-polling the server for mouse positions, we ask
171 the server for pointer motion hints. This means that we get only 178 the server for pointer motion hints. This means that we get only
@@ -175,13 +182,7 @@ static int curs_y;
175 get another MotionNotify event the next time the mouse moves. This 182 get another MotionNotify event the next time the mouse moves. This
176 is at least as efficient as getting motion events when mouse 183 is at least as efficient as getting motion events when mouse
177 tracking is on, and I suspect only negligibly worse when tracking 184 tracking is on, and I suspect only negligibly worse when tracking
178 is off. 185 is off. */
179
180 The silly O'Reilly & Associates Nutshell guides barely document
181 pointer motion hints at all (I think you have to infer how they
182 work from an example), and the description of XQueryPointer doesn't
183 mention that calling it causes you to get another motion hint from
184 the server, which is very important. */
185 186
186/* Where the mouse was last time we reported a mouse event. */ 187/* Where the mouse was last time we reported a mouse event. */
187static FRAME_PTR last_mouse_frame; 188static FRAME_PTR last_mouse_frame;
@@ -1837,17 +1838,6 @@ note_mouse_movement (frame, event)
1837 last_mouse_scroll_bar = Qnil; 1838 last_mouse_scroll_bar = Qnil;
1838 1839
1839 note_mouse_highlight (frame, -1, -1); 1840 note_mouse_highlight (frame, -1, -1);
1840
1841 /* Ask for another mouse motion event. */
1842 {
1843 int dummy;
1844 Window dummy_window;
1845
1846 XQueryPointer (event->display, FRAME_X_WINDOW (frame),
1847 &dummy_window, &dummy_window,
1848 &dummy, &dummy, &dummy, &dummy,
1849 (unsigned int *) &dummy);
1850 }
1851 } 1841 }
1852 1842
1853 /* Has the mouse moved off the glyph it was on at the last sighting? */ 1843 /* Has the mouse moved off the glyph it was on at the last sighting? */
@@ -1860,30 +1850,6 @@ note_mouse_movement (frame, event)
1860 last_mouse_scroll_bar = Qnil; 1850 last_mouse_scroll_bar = Qnil;
1861 1851
1862 note_mouse_highlight (frame, event->x, event->y); 1852 note_mouse_highlight (frame, event->x, event->y);
1863
1864 /* Ask for another mouse motion event. */
1865 {
1866 int dummy;
1867 Window dummy_window;
1868
1869 XQueryPointer (event->display, FRAME_X_WINDOW (frame),
1870 &dummy_window, &dummy_window,
1871 &dummy, &dummy, &dummy, &dummy,
1872 (unsigned int *) &dummy);
1873 }
1874 }
1875 else
1876 {
1877 /* It's on the same glyph. Call XQueryPointer so we'll get an
1878 event the next time the mouse moves and we can see if it's
1879 *still* on the same glyph. */
1880 int dummy;
1881 Window dummy_window;
1882
1883 XQueryPointer (event->display, FRAME_X_WINDOW (frame),
1884 &dummy_window, &dummy_window,
1885 &dummy, &dummy, &dummy, &dummy,
1886 (unsigned int *) &dummy);
1887 } 1853 }
1888} 1854}
1889 1855
@@ -2258,9 +2224,7 @@ static void x_scroll_bar_report_motion ();
2258 Don't store anything if we don't have a valid set of values to report. 2224 Don't store anything if we don't have a valid set of values to report.
2259 2225
2260 This clears the mouse_moved flag, so we can wait for the next mouse 2226 This clears the mouse_moved flag, so we can wait for the next mouse
2261 movement. This also calls XQueryPointer, which will cause the 2227 movement. */
2262 server to give us another MotionNotify when the mouse moves
2263 again. */
2264 2228
2265static void 2229static void
2266XTmouse_position (fp, insist, bar_window, part, x, y, time) 2230XTmouse_position (fp, insist, bar_window, part, x, y, time)
@@ -3001,18 +2965,6 @@ x_scroll_bar_note_movement (bar, event)
3001 x_scroll_bar_set_handle (bar, new_start, new_end, 0); 2965 x_scroll_bar_set_handle (bar, new_start, new_end, 0);
3002 } 2966 }
3003 } 2967 }
3004
3005 /* Call XQueryPointer so we'll get an event the next time the mouse
3006 moves and we can see *still* on the same position. */
3007 {
3008 int dummy;
3009 Window dummy_window;
3010
3011 XQueryPointer (event->xmotion.display, event->xmotion.window,
3012 &dummy_window, &dummy_window,
3013 &dummy, &dummy, &dummy, &dummy,
3014 (unsigned int *) &dummy);
3015 }
3016} 2968}
3017 2969
3018/* Return information to the user about the current position of the mouse 2970/* Return information to the user about the current position of the mouse
@@ -4812,6 +4764,7 @@ x_new_font (f, fontname)
4812 char *full_name; 4764 char *full_name;
4813 XFontStruct *font; 4765 XFontStruct *font;
4814 int n_fonts; 4766 int n_fonts;
4767 Atom FONT_atom;
4815 4768
4816 /* Try to find a character-cell font in the list. */ 4769 /* Try to find a character-cell font in the list. */
4817#if 0 4770#if 0
@@ -4857,11 +4810,10 @@ x_new_font (f, fontname)
4857 4810
4858 /* Try to get the full name of FONT. Put it in full_name. */ 4811 /* Try to get the full name of FONT. Put it in full_name. */
4859 full_name = 0; 4812 full_name = 0;
4813 FONT_atom = XInternAtom (FRAME_X_DISPLAY (f), "FONT", False);
4860 for (i = 0; i < font->n_properties; i++) 4814 for (i = 0; i < font->n_properties; i++)
4861 { 4815 {
4862 char *atom 4816 if (FONT_atom == font->properties[i].name)
4863 = XGetAtomName (FRAME_X_DISPLAY (f), font->properties[i].name);
4864 if (!strcmp (atom, "FONT"))
4865 { 4817 {
4866 char *name = XGetAtomName (FRAME_X_DISPLAY (f), 4818 char *name = XGetAtomName (FRAME_X_DISPLAY (f),
4867 (Atom) (font->properties[i].card32)); 4819 (Atom) (font->properties[i].card32));
@@ -4885,8 +4837,6 @@ x_new_font (f, fontname)
4885 4837
4886 break; 4838 break;
4887 } 4839 }
4888
4889 XFree (atom);
4890 } 4840 }
4891 4841
4892 n_fonts = FRAME_X_DISPLAY_INFO (f)->n_fonts; 4842 n_fonts = FRAME_X_DISPLAY_INFO (f)->n_fonts;