-#define UNBLOCK_INPUT \
- (interrupt_input_blocked--, \
- (interrupt_input_blocked < 0 ? (abort (), 0) : 0), \
- ((interrupt_input_blocked == 0 && interrupt_input_pending != 0) \
- ? (reinvoke_input_signal (), 0) \
- : 0))
-
-#define TOTALLY_UNBLOCK_INPUT (interrupt_input_blocked = 0)
+
+#define UNBLOCK_INPUT \
+ do \
+ { \
+ --interrupt_input_blocked; \
+ if (interrupt_input_blocked == 0) \
+ { \
+ if (interrupt_input_pending) \
+ reinvoke_input_signal (); \
+ if (pending_atimers) \
+ do_pending_atimers (); \
+ } \
+ else if (interrupt_input_blocked < 0) \
+ abort (); \
+ } \
+ while (0)
+
+/* Undo any number of BLOCK_INPUT calls,
+ and also reinvoke any pending signal. */
+
+#define TOTALLY_UNBLOCK_INPUT \
+ do if (interrupt_input_blocked != 0) \
+ { \
+ interrupt_input_blocked = 1; \
+ UNBLOCK_INPUT; \
+ } \
+ while (0)
+
+/* Undo any number of BLOCK_INPUT calls down to level LEVEL,
+ and also (if the level is now 0) reinvoke any pending signal. */
+
+#define UNBLOCK_INPUT_TO(LEVEL) \
+ do \
+ { \
+ interrupt_input_blocked = (LEVEL) + 1; \
+ UNBLOCK_INPUT; \
+ } \
+ while (0)
+
+#endif /* defined HAVE_NS && !defined COCOA_EXPERIMENTAL_CTRL_G */
+