]> code.delx.au - gnu-emacs/blobdiff - src/keyboard.c
* keyboard.c (apply_modifiers): Fix typo in sanity check.
[gnu-emacs] / src / keyboard.c
index 2f8689ef13ef4690e8fafd576844d29b2f88acdb..8f4b9b4425fde434244855b39cc8fd429c6d6522 100644 (file)
@@ -36,6 +36,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
 #include "dispextern.h"
 #include "keyboard.h"
 #include "intervals.h"
+#include "blockinput.h"
 #include <setjmp.h>
 #include <errno.h>
 
@@ -49,6 +50,16 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
 
 extern int errno;
 
+/* Variables for blockinput.h: */
+
+/* Non-zero if interrupt input is blocked right now.  */
+int interrupt_input_blocked;
+
+/* Nonzero means an input interrupt has arrived
+   during the current critical section.  */
+int interrupt_input_pending;
+
+
 #ifdef HAVE_X_WINDOWS
 extern Lisp_Object Vmouse_grabbed;
 
@@ -1158,12 +1169,9 @@ int polling_for_input;
 SIGTYPE
 input_poll_signal ()
 {
-#ifdef HAVE_X_WINDOWS
-  extern int x_input_blocked;
-  if (x_input_blocked == 0)
-#endif
-    if (!waiting_for_input)
-      read_avail_input (0);
+  if (interrupt_input_blocked == 0
+      && !waiting_for_input)
+    read_avail_input (0);
   signal (SIGALRM, input_poll_signal);
   alarm (polling_period);
 }
@@ -1317,6 +1325,10 @@ read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu)
       XSET (internal_last_event_frame, Lisp_Frame, selected_frame);
       Vlast_event_frame = internal_last_event_frame;
 #endif
+      /* If we report the quit char as an event,
+        don't do so more than once.  */
+      if (!NILP (Vinhibit_quit))
+       Vquit_flag = Qnil;
 
       goto non_reread;
     }
@@ -2481,6 +2493,8 @@ parse_modifiers (symbol)
                   Qnil);
       Lisp_Object mask;
 
+      if (modifiers & ~((1<<VALBITS) - 1))
+       abort ();
       XFASTINT (mask) = modifiers;
       elements = Fcons (unmodified, Fcons (mask, Qnil));
 
@@ -2517,6 +2531,8 @@ apply_modifiers (modifiers, base)
 
   /* The click modifier never figures into cache indices.  */
   cache = Fget (base, Qmodifier_cache);
+  if (modifiers & ~((1<<VALBITS) - 1))
+    abort ();
   XFASTINT (index) = (modifiers & ~click_modifier);
   entry = Fassq (index, cache);
 
@@ -2534,6 +2550,8 @@ apply_modifiers (modifiers, base)
       Fput (base, Qmodifier_cache, Fcons (entry, cache));
 
       /* We have the parsing info now for free, so add it to the caches.  */
+      if (modifiers & ~((1<<VALBITS) - 1))
+       abort ();
       XFASTINT (index) = modifiers;
       Fput (new_symbol, Qevent_symbol_element_mask,
            Fcons (base, Fcons (index, Qnil)));