[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] Changes to emacs/src/keyboard.c,v
From: |
Chong Yidong |
Subject: |
[Emacs-diffs] Changes to emacs/src/keyboard.c,v |
Date: |
Sun, 20 Aug 2006 17:58:10 +0000 |
CVSROOT: /sources/emacs
Module name: emacs
Changes by: Chong Yidong <cyd> 06/08/20 17:58:09
Index: keyboard.c
===================================================================
RCS file: /sources/emacs/emacs/src/keyboard.c,v
retrieving revision 1.869
retrieving revision 1.870
diff -u -b -r1.869 -r1.870
--- keyboard.c 20 Aug 2006 12:06:20 -0000 1.869
+++ keyboard.c 20 Aug 2006 17:58:09 -0000 1.870
@@ -1390,6 +1390,72 @@
return Qnil;
}
+#ifdef HAVE_MOUSE
+
+/* Restore mouse tracking enablement. See Ftrack_mouse for the only use
+ of this function. */
+
+static Lisp_Object
+tracking_off (old_value)
+ Lisp_Object old_value;
+{
+ do_mouse_tracking = old_value;
+ if (NILP (old_value))
+ {
+ /* Redisplay may have been preempted because there was input
+ available, and it assumes it will be called again after the
+ input has been processed. If the only input available was
+ the sort that we have just disabled, then we need to call
+ redisplay. */
+ if (!readable_events (READABLE_EVENTS_DO_TIMERS_NOW))
+ {
+ redisplay_preserve_echo_area (6);
+ get_input_pending (&input_pending,
+ READABLE_EVENTS_DO_TIMERS_NOW);
+ }
+ }
+ return Qnil;
+}
+
+DEFUN ("track-mouse", Ftrack_mouse, Strack_mouse, 0, UNEVALLED, 0,
+ doc: /* Evaluate BODY with mouse movement events enabled.
+Within a `track-mouse' form, mouse motion generates input events that
+you can read with `read-event'.
+Normally, mouse motion is ignored.
+usage: (track-mouse BODY ...) */)
+ (args)
+ Lisp_Object args;
+{
+ int count = SPECPDL_INDEX ();
+ Lisp_Object val;
+
+ record_unwind_protect (tracking_off, do_mouse_tracking);
+
+ 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 */
+
/* This is the actual command reading loop,
sans error-handling encapsulation. */
@@ -2310,7 +2376,17 @@
#ifdef HAVE_MOUSE
if (!noninteractive && STRINGP (help))
+ {
+ /* The mouse-fixup-help-message Lisp function can call
+ mouse_position_hook, which resets the mouse_moved flags.
+ This causes trouble if we are trying to read a mouse motion
+ event (i.e., if we are inside a `track-mouse' form), so we
+ restore the mouse_moved flag. */
+ FRAME_PTR f = NILP (do_mouse_tracking) ? NULL : some_mouse_moved ();
help = call1 (Qmouse_fixup_help_message, help);
+ if (f)
+ f->mouse_moved = 1;
+ }
#endif
if (STRINGP (help) || NILP (help))
@@ -3464,72 +3540,6 @@
bcopy (temp, getcjmp, sizeof getcjmp);
}
-#ifdef HAVE_MOUSE
-
-/* Restore mouse tracking enablement. See Ftrack_mouse for the only use
- of this function. */
-
-static Lisp_Object
-tracking_off (old_value)
- Lisp_Object old_value;
-{
- do_mouse_tracking = old_value;
- if (NILP (old_value))
- {
- /* Redisplay may have been preempted because there was input
- available, and it assumes it will be called again after the
- input has been processed. If the only input available was
- the sort that we have just disabled, then we need to call
- redisplay. */
- if (!readable_events (READABLE_EVENTS_DO_TIMERS_NOW))
- {
- redisplay_preserve_echo_area (6);
- get_input_pending (&input_pending,
- READABLE_EVENTS_DO_TIMERS_NOW);
- }
- }
- return Qnil;
-}
-
-DEFUN ("track-mouse", Ftrack_mouse, Strack_mouse, 0, UNEVALLED, 0,
- doc: /* Evaluate BODY with mouse movement events enabled.
-Within a `track-mouse' form, mouse motion generates input events that
-you can read with `read-event'.
-Normally, mouse motion is ignored.
-usage: (track-mouse BODY ...) */)
- (args)
- Lisp_Object args;
-{
- int count = SPECPDL_INDEX ();
- Lisp_Object val;
-
- record_unwind_protect (tracking_off, do_mouse_tracking);
-
- 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.
kbd_buffer_store_event places events in kbd_buffer, and
kbd_buffer_get_event retrieves them. */
- [Emacs-diffs] Changes to emacs/src/keyboard.c,v, Chong Yidong, 2006/08/04
- [Emacs-diffs] Changes to emacs/src/keyboard.c,v, Eli Zaretskii, 2006/08/05
- [Emacs-diffs] Changes to emacs/src/keyboard.c,v, Richard M. Stallman, 2006/08/09
- [Emacs-diffs] Changes to emacs/src/keyboard.c,v, Jan Djärv, 2006/08/10
- [Emacs-diffs] Changes to emacs/src/keyboard.c,v, Chong Yidong, 2006/08/14
- [Emacs-diffs] Changes to emacs/src/keyboard.c,v, Chong Yidong, 2006/08/15
- [Emacs-diffs] Changes to emacs/src/keyboard.c,v, Richard M. Stallman, 2006/08/20
- [Emacs-diffs] Changes to emacs/src/keyboard.c,v,
Chong Yidong <=
- [Emacs-diffs] Changes to emacs/src/keyboard.c,v, Kenichi Handa, 2006/08/20
- [Emacs-diffs] Changes to emacs/src/keyboard.c,v, Jan Djärv, 2006/08/21
- [Emacs-diffs] Changes to emacs/src/keyboard.c,v, Kim F. Storm, 2006/08/25
- [Emacs-diffs] Changes to emacs/src/keyboard.c,v, YAMAMOTO Mitsuharu, 2006/08/27