diff options
| author | Paul Eggert | 2012-09-23 01:44:20 -0700 |
|---|---|---|
| committer | Paul Eggert | 2012-09-23 01:44:20 -0700 |
| commit | 4d7e6e51dd4acecff466a28d958c50f34fc130b8 (patch) | |
| tree | 5e340d48fb69f9a40a4304cc94db2006caefe51f /src | |
| parent | 8f4635e97e1587c4026ec83fc1bd9f8954775915 (diff) | |
| download | emacs-4d7e6e51dd4acecff466a28d958c50f34fc130b8.tar.gz emacs-4d7e6e51dd4acecff466a28d958c50f34fc130b8.zip | |
Simplify and avoid signal-handling races.
* nt/inc/ms-w32.h (emacs_raise): New macro.
* src/alloc.c (die):
* src/sysdep.c (emacs_abort) [HAVE_NTGUI]:
Avoid recursive loop if there's a fatal error in the function itself.
* src/atimer.c (pending_atimers):
* src/blockinput.h: Don't include "atimer.h"; no longer needed.
(interrupt_input_pending): Remove. All uses removed.
pending_signals now counts both atimers and ordinary interrupts.
This is less racy than having three separate pending-signal flags.
(block_input, unblock_input, totally_unblock_input, unblock_input_to)
(input_blocked_p):
Rename from their upper-case counterparts BLOCK_INPUT,
UNBLOCK_INPUT, TOTALLY_UNBLOCK_INPUT, UNBLOCK_INPUT_TO,
INPUT_BLOCKED_P, and turn into functions. All uses changed.
This makes it easier to access volatile variables more accurately.
(BLOCK_INPUT_RESIGNAL): Remove. All uses replaced by unblock_input ().
(input_blocked_p): Prefer this to 'interrupt_input_blocked', as
that's more reliable if the code is buggy and sets
interrupt_input_blocked to a negative value. All uses changed.
* src/atimer.c (deliver_alarm_signal):
Remove. No need to deliver this to the parent; any thread can
handle this signal now. All uses replaced by underlying handler.
* src/atimer.c (turn_on_atimers):
* src/dispnew.c (handle_window_change_signal):
* src/emacs.c (handle_danger_signal):
* src/keyboard.c (kbd_buffer_get_event):
Don't reestablish signal handler; not needed with sigaction.
* src/blockinput.h (UNBLOCK_INPUT_TO, TOTALLY_UNBLOCK_INPUT)
(UNBLOCK_INPUT_TO):
Rework to avoid unnecessary accesses to volatile variables.
(UNBLOCK_INPUT_TO): Now a function.
(totally_unblock_input, unblock_input): New decls.
* src/data.c (handle_arith_signal, deliver_arith_signal): Move to sysdep.c
(init_data): Remove. Necessary stuff now done in init_signal.
* src/emacs.c, src/xdisp.c: Include "atimer.h", since we invoke atimer functions.
* src/emacs.c (handle_fatal_signal, deliver_fatal_signal): Move to sysdep.c.
(fatal_error_code): Remove; no longer needed.
(terminate_due_to_signal): Rename from fatal_error_backtrace, since
it doesn't always backtrace. All uses changed. No need to reset
signal to default, since sigaction and/or die does that for us now.
Use emacs_raise (FOO), not kill (getpid (), FOO).
(main): Check more-accurately whether we're dumping.
Move fatal-error setup to sysdep.c
* src/floatfns.c: Do not include "syssignal.h"; no longer needed.
* src/gtkutil.c (xg_get_file_name, xg_get_font):
Remove no-longer-needed signal-mask manipulation.
* src/keyboard.c, src/process.c (POLL_FOR_INPUT):
Don't depend on USE_ASYNC_EVENTS, a symbol that is never defined.
* src/keyboard.c (read_avail_input): Remove.
All uses replaced by gobble_input.
(Ftop_level): Use TOTALLY_UNBLOCK_INPUT rather than open code.
(kbd_buffer_store_event_hold, gobble_input):
(record_asynch_buffer_change) [USABLE_SIGIO]:
(store_user_signal_events):
No need to mess with signal mask.
(gobble_input): If blocking input and there are terminals, simply
set pending_signals to 1 and return. All hooks changed to not
worry about whether input is blocked.
(process_pending_signals): Clear pending_signals before processing
them, in case a signal comes in while we're processing.
By convention callers now test pending_signals before calling us.
(UNBLOCK_INPUT_TO, unblock_input, totally_unblock_input):
New functions, to support changes to blockinput.h.
(handle_input_available_signal): Now extern.
(reinvoke_input_signal): Remove. All uses replaced by
handle_async_input.
(quit_count): Now volatile, since a signal handler uses it.
(handle_interrupt): Now takes bool IN_SIGNAL_HANDLER as arg. All
callers changed. Block SIGINT only if not already blocked.
Clear sigmask reliably, even if Fsignal returns, which it can.
Omit unnecessary accesses to volatile var.
(quit_throw_to_read_char): No need to restore sigmask.
* src/keyboard.c (gobble_input, handle_user_signal):
* src/process.c (wait_reading_process_output):
Call signal-handling code rather than killing ourselves.
* src/lisp.h: Include <float.h>, for...
(IEEE_FLOATING_POINT): New macro, moved here to avoid duplication.
(pending_signals): Now volatile.
(syms_of_data): Now const if IEEE floating point.
(handle_input_available_signal) [USABLE_SIGIO]:
(terminate_due_to_signal, record_child_status_change): New decls.
* src/process.c (create_process): Avoid disaster if memory is exhausted
while we're processing a vfork, by tightening the critical section
around the vfork.
(send_process_frame, process_sent_to, handle_pipe_signal)
(deliver_pipe_signal): Remove. No longer needed, as Emacs now
ignores SIGPIPE.
(send_process): No need for setjmp/longjmp any more, since the
SIGPIPE stuff is now gone. Instead, report an error if errno
is EPIPE.
(record_child_status_change): Now extern. PID and W are now args.
Return void, not bool. All callers changed.
* src/sysdep.c (wait_debugging) [(BSD_SYSTEM || HPUX) && !defined (__GNU__)]:
Remove. All uses removed. This bug should be fixed now in a
different way.
(wait_for_termination_1): Use waitpid rather than sigsuspend,
and record the child status change directly. This avoids the
need to futz with the signal mask.
(process_fatal_action): Move here from emacs.c.
(emacs_sigaction_flags): New function, containing
much of what used to be in emacs_sigaction_init.
(emacs_sigaction_init): Use it. Block nonfatal system signals that are
caught by emacs, to make races less likely.
(deliver_process_signal): Rename from handle_on_main_thread.
All uses changed.
(BACKTRACE_LIMIT_MAX): Now at top level.
(thread_backtrace_buffer, threadback_backtrace_pointers):
New static vars.
(deliver_thread_signal, deliver_fatal_thread_signal):
New functions, for more-accurate delivery of thread-specific signals.
(handle_fatal_signal, deliver_fatal_signal): Move here from emacs.c.
(deliver_arith_signal): Handle in this thread, not
in the main thread, since it's triggered by this thread.
(maybe_fatal_sig): New function.
(init_signals): New arg DUMPING so that we can be more accurate
about whether we're dumping. Caller changed.
Treat thread-specific signals differently from process-general signals.
Block all signals while handling fatal error; that's safer.
xsignal from SIGFPE only on non-IEEE hosts, treating it as fatal
on IEEE hosts.
When batch, ignore SIGHUP, SIGINT, SIGTERM if they were already ignored.
Ignore SIGPIPE unless batch.
(emacs_backtrace): Output backtrace for the appropriate thread,
which is not necessarily the main thread.
* src/syssignal.h: Include <stdbool.h>.
(emacs_raise): New macro.
* src/xterm.c (x_connection_signal): Remove; no longer needed
now that we use sigaction.
(x_connection_closed): No need to mess with sigmask now.
(x_initialize): No need to reset SIGPIPE handler here, since
init_signals does this for us now.
Fixes: debbugs:12471
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 134 | ||||
| -rw-r--r-- | src/alloc.c | 11 | ||||
| -rw-r--r-- | src/atimer.c | 51 | ||||
| -rw-r--r-- | src/blockinput.h | 118 | ||||
| -rw-r--r-- | src/buffer.c | 24 | ||||
| -rw-r--r-- | src/callproc.c | 11 | ||||
| -rw-r--r-- | src/data.c | 37 | ||||
| -rw-r--r-- | src/dired.c | 20 | ||||
| -rw-r--r-- | src/dispnew.c | 26 | ||||
| -rw-r--r-- | src/dosfns.c | 4 | ||||
| -rw-r--r-- | src/editfns.c | 48 | ||||
| -rw-r--r-- | src/emacs.c | 168 | ||||
| -rw-r--r-- | src/eval.c | 18 | ||||
| -rw-r--r-- | src/fileio.c | 24 | ||||
| -rw-r--r-- | src/floatfns.c | 9 | ||||
| -rw-r--r-- | src/fns.c | 7 | ||||
| -rw-r--r-- | src/fontset.c | 4 | ||||
| -rw-r--r-- | src/frame.c | 4 | ||||
| -rw-r--r-- | src/fringe.c | 2 | ||||
| -rw-r--r-- | src/ftxfont.c | 16 | ||||
| -rw-r--r-- | src/gtkutil.c | 91 | ||||
| -rw-r--r-- | src/image.c | 50 | ||||
| -rw-r--r-- | src/keyboard.c | 269 | ||||
| -rw-r--r-- | src/keyboard.h | 2 | ||||
| -rw-r--r-- | src/keymap.c | 4 | ||||
| -rw-r--r-- | src/lisp.h | 20 | ||||
| -rw-r--r-- | src/lread.c | 24 | ||||
| -rw-r--r-- | src/menu.c | 12 | ||||
| -rw-r--r-- | src/msdos.c | 8 | ||||
| -rw-r--r-- | src/nsfns.m | 42 | ||||
| -rw-r--r-- | src/nsfont.m | 12 | ||||
| -rw-r--r-- | src/nsmenu.m | 28 | ||||
| -rw-r--r-- | src/nsterm.m | 128 | ||||
| -rw-r--r-- | src/print.c | 4 | ||||
| -rw-r--r-- | src/process.c | 574 | ||||
| -rw-r--r-- | src/ralloc.c | 4 | ||||
| -rw-r--r-- | src/search.c | 2 | ||||
| -rw-r--r-- | src/sysdep.c | 413 | ||||
| -rw-r--r-- | src/syssignal.h | 9 | ||||
| -rw-r--r-- | src/term.c | 12 | ||||
| -rw-r--r-- | src/termhooks.h | 3 | ||||
| -rw-r--r-- | src/w16select.c | 8 | ||||
| -rw-r--r-- | src/w32fns.c | 110 | ||||
| -rw-r--r-- | src/w32inevt.c | 15 | ||||
| -rw-r--r-- | src/w32menu.c | 12 | ||||
| -rw-r--r-- | src/w32reg.c | 4 | ||||
| -rw-r--r-- | src/w32select.c | 12 | ||||
| -rw-r--r-- | src/w32term.c | 123 | ||||
| -rw-r--r-- | src/widget.c | 4 | ||||
| -rw-r--r-- | src/window.c | 34 | ||||
| -rw-r--r-- | src/xdisp.c | 43 | ||||
| -rw-r--r-- | src/xfaces.c | 50 | ||||
| -rw-r--r-- | src/xfns.c | 176 | ||||
| -rw-r--r-- | src/xfont.c | 40 | ||||
| -rw-r--r-- | src/xftfont.c | 34 | ||||
| -rw-r--r-- | src/xmenu.c | 54 | ||||
| -rw-r--r-- | src/xselect.c | 100 | ||||
| -rw-r--r-- | src/xsettings.c | 4 | ||||
| -rw-r--r-- | src/xterm.c | 302 |
59 files changed, 1722 insertions, 1850 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index ee3befaa9ba..37c1ecf8824 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,137 @@ | |||
| 1 | 2012-09-23 Paul Eggert <eggert@cs.ucla.edu> | ||
| 2 | |||
| 3 | Simplify and avoid signal-handling races (Bug#12471). | ||
| 4 | * alloc.c (die): | ||
| 5 | * sysdep.c (emacs_abort) [HAVE_NTGUI]: | ||
| 6 | Avoid recursive loop if there's a fatal error in the function itself. | ||
| 7 | * atimer.c (pending_atimers): | ||
| 8 | * blockinput.h: Don't include "atimer.h"; no longer needed. | ||
| 9 | (interrupt_input_pending): Remove. All uses removed. | ||
| 10 | pending_signals now counts both atimers and ordinary interrupts. | ||
| 11 | This is less racy than having three separate pending-signal flags. | ||
| 12 | (block_input, unblock_input, totally_unblock_input, unblock_input_to) | ||
| 13 | (input_blocked_p): | ||
| 14 | Rename from their upper-case counterparts BLOCK_INPUT, | ||
| 15 | UNBLOCK_INPUT, TOTALLY_UNBLOCK_INPUT, UNBLOCK_INPUT_TO, | ||
| 16 | INPUT_BLOCKED_P, and turn into functions. All uses changed. | ||
| 17 | This makes it easier to access volatile variables more accurately. | ||
| 18 | (BLOCK_INPUT_RESIGNAL): Remove. All uses replaced by unblock_input (). | ||
| 19 | (input_blocked_p): Prefer this to 'interrupt_input_blocked', as | ||
| 20 | that's more reliable if the code is buggy and sets | ||
| 21 | interrupt_input_blocked to a negative value. All uses changed. | ||
| 22 | * atimer.c (deliver_alarm_signal): | ||
| 23 | Remove. No need to deliver this to the parent; any thread can | ||
| 24 | handle this signal now. All uses replaced by underlying handler. | ||
| 25 | * atimer.c (turn_on_atimers): | ||
| 26 | * dispnew.c (handle_window_change_signal): | ||
| 27 | * emacs.c (handle_danger_signal): | ||
| 28 | * keyboard.c (kbd_buffer_get_event): | ||
| 29 | Don't reestablish signal handler; not needed with sigaction. | ||
| 30 | * blockinput.h (UNBLOCK_INPUT_TO, TOTALLY_UNBLOCK_INPUT) | ||
| 31 | (UNBLOCK_INPUT_TO): | ||
| 32 | Rework to avoid unnecessary accesses to volatile variables. | ||
| 33 | (UNBLOCK_INPUT_TO): Now a function. | ||
| 34 | (totally_unblock_input, unblock_input): New decls. | ||
| 35 | * data.c (handle_arith_signal, deliver_arith_signal): Move to sysdep.c | ||
| 36 | (init_data): Remove. Necessary stuff now done in init_signal. | ||
| 37 | * emacs.c, xdisp.c: Include "atimer.h", since we invoke atimer functions. | ||
| 38 | * emacs.c (handle_fatal_signal, deliver_fatal_signal): Move to sysdep.c. | ||
| 39 | (fatal_error_code): Remove; no longer needed. | ||
| 40 | (terminate_due_to_signal): Rename from fatal_error_backtrace, since | ||
| 41 | it doesn't always backtrace. All uses changed. No need to reset | ||
| 42 | signal to default, since sigaction and/or die does that for us now. | ||
| 43 | Use emacs_raise (FOO), not kill (getpid (), FOO). | ||
| 44 | (main): Check more-accurately whether we're dumping. | ||
| 45 | Move fatal-error setup to sysdep.c | ||
| 46 | * floatfns.c: Do not include "syssignal.h"; no longer needed. | ||
| 47 | * gtkutil.c (xg_get_file_name, xg_get_font): | ||
| 48 | Remove no-longer-needed signal-mask manipulation. | ||
| 49 | * keyboard.c, process.c (POLL_FOR_INPUT): | ||
| 50 | Don't depend on USE_ASYNC_EVENTS, a symbol that is never defined. | ||
| 51 | * keyboard.c (read_avail_input): Remove. | ||
| 52 | All uses replaced by gobble_input. | ||
| 53 | (Ftop_level): Use TOTALLY_UNBLOCK_INPUT rather than open code. | ||
| 54 | (kbd_buffer_store_event_hold, gobble_input): | ||
| 55 | (record_asynch_buffer_change) [USABLE_SIGIO]: | ||
| 56 | (store_user_signal_events): | ||
| 57 | No need to mess with signal mask. | ||
| 58 | (gobble_input): If blocking input and there are terminals, simply | ||
| 59 | set pending_signals to 1 and return. All hooks changed to not | ||
| 60 | worry about whether input is blocked. | ||
| 61 | (process_pending_signals): Clear pending_signals before processing | ||
| 62 | them, in case a signal comes in while we're processing. | ||
| 63 | By convention callers now test pending_signals before calling us. | ||
| 64 | (UNBLOCK_INPUT_TO, unblock_input, totally_unblock_input): | ||
| 65 | New functions, to support changes to blockinput.h. | ||
| 66 | (handle_input_available_signal): Now extern. | ||
| 67 | (reinvoke_input_signal): Remove. All uses replaced by | ||
| 68 | handle_async_input. | ||
| 69 | (quit_count): Now volatile, since a signal handler uses it. | ||
| 70 | (handle_interrupt): Now takes bool IN_SIGNAL_HANDLER as arg. All | ||
| 71 | callers changed. Block SIGINT only if not already blocked. | ||
| 72 | Clear sigmask reliably, even if Fsignal returns, which it can. | ||
| 73 | Omit unnecessary accesses to volatile var. | ||
| 74 | (quit_throw_to_read_char): No need to restore sigmask. | ||
| 75 | * keyboard.c (gobble_input, handle_user_signal): | ||
| 76 | * process.c (wait_reading_process_output): | ||
| 77 | Call signal-handling code rather than killing ourselves. | ||
| 78 | * lisp.h: Include <float.h>, for... | ||
| 79 | (IEEE_FLOATING_POINT): New macro, moved here to avoid duplication. | ||
| 80 | (pending_signals): Now volatile. | ||
| 81 | (syms_of_data): Now const if IEEE floating point. | ||
| 82 | (handle_input_available_signal) [USABLE_SIGIO]: | ||
| 83 | (terminate_due_to_signal, record_child_status_change): New decls. | ||
| 84 | * process.c (create_process): Avoid disaster if memory is exhausted | ||
| 85 | while we're processing a vfork, by tightening the critical section | ||
| 86 | around the vfork. | ||
| 87 | (send_process_frame, process_sent_to, handle_pipe_signal) | ||
| 88 | (deliver_pipe_signal): Remove. No longer needed, as Emacs now | ||
| 89 | ignores SIGPIPE. | ||
| 90 | (send_process): No need for setjmp/longjmp any more, since the | ||
| 91 | SIGPIPE stuff is now gone. Instead, report an error if errno | ||
| 92 | is EPIPE. | ||
| 93 | (record_child_status_change): Now extern. PID and W are now args. | ||
| 94 | Return void, not bool. All callers changed. | ||
| 95 | * sysdep.c (wait_debugging) [(BSD_SYSTEM || HPUX) && !defined (__GNU__)]: | ||
| 96 | Remove. All uses removed. This bug should be fixed now in a | ||
| 97 | different way. | ||
| 98 | (wait_for_termination_1): Use waitpid rather than sigsuspend, | ||
| 99 | and record the child status change directly. This avoids the | ||
| 100 | need to futz with the signal mask. | ||
| 101 | (process_fatal_action): Move here from emacs.c. | ||
| 102 | (emacs_sigaction_flags): New function, containing | ||
| 103 | much of what used to be in emacs_sigaction_init. | ||
| 104 | (emacs_sigaction_init): Use it. Block nonfatal system signals that are | ||
| 105 | caught by emacs, to make races less likely. | ||
| 106 | (deliver_process_signal): Rename from handle_on_main_thread. | ||
| 107 | All uses changed. | ||
| 108 | (BACKTRACE_LIMIT_MAX): Now at top level. | ||
| 109 | (thread_backtrace_buffer, threadback_backtrace_pointers): | ||
| 110 | New static vars. | ||
| 111 | (deliver_thread_signal, deliver_fatal_thread_signal): | ||
| 112 | New functions, for more-accurate delivery of thread-specific signals. | ||
| 113 | (handle_fatal_signal, deliver_fatal_signal): Move here from emacs.c. | ||
| 114 | (deliver_arith_signal): Handle in this thread, not | ||
| 115 | in the main thread, since it's triggered by this thread. | ||
| 116 | (maybe_fatal_sig): New function. | ||
| 117 | (init_signals): New arg DUMPING so that we can be more accurate | ||
| 118 | about whether we're dumping. Caller changed. | ||
| 119 | Treat thread-specific signals differently from process-general signals. | ||
| 120 | Block all signals while handling fatal error; that's safer. | ||
| 121 | xsignal from SIGFPE only on non-IEEE hosts, treating it as fatal | ||
| 122 | on IEEE hosts. | ||
| 123 | When batch, ignore SIGHUP, SIGINT, SIGTERM if they were already ignored. | ||
| 124 | Ignore SIGPIPE unless batch. | ||
| 125 | (emacs_backtrace): Output backtrace for the appropriate thread, | ||
| 126 | which is not necessarily the main thread. | ||
| 127 | * syssignal.h: Include <stdbool.h>. | ||
| 128 | (emacs_raise): New macro. | ||
| 129 | * xterm.c (x_connection_signal): Remove; no longer needed | ||
| 130 | now that we use sigaction. | ||
| 131 | (x_connection_closed): No need to mess with sigmask now. | ||
| 132 | (x_initialize): No need to reset SIGPIPE handler here, since | ||
| 133 | init_signals does this for us now. | ||
| 134 | |||
| 1 | 2012-09-23 Jan Djärv <jan.h.d@swipnet.se> | 135 | 2012-09-23 Jan Djärv <jan.h.d@swipnet.se> |
| 2 | 136 | ||
| 3 | * nsterm.m (ns_dumpglyphs_image): dr is a new rect to draw image into, | 137 | * nsterm.m (ns_dumpglyphs_image): dr is a new rect to draw image into, |
diff --git a/src/alloc.c b/src/alloc.c index 02ba2f5f9e3..3c60f685d08 100644 --- a/src/alloc.c +++ b/src/alloc.c | |||
| @@ -633,13 +633,13 @@ static void | |||
| 633 | malloc_block_input (void) | 633 | malloc_block_input (void) |
| 634 | { | 634 | { |
| 635 | if (block_input_in_memory_allocators) | 635 | if (block_input_in_memory_allocators) |
| 636 | BLOCK_INPUT; | 636 | block_input (); |
| 637 | } | 637 | } |
| 638 | static void | 638 | static void |
| 639 | malloc_unblock_input (void) | 639 | malloc_unblock_input (void) |
| 640 | { | 640 | { |
| 641 | if (block_input_in_memory_allocators) | 641 | if (block_input_in_memory_allocators) |
| 642 | UNBLOCK_INPUT; | 642 | unblock_input (); |
| 643 | } | 643 | } |
| 644 | # define MALLOC_BLOCK_INPUT malloc_block_input () | 644 | # define MALLOC_BLOCK_INPUT malloc_block_input () |
| 645 | # define MALLOC_UNBLOCK_INPUT malloc_unblock_input () | 645 | # define MALLOC_UNBLOCK_INPUT malloc_unblock_input () |
| @@ -5125,7 +5125,7 @@ See Info node `(elisp)Garbage Collection'. */) | |||
| 5125 | if (garbage_collection_messages) | 5125 | if (garbage_collection_messages) |
| 5126 | message1_nolog ("Garbage collecting..."); | 5126 | message1_nolog ("Garbage collecting..."); |
| 5127 | 5127 | ||
| 5128 | BLOCK_INPUT; | 5128 | block_input (); |
| 5129 | 5129 | ||
| 5130 | shrink_regexp_cache (); | 5130 | shrink_regexp_cache (); |
| 5131 | 5131 | ||
| @@ -5242,7 +5242,7 @@ See Info node `(elisp)Garbage Collection'. */) | |||
| 5242 | dump_zombies (); | 5242 | dump_zombies (); |
| 5243 | #endif | 5243 | #endif |
| 5244 | 5244 | ||
| 5245 | UNBLOCK_INPUT; | 5245 | unblock_input (); |
| 5246 | 5246 | ||
| 5247 | check_cons_list (); | 5247 | check_cons_list (); |
| 5248 | 5248 | ||
| @@ -6393,9 +6393,10 @@ bool suppress_checking; | |||
| 6393 | void | 6393 | void |
| 6394 | die (const char *msg, const char *file, int line) | 6394 | die (const char *msg, const char *file, int line) |
| 6395 | { | 6395 | { |
| 6396 | signal (SIGABRT, SIG_DFL); | ||
| 6396 | fprintf (stderr, "\r\n%s:%d: Emacs fatal error: %s\r\n", | 6397 | fprintf (stderr, "\r\n%s:%d: Emacs fatal error: %s\r\n", |
| 6397 | file, line, msg); | 6398 | file, line, msg); |
| 6398 | fatal_error_backtrace (SIGABRT, INT_MAX); | 6399 | terminate_due_to_signal (SIGABRT, INT_MAX); |
| 6399 | } | 6400 | } |
| 6400 | #endif | 6401 | #endif |
| 6401 | 6402 | ||
diff --git a/src/atimer.c b/src/atimer.c index 5dbd807872a..d3b6c7d8fd3 100644 --- a/src/atimer.c +++ b/src/atimer.c | |||
| @@ -40,14 +40,6 @@ static struct atimer *stopped_atimers; | |||
| 40 | 40 | ||
| 41 | static struct atimer *atimers; | 41 | static struct atimer *atimers; |
| 42 | 42 | ||
| 43 | /* Non-zero means alarm signal handler has found ripe timers but | ||
| 44 | interrupt_input_blocked was non-zero. In this case, timer | ||
| 45 | functions are not called until the next UNBLOCK_INPUT because timer | ||
| 46 | functions are expected to call X, and X cannot be assumed to be | ||
| 47 | reentrant. */ | ||
| 48 | |||
| 49 | int pending_atimers; | ||
| 50 | |||
| 51 | /* Block/unblock SIGALRM. */ | 43 | /* Block/unblock SIGALRM. */ |
| 52 | 44 | ||
| 53 | static void | 45 | static void |
| @@ -341,16 +333,11 @@ schedule_atimer (struct atimer *t) | |||
| 341 | static void | 333 | static void |
| 342 | run_timers (void) | 334 | run_timers (void) |
| 343 | { | 335 | { |
| 344 | EMACS_TIME now; | 336 | EMACS_TIME now = current_emacs_time (); |
| 345 | 337 | ||
| 346 | while (atimers | 338 | while (atimers && EMACS_TIME_LE (atimers->expiration, now)) |
| 347 | && (pending_atimers = interrupt_input_blocked) == 0 | ||
| 348 | && (now = current_emacs_time (), | ||
| 349 | EMACS_TIME_LE (atimers->expiration, now))) | ||
| 350 | { | 339 | { |
| 351 | struct atimer *t; | 340 | struct atimer *t = atimers; |
| 352 | |||
| 353 | t = atimers; | ||
| 354 | atimers = atimers->next; | 341 | atimers = atimers->next; |
| 355 | t->fn (t); | 342 | t->fn (t); |
| 356 | 343 | ||
| @@ -366,16 +353,7 @@ run_timers (void) | |||
| 366 | } | 353 | } |
| 367 | } | 354 | } |
| 368 | 355 | ||
| 369 | if (! atimers) | 356 | set_alarm (); |
| 370 | pending_atimers = 0; | ||
| 371 | |||
| 372 | if (pending_atimers) | ||
| 373 | pending_signals = 1; | ||
| 374 | else | ||
| 375 | { | ||
| 376 | pending_signals = interrupt_input_pending; | ||
| 377 | set_alarm (); | ||
| 378 | } | ||
| 379 | } | 357 | } |
| 380 | 358 | ||
| 381 | 359 | ||
| @@ -385,23 +363,16 @@ run_timers (void) | |||
| 385 | static void | 363 | static void |
| 386 | handle_alarm_signal (int sig) | 364 | handle_alarm_signal (int sig) |
| 387 | { | 365 | { |
| 388 | pending_atimers = 1; | ||
| 389 | pending_signals = 1; | 366 | pending_signals = 1; |
| 390 | } | 367 | } |
| 391 | 368 | ||
| 392 | static void | ||
| 393 | deliver_alarm_signal (int sig) | ||
| 394 | { | ||
| 395 | handle_on_main_thread (sig, handle_alarm_signal); | ||
| 396 | } | ||
| 397 | |||
| 398 | 369 | ||
| 399 | /* Call alarm signal handler for pending timers. */ | 370 | /* Do pending timers. */ |
| 400 | 371 | ||
| 401 | void | 372 | void |
| 402 | do_pending_atimers (void) | 373 | do_pending_atimers (void) |
| 403 | { | 374 | { |
| 404 | if (pending_atimers) | 375 | if (atimers) |
| 405 | { | 376 | { |
| 406 | block_atimers (); | 377 | block_atimers (); |
| 407 | run_timers (); | 378 | run_timers (); |
| @@ -417,12 +388,7 @@ void | |||
| 417 | turn_on_atimers (bool on) | 388 | turn_on_atimers (bool on) |
| 418 | { | 389 | { |
| 419 | if (on) | 390 | if (on) |
| 420 | { | 391 | set_alarm (); |
| 421 | struct sigaction action; | ||
| 422 | emacs_sigaction_init (&action, deliver_alarm_signal); | ||
| 423 | sigaction (SIGALRM, &action, 0); | ||
| 424 | set_alarm (); | ||
| 425 | } | ||
| 426 | else | 392 | else |
| 427 | alarm (0); | 393 | alarm (0); |
| 428 | } | 394 | } |
| @@ -433,8 +399,7 @@ init_atimer (void) | |||
| 433 | { | 399 | { |
| 434 | struct sigaction action; | 400 | struct sigaction action; |
| 435 | free_atimers = stopped_atimers = atimers = NULL; | 401 | free_atimers = stopped_atimers = atimers = NULL; |
| 436 | pending_atimers = 0; | ||
| 437 | /* pending_signals is initialized in init_keyboard.*/ | 402 | /* pending_signals is initialized in init_keyboard.*/ |
| 438 | emacs_sigaction_init (&action, deliver_alarm_signal); | 403 | emacs_sigaction_init (&action, handle_alarm_signal); |
| 439 | sigaction (SIGALRM, &action, 0); | 404 | sigaction (SIGALRM, &action, 0); |
| 440 | } | 405 | } |
diff --git a/src/blockinput.h b/src/blockinput.h index 7501bfc91a0..70822e29be7 100644 --- a/src/blockinput.h +++ b/src/blockinput.h | |||
| @@ -19,103 +19,57 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 19 | #ifndef EMACS_BLOCKINPUT_H | 19 | #ifndef EMACS_BLOCKINPUT_H |
| 20 | #define EMACS_BLOCKINPUT_H | 20 | #define EMACS_BLOCKINPUT_H |
| 21 | 21 | ||
| 22 | #include "atimer.h" | 22 | INLINE_HEADER_BEGIN |
| 23 | #ifndef BLOCKINPUT_INLINE | ||
| 24 | # define BLOCKINPUT_INLINE INLINE | ||
| 25 | #endif | ||
| 23 | 26 | ||
| 24 | /* When Emacs is using signal-driven input, the processing of those | 27 | /* Emacs should avoid doing anything hairy in a signal handler, because |
| 25 | input signals can get pretty hairy. For example, when Emacs is | 28 | so many system functions are non-reentrant. For example, malloc |
| 26 | running under X windows, handling an input signal can entail | 29 | and the Xlib functions aren't usually re-entrant, so if they were |
| 27 | retrieving events from the X event queue, or making other X calls. | 30 | used by the SIGIO handler, we'd lose. |
| 28 | |||
| 29 | If an input signal occurs while Emacs is in the midst of some | ||
| 30 | non-reentrant code, and the signal processing invokes that same | ||
| 31 | code, we lose. For example, malloc and the Xlib functions aren't | ||
| 32 | usually re-entrant, and both are used by the X input signal handler | ||
| 33 | - if we try to process an input signal in the midst of executing | ||
| 34 | any of these functions, we'll lose. | ||
| 35 | 31 | ||
| 36 | To avoid this, we make the following requirements: | 32 | To avoid this, we make the following requirements: |
| 37 | 33 | ||
| 38 | * Everyone must evaluate BLOCK_INPUT before entering these functions, | 34 | * Everyone must evaluate BLOCK_INPUT before performing actions that |
| 39 | and then call UNBLOCK_INPUT after performing them. Calls | 35 | might conflict with a signal handler, and then call UNBLOCK_INPUT |
| 40 | BLOCK_INPUT and UNBLOCK_INPUT may be nested. | 36 | after performing them. Calls BLOCK_INPUT and UNBLOCK_INPUT may be |
| 37 | nested. | ||
| 41 | 38 | ||
| 42 | * Any complicated interrupt handling code should test | 39 | * Any complicated interrupt handling code should test |
| 43 | interrupt_input_blocked, and put off its work until later. | 40 | INPUT_BLOCKED_P, and put off its work until later. |
| 44 | 41 | ||
| 45 | * If the interrupt handling code wishes, it may set | 42 | * If the interrupt handling code wishes, it may set |
| 46 | interrupt_input_pending to a non-zero value. If that flag is set | 43 | pending_signals to a non-zero value. If that flag is set |
| 47 | when input becomes unblocked, UNBLOCK_INPUT will send a new SIGIO. */ | 44 | when input becomes unblocked, UNBLOCK_INPUT will then read |
| 48 | 45 | input and process timers. | |
| 49 | extern volatile int interrupt_input_blocked; | ||
| 50 | |||
| 51 | /* Nonzero means an input interrupt has arrived | ||
| 52 | during the current critical section. */ | ||
| 53 | extern int interrupt_input_pending; | ||
| 54 | 46 | ||
| 47 | Historically, Emacs signal handlers did much more than they do now, | ||
| 48 | and this caused many BLOCK_INPUT calls to be sprinkled around the code. | ||
| 49 | FIXME: Remove calls that aren't needed now. */ | ||
| 55 | 50 | ||
| 56 | /* Non-zero means asynchronous timers should be run when input is | 51 | extern volatile int interrupt_input_blocked; |
| 57 | unblocked. */ | ||
| 58 | 52 | ||
| 59 | extern int pending_atimers; | 53 | /* Begin critical section. */ |
| 60 | 54 | ||
| 55 | BLOCKINPUT_INLINE void | ||
| 56 | block_input (void) | ||
| 57 | { | ||
| 58 | interrupt_input_blocked++; | ||
| 59 | } | ||
| 61 | 60 | ||
| 62 | /* Begin critical section. */ | 61 | extern void unblock_input (void); |
| 63 | #define BLOCK_INPUT (interrupt_input_blocked++) | 62 | extern void totally_unblock_input (void); |
| 64 | 63 | extern void unblock_input_to (int); | |
| 65 | /* End critical section. | ||
| 66 | |||
| 67 | If doing signal-driven input, and a signal came in when input was | ||
| 68 | blocked, reinvoke the signal handler now to deal with it. | ||
| 69 | |||
| 70 | Always test interrupt_input_pending; that's not too expensive, and | ||
| 71 | it'll never get set if we don't need to resignal. This is simpler | ||
| 72 | than dealing here with every configuration option that might affect | ||
| 73 | whether interrupt_input_pending can be nonzero. */ | ||
| 74 | |||
| 75 | #define UNBLOCK_INPUT \ | ||
| 76 | do \ | ||
| 77 | { \ | ||
| 78 | --interrupt_input_blocked; \ | ||
| 79 | if (interrupt_input_blocked == 0) \ | ||
| 80 | { \ | ||
| 81 | if (interrupt_input_pending) \ | ||
| 82 | reinvoke_input_signal (); \ | ||
| 83 | if (pending_atimers) \ | ||
| 84 | do_pending_atimers (); \ | ||
| 85 | } \ | ||
| 86 | else if (interrupt_input_blocked < 0) \ | ||
| 87 | emacs_abort (); \ | ||
| 88 | } \ | ||
| 89 | while (0) | ||
| 90 | |||
| 91 | /* Undo any number of BLOCK_INPUT calls, | ||
| 92 | and also reinvoke any pending signal. */ | ||
| 93 | |||
| 94 | #define TOTALLY_UNBLOCK_INPUT \ | ||
| 95 | do if (interrupt_input_blocked != 0) \ | ||
| 96 | { \ | ||
| 97 | interrupt_input_blocked = 1; \ | ||
| 98 | UNBLOCK_INPUT; \ | ||
| 99 | } \ | ||
| 100 | while (0) | ||
| 101 | |||
| 102 | /* Undo any number of BLOCK_INPUT calls down to level LEVEL, | ||
| 103 | and also (if the level is now 0) reinvoke any pending signal. */ | ||
| 104 | |||
| 105 | #define UNBLOCK_INPUT_TO(LEVEL) \ | ||
| 106 | do \ | ||
| 107 | { \ | ||
| 108 | interrupt_input_blocked = (LEVEL) + 1; \ | ||
| 109 | UNBLOCK_INPUT; \ | ||
| 110 | } \ | ||
| 111 | while (0) | ||
| 112 | |||
| 113 | #define UNBLOCK_INPUT_RESIGNAL UNBLOCK_INPUT | ||
| 114 | 64 | ||
| 115 | /* In critical section ? */ | 65 | /* In critical section ? */ |
| 116 | #define INPUT_BLOCKED_P (interrupt_input_blocked > 0) | ||
| 117 | 66 | ||
| 118 | /* Defined in keyboard.c */ | 67 | BLOCKINPUT_INLINE bool |
| 119 | extern void reinvoke_input_signal (void); | 68 | input_blocked_p (void) |
| 69 | { | ||
| 70 | return 0 < interrupt_input_blocked; | ||
| 71 | } | ||
| 72 | |||
| 73 | INLINE_HEADER_END | ||
| 120 | 74 | ||
| 121 | #endif /* EMACS_BLOCKINPUT_H */ | 75 | #endif /* EMACS_BLOCKINPUT_H */ |
diff --git a/src/buffer.c b/src/buffer.c index 22624e33a4b..356a308fce6 100644 --- a/src/buffer.c +++ b/src/buffer.c | |||
| @@ -550,11 +550,11 @@ even if it is dead. The return value is never nil. */) | |||
| 550 | b->indirections = 0; | 550 | b->indirections = 0; |
| 551 | 551 | ||
| 552 | BUF_GAP_SIZE (b) = 20; | 552 | BUF_GAP_SIZE (b) = 20; |
| 553 | BLOCK_INPUT; | 553 | block_input (); |
| 554 | /* We allocate extra 1-byte at the tail and keep it always '\0' for | 554 | /* We allocate extra 1-byte at the tail and keep it always '\0' for |
| 555 | anchoring a search. */ | 555 | anchoring a search. */ |
| 556 | alloc_buffer_text (b, BUF_GAP_SIZE (b) + 1); | 556 | alloc_buffer_text (b, BUF_GAP_SIZE (b) + 1); |
| 557 | UNBLOCK_INPUT; | 557 | unblock_input (); |
| 558 | if (! BUF_BEG_ADDR (b)) | 558 | if (! BUF_BEG_ADDR (b)) |
| 559 | buffer_memory_full (BUF_GAP_SIZE (b) + 1); | 559 | buffer_memory_full (BUF_GAP_SIZE (b) + 1); |
| 560 | 560 | ||
| @@ -1923,7 +1923,7 @@ cleaning up all windows currently displaying the buffer to be killed. */) | |||
| 1923 | 1923 | ||
| 1924 | bset_name (b, Qnil); | 1924 | bset_name (b, Qnil); |
| 1925 | 1925 | ||
| 1926 | BLOCK_INPUT; | 1926 | block_input (); |
| 1927 | if (b->base_buffer) | 1927 | if (b->base_buffer) |
| 1928 | { | 1928 | { |
| 1929 | /* Notify our base buffer that we don't share the text anymore. */ | 1929 | /* Notify our base buffer that we don't share the text anymore. */ |
| @@ -1946,7 +1946,7 @@ cleaning up all windows currently displaying the buffer to be killed. */) | |||
| 1946 | b->width_run_cache = 0; | 1946 | b->width_run_cache = 0; |
| 1947 | } | 1947 | } |
| 1948 | bset_width_table (b, Qnil); | 1948 | bset_width_table (b, Qnil); |
| 1949 | UNBLOCK_INPUT; | 1949 | unblock_input (); |
| 1950 | bset_undo_list (b, Qnil); | 1950 | bset_undo_list (b, Qnil); |
| 1951 | 1951 | ||
| 1952 | /* Run buffer-list-update-hook. */ | 1952 | /* Run buffer-list-update-hook. */ |
| @@ -5032,7 +5032,7 @@ alloc_buffer_text (struct buffer *b, ptrdiff_t nbytes) | |||
| 5032 | { | 5032 | { |
| 5033 | void *p; | 5033 | void *p; |
| 5034 | 5034 | ||
| 5035 | BLOCK_INPUT; | 5035 | block_input (); |
| 5036 | #if defined USE_MMAP_FOR_BUFFERS | 5036 | #if defined USE_MMAP_FOR_BUFFERS |
| 5037 | p = mmap_alloc ((void **) &b->text->beg, nbytes); | 5037 | p = mmap_alloc ((void **) &b->text->beg, nbytes); |
| 5038 | #elif defined REL_ALLOC | 5038 | #elif defined REL_ALLOC |
| @@ -5043,12 +5043,12 @@ alloc_buffer_text (struct buffer *b, ptrdiff_t nbytes) | |||
| 5043 | 5043 | ||
| 5044 | if (p == NULL) | 5044 | if (p == NULL) |
| 5045 | { | 5045 | { |
| 5046 | UNBLOCK_INPUT; | 5046 | unblock_input (); |
| 5047 | memory_full (nbytes); | 5047 | memory_full (nbytes); |
| 5048 | } | 5048 | } |
| 5049 | 5049 | ||
| 5050 | b->text->beg = (unsigned char *) p; | 5050 | b->text->beg = (unsigned char *) p; |
| 5051 | UNBLOCK_INPUT; | 5051 | unblock_input (); |
| 5052 | } | 5052 | } |
| 5053 | 5053 | ||
| 5054 | /* Enlarge buffer B's text buffer by DELTA bytes. DELTA < 0 means | 5054 | /* Enlarge buffer B's text buffer by DELTA bytes. DELTA < 0 means |
| @@ -5060,7 +5060,7 @@ enlarge_buffer_text (struct buffer *b, ptrdiff_t delta) | |||
| 5060 | void *p; | 5060 | void *p; |
| 5061 | ptrdiff_t nbytes = (BUF_Z_BYTE (b) - BUF_BEG_BYTE (b) + BUF_GAP_SIZE (b) + 1 | 5061 | ptrdiff_t nbytes = (BUF_Z_BYTE (b) - BUF_BEG_BYTE (b) + BUF_GAP_SIZE (b) + 1 |
| 5062 | + delta); | 5062 | + delta); |
| 5063 | BLOCK_INPUT; | 5063 | block_input (); |
| 5064 | #if defined USE_MMAP_FOR_BUFFERS | 5064 | #if defined USE_MMAP_FOR_BUFFERS |
| 5065 | p = mmap_realloc ((void **) &b->text->beg, nbytes); | 5065 | p = mmap_realloc ((void **) &b->text->beg, nbytes); |
| 5066 | #elif defined REL_ALLOC | 5066 | #elif defined REL_ALLOC |
| @@ -5071,12 +5071,12 @@ enlarge_buffer_text (struct buffer *b, ptrdiff_t delta) | |||
| 5071 | 5071 | ||
| 5072 | if (p == NULL) | 5072 | if (p == NULL) |
| 5073 | { | 5073 | { |
| 5074 | UNBLOCK_INPUT; | 5074 | unblock_input (); |
| 5075 | memory_full (nbytes); | 5075 | memory_full (nbytes); |
| 5076 | } | 5076 | } |
| 5077 | 5077 | ||
| 5078 | BUF_BEG_ADDR (b) = (unsigned char *) p; | 5078 | BUF_BEG_ADDR (b) = (unsigned char *) p; |
| 5079 | UNBLOCK_INPUT; | 5079 | unblock_input (); |
| 5080 | } | 5080 | } |
| 5081 | 5081 | ||
| 5082 | 5082 | ||
| @@ -5085,7 +5085,7 @@ enlarge_buffer_text (struct buffer *b, ptrdiff_t delta) | |||
| 5085 | static void | 5085 | static void |
| 5086 | free_buffer_text (struct buffer *b) | 5086 | free_buffer_text (struct buffer *b) |
| 5087 | { | 5087 | { |
| 5088 | BLOCK_INPUT; | 5088 | block_input (); |
| 5089 | 5089 | ||
| 5090 | #if defined USE_MMAP_FOR_BUFFERS | 5090 | #if defined USE_MMAP_FOR_BUFFERS |
| 5091 | mmap_free ((void **) &b->text->beg); | 5091 | mmap_free ((void **) &b->text->beg); |
| @@ -5096,7 +5096,7 @@ free_buffer_text (struct buffer *b) | |||
| 5096 | #endif | 5096 | #endif |
| 5097 | 5097 | ||
| 5098 | BUF_BEG_ADDR (b) = NULL; | 5098 | BUF_BEG_ADDR (b) = NULL; |
| 5099 | UNBLOCK_INPUT; | 5099 | unblock_input (); |
| 5100 | } | 5100 | } |
| 5101 | 5101 | ||
| 5102 | 5102 | ||
diff --git a/src/callproc.c b/src/callproc.c index 2604d295f3e..fc3eb943433 100644 --- a/src/callproc.c +++ b/src/callproc.c | |||
| @@ -582,7 +582,7 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */) | |||
| 582 | 0, current_dir); | 582 | 0, current_dir); |
| 583 | #else /* not WINDOWSNT */ | 583 | #else /* not WINDOWSNT */ |
| 584 | 584 | ||
| 585 | BLOCK_INPUT; | 585 | block_input (); |
| 586 | 586 | ||
| 587 | /* vfork, and prevent local vars from being clobbered by the vfork. */ | 587 | /* vfork, and prevent local vars from being clobbered by the vfork. */ |
| 588 | { | 588 | { |
| @@ -626,15 +626,14 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */) | |||
| 626 | setpgrp (pid, pid); | 626 | setpgrp (pid, pid); |
| 627 | #endif /* USG */ | 627 | #endif /* USG */ |
| 628 | 628 | ||
| 629 | /* GConf causes us to ignore SIGPIPE, make sure it is restored | 629 | /* Emacs ignores SIGPIPE, but the child should not. */ |
| 630 | in the child. */ | ||
| 631 | signal (SIGPIPE, SIG_DFL); | 630 | signal (SIGPIPE, SIG_DFL); |
| 632 | 631 | ||
| 633 | child_setup (filefd, fd1, fd_error, (char **) new_argv, | 632 | child_setup (filefd, fd1, fd_error, (char **) new_argv, |
| 634 | 0, current_dir); | 633 | 0, current_dir); |
| 635 | } | 634 | } |
| 636 | 635 | ||
| 637 | UNBLOCK_INPUT; | 636 | unblock_input (); |
| 638 | 637 | ||
| 639 | #endif /* not WINDOWSNT */ | 638 | #endif /* not WINDOWSNT */ |
| 640 | 639 | ||
| @@ -976,9 +975,9 @@ usage: (call-process-region START END PROGRAM &optional DELETE BUFFER DISPLAY &r | |||
| 976 | { | 975 | { |
| 977 | int fd; | 976 | int fd; |
| 978 | 977 | ||
| 979 | BLOCK_INPUT; | 978 | block_input (); |
| 980 | fd = mkstemp (tempfile); | 979 | fd = mkstemp (tempfile); |
| 981 | UNBLOCK_INPUT; | 980 | unblock_input (); |
| 982 | if (fd == -1) | 981 | if (fd == -1) |
| 983 | report_file_error ("Failed to open temporary file", | 982 | report_file_error ("Failed to open temporary file", |
| 984 | Fcons (build_string (tempfile), Qnil)); | 983 | Fcons (build_string (tempfile), Qnil)); |
diff --git a/src/data.c b/src/data.c index 72d7c8ccf9a..abcdd4dca0d 100644 --- a/src/data.c +++ b/src/data.c | |||
| @@ -34,14 +34,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 34 | #include "font.h" | 34 | #include "font.h" |
| 35 | #include "keymap.h" | 35 | #include "keymap.h" |
| 36 | 36 | ||
| 37 | #include <float.h> | ||
| 38 | #if (FLT_RADIX == 2 && FLT_MANT_DIG == 24 \ | ||
| 39 | && FLT_MIN_EXP == -125 && FLT_MAX_EXP == 128) | ||
| 40 | #define IEEE_FLOATING_POINT 1 | ||
| 41 | #else | ||
| 42 | #define IEEE_FLOATING_POINT 0 | ||
| 43 | #endif | ||
| 44 | |||
| 45 | Lisp_Object Qnil, Qt, Qquote, Qlambda, Qunbound; | 37 | Lisp_Object Qnil, Qt, Qquote, Qlambda, Qunbound; |
| 46 | static Lisp_Object Qsubr; | 38 | static Lisp_Object Qsubr; |
| 47 | Lisp_Object Qerror_conditions, Qerror_message, Qtop_level; | 39 | Lisp_Object Qerror_conditions, Qerror_message, Qtop_level; |
| @@ -3179,32 +3171,3 @@ syms_of_data (void) | |||
| 3179 | Vmost_negative_fixnum = make_number (MOST_NEGATIVE_FIXNUM); | 3171 | Vmost_negative_fixnum = make_number (MOST_NEGATIVE_FIXNUM); |
| 3180 | XSYMBOL (intern_c_string ("most-negative-fixnum"))->constant = 1; | 3172 | XSYMBOL (intern_c_string ("most-negative-fixnum"))->constant = 1; |
| 3181 | } | 3173 | } |
| 3182 | |||
| 3183 | static _Noreturn void | ||
| 3184 | handle_arith_signal (int sig) | ||
| 3185 | { | ||
| 3186 | pthread_sigmask (SIG_SETMASK, &empty_mask, 0); | ||
| 3187 | xsignal0 (Qarith_error); | ||
| 3188 | } | ||
| 3189 | |||
| 3190 | static void | ||
| 3191 | deliver_arith_signal (int sig) | ||
| 3192 | { | ||
| 3193 | handle_on_main_thread (sig, handle_arith_signal); | ||
| 3194 | } | ||
| 3195 | |||
| 3196 | void | ||
| 3197 | init_data (void) | ||
| 3198 | { | ||
| 3199 | struct sigaction action; | ||
| 3200 | /* Don't do this if just dumping out. | ||
| 3201 | We don't want to call `signal' in this case | ||
| 3202 | so that we don't have trouble with dumping | ||
| 3203 | signal-delivering routines in an inconsistent state. */ | ||
| 3204 | #ifndef CANNOT_DUMP | ||
| 3205 | if (!initialized) | ||
| 3206 | return; | ||
| 3207 | #endif /* CANNOT_DUMP */ | ||
| 3208 | emacs_sigaction_init (&action, deliver_arith_signal); | ||
| 3209 | sigaction (SIGFPE, &action, 0); | ||
| 3210 | } | ||
diff --git a/src/dired.c b/src/dired.c index 3aa27ecf920..4986f845101 100644 --- a/src/dired.c +++ b/src/dired.c | |||
| @@ -101,9 +101,9 @@ static Lisp_Object | |||
| 101 | directory_files_internal_unwind (Lisp_Object dh) | 101 | directory_files_internal_unwind (Lisp_Object dh) |
| 102 | { | 102 | { |
| 103 | DIR *d = (DIR *) XSAVE_VALUE (dh)->pointer; | 103 | DIR *d = (DIR *) XSAVE_VALUE (dh)->pointer; |
| 104 | BLOCK_INPUT; | 104 | block_input (); |
| 105 | closedir (d); | 105 | closedir (d); |
| 106 | UNBLOCK_INPUT; | 106 | unblock_input (); |
| 107 | return Qnil; | 107 | return Qnil; |
| 108 | } | 108 | } |
| 109 | 109 | ||
| @@ -164,9 +164,9 @@ directory_files_internal (Lisp_Object directory, Lisp_Object full, | |||
| 164 | /* Now *bufp is the compiled form of MATCH; don't call anything | 164 | /* Now *bufp is the compiled form of MATCH; don't call anything |
| 165 | which might compile a new regexp until we're done with the loop! */ | 165 | which might compile a new regexp until we're done with the loop! */ |
| 166 | 166 | ||
| 167 | BLOCK_INPUT; | 167 | block_input (); |
| 168 | d = opendir (SSDATA (dirfilename)); | 168 | d = opendir (SSDATA (dirfilename)); |
| 169 | UNBLOCK_INPUT; | 169 | unblock_input (); |
| 170 | if (d == NULL) | 170 | if (d == NULL) |
| 171 | report_file_error ("Opening directory", Fcons (directory, Qnil)); | 171 | report_file_error ("Opening directory", Fcons (directory, Qnil)); |
| 172 | 172 | ||
| @@ -310,9 +310,9 @@ directory_files_internal (Lisp_Object directory, Lisp_Object full, | |||
| 310 | } | 310 | } |
| 311 | } | 311 | } |
| 312 | 312 | ||
| 313 | BLOCK_INPUT; | 313 | block_input (); |
| 314 | closedir (d); | 314 | closedir (d); |
| 315 | UNBLOCK_INPUT; | 315 | unblock_input (); |
| 316 | #ifdef WINDOWSNT | 316 | #ifdef WINDOWSNT |
| 317 | if (attrs) | 317 | if (attrs) |
| 318 | Vw32_get_true_file_attributes = w32_save; | 318 | Vw32_get_true_file_attributes = w32_save; |
| @@ -486,9 +486,9 @@ file_name_completion (Lisp_Object file, Lisp_Object dirname, bool all_flag, | |||
| 486 | 486 | ||
| 487 | encoded_dir = ENCODE_FILE (dirname); | 487 | encoded_dir = ENCODE_FILE (dirname); |
| 488 | 488 | ||
| 489 | BLOCK_INPUT; | 489 | block_input (); |
| 490 | d = opendir (SSDATA (Fdirectory_file_name (encoded_dir))); | 490 | d = opendir (SSDATA (Fdirectory_file_name (encoded_dir))); |
| 491 | UNBLOCK_INPUT; | 491 | unblock_input (); |
| 492 | if (!d) | 492 | if (!d) |
| 493 | report_file_error ("Opening directory", Fcons (dirname, Qnil)); | 493 | report_file_error ("Opening directory", Fcons (dirname, Qnil)); |
| 494 | 494 | ||
| @@ -962,10 +962,10 @@ so last access time will always be midnight of that day. */) | |||
| 962 | 962 | ||
| 963 | if (!(NILP (id_format) || EQ (id_format, Qinteger))) | 963 | if (!(NILP (id_format) || EQ (id_format, Qinteger))) |
| 964 | { | 964 | { |
| 965 | BLOCK_INPUT; | 965 | block_input (); |
| 966 | uname = stat_uname (&s); | 966 | uname = stat_uname (&s); |
| 967 | gname = stat_gname (&s); | 967 | gname = stat_gname (&s); |
| 968 | UNBLOCK_INPUT; | 968 | unblock_input (); |
| 969 | } | 969 | } |
| 970 | if (uname) | 970 | if (uname) |
| 971 | values[2] = DECODE_SYSTEM (build_string (uname)); | 971 | values[2] = DECODE_SYSTEM (build_string (uname)); |
diff --git a/src/dispnew.c b/src/dispnew.c index fc966581adb..555136d785c 100644 --- a/src/dispnew.c +++ b/src/dispnew.c | |||
| @@ -1834,7 +1834,7 @@ adjust_glyphs (struct frame *f) | |||
| 1834 | { | 1834 | { |
| 1835 | /* Block input so that expose events and other events that access | 1835 | /* Block input so that expose events and other events that access |
| 1836 | glyph matrices are not processed while we are changing them. */ | 1836 | glyph matrices are not processed while we are changing them. */ |
| 1837 | BLOCK_INPUT; | 1837 | block_input (); |
| 1838 | 1838 | ||
| 1839 | if (f) | 1839 | if (f) |
| 1840 | adjust_frame_glyphs (f); | 1840 | adjust_frame_glyphs (f); |
| @@ -1846,7 +1846,7 @@ adjust_glyphs (struct frame *f) | |||
| 1846 | adjust_frame_glyphs (XFRAME (lisp_frame)); | 1846 | adjust_frame_glyphs (XFRAME (lisp_frame)); |
| 1847 | } | 1847 | } |
| 1848 | 1848 | ||
| 1849 | UNBLOCK_INPUT; | 1849 | unblock_input (); |
| 1850 | } | 1850 | } |
| 1851 | 1851 | ||
| 1852 | 1852 | ||
| @@ -2242,7 +2242,7 @@ free_glyphs (struct frame *f) | |||
| 2242 | { | 2242 | { |
| 2243 | /* Block interrupt input so that we don't get surprised by an X | 2243 | /* Block interrupt input so that we don't get surprised by an X |
| 2244 | event while we're in an inconsistent state. */ | 2244 | event while we're in an inconsistent state. */ |
| 2245 | BLOCK_INPUT; | 2245 | block_input (); |
| 2246 | f->glyphs_initialized_p = 0; | 2246 | f->glyphs_initialized_p = 0; |
| 2247 | 2247 | ||
| 2248 | /* Release window sub-matrices. */ | 2248 | /* Release window sub-matrices. */ |
| @@ -2287,7 +2287,7 @@ free_glyphs (struct frame *f) | |||
| 2287 | f->desired_pool = f->current_pool = NULL; | 2287 | f->desired_pool = f->current_pool = NULL; |
| 2288 | } | 2288 | } |
| 2289 | 2289 | ||
| 2290 | UNBLOCK_INPUT; | 2290 | unblock_input (); |
| 2291 | } | 2291 | } |
| 2292 | } | 2292 | } |
| 2293 | 2293 | ||
| @@ -5563,10 +5563,6 @@ handle_window_change_signal (int sig) | |||
| 5563 | int width, height; | 5563 | int width, height; |
| 5564 | struct tty_display_info *tty; | 5564 | struct tty_display_info *tty; |
| 5565 | 5565 | ||
| 5566 | struct sigaction action; | ||
| 5567 | emacs_sigaction_init (&action, deliver_window_change_signal); | ||
| 5568 | sigaction (SIGWINCH, &action, 0); | ||
| 5569 | |||
| 5570 | /* The frame size change obviously applies to a single | 5566 | /* The frame size change obviously applies to a single |
| 5571 | termcap-controlled terminal, but we can't decide which. | 5567 | termcap-controlled terminal, but we can't decide which. |
| 5572 | Therefore, we resize the frames corresponding to each tty. | 5568 | Therefore, we resize the frames corresponding to each tty. |
| @@ -5599,7 +5595,7 @@ handle_window_change_signal (int sig) | |||
| 5599 | static void | 5595 | static void |
| 5600 | deliver_window_change_signal (int sig) | 5596 | deliver_window_change_signal (int sig) |
| 5601 | { | 5597 | { |
| 5602 | handle_on_main_thread (sig, handle_window_change_signal); | 5598 | deliver_process_signal (sig, handle_window_change_signal); |
| 5603 | } | 5599 | } |
| 5604 | #endif /* SIGWINCH */ | 5600 | #endif /* SIGWINCH */ |
| 5605 | 5601 | ||
| @@ -5708,7 +5704,7 @@ change_frame_size_1 (struct frame *f, int newheight, int newwidth, | |||
| 5708 | && new_frame_total_cols == FRAME_TOTAL_COLS (f)) | 5704 | && new_frame_total_cols == FRAME_TOTAL_COLS (f)) |
| 5709 | return; | 5705 | return; |
| 5710 | 5706 | ||
| 5711 | BLOCK_INPUT; | 5707 | block_input (); |
| 5712 | 5708 | ||
| 5713 | #ifdef MSDOS | 5709 | #ifdef MSDOS |
| 5714 | /* We only can set screen dimensions to certain values supported | 5710 | /* We only can set screen dimensions to certain values supported |
| @@ -5760,7 +5756,7 @@ change_frame_size_1 (struct frame *f, int newheight, int newwidth, | |||
| 5760 | SET_FRAME_GARBAGED (f); | 5756 | SET_FRAME_GARBAGED (f); |
| 5761 | f->resized_p = 1; | 5757 | f->resized_p = 1; |
| 5762 | 5758 | ||
| 5763 | UNBLOCK_INPUT; | 5759 | unblock_input (); |
| 5764 | 5760 | ||
| 5765 | record_unwind_current_buffer (); | 5761 | record_unwind_current_buffer (); |
| 5766 | 5762 | ||
| @@ -5791,9 +5787,9 @@ FILE = nil means just close any termscript file currently open. */) | |||
| 5791 | 5787 | ||
| 5792 | if (tty->termscript != 0) | 5788 | if (tty->termscript != 0) |
| 5793 | { | 5789 | { |
| 5794 | BLOCK_INPUT; | 5790 | block_input (); |
| 5795 | fclose (tty->termscript); | 5791 | fclose (tty->termscript); |
| 5796 | UNBLOCK_INPUT; | 5792 | unblock_input (); |
| 5797 | } | 5793 | } |
| 5798 | tty->termscript = 0; | 5794 | tty->termscript = 0; |
| 5799 | 5795 | ||
| @@ -5824,7 +5820,7 @@ when TERMINAL is nil. */) | |||
| 5824 | 5820 | ||
| 5825 | /* ??? Perhaps we should do something special for multibyte strings here. */ | 5821 | /* ??? Perhaps we should do something special for multibyte strings here. */ |
| 5826 | CHECK_STRING (string); | 5822 | CHECK_STRING (string); |
| 5827 | BLOCK_INPUT; | 5823 | block_input (); |
| 5828 | 5824 | ||
| 5829 | if (!t) | 5825 | if (!t) |
| 5830 | error ("Unknown terminal device"); | 5826 | error ("Unknown terminal device"); |
| @@ -5849,7 +5845,7 @@ when TERMINAL is nil. */) | |||
| 5849 | } | 5845 | } |
| 5850 | fwrite (SDATA (string), 1, SBYTES (string), out); | 5846 | fwrite (SDATA (string), 1, SBYTES (string), out); |
| 5851 | fflush (out); | 5847 | fflush (out); |
| 5852 | UNBLOCK_INPUT; | 5848 | unblock_input (); |
| 5853 | return Qnil; | 5849 | return Qnil; |
| 5854 | } | 5850 | } |
| 5855 | 5851 | ||
diff --git a/src/dosfns.c b/src/dosfns.c index 3c649f4d534..ce1ec4a4f93 100644 --- a/src/dosfns.c +++ b/src/dosfns.c | |||
| @@ -480,9 +480,9 @@ x_set_title (struct frame *f, Lisp_Object name) | |||
| 480 | 480 | ||
| 481 | if (FRAME_MSDOS_P (f)) | 481 | if (FRAME_MSDOS_P (f)) |
| 482 | { | 482 | { |
| 483 | BLOCK_INPUT; | 483 | block_input (); |
| 484 | w95_set_virtual_machine_title (SDATA (name)); | 484 | w95_set_virtual_machine_title (SDATA (name)); |
| 485 | UNBLOCK_INPUT; | 485 | unblock_input (); |
| 486 | } | 486 | } |
| 487 | } | 487 | } |
| 488 | #endif /* !HAVE_X_WINDOWS */ | 488 | #endif /* !HAVE_X_WINDOWS */ |
diff --git a/src/editfns.c b/src/editfns.c index acf9c48e7a0..fc6465a3d46 100644 --- a/src/editfns.c +++ b/src/editfns.c | |||
| @@ -1219,9 +1219,9 @@ of the user with that uid, or nil if there is no such user. */) | |||
| 1219 | return Vuser_login_name; | 1219 | return Vuser_login_name; |
| 1220 | 1220 | ||
| 1221 | CONS_TO_INTEGER (uid, uid_t, id); | 1221 | CONS_TO_INTEGER (uid, uid_t, id); |
| 1222 | BLOCK_INPUT; | 1222 | block_input (); |
| 1223 | pw = getpwuid (id); | 1223 | pw = getpwuid (id); |
| 1224 | UNBLOCK_INPUT; | 1224 | unblock_input (); |
| 1225 | return (pw ? build_string (pw->pw_name) : Qnil); | 1225 | return (pw ? build_string (pw->pw_name) : Qnil); |
| 1226 | } | 1226 | } |
| 1227 | 1227 | ||
| @@ -1279,15 +1279,15 @@ name, or nil if there is no such user. */) | |||
| 1279 | { | 1279 | { |
| 1280 | uid_t u; | 1280 | uid_t u; |
| 1281 | CONS_TO_INTEGER (uid, uid_t, u); | 1281 | CONS_TO_INTEGER (uid, uid_t, u); |
| 1282 | BLOCK_INPUT; | 1282 | block_input (); |
| 1283 | pw = getpwuid (u); | 1283 | pw = getpwuid (u); |
| 1284 | UNBLOCK_INPUT; | 1284 | unblock_input (); |
| 1285 | } | 1285 | } |
| 1286 | else if (STRINGP (uid)) | 1286 | else if (STRINGP (uid)) |
| 1287 | { | 1287 | { |
| 1288 | BLOCK_INPUT; | 1288 | block_input (); |
| 1289 | pw = getpwnam (SSDATA (uid)); | 1289 | pw = getpwnam (SSDATA (uid)); |
| 1290 | UNBLOCK_INPUT; | 1290 | unblock_input (); |
| 1291 | } | 1291 | } |
| 1292 | else | 1292 | else |
| 1293 | error ("Invalid UID specification"); | 1293 | error ("Invalid UID specification"); |
| @@ -1763,14 +1763,14 @@ format_time_string (char const *format, ptrdiff_t formatlen, | |||
| 1763 | while (1) | 1763 | while (1) |
| 1764 | { | 1764 | { |
| 1765 | time_t *taddr = emacs_secs_addr (&t); | 1765 | time_t *taddr = emacs_secs_addr (&t); |
| 1766 | BLOCK_INPUT; | 1766 | block_input (); |
| 1767 | 1767 | ||
| 1768 | synchronize_system_time_locale (); | 1768 | synchronize_system_time_locale (); |
| 1769 | 1769 | ||
| 1770 | tm = ut ? gmtime (taddr) : localtime (taddr); | 1770 | tm = ut ? gmtime (taddr) : localtime (taddr); |
| 1771 | if (! tm) | 1771 | if (! tm) |
| 1772 | { | 1772 | { |
| 1773 | UNBLOCK_INPUT; | 1773 | unblock_input (); |
| 1774 | time_overflow (); | 1774 | time_overflow (); |
| 1775 | } | 1775 | } |
| 1776 | *tmp = *tm; | 1776 | *tmp = *tm; |
| @@ -1782,14 +1782,14 @@ format_time_string (char const *format, ptrdiff_t formatlen, | |||
| 1782 | 1782 | ||
| 1783 | /* Buffer was too small, so make it bigger and try again. */ | 1783 | /* Buffer was too small, so make it bigger and try again. */ |
| 1784 | len = emacs_nmemftime (NULL, SIZE_MAX, format, formatlen, tm, ut, ns); | 1784 | len = emacs_nmemftime (NULL, SIZE_MAX, format, formatlen, tm, ut, ns); |
| 1785 | UNBLOCK_INPUT; | 1785 | unblock_input (); |
| 1786 | if (STRING_BYTES_BOUND <= len) | 1786 | if (STRING_BYTES_BOUND <= len) |
| 1787 | string_overflow (); | 1787 | string_overflow (); |
| 1788 | size = len + 1; | 1788 | size = len + 1; |
| 1789 | buf = SAFE_ALLOCA (size); | 1789 | buf = SAFE_ALLOCA (size); |
| 1790 | } | 1790 | } |
| 1791 | 1791 | ||
| 1792 | UNBLOCK_INPUT; | 1792 | unblock_input (); |
| 1793 | bufstring = make_unibyte_string (buf, len); | 1793 | bufstring = make_unibyte_string (buf, len); |
| 1794 | SAFE_FREE (); | 1794 | SAFE_FREE (); |
| 1795 | return code_convert_string_norecord (bufstring, Vlocale_coding_system, 0); | 1795 | return code_convert_string_norecord (bufstring, Vlocale_coding_system, 0); |
| @@ -1817,11 +1817,11 @@ DOW and ZONE.) */) | |||
| 1817 | struct tm *decoded_time; | 1817 | struct tm *decoded_time; |
| 1818 | Lisp_Object list_args[9]; | 1818 | Lisp_Object list_args[9]; |
| 1819 | 1819 | ||
| 1820 | BLOCK_INPUT; | 1820 | block_input (); |
| 1821 | decoded_time = localtime (&time_spec); | 1821 | decoded_time = localtime (&time_spec); |
| 1822 | if (decoded_time) | 1822 | if (decoded_time) |
| 1823 | save_tm = *decoded_time; | 1823 | save_tm = *decoded_time; |
| 1824 | UNBLOCK_INPUT; | 1824 | unblock_input (); |
| 1825 | if (! (decoded_time | 1825 | if (! (decoded_time |
| 1826 | && MOST_NEGATIVE_FIXNUM - TM_YEAR_BASE <= save_tm.tm_year | 1826 | && MOST_NEGATIVE_FIXNUM - TM_YEAR_BASE <= save_tm.tm_year |
| 1827 | && save_tm.tm_year <= MOST_POSITIVE_FIXNUM - TM_YEAR_BASE)) | 1827 | && save_tm.tm_year <= MOST_POSITIVE_FIXNUM - TM_YEAR_BASE)) |
| @@ -1837,13 +1837,13 @@ DOW and ZONE.) */) | |||
| 1837 | XSETFASTINT (list_args[6], save_tm.tm_wday); | 1837 | XSETFASTINT (list_args[6], save_tm.tm_wday); |
| 1838 | list_args[7] = save_tm.tm_isdst ? Qt : Qnil; | 1838 | list_args[7] = save_tm.tm_isdst ? Qt : Qnil; |
| 1839 | 1839 | ||
| 1840 | BLOCK_INPUT; | 1840 | block_input (); |
| 1841 | decoded_time = gmtime (&time_spec); | 1841 | decoded_time = gmtime (&time_spec); |
| 1842 | if (decoded_time == 0) | 1842 | if (decoded_time == 0) |
| 1843 | list_args[8] = Qnil; | 1843 | list_args[8] = Qnil; |
| 1844 | else | 1844 | else |
| 1845 | XSETINT (list_args[8], tm_diff (&save_tm, decoded_time)); | 1845 | XSETINT (list_args[8], tm_diff (&save_tm, decoded_time)); |
| 1846 | UNBLOCK_INPUT; | 1846 | unblock_input (); |
| 1847 | return Flist (9, list_args); | 1847 | return Flist (9, list_args); |
| 1848 | } | 1848 | } |
| 1849 | 1849 | ||
| @@ -1901,9 +1901,9 @@ usage: (encode-time SECOND MINUTE HOUR DAY MONTH YEAR &optional ZONE) */) | |||
| 1901 | zone = XCAR (zone); | 1901 | zone = XCAR (zone); |
| 1902 | if (NILP (zone)) | 1902 | if (NILP (zone)) |
| 1903 | { | 1903 | { |
| 1904 | BLOCK_INPUT; | 1904 | block_input (); |
| 1905 | value = mktime (&tm); | 1905 | value = mktime (&tm); |
| 1906 | UNBLOCK_INPUT; | 1906 | unblock_input (); |
| 1907 | } | 1907 | } |
| 1908 | else | 1908 | else |
| 1909 | { | 1909 | { |
| @@ -1928,7 +1928,7 @@ usage: (encode-time SECOND MINUTE HOUR DAY MONTH YEAR &optional ZONE) */) | |||
| 1928 | else | 1928 | else |
| 1929 | error ("Invalid time zone specification"); | 1929 | error ("Invalid time zone specification"); |
| 1930 | 1930 | ||
| 1931 | BLOCK_INPUT; | 1931 | block_input (); |
| 1932 | 1932 | ||
| 1933 | /* Set TZ before calling mktime; merely adjusting mktime's returned | 1933 | /* Set TZ before calling mktime; merely adjusting mktime's returned |
| 1934 | value doesn't suffice, since that would mishandle leap seconds. */ | 1934 | value doesn't suffice, since that would mishandle leap seconds. */ |
| @@ -1942,7 +1942,7 @@ usage: (encode-time SECOND MINUTE HOUR DAY MONTH YEAR &optional ZONE) */) | |||
| 1942 | #ifdef LOCALTIME_CACHE | 1942 | #ifdef LOCALTIME_CACHE |
| 1943 | tzset (); | 1943 | tzset (); |
| 1944 | #endif | 1944 | #endif |
| 1945 | UNBLOCK_INPUT; | 1945 | unblock_input (); |
| 1946 | 1946 | ||
| 1947 | xfree (newenv); | 1947 | xfree (newenv); |
| 1948 | } | 1948 | } |
| @@ -1978,7 +1978,7 @@ but this is considered obsolete. */) | |||
| 1978 | newline, and without the 4-digit year limit. Don't use asctime | 1978 | newline, and without the 4-digit year limit. Don't use asctime |
| 1979 | or ctime, as they might dump core if the year is outside the | 1979 | or ctime, as they might dump core if the year is outside the |
| 1980 | range -999 .. 9999. */ | 1980 | range -999 .. 9999. */ |
| 1981 | BLOCK_INPUT; | 1981 | block_input (); |
| 1982 | tm = localtime (&value); | 1982 | tm = localtime (&value); |
| 1983 | if (tm) | 1983 | if (tm) |
| 1984 | { | 1984 | { |
| @@ -1994,7 +1994,7 @@ but this is considered obsolete. */) | |||
| 1994 | tm->tm_hour, tm->tm_min, tm->tm_sec, | 1994 | tm->tm_hour, tm->tm_min, tm->tm_sec, |
| 1995 | tm->tm_year + year_base); | 1995 | tm->tm_year + year_base); |
| 1996 | } | 1996 | } |
| 1997 | UNBLOCK_INPUT; | 1997 | unblock_input (); |
| 1998 | if (! tm) | 1998 | if (! tm) |
| 1999 | time_overflow (); | 1999 | time_overflow (); |
| 2000 | 2000 | ||
| @@ -2050,11 +2050,11 @@ the data it can't find. */) | |||
| 2050 | zone_offset = Qnil; | 2050 | zone_offset = Qnil; |
| 2051 | value = make_emacs_time (lisp_seconds_argument (specified_time), 0); | 2051 | value = make_emacs_time (lisp_seconds_argument (specified_time), 0); |
| 2052 | zone_name = format_time_string ("%Z", sizeof "%Z" - 1, value, 0, &localtm); | 2052 | zone_name = format_time_string ("%Z", sizeof "%Z" - 1, value, 0, &localtm); |
| 2053 | BLOCK_INPUT; | 2053 | block_input (); |
| 2054 | t = gmtime (emacs_secs_addr (&value)); | 2054 | t = gmtime (emacs_secs_addr (&value)); |
| 2055 | if (t) | 2055 | if (t) |
| 2056 | offset = tm_diff (&localtm, t); | 2056 | offset = tm_diff (&localtm, t); |
| 2057 | UNBLOCK_INPUT; | 2057 | unblock_input (); |
| 2058 | 2058 | ||
| 2059 | if (t) | 2059 | if (t) |
| 2060 | { | 2060 | { |
| @@ -2101,7 +2101,7 @@ only the former. */) | |||
| 2101 | if (! (NILP (tz) || EQ (tz, Qt))) | 2101 | if (! (NILP (tz) || EQ (tz, Qt))) |
| 2102 | CHECK_STRING (tz); | 2102 | CHECK_STRING (tz); |
| 2103 | 2103 | ||
| 2104 | BLOCK_INPUT; | 2104 | block_input (); |
| 2105 | 2105 | ||
| 2106 | /* When called for the first time, save the original TZ. */ | 2106 | /* When called for the first time, save the original TZ. */ |
| 2107 | old_environbuf = environbuf; | 2107 | old_environbuf = environbuf; |
| @@ -2118,7 +2118,7 @@ only the former. */) | |||
| 2118 | set_time_zone_rule (tzstring); | 2118 | set_time_zone_rule (tzstring); |
| 2119 | environbuf = environ; | 2119 | environbuf = environ; |
| 2120 | 2120 | ||
| 2121 | UNBLOCK_INPUT; | 2121 | unblock_input (); |
| 2122 | 2122 | ||
| 2123 | xfree (old_environbuf); | 2123 | xfree (old_environbuf); |
| 2124 | return Qnil; | 2124 | return Qnil; |
diff --git a/src/emacs.c b/src/emacs.c index 52f38925b32..eb83a0ae9a8 100644 --- a/src/emacs.c +++ b/src/emacs.c | |||
| @@ -54,6 +54,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 54 | #include "window.h" | 54 | #include "window.h" |
| 55 | 55 | ||
| 56 | #include "systty.h" | 56 | #include "systty.h" |
| 57 | #include "atimer.h" | ||
| 57 | #include "blockinput.h" | 58 | #include "blockinput.h" |
| 58 | #include "syssignal.h" | 59 | #include "syssignal.h" |
| 59 | #include "process.h" | 60 | #include "process.h" |
| @@ -269,9 +270,6 @@ Report bugs to bug-gnu-emacs@gnu.org. First, please see the Bugs\n\ | |||
| 269 | section of the Emacs manual or the file BUGS.\n" | 270 | section of the Emacs manual or the file BUGS.\n" |
| 270 | 271 | ||
| 271 | 272 | ||
| 272 | /* Signal code for the fatal signal that was received. */ | ||
| 273 | static int fatal_error_code; | ||
| 274 | |||
| 275 | /* True if handling a fatal error already. */ | 273 | /* True if handling a fatal error already. */ |
| 276 | bool fatal_error_in_progress; | 274 | bool fatal_error_in_progress; |
| 277 | 275 | ||
| @@ -282,28 +280,12 @@ static void *ns_pool; | |||
| 282 | 280 | ||
| 283 | 281 | ||
| 284 | 282 | ||
| 285 | /* Handle bus errors, invalid instruction, etc. */ | ||
| 286 | static void | ||
| 287 | handle_fatal_signal (int sig) | ||
| 288 | { | ||
| 289 | fatal_error_backtrace (sig, 10); | ||
| 290 | } | ||
| 291 | |||
| 292 | static void | ||
| 293 | deliver_fatal_signal (int sig) | ||
| 294 | { | ||
| 295 | handle_on_main_thread (sig, handle_fatal_signal); | ||
| 296 | } | ||
| 297 | |||
| 298 | /* Report a fatal error due to signal SIG, output a backtrace of at | 283 | /* Report a fatal error due to signal SIG, output a backtrace of at |
| 299 | most BACKTRACE_LIMIT lines, and exit. */ | 284 | most BACKTRACE_LIMIT lines, and exit. */ |
| 300 | _Noreturn void | 285 | _Noreturn void |
| 301 | fatal_error_backtrace (int sig, int backtrace_limit) | 286 | terminate_due_to_signal (int sig, int backtrace_limit) |
| 302 | { | 287 | { |
| 303 | fatal_error_code = sig; | 288 | totally_unblock_input (); |
| 304 | signal (sig, SIG_DFL); | ||
| 305 | |||
| 306 | TOTALLY_UNBLOCK_INPUT; | ||
| 307 | 289 | ||
| 308 | /* If fatal error occurs in code below, avoid infinite recursion. */ | 290 | /* If fatal error occurs in code below, avoid infinite recursion. */ |
| 309 | if (! fatal_error_in_progress) | 291 | if (! fatal_error_in_progress) |
| @@ -318,19 +300,18 @@ fatal_error_backtrace (int sig, int backtrace_limit) | |||
| 318 | } | 300 | } |
| 319 | 301 | ||
| 320 | /* Signal the same code; this time it will really be fatal. | 302 | /* Signal the same code; this time it will really be fatal. |
| 321 | Remember that since we're in a signal handler, the signal we're | 303 | Since we're in a signal handler, the signal is blocked, so we |
| 322 | going to send is probably blocked, so we have to unblock it if we | 304 | have to unblock it if we want to really receive it. */ |
| 323 | want to really receive it. */ | ||
| 324 | #ifndef MSDOS | 305 | #ifndef MSDOS |
| 325 | { | 306 | { |
| 326 | sigset_t unblocked; | 307 | sigset_t unblocked; |
| 327 | sigemptyset (&unblocked); | 308 | sigemptyset (&unblocked); |
| 328 | sigaddset (&unblocked, fatal_error_code); | 309 | sigaddset (&unblocked, sig); |
| 329 | pthread_sigmask (SIG_UNBLOCK, &unblocked, 0); | 310 | pthread_sigmask (SIG_UNBLOCK, &unblocked, 0); |
| 330 | } | 311 | } |
| 331 | #endif | 312 | #endif |
| 332 | 313 | ||
| 333 | kill (getpid (), fatal_error_code); | 314 | emacs_raise (sig); |
| 334 | 315 | ||
| 335 | /* This shouldn't be executed, but it prevents a warning. */ | 316 | /* This shouldn't be executed, but it prevents a warning. */ |
| 336 | exit (1); | 317 | exit (1); |
| @@ -339,15 +320,9 @@ fatal_error_backtrace (int sig, int backtrace_limit) | |||
| 339 | #ifdef SIGDANGER | 320 | #ifdef SIGDANGER |
| 340 | 321 | ||
| 341 | /* Handler for SIGDANGER. */ | 322 | /* Handler for SIGDANGER. */ |
| 342 | static void deliver_danger_signal (int); | ||
| 343 | |||
| 344 | static void | 323 | static void |
| 345 | handle_danger_signal (int sig) | 324 | handle_danger_signal (int sig) |
| 346 | { | 325 | { |
| 347 | struct sigaction action; | ||
| 348 | emacs_sigaction_init (&action, deliver_danger_signal); | ||
| 349 | sigaction (sig, &action, 0); | ||
| 350 | |||
| 351 | malloc_warning ("Operating system warns that virtual memory is running low.\n"); | 326 | malloc_warning ("Operating system warns that virtual memory is running low.\n"); |
| 352 | 327 | ||
| 353 | /* It might be unsafe to call do_auto_save now. */ | 328 | /* It might be unsafe to call do_auto_save now. */ |
| @@ -357,7 +332,7 @@ handle_danger_signal (int sig) | |||
| 357 | static void | 332 | static void |
| 358 | deliver_danger_signal (int sig) | 333 | deliver_danger_signal (int sig) |
| 359 | { | 334 | { |
| 360 | handle_on_main_thread (sig, handle_danger_signal); | 335 | deliver_process_signal (sig, handle_danger_signal); |
| 361 | } | 336 | } |
| 362 | #endif | 337 | #endif |
| 363 | 338 | ||
| @@ -680,6 +655,7 @@ main (int argc, char **argv) | |||
| 680 | #endif | 655 | #endif |
| 681 | char stack_bottom_variable; | 656 | char stack_bottom_variable; |
| 682 | bool do_initial_setlocale; | 657 | bool do_initial_setlocale; |
| 658 | bool dumping; | ||
| 683 | int skip_args = 0; | 659 | int skip_args = 0; |
| 684 | #ifdef HAVE_SETRLIMIT | 660 | #ifdef HAVE_SETRLIMIT |
| 685 | struct rlimit rlim; | 661 | struct rlimit rlim; |
| @@ -691,7 +667,6 @@ main (int argc, char **argv) | |||
| 691 | char dname_arg2[80]; | 667 | char dname_arg2[80]; |
| 692 | #endif | 668 | #endif |
| 693 | char *ch_to_dir; | 669 | char *ch_to_dir; |
| 694 | struct sigaction fatal_error_action; | ||
| 695 | 670 | ||
| 696 | #if GC_MARK_STACK | 671 | #if GC_MARK_STACK |
| 697 | stack_base = &dummy; | 672 | stack_base = &dummy; |
| @@ -777,12 +752,11 @@ main (int argc, char **argv) | |||
| 777 | exit (1); | 752 | exit (1); |
| 778 | } | 753 | } |
| 779 | 754 | ||
| 755 | dumping = !initialized && (strcmp (argv[argc - 1], "dump") == 0 | ||
| 756 | || strcmp (argv[argc - 1], "bootstrap") == 0); | ||
| 780 | 757 | ||
| 781 | #ifdef HAVE_PERSONALITY_LINUX32 | 758 | #ifdef HAVE_PERSONALITY_LINUX32 |
| 782 | if (!initialized | 759 | if (dumping && ! getenv ("EMACS_HEAP_EXEC")) |
| 783 | && (strcmp (argv[argc-1], "dump") == 0 | ||
| 784 | || strcmp (argv[argc-1], "bootstrap") == 0) | ||
| 785 | && ! getenv ("EMACS_HEAP_EXEC")) | ||
| 786 | { | 760 | { |
| 787 | static char heapexec[] = "EMACS_HEAP_EXEC=true"; | 761 | static char heapexec[] = "EMACS_HEAP_EXEC=true"; |
| 788 | /* Set this so we only do this once. */ | 762 | /* Set this so we only do this once. */ |
| @@ -1107,119 +1081,7 @@ Using an Emacs configured with --with-x-toolkit=lucid does not have this problem | |||
| 1107 | #endif | 1081 | #endif |
| 1108 | } | 1082 | } |
| 1109 | 1083 | ||
| 1110 | init_signals (); | 1084 | init_signals (dumping); |
| 1111 | emacs_sigaction_init (&fatal_error_action, deliver_fatal_signal); | ||
| 1112 | |||
| 1113 | /* Don't catch SIGHUP if dumping. */ | ||
| 1114 | if (1 | ||
| 1115 | #ifndef CANNOT_DUMP | ||
| 1116 | && initialized | ||
| 1117 | #endif | ||
| 1118 | ) | ||
| 1119 | { | ||
| 1120 | /* In --batch mode, don't catch SIGHUP if already ignored. | ||
| 1121 | That makes nohup work. */ | ||
| 1122 | bool catch_SIGHUP = !noninteractive; | ||
| 1123 | if (!catch_SIGHUP) | ||
| 1124 | { | ||
| 1125 | struct sigaction old_action; | ||
| 1126 | sigaction (SIGHUP, 0, &old_action); | ||
| 1127 | catch_SIGHUP = old_action.sa_handler != SIG_IGN; | ||
| 1128 | } | ||
| 1129 | if (catch_SIGHUP) | ||
| 1130 | sigaction (SIGHUP, &fatal_error_action, 0); | ||
| 1131 | } | ||
| 1132 | |||
| 1133 | if ( | ||
| 1134 | #ifndef CANNOT_DUMP | ||
| 1135 | ! noninteractive || initialized | ||
| 1136 | #else | ||
| 1137 | 1 | ||
| 1138 | #endif | ||
| 1139 | ) | ||
| 1140 | { | ||
| 1141 | /* Don't catch these signals in batch mode if dumping. | ||
| 1142 | On some machines, this sets static data that would make | ||
| 1143 | signal fail to work right when the dumped Emacs is run. */ | ||
| 1144 | sigaction (SIGQUIT, &fatal_error_action, 0); | ||
| 1145 | sigaction (SIGILL, &fatal_error_action, 0); | ||
| 1146 | sigaction (SIGTRAP, &fatal_error_action, 0); | ||
| 1147 | #ifdef SIGUSR1 | ||
| 1148 | add_user_signal (SIGUSR1, "sigusr1"); | ||
| 1149 | #endif | ||
| 1150 | #ifdef SIGUSR2 | ||
| 1151 | add_user_signal (SIGUSR2, "sigusr2"); | ||
| 1152 | #endif | ||
| 1153 | #ifdef SIGABRT | ||
| 1154 | sigaction (SIGABRT, &fatal_error_action, 0); | ||
| 1155 | #endif | ||
| 1156 | #ifdef SIGHWE | ||
| 1157 | sigaction (SIGHWE, &fatal_error_action, 0); | ||
| 1158 | #endif | ||
| 1159 | #ifdef SIGPRE | ||
| 1160 | sigaction (SIGPRE, &fatal_error_action, 0); | ||
| 1161 | #endif | ||
| 1162 | #ifdef SIGORE | ||
| 1163 | sigaction (SIGORE, &fatal_error_action, 0); | ||
| 1164 | #endif | ||
| 1165 | #ifdef SIGUME | ||
| 1166 | sigaction (SIGUME, &fatal_error_action, 0); | ||
| 1167 | #endif | ||
| 1168 | #ifdef SIGDLK | ||
| 1169 | sigaction (SIGDLK, &fatal_error_action, 0); | ||
| 1170 | #endif | ||
| 1171 | #ifdef SIGCPULIM | ||
| 1172 | sigaction (SIGCPULIM, &fatal_error_action, 0); | ||
| 1173 | #endif | ||
| 1174 | #ifdef SIGIOT | ||
| 1175 | /* This is missing on some systems - OS/2, for example. */ | ||
| 1176 | sigaction (SIGIOT, &fatal_error_action, 0); | ||
| 1177 | #endif | ||
| 1178 | #ifdef SIGEMT | ||
| 1179 | sigaction (SIGEMT, &fatal_error_action, 0); | ||
| 1180 | #endif | ||
| 1181 | sigaction (SIGFPE, &fatal_error_action, 0); | ||
| 1182 | #ifdef SIGBUS | ||
| 1183 | sigaction (SIGBUS, &fatal_error_action, 0); | ||
| 1184 | #endif | ||
| 1185 | sigaction (SIGSEGV, &fatal_error_action, 0); | ||
| 1186 | #ifdef SIGSYS | ||
| 1187 | sigaction (SIGSYS, &fatal_error_action, 0); | ||
| 1188 | #endif | ||
| 1189 | /* May need special treatment on MS-Windows. See | ||
| 1190 | http://lists.gnu.org/archive/html/emacs-devel/2010-09/msg01062.html | ||
| 1191 | Please update the doc of kill-emacs, kill-emacs-hook, and | ||
| 1192 | NEWS if you change this. | ||
| 1193 | */ | ||
| 1194 | if (noninteractive) | ||
| 1195 | sigaction (SIGINT, &fatal_error_action, 0); | ||
| 1196 | sigaction (SIGTERM, &fatal_error_action, 0); | ||
| 1197 | #ifdef SIGXCPU | ||
| 1198 | sigaction (SIGXCPU, &fatal_error_action, 0); | ||
| 1199 | #endif | ||
| 1200 | #ifdef SIGXFSZ | ||
| 1201 | sigaction (SIGXFSZ, &fatal_error_action, 0); | ||
| 1202 | #endif /* SIGXFSZ */ | ||
| 1203 | |||
| 1204 | #ifdef SIGDANGER | ||
| 1205 | /* This just means available memory is getting low. */ | ||
| 1206 | { | ||
| 1207 | struct sigaction action; | ||
| 1208 | emacs_sigaction_init (&action, deliver_danger_signal); | ||
| 1209 | sigaction (SIGDANGER, &action, 0); | ||
| 1210 | } | ||
| 1211 | #endif | ||
| 1212 | |||
| 1213 | #ifdef AIX | ||
| 1214 | /* 20 is SIGCHLD, 21 is SIGTTIN, 22 is SIGTTOU. */ | ||
| 1215 | sigaction (SIGXCPU, &fatal_error_action, 0); | ||
| 1216 | sigaction (SIGIOINT, &fatal_error_action, 0); | ||
| 1217 | sigaction (SIGGRANT, &fatal_error_action, 0); | ||
| 1218 | sigaction (SIGRETRACT, &fatal_error_action, 0); | ||
| 1219 | sigaction (SIGSOUND, &fatal_error_action, 0); | ||
| 1220 | sigaction (SIGMSG, &fatal_error_action, 0); | ||
| 1221 | #endif /* AIX */ | ||
| 1222 | } | ||
| 1223 | 1085 | ||
| 1224 | noninteractive1 = noninteractive; | 1086 | noninteractive1 = noninteractive; |
| 1225 | 1087 | ||
| @@ -1281,7 +1143,6 @@ Using an Emacs configured with --with-x-toolkit=lucid does not have this problem | |||
| 1281 | } | 1143 | } |
| 1282 | 1144 | ||
| 1283 | init_eval (); | 1145 | init_eval (); |
| 1284 | init_data (); | ||
| 1285 | init_atimer (); | 1146 | init_atimer (); |
| 1286 | running_asynch_code = 0; | 1147 | running_asynch_code = 0; |
| 1287 | init_random (); | 1148 | init_random (); |
| @@ -1407,8 +1268,7 @@ Using an Emacs configured with --with-x-toolkit=lucid does not have this problem | |||
| 1407 | /* egetenv is a pretty low-level facility, which may get called in | 1268 | /* egetenv is a pretty low-level facility, which may get called in |
| 1408 | many circumstances; it seems flimsy to put off initializing it | 1269 | many circumstances; it seems flimsy to put off initializing it |
| 1409 | until calling init_callproc. Do not do it when dumping. */ | 1270 | until calling init_callproc. Do not do it when dumping. */ |
| 1410 | if (initialized || ((strcmp (argv[argc-1], "dump") != 0 | 1271 | if (! dumping) |
| 1411 | && strcmp (argv[argc-1], "bootstrap") != 0))) | ||
| 1412 | set_initial_environment (); | 1272 | set_initial_environment (); |
| 1413 | 1273 | ||
| 1414 | /* AIX crashes are reported in system versions 3.2.3 and 3.2.4 | 1274 | /* AIX crashes are reported in system versions 3.2.3 and 3.2.4 |
diff --git a/src/eval.c b/src/eval.c index e47478bb1f1..25a41486279 100644 --- a/src/eval.c +++ b/src/eval.c | |||
| @@ -1076,7 +1076,7 @@ internal_catch (Lisp_Object tag, Lisp_Object (*func) (Lisp_Object), Lisp_Object | |||
| 1076 | /* Unwind the specbind, catch, and handler stacks back to CATCH, and | 1076 | /* Unwind the specbind, catch, and handler stacks back to CATCH, and |
| 1077 | jump to that CATCH, returning VALUE as the value of that catch. | 1077 | jump to that CATCH, returning VALUE as the value of that catch. |
| 1078 | 1078 | ||
| 1079 | This is the guts Fthrow and Fsignal; they differ only in the way | 1079 | This is the guts of Fthrow and Fsignal; they differ only in the way |
| 1080 | they choose the catch tag to throw to. A catch tag for a | 1080 | they choose the catch tag to throw to. A catch tag for a |
| 1081 | condition-case form has a TAG of Qnil. | 1081 | condition-case form has a TAG of Qnil. |
| 1082 | 1082 | ||
| @@ -1085,7 +1085,7 @@ internal_catch (Lisp_Object tag, Lisp_Object (*func) (Lisp_Object), Lisp_Object | |||
| 1085 | the handler stack as we go, so that the proper handlers are in | 1085 | the handler stack as we go, so that the proper handlers are in |
| 1086 | effect for each unwind-protect clause we run. At the end, restore | 1086 | effect for each unwind-protect clause we run. At the end, restore |
| 1087 | some static info saved in CATCH, and longjmp to the location | 1087 | some static info saved in CATCH, and longjmp to the location |
| 1088 | specified in the | 1088 | specified there. |
| 1089 | 1089 | ||
| 1090 | This is used for correct unwinding in Fthrow and Fsignal. */ | 1090 | This is used for correct unwinding in Fthrow and Fsignal. */ |
| 1091 | 1091 | ||
| @@ -1099,7 +1099,7 @@ unwind_to_catch (struct catchtag *catch, Lisp_Object value) | |||
| 1099 | 1099 | ||
| 1100 | /* Restore certain special C variables. */ | 1100 | /* Restore certain special C variables. */ |
| 1101 | set_poll_suppress_count (catch->poll_suppress_count); | 1101 | set_poll_suppress_count (catch->poll_suppress_count); |
| 1102 | UNBLOCK_INPUT_TO (catch->interrupt_input_blocked); | 1102 | unblock_input_to (catch->interrupt_input_blocked); |
| 1103 | immediate_quit = 0; | 1103 | immediate_quit = 0; |
| 1104 | 1104 | ||
| 1105 | do | 1105 | do |
| @@ -1114,16 +1114,6 @@ unwind_to_catch (struct catchtag *catch, Lisp_Object value) | |||
| 1114 | } | 1114 | } |
| 1115 | while (! last_time); | 1115 | while (! last_time); |
| 1116 | 1116 | ||
| 1117 | #if HAVE_X_WINDOWS | ||
| 1118 | /* If x_catch_errors was done, turn it off now. | ||
| 1119 | (First we give unbind_to a chance to do that.) */ | ||
| 1120 | #if 0 /* This would disable x_catch_errors after x_connection_closed. | ||
| 1121 | The catch must remain in effect during that delicate | ||
| 1122 | state. --lorentey */ | ||
| 1123 | x_fully_uncatch_errors (); | ||
| 1124 | #endif | ||
| 1125 | #endif | ||
| 1126 | |||
| 1127 | byte_stack_list = catch->byte_stack; | 1117 | byte_stack_list = catch->byte_stack; |
| 1128 | gcprolist = catch->gcpro; | 1118 | gcprolist = catch->gcpro; |
| 1129 | #ifdef DEBUG_GCPRO | 1119 | #ifdef DEBUG_GCPRO |
| @@ -1713,7 +1703,7 @@ maybe_call_debugger (Lisp_Object conditions, Lisp_Object sig, Lisp_Object data) | |||
| 1713 | if ( | 1703 | if ( |
| 1714 | /* Don't try to run the debugger with interrupts blocked. | 1704 | /* Don't try to run the debugger with interrupts blocked. |
| 1715 | The editing loop would return anyway. */ | 1705 | The editing loop would return anyway. */ |
| 1716 | ! INPUT_BLOCKED_P | 1706 | ! input_blocked_p () |
| 1717 | && NILP (Vinhibit_debugger) | 1707 | && NILP (Vinhibit_debugger) |
| 1718 | /* Does user want to enter debugger for this kind of error? */ | 1708 | /* Does user want to enter debugger for this kind of error? */ |
| 1719 | && (EQ (sig, Qquit) | 1709 | && (EQ (sig, Qquit) |
diff --git a/src/fileio.c b/src/fileio.c index 6c4e34d7312..9d8a0dc8b45 100644 --- a/src/fileio.c +++ b/src/fileio.c | |||
| @@ -1025,9 +1025,9 @@ filesystem tree, not (expand-file-name ".." dirname). */) | |||
| 1025 | memcpy (o, nm, p - nm); | 1025 | memcpy (o, nm, p - nm); |
| 1026 | o [p - nm] = 0; | 1026 | o [p - nm] = 0; |
| 1027 | 1027 | ||
| 1028 | BLOCK_INPUT; | 1028 | block_input (); |
| 1029 | pw = (struct passwd *) getpwnam (o + 1); | 1029 | pw = (struct passwd *) getpwnam (o + 1); |
| 1030 | UNBLOCK_INPUT; | 1030 | unblock_input (); |
| 1031 | if (pw) | 1031 | if (pw) |
| 1032 | { | 1032 | { |
| 1033 | newdir = pw->pw_dir; | 1033 | newdir = pw->pw_dir; |
| @@ -1413,9 +1413,9 @@ See also the function `substitute-in-file-name'.") | |||
| 1413 | o[len] = 0; | 1413 | o[len] = 0; |
| 1414 | 1414 | ||
| 1415 | /* Look up the user name. */ | 1415 | /* Look up the user name. */ |
| 1416 | BLOCK_INPUT; | 1416 | block_input (); |
| 1417 | pw = (struct passwd *) getpwnam (o + 1); | 1417 | pw = (struct passwd *) getpwnam (o + 1); |
| 1418 | UNBLOCK_INPUT; | 1418 | unblock_input (); |
| 1419 | if (!pw) | 1419 | if (!pw) |
| 1420 | error ("\"%s\" isn't a registered user", o + 1); | 1420 | error ("\"%s\" isn't a registered user", o + 1); |
| 1421 | 1421 | ||
| @@ -1531,9 +1531,9 @@ search_embedded_absfilename (char *nm, char *endp) | |||
| 1531 | /* If we have ~user and `user' exists, discard | 1531 | /* If we have ~user and `user' exists, discard |
| 1532 | everything up to ~. But if `user' does not exist, leave | 1532 | everything up to ~. But if `user' does not exist, leave |
| 1533 | ~user alone, it might be a literal file name. */ | 1533 | ~user alone, it might be a literal file name. */ |
| 1534 | BLOCK_INPUT; | 1534 | block_input (); |
| 1535 | pw = getpwnam (o + 1); | 1535 | pw = getpwnam (o + 1); |
| 1536 | UNBLOCK_INPUT; | 1536 | unblock_input (); |
| 1537 | if (pw) | 1537 | if (pw) |
| 1538 | return p; | 1538 | return p; |
| 1539 | } | 1539 | } |
| @@ -2999,10 +2999,10 @@ The value is an integer. */) | |||
| 2999 | mode_t realmask; | 2999 | mode_t realmask; |
| 3000 | Lisp_Object value; | 3000 | Lisp_Object value; |
| 3001 | 3001 | ||
| 3002 | BLOCK_INPUT; | 3002 | block_input (); |
| 3003 | realmask = umask (0); | 3003 | realmask = umask (0); |
| 3004 | umask (realmask); | 3004 | umask (realmask); |
| 3005 | UNBLOCK_INPUT; | 3005 | unblock_input (); |
| 3006 | 3006 | ||
| 3007 | XSETINT (value, (~ realmask) & 0777); | 3007 | XSETINT (value, (~ realmask) & 0777); |
| 3008 | return value; | 3008 | return value; |
| @@ -5235,9 +5235,9 @@ do_auto_save_unwind (Lisp_Object arg) /* used as unwind-protect function */ | |||
| 5235 | auto_saving = 0; | 5235 | auto_saving = 0; |
| 5236 | if (stream != NULL) | 5236 | if (stream != NULL) |
| 5237 | { | 5237 | { |
| 5238 | BLOCK_INPUT; | 5238 | block_input (); |
| 5239 | fclose (stream); | 5239 | fclose (stream); |
| 5240 | UNBLOCK_INPUT; | 5240 | unblock_input (); |
| 5241 | } | 5241 | } |
| 5242 | return Qnil; | 5242 | return Qnil; |
| 5243 | } | 5243 | } |
| @@ -5368,7 +5368,7 @@ A non-nil CURRENT-ONLY argument means save only current buffer. */) | |||
| 5368 | if (STRINGP (BVAR (b, auto_save_file_name)) | 5368 | if (STRINGP (BVAR (b, auto_save_file_name)) |
| 5369 | && stream != NULL && do_handled_files == 0) | 5369 | && stream != NULL && do_handled_files == 0) |
| 5370 | { | 5370 | { |
| 5371 | BLOCK_INPUT; | 5371 | block_input (); |
| 5372 | if (!NILP (BVAR (b, filename))) | 5372 | if (!NILP (BVAR (b, filename))) |
| 5373 | { | 5373 | { |
| 5374 | fwrite (SDATA (BVAR (b, filename)), 1, | 5374 | fwrite (SDATA (BVAR (b, filename)), 1, |
| @@ -5378,7 +5378,7 @@ A non-nil CURRENT-ONLY argument means save only current buffer. */) | |||
| 5378 | fwrite (SDATA (BVAR (b, auto_save_file_name)), 1, | 5378 | fwrite (SDATA (BVAR (b, auto_save_file_name)), 1, |
| 5379 | SBYTES (BVAR (b, auto_save_file_name)), stream); | 5379 | SBYTES (BVAR (b, auto_save_file_name)), stream); |
| 5380 | putc ('\n', stream); | 5380 | putc ('\n', stream); |
| 5381 | UNBLOCK_INPUT; | 5381 | unblock_input (); |
| 5382 | } | 5382 | } |
| 5383 | 5383 | ||
| 5384 | if (!NILP (current_only) | 5384 | if (!NILP (current_only) |
diff --git a/src/floatfns.c b/src/floatfns.c index 4fe209fcb61..645a5957609 100644 --- a/src/floatfns.c +++ b/src/floatfns.c | |||
| @@ -31,15 +31,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 31 | #include <config.h> | 31 | #include <config.h> |
| 32 | 32 | ||
| 33 | #include "lisp.h" | 33 | #include "lisp.h" |
| 34 | #include "syssignal.h" | ||
| 35 | |||
| 36 | #include <float.h> | ||
| 37 | #if (FLT_RADIX == 2 && FLT_MANT_DIG == 24 \ | ||
| 38 | && FLT_MIN_EXP == -125 && FLT_MAX_EXP == 128) | ||
| 39 | #define IEEE_FLOATING_POINT 1 | ||
| 40 | #else | ||
| 41 | #define IEEE_FLOATING_POINT 0 | ||
| 42 | #endif | ||
| 43 | 34 | ||
| 44 | #include <math.h> | 35 | #include <math.h> |
| 45 | 36 | ||
| @@ -1838,13 +1838,6 @@ properties on the list. This function never signals an error. */) | |||
| 1838 | halftail = XCDR (halftail); | 1838 | halftail = XCDR (halftail); |
| 1839 | if (EQ (tail, halftail)) | 1839 | if (EQ (tail, halftail)) |
| 1840 | break; | 1840 | break; |
| 1841 | |||
| 1842 | #if 0 /* Unsafe version. */ | ||
| 1843 | /* This function can be called asynchronously | ||
| 1844 | (setup_coding_system). Don't QUIT in that case. */ | ||
| 1845 | if (!interrupt_input_blocked) | ||
| 1846 | QUIT; | ||
| 1847 | #endif | ||
| 1848 | } | 1841 | } |
| 1849 | 1842 | ||
| 1850 | return Qnil; | 1843 | return Qnil; |
diff --git a/src/fontset.c b/src/fontset.c index 35d4bfb367e..7b051cbe1f3 100644 --- a/src/fontset.c +++ b/src/fontset.c | |||
| @@ -1275,7 +1275,7 @@ free_realized_fontsets (Lisp_Object base) | |||
| 1275 | doesn't remove FACE from a cache. Until we find a solution, we | 1275 | doesn't remove FACE from a cache. Until we find a solution, we |
| 1276 | suppress this code, and simply use Fclear_face_cache even though | 1276 | suppress this code, and simply use Fclear_face_cache even though |
| 1277 | that is not efficient. */ | 1277 | that is not efficient. */ |
| 1278 | BLOCK_INPUT; | 1278 | block_input (); |
| 1279 | for (id = 0; id < ASIZE (Vfontset_table); id++) | 1279 | for (id = 0; id < ASIZE (Vfontset_table); id++) |
| 1280 | { | 1280 | { |
| 1281 | Lisp_Object this = AREF (Vfontset_table, id); | 1281 | Lisp_Object this = AREF (Vfontset_table, id); |
| @@ -1296,7 +1296,7 @@ free_realized_fontsets (Lisp_Object base) | |||
| 1296 | } | 1296 | } |
| 1297 | } | 1297 | } |
| 1298 | } | 1298 | } |
| 1299 | UNBLOCK_INPUT; | 1299 | unblock_input (); |
| 1300 | #else /* not 0 */ | 1300 | #else /* not 0 */ |
| 1301 | /* But, we don't have to call Fclear_face_cache if no fontset has | 1301 | /* But, we don't have to call Fclear_face_cache if no fontset has |
| 1302 | been realized from BASE. */ | 1302 | been realized from BASE. */ |
diff --git a/src/frame.c b/src/frame.c index f3d16171516..4bcacef39c5 100644 --- a/src/frame.c +++ b/src/frame.c | |||
| @@ -3533,9 +3533,9 @@ x_set_alpha (struct frame *f, Lisp_Object arg, Lisp_Object oldval) | |||
| 3533 | f->alpha[i] = newval[i]; | 3533 | f->alpha[i] = newval[i]; |
| 3534 | 3534 | ||
| 3535 | #if defined (HAVE_X_WINDOWS) || defined (HAVE_NTGUI) || defined (NS_IMPL_COCOA) | 3535 | #if defined (HAVE_X_WINDOWS) || defined (HAVE_NTGUI) || defined (NS_IMPL_COCOA) |
| 3536 | BLOCK_INPUT; | 3536 | block_input (); |
| 3537 | x_set_frame_alpha (f); | 3537 | x_set_frame_alpha (f); |
| 3538 | UNBLOCK_INPUT; | 3538 | unblock_input (); |
| 3539 | #endif | 3539 | #endif |
| 3540 | 3540 | ||
| 3541 | return; | 3541 | return; |
diff --git a/src/fringe.c b/src/fringe.c index 6e6deeddb08..d788503e91e 100644 --- a/src/fringe.c +++ b/src/fringe.c | |||
| @@ -872,7 +872,7 @@ draw_fringe_bitmap (struct window *w, struct glyph_row *row, int left_p) | |||
| 872 | void | 872 | void |
| 873 | draw_row_fringe_bitmaps (struct window *w, struct glyph_row *row) | 873 | draw_row_fringe_bitmaps (struct window *w, struct glyph_row *row) |
| 874 | { | 874 | { |
| 875 | eassert (interrupt_input_blocked); | 875 | eassert (input_blocked_p ()); |
| 876 | 876 | ||
| 877 | /* If row is completely invisible, because of vscrolling, we | 877 | /* If row is completely invisible, because of vscrolling, we |
| 878 | don't have to draw anything. */ | 878 | don't have to draw anything. */ |
diff --git a/src/ftxfont.c b/src/ftxfont.c index 466250bd43f..5effe6e9104 100644 --- a/src/ftxfont.c +++ b/src/ftxfont.c | |||
| @@ -98,7 +98,7 @@ ftxfont_get_gcs (FRAME_PTR f, long unsigned int foreground, long unsigned int ba | |||
| 98 | new->colors[0].pixel = background; | 98 | new->colors[0].pixel = background; |
| 99 | new->colors[1].pixel = foreground; | 99 | new->colors[1].pixel = foreground; |
| 100 | 100 | ||
| 101 | BLOCK_INPUT; | 101 | block_input (); |
| 102 | XQueryColors (FRAME_X_DISPLAY (f), FRAME_X_COLORMAP (f), new->colors, 2); | 102 | XQueryColors (FRAME_X_DISPLAY (f), FRAME_X_COLORMAP (f), new->colors, 2); |
| 103 | for (i = 1; i < 7; i++) | 103 | for (i = 1; i < 7; i++) |
| 104 | { | 104 | { |
| @@ -115,14 +115,14 @@ ftxfont_get_gcs (FRAME_PTR f, long unsigned int foreground, long unsigned int ba | |||
| 115 | new->gcs[i - 1] = XCreateGC (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), | 115 | new->gcs[i - 1] = XCreateGC (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), |
| 116 | GCForeground, &xgcv); | 116 | GCForeground, &xgcv); |
| 117 | } | 117 | } |
| 118 | UNBLOCK_INPUT; | 118 | unblock_input (); |
| 119 | 119 | ||
| 120 | if (i < 7) | 120 | if (i < 7) |
| 121 | { | 121 | { |
| 122 | BLOCK_INPUT; | 122 | block_input (); |
| 123 | for (i--; i >= 0; i--) | 123 | for (i--; i >= 0; i--) |
| 124 | XFreeGC (FRAME_X_DISPLAY (f), new->gcs[i]); | 124 | XFreeGC (FRAME_X_DISPLAY (f), new->gcs[i]); |
| 125 | UNBLOCK_INPUT; | 125 | unblock_input (); |
| 126 | if (prev) | 126 | if (prev) |
| 127 | prev->next = new->next; | 127 | prev->next = new->next; |
| 128 | else if (data) | 128 | else if (data) |
| @@ -282,7 +282,7 @@ ftxfont_draw (struct glyph_string *s, int from, int to, int x, int y, | |||
| 282 | 282 | ||
| 283 | n[0] = n[1] = n[2] = n[3] = n[4] = n[5] = n[6] = 0; | 283 | n[0] = n[1] = n[2] = n[3] = n[4] = n[5] = n[6] = 0; |
| 284 | 284 | ||
| 285 | BLOCK_INPUT; | 285 | block_input (); |
| 286 | if (with_background) | 286 | if (with_background) |
| 287 | ftxfont_draw_background (f, font, s->gc, x, y, s->width); | 287 | ftxfont_draw_background (f, font, s->gc, x, y, s->width); |
| 288 | code = alloca (sizeof (unsigned) * len); | 288 | code = alloca (sizeof (unsigned) * len); |
| @@ -332,7 +332,7 @@ ftxfont_draw (struct glyph_string *s, int from, int to, int x, int y, | |||
| 332 | } | 332 | } |
| 333 | } | 333 | } |
| 334 | 334 | ||
| 335 | UNBLOCK_INPUT; | 335 | unblock_input (); |
| 336 | 336 | ||
| 337 | return len; | 337 | return len; |
| 338 | } | 338 | } |
| @@ -342,7 +342,7 @@ ftxfont_end_for_frame (FRAME_PTR f) | |||
| 342 | { | 342 | { |
| 343 | struct ftxfont_frame_data *data = font_get_frame_data (f, &ftxfont_driver); | 343 | struct ftxfont_frame_data *data = font_get_frame_data (f, &ftxfont_driver); |
| 344 | 344 | ||
| 345 | BLOCK_INPUT; | 345 | block_input (); |
| 346 | while (data) | 346 | while (data) |
| 347 | { | 347 | { |
| 348 | struct ftxfont_frame_data *next = data->next; | 348 | struct ftxfont_frame_data *next = data->next; |
| @@ -353,7 +353,7 @@ ftxfont_end_for_frame (FRAME_PTR f) | |||
| 353 | free (data); | 353 | free (data); |
| 354 | data = next; | 354 | data = next; |
| 355 | } | 355 | } |
| 356 | UNBLOCK_INPUT; | 356 | unblock_input (); |
| 357 | font_put_frame_data (f, &ftxfont_driver, NULL); | 357 | font_put_frame_data (f, &ftxfont_driver, NULL); |
| 358 | return 0; | 358 | return 0; |
| 359 | } | 359 | } |
diff --git a/src/gtkutil.c b/src/gtkutil.c index 1eb4b2cabdf..bf635250380 100644 --- a/src/gtkutil.c +++ b/src/gtkutil.c | |||
| @@ -590,7 +590,7 @@ xg_check_special_colors (struct frame *f, | |||
| 590 | if (! FRAME_GTK_WIDGET (f) || ! (get_bg || get_fg)) | 590 | if (! FRAME_GTK_WIDGET (f) || ! (get_bg || get_fg)) |
| 591 | return success_p; | 591 | return success_p; |
| 592 | 592 | ||
| 593 | BLOCK_INPUT; | 593 | block_input (); |
| 594 | { | 594 | { |
| 595 | #ifdef HAVE_GTK3 | 595 | #ifdef HAVE_GTK3 |
| 596 | GtkStyleContext *gsty | 596 | GtkStyleContext *gsty |
| @@ -620,7 +620,7 @@ xg_check_special_colors (struct frame *f, | |||
| 620 | #endif | 620 | #endif |
| 621 | 621 | ||
| 622 | } | 622 | } |
| 623 | UNBLOCK_INPUT; | 623 | unblock_input (); |
| 624 | return success_p; | 624 | return success_p; |
| 625 | } | 625 | } |
| 626 | 626 | ||
| @@ -725,7 +725,7 @@ xg_prepare_tooltip (FRAME_PTR f, | |||
| 725 | 725 | ||
| 726 | if (!x->ttip_lbl) return 0; | 726 | if (!x->ttip_lbl) return 0; |
| 727 | 727 | ||
| 728 | BLOCK_INPUT; | 728 | block_input (); |
| 729 | encoded_string = ENCODE_UTF_8 (string); | 729 | encoded_string = ENCODE_UTF_8 (string); |
| 730 | widget = GTK_WIDGET (x->ttip_lbl); | 730 | widget = GTK_WIDGET (x->ttip_lbl); |
| 731 | gwin = gtk_widget_get_window (GTK_WIDGET (x->ttip_window)); | 731 | gwin = gtk_widget_get_window (GTK_WIDGET (x->ttip_window)); |
| @@ -753,7 +753,7 @@ xg_prepare_tooltip (FRAME_PTR f, | |||
| 753 | if (width) *width = req.width; | 753 | if (width) *width = req.width; |
| 754 | if (height) *height = req.height; | 754 | if (height) *height = req.height; |
| 755 | 755 | ||
| 756 | UNBLOCK_INPUT; | 756 | unblock_input (); |
| 757 | 757 | ||
| 758 | return 1; | 758 | return 1; |
| 759 | #endif /* USE_GTK_TOOLTIP */ | 759 | #endif /* USE_GTK_TOOLTIP */ |
| @@ -769,10 +769,10 @@ xg_show_tooltip (FRAME_PTR f, int root_x, int root_y) | |||
| 769 | struct x_output *x = f->output_data.x; | 769 | struct x_output *x = f->output_data.x; |
| 770 | if (x->ttip_window) | 770 | if (x->ttip_window) |
| 771 | { | 771 | { |
| 772 | BLOCK_INPUT; | 772 | block_input (); |
| 773 | gtk_window_move (x->ttip_window, root_x, root_y); | 773 | gtk_window_move (x->ttip_window, root_x, root_y); |
| 774 | gtk_widget_show_all (GTK_WIDGET (x->ttip_window)); | 774 | gtk_widget_show_all (GTK_WIDGET (x->ttip_window)); |
| 775 | UNBLOCK_INPUT; | 775 | unblock_input (); |
| 776 | } | 776 | } |
| 777 | #endif | 777 | #endif |
| 778 | } | 778 | } |
| @@ -789,7 +789,7 @@ xg_hide_tooltip (FRAME_PTR f) | |||
| 789 | if (f->output_data.x->ttip_window) | 789 | if (f->output_data.x->ttip_window) |
| 790 | { | 790 | { |
| 791 | GtkWindow *win = f->output_data.x->ttip_window; | 791 | GtkWindow *win = f->output_data.x->ttip_window; |
| 792 | BLOCK_INPUT; | 792 | block_input (); |
| 793 | gtk_widget_hide (GTK_WIDGET (win)); | 793 | gtk_widget_hide (GTK_WIDGET (win)); |
| 794 | 794 | ||
| 795 | if (g_object_get_data (G_OBJECT (win), "restore-tt")) | 795 | if (g_object_get_data (G_OBJECT (win), "restore-tt")) |
| @@ -799,7 +799,7 @@ xg_hide_tooltip (FRAME_PTR f) | |||
| 799 | GtkSettings *settings = gtk_settings_get_for_screen (screen); | 799 | GtkSettings *settings = gtk_settings_get_for_screen (screen); |
| 800 | g_object_set (settings, "gtk-enable-tooltips", TRUE, NULL); | 800 | g_object_set (settings, "gtk-enable-tooltips", TRUE, NULL); |
| 801 | } | 801 | } |
| 802 | UNBLOCK_INPUT; | 802 | unblock_input (); |
| 803 | 803 | ||
| 804 | ret = 1; | 804 | ret = 1; |
| 805 | } | 805 | } |
| @@ -1007,7 +1007,7 @@ xg_win_to_widget (Display *dpy, Window wdesc) | |||
| 1007 | gpointer gdkwin; | 1007 | gpointer gdkwin; |
| 1008 | GtkWidget *gwdesc = 0; | 1008 | GtkWidget *gwdesc = 0; |
| 1009 | 1009 | ||
| 1010 | BLOCK_INPUT; | 1010 | block_input (); |
| 1011 | 1011 | ||
| 1012 | gdkwin = gdk_x11_window_lookup_for_display (gdk_x11_lookup_xdisplay (dpy), | 1012 | gdkwin = gdk_x11_window_lookup_for_display (gdk_x11_lookup_xdisplay (dpy), |
| 1013 | wdesc); | 1013 | wdesc); |
| @@ -1019,7 +1019,7 @@ xg_win_to_widget (Display *dpy, Window wdesc) | |||
| 1019 | gwdesc = gtk_get_event_widget (&event); | 1019 | gwdesc = gtk_get_event_widget (&event); |
| 1020 | } | 1020 | } |
| 1021 | 1021 | ||
| 1022 | UNBLOCK_INPUT; | 1022 | unblock_input (); |
| 1023 | return gwdesc; | 1023 | return gwdesc; |
| 1024 | } | 1024 | } |
| 1025 | 1025 | ||
| @@ -1123,7 +1123,7 @@ xg_create_frame_widgets (FRAME_PTR f) | |||
| 1123 | #endif | 1123 | #endif |
| 1124 | char *title = 0; | 1124 | char *title = 0; |
| 1125 | 1125 | ||
| 1126 | BLOCK_INPUT; | 1126 | block_input (); |
| 1127 | 1127 | ||
| 1128 | if (FRAME_X_EMBEDDED_P (f)) | 1128 | if (FRAME_X_EMBEDDED_P (f)) |
| 1129 | { | 1129 | { |
| @@ -1161,7 +1161,7 @@ xg_create_frame_widgets (FRAME_PTR f) | |||
| 1161 | if (whbox) gtk_widget_destroy (whbox); | 1161 | if (whbox) gtk_widget_destroy (whbox); |
| 1162 | if (wfixed) gtk_widget_destroy (wfixed); | 1162 | if (wfixed) gtk_widget_destroy (wfixed); |
| 1163 | 1163 | ||
| 1164 | UNBLOCK_INPUT; | 1164 | unblock_input (); |
| 1165 | return 0; | 1165 | return 0; |
| 1166 | } | 1166 | } |
| 1167 | 1167 | ||
| @@ -1275,7 +1275,7 @@ xg_create_frame_widgets (FRAME_PTR f) | |||
| 1275 | } | 1275 | } |
| 1276 | } | 1276 | } |
| 1277 | 1277 | ||
| 1278 | UNBLOCK_INPUT; | 1278 | unblock_input (); |
| 1279 | 1279 | ||
| 1280 | return 1; | 1280 | return 1; |
| 1281 | } | 1281 | } |
| @@ -1397,12 +1397,12 @@ x_wm_set_size_hint (FRAME_PTR f, long int flags, int user_position) | |||
| 1397 | &f->output_data.x->size_hints, | 1397 | &f->output_data.x->size_hints, |
| 1398 | sizeof (size_hints)) != 0) | 1398 | sizeof (size_hints)) != 0) |
| 1399 | { | 1399 | { |
| 1400 | BLOCK_INPUT; | 1400 | block_input (); |
| 1401 | gtk_window_set_geometry_hints (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)), | 1401 | gtk_window_set_geometry_hints (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)), |
| 1402 | NULL, &size_hints, hint_flags); | 1402 | NULL, &size_hints, hint_flags); |
| 1403 | f->output_data.x->size_hints = size_hints; | 1403 | f->output_data.x->size_hints = size_hints; |
| 1404 | f->output_data.x->hint_flags = hint_flags; | 1404 | f->output_data.x->hint_flags = hint_flags; |
| 1405 | UNBLOCK_INPUT; | 1405 | unblock_input (); |
| 1406 | } | 1406 | } |
| 1407 | } | 1407 | } |
| 1408 | 1408 | ||
| @@ -1417,9 +1417,9 @@ xg_set_background_color (FRAME_PTR f, long unsigned int bg) | |||
| 1417 | { | 1417 | { |
| 1418 | if (FRAME_GTK_WIDGET (f)) | 1418 | if (FRAME_GTK_WIDGET (f)) |
| 1419 | { | 1419 | { |
| 1420 | BLOCK_INPUT; | 1420 | block_input (); |
| 1421 | xg_set_widget_bg (f, FRAME_GTK_WIDGET (f), FRAME_BACKGROUND_PIXEL (f)); | 1421 | xg_set_widget_bg (f, FRAME_GTK_WIDGET (f), FRAME_BACKGROUND_PIXEL (f)); |
| 1422 | UNBLOCK_INPUT; | 1422 | unblock_input (); |
| 1423 | } | 1423 | } |
| 1424 | } | 1424 | } |
| 1425 | 1425 | ||
| @@ -1637,14 +1637,14 @@ pop_down_dialog (Lisp_Object arg) | |||
| 1637 | struct Lisp_Save_Value *p = XSAVE_VALUE (arg); | 1637 | struct Lisp_Save_Value *p = XSAVE_VALUE (arg); |
| 1638 | struct xg_dialog_data *dd = (struct xg_dialog_data *) p->pointer; | 1638 | struct xg_dialog_data *dd = (struct xg_dialog_data *) p->pointer; |
| 1639 | 1639 | ||
| 1640 | BLOCK_INPUT; | 1640 | block_input (); |
| 1641 | if (dd->w) gtk_widget_destroy (dd->w); | 1641 | if (dd->w) gtk_widget_destroy (dd->w); |
| 1642 | if (dd->timerid != 0) g_source_remove (dd->timerid); | 1642 | if (dd->timerid != 0) g_source_remove (dd->timerid); |
| 1643 | 1643 | ||
| 1644 | g_main_loop_quit (dd->loop); | 1644 | g_main_loop_quit (dd->loop); |
| 1645 | g_main_loop_unref (dd->loop); | 1645 | g_main_loop_unref (dd->loop); |
| 1646 | 1646 | ||
| 1647 | UNBLOCK_INPUT; | 1647 | unblock_input (); |
| 1648 | 1648 | ||
| 1649 | return Qnil; | 1649 | return Qnil; |
| 1650 | } | 1650 | } |
| @@ -1973,16 +1973,6 @@ xg_get_file_name (FRAME_PTR f, | |||
| 1973 | int filesel_done = 0; | 1973 | int filesel_done = 0; |
| 1974 | xg_get_file_func func; | 1974 | xg_get_file_func func; |
| 1975 | 1975 | ||
| 1976 | #if defined (HAVE_PTHREAD) && defined (__SIGRTMIN) | ||
| 1977 | /* I really don't know why this is needed, but without this the GLIBC add on | ||
| 1978 | library linuxthreads hangs when the Gnome file chooser backend creates | ||
| 1979 | threads. */ | ||
| 1980 | sigset_t blocked; | ||
| 1981 | sigemptyset (&blocked); | ||
| 1982 | sigaddset (&blocked, __SIGRTMIN); | ||
| 1983 | pthread_sigmask (SIG_BLOCK, &blocked, 0); | ||
| 1984 | #endif /* HAVE_PTHREAD */ | ||
| 1985 | |||
| 1986 | #ifdef HAVE_GTK_FILE_SELECTION_NEW | 1976 | #ifdef HAVE_GTK_FILE_SELECTION_NEW |
| 1987 | 1977 | ||
| 1988 | if (xg_uses_old_file_dialog ()) | 1978 | if (xg_uses_old_file_dialog ()) |
| @@ -2000,11 +1990,6 @@ xg_get_file_name (FRAME_PTR f, | |||
| 2000 | gtk_widget_set_name (w, "emacs-filedialog"); | 1990 | gtk_widget_set_name (w, "emacs-filedialog"); |
| 2001 | 1991 | ||
| 2002 | filesel_done = xg_dialog_run (f, w); | 1992 | filesel_done = xg_dialog_run (f, w); |
| 2003 | |||
| 2004 | #if defined (HAVE_PTHREAD) && defined (__SIGRTMIN) | ||
| 2005 | pthread_sigmask (SIG_UNBLOCK, &blocked, 0); | ||
| 2006 | #endif | ||
| 2007 | |||
| 2008 | if (filesel_done == GTK_RESPONSE_OK) | 1993 | if (filesel_done == GTK_RESPONSE_OK) |
| 2009 | fn = (*func) (w); | 1994 | fn = (*func) (w); |
| 2010 | 1995 | ||
| @@ -2057,13 +2042,6 @@ xg_get_font (FRAME_PTR f, const char *default_name) | |||
| 2057 | int done = 0; | 2042 | int done = 0; |
| 2058 | Lisp_Object font = Qnil; | 2043 | Lisp_Object font = Qnil; |
| 2059 | 2044 | ||
| 2060 | #if defined (HAVE_PTHREAD) && defined (__SIGRTMIN) | ||
| 2061 | sigset_t blocked; | ||
| 2062 | sigemptyset (&blocked); | ||
| 2063 | sigaddset (&blocked, __SIGRTMIN); | ||
| 2064 | pthread_sigmask (SIG_BLOCK, &blocked, 0); | ||
| 2065 | #endif /* HAVE_PTHREAD */ | ||
| 2066 | |||
| 2067 | w = gtk_font_chooser_dialog_new | 2045 | w = gtk_font_chooser_dialog_new |
| 2068 | ("Pick a font", GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f))); | 2046 | ("Pick a font", GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f))); |
| 2069 | 2047 | ||
| @@ -2088,11 +2066,6 @@ xg_get_font (FRAME_PTR f, const char *default_name) | |||
| 2088 | 2066 | ||
| 2089 | gtk_widget_set_name (w, "emacs-fontdialog"); | 2067 | gtk_widget_set_name (w, "emacs-fontdialog"); |
| 2090 | done = xg_dialog_run (f, w); | 2068 | done = xg_dialog_run (f, w); |
| 2091 | |||
| 2092 | #if defined (HAVE_PTHREAD) && defined (__SIGRTMIN) | ||
| 2093 | pthread_sigmask (SIG_UNBLOCK, &blocked, 0); | ||
| 2094 | #endif | ||
| 2095 | |||
| 2096 | if (done == GTK_RESPONSE_OK) | 2069 | if (done == GTK_RESPONSE_OK) |
| 2097 | { | 2070 | { |
| 2098 | #if USE_NEW_GTK_FONT_CHOOSER | 2071 | #if USE_NEW_GTK_FONT_CHOOSER |
| @@ -3358,7 +3331,7 @@ xg_update_frame_menubar (FRAME_PTR f) | |||
| 3358 | if (x->menubar_widget && gtk_widget_get_parent (x->menubar_widget)) | 3331 | if (x->menubar_widget && gtk_widget_get_parent (x->menubar_widget)) |
| 3359 | return 0; /* Already done this, happens for frames created invisible. */ | 3332 | return 0; /* Already done this, happens for frames created invisible. */ |
| 3360 | 3333 | ||
| 3361 | BLOCK_INPUT; | 3334 | block_input (); |
| 3362 | 3335 | ||
| 3363 | gtk_box_pack_start (GTK_BOX (x->vbox_widget), x->menubar_widget, | 3336 | gtk_box_pack_start (GTK_BOX (x->vbox_widget), x->menubar_widget, |
| 3364 | FALSE, FALSE, 0); | 3337 | FALSE, FALSE, 0); |
| @@ -3378,7 +3351,7 @@ xg_update_frame_menubar (FRAME_PTR f) | |||
| 3378 | FRAME_MENUBAR_HEIGHT (f) = req.height; | 3351 | FRAME_MENUBAR_HEIGHT (f) = req.height; |
| 3379 | xg_height_or_width_changed (f); | 3352 | xg_height_or_width_changed (f); |
| 3380 | } | 3353 | } |
| 3381 | UNBLOCK_INPUT; | 3354 | unblock_input (); |
| 3382 | 3355 | ||
| 3383 | return 1; | 3356 | return 1; |
| 3384 | } | 3357 | } |
| @@ -3393,7 +3366,7 @@ free_frame_menubar (FRAME_PTR f) | |||
| 3393 | 3366 | ||
| 3394 | if (x->menubar_widget) | 3367 | if (x->menubar_widget) |
| 3395 | { | 3368 | { |
| 3396 | BLOCK_INPUT; | 3369 | block_input (); |
| 3397 | 3370 | ||
| 3398 | gtk_container_remove (GTK_CONTAINER (x->vbox_widget), x->menubar_widget); | 3371 | gtk_container_remove (GTK_CONTAINER (x->vbox_widget), x->menubar_widget); |
| 3399 | /* The menubar and its children shall be deleted when removed from | 3372 | /* The menubar and its children shall be deleted when removed from |
| @@ -3401,7 +3374,7 @@ free_frame_menubar (FRAME_PTR f) | |||
| 3401 | x->menubar_widget = 0; | 3374 | x->menubar_widget = 0; |
| 3402 | FRAME_MENUBAR_HEIGHT (f) = 0; | 3375 | FRAME_MENUBAR_HEIGHT (f) = 0; |
| 3403 | xg_height_or_width_changed (f); | 3376 | xg_height_or_width_changed (f); |
| 3404 | UNBLOCK_INPUT; | 3377 | unblock_input (); |
| 3405 | } | 3378 | } |
| 3406 | } | 3379 | } |
| 3407 | 3380 | ||
| @@ -3838,7 +3811,7 @@ xg_set_toolkit_scroll_bar_thumb (struct scroll_bar *bar, | |||
| 3838 | 3811 | ||
| 3839 | if (changed || int_gtk_range_get_value (GTK_RANGE (wscroll)) != value) | 3812 | if (changed || int_gtk_range_get_value (GTK_RANGE (wscroll)) != value) |
| 3840 | { | 3813 | { |
| 3841 | BLOCK_INPUT; | 3814 | block_input (); |
| 3842 | 3815 | ||
| 3843 | /* gtk_range_set_value invokes the callback. Set | 3816 | /* gtk_range_set_value invokes the callback. Set |
| 3844 | ignore_gtk_scrollbar to make the callback do nothing */ | 3817 | ignore_gtk_scrollbar to make the callback do nothing */ |
| @@ -3851,7 +3824,7 @@ xg_set_toolkit_scroll_bar_thumb (struct scroll_bar *bar, | |||
| 3851 | 3824 | ||
| 3852 | xg_ignore_gtk_scrollbar = 0; | 3825 | xg_ignore_gtk_scrollbar = 0; |
| 3853 | 3826 | ||
| 3854 | UNBLOCK_INPUT; | 3827 | unblock_input (); |
| 3855 | } | 3828 | } |
| 3856 | } | 3829 | } |
| 3857 | } | 3830 | } |
| @@ -4642,7 +4615,7 @@ update_frame_tool_bar (FRAME_PTR f) | |||
| 4642 | if (! FRAME_GTK_WIDGET (f)) | 4615 | if (! FRAME_GTK_WIDGET (f)) |
| 4643 | return; | 4616 | return; |
| 4644 | 4617 | ||
| 4645 | BLOCK_INPUT; | 4618 | block_input (); |
| 4646 | 4619 | ||
| 4647 | if (RANGED_INTEGERP (1, Vtool_bar_button_margin, INT_MAX)) | 4620 | if (RANGED_INTEGERP (1, Vtool_bar_button_margin, INT_MAX)) |
| 4648 | { | 4621 | { |
| @@ -4684,7 +4657,7 @@ update_frame_tool_bar (FRAME_PTR f) | |||
| 4684 | && ! NILP (Fequal (tbinfo->style, style)) | 4657 | && ! NILP (Fequal (tbinfo->style, style)) |
| 4685 | && ! NILP (Fequal (tbinfo->last_tool_bar, f->tool_bar_items))) | 4658 | && ! NILP (Fequal (tbinfo->last_tool_bar, f->tool_bar_items))) |
| 4686 | { | 4659 | { |
| 4687 | UNBLOCK_INPUT; | 4660 | unblock_input (); |
| 4688 | return; | 4661 | return; |
| 4689 | } | 4662 | } |
| 4690 | 4663 | ||
| @@ -4895,7 +4868,7 @@ update_frame_tool_bar (FRAME_PTR f) | |||
| 4895 | xg_height_or_width_changed (f); | 4868 | xg_height_or_width_changed (f); |
| 4896 | } | 4869 | } |
| 4897 | 4870 | ||
| 4898 | UNBLOCK_INPUT; | 4871 | unblock_input (); |
| 4899 | } | 4872 | } |
| 4900 | 4873 | ||
| 4901 | /* Deallocate all resources for the tool bar on frame F. | 4874 | /* Deallocate all resources for the tool bar on frame F. |
| @@ -4910,7 +4883,7 @@ free_frame_tool_bar (FRAME_PTR f) | |||
| 4910 | { | 4883 | { |
| 4911 | struct xg_frame_tb_info *tbinfo; | 4884 | struct xg_frame_tb_info *tbinfo; |
| 4912 | int is_packed = x->handlebox_widget != 0; | 4885 | int is_packed = x->handlebox_widget != 0; |
| 4913 | BLOCK_INPUT; | 4886 | block_input (); |
| 4914 | /* We may have created the toolbar_widget in xg_create_tool_bar, but | 4887 | /* We may have created the toolbar_widget in xg_create_tool_bar, but |
| 4915 | not the x->handlebox_widget which is created in xg_pack_tool_bar. */ | 4888 | not the x->handlebox_widget which is created in xg_pack_tool_bar. */ |
| 4916 | if (is_packed) | 4889 | if (is_packed) |
| @@ -4942,7 +4915,7 @@ free_frame_tool_bar (FRAME_PTR f) | |||
| 4942 | 4915 | ||
| 4943 | xg_height_or_width_changed (f); | 4916 | xg_height_or_width_changed (f); |
| 4944 | 4917 | ||
| 4945 | UNBLOCK_INPUT; | 4918 | unblock_input (); |
| 4946 | } | 4919 | } |
| 4947 | } | 4920 | } |
| 4948 | 4921 | ||
| @@ -4954,7 +4927,7 @@ xg_change_toolbar_position (FRAME_PTR f, Lisp_Object pos) | |||
| 4954 | if (! x->toolbar_widget || ! x->handlebox_widget) | 4927 | if (! x->toolbar_widget || ! x->handlebox_widget) |
| 4955 | return 1; | 4928 | return 1; |
| 4956 | 4929 | ||
| 4957 | BLOCK_INPUT; | 4930 | block_input (); |
| 4958 | g_object_ref (x->handlebox_widget); | 4931 | g_object_ref (x->handlebox_widget); |
| 4959 | if (x->toolbar_in_hbox) | 4932 | if (x->toolbar_in_hbox) |
| 4960 | gtk_container_remove (GTK_CONTAINER (x->hbox_widget), | 4933 | gtk_container_remove (GTK_CONTAINER (x->hbox_widget), |
| @@ -4967,7 +4940,7 @@ xg_change_toolbar_position (FRAME_PTR f, Lisp_Object pos) | |||
| 4967 | if (xg_update_tool_bar_sizes (f)) | 4940 | if (xg_update_tool_bar_sizes (f)) |
| 4968 | xg_height_or_width_changed (f); | 4941 | xg_height_or_width_changed (f); |
| 4969 | 4942 | ||
| 4970 | UNBLOCK_INPUT; | 4943 | unblock_input (); |
| 4971 | return 1; | 4944 | return 1; |
| 4972 | } | 4945 | } |
| 4973 | 4946 | ||
diff --git a/src/image.c b/src/image.c index 0060d0d4148..a3717bf365e 100644 --- a/src/image.c +++ b/src/image.c | |||
| @@ -407,9 +407,9 @@ x_destroy_bitmap (FRAME_PTR f, ptrdiff_t id) | |||
| 407 | 407 | ||
| 408 | if (--bm->refcount == 0) | 408 | if (--bm->refcount == 0) |
| 409 | { | 409 | { |
| 410 | BLOCK_INPUT; | 410 | block_input (); |
| 411 | free_bitmap_record (dpyinfo, bm); | 411 | free_bitmap_record (dpyinfo, bm); |
| 412 | UNBLOCK_INPUT; | 412 | unblock_input (); |
| 413 | } | 413 | } |
| 414 | } | 414 | } |
| 415 | } | 415 | } |
| @@ -470,19 +470,19 @@ x_create_bitmap_mask (struct frame *f, ptrdiff_t id) | |||
| 470 | width = x_bitmap_width (f, id); | 470 | width = x_bitmap_width (f, id); |
| 471 | height = x_bitmap_height (f, id); | 471 | height = x_bitmap_height (f, id); |
| 472 | 472 | ||
| 473 | BLOCK_INPUT; | 473 | block_input (); |
| 474 | ximg = XGetImage (FRAME_X_DISPLAY (f), pixmap, 0, 0, width, height, | 474 | ximg = XGetImage (FRAME_X_DISPLAY (f), pixmap, 0, 0, width, height, |
| 475 | ~0, ZPixmap); | 475 | ~0, ZPixmap); |
| 476 | 476 | ||
| 477 | if (!ximg) | 477 | if (!ximg) |
| 478 | { | 478 | { |
| 479 | UNBLOCK_INPUT; | 479 | unblock_input (); |
| 480 | return -1; | 480 | return -1; |
| 481 | } | 481 | } |
| 482 | 482 | ||
| 483 | result = x_create_x_image_and_pixmap (f, width, height, 1, &mask_img, &mask); | 483 | result = x_create_x_image_and_pixmap (f, width, height, 1, &mask_img, &mask); |
| 484 | 484 | ||
| 485 | UNBLOCK_INPUT; | 485 | unblock_input (); |
| 486 | if (!result) | 486 | if (!result) |
| 487 | { | 487 | { |
| 488 | XDestroyImage (ximg); | 488 | XDestroyImage (ximg); |
| @@ -514,7 +514,7 @@ x_create_bitmap_mask (struct frame *f, ptrdiff_t id) | |||
| 514 | } | 514 | } |
| 515 | } | 515 | } |
| 516 | 516 | ||
| 517 | eassert (interrupt_input_blocked); | 517 | eassert (input_blocked_p ()); |
| 518 | gc = XCreateGC (FRAME_X_DISPLAY (f), mask, 0, NULL); | 518 | gc = XCreateGC (FRAME_X_DISPLAY (f), mask, 0, NULL); |
| 519 | XPutImage (FRAME_X_DISPLAY (f), mask, gc, mask_img, 0, 0, 0, 0, | 519 | XPutImage (FRAME_X_DISPLAY (f), mask, gc, mask_img, 0, 0, 0, 0, |
| 520 | width, height); | 520 | width, height); |
| @@ -593,7 +593,7 @@ define_image_type (struct image_type *type, Lisp_Object libraries) | |||
| 593 | Lisp_Object target_type = *type->type; | 593 | Lisp_Object target_type = *type->type; |
| 594 | int type_valid = 1; | 594 | int type_valid = 1; |
| 595 | 595 | ||
| 596 | BLOCK_INPUT; | 596 | block_input (); |
| 597 | 597 | ||
| 598 | for (p = image_types; p; p = p->next) | 598 | for (p = image_types; p; p = p->next) |
| 599 | if (EQ (*p->type, target_type)) | 599 | if (EQ (*p->type, target_type)) |
| @@ -625,7 +625,7 @@ define_image_type (struct image_type *type, Lisp_Object libraries) | |||
| 625 | } | 625 | } |
| 626 | 626 | ||
| 627 | done: | 627 | done: |
| 628 | UNBLOCK_INPUT; | 628 | unblock_input (); |
| 629 | return p; | 629 | return p; |
| 630 | } | 630 | } |
| 631 | 631 | ||
| @@ -1328,9 +1328,9 @@ x_clear_image_1 (struct frame *f, struct image *img, int pixmap_p, int mask_p, | |||
| 1328 | static void | 1328 | static void |
| 1329 | x_clear_image (struct frame *f, struct image *img) | 1329 | x_clear_image (struct frame *f, struct image *img) |
| 1330 | { | 1330 | { |
| 1331 | BLOCK_INPUT; | 1331 | block_input (); |
| 1332 | x_clear_image_1 (f, img, 1, 1, 1); | 1332 | x_clear_image_1 (f, img, 1, 1, 1); |
| 1333 | UNBLOCK_INPUT; | 1333 | unblock_input (); |
| 1334 | } | 1334 | } |
| 1335 | 1335 | ||
| 1336 | 1336 | ||
| @@ -1485,7 +1485,7 @@ clear_image_cache (struct frame *f, Lisp_Object filter) | |||
| 1485 | 1485 | ||
| 1486 | /* Block input so that we won't be interrupted by a SIGIO | 1486 | /* Block input so that we won't be interrupted by a SIGIO |
| 1487 | while being in an inconsistent state. */ | 1487 | while being in an inconsistent state. */ |
| 1488 | BLOCK_INPUT; | 1488 | block_input (); |
| 1489 | 1489 | ||
| 1490 | if (!NILP (filter)) | 1490 | if (!NILP (filter)) |
| 1491 | { | 1491 | { |
| @@ -1551,7 +1551,7 @@ clear_image_cache (struct frame *f, Lisp_Object filter) | |||
| 1551 | ++windows_or_buffers_changed; | 1551 | ++windows_or_buffers_changed; |
| 1552 | } | 1552 | } |
| 1553 | 1553 | ||
| 1554 | UNBLOCK_INPUT; | 1554 | unblock_input (); |
| 1555 | } | 1555 | } |
| 1556 | } | 1556 | } |
| 1557 | 1557 | ||
| @@ -1716,7 +1716,7 @@ lookup_image (struct frame *f, Lisp_Object spec) | |||
| 1716 | /* If not found, create a new image and cache it. */ | 1716 | /* If not found, create a new image and cache it. */ |
| 1717 | if (img == NULL) | 1717 | if (img == NULL) |
| 1718 | { | 1718 | { |
| 1719 | BLOCK_INPUT; | 1719 | block_input (); |
| 1720 | img = make_image (spec, hash); | 1720 | img = make_image (spec, hash); |
| 1721 | cache_image (f, img); | 1721 | cache_image (f, img); |
| 1722 | img->load_failed_p = img->type->load (f, img) == 0; | 1722 | img->load_failed_p = img->type->load (f, img) == 0; |
| @@ -1787,7 +1787,7 @@ lookup_image (struct frame *f, Lisp_Object spec) | |||
| 1787 | postprocess_image (f, img); | 1787 | postprocess_image (f, img); |
| 1788 | } | 1788 | } |
| 1789 | 1789 | ||
| 1790 | UNBLOCK_INPUT; | 1790 | unblock_input (); |
| 1791 | } | 1791 | } |
| 1792 | 1792 | ||
| 1793 | /* We're using IMG, so set its timestamp to `now'. */ | 1793 | /* We're using IMG, so set its timestamp to `now'. */ |
| @@ -1940,7 +1940,7 @@ x_create_x_image_and_pixmap (struct frame *f, int width, int height, int depth, | |||
| 1940 | Window window = FRAME_X_WINDOW (f); | 1940 | Window window = FRAME_X_WINDOW (f); |
| 1941 | Screen *screen = FRAME_X_SCREEN (f); | 1941 | Screen *screen = FRAME_X_SCREEN (f); |
| 1942 | 1942 | ||
| 1943 | eassert (interrupt_input_blocked); | 1943 | eassert (input_blocked_p ()); |
| 1944 | 1944 | ||
| 1945 | if (depth <= 0) | 1945 | if (depth <= 0) |
| 1946 | depth = DefaultDepthOfScreen (screen); | 1946 | depth = DefaultDepthOfScreen (screen); |
| @@ -2078,7 +2078,7 @@ x_create_x_image_and_pixmap (struct frame *f, int width, int height, int depth, | |||
| 2078 | static void | 2078 | static void |
| 2079 | x_destroy_x_image (XImagePtr ximg) | 2079 | x_destroy_x_image (XImagePtr ximg) |
| 2080 | { | 2080 | { |
| 2081 | eassert (interrupt_input_blocked); | 2081 | eassert (input_blocked_p ()); |
| 2082 | if (ximg) | 2082 | if (ximg) |
| 2083 | { | 2083 | { |
| 2084 | #ifdef HAVE_X_WINDOWS | 2084 | #ifdef HAVE_X_WINDOWS |
| @@ -2107,7 +2107,7 @@ x_put_x_image (struct frame *f, XImagePtr ximg, Pixmap pixmap, int width, int he | |||
| 2107 | #ifdef HAVE_X_WINDOWS | 2107 | #ifdef HAVE_X_WINDOWS |
| 2108 | GC gc; | 2108 | GC gc; |
| 2109 | 2109 | ||
| 2110 | eassert (interrupt_input_blocked); | 2110 | eassert (input_blocked_p ()); |
| 2111 | gc = XCreateGC (FRAME_X_DISPLAY (f), pixmap, 0, NULL); | 2111 | gc = XCreateGC (FRAME_X_DISPLAY (f), pixmap, 0, NULL); |
| 2112 | XPutImage (FRAME_X_DISPLAY (f), pixmap, gc, ximg, 0, 0, 0, 0, width, height); | 2112 | XPutImage (FRAME_X_DISPLAY (f), pixmap, gc, ximg, 0, 0, 0, 0, width, height); |
| 2113 | XFreeGC (FRAME_X_DISPLAY (f), gc); | 2113 | XFreeGC (FRAME_X_DISPLAY (f), gc); |
| @@ -4311,12 +4311,12 @@ lookup_pixel_color (struct frame *f, unsigned long pixel) | |||
| 4311 | x_query_color (f, &color); | 4311 | x_query_color (f, &color); |
| 4312 | rc = x_alloc_nearest_color (f, cmap, &color); | 4312 | rc = x_alloc_nearest_color (f, cmap, &color); |
| 4313 | #else | 4313 | #else |
| 4314 | BLOCK_INPUT; | 4314 | block_input (); |
| 4315 | cmap = DefaultColormapOfScreen (FRAME_X_SCREEN (f)); | 4315 | cmap = DefaultColormapOfScreen (FRAME_X_SCREEN (f)); |
| 4316 | color.pixel = pixel; | 4316 | color.pixel = pixel; |
| 4317 | XQueryColor (NULL, cmap, &color); | 4317 | XQueryColor (NULL, cmap, &color); |
| 4318 | rc = x_alloc_nearest_color (f, cmap, &color); | 4318 | rc = x_alloc_nearest_color (f, cmap, &color); |
| 4319 | UNBLOCK_INPUT; | 4319 | unblock_input (); |
| 4320 | #endif /* HAVE_X_WINDOWS */ | 4320 | #endif /* HAVE_X_WINDOWS */ |
| 4321 | 4321 | ||
| 4322 | if (rc) | 4322 | if (rc) |
| @@ -8656,11 +8656,11 @@ gs_load (struct frame *f, struct image *img) | |||
| 8656 | if (x_check_image_size (0, img->width, img->height)) | 8656 | if (x_check_image_size (0, img->width, img->height)) |
| 8657 | { | 8657 | { |
| 8658 | /* Only W32 version did BLOCK_INPUT here. ++kfs */ | 8658 | /* Only W32 version did BLOCK_INPUT here. ++kfs */ |
| 8659 | BLOCK_INPUT; | 8659 | block_input (); |
| 8660 | img->pixmap = XCreatePixmap (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), | 8660 | img->pixmap = XCreatePixmap (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), |
| 8661 | img->width, img->height, | 8661 | img->width, img->height, |
| 8662 | DefaultDepthOfScreen (FRAME_X_SCREEN (f))); | 8662 | DefaultDepthOfScreen (FRAME_X_SCREEN (f))); |
| 8663 | UNBLOCK_INPUT; | 8663 | unblock_input (); |
| 8664 | } | 8664 | } |
| 8665 | 8665 | ||
| 8666 | if (!img->pixmap) | 8666 | if (!img->pixmap) |
| @@ -8736,7 +8736,7 @@ x_kill_gs_process (Pixmap pixmap, struct frame *f) | |||
| 8736 | { | 8736 | { |
| 8737 | XImagePtr ximg; | 8737 | XImagePtr ximg; |
| 8738 | 8738 | ||
| 8739 | BLOCK_INPUT; | 8739 | block_input (); |
| 8740 | 8740 | ||
| 8741 | /* Try to get an XImage for img->pixmep. */ | 8741 | /* Try to get an XImage for img->pixmep. */ |
| 8742 | ximg = XGetImage (FRAME_X_DISPLAY (f), img->pixmap, | 8742 | ximg = XGetImage (FRAME_X_DISPLAY (f), img->pixmap, |
| @@ -8779,15 +8779,15 @@ x_kill_gs_process (Pixmap pixmap, struct frame *f) | |||
| 8779 | image_error ("Cannot get X image of `%s'; colors will not be freed", | 8779 | image_error ("Cannot get X image of `%s'; colors will not be freed", |
| 8780 | img->spec, Qnil); | 8780 | img->spec, Qnil); |
| 8781 | 8781 | ||
| 8782 | UNBLOCK_INPUT; | 8782 | unblock_input (); |
| 8783 | } | 8783 | } |
| 8784 | #endif /* HAVE_X_WINDOWS */ | 8784 | #endif /* HAVE_X_WINDOWS */ |
| 8785 | 8785 | ||
| 8786 | /* Now that we have the pixmap, compute mask and transform the | 8786 | /* Now that we have the pixmap, compute mask and transform the |
| 8787 | image if requested. */ | 8787 | image if requested. */ |
| 8788 | BLOCK_INPUT; | 8788 | block_input (); |
| 8789 | postprocess_image (f, img); | 8789 | postprocess_image (f, img); |
| 8790 | UNBLOCK_INPUT; | 8790 | unblock_input (); |
| 8791 | } | 8791 | } |
| 8792 | 8792 | ||
| 8793 | #endif /* HAVE_GHOSTSCRIPT */ | 8793 | #endif /* HAVE_GHOSTSCRIPT */ |
diff --git a/src/keyboard.c b/src/keyboard.c index c5a741abc10..f3d7df5e98f 100644 --- a/src/keyboard.c +++ b/src/keyboard.c | |||
| @@ -19,6 +19,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 19 | 19 | ||
| 20 | #include <config.h> | 20 | #include <config.h> |
| 21 | 21 | ||
| 22 | #define BLOCKINPUT_INLINE EXTERN_INLINE | ||
| 22 | #define KEYBOARD_INLINE EXTERN_INLINE | 23 | #define KEYBOARD_INLINE EXTERN_INLINE |
| 23 | 24 | ||
| 24 | #include <stdio.h> | 25 | #include <stdio.h> |
| @@ -72,19 +73,12 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 72 | 73 | ||
| 73 | /* Variables for blockinput.h: */ | 74 | /* Variables for blockinput.h: */ |
| 74 | 75 | ||
| 75 | /* Non-zero if interrupt input is blocked right now. */ | 76 | /* Positive if interrupt input is blocked right now. */ |
| 76 | volatile int interrupt_input_blocked; | 77 | volatile int interrupt_input_blocked; |
| 77 | 78 | ||
| 78 | /* Nonzero means an input interrupt has arrived | 79 | /* Nonzero means an input interrupt or alarm signal has arrived. |
| 79 | during the current critical section. */ | 80 | The QUIT macro checks this. */ |
| 80 | int interrupt_input_pending; | 81 | volatile int pending_signals; |
| 81 | |||
| 82 | /* This var should be (interrupt_input_pending || pending_atimers). | ||
| 83 | The QUIT macro checks this instead of interrupt_input_pending and | ||
| 84 | pending_atimers separately, to reduce code size. So, any code that | ||
| 85 | changes interrupt_input_pending or pending_atimers should update | ||
| 86 | this too. */ | ||
| 87 | int pending_signals; | ||
| 88 | 82 | ||
| 89 | #define KBD_BUFFER_SIZE 4096 | 83 | #define KBD_BUFFER_SIZE 4096 |
| 90 | 84 | ||
| @@ -225,7 +219,11 @@ static Lisp_Object last_point_position_window; | |||
| 225 | last event came from a macro. We use this to determine when to | 219 | last event came from a macro. We use this to determine when to |
| 226 | generate switch-frame events. This may be cleared by functions | 220 | generate switch-frame events. This may be cleared by functions |
| 227 | like Fselect_frame, to make sure that a switch-frame event is | 221 | like Fselect_frame, to make sure that a switch-frame event is |
| 228 | generated by the next character. */ | 222 | generated by the next character. |
| 223 | |||
| 224 | FIXME: This is modified by a signal handler so it should be volatile. | ||
| 225 | It's exported to Lisp, though, so it can't simply be marked | ||
| 226 | 'volatile' here. */ | ||
| 229 | Lisp_Object internal_last_event_frame; | 227 | Lisp_Object internal_last_event_frame; |
| 230 | 228 | ||
| 231 | /* The timestamp of the last input event we received from the X server. | 229 | /* The timestamp of the last input event we received from the X server. |
| @@ -389,7 +387,7 @@ int interrupts_deferred; | |||
| 389 | 387 | ||
| 390 | /* If we support a window system, turn on the code to poll periodically | 388 | /* If we support a window system, turn on the code to poll periodically |
| 391 | to detect C-g. It isn't actually used when doing interrupt input. */ | 389 | to detect C-g. It isn't actually used when doing interrupt input. */ |
| 392 | #if defined (HAVE_WINDOW_SYSTEM) && !defined (USE_ASYNC_EVENTS) | 390 | #ifdef HAVE_WINDOW_SYSTEM |
| 393 | #define POLL_FOR_INPUT | 391 | #define POLL_FOR_INPUT |
| 394 | #endif | 392 | #endif |
| 395 | 393 | ||
| @@ -413,7 +411,6 @@ static EMACS_TIME timer_last_idleness_start_time; | |||
| 413 | /* Function for init_keyboard to call with no args (if nonzero). */ | 411 | /* Function for init_keyboard to call with no args (if nonzero). */ |
| 414 | static void (*keyboard_init_hook) (void); | 412 | static void (*keyboard_init_hook) (void); |
| 415 | 413 | ||
| 416 | static int read_avail_input (void); | ||
| 417 | static void get_input_pending (int *, int); | 414 | static void get_input_pending (int *, int); |
| 418 | static int readable_events (int); | 415 | static int readable_events (int); |
| 419 | static Lisp_Object read_char_x_menu_prompt (ptrdiff_t, Lisp_Object *, | 416 | static Lisp_Object read_char_x_menu_prompt (ptrdiff_t, Lisp_Object *, |
| @@ -440,7 +437,7 @@ static Lisp_Object restore_kboard_configuration (Lisp_Object); | |||
| 440 | #ifdef USABLE_SIGIO | 437 | #ifdef USABLE_SIGIO |
| 441 | static void deliver_input_available_signal (int signo); | 438 | static void deliver_input_available_signal (int signo); |
| 442 | #endif | 439 | #endif |
| 443 | static void handle_interrupt (void); | 440 | static void handle_interrupt (bool); |
| 444 | static _Noreturn void quit_throw_to_read_char (int); | 441 | static _Noreturn void quit_throw_to_read_char (int); |
| 445 | static void process_special_events (void); | 442 | static void process_special_events (void); |
| 446 | static void timer_start_idle (void); | 443 | static void timer_start_idle (void); |
| @@ -823,7 +820,7 @@ This function is called by the editor initialization to begin editing. */) | |||
| 823 | 820 | ||
| 824 | /* If we enter while input is blocked, don't lock up here. | 821 | /* If we enter while input is blocked, don't lock up here. |
| 825 | This may happen through the debugger during redisplay. */ | 822 | This may happen through the debugger during redisplay. */ |
| 826 | if (INPUT_BLOCKED_P) | 823 | if (input_blocked_p ()) |
| 827 | return Qnil; | 824 | return Qnil; |
| 828 | 825 | ||
| 829 | command_loop_level++; | 826 | command_loop_level++; |
| @@ -1216,8 +1213,7 @@ This also exits all active minibuffers. */) | |||
| 1216 | 1213 | ||
| 1217 | /* Unblock input if we enter with input blocked. This may happen if | 1214 | /* Unblock input if we enter with input blocked. This may happen if |
| 1218 | redisplay traps e.g. during tool-bar update with input blocked. */ | 1215 | redisplay traps e.g. during tool-bar update with input blocked. */ |
| 1219 | while (INPUT_BLOCKED_P) | 1216 | totally_unblock_input (); |
| 1220 | UNBLOCK_INPUT; | ||
| 1221 | 1217 | ||
| 1222 | Fthrow (Qtop_level, Qnil); | 1218 | Fthrow (Qtop_level, Qnil); |
| 1223 | } | 1219 | } |
| @@ -1460,15 +1456,6 @@ command_loop_1 (void) | |||
| 1460 | } | 1456 | } |
| 1461 | } | 1457 | } |
| 1462 | 1458 | ||
| 1463 | #if 0 | ||
| 1464 | /* Select the frame that the last event came from. Usually, | ||
| 1465 | switch-frame events will take care of this, but if some lisp | ||
| 1466 | code swallows a switch-frame event, we'll fix things up here. | ||
| 1467 | Is this a good idea? */ | ||
| 1468 | if (FRAMEP (internal_last_event_frame) | ||
| 1469 | && !EQ (internal_last_event_frame, selected_frame)) | ||
| 1470 | Fselect_frame (internal_last_event_frame, Qnil); | ||
| 1471 | #endif | ||
| 1472 | /* If it has changed current-menubar from previous value, | 1459 | /* If it has changed current-menubar from previous value, |
| 1473 | really recompute the menubar from the value. */ | 1460 | really recompute the menubar from the value. */ |
| 1474 | if (! NILP (Vlucid_menu_bar_dirty_flag) | 1461 | if (! NILP (Vlucid_menu_bar_dirty_flag) |
| @@ -2008,9 +1995,9 @@ static struct atimer *poll_timer; | |||
| 2008 | void | 1995 | void |
| 2009 | poll_for_input_1 (void) | 1996 | poll_for_input_1 (void) |
| 2010 | { | 1997 | { |
| 2011 | if (interrupt_input_blocked == 0 | 1998 | if (! input_blocked_p () |
| 2012 | && !waiting_for_input) | 1999 | && !waiting_for_input) |
| 2013 | read_avail_input (); | 2000 | gobble_input (); |
| 2014 | } | 2001 | } |
| 2015 | 2002 | ||
| 2016 | /* Timer callback function for poll_timer. TIMER is equal to | 2003 | /* Timer callback function for poll_timer. TIMER is equal to |
| @@ -2020,10 +2007,7 @@ static void | |||
| 2020 | poll_for_input (struct atimer *timer) | 2007 | poll_for_input (struct atimer *timer) |
| 2021 | { | 2008 | { |
| 2022 | if (poll_suppress_count == 0) | 2009 | if (poll_suppress_count == 0) |
| 2023 | { | 2010 | pending_signals = 1; |
| 2024 | interrupt_input_pending = 1; | ||
| 2025 | pending_signals = 1; | ||
| 2026 | } | ||
| 2027 | } | 2011 | } |
| 2028 | 2012 | ||
| 2029 | #endif /* POLL_FOR_INPUT */ | 2013 | #endif /* POLL_FOR_INPUT */ |
| @@ -3344,7 +3328,7 @@ record_char (Lisp_Object c) | |||
| 3344 | If you, dear reader, have a better idea, you've got the source. :-) */ | 3328 | If you, dear reader, have a better idea, you've got the source. :-) */ |
| 3345 | if (dribble) | 3329 | if (dribble) |
| 3346 | { | 3330 | { |
| 3347 | BLOCK_INPUT; | 3331 | block_input (); |
| 3348 | if (INTEGERP (c)) | 3332 | if (INTEGERP (c)) |
| 3349 | { | 3333 | { |
| 3350 | if (XUINT (c) < 0x100) | 3334 | if (XUINT (c) < 0x100) |
| @@ -3370,7 +3354,7 @@ record_char (Lisp_Object c) | |||
| 3370 | } | 3354 | } |
| 3371 | 3355 | ||
| 3372 | fflush (dribble); | 3356 | fflush (dribble); |
| 3373 | UNBLOCK_INPUT; | 3357 | unblock_input (); |
| 3374 | } | 3358 | } |
| 3375 | } | 3359 | } |
| 3376 | 3360 | ||
| @@ -3514,10 +3498,8 @@ kbd_buffer_store_event (register struct input_event *event) | |||
| 3514 | Else, if EVENT is a quit event, store the quit event | 3498 | Else, if EVENT is a quit event, store the quit event |
| 3515 | in HOLD_QUIT, and return (thus ignoring further events). | 3499 | in HOLD_QUIT, and return (thus ignoring further events). |
| 3516 | 3500 | ||
| 3517 | This is used in read_avail_input to postpone the processing | 3501 | This is used to postpone the processing of the quit event until all |
| 3518 | of the quit event until all subsequent input events have been | 3502 | subsequent input events have been parsed (and discarded). */ |
| 3519 | parsed (and discarded). | ||
| 3520 | */ | ||
| 3521 | 3503 | ||
| 3522 | void | 3504 | void |
| 3523 | kbd_buffer_store_event_hold (register struct input_event *event, | 3505 | kbd_buffer_store_event_hold (register struct input_event *event, |
| @@ -3587,7 +3569,8 @@ kbd_buffer_store_event_hold (register struct input_event *event, | |||
| 3587 | } | 3569 | } |
| 3588 | 3570 | ||
| 3589 | last_event_timestamp = event->timestamp; | 3571 | last_event_timestamp = event->timestamp; |
| 3590 | handle_interrupt (); | 3572 | |
| 3573 | handle_interrupt (0); | ||
| 3591 | return; | 3574 | return; |
| 3592 | } | 3575 | } |
| 3593 | 3576 | ||
| @@ -3643,7 +3626,6 @@ kbd_buffer_store_event_hold (register struct input_event *event, | |||
| 3643 | if (immediate_quit && NILP (Vinhibit_quit)) | 3626 | if (immediate_quit && NILP (Vinhibit_quit)) |
| 3644 | { | 3627 | { |
| 3645 | immediate_quit = 0; | 3628 | immediate_quit = 0; |
| 3646 | pthread_sigmask (SIG_SETMASK, &empty_mask, 0); | ||
| 3647 | QUIT; | 3629 | QUIT; |
| 3648 | } | 3630 | } |
| 3649 | } | 3631 | } |
| @@ -3793,14 +3775,6 @@ kbd_buffer_get_event (KBOARD **kbp, | |||
| 3793 | /* Start reading input again, we have processed enough so we can | 3775 | /* Start reading input again, we have processed enough so we can |
| 3794 | accept new events again. */ | 3776 | accept new events again. */ |
| 3795 | unhold_keyboard_input (); | 3777 | unhold_keyboard_input (); |
| 3796 | #ifdef USABLE_SIGIO | ||
| 3797 | if (!noninteractive) | ||
| 3798 | { | ||
| 3799 | struct sigaction action; | ||
| 3800 | emacs_sigaction_init (&action, deliver_input_available_signal); | ||
| 3801 | sigaction (SIGIO, &action, 0); | ||
| 3802 | } | ||
| 3803 | #endif | ||
| 3804 | start_polling (); | 3778 | start_polling (); |
| 3805 | } | 3779 | } |
| 3806 | #endif /* subprocesses */ | 3780 | #endif /* subprocesses */ |
| @@ -3869,7 +3843,7 @@ kbd_buffer_get_event (KBOARD **kbp, | |||
| 3869 | wait_reading_process_output (0, 0, -1, 1, Qnil, NULL, 0); | 3843 | wait_reading_process_output (0, 0, -1, 1, Qnil, NULL, 0); |
| 3870 | 3844 | ||
| 3871 | if (!interrupt_input && kbd_fetch_ptr == kbd_store_ptr) | 3845 | if (!interrupt_input && kbd_fetch_ptr == kbd_store_ptr) |
| 3872 | read_avail_input (); | 3846 | gobble_input (); |
| 3873 | } | 3847 | } |
| 3874 | 3848 | ||
| 3875 | if (CONSP (Vunread_command_events)) | 3849 | if (CONSP (Vunread_command_events)) |
| @@ -6752,41 +6726,6 @@ get_input_pending (int *addr, int flags) | |||
| 6752 | *addr = (!NILP (Vquit_flag) || readable_events (flags)); | 6726 | *addr = (!NILP (Vquit_flag) || readable_events (flags)); |
| 6753 | } | 6727 | } |
| 6754 | 6728 | ||
| 6755 | /* Interface to read_avail_input, blocking SIGIO or SIGALRM if necessary. */ | ||
| 6756 | |||
| 6757 | void | ||
| 6758 | gobble_input (void) | ||
| 6759 | { | ||
| 6760 | #ifdef USABLE_SIGIO | ||
| 6761 | if (interrupt_input) | ||
| 6762 | { | ||
| 6763 | sigset_t blocked, procmask; | ||
| 6764 | sigemptyset (&blocked); | ||
| 6765 | sigaddset (&blocked, SIGIO); | ||
| 6766 | pthread_sigmask (SIG_BLOCK, &blocked, &procmask); | ||
| 6767 | read_avail_input (); | ||
| 6768 | pthread_sigmask (SIG_SETMASK, &procmask, 0); | ||
| 6769 | } | ||
| 6770 | else | ||
| 6771 | #ifdef POLL_FOR_INPUT | ||
| 6772 | /* XXX This condition was (read_socket_hook && !interrupt_input), | ||
| 6773 | but read_socket_hook is not global anymore. Let's pretend that | ||
| 6774 | it's always set. */ | ||
| 6775 | if (!interrupt_input && poll_suppress_count == 0) | ||
| 6776 | { | ||
| 6777 | sigset_t blocked, procmask; | ||
| 6778 | sigemptyset (&blocked); | ||
| 6779 | sigaddset (&blocked, SIGALRM); | ||
| 6780 | pthread_sigmask (SIG_BLOCK, &blocked, &procmask); | ||
| 6781 | read_avail_input (); | ||
| 6782 | pthread_sigmask (SIG_SETMASK, &procmask, 0); | ||
| 6783 | } | ||
| 6784 | else | ||
| 6785 | #endif | ||
| 6786 | #endif | ||
| 6787 | read_avail_input (); | ||
| 6788 | } | ||
| 6789 | |||
| 6790 | /* Put a BUFFER_SWITCH_EVENT in the buffer | 6729 | /* Put a BUFFER_SWITCH_EVENT in the buffer |
| 6791 | so that read_key_sequence will notice the new current buffer. */ | 6730 | so that read_key_sequence will notice the new current buffer. */ |
| 6792 | 6731 | ||
| @@ -6814,14 +6753,7 @@ record_asynch_buffer_change (void) | |||
| 6814 | /* Make sure no interrupt happens while storing the event. */ | 6753 | /* Make sure no interrupt happens while storing the event. */ |
| 6815 | #ifdef USABLE_SIGIO | 6754 | #ifdef USABLE_SIGIO |
| 6816 | if (interrupt_input) | 6755 | if (interrupt_input) |
| 6817 | { | 6756 | kbd_buffer_store_event (&event); |
| 6818 | sigset_t blocked, procmask; | ||
| 6819 | sigemptyset (&blocked); | ||
| 6820 | sigaddset (&blocked, SIGIO); | ||
| 6821 | pthread_sigmask (SIG_BLOCK, &blocked, &procmask); | ||
| 6822 | kbd_buffer_store_event (&event); | ||
| 6823 | pthread_sigmask (SIG_SETMASK, &procmask, 0); | ||
| 6824 | } | ||
| 6825 | else | 6757 | else |
| 6826 | #endif | 6758 | #endif |
| 6827 | { | 6759 | { |
| @@ -6834,13 +6766,11 @@ record_asynch_buffer_change (void) | |||
| 6834 | /* Read any terminal input already buffered up by the system | 6766 | /* Read any terminal input already buffered up by the system |
| 6835 | into the kbd_buffer, but do not wait. | 6767 | into the kbd_buffer, but do not wait. |
| 6836 | 6768 | ||
| 6837 | EXPECTED should be nonzero if the caller knows there is some input. | 6769 | Return the number of keyboard chars read, or -1 meaning |
| 6838 | |||
| 6839 | Returns the number of keyboard chars read, or -1 meaning | ||
| 6840 | this is a bad time to try to read input. */ | 6770 | this is a bad time to try to read input. */ |
| 6841 | 6771 | ||
| 6842 | static int | 6772 | int |
| 6843 | read_avail_input (void) | 6773 | gobble_input (void) |
| 6844 | { | 6774 | { |
| 6845 | int nread = 0; | 6775 | int nread = 0; |
| 6846 | int err = 0; | 6776 | int err = 0; |
| @@ -6860,11 +6790,17 @@ read_avail_input (void) | |||
| 6860 | int nr; | 6790 | int nr; |
| 6861 | struct input_event hold_quit; | 6791 | struct input_event hold_quit; |
| 6862 | 6792 | ||
| 6793 | if (input_blocked_p ()) | ||
| 6794 | { | ||
| 6795 | pending_signals = 1; | ||
| 6796 | break; | ||
| 6797 | } | ||
| 6798 | |||
| 6863 | EVENT_INIT (hold_quit); | 6799 | EVENT_INIT (hold_quit); |
| 6864 | hold_quit.kind = NO_EVENT; | 6800 | hold_quit.kind = NO_EVENT; |
| 6865 | 6801 | ||
| 6866 | /* No need for FIONREAD or fcntl; just say don't wait. */ | 6802 | /* No need for FIONREAD or fcntl; just say don't wait. */ |
| 6867 | while (0 < (nr = (*t->read_socket_hook) (t, &hold_quit))) | 6803 | while (0 < (nr = (*t->read_socket_hook) (t, &hold_quit))) |
| 6868 | nread += nr; | 6804 | nread += nr; |
| 6869 | 6805 | ||
| 6870 | if (nr == -1) /* Not OK to read input now. */ | 6806 | if (nr == -1) /* Not OK to read input now. */ |
| @@ -6885,7 +6821,7 @@ read_avail_input (void) | |||
| 6885 | this process rather than to the whole process | 6821 | this process rather than to the whole process |
| 6886 | group? Perhaps on systems with FIONREAD Emacs is | 6822 | group? Perhaps on systems with FIONREAD Emacs is |
| 6887 | alone in its group. */ | 6823 | alone in its group. */ |
| 6888 | kill (getpid (), SIGHUP); | 6824 | terminate_due_to_signal (SIGHUP, 10); |
| 6889 | 6825 | ||
| 6890 | /* XXX Is calling delete_terminal safe here? It calls delete_frame. */ | 6826 | /* XXX Is calling delete_terminal safe here? It calls delete_frame. */ |
| 6891 | { | 6827 | { |
| @@ -7174,34 +7110,68 @@ tty_read_avail_input (struct terminal *terminal, | |||
| 7174 | static void | 7110 | static void |
| 7175 | handle_async_input (void) | 7111 | handle_async_input (void) |
| 7176 | { | 7112 | { |
| 7177 | interrupt_input_pending = 0; | 7113 | #ifdef USABLE_SIGIO |
| 7178 | pending_signals = pending_atimers; | ||
| 7179 | |||
| 7180 | while (1) | 7114 | while (1) |
| 7181 | { | 7115 | { |
| 7182 | int nread = read_avail_input (); | 7116 | int nread = gobble_input (); |
| 7183 | /* -1 means it's not ok to read the input now. | 7117 | /* -1 means it's not ok to read the input now. |
| 7184 | UNBLOCK_INPUT will read it later; now, avoid infinite loop. | 7118 | UNBLOCK_INPUT will read it later; now, avoid infinite loop. |
| 7185 | 0 means there was no keyboard input available. */ | 7119 | 0 means there was no keyboard input available. */ |
| 7186 | if (nread <= 0) | 7120 | if (nread <= 0) |
| 7187 | break; | 7121 | break; |
| 7188 | } | 7122 | } |
| 7123 | #endif | ||
| 7189 | } | 7124 | } |
| 7190 | 7125 | ||
| 7191 | void | 7126 | void |
| 7192 | process_pending_signals (void) | 7127 | process_pending_signals (void) |
| 7193 | { | 7128 | { |
| 7194 | if (interrupt_input_pending) | 7129 | pending_signals = 0; |
| 7195 | handle_async_input (); | 7130 | handle_async_input (); |
| 7196 | do_pending_atimers (); | 7131 | do_pending_atimers (); |
| 7197 | } | 7132 | } |
| 7198 | 7133 | ||
| 7134 | /* Undo any number of BLOCK_INPUT calls down to level LEVEL, | ||
| 7135 | and also (if the level is now 0) reinvoke any pending signal. */ | ||
| 7136 | |||
| 7137 | void | ||
| 7138 | unblock_input_to (int level) | ||
| 7139 | { | ||
| 7140 | interrupt_input_blocked = level; | ||
| 7141 | if (level == 0) | ||
| 7142 | { | ||
| 7143 | if (pending_signals) | ||
| 7144 | process_pending_signals (); | ||
| 7145 | } | ||
| 7146 | else if (level < 0) | ||
| 7147 | emacs_abort (); | ||
| 7148 | } | ||
| 7149 | |||
| 7150 | /* End critical section. | ||
| 7151 | |||
| 7152 | If doing signal-driven input, and a signal came in when input was | ||
| 7153 | blocked, reinvoke the signal handler now to deal with it. */ | ||
| 7154 | |||
| 7155 | void | ||
| 7156 | unblock_input (void) | ||
| 7157 | { | ||
| 7158 | unblock_input_to (interrupt_input_blocked - 1); | ||
| 7159 | } | ||
| 7160 | |||
| 7161 | /* Undo any number of BLOCK_INPUT calls, | ||
| 7162 | and also reinvoke any pending signal. */ | ||
| 7163 | |||
| 7164 | void | ||
| 7165 | totally_unblock_input (void) | ||
| 7166 | { | ||
| 7167 | unblock_input_to (0); | ||
| 7168 | } | ||
| 7169 | |||
| 7199 | #ifdef USABLE_SIGIO | 7170 | #ifdef USABLE_SIGIO |
| 7200 | 7171 | ||
| 7201 | static void | 7172 | void |
| 7202 | handle_input_available_signal (int sig) | 7173 | handle_input_available_signal (int sig) |
| 7203 | { | 7174 | { |
| 7204 | interrupt_input_pending = 1; | ||
| 7205 | pending_signals = 1; | 7175 | pending_signals = 1; |
| 7206 | 7176 | ||
| 7207 | if (input_available_clear_time) | 7177 | if (input_available_clear_time) |
| @@ -7211,25 +7181,10 @@ handle_input_available_signal (int sig) | |||
| 7211 | static void | 7181 | static void |
| 7212 | deliver_input_available_signal (int sig) | 7182 | deliver_input_available_signal (int sig) |
| 7213 | { | 7183 | { |
| 7214 | handle_on_main_thread (sig, handle_input_available_signal); | 7184 | deliver_process_signal (sig, handle_input_available_signal); |
| 7215 | } | 7185 | } |
| 7216 | #endif /* USABLE_SIGIO */ | 7186 | #endif /* USABLE_SIGIO */ |
| 7217 | 7187 | ||
| 7218 | /* Send ourselves a SIGIO. | ||
| 7219 | |||
| 7220 | This function exists so that the UNBLOCK_INPUT macro in | ||
| 7221 | blockinput.h can have some way to take care of input we put off | ||
| 7222 | dealing with, without assuming that every file which uses | ||
| 7223 | UNBLOCK_INPUT also has #included the files necessary to get SIGIO. */ | ||
| 7224 | void | ||
| 7225 | reinvoke_input_signal (void) | ||
| 7226 | { | ||
| 7227 | #ifdef USABLE_SIGIO | ||
| 7228 | handle_async_input (); | ||
| 7229 | #endif | ||
| 7230 | } | ||
| 7231 | |||
| 7232 | |||
| 7233 | 7188 | ||
| 7234 | /* User signal events. */ | 7189 | /* User signal events. */ |
| 7235 | 7190 | ||
| @@ -7300,7 +7255,7 @@ handle_user_signal (int sig) | |||
| 7300 | p->npending++; | 7255 | p->npending++; |
| 7301 | #ifdef USABLE_SIGIO | 7256 | #ifdef USABLE_SIGIO |
| 7302 | if (interrupt_input) | 7257 | if (interrupt_input) |
| 7303 | kill (getpid (), SIGIO); | 7258 | handle_input_available_signal (sig); |
| 7304 | else | 7259 | else |
| 7305 | #endif | 7260 | #endif |
| 7306 | { | 7261 | { |
| @@ -7316,7 +7271,7 @@ handle_user_signal (int sig) | |||
| 7316 | static void | 7271 | static void |
| 7317 | deliver_user_signal (int sig) | 7272 | deliver_user_signal (int sig) |
| 7318 | { | 7273 | { |
| 7319 | handle_on_main_thread (sig, handle_user_signal); | 7274 | deliver_process_signal (sig, handle_user_signal); |
| 7320 | } | 7275 | } |
| 7321 | 7276 | ||
| 7322 | static char * | 7277 | static char * |
| @@ -7341,8 +7296,6 @@ store_user_signal_events (void) | |||
| 7341 | for (p = user_signals; p; p = p->next) | 7296 | for (p = user_signals; p; p = p->next) |
| 7342 | if (p->npending > 0) | 7297 | if (p->npending > 0) |
| 7343 | { | 7298 | { |
| 7344 | sigset_t blocked, procmask; | ||
| 7345 | |||
| 7346 | if (! buf_initialized) | 7299 | if (! buf_initialized) |
| 7347 | { | 7300 | { |
| 7348 | memset (&buf, 0, sizeof buf); | 7301 | memset (&buf, 0, sizeof buf); |
| @@ -7351,10 +7304,6 @@ store_user_signal_events (void) | |||
| 7351 | buf_initialized = 1; | 7304 | buf_initialized = 1; |
| 7352 | } | 7305 | } |
| 7353 | 7306 | ||
| 7354 | sigemptyset (&blocked); | ||
| 7355 | sigaddset (&blocked, p->sig); | ||
| 7356 | pthread_sigmask (SIG_BLOCK, &blocked, &procmask); | ||
| 7357 | |||
| 7358 | do | 7307 | do |
| 7359 | { | 7308 | { |
| 7360 | buf.code = p->sig; | 7309 | buf.code = p->sig; |
| @@ -7362,8 +7311,6 @@ store_user_signal_events (void) | |||
| 7362 | p->npending--; | 7311 | p->npending--; |
| 7363 | } | 7312 | } |
| 7364 | while (p->npending > 0); | 7313 | while (p->npending > 0); |
| 7365 | |||
| 7366 | pthread_sigmask (SIG_SETMASK, &procmask, 0); | ||
| 7367 | } | 7314 | } |
| 7368 | } | 7315 | } |
| 7369 | 7316 | ||
| @@ -10568,9 +10515,9 @@ The file will be closed when Emacs exits. */) | |||
| 10568 | { | 10515 | { |
| 10569 | if (dribble) | 10516 | if (dribble) |
| 10570 | { | 10517 | { |
| 10571 | BLOCK_INPUT; | 10518 | block_input (); |
| 10572 | fclose (dribble); | 10519 | fclose (dribble); |
| 10573 | UNBLOCK_INPUT; | 10520 | unblock_input (); |
| 10574 | dribble = 0; | 10521 | dribble = 0; |
| 10575 | } | 10522 | } |
| 10576 | if (!NILP (file)) | 10523 | if (!NILP (file)) |
| @@ -10759,21 +10706,21 @@ handle_interrupt_signal (int sig) | |||
| 10759 | from the controlling tty. */ | 10706 | from the controlling tty. */ |
| 10760 | internal_last_event_frame = terminal->display_info.tty->top_frame; | 10707 | internal_last_event_frame = terminal->display_info.tty->top_frame; |
| 10761 | 10708 | ||
| 10762 | handle_interrupt (); | 10709 | handle_interrupt (1); |
| 10763 | } | 10710 | } |
| 10764 | } | 10711 | } |
| 10765 | 10712 | ||
| 10766 | static void | 10713 | static void |
| 10767 | deliver_interrupt_signal (int sig) | 10714 | deliver_interrupt_signal (int sig) |
| 10768 | { | 10715 | { |
| 10769 | handle_on_main_thread (sig, handle_interrupt_signal); | 10716 | deliver_process_signal (sig, handle_interrupt_signal); |
| 10770 | } | 10717 | } |
| 10771 | 10718 | ||
| 10772 | 10719 | ||
| 10773 | /* If Emacs is stuck because `inhibit-quit' is true, then keep track | 10720 | /* If Emacs is stuck because `inhibit-quit' is true, then keep track |
| 10774 | of the number of times C-g has been requested. If C-g is pressed | 10721 | of the number of times C-g has been requested. If C-g is pressed |
| 10775 | enough times, then quit anyway. See bug#6585. */ | 10722 | enough times, then quit anyway. See bug#6585. */ |
| 10776 | static int force_quit_count; | 10723 | static int volatile force_quit_count; |
| 10777 | 10724 | ||
| 10778 | /* This routine is called at interrupt level in response to C-g. | 10725 | /* This routine is called at interrupt level in response to C-g. |
| 10779 | 10726 | ||
| @@ -10787,7 +10734,7 @@ static int force_quit_count; | |||
| 10787 | non-nil, it stops the job right away. */ | 10734 | non-nil, it stops the job right away. */ |
| 10788 | 10735 | ||
| 10789 | static void | 10736 | static void |
| 10790 | handle_interrupt (void) | 10737 | handle_interrupt (bool in_signal_handler) |
| 10791 | { | 10738 | { |
| 10792 | char c; | 10739 | char c; |
| 10793 | 10740 | ||
| @@ -10796,13 +10743,16 @@ handle_interrupt (void) | |||
| 10796 | /* XXX This code needs to be revised for multi-tty support. */ | 10743 | /* XXX This code needs to be revised for multi-tty support. */ |
| 10797 | if (!NILP (Vquit_flag) && get_named_tty ("/dev/tty")) | 10744 | if (!NILP (Vquit_flag) && get_named_tty ("/dev/tty")) |
| 10798 | { | 10745 | { |
| 10799 | /* If SIGINT isn't blocked, don't let us be interrupted by | 10746 | if (! in_signal_handler) |
| 10800 | another SIGINT, it might be harmful due to non-reentrancy | 10747 | { |
| 10801 | in I/O functions. */ | 10748 | /* If SIGINT isn't blocked, don't let us be interrupted by |
| 10802 | sigset_t blocked; | 10749 | a SIGINT. It might be harmful due to non-reentrancy |
| 10803 | sigemptyset (&blocked); | 10750 | in I/O functions. */ |
| 10804 | sigaddset (&blocked, SIGINT); | 10751 | sigset_t blocked; |
| 10805 | pthread_sigmask (SIG_BLOCK, &blocked, 0); | 10752 | sigemptyset (&blocked); |
| 10753 | sigaddset (&blocked, SIGINT); | ||
| 10754 | pthread_sigmask (SIG_BLOCK, &blocked, 0); | ||
| 10755 | } | ||
| 10806 | 10756 | ||
| 10807 | fflush (stdout); | 10757 | fflush (stdout); |
| 10808 | reset_all_sys_modes (); | 10758 | reset_all_sys_modes (); |
| @@ -10873,7 +10823,6 @@ handle_interrupt (void) | |||
| 10873 | #endif /* not MSDOS */ | 10823 | #endif /* not MSDOS */ |
| 10874 | fflush (stdout); | 10824 | fflush (stdout); |
| 10875 | init_all_sys_modes (); | 10825 | init_all_sys_modes (); |
| 10876 | pthread_sigmask (SIG_SETMASK, &empty_mask, 0); | ||
| 10877 | } | 10826 | } |
| 10878 | else | 10827 | else |
| 10879 | { | 10828 | { |
| @@ -10891,15 +10840,14 @@ handle_interrupt (void) | |||
| 10891 | GCPRO4 (saved.object, saved.global_code, | 10840 | GCPRO4 (saved.object, saved.global_code, |
| 10892 | saved.current_syntax_table, saved.old_prop); | 10841 | saved.current_syntax_table, saved.old_prop); |
| 10893 | Fsignal (Qquit, Qnil); | 10842 | Fsignal (Qquit, Qnil); |
| 10894 | /* FIXME: AFAIK, `quit' can never return, so this code is dead! */ | ||
| 10895 | gl_state = saved; | 10843 | gl_state = saved; |
| 10896 | UNGCPRO; | 10844 | UNGCPRO; |
| 10897 | } | 10845 | } |
| 10898 | else | 10846 | else |
| 10899 | { /* Else request quit when it's safe. */ | 10847 | { /* Else request quit when it's safe. */ |
| 10900 | if (NILP (Vquit_flag)) | 10848 | int count = NILP (Vquit_flag) ? 1 : force_quit_count + 1; |
| 10901 | force_quit_count = 0; | 10849 | force_quit_count = count; |
| 10902 | if (++force_quit_count == 3) | 10850 | if (count == 3) |
| 10903 | { | 10851 | { |
| 10904 | immediate_quit = 1; | 10852 | immediate_quit = 1; |
| 10905 | Vinhibit_quit = Qnil; | 10853 | Vinhibit_quit = Qnil; |
| @@ -10908,6 +10856,8 @@ handle_interrupt (void) | |||
| 10908 | } | 10856 | } |
| 10909 | } | 10857 | } |
| 10910 | 10858 | ||
| 10859 | pthread_sigmask (SIG_SETMASK, &empty_mask, 0); | ||
| 10860 | |||
| 10911 | /* TODO: The longjmp in this call throws the NS event loop integration off, | 10861 | /* TODO: The longjmp in this call throws the NS event loop integration off, |
| 10912 | and it seems to do fine without this. Probably some attention | 10862 | and it seems to do fine without this. Probably some attention |
| 10913 | needs to be paid to the setting of waiting_for_input in | 10863 | needs to be paid to the setting of waiting_for_input in |
| @@ -10917,7 +10867,7 @@ handle_interrupt (void) | |||
| 10917 | separate event loop thread like W32. */ | 10867 | separate event loop thread like W32. */ |
| 10918 | #ifndef HAVE_NS | 10868 | #ifndef HAVE_NS |
| 10919 | if (waiting_for_input && !echoing) | 10869 | if (waiting_for_input && !echoing) |
| 10920 | quit_throw_to_read_char (1); | 10870 | quit_throw_to_read_char (in_signal_handler); |
| 10921 | #endif | 10871 | #endif |
| 10922 | } | 10872 | } |
| 10923 | 10873 | ||
| @@ -10931,22 +10881,12 @@ quit_throw_to_read_char (int from_signal) | |||
| 10931 | if (!from_signal && EQ (Vquit_flag, Qkill_emacs)) | 10881 | if (!from_signal && EQ (Vquit_flag, Qkill_emacs)) |
| 10932 | Fkill_emacs (Qnil); | 10882 | Fkill_emacs (Qnil); |
| 10933 | 10883 | ||
| 10934 | pthread_sigmask (SIG_SETMASK, &empty_mask, 0); | ||
| 10935 | /* Prevent another signal from doing this before we finish. */ | 10884 | /* Prevent another signal from doing this before we finish. */ |
| 10936 | clear_waiting_for_input (); | 10885 | clear_waiting_for_input (); |
| 10937 | input_pending = 0; | 10886 | input_pending = 0; |
| 10938 | 10887 | ||
| 10939 | Vunread_command_events = Qnil; | 10888 | Vunread_command_events = Qnil; |
| 10940 | 10889 | ||
| 10941 | #if 0 /* Currently, sit_for is called from read_char without turning | ||
| 10942 | off polling. And that can call set_waiting_for_input. | ||
| 10943 | It seems to be harmless. */ | ||
| 10944 | #ifdef POLL_FOR_INPUT | ||
| 10945 | /* May be > 1 if in recursive minibuffer. */ | ||
| 10946 | if (poll_suppress_count == 0) | ||
| 10947 | emacs_abort (); | ||
| 10948 | #endif | ||
| 10949 | #endif | ||
| 10950 | if (FRAMEP (internal_last_event_frame) | 10890 | if (FRAMEP (internal_last_event_frame) |
| 10951 | && !EQ (internal_last_event_frame, selected_frame)) | 10891 | && !EQ (internal_last_event_frame, selected_frame)) |
| 10952 | do_switch_frame (make_lispy_switch_frame (internal_last_event_frame), | 10892 | do_switch_frame (make_lispy_switch_frame (internal_last_event_frame), |
| @@ -11337,7 +11277,6 @@ init_keyboard (void) | |||
| 11337 | #endif | 11277 | #endif |
| 11338 | input_pending = 0; | 11278 | input_pending = 0; |
| 11339 | interrupt_input_blocked = 0; | 11279 | interrupt_input_blocked = 0; |
| 11340 | interrupt_input_pending = 0; | ||
| 11341 | pending_signals = 0; | 11280 | pending_signals = 0; |
| 11342 | 11281 | ||
| 11343 | /* This means that command_loop_1 won't try to select anything the first | 11282 | /* This means that command_loop_1 won't try to select anything the first |
| @@ -11358,7 +11297,7 @@ init_keyboard (void) | |||
| 11358 | /* Before multi-tty support, these handlers used to be installed | 11297 | /* Before multi-tty support, these handlers used to be installed |
| 11359 | only if the current session was a tty session. Now an Emacs | 11298 | only if the current session was a tty session. Now an Emacs |
| 11360 | session may have multiple display types, so we always handle | 11299 | session may have multiple display types, so we always handle |
| 11361 | SIGINT. There is special code in interrupt_signal to exit | 11300 | SIGINT. There is special code in handle_interrupt_signal to exit |
| 11362 | Emacs on SIGINT when there are no termcap frames on the | 11301 | Emacs on SIGINT when there are no termcap frames on the |
| 11363 | controlling terminal. */ | 11302 | controlling terminal. */ |
| 11364 | struct sigaction action; | 11303 | struct sigaction action; |
diff --git a/src/keyboard.h b/src/keyboard.h index 3601f68be9f..bc35bba4ecc 100644 --- a/src/keyboard.h +++ b/src/keyboard.h | |||
| @@ -523,7 +523,7 @@ extern void input_poll_signal (int); | |||
| 523 | extern void start_polling (void); | 523 | extern void start_polling (void); |
| 524 | extern void stop_polling (void); | 524 | extern void stop_polling (void); |
| 525 | extern void set_poll_suppress_count (int); | 525 | extern void set_poll_suppress_count (int); |
| 526 | extern void gobble_input (void); | 526 | extern int gobble_input (void); |
| 527 | extern int input_polling_used (void); | 527 | extern int input_polling_used (void); |
| 528 | extern void clear_input_pending (void); | 528 | extern void clear_input_pending (void); |
| 529 | extern int requeued_events_pending_p (void); | 529 | extern int requeued_events_pending_p (void); |
diff --git a/src/keymap.c b/src/keymap.c index 66fb52061f9..6ea142651bf 100644 --- a/src/keymap.c +++ b/src/keymap.c | |||
| @@ -1477,7 +1477,7 @@ current_minor_maps (Lisp_Object **modeptr, Lisp_Object **mapptr) | |||
| 1477 | 1477 | ||
| 1478 | /* Use malloc here. See the comment above this function. | 1478 | /* Use malloc here. See the comment above this function. |
| 1479 | Avoid realloc here; it causes spurious traps on GNU/Linux [KFS] */ | 1479 | Avoid realloc here; it causes spurious traps on GNU/Linux [KFS] */ |
| 1480 | BLOCK_INPUT; | 1480 | block_input (); |
| 1481 | newmodes = malloc (allocsize); | 1481 | newmodes = malloc (allocsize); |
| 1482 | if (newmodes) | 1482 | if (newmodes) |
| 1483 | { | 1483 | { |
| @@ -1501,7 +1501,7 @@ current_minor_maps (Lisp_Object **modeptr, Lisp_Object **mapptr) | |||
| 1501 | } | 1501 | } |
| 1502 | cmm_maps = newmaps; | 1502 | cmm_maps = newmaps; |
| 1503 | } | 1503 | } |
| 1504 | UNBLOCK_INPUT; | 1504 | unblock_input (); |
| 1505 | 1505 | ||
| 1506 | if (newmodes == NULL || newmaps == NULL) | 1506 | if (newmodes == NULL || newmaps == NULL) |
| 1507 | break; | 1507 | break; |
diff --git a/src/lisp.h b/src/lisp.h index 3a473a60b48..7a23ba6165f 100644 --- a/src/lisp.h +++ b/src/lisp.h | |||
| @@ -25,6 +25,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 25 | #include <stdarg.h> | 25 | #include <stdarg.h> |
| 26 | #include <stdbool.h> | 26 | #include <stdbool.h> |
| 27 | #include <stddef.h> | 27 | #include <stddef.h> |
| 28 | #include <float.h> | ||
| 28 | #include <inttypes.h> | 29 | #include <inttypes.h> |
| 29 | #include <limits.h> | 30 | #include <limits.h> |
| 30 | 31 | ||
| @@ -1487,6 +1488,16 @@ struct Lisp_Float | |||
| 1487 | #define XFLOAT_DATA(f) (0 ? XFLOAT (f)->u.data : XFLOAT (f)->u.data) | 1488 | #define XFLOAT_DATA(f) (0 ? XFLOAT (f)->u.data : XFLOAT (f)->u.data) |
| 1488 | #define XFLOAT_INIT(f, n) (XFLOAT (f)->u.data = (n)) | 1489 | #define XFLOAT_INIT(f, n) (XFLOAT (f)->u.data = (n)) |
| 1489 | 1490 | ||
| 1491 | /* Most hosts nowadays use IEEE floating point, so they use IEC 60559 | ||
| 1492 | representations, have infinities and NaNs, and do not trap on | ||
| 1493 | exceptions. Define IEEE_FLOATING_POINT if this host is one of the | ||
| 1494 | typical ones. The C11 macro __STDC_IEC_559__ is close to what is | ||
| 1495 | wanted here, but is not quite right because Emacs does not require | ||
| 1496 | all the features of C11 Annex F (and does not require C11 at all, | ||
| 1497 | for that matter). */ | ||
| 1498 | #define IEEE_FLOATING_POINT (FLT_RADIX == 2 && FLT_MANT_DIG == 24 \ | ||
| 1499 | && FLT_MIN_EXP == -125 && FLT_MAX_EXP == 128) | ||
| 1500 | |||
| 1490 | /* A character, declared with the following typedef, is a member | 1501 | /* A character, declared with the following typedef, is a member |
| 1491 | of some character set associated with the current buffer. */ | 1502 | of some character set associated with the current buffer. */ |
| 1492 | #ifndef _UCHAR_T /* Protect against something in ctab.h on AIX. */ | 1503 | #ifndef _UCHAR_T /* Protect against something in ctab.h on AIX. */ |
| @@ -2108,7 +2119,7 @@ extern char *stack_bottom; | |||
| 2108 | a request to exit Emacs when it is safe to do. */ | 2119 | a request to exit Emacs when it is safe to do. */ |
| 2109 | 2120 | ||
| 2110 | extern void process_pending_signals (void); | 2121 | extern void process_pending_signals (void); |
| 2111 | extern int pending_signals; | 2122 | extern int volatile pending_signals; |
| 2112 | 2123 | ||
| 2113 | extern void process_quit_flag (void); | 2124 | extern void process_quit_flag (void); |
| 2114 | #define QUIT \ | 2125 | #define QUIT \ |
| @@ -2633,7 +2644,6 @@ extern _Noreturn Lisp_Object wrong_type_argument (Lisp_Object, Lisp_Object); | |||
| 2633 | extern Lisp_Object do_symval_forwarding (union Lisp_Fwd *); | 2644 | extern Lisp_Object do_symval_forwarding (union Lisp_Fwd *); |
| 2634 | extern void set_internal (Lisp_Object, Lisp_Object, Lisp_Object, bool); | 2645 | extern void set_internal (Lisp_Object, Lisp_Object, Lisp_Object, bool); |
| 2635 | extern void syms_of_data (void); | 2646 | extern void syms_of_data (void); |
| 2636 | extern void init_data (void); | ||
| 2637 | extern void swap_in_global_binding (struct Lisp_Symbol *); | 2647 | extern void swap_in_global_binding (struct Lisp_Symbol *); |
| 2638 | 2648 | ||
| 2639 | /* Defined in cmds.c */ | 2649 | /* Defined in cmds.c */ |
| @@ -3227,6 +3237,9 @@ extern int input_pending; | |||
| 3227 | extern Lisp_Object menu_bar_items (Lisp_Object); | 3237 | extern Lisp_Object menu_bar_items (Lisp_Object); |
| 3228 | extern Lisp_Object tool_bar_items (Lisp_Object, int *); | 3238 | extern Lisp_Object tool_bar_items (Lisp_Object, int *); |
| 3229 | extern void discard_mouse_events (void); | 3239 | extern void discard_mouse_events (void); |
| 3240 | #ifdef USABLE_SIGIO | ||
| 3241 | void handle_input_available_signal (int); | ||
| 3242 | #endif | ||
| 3230 | extern Lisp_Object pending_funcalls; | 3243 | extern Lisp_Object pending_funcalls; |
| 3231 | extern int detect_input_pending (void); | 3244 | extern int detect_input_pending (void); |
| 3232 | extern int detect_input_pending_ignore_squeezables (void); | 3245 | extern int detect_input_pending_ignore_squeezables (void); |
| @@ -3269,7 +3282,7 @@ extern bool display_arg; | |||
| 3269 | extern Lisp_Object decode_env_path (const char *, const char *); | 3282 | extern Lisp_Object decode_env_path (const char *, const char *); |
| 3270 | extern Lisp_Object empty_unibyte_string, empty_multibyte_string; | 3283 | extern Lisp_Object empty_unibyte_string, empty_multibyte_string; |
| 3271 | extern Lisp_Object Qfile_name_handler_alist; | 3284 | extern Lisp_Object Qfile_name_handler_alist; |
| 3272 | extern _Noreturn void fatal_error_backtrace (int, int); | 3285 | extern _Noreturn void terminate_due_to_signal (int, int); |
| 3273 | extern Lisp_Object Qkill_emacs; | 3286 | extern Lisp_Object Qkill_emacs; |
| 3274 | #if HAVE_SETLOCALE | 3287 | #if HAVE_SETLOCALE |
| 3275 | void fixup_locale (void); | 3288 | void fixup_locale (void); |
| @@ -3320,6 +3333,7 @@ extern int wait_reading_process_output (intmax_t, int, int, int, | |||
| 3320 | #endif | 3333 | #endif |
| 3321 | extern void add_keyboard_wait_descriptor (int); | 3334 | extern void add_keyboard_wait_descriptor (int); |
| 3322 | extern void delete_keyboard_wait_descriptor (int); | 3335 | extern void delete_keyboard_wait_descriptor (int); |
| 3336 | extern void record_child_status_change (pid_t, int); | ||
| 3323 | #ifdef HAVE_GPM | 3337 | #ifdef HAVE_GPM |
| 3324 | extern void add_gpm_wait_descriptor (int); | 3338 | extern void add_gpm_wait_descriptor (int); |
| 3325 | extern void delete_gpm_wait_descriptor (int); | 3339 | extern void delete_gpm_wait_descriptor (int); |
diff --git a/src/lread.c b/src/lread.c index 08d5f97292b..cb808b37677 100644 --- a/src/lread.c +++ b/src/lread.c | |||
| @@ -408,9 +408,9 @@ unreadchar (Lisp_Object readcharfun, int c) | |||
| 408 | { | 408 | { |
| 409 | if (load_each_byte) | 409 | if (load_each_byte) |
| 410 | { | 410 | { |
| 411 | BLOCK_INPUT; | 411 | block_input (); |
| 412 | ungetc (c, instream); | 412 | ungetc (c, instream); |
| 413 | UNBLOCK_INPUT; | 413 | unblock_input (); |
| 414 | } | 414 | } |
| 415 | else | 415 | else |
| 416 | unread_char = c; | 416 | unread_char = c; |
| @@ -431,28 +431,28 @@ readbyte_from_file (int c, Lisp_Object readcharfun) | |||
| 431 | { | 431 | { |
| 432 | if (c >= 0) | 432 | if (c >= 0) |
| 433 | { | 433 | { |
| 434 | BLOCK_INPUT; | 434 | block_input (); |
| 435 | ungetc (c, instream); | 435 | ungetc (c, instream); |
| 436 | UNBLOCK_INPUT; | 436 | unblock_input (); |
| 437 | return 0; | 437 | return 0; |
| 438 | } | 438 | } |
| 439 | 439 | ||
| 440 | BLOCK_INPUT; | 440 | block_input (); |
| 441 | c = getc (instream); | 441 | c = getc (instream); |
| 442 | 442 | ||
| 443 | #ifdef EINTR | 443 | #ifdef EINTR |
| 444 | /* Interrupted reads have been observed while reading over the network. */ | 444 | /* Interrupted reads have been observed while reading over the network. */ |
| 445 | while (c == EOF && ferror (instream) && errno == EINTR) | 445 | while (c == EOF && ferror (instream) && errno == EINTR) |
| 446 | { | 446 | { |
| 447 | UNBLOCK_INPUT; | 447 | unblock_input (); |
| 448 | QUIT; | 448 | QUIT; |
| 449 | BLOCK_INPUT; | 449 | block_input (); |
| 450 | clearerr (instream); | 450 | clearerr (instream); |
| 451 | c = getc (instream); | 451 | c = getc (instream); |
| 452 | } | 452 | } |
| 453 | #endif | 453 | #endif |
| 454 | 454 | ||
| 455 | UNBLOCK_INPUT; | 455 | unblock_input (); |
| 456 | 456 | ||
| 457 | return (c == EOF ? -1 : c); | 457 | return (c == EOF ? -1 : c); |
| 458 | } | 458 | } |
| @@ -753,9 +753,9 @@ DEFUN ("get-file-char", Fget_file_char, Sget_file_char, 0, 0, 0, | |||
| 753 | (void) | 753 | (void) |
| 754 | { | 754 | { |
| 755 | register Lisp_Object val; | 755 | register Lisp_Object val; |
| 756 | BLOCK_INPUT; | 756 | block_input (); |
| 757 | XSETINT (val, getc (instream)); | 757 | XSETINT (val, getc (instream)); |
| 758 | UNBLOCK_INPUT; | 758 | unblock_input (); |
| 759 | return val; | 759 | return val; |
| 760 | } | 760 | } |
| 761 | 761 | ||
| @@ -1350,9 +1350,9 @@ load_unwind (Lisp_Object arg) /* Used as unwind-protect function in load. */ | |||
| 1350 | FILE *stream = (FILE *) XSAVE_VALUE (arg)->pointer; | 1350 | FILE *stream = (FILE *) XSAVE_VALUE (arg)->pointer; |
| 1351 | if (stream != NULL) | 1351 | if (stream != NULL) |
| 1352 | { | 1352 | { |
| 1353 | BLOCK_INPUT; | 1353 | block_input (); |
| 1354 | fclose (stream); | 1354 | fclose (stream); |
| 1355 | UNBLOCK_INPUT; | 1355 | unblock_input (); |
| 1356 | } | 1356 | } |
| 1357 | return Qnil; | 1357 | return Qnil; |
| 1358 | } | 1358 | } |
diff --git a/src/menu.c b/src/menu.c index 7b01d1faefc..5374aa9157a 100644 --- a/src/menu.c +++ b/src/menu.c | |||
| @@ -573,9 +573,9 @@ xmalloc_widget_value (void) | |||
| 573 | { | 573 | { |
| 574 | widget_value *value; | 574 | widget_value *value; |
| 575 | 575 | ||
| 576 | BLOCK_INPUT; | 576 | block_input (); |
| 577 | value = malloc_widget_value (); | 577 | value = malloc_widget_value (); |
| 578 | UNBLOCK_INPUT; | 578 | unblock_input (); |
| 579 | 579 | ||
| 580 | return value; | 580 | return value; |
| 581 | } | 581 | } |
| @@ -602,9 +602,9 @@ free_menubar_widget_value_tree (widget_value *wv) | |||
| 602 | free_menubar_widget_value_tree (wv->next); | 602 | free_menubar_widget_value_tree (wv->next); |
| 603 | wv->next = (widget_value *) 0xDEADBEEF; | 603 | wv->next = (widget_value *) 0xDEADBEEF; |
| 604 | } | 604 | } |
| 605 | BLOCK_INPUT; | 605 | block_input (); |
| 606 | free_widget_value (wv); | 606 | free_widget_value (wv); |
| 607 | UNBLOCK_INPUT; | 607 | unblock_input (); |
| 608 | } | 608 | } |
| 609 | 609 | ||
| 610 | /* Create a tree of widget_value objects | 610 | /* Create a tree of widget_value objects |
| @@ -1313,7 +1313,7 @@ no quit occurs and `x-popup-menu' returns nil. */) | |||
| 1313 | #endif | 1313 | #endif |
| 1314 | 1314 | ||
| 1315 | /* Display them in a menu. */ | 1315 | /* Display them in a menu. */ |
| 1316 | BLOCK_INPUT; | 1316 | block_input (); |
| 1317 | 1317 | ||
| 1318 | /* FIXME: Use a terminal hook! */ | 1318 | /* FIXME: Use a terminal hook! */ |
| 1319 | #if defined HAVE_NTGUI | 1319 | #if defined HAVE_NTGUI |
| @@ -1332,7 +1332,7 @@ no quit occurs and `x-popup-menu' returns nil. */) | |||
| 1332 | last_event_timestamp); | 1332 | last_event_timestamp); |
| 1333 | #endif | 1333 | #endif |
| 1334 | 1334 | ||
| 1335 | UNBLOCK_INPUT; | 1335 | unblock_input (); |
| 1336 | 1336 | ||
| 1337 | #ifdef HAVE_NS | 1337 | #ifdef HAVE_NS |
| 1338 | unbind_to (specpdl_count, Qnil); | 1338 | unbind_to (specpdl_count, Qnil); |
diff --git a/src/msdos.c b/src/msdos.c index ed5d3240aa1..bac6b977fdf 100644 --- a/src/msdos.c +++ b/src/msdos.c | |||
| @@ -1229,7 +1229,7 @@ IT_update_begin (struct frame *f) | |||
| 1229 | if (display_info->termscript) | 1229 | if (display_info->termscript) |
| 1230 | fprintf (display_info->termscript, "\n\n<UPDATE_BEGIN"); | 1230 | fprintf (display_info->termscript, "\n\n<UPDATE_BEGIN"); |
| 1231 | 1231 | ||
| 1232 | BLOCK_INPUT; | 1232 | block_input (); |
| 1233 | 1233 | ||
| 1234 | if (f && f == mouse_face_frame) | 1234 | if (f && f == mouse_face_frame) |
| 1235 | { | 1235 | { |
| @@ -1279,7 +1279,7 @@ IT_update_begin (struct frame *f) | |||
| 1279 | hlinfo->mouse_face_mouse_frame = NULL; | 1279 | hlinfo->mouse_face_mouse_frame = NULL; |
| 1280 | } | 1280 | } |
| 1281 | 1281 | ||
| 1282 | UNBLOCK_INPUT; | 1282 | unblock_input (); |
| 1283 | } | 1283 | } |
| 1284 | 1284 | ||
| 1285 | static void | 1285 | static void |
| @@ -1302,13 +1302,13 @@ IT_frame_up_to_date (struct frame *f) | |||
| 1302 | if (hlinfo->mouse_face_deferred_gc | 1302 | if (hlinfo->mouse_face_deferred_gc |
| 1303 | || (f && f == hlinfo->mouse_face_mouse_frame)) | 1303 | || (f && f == hlinfo->mouse_face_mouse_frame)) |
| 1304 | { | 1304 | { |
| 1305 | BLOCK_INPUT; | 1305 | block_input (); |
| 1306 | if (hlinfo->mouse_face_mouse_frame) | 1306 | if (hlinfo->mouse_face_mouse_frame) |
| 1307 | note_mouse_highlight (hlinfo->mouse_face_mouse_frame, | 1307 | note_mouse_highlight (hlinfo->mouse_face_mouse_frame, |
| 1308 | hlinfo->mouse_face_mouse_x, | 1308 | hlinfo->mouse_face_mouse_x, |
| 1309 | hlinfo->mouse_face_mouse_y); | 1309 | hlinfo->mouse_face_mouse_y); |
| 1310 | hlinfo->mouse_face_deferred_gc = 0; | 1310 | hlinfo->mouse_face_deferred_gc = 0; |
| 1311 | UNBLOCK_INPUT; | 1311 | unblock_input (); |
| 1312 | } | 1312 | } |
| 1313 | 1313 | ||
| 1314 | /* Set the cursor type to whatever they wanted. In a minibuffer | 1314 | /* Set the cursor type to whatever they wanted. In a minibuffer |
diff --git a/src/nsfns.m b/src/nsfns.m index e2c8c3722c0..94ace360438 100644 --- a/src/nsfns.m +++ b/src/nsfns.m | |||
| @@ -615,7 +615,7 @@ ns_set_name_as_filename (struct frame *f) | |||
| 615 | if (f->explicit_name || ! NILP (f->title) || ns_in_resize) | 615 | if (f->explicit_name || ! NILP (f->title) || ns_in_resize) |
| 616 | return; | 616 | return; |
| 617 | 617 | ||
| 618 | BLOCK_INPUT; | 618 | block_input (); |
| 619 | pool = [[NSAutoreleasePool alloc] init]; | 619 | pool = [[NSAutoreleasePool alloc] init]; |
| 620 | filename = BVAR (XBUFFER (buf), filename); | 620 | filename = BVAR (XBUFFER (buf), filename); |
| 621 | name = BVAR (XBUFFER (buf), name); | 621 | name = BVAR (XBUFFER (buf), name); |
| @@ -640,7 +640,7 @@ ns_set_name_as_filename (struct frame *f) | |||
| 640 | if (title && (! strcmp (title, SSDATA (encoded_name)))) | 640 | if (title && (! strcmp (title, SSDATA (encoded_name)))) |
| 641 | { | 641 | { |
| 642 | [pool release]; | 642 | [pool release]; |
| 643 | UNBLOCK_INPUT; | 643 | unblock_input (); |
| 644 | return; | 644 | return; |
| 645 | } | 645 | } |
| 646 | 646 | ||
| @@ -678,7 +678,7 @@ ns_set_name_as_filename (struct frame *f) | |||
| 678 | } | 678 | } |
| 679 | 679 | ||
| 680 | [pool release]; | 680 | [pool release]; |
| 681 | UNBLOCK_INPUT; | 681 | unblock_input (); |
| 682 | } | 682 | } |
| 683 | 683 | ||
| 684 | 684 | ||
| @@ -689,11 +689,11 @@ ns_set_doc_edited (struct frame *f, Lisp_Object arg) | |||
| 689 | NSAutoreleasePool *pool; | 689 | NSAutoreleasePool *pool; |
| 690 | if (!MINI_WINDOW_P (XWINDOW (f->selected_window))) | 690 | if (!MINI_WINDOW_P (XWINDOW (f->selected_window))) |
| 691 | { | 691 | { |
| 692 | BLOCK_INPUT; | 692 | block_input (); |
| 693 | pool = [[NSAutoreleasePool alloc] init]; | 693 | pool = [[NSAutoreleasePool alloc] init]; |
| 694 | [[view window] setDocumentEdited: !NILP (arg)]; | 694 | [[view window] setDocumentEdited: !NILP (arg)]; |
| 695 | [pool release]; | 695 | [pool release]; |
| 696 | UNBLOCK_INPUT; | 696 | unblock_input (); |
| 697 | } | 697 | } |
| 698 | } | 698 | } |
| 699 | 699 | ||
| @@ -771,14 +771,14 @@ ns_implicitly_set_icon_type (struct frame *f) | |||
| 771 | 771 | ||
| 772 | NSTRACE (ns_implicitly_set_icon_type); | 772 | NSTRACE (ns_implicitly_set_icon_type); |
| 773 | 773 | ||
| 774 | BLOCK_INPUT; | 774 | block_input (); |
| 775 | pool = [[NSAutoreleasePool alloc] init]; | 775 | pool = [[NSAutoreleasePool alloc] init]; |
| 776 | if (f->output_data.ns->miniimage | 776 | if (f->output_data.ns->miniimage |
| 777 | && [[NSString stringWithUTF8String: SSDATA (f->name)] | 777 | && [[NSString stringWithUTF8String: SSDATA (f->name)] |
| 778 | isEqualToString: [(NSImage *)f->output_data.ns->miniimage name]]) | 778 | isEqualToString: [(NSImage *)f->output_data.ns->miniimage name]]) |
| 779 | { | 779 | { |
| 780 | [pool release]; | 780 | [pool release]; |
| 781 | UNBLOCK_INPUT; | 781 | unblock_input (); |
| 782 | return; | 782 | return; |
| 783 | } | 783 | } |
| 784 | 784 | ||
| @@ -786,7 +786,7 @@ ns_implicitly_set_icon_type (struct frame *f) | |||
| 786 | if (CONSP (tem) && ! NILP (XCDR (tem))) | 786 | if (CONSP (tem) && ! NILP (XCDR (tem))) |
| 787 | { | 787 | { |
| 788 | [pool release]; | 788 | [pool release]; |
| 789 | UNBLOCK_INPUT; | 789 | unblock_input (); |
| 790 | return; | 790 | return; |
| 791 | } | 791 | } |
| 792 | 792 | ||
| @@ -826,7 +826,7 @@ ns_implicitly_set_icon_type (struct frame *f) | |||
| 826 | f->output_data.ns->miniimage = image; | 826 | f->output_data.ns->miniimage = image; |
| 827 | [view setMiniwindowImage: setMini]; | 827 | [view setMiniwindowImage: setMini]; |
| 828 | [pool release]; | 828 | [pool release]; |
| 829 | UNBLOCK_INPUT; | 829 | unblock_input (); |
| 830 | } | 830 | } |
| 831 | 831 | ||
| 832 | 832 | ||
| @@ -1232,7 +1232,7 @@ This function is an internal primitive--use `make-frame' instead. */) | |||
| 1232 | f->resx = dpyinfo->resx; | 1232 | f->resx = dpyinfo->resx; |
| 1233 | f->resy = dpyinfo->resy; | 1233 | f->resy = dpyinfo->resy; |
| 1234 | 1234 | ||
| 1235 | BLOCK_INPUT; | 1235 | block_input (); |
| 1236 | register_font_driver (&nsfont_driver, f); | 1236 | register_font_driver (&nsfont_driver, f); |
| 1237 | x_default_parameter (f, parms, Qfont_backend, Qnil, | 1237 | x_default_parameter (f, parms, Qfont_backend, Qnil, |
| 1238 | "fontBackend", "FontBackend", RES_TYPE_STRING); | 1238 | "fontBackend", "FontBackend", RES_TYPE_STRING); |
| @@ -1247,7 +1247,7 @@ This function is an internal primitive--use `make-frame' instead. */) | |||
| 1247 | build_string ([[font fontName] UTF8String]), | 1247 | build_string ([[font fontName] UTF8String]), |
| 1248 | "font", "Font", RES_TYPE_STRING); | 1248 | "font", "Font", RES_TYPE_STRING); |
| 1249 | } | 1249 | } |
| 1250 | UNBLOCK_INPUT; | 1250 | unblock_input (); |
| 1251 | 1251 | ||
| 1252 | x_default_parameter (f, parms, Qborder_width, make_number (0), | 1252 | x_default_parameter (f, parms, Qborder_width, make_number (0), |
| 1253 | "borderwidth", "BorderWidth", RES_TYPE_NUMBER); | 1253 | "borderwidth", "BorderWidth", RES_TYPE_NUMBER); |
| @@ -1411,10 +1411,10 @@ FRAME nil means use the selected frame. */) | |||
| 1411 | if (dpyinfo->x_focus_frame != f) | 1411 | if (dpyinfo->x_focus_frame != f) |
| 1412 | { | 1412 | { |
| 1413 | EmacsView *view = FRAME_NS_VIEW (f); | 1413 | EmacsView *view = FRAME_NS_VIEW (f); |
| 1414 | BLOCK_INPUT; | 1414 | block_input (); |
| 1415 | [NSApp activateIgnoringOtherApps: YES]; | 1415 | [NSApp activateIgnoringOtherApps: YES]; |
| 1416 | [[view window] makeKeyAndOrderFront: view]; | 1416 | [[view window] makeKeyAndOrderFront: view]; |
| 1417 | UNBLOCK_INPUT; | 1417 | unblock_input (); |
| 1418 | } | 1418 | } |
| 1419 | 1419 | ||
| 1420 | return Qnil; | 1420 | return Qnil; |
| @@ -1511,7 +1511,7 @@ Optional arg INIT, if non-nil, provides a default file name to use. */) | |||
| 1511 | [panel setDelegate: fileDelegate]; | 1511 | [panel setDelegate: fileDelegate]; |
| 1512 | 1512 | ||
| 1513 | panelOK = 0; | 1513 | panelOK = 0; |
| 1514 | BLOCK_INPUT; | 1514 | block_input (); |
| 1515 | if (NILP (mustmatch)) | 1515 | if (NILP (mustmatch)) |
| 1516 | { | 1516 | { |
| 1517 | ret = [panel runModalForDirectory: dirS file: initS]; | 1517 | ret = [panel runModalForDirectory: dirS file: initS]; |
| @@ -1528,7 +1528,7 @@ Optional arg INIT, if non-nil, provides a default file name to use. */) | |||
| 1528 | fname = build_string ([[panel filename] UTF8String]); | 1528 | fname = build_string ([[panel filename] UTF8String]); |
| 1529 | 1529 | ||
| 1530 | [[FRAME_NS_VIEW (SELECTED_FRAME ()) window] makeKeyWindow]; | 1530 | [[FRAME_NS_VIEW (SELECTED_FRAME ()) window] makeKeyWindow]; |
| 1531 | UNBLOCK_INPUT; | 1531 | unblock_input (); |
| 1532 | 1532 | ||
| 1533 | return ret ? fname : Qnil; | 1533 | return ret ? fname : Qnil; |
| 1534 | } | 1534 | } |
| @@ -1899,7 +1899,7 @@ The optional argument FRAME is currently ignored. */) | |||
| 1899 | error ("non-Nextstep frame used in `ns-list-colors'"); | 1899 | error ("non-Nextstep frame used in `ns-list-colors'"); |
| 1900 | } | 1900 | } |
| 1901 | 1901 | ||
| 1902 | BLOCK_INPUT; | 1902 | block_input (); |
| 1903 | 1903 | ||
| 1904 | colorlists = [[NSColorList availableColorLists] objectEnumerator]; | 1904 | colorlists = [[NSColorList availableColorLists] objectEnumerator]; |
| 1905 | while ((clist = [colorlists nextObject])) | 1905 | while ((clist = [colorlists nextObject])) |
| @@ -1917,7 +1917,7 @@ The optional argument FRAME is currently ignored. */) | |||
| 1917 | } | 1917 | } |
| 1918 | } | 1918 | } |
| 1919 | 1919 | ||
| 1920 | UNBLOCK_INPUT; | 1920 | unblock_input (); |
| 1921 | 1921 | ||
| 1922 | return list; | 1922 | return list; |
| 1923 | } | 1923 | } |
| @@ -2115,7 +2115,7 @@ In case the execution fails, an error is signaled. */) | |||
| 2115 | CHECK_STRING (script); | 2115 | CHECK_STRING (script); |
| 2116 | check_ns (); | 2116 | check_ns (); |
| 2117 | 2117 | ||
| 2118 | BLOCK_INPUT; | 2118 | block_input (); |
| 2119 | 2119 | ||
| 2120 | as_script = script; | 2120 | as_script = script; |
| 2121 | as_result = &result; | 2121 | as_result = &result; |
| @@ -2141,7 +2141,7 @@ In case the execution fails, an error is signaled. */) | |||
| 2141 | as_status = 0; | 2141 | as_status = 0; |
| 2142 | as_script = Qnil; | 2142 | as_script = Qnil; |
| 2143 | as_result = 0; | 2143 | as_result = 0; |
| 2144 | UNBLOCK_INPUT; | 2144 | unblock_input (); |
| 2145 | if (status == 0) | 2145 | if (status == 0) |
| 2146 | return result; | 2146 | return result; |
| 2147 | else if (!STRINGP (result)) | 2147 | else if (!STRINGP (result)) |
| @@ -2548,7 +2548,7 @@ Text larger than the specified size is clipped. */) | |||
| 2548 | else | 2548 | else |
| 2549 | CHECK_NUMBER (dy); | 2549 | CHECK_NUMBER (dy); |
| 2550 | 2550 | ||
| 2551 | BLOCK_INPUT; | 2551 | block_input (); |
| 2552 | if (ns_tooltip == nil) | 2552 | if (ns_tooltip == nil) |
| 2553 | ns_tooltip = [[EmacsTooltip alloc] init]; | 2553 | ns_tooltip = [[EmacsTooltip alloc] init]; |
| 2554 | else | 2554 | else |
| @@ -2563,7 +2563,7 @@ Text larger than the specified size is clipped. */) | |||
| 2563 | &root_x, &root_y); | 2563 | &root_x, &root_y); |
| 2564 | 2564 | ||
| 2565 | [ns_tooltip showAtX: root_x Y: root_y for: XINT (timeout)]; | 2565 | [ns_tooltip showAtX: root_x Y: root_y for: XINT (timeout)]; |
| 2566 | UNBLOCK_INPUT; | 2566 | unblock_input (); |
| 2567 | 2567 | ||
| 2568 | UNGCPRO; | 2568 | UNGCPRO; |
| 2569 | return unbind_to (count, Qnil); | 2569 | return unbind_to (count, Qnil); |
diff --git a/src/nsfont.m b/src/nsfont.m index eba1eb04765..b13c96aa6ed 100644 --- a/src/nsfont.m +++ b/src/nsfont.m | |||
| @@ -821,7 +821,7 @@ nsfont_open (FRAME_PTR f, Lisp_Object font_entity, int pixel_size) | |||
| 821 | font_info->glyphs = xzalloc (0x100 * sizeof *font_info->glyphs); | 821 | font_info->glyphs = xzalloc (0x100 * sizeof *font_info->glyphs); |
| 822 | font_info->metrics = xzalloc (0x100 * sizeof *font_info->metrics); | 822 | font_info->metrics = xzalloc (0x100 * sizeof *font_info->metrics); |
| 823 | 823 | ||
| 824 | BLOCK_INPUT; | 824 | block_input (); |
| 825 | 825 | ||
| 826 | /* for metrics */ | 826 | /* for metrics */ |
| 827 | sfont = [nsfont screenFont]; | 827 | sfont = [nsfont screenFont]; |
| @@ -932,7 +932,7 @@ nsfont_open (FRAME_PTR f, Lisp_Object font_entity, int pixel_size) | |||
| 932 | font->props[FONT_FULLNAME_INDEX] = | 932 | font->props[FONT_FULLNAME_INDEX] = |
| 933 | make_unibyte_string (font_info->name, strlen (font_info->name)); | 933 | make_unibyte_string (font_info->name, strlen (font_info->name)); |
| 934 | } | 934 | } |
| 935 | UNBLOCK_INPUT; | 935 | unblock_input (); |
| 936 | 936 | ||
| 937 | return font_object; | 937 | return font_object; |
| 938 | } | 938 | } |
| @@ -1316,7 +1316,7 @@ ns_uni_to_glyphs (struct nsfont_info *font_info, unsigned char block) | |||
| 1316 | fprintf (stderr, "%p\tFinding glyphs for glyphs in block %d\n", | 1316 | fprintf (stderr, "%p\tFinding glyphs for glyphs in block %d\n", |
| 1317 | font_info, block); | 1317 | font_info, block); |
| 1318 | 1318 | ||
| 1319 | BLOCK_INPUT; | 1319 | block_input (); |
| 1320 | 1320 | ||
| 1321 | #ifdef NS_IMPL_COCOA | 1321 | #ifdef NS_IMPL_COCOA |
| 1322 | if (firstTime) | 1322 | if (firstTime) |
| @@ -1373,7 +1373,7 @@ ns_uni_to_glyphs (struct nsfont_info *font_info, unsigned char block) | |||
| 1373 | #endif | 1373 | #endif |
| 1374 | } | 1374 | } |
| 1375 | 1375 | ||
| 1376 | UNBLOCK_INPUT; | 1376 | unblock_input (); |
| 1377 | xfree (unichars); | 1377 | xfree (unichars); |
| 1378 | } | 1378 | } |
| 1379 | 1379 | ||
| @@ -1398,7 +1398,7 @@ ns_glyph_metrics (struct nsfont_info *font_info, unsigned char block) | |||
| 1398 | numGlyphs = 0x10000; | 1398 | numGlyphs = 0x10000; |
| 1399 | #endif | 1399 | #endif |
| 1400 | 1400 | ||
| 1401 | BLOCK_INPUT; | 1401 | block_input (); |
| 1402 | sfont = [font_info->nsfont screenFont]; | 1402 | sfont = [font_info->nsfont screenFont]; |
| 1403 | 1403 | ||
| 1404 | font_info->metrics[block] = xzalloc (0x100 * sizeof (struct font_metrics)); | 1404 | font_info->metrics[block] = xzalloc (0x100 * sizeof (struct font_metrics)); |
| @@ -1427,7 +1427,7 @@ ns_glyph_metrics (struct nsfont_info *font_info, unsigned char block) | |||
| 1427 | metrics->ascent = r.size.height - metrics->descent; | 1427 | metrics->ascent = r.size.height - metrics->descent; |
| 1428 | /*-lrint (hshrink* [sfont descender] - expand * hd/2); */ | 1428 | /*-lrint (hshrink* [sfont descender] - expand * hd/2); */ |
| 1429 | } | 1429 | } |
| 1430 | UNBLOCK_INPUT; | 1430 | unblock_input (); |
| 1431 | } | 1431 | } |
| 1432 | 1432 | ||
| 1433 | 1433 | ||
diff --git a/src/nsmenu.m b/src/nsmenu.m index 907d3eac622..ed5e76cad0d 100644 --- a/src/nsmenu.m +++ b/src/nsmenu.m | |||
| @@ -146,7 +146,7 @@ ns_update_menubar (struct frame *f, int deep_p, EmacsMenu *submenu) | |||
| 146 | XSETFRAME (Vmenu_updating_frame, f); | 146 | XSETFRAME (Vmenu_updating_frame, f); |
| 147 | /*fprintf (stderr, "ns_update_menubar: frame: %p\tdeep: %d\tsub: %p\n", f, deep_p, submenu); */ | 147 | /*fprintf (stderr, "ns_update_menubar: frame: %p\tdeep: %d\tsub: %p\n", f, deep_p, submenu); */ |
| 148 | 148 | ||
| 149 | BLOCK_INPUT; | 149 | block_input (); |
| 150 | pool = [[NSAutoreleasePool alloc] init]; | 150 | pool = [[NSAutoreleasePool alloc] init]; |
| 151 | 151 | ||
| 152 | /* Menu may have been created automatically; if so, discard it. */ | 152 | /* Menu may have been created automatically; if so, discard it. */ |
| @@ -271,7 +271,7 @@ ns_update_menubar (struct frame *f, int deep_p, EmacsMenu *submenu) | |||
| 271 | discard_menu_items (); | 271 | discard_menu_items (); |
| 272 | unbind_to (specpdl_count, Qnil); | 272 | unbind_to (specpdl_count, Qnil); |
| 273 | [pool release]; | 273 | [pool release]; |
| 274 | UNBLOCK_INPUT; | 274 | unblock_input (); |
| 275 | return; | 275 | return; |
| 276 | } | 276 | } |
| 277 | 277 | ||
| @@ -333,7 +333,7 @@ ns_update_menubar (struct frame *f, int deep_p, EmacsMenu *submenu) | |||
| 333 | discard_menu_items (); | 333 | discard_menu_items (); |
| 334 | unbind_to (specpdl_count, Qnil); | 334 | unbind_to (specpdl_count, Qnil); |
| 335 | [pool release]; | 335 | [pool release]; |
| 336 | UNBLOCK_INPUT; | 336 | unblock_input (); |
| 337 | return; | 337 | return; |
| 338 | } | 338 | } |
| 339 | } | 339 | } |
| @@ -404,7 +404,7 @@ ns_update_menubar (struct frame *f, int deep_p, EmacsMenu *submenu) | |||
| 404 | { | 404 | { |
| 405 | free_menubar_widget_value_tree (first_wv); | 405 | free_menubar_widget_value_tree (first_wv); |
| 406 | [pool release]; | 406 | [pool release]; |
| 407 | UNBLOCK_INPUT; | 407 | unblock_input (); |
| 408 | return; | 408 | return; |
| 409 | } | 409 | } |
| 410 | 410 | ||
| @@ -435,7 +435,7 @@ ns_update_menubar (struct frame *f, int deep_p, EmacsMenu *submenu) | |||
| 435 | { | 435 | { |
| 436 | free_menubar_widget_value_tree (first_wv); | 436 | free_menubar_widget_value_tree (first_wv); |
| 437 | [pool release]; | 437 | [pool release]; |
| 438 | UNBLOCK_INPUT; | 438 | unblock_input (); |
| 439 | return; | 439 | return; |
| 440 | } | 440 | } |
| 441 | } | 441 | } |
| @@ -498,7 +498,7 @@ ns_update_menubar (struct frame *f, int deep_p, EmacsMenu *submenu) | |||
| 498 | [NSApp setMainMenu: menu]; | 498 | [NSApp setMainMenu: menu]; |
| 499 | 499 | ||
| 500 | [pool release]; | 500 | [pool release]; |
| 501 | UNBLOCK_INPUT; | 501 | unblock_input (); |
| 502 | 502 | ||
| 503 | } | 503 | } |
| 504 | 504 | ||
| @@ -1012,10 +1012,10 @@ free_frame_tool_bar (FRAME_PTR f) | |||
| 1012 | Under NS we just hide the toolbar until it might be needed again. | 1012 | Under NS we just hide the toolbar until it might be needed again. |
| 1013 | -------------------------------------------------------------------------- */ | 1013 | -------------------------------------------------------------------------- */ |
| 1014 | { | 1014 | { |
| 1015 | BLOCK_INPUT; | 1015 | block_input (); |
| 1016 | [[FRAME_NS_VIEW (f) toolbar] setVisible: NO]; | 1016 | [[FRAME_NS_VIEW (f) toolbar] setVisible: NO]; |
| 1017 | FRAME_TOOLBAR_HEIGHT (f) = 0; | 1017 | FRAME_TOOLBAR_HEIGHT (f) = 0; |
| 1018 | UNBLOCK_INPUT; | 1018 | unblock_input (); |
| 1019 | } | 1019 | } |
| 1020 | 1020 | ||
| 1021 | void | 1021 | void |
| @@ -1029,7 +1029,7 @@ update_frame_tool_bar (FRAME_PTR f) | |||
| 1029 | NSWindow *window = [view window]; | 1029 | NSWindow *window = [view window]; |
| 1030 | EmacsToolbar *toolbar = [view toolbar]; | 1030 | EmacsToolbar *toolbar = [view toolbar]; |
| 1031 | 1031 | ||
| 1032 | BLOCK_INPUT; | 1032 | block_input (); |
| 1033 | [toolbar clearActive]; | 1033 | [toolbar clearActive]; |
| 1034 | 1034 | ||
| 1035 | /* update EmacsToolbar as in GtkUtils, build items list */ | 1035 | /* update EmacsToolbar as in GtkUtils, build items list */ |
| @@ -1115,7 +1115,7 @@ update_frame_tool_bar (FRAME_PTR f) | |||
| 1115 | FRAME_TOOLBAR_HEIGHT (f) = | 1115 | FRAME_TOOLBAR_HEIGHT (f) = |
| 1116 | NSHeight ([window frameRectForContentRect: NSMakeRect (0, 0, 0, 0)]) | 1116 | NSHeight ([window frameRectForContentRect: NSMakeRect (0, 0, 0, 0)]) |
| 1117 | - FRAME_NS_TITLEBAR_HEIGHT (f); | 1117 | - FRAME_NS_TITLEBAR_HEIGHT (f); |
| 1118 | UNBLOCK_INPUT; | 1118 | unblock_input (); |
| 1119 | } | 1119 | } |
| 1120 | 1120 | ||
| 1121 | 1121 | ||
| @@ -1355,7 +1355,7 @@ pop_down_menu (Lisp_Object arg) | |||
| 1355 | struct Lisp_Save_Value *p = XSAVE_VALUE (arg); | 1355 | struct Lisp_Save_Value *p = XSAVE_VALUE (arg); |
| 1356 | struct Popdown_data *unwind_data = (struct Popdown_data *) p->pointer; | 1356 | struct Popdown_data *unwind_data = (struct Popdown_data *) p->pointer; |
| 1357 | 1357 | ||
| 1358 | BLOCK_INPUT; | 1358 | block_input (); |
| 1359 | if (popup_activated_flag) | 1359 | if (popup_activated_flag) |
| 1360 | { | 1360 | { |
| 1361 | EmacsDialogPanel *panel = unwind_data->dialog; | 1361 | EmacsDialogPanel *panel = unwind_data->dialog; |
| @@ -1366,7 +1366,7 @@ pop_down_menu (Lisp_Object arg) | |||
| 1366 | } | 1366 | } |
| 1367 | 1367 | ||
| 1368 | xfree (unwind_data); | 1368 | xfree (unwind_data); |
| 1369 | UNBLOCK_INPUT; | 1369 | unblock_input (); |
| 1370 | 1370 | ||
| 1371 | return Qnil; | 1371 | return Qnil; |
| 1372 | } | 1372 | } |
| @@ -1434,7 +1434,7 @@ ns_popup_dialog (Lisp_Object position, Lisp_Object contents, Lisp_Object header) | |||
| 1434 | the dialog. */ | 1434 | the dialog. */ |
| 1435 | contents = Fcons (title, Fcons (Fcons (build_string ("Ok"), Qt), Qnil)); | 1435 | contents = Fcons (title, Fcons (Fcons (build_string ("Ok"), Qt), Qnil)); |
| 1436 | 1436 | ||
| 1437 | BLOCK_INPUT; | 1437 | block_input (); |
| 1438 | pool = [[NSAutoreleasePool alloc] init]; | 1438 | pool = [[NSAutoreleasePool alloc] init]; |
| 1439 | dialog = [[EmacsDialogPanel alloc] initFromContents: contents | 1439 | dialog = [[EmacsDialogPanel alloc] initFromContents: contents |
| 1440 | isQuestion: isQ]; | 1440 | isQuestion: isQ]; |
| @@ -1452,7 +1452,7 @@ ns_popup_dialog (Lisp_Object position, Lisp_Object contents, Lisp_Object header) | |||
| 1452 | unbind_to (specpdl_count, Qnil); /* calls pop_down_menu */ | 1452 | unbind_to (specpdl_count, Qnil); /* calls pop_down_menu */ |
| 1453 | } | 1453 | } |
| 1454 | 1454 | ||
| 1455 | UNBLOCK_INPUT; | 1455 | unblock_input (); |
| 1456 | 1456 | ||
| 1457 | return tem; | 1457 | return tem; |
| 1458 | } | 1458 | } |
diff --git a/src/nsterm.m b/src/nsterm.m index a31b0127d89..cd9358f5582 100644 --- a/src/nsterm.m +++ b/src/nsterm.m | |||
| @@ -581,7 +581,7 @@ ns_update_auto_hide_menu_bar (void) | |||
| 581 | #endif | 581 | #endif |
| 582 | #ifdef NS_IMPL_COCOA | 582 | #ifdef NS_IMPL_COCOA |
| 583 | #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6 | 583 | #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6 |
| 584 | BLOCK_INPUT; | 584 | block_input (); |
| 585 | 585 | ||
| 586 | NSTRACE (ns_update_auto_hide_menu_bar); | 586 | NSTRACE (ns_update_auto_hide_menu_bar); |
| 587 | 587 | ||
| @@ -612,7 +612,7 @@ ns_update_auto_hide_menu_bar (void) | |||
| 612 | } | 612 | } |
| 613 | } | 613 | } |
| 614 | 614 | ||
| 615 | UNBLOCK_INPUT; | 615 | unblock_input (); |
| 616 | #endif | 616 | #endif |
| 617 | #endif | 617 | #endif |
| 618 | } | 618 | } |
| @@ -662,7 +662,7 @@ ns_update_window_begin (struct window *w) | |||
| 662 | updated_window = w; | 662 | updated_window = w; |
| 663 | set_output_cursor (&w->cursor); | 663 | set_output_cursor (&w->cursor); |
| 664 | 664 | ||
| 665 | BLOCK_INPUT; | 665 | block_input (); |
| 666 | 666 | ||
| 667 | if (f == hlinfo->mouse_face_mouse_frame) | 667 | if (f == hlinfo->mouse_face_mouse_frame) |
| 668 | { | 668 | { |
| @@ -677,7 +677,7 @@ ns_update_window_begin (struct window *w) | |||
| 677 | /* (further code for mouse faces ifdef'd out in other terms elided) */ | 677 | /* (further code for mouse faces ifdef'd out in other terms elided) */ |
| 678 | } | 678 | } |
| 679 | 679 | ||
| 680 | UNBLOCK_INPUT; | 680 | unblock_input (); |
| 681 | } | 681 | } |
| 682 | 682 | ||
| 683 | 683 | ||
| @@ -694,7 +694,7 @@ ns_update_window_end (struct window *w, int cursor_on_p, | |||
| 694 | /* note: this fn is nearly identical in all terms */ | 694 | /* note: this fn is nearly identical in all terms */ |
| 695 | if (!w->pseudo_window_p) | 695 | if (!w->pseudo_window_p) |
| 696 | { | 696 | { |
| 697 | BLOCK_INPUT; | 697 | block_input (); |
| 698 | 698 | ||
| 699 | if (cursor_on_p) | 699 | if (cursor_on_p) |
| 700 | display_and_set_cursor (w, 1, | 700 | display_and_set_cursor (w, 1, |
| @@ -704,7 +704,7 @@ ns_update_window_end (struct window *w, int cursor_on_p, | |||
| 704 | if (draw_window_fringes (w, 1)) | 704 | if (draw_window_fringes (w, 1)) |
| 705 | x_draw_vertical_border (w); | 705 | x_draw_vertical_border (w); |
| 706 | 706 | ||
| 707 | UNBLOCK_INPUT; | 707 | unblock_input (); |
| 708 | } | 708 | } |
| 709 | 709 | ||
| 710 | /* If a row with mouse-face was overwritten, arrange for | 710 | /* If a row with mouse-face was overwritten, arrange for |
| @@ -733,7 +733,7 @@ ns_update_end (struct frame *f) | |||
| 733 | /* if (f == MOUSE_HL_INFO (f)->mouse_face_mouse_frame) */ | 733 | /* if (f == MOUSE_HL_INFO (f)->mouse_face_mouse_frame) */ |
| 734 | MOUSE_HL_INFO (f)->mouse_face_defer = 0; | 734 | MOUSE_HL_INFO (f)->mouse_face_defer = 0; |
| 735 | 735 | ||
| 736 | BLOCK_INPUT; | 736 | block_input (); |
| 737 | 737 | ||
| 738 | #ifdef NS_IMPL_GNUSTEP | 738 | #ifdef NS_IMPL_GNUSTEP |
| 739 | /* trigger flush only in the rectangle we tracked as being drawn */ | 739 | /* trigger flush only in the rectangle we tracked as being drawn */ |
| @@ -745,7 +745,7 @@ ns_update_end (struct frame *f) | |||
| 745 | [view unlockFocus]; | 745 | [view unlockFocus]; |
| 746 | [[view window] flushWindow]; | 746 | [[view window] flushWindow]; |
| 747 | 747 | ||
| 748 | UNBLOCK_INPUT; | 748 | unblock_input (); |
| 749 | ns_updating_frame = NULL; | 749 | ns_updating_frame = NULL; |
| 750 | NSTRACE (ns_update_end); | 750 | NSTRACE (ns_update_end); |
| 751 | } | 751 | } |
| @@ -902,7 +902,7 @@ ns_ring_bell (struct frame *f) | |||
| 902 | struct frame *frame = SELECTED_FRAME (); | 902 | struct frame *frame = SELECTED_FRAME (); |
| 903 | NSView *view; | 903 | NSView *view; |
| 904 | 904 | ||
| 905 | BLOCK_INPUT; | 905 | block_input (); |
| 906 | pool = [[NSAutoreleasePool alloc] init]; | 906 | pool = [[NSAutoreleasePool alloc] init]; |
| 907 | 907 | ||
| 908 | view = FRAME_NS_VIEW (frame); | 908 | view = FRAME_NS_VIEW (frame); |
| @@ -929,7 +929,7 @@ ns_ring_bell (struct frame *f) | |||
| 929 | ns_unfocus (frame); | 929 | ns_unfocus (frame); |
| 930 | } | 930 | } |
| 931 | [pool release]; | 931 | [pool release]; |
| 932 | UNBLOCK_INPUT; | 932 | unblock_input (); |
| 933 | } | 933 | } |
| 934 | else | 934 | else |
| 935 | { | 935 | { |
| @@ -970,13 +970,13 @@ ns_raise_frame (struct frame *f) | |||
| 970 | { | 970 | { |
| 971 | NSView *view = FRAME_NS_VIEW (f); | 971 | NSView *view = FRAME_NS_VIEW (f); |
| 972 | check_ns (); | 972 | check_ns (); |
| 973 | BLOCK_INPUT; | 973 | block_input (); |
| 974 | FRAME_SAMPLE_VISIBILITY (f); | 974 | FRAME_SAMPLE_VISIBILITY (f); |
| 975 | if (FRAME_VISIBLE_P (f)) | 975 | if (FRAME_VISIBLE_P (f)) |
| 976 | { | 976 | { |
| 977 | [[view window] makeKeyAndOrderFront: NSApp]; | 977 | [[view window] makeKeyAndOrderFront: NSApp]; |
| 978 | } | 978 | } |
| 979 | UNBLOCK_INPUT; | 979 | unblock_input (); |
| 980 | } | 980 | } |
| 981 | 981 | ||
| 982 | 982 | ||
| @@ -988,9 +988,9 @@ ns_lower_frame (struct frame *f) | |||
| 988 | { | 988 | { |
| 989 | NSView *view = FRAME_NS_VIEW (f); | 989 | NSView *view = FRAME_NS_VIEW (f); |
| 990 | check_ns (); | 990 | check_ns (); |
| 991 | BLOCK_INPUT; | 991 | block_input (); |
| 992 | [[view window] orderBack: NSApp]; | 992 | [[view window] orderBack: NSApp]; |
| 993 | UNBLOCK_INPUT; | 993 | unblock_input (); |
| 994 | } | 994 | } |
| 995 | 995 | ||
| 996 | 996 | ||
| @@ -1126,7 +1126,7 @@ x_free_frame_resources (struct frame *f) | |||
| 1126 | 1126 | ||
| 1127 | [(EmacsView *)view setWindowClosing: YES]; /* may not have been informed */ | 1127 | [(EmacsView *)view setWindowClosing: YES]; /* may not have been informed */ |
| 1128 | 1128 | ||
| 1129 | BLOCK_INPUT; | 1129 | block_input (); |
| 1130 | 1130 | ||
| 1131 | free_frame_menubar (f); | 1131 | free_frame_menubar (f); |
| 1132 | 1132 | ||
| @@ -1154,7 +1154,7 @@ x_free_frame_resources (struct frame *f) | |||
| 1154 | 1154 | ||
| 1155 | xfree (f->output_data.ns); | 1155 | xfree (f->output_data.ns); |
| 1156 | 1156 | ||
| 1157 | UNBLOCK_INPUT; | 1157 | unblock_input (); |
| 1158 | } | 1158 | } |
| 1159 | 1159 | ||
| 1160 | void | 1160 | void |
| @@ -1183,7 +1183,7 @@ x_set_offset (struct frame *f, int xoff, int yoff, int change_grav) | |||
| 1183 | 1183 | ||
| 1184 | NSTRACE (x_set_offset); | 1184 | NSTRACE (x_set_offset); |
| 1185 | 1185 | ||
| 1186 | BLOCK_INPUT; | 1186 | block_input (); |
| 1187 | 1187 | ||
| 1188 | f->left_pos = xoff; | 1188 | f->left_pos = xoff; |
| 1189 | f->top_pos = yoff; | 1189 | f->top_pos = yoff; |
| @@ -1215,7 +1215,7 @@ x_set_offset (struct frame *f, int xoff, int yoff, int change_grav) | |||
| 1215 | f->size_hint_flags &= ~(XNegative|YNegative); | 1215 | f->size_hint_flags &= ~(XNegative|YNegative); |
| 1216 | } | 1216 | } |
| 1217 | 1217 | ||
| 1218 | UNBLOCK_INPUT; | 1218 | unblock_input (); |
| 1219 | } | 1219 | } |
| 1220 | 1220 | ||
| 1221 | 1221 | ||
| @@ -1240,7 +1240,7 @@ x_set_window_size (struct frame *f, int change_grav, int cols, int rows) | |||
| 1240 | 1240 | ||
| 1241 | /*fprintf (stderr, "\tsetWindowSize: %d x %d, font size %d x %d\n", cols, rows, FRAME_COLUMN_WIDTH (f), FRAME_LINE_HEIGHT (f)); */ | 1241 | /*fprintf (stderr, "\tsetWindowSize: %d x %d, font size %d x %d\n", cols, rows, FRAME_COLUMN_WIDTH (f), FRAME_LINE_HEIGHT (f)); */ |
| 1242 | 1242 | ||
| 1243 | BLOCK_INPUT; | 1243 | block_input (); |
| 1244 | 1244 | ||
| 1245 | check_frame_size (f, &rows, &cols); | 1245 | check_frame_size (f, &rows, &cols); |
| 1246 | 1246 | ||
| @@ -1302,7 +1302,7 @@ x_set_window_size (struct frame *f, int change_grav, int cols, int rows) | |||
| 1302 | mark_window_cursors_off (XWINDOW (f->root_window)); | 1302 | mark_window_cursors_off (XWINDOW (f->root_window)); |
| 1303 | cancel_mouse_face (f); | 1303 | cancel_mouse_face (f); |
| 1304 | 1304 | ||
| 1305 | UNBLOCK_INPUT; | 1305 | unblock_input (); |
| 1306 | } | 1306 | } |
| 1307 | 1307 | ||
| 1308 | 1308 | ||
| @@ -1414,7 +1414,7 @@ ns_get_color (const char *name, NSColor **col) | |||
| 1414 | NSString *nsname = [NSString stringWithUTF8String: name]; | 1414 | NSString *nsname = [NSString stringWithUTF8String: name]; |
| 1415 | 1415 | ||
| 1416 | /*fprintf (stderr, "ns_get_color: '%s'\n", name); */ | 1416 | /*fprintf (stderr, "ns_get_color: '%s'\n", name); */ |
| 1417 | BLOCK_INPUT; | 1417 | block_input (); |
| 1418 | 1418 | ||
| 1419 | if ([nsname isEqualToString: @"ns_selection_color"]) | 1419 | if ([nsname isEqualToString: @"ns_selection_color"]) |
| 1420 | { | 1420 | { |
| @@ -1461,7 +1461,7 @@ ns_get_color (const char *name, NSColor **col) | |||
| 1461 | if (r >= 0.0) | 1461 | if (r >= 0.0) |
| 1462 | { | 1462 | { |
| 1463 | *col = [NSColor colorWithCalibratedRed: r green: g blue: b alpha: 1.0]; | 1463 | *col = [NSColor colorWithCalibratedRed: r green: g blue: b alpha: 1.0]; |
| 1464 | UNBLOCK_INPUT; | 1464 | unblock_input (); |
| 1465 | return 0; | 1465 | return 0; |
| 1466 | } | 1466 | } |
| 1467 | 1467 | ||
| @@ -1493,7 +1493,7 @@ ns_get_color (const char *name, NSColor **col) | |||
| 1493 | 1493 | ||
| 1494 | if (new) | 1494 | if (new) |
| 1495 | *col = [new colorUsingColorSpaceName: NSCalibratedRGBColorSpace]; | 1495 | *col = [new colorUsingColorSpaceName: NSCalibratedRGBColorSpace]; |
| 1496 | UNBLOCK_INPUT; | 1496 | unblock_input (); |
| 1497 | return new ? 0 : 1; | 1497 | return new ? 0 : 1; |
| 1498 | } | 1498 | } |
| 1499 | 1499 | ||
| @@ -1524,12 +1524,12 @@ ns_color_to_lisp (NSColor *col) | |||
| 1524 | const char *str; | 1524 | const char *str; |
| 1525 | NSTRACE (ns_color_to_lisp); | 1525 | NSTRACE (ns_color_to_lisp); |
| 1526 | 1526 | ||
| 1527 | BLOCK_INPUT; | 1527 | block_input (); |
| 1528 | if ([[col colorSpaceName] isEqualToString: NSNamedColorSpace]) | 1528 | if ([[col colorSpaceName] isEqualToString: NSNamedColorSpace]) |
| 1529 | 1529 | ||
| 1530 | if ((str =[[col colorNameComponent] UTF8String])) | 1530 | if ((str =[[col colorNameComponent] UTF8String])) |
| 1531 | { | 1531 | { |
| 1532 | UNBLOCK_INPUT; | 1532 | unblock_input (); |
| 1533 | return build_string ((char *)str); | 1533 | return build_string ((char *)str); |
| 1534 | } | 1534 | } |
| 1535 | 1535 | ||
| @@ -1541,14 +1541,14 @@ ns_color_to_lisp (NSColor *col) | |||
| 1541 | getWhite: &gray alpha: &alpha]; | 1541 | getWhite: &gray alpha: &alpha]; |
| 1542 | snprintf (buf, sizeof (buf), "#%2.2lx%2.2lx%2.2lx", | 1542 | snprintf (buf, sizeof (buf), "#%2.2lx%2.2lx%2.2lx", |
| 1543 | lrint (gray * 0xff), lrint (gray * 0xff), lrint (gray * 0xff)); | 1543 | lrint (gray * 0xff), lrint (gray * 0xff), lrint (gray * 0xff)); |
| 1544 | UNBLOCK_INPUT; | 1544 | unblock_input (); |
| 1545 | return build_string (buf); | 1545 | return build_string (buf); |
| 1546 | } | 1546 | } |
| 1547 | 1547 | ||
| 1548 | snprintf (buf, sizeof (buf), "#%2.2lx%2.2lx%2.2lx", | 1548 | snprintf (buf, sizeof (buf), "#%2.2lx%2.2lx%2.2lx", |
| 1549 | lrint (red*0xff), lrint (green*0xff), lrint (blue*0xff)); | 1549 | lrint (red*0xff), lrint (green*0xff), lrint (blue*0xff)); |
| 1550 | 1550 | ||
| 1551 | UNBLOCK_INPUT; | 1551 | unblock_input (); |
| 1552 | return build_string (buf); | 1552 | return build_string (buf); |
| 1553 | } | 1553 | } |
| 1554 | 1554 | ||
| @@ -1592,16 +1592,16 @@ ns_defined_color (struct frame *f, | |||
| 1592 | NSColor *col; | 1592 | NSColor *col; |
| 1593 | NSTRACE (ns_defined_color); | 1593 | NSTRACE (ns_defined_color); |
| 1594 | 1594 | ||
| 1595 | BLOCK_INPUT; | 1595 | block_input (); |
| 1596 | if (ns_get_color (name, &col) != 0) /* Color not found */ | 1596 | if (ns_get_color (name, &col) != 0) /* Color not found */ |
| 1597 | { | 1597 | { |
| 1598 | UNBLOCK_INPUT; | 1598 | unblock_input (); |
| 1599 | return 0; | 1599 | return 0; |
| 1600 | } | 1600 | } |
| 1601 | if (makeIndex && alloc) | 1601 | if (makeIndex && alloc) |
| 1602 | color_def->pixel = ns_index_color (col, f); | 1602 | color_def->pixel = ns_index_color (col, f); |
| 1603 | ns_query_color (col, color_def, !makeIndex); | 1603 | ns_query_color (col, color_def, !makeIndex); |
| 1604 | UNBLOCK_INPUT; | 1604 | unblock_input (); |
| 1605 | return 1; | 1605 | return 1; |
| 1606 | } | 1606 | } |
| 1607 | 1607 | ||
| @@ -1767,7 +1767,7 @@ ns_mouse_position (struct frame **fp, int insist, Lisp_Object *bar_window, | |||
| 1767 | 1767 | ||
| 1768 | dpyinfo = FRAME_NS_DISPLAY_INFO (*fp); | 1768 | dpyinfo = FRAME_NS_DISPLAY_INFO (*fp); |
| 1769 | 1769 | ||
| 1770 | BLOCK_INPUT; | 1770 | block_input (); |
| 1771 | 1771 | ||
| 1772 | if (last_mouse_scroll_bar != nil && insist == 0) | 1772 | if (last_mouse_scroll_bar != nil && insist == 0) |
| 1773 | { | 1773 | { |
| @@ -1812,7 +1812,7 @@ ns_mouse_position (struct frame **fp, int insist, Lisp_Object *bar_window, | |||
| 1812 | } | 1812 | } |
| 1813 | } | 1813 | } |
| 1814 | 1814 | ||
| 1815 | UNBLOCK_INPUT; | 1815 | unblock_input (); |
| 1816 | } | 1816 | } |
| 1817 | 1817 | ||
| 1818 | 1818 | ||
| @@ -1832,7 +1832,7 @@ ns_frame_up_to_date (struct frame *f) | |||
| 1832 | if ((hlinfo->mouse_face_deferred_gc || f ==hlinfo->mouse_face_mouse_frame) | 1832 | if ((hlinfo->mouse_face_deferred_gc || f ==hlinfo->mouse_face_mouse_frame) |
| 1833 | /*&& hlinfo->mouse_face_mouse_frame*/) | 1833 | /*&& hlinfo->mouse_face_mouse_frame*/) |
| 1834 | { | 1834 | { |
| 1835 | BLOCK_INPUT; | 1835 | block_input (); |
| 1836 | ns_update_begin(f); | 1836 | ns_update_begin(f); |
| 1837 | if (hlinfo->mouse_face_mouse_frame) | 1837 | if (hlinfo->mouse_face_mouse_frame) |
| 1838 | note_mouse_highlight (hlinfo->mouse_face_mouse_frame, | 1838 | note_mouse_highlight (hlinfo->mouse_face_mouse_frame, |
| @@ -1840,7 +1840,7 @@ ns_frame_up_to_date (struct frame *f) | |||
| 1840 | hlinfo->mouse_face_mouse_y); | 1840 | hlinfo->mouse_face_mouse_y); |
| 1841 | hlinfo->mouse_face_deferred_gc = 0; | 1841 | hlinfo->mouse_face_deferred_gc = 0; |
| 1842 | ns_update_end(f); | 1842 | ns_update_end(f); |
| 1843 | UNBLOCK_INPUT; | 1843 | unblock_input (); |
| 1844 | } | 1844 | } |
| 1845 | } | 1845 | } |
| 1846 | } | 1846 | } |
| @@ -1955,7 +1955,7 @@ ns_clear_frame (struct frame *f) | |||
| 1955 | 1955 | ||
| 1956 | r = [view bounds]; | 1956 | r = [view bounds]; |
| 1957 | 1957 | ||
| 1958 | BLOCK_INPUT; | 1958 | block_input (); |
| 1959 | ns_focus (f, &r, 1); | 1959 | ns_focus (f, &r, 1); |
| 1960 | [ns_lookup_indexed_color (NS_FACE_BACKGROUND (FRAME_DEFAULT_FACE (f)), f) set]; | 1960 | [ns_lookup_indexed_color (NS_FACE_BACKGROUND (FRAME_DEFAULT_FACE (f)), f) set]; |
| 1961 | NSRectFill (r); | 1961 | NSRectFill (r); |
| @@ -1967,7 +1967,7 @@ ns_clear_frame (struct frame *f) | |||
| 1967 | 1967 | ||
| 1968 | /* as of 2006/11 or so this is now needed */ | 1968 | /* as of 2006/11 or so this is now needed */ |
| 1969 | ns_redraw_scroll_bars (f); | 1969 | ns_redraw_scroll_bars (f); |
| 1970 | UNBLOCK_INPUT; | 1970 | unblock_input (); |
| 1971 | } | 1971 | } |
| 1972 | 1972 | ||
| 1973 | 1973 | ||
| @@ -2068,7 +2068,7 @@ ns_scroll_run (struct window *w, struct run *run) | |||
| 2068 | if (height == 0) | 2068 | if (height == 0) |
| 2069 | return; | 2069 | return; |
| 2070 | 2070 | ||
| 2071 | BLOCK_INPUT; | 2071 | block_input (); |
| 2072 | 2072 | ||
| 2073 | updated_window = w; | 2073 | updated_window = w; |
| 2074 | x_clear_cursor (w); | 2074 | x_clear_cursor (w); |
| @@ -2083,7 +2083,7 @@ ns_scroll_run (struct window *w, struct run *run) | |||
| 2083 | ns_unfocus (f); | 2083 | ns_unfocus (f); |
| 2084 | } | 2084 | } |
| 2085 | 2085 | ||
| 2086 | UNBLOCK_INPUT; | 2086 | unblock_input (); |
| 2087 | } | 2087 | } |
| 2088 | 2088 | ||
| 2089 | 2089 | ||
| @@ -2117,12 +2117,12 @@ ns_after_update_window_line (struct glyph_row *desired_row) | |||
| 2117 | { | 2117 | { |
| 2118 | int y = WINDOW_TO_FRAME_PIXEL_Y (w, max (0, desired_row->y)); | 2118 | int y = WINDOW_TO_FRAME_PIXEL_Y (w, max (0, desired_row->y)); |
| 2119 | 2119 | ||
| 2120 | BLOCK_INPUT; | 2120 | block_input (); |
| 2121 | ns_clear_frame_area (f, 0, y, width, height); | 2121 | ns_clear_frame_area (f, 0, y, width, height); |
| 2122 | ns_clear_frame_area (f, | 2122 | ns_clear_frame_area (f, |
| 2123 | FRAME_PIXEL_WIDTH (f) - width, | 2123 | FRAME_PIXEL_WIDTH (f) - width, |
| 2124 | y, width, height); | 2124 | y, width, height); |
| 2125 | UNBLOCK_INPUT; | 2125 | unblock_input (); |
| 2126 | } | 2126 | } |
| 2127 | } | 2127 | } |
| 2128 | 2128 | ||
| @@ -2489,12 +2489,12 @@ show_hourglass (struct atimer *timer) | |||
| 2489 | if (hourglass_shown_p) | 2489 | if (hourglass_shown_p) |
| 2490 | return; | 2490 | return; |
| 2491 | 2491 | ||
| 2492 | BLOCK_INPUT; | 2492 | block_input (); |
| 2493 | 2493 | ||
| 2494 | /* TODO: add NSProgressIndicator to selected frame (see macfns.c) */ | 2494 | /* TODO: add NSProgressIndicator to selected frame (see macfns.c) */ |
| 2495 | 2495 | ||
| 2496 | hourglass_shown_p = 1; | 2496 | hourglass_shown_p = 1; |
| 2497 | UNBLOCK_INPUT; | 2497 | unblock_input (); |
| 2498 | } | 2498 | } |
| 2499 | 2499 | ||
| 2500 | 2500 | ||
| @@ -2504,12 +2504,12 @@ hide_hourglass (void) | |||
| 2504 | if (!hourglass_shown_p) | 2504 | if (!hourglass_shown_p) |
| 2505 | return; | 2505 | return; |
| 2506 | 2506 | ||
| 2507 | BLOCK_INPUT; | 2507 | block_input (); |
| 2508 | 2508 | ||
| 2509 | /* TODO: remove NSProgressIndicator from all frames */ | 2509 | /* TODO: remove NSProgressIndicator from all frames */ |
| 2510 | 2510 | ||
| 2511 | hourglass_shown_p = 0; | 2511 | hourglass_shown_p = 0; |
| 2512 | UNBLOCK_INPUT; | 2512 | unblock_input (); |
| 2513 | } | 2513 | } |
| 2514 | 2514 | ||
| 2515 | 2515 | ||
| @@ -3352,17 +3352,7 @@ ns_read_socket (struct terminal *terminal, struct input_event *hold_quit) | |||
| 3352 | if ([NSApp modalWindow] != nil) | 3352 | if ([NSApp modalWindow] != nil) |
| 3353 | return -1; | 3353 | return -1; |
| 3354 | 3354 | ||
| 3355 | if (interrupt_input_blocked) | 3355 | block_input (); |
| 3356 | { | ||
| 3357 | interrupt_input_pending = 1; | ||
| 3358 | pending_signals = 1; | ||
| 3359 | return -1; | ||
| 3360 | } | ||
| 3361 | |||
| 3362 | interrupt_input_pending = 0; | ||
| 3363 | pending_signals = pending_atimers; | ||
| 3364 | |||
| 3365 | BLOCK_INPUT; | ||
| 3366 | n_emacs_events_pending = 0; | 3356 | n_emacs_events_pending = 0; |
| 3367 | EVENT_INIT (ev); | 3357 | EVENT_INIT (ev); |
| 3368 | emacs_event = &ev; | 3358 | emacs_event = &ev; |
| @@ -3407,7 +3397,7 @@ ns_read_socket (struct terminal *terminal, struct input_event *hold_quit) | |||
| 3407 | nevents = n_emacs_events_pending; | 3397 | nevents = n_emacs_events_pending; |
| 3408 | n_emacs_events_pending = 0; | 3398 | n_emacs_events_pending = 0; |
| 3409 | emacs_event = q_event_ptr = NULL; | 3399 | emacs_event = q_event_ptr = NULL; |
| 3410 | UNBLOCK_INPUT; | 3400 | unblock_input (); |
| 3411 | 3401 | ||
| 3412 | return nevents; | 3402 | return nevents; |
| 3413 | } | 3403 | } |
| @@ -3487,7 +3477,7 @@ ns_select (int nfds, fd_set *readfds, fd_set *writefds, | |||
| 3487 | } | 3477 | } |
| 3488 | 3478 | ||
| 3489 | EVENT_INIT (event); | 3479 | EVENT_INIT (event); |
| 3490 | BLOCK_INPUT; | 3480 | block_input (); |
| 3491 | emacs_event = &event; | 3481 | emacs_event = &event; |
| 3492 | if (++apploopnr != 1) | 3482 | if (++apploopnr != 1) |
| 3493 | { | 3483 | { |
| @@ -3501,7 +3491,7 @@ ns_select (int nfds, fd_set *readfds, fd_set *writefds, | |||
| 3501 | c = 's'; | 3491 | c = 's'; |
| 3502 | write (selfds[1], &c, 1); | 3492 | write (selfds[1], &c, 1); |
| 3503 | } | 3493 | } |
| 3504 | UNBLOCK_INPUT; | 3494 | unblock_input (); |
| 3505 | 3495 | ||
| 3506 | ev = last_appdefined_event; | 3496 | ev = last_appdefined_event; |
| 3507 | 3497 | ||
| @@ -3613,7 +3603,7 @@ ns_set_vertical_scroll_bar (struct window *window, | |||
| 3613 | || WINDOW_RIGHT_MARGIN_COLS (window) == 0)); | 3603 | || WINDOW_RIGHT_MARGIN_COLS (window) == 0)); |
| 3614 | 3604 | ||
| 3615 | XSETWINDOW (win, window); | 3605 | XSETWINDOW (win, window); |
| 3616 | BLOCK_INPUT; | 3606 | block_input (); |
| 3617 | 3607 | ||
| 3618 | /* we want at least 5 lines to display a scrollbar */ | 3608 | /* we want at least 5 lines to display a scrollbar */ |
| 3619 | if (WINDOW_TOTAL_LINES (window) < 5) | 3609 | if (WINDOW_TOTAL_LINES (window) < 5) |
| @@ -3625,7 +3615,7 @@ ns_set_vertical_scroll_bar (struct window *window, | |||
| 3625 | wset_vertical_scroll_bar (window, Qnil); | 3615 | wset_vertical_scroll_bar (window, Qnil); |
| 3626 | } | 3616 | } |
| 3627 | ns_clear_frame_area (f, sb_left, top, width, height); | 3617 | ns_clear_frame_area (f, sb_left, top, width, height); |
| 3628 | UNBLOCK_INPUT; | 3618 | unblock_input (); |
| 3629 | return; | 3619 | return; |
| 3630 | } | 3620 | } |
| 3631 | 3621 | ||
| @@ -3657,7 +3647,7 @@ ns_set_vertical_scroll_bar (struct window *window, | |||
| 3657 | } | 3647 | } |
| 3658 | 3648 | ||
| 3659 | [bar setPosition: position portion: portion whole: whole]; | 3649 | [bar setPosition: position portion: portion whole: whole]; |
| 3660 | UNBLOCK_INPUT; | 3650 | unblock_input (); |
| 3661 | } | 3651 | } |
| 3662 | 3652 | ||
| 3663 | 3653 | ||
| @@ -3901,11 +3891,11 @@ ns_delete_terminal (struct terminal *terminal) | |||
| 3901 | if (!terminal->name) | 3891 | if (!terminal->name) |
| 3902 | return; | 3892 | return; |
| 3903 | 3893 | ||
| 3904 | BLOCK_INPUT; | 3894 | block_input (); |
| 3905 | 3895 | ||
| 3906 | x_destroy_all_bitmaps (dpyinfo); | 3896 | x_destroy_all_bitmaps (dpyinfo); |
| 3907 | ns_delete_display (dpyinfo); | 3897 | ns_delete_display (dpyinfo); |
| 3908 | UNBLOCK_INPUT; | 3898 | unblock_input (); |
| 3909 | } | 3899 | } |
| 3910 | 3900 | ||
| 3911 | 3901 | ||
| @@ -3983,7 +3973,7 @@ ns_term_init (Lisp_Object display_name) | |||
| 3983 | 3973 | ||
| 3984 | /* count object allocs (About, click icon); on OS X use ObjectAlloc tool */ | 3974 | /* count object allocs (About, click icon); on OS X use ObjectAlloc tool */ |
| 3985 | /*GSDebugAllocationActive (YES); */ | 3975 | /*GSDebugAllocationActive (YES); */ |
| 3986 | BLOCK_INPUT; | 3976 | block_input (); |
| 3987 | 3977 | ||
| 3988 | baud_rate = 38400; | 3978 | baud_rate = 38400; |
| 3989 | Fset_input_interrupt_mode (Qnil); | 3979 | Fset_input_interrupt_mode (Qnil); |
| @@ -4052,7 +4042,7 @@ ns_term_init (Lisp_Object display_name) | |||
| 4052 | 4042 | ||
| 4053 | terminal->name = xstrdup (SSDATA (display_name)); | 4043 | terminal->name = xstrdup (SSDATA (display_name)); |
| 4054 | 4044 | ||
| 4055 | UNBLOCK_INPUT; | 4045 | unblock_input (); |
| 4056 | 4046 | ||
| 4057 | if (!inhibit_x_resources) | 4047 | if (!inhibit_x_resources) |
| 4058 | { | 4048 | { |
| @@ -6370,13 +6360,13 @@ not_in_argv (NSString *arg) | |||
| 6370 | - (void)setFrame: (NSRect)newRect | 6360 | - (void)setFrame: (NSRect)newRect |
| 6371 | { | 6361 | { |
| 6372 | NSTRACE (EmacsScroller_setFrame); | 6362 | NSTRACE (EmacsScroller_setFrame); |
| 6373 | /* BLOCK_INPUT; */ | 6363 | /* block_input (); */ |
| 6374 | pixel_height = NSHeight (newRect); | 6364 | pixel_height = NSHeight (newRect); |
| 6375 | if (pixel_height == 0) pixel_height = 1; | 6365 | if (pixel_height == 0) pixel_height = 1; |
| 6376 | min_portion = 20 / pixel_height; | 6366 | min_portion = 20 / pixel_height; |
| 6377 | [super setFrame: newRect]; | 6367 | [super setFrame: newRect]; |
| 6378 | [self display]; | 6368 | [self display]; |
| 6379 | /* UNBLOCK_INPUT; */ | 6369 | /* unblock_input (); */ |
| 6380 | } | 6370 | } |
| 6381 | 6371 | ||
| 6382 | 6372 | ||
| @@ -6411,14 +6401,14 @@ not_in_argv (NSString *arg) | |||
| 6411 | if (condemned) | 6401 | if (condemned) |
| 6412 | { | 6402 | { |
| 6413 | EmacsView *view; | 6403 | EmacsView *view; |
| 6414 | BLOCK_INPUT; | 6404 | block_input (); |
| 6415 | /* ensure other scrollbar updates after deletion */ | 6405 | /* ensure other scrollbar updates after deletion */ |
| 6416 | view = (EmacsView *)FRAME_NS_VIEW (frame); | 6406 | view = (EmacsView *)FRAME_NS_VIEW (frame); |
| 6417 | if (view != nil) | 6407 | if (view != nil) |
| 6418 | view->scrollbarsNeedingUpdate++; | 6408 | view->scrollbarsNeedingUpdate++; |
| 6419 | [self removeFromSuperview]; | 6409 | [self removeFromSuperview]; |
| 6420 | [self release]; | 6410 | [self release]; |
| 6421 | UNBLOCK_INPUT; | 6411 | unblock_input (); |
| 6422 | } | 6412 | } |
| 6423 | return self; | 6413 | return self; |
| 6424 | } | 6414 | } |
diff --git a/src/print.c b/src/print.c index aae13bb6764..49b491faec8 100644 --- a/src/print.c +++ b/src/print.c | |||
| @@ -753,9 +753,9 @@ append to existing target file. */) | |||
| 753 | { | 753 | { |
| 754 | if (initial_stderr_stream != NULL) | 754 | if (initial_stderr_stream != NULL) |
| 755 | { | 755 | { |
| 756 | BLOCK_INPUT; | 756 | block_input (); |
| 757 | fclose (stderr); | 757 | fclose (stderr); |
| 758 | UNBLOCK_INPUT; | 758 | unblock_input (); |
| 759 | } | 759 | } |
| 760 | stderr = initial_stderr_stream; | 760 | stderr = initial_stderr_stream; |
| 761 | initial_stderr_stream = NULL; | 761 | initial_stderr_stream = NULL; |
diff --git a/src/process.c b/src/process.c index c654369627d..ab215766c07 100644 --- a/src/process.c +++ b/src/process.c | |||
| @@ -255,11 +255,12 @@ static int keyboard_bit_set (SELECT_TYPE *); | |||
| 255 | static void deactivate_process (Lisp_Object); | 255 | static void deactivate_process (Lisp_Object); |
| 256 | static void status_notify (struct Lisp_Process *); | 256 | static void status_notify (struct Lisp_Process *); |
| 257 | static int read_process_output (Lisp_Object, int); | 257 | static int read_process_output (Lisp_Object, int); |
| 258 | static void handle_child_signal (int); | ||
| 258 | static void create_pty (Lisp_Object); | 259 | static void create_pty (Lisp_Object); |
| 259 | 260 | ||
| 260 | /* If we support a window system, turn on the code to poll periodically | 261 | /* If we support a window system, turn on the code to poll periodically |
| 261 | to detect C-g. It isn't actually used when doing interrupt input. */ | 262 | to detect C-g. It isn't actually used when doing interrupt input. */ |
| 262 | #if defined (HAVE_WINDOW_SYSTEM) && !defined (USE_ASYNC_EVENTS) | 263 | #ifdef HAVE_WINDOW_SYSTEM |
| 263 | #define POLL_FOR_INPUT | 264 | #define POLL_FOR_INPUT |
| 264 | #endif | 265 | #endif |
| 265 | 266 | ||
| @@ -1610,11 +1611,16 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir) | |||
| 1610 | int wait_child_setup[2]; | 1611 | int wait_child_setup[2]; |
| 1611 | #endif | 1612 | #endif |
| 1612 | #ifdef SIGCHLD | 1613 | #ifdef SIGCHLD |
| 1613 | sigset_t blocked, procmask; | 1614 | sigset_t blocked; |
| 1614 | #endif | 1615 | #endif |
| 1615 | /* Use volatile to protect variables from being clobbered by vfork. */ | 1616 | /* Use volatile to protect variables from being clobbered by vfork. */ |
| 1616 | volatile int forkin, forkout; | 1617 | volatile int forkin, forkout; |
| 1617 | volatile int pty_flag = 0; | 1618 | volatile int pty_flag = 0; |
| 1619 | volatile Lisp_Object lisp_pty_name = Qnil; | ||
| 1620 | volatile Lisp_Object encoded_current_dir; | ||
| 1621 | #if HAVE_WORKING_VFORK | ||
| 1622 | char **volatile save_environ; | ||
| 1623 | #endif | ||
| 1618 | 1624 | ||
| 1619 | inchannel = outchannel = -1; | 1625 | inchannel = outchannel = -1; |
| 1620 | 1626 | ||
| @@ -1640,6 +1646,7 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir) | |||
| 1640 | forkin = forkout = -1; | 1646 | forkin = forkout = -1; |
| 1641 | #endif /* not USG, or USG_SUBTTY_WORKS */ | 1647 | #endif /* not USG, or USG_SUBTTY_WORKS */ |
| 1642 | pty_flag = 1; | 1648 | pty_flag = 1; |
| 1649 | lisp_pty_name = build_string (pty_name); | ||
| 1643 | } | 1650 | } |
| 1644 | else | 1651 | else |
| 1645 | #endif /* HAVE_PTYS */ | 1652 | #endif /* HAVE_PTYS */ |
| @@ -1704,14 +1711,6 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir) | |||
| 1704 | XPROCESS (process)->pty_flag = pty_flag; | 1711 | XPROCESS (process)->pty_flag = pty_flag; |
| 1705 | pset_status (XPROCESS (process), Qrun); | 1712 | pset_status (XPROCESS (process), Qrun); |
| 1706 | 1713 | ||
| 1707 | #ifdef SIGCHLD | ||
| 1708 | /* Delay interrupts until we have a chance to store | ||
| 1709 | the new fork's pid in its process structure */ | ||
| 1710 | sigemptyset (&blocked); | ||
| 1711 | sigaddset (&blocked, SIGCHLD); | ||
| 1712 | pthread_sigmask (SIG_BLOCK, &blocked, &procmask); | ||
| 1713 | #endif | ||
| 1714 | |||
| 1715 | FD_SET (inchannel, &input_wait_mask); | 1714 | FD_SET (inchannel, &input_wait_mask); |
| 1716 | FD_SET (inchannel, &non_keyboard_wait_mask); | 1715 | FD_SET (inchannel, &non_keyboard_wait_mask); |
| 1717 | if (inchannel > max_process_desc) | 1716 | if (inchannel > max_process_desc) |
| @@ -1729,89 +1728,99 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir) | |||
| 1729 | error. */ | 1728 | error. */ |
| 1730 | setup_process_coding_systems (process); | 1729 | setup_process_coding_systems (process); |
| 1731 | 1730 | ||
| 1732 | BLOCK_INPUT; | 1731 | encoded_current_dir = ENCODE_FILE (current_dir); |
| 1733 | 1732 | ||
| 1734 | { | 1733 | block_input (); |
| 1735 | /* child_setup must clobber environ on systems with true vfork. | 1734 | |
| 1736 | Protect it from permanent change. */ | 1735 | #ifdef SIGCHLD |
| 1737 | char **save_environ = environ; | 1736 | /* Block SIGCHLD until we have a chance to store the new fork's |
| 1738 | volatile Lisp_Object encoded_current_dir = ENCODE_FILE (current_dir); | 1737 | pid in its process structure. */ |
| 1738 | sigemptyset (&blocked); | ||
| 1739 | sigaddset (&blocked, SIGCHLD); | ||
| 1740 | pthread_sigmask (SIG_BLOCK, &blocked, 0); | ||
| 1741 | #endif | ||
| 1742 | |||
| 1743 | #if HAVE_WORKING_VFORK | ||
| 1744 | /* child_setup must clobber environ on systems with true vfork. | ||
| 1745 | Protect it from permanent change. */ | ||
| 1746 | save_environ = environ; | ||
| 1747 | #endif | ||
| 1739 | 1748 | ||
| 1740 | #ifndef WINDOWSNT | 1749 | #ifndef WINDOWSNT |
| 1741 | pid = vfork (); | 1750 | pid = vfork (); |
| 1742 | if (pid == 0) | 1751 | if (pid == 0) |
| 1743 | #endif /* not WINDOWSNT */ | 1752 | #endif /* not WINDOWSNT */ |
| 1744 | { | 1753 | { |
| 1745 | int xforkin = forkin; | 1754 | int xforkin = forkin; |
| 1746 | int xforkout = forkout; | 1755 | int xforkout = forkout; |
| 1747 | 1756 | ||
| 1748 | /* Make the pty be the controlling terminal of the process. */ | 1757 | /* Make the pty be the controlling terminal of the process. */ |
| 1749 | #ifdef HAVE_PTYS | 1758 | #ifdef HAVE_PTYS |
| 1750 | /* First, disconnect its current controlling terminal. */ | 1759 | /* First, disconnect its current controlling terminal. */ |
| 1751 | #ifdef HAVE_SETSID | 1760 | #ifdef HAVE_SETSID |
| 1752 | /* We tried doing setsid only if pty_flag, but it caused | 1761 | /* We tried doing setsid only if pty_flag, but it caused |
| 1753 | process_set_signal to fail on SGI when using a pipe. */ | 1762 | process_set_signal to fail on SGI when using a pipe. */ |
| 1754 | setsid (); | 1763 | setsid (); |
| 1755 | /* Make the pty's terminal the controlling terminal. */ | 1764 | /* Make the pty's terminal the controlling terminal. */ |
| 1756 | if (pty_flag && xforkin >= 0) | 1765 | if (pty_flag && xforkin >= 0) |
| 1757 | { | 1766 | { |
| 1758 | #ifdef TIOCSCTTY | 1767 | #ifdef TIOCSCTTY |
| 1759 | /* We ignore the return value | 1768 | /* We ignore the return value |
| 1760 | because faith@cs.unc.edu says that is necessary on Linux. */ | 1769 | because faith@cs.unc.edu says that is necessary on Linux. */ |
| 1761 | ioctl (xforkin, TIOCSCTTY, 0); | 1770 | ioctl (xforkin, TIOCSCTTY, 0); |
| 1762 | #endif | 1771 | #endif |
| 1763 | } | 1772 | } |
| 1764 | #else /* not HAVE_SETSID */ | 1773 | #else /* not HAVE_SETSID */ |
| 1765 | #ifdef USG | 1774 | #ifdef USG |
| 1766 | /* It's very important to call setpgrp here and no time | 1775 | /* It's very important to call setpgrp here and no time |
| 1767 | afterwards. Otherwise, we lose our controlling tty which | 1776 | afterwards. Otherwise, we lose our controlling tty which |
| 1768 | is set when we open the pty. */ | 1777 | is set when we open the pty. */ |
| 1769 | setpgrp (); | 1778 | setpgrp (); |
| 1770 | #endif /* USG */ | 1779 | #endif /* USG */ |
| 1771 | #endif /* not HAVE_SETSID */ | 1780 | #endif /* not HAVE_SETSID */ |
| 1772 | #if defined (LDISC1) | 1781 | #if defined (LDISC1) |
| 1773 | if (pty_flag && xforkin >= 0) | 1782 | if (pty_flag && xforkin >= 0) |
| 1774 | { | 1783 | { |
| 1775 | struct termios t; | 1784 | struct termios t; |
| 1776 | tcgetattr (xforkin, &t); | 1785 | tcgetattr (xforkin, &t); |
| 1777 | t.c_lflag = LDISC1; | 1786 | t.c_lflag = LDISC1; |
| 1778 | if (tcsetattr (xforkin, TCSANOW, &t) < 0) | 1787 | if (tcsetattr (xforkin, TCSANOW, &t) < 0) |
| 1779 | emacs_write (1, "create_process/tcsetattr LDISC1 failed\n", 39); | 1788 | emacs_write (1, "create_process/tcsetattr LDISC1 failed\n", 39); |
| 1780 | } | 1789 | } |
| 1781 | #else | 1790 | #else |
| 1782 | #if defined (NTTYDISC) && defined (TIOCSETD) | 1791 | #if defined (NTTYDISC) && defined (TIOCSETD) |
| 1783 | if (pty_flag && xforkin >= 0) | 1792 | if (pty_flag && xforkin >= 0) |
| 1784 | { | 1793 | { |
| 1785 | /* Use new line discipline. */ | 1794 | /* Use new line discipline. */ |
| 1786 | int ldisc = NTTYDISC; | 1795 | int ldisc = NTTYDISC; |
| 1787 | ioctl (xforkin, TIOCSETD, &ldisc); | 1796 | ioctl (xforkin, TIOCSETD, &ldisc); |
| 1788 | } | 1797 | } |
| 1789 | #endif | 1798 | #endif |
| 1790 | #endif | 1799 | #endif |
| 1791 | #ifdef TIOCNOTTY | 1800 | #ifdef TIOCNOTTY |
| 1792 | /* In 4.3BSD, the TIOCSPGRP bug has been fixed, and now you | 1801 | /* In 4.3BSD, the TIOCSPGRP bug has been fixed, and now you |
| 1793 | can do TIOCSPGRP only to the process's controlling tty. */ | 1802 | can do TIOCSPGRP only to the process's controlling tty. */ |
| 1794 | if (pty_flag) | 1803 | if (pty_flag) |
| 1795 | { | 1804 | { |
| 1796 | /* I wonder: would just ioctl (0, TIOCNOTTY, 0) work here? | 1805 | /* I wonder: would just ioctl (0, TIOCNOTTY, 0) work here? |
| 1797 | I can't test it since I don't have 4.3. */ | 1806 | I can't test it since I don't have 4.3. */ |
| 1798 | int j = emacs_open ("/dev/tty", O_RDWR, 0); | 1807 | int j = emacs_open ("/dev/tty", O_RDWR, 0); |
| 1799 | if (j >= 0) | 1808 | if (j >= 0) |
| 1800 | { | 1809 | { |
| 1801 | ioctl (j, TIOCNOTTY, 0); | 1810 | ioctl (j, TIOCNOTTY, 0); |
| 1802 | emacs_close (j); | 1811 | emacs_close (j); |
| 1803 | } | 1812 | } |
| 1804 | #ifndef USG | 1813 | #ifndef USG |
| 1805 | /* In order to get a controlling terminal on some versions | 1814 | /* In order to get a controlling terminal on some versions |
| 1806 | of BSD, it is necessary to put the process in pgrp 0 | 1815 | of BSD, it is necessary to put the process in pgrp 0 |
| 1807 | before it opens the terminal. */ | 1816 | before it opens the terminal. */ |
| 1808 | #ifdef HAVE_SETPGID | 1817 | #ifdef HAVE_SETPGID |
| 1809 | setpgid (0, 0); | 1818 | setpgid (0, 0); |
| 1810 | #else | 1819 | #else |
| 1811 | setpgrp (0, 0); | 1820 | setpgrp (0, 0); |
| 1812 | #endif | 1821 | #endif |
| 1813 | #endif | 1822 | #endif |
| 1814 | } | 1823 | } |
| 1815 | #endif /* TIOCNOTTY */ | 1824 | #endif /* TIOCNOTTY */ |
| 1816 | 1825 | ||
| 1817 | #if !defined (DONT_REOPEN_PTY) | 1826 | #if !defined (DONT_REOPEN_PTY) |
| @@ -1823,70 +1832,79 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir) | |||
| 1823 | both HAVE_SETSID and TIOCSCTTY are defined. */ | 1832 | both HAVE_SETSID and TIOCSCTTY are defined. */ |
| 1824 | /* Now close the pty (if we had it open) and reopen it. | 1833 | /* Now close the pty (if we had it open) and reopen it. |
| 1825 | This makes the pty the controlling terminal of the subprocess. */ | 1834 | This makes the pty the controlling terminal of the subprocess. */ |
| 1826 | if (pty_flag) | 1835 | if (pty_flag) |
| 1827 | { | 1836 | { |
| 1828 | 1837 | ||
| 1829 | /* I wonder if emacs_close (emacs_open (pty_name, ...)) | 1838 | /* I wonder if emacs_close (emacs_open (pty_name, ...)) |
| 1830 | would work? */ | 1839 | would work? */ |
| 1831 | if (xforkin >= 0) | 1840 | if (xforkin >= 0) |
| 1832 | emacs_close (xforkin); | 1841 | emacs_close (xforkin); |
| 1833 | xforkout = xforkin = emacs_open (pty_name, O_RDWR, 0); | 1842 | xforkout = xforkin = emacs_open (pty_name, O_RDWR, 0); |
| 1834 | 1843 | ||
| 1835 | if (xforkin < 0) | 1844 | if (xforkin < 0) |
| 1836 | { | 1845 | { |
| 1837 | emacs_write (1, "Couldn't open the pty terminal ", 31); | 1846 | emacs_write (1, "Couldn't open the pty terminal ", 31); |
| 1838 | emacs_write (1, pty_name, strlen (pty_name)); | 1847 | emacs_write (1, pty_name, strlen (pty_name)); |
| 1839 | emacs_write (1, "\n", 1); | 1848 | emacs_write (1, "\n", 1); |
| 1840 | _exit (1); | 1849 | _exit (1); |
| 1841 | } | 1850 | } |
| 1842 | 1851 | ||
| 1843 | } | 1852 | } |
| 1844 | #endif /* not DONT_REOPEN_PTY */ | 1853 | #endif /* not DONT_REOPEN_PTY */ |
| 1845 | 1854 | ||
| 1846 | #ifdef SETUP_SLAVE_PTY | 1855 | #ifdef SETUP_SLAVE_PTY |
| 1847 | if (pty_flag) | 1856 | if (pty_flag) |
| 1848 | { | 1857 | { |
| 1849 | SETUP_SLAVE_PTY; | 1858 | SETUP_SLAVE_PTY; |
| 1850 | } | 1859 | } |
| 1851 | #endif /* SETUP_SLAVE_PTY */ | 1860 | #endif /* SETUP_SLAVE_PTY */ |
| 1852 | #ifdef AIX | 1861 | #ifdef AIX |
| 1853 | /* On AIX, we've disabled SIGHUP above once we start a child on a pty. | 1862 | /* On AIX, we've disabled SIGHUP above once we start a child on a pty. |
| 1854 | Now reenable it in the child, so it will die when we want it to. */ | 1863 | Now reenable it in the child, so it will die when we want it to. */ |
| 1855 | if (pty_flag) | 1864 | if (pty_flag) |
| 1856 | signal (SIGHUP, SIG_DFL); | 1865 | signal (SIGHUP, SIG_DFL); |
| 1857 | #endif | 1866 | #endif |
| 1858 | #endif /* HAVE_PTYS */ | 1867 | #endif /* HAVE_PTYS */ |
| 1859 | 1868 | ||
| 1860 | signal (SIGINT, SIG_DFL); | 1869 | signal (SIGINT, SIG_DFL); |
| 1861 | signal (SIGQUIT, SIG_DFL); | 1870 | signal (SIGQUIT, SIG_DFL); |
| 1862 | /* GConf causes us to ignore SIGPIPE, make sure it is restored | 1871 | |
| 1863 | in the child. */ | 1872 | /* Emacs ignores SIGPIPE, but the child should not. */ |
| 1864 | signal (SIGPIPE, SIG_DFL); | 1873 | signal (SIGPIPE, SIG_DFL); |
| 1865 | 1874 | ||
| 1866 | #ifdef SIGCHLD | 1875 | #ifdef SIGCHLD |
| 1867 | /* Stop blocking signals in the child. */ | 1876 | /* Stop blocking signals in the child. */ |
| 1868 | pthread_sigmask (SIG_SETMASK, &procmask, 0); | 1877 | pthread_sigmask (SIG_SETMASK, &empty_mask, 0); |
| 1869 | #endif | 1878 | #endif |
| 1870 | 1879 | ||
| 1871 | if (pty_flag) | 1880 | if (pty_flag) |
| 1872 | child_setup_tty (xforkout); | 1881 | child_setup_tty (xforkout); |
| 1873 | #ifdef WINDOWSNT | 1882 | #ifdef WINDOWSNT |
| 1874 | pid = child_setup (xforkin, xforkout, xforkout, | 1883 | pid = child_setup (xforkin, xforkout, xforkout, |
| 1875 | new_argv, 1, encoded_current_dir); | 1884 | new_argv, 1, encoded_current_dir); |
| 1876 | #else /* not WINDOWSNT */ | 1885 | #else /* not WINDOWSNT */ |
| 1877 | #ifdef FD_CLOEXEC | 1886 | #ifdef FD_CLOEXEC |
| 1878 | emacs_close (wait_child_setup[0]); | 1887 | emacs_close (wait_child_setup[0]); |
| 1879 | #endif | 1888 | #endif |
| 1880 | child_setup (xforkin, xforkout, xforkout, | 1889 | child_setup (xforkin, xforkout, xforkout, |
| 1881 | new_argv, 1, encoded_current_dir); | 1890 | new_argv, 1, encoded_current_dir); |
| 1882 | #endif /* not WINDOWSNT */ | 1891 | #endif /* not WINDOWSNT */ |
| 1883 | } | 1892 | } |
| 1884 | environ = save_environ; | 1893 | |
| 1885 | } | 1894 | /* Back in the parent process. */ |
| 1895 | |||
| 1896 | #if HAVE_WORKING_VFORK | ||
| 1897 | environ = save_environ; | ||
| 1898 | #endif | ||
| 1899 | |||
| 1900 | XPROCESS (process)->pid = pid; | ||
| 1886 | 1901 | ||
| 1887 | UNBLOCK_INPUT; | 1902 | /* Stop blocking signals in the parent. */ |
| 1903 | #ifdef SIGCHLD | ||
| 1904 | pthread_sigmask (SIG_SETMASK, &empty_mask, 0); | ||
| 1905 | #endif | ||
| 1906 | unblock_input (); | ||
| 1888 | 1907 | ||
| 1889 | /* This runs in the Emacs process. */ | ||
| 1890 | if (pid < 0) | 1908 | if (pid < 0) |
| 1891 | { | 1909 | { |
| 1892 | if (forkin >= 0) | 1910 | if (forkin >= 0) |
| @@ -1897,7 +1915,6 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir) | |||
| 1897 | else | 1915 | else |
| 1898 | { | 1916 | { |
| 1899 | /* vfork succeeded. */ | 1917 | /* vfork succeeded. */ |
| 1900 | XPROCESS (process)->pid = pid; | ||
| 1901 | 1918 | ||
| 1902 | #ifdef WINDOWSNT | 1919 | #ifdef WINDOWSNT |
| 1903 | register_child (pid, inchannel); | 1920 | register_child (pid, inchannel); |
| @@ -1923,12 +1940,7 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir) | |||
| 1923 | if (forkin != forkout && forkout >= 0) | 1940 | if (forkin != forkout && forkout >= 0) |
| 1924 | emacs_close (forkout); | 1941 | emacs_close (forkout); |
| 1925 | 1942 | ||
| 1926 | #ifdef HAVE_PTYS | 1943 | pset_tty_name (XPROCESS (process), lisp_pty_name); |
| 1927 | if (pty_flag) | ||
| 1928 | pset_tty_name (XPROCESS (process), build_string (pty_name)); | ||
| 1929 | else | ||
| 1930 | #endif | ||
| 1931 | pset_tty_name (XPROCESS (process), Qnil); | ||
| 1932 | 1944 | ||
| 1933 | #if !defined (WINDOWSNT) && defined (FD_CLOEXEC) | 1945 | #if !defined (WINDOWSNT) && defined (FD_CLOEXEC) |
| 1934 | /* Wait for child_setup to complete in case that vfork is | 1946 | /* Wait for child_setup to complete in case that vfork is |
| @@ -1945,11 +1957,6 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir) | |||
| 1945 | #endif | 1957 | #endif |
| 1946 | } | 1958 | } |
| 1947 | 1959 | ||
| 1948 | #ifdef SIGCHLD | ||
| 1949 | /* Stop blocking signals in the parent. */ | ||
| 1950 | pthread_sigmask (SIG_SETMASK, &procmask, 0); | ||
| 1951 | #endif | ||
| 1952 | |||
| 1953 | /* Now generate the error if vfork failed. */ | 1960 | /* Now generate the error if vfork failed. */ |
| 1954 | if (pid < 0) | 1961 | if (pid < 0) |
| 1955 | report_file_error ("Doing vfork", Qnil); | 1962 | report_file_error ("Doing vfork", Qnil); |
| @@ -3402,9 +3409,9 @@ usage: (make-network-process &rest ARGS) */) | |||
| 3402 | #ifdef HAVE_GETADDRINFO | 3409 | #ifdef HAVE_GETADDRINFO |
| 3403 | if (res != &ai) | 3410 | if (res != &ai) |
| 3404 | { | 3411 | { |
| 3405 | BLOCK_INPUT; | 3412 | block_input (); |
| 3406 | freeaddrinfo (res); | 3413 | freeaddrinfo (res); |
| 3407 | UNBLOCK_INPUT; | 3414 | unblock_input (); |
| 3408 | } | 3415 | } |
| 3409 | #endif | 3416 | #endif |
| 3410 | 3417 | ||
| @@ -4372,7 +4379,7 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd, | |||
| 4372 | Otherwise, do pending quit if requested. */ | 4379 | Otherwise, do pending quit if requested. */ |
| 4373 | if (read_kbd >= 0) | 4380 | if (read_kbd >= 0) |
| 4374 | QUIT; | 4381 | QUIT; |
| 4375 | else | 4382 | else if (pending_signals) |
| 4376 | process_pending_signals (); | 4383 | process_pending_signals (); |
| 4377 | 4384 | ||
| 4378 | /* Exit now if the cell we're waiting for became non-nil. */ | 4385 | /* Exit now if the cell we're waiting for became non-nil. */ |
| @@ -4739,21 +4746,6 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd, | |||
| 4739 | check_write = 0; | 4746 | check_write = 0; |
| 4740 | } | 4747 | } |
| 4741 | 4748 | ||
| 4742 | #if 0 /* When polling is used, interrupt_input is 0, | ||
| 4743 | so get_input_pending should read the input. | ||
| 4744 | So this should not be needed. */ | ||
| 4745 | /* If we are using polling for input, | ||
| 4746 | and we see input available, make it get read now. | ||
| 4747 | Otherwise it might not actually get read for a second. | ||
| 4748 | And on hpux, since we turn off polling in wait_reading_process_output, | ||
| 4749 | it might never get read at all if we don't spend much time | ||
| 4750 | outside of wait_reading_process_output. */ | ||
| 4751 | if (read_kbd && interrupt_input | ||
| 4752 | && keyboard_bit_set (&Available) | ||
| 4753 | && input_polling_used ()) | ||
| 4754 | kill (getpid (), SIGALRM); | ||
| 4755 | #endif | ||
| 4756 | |||
| 4757 | /* Check for keyboard input */ | 4749 | /* Check for keyboard input */ |
| 4758 | /* If there is any, return immediately | 4750 | /* If there is any, return immediately |
| 4759 | to give it higher priority than subprocesses */ | 4751 | to give it higher priority than subprocesses */ |
| @@ -4817,7 +4809,7 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd, | |||
| 4817 | 4809 | ||
| 4818 | if (read_kbd && interrupt_input | 4810 | if (read_kbd && interrupt_input |
| 4819 | && keyboard_bit_set (&Available) && ! noninteractive) | 4811 | && keyboard_bit_set (&Available) && ! noninteractive) |
| 4820 | kill (getpid (), SIGIO); | 4812 | handle_input_available_signal (SIGIO); |
| 4821 | #endif | 4813 | #endif |
| 4822 | 4814 | ||
| 4823 | if (! wait_proc) | 4815 | if (! wait_proc) |
| @@ -4937,7 +4929,7 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd, | |||
| 4937 | pset_status (p, Qfailed); | 4929 | pset_status (p, Qfailed); |
| 4938 | } | 4930 | } |
| 4939 | else | 4931 | else |
| 4940 | kill (getpid (), SIGCHLD); | 4932 | handle_child_signal (SIGCHLD); |
| 4941 | } | 4933 | } |
| 4942 | #endif /* HAVE_PTYS */ | 4934 | #endif /* HAVE_PTYS */ |
| 4943 | /* If we can detect process termination, don't consider the | 4935 | /* If we can detect process termination, don't consider the |
| @@ -5393,25 +5385,6 @@ read_process_output (Lisp_Object proc, register int channel) | |||
| 5393 | 5385 | ||
| 5394 | /* Sending data to subprocess */ | 5386 | /* Sending data to subprocess */ |
| 5395 | 5387 | ||
| 5396 | static sys_jmp_buf send_process_frame; | ||
| 5397 | static Lisp_Object process_sent_to; | ||
| 5398 | |||
| 5399 | static _Noreturn void | ||
| 5400 | handle_pipe_signal (int sig) | ||
| 5401 | { | ||
| 5402 | sigset_t unblocked; | ||
| 5403 | sigemptyset (&unblocked); | ||
| 5404 | sigaddset (&unblocked, SIGPIPE); | ||
| 5405 | pthread_sigmask (SIG_UNBLOCK, &unblocked, 0); | ||
| 5406 | sys_longjmp (send_process_frame, 1); | ||
| 5407 | } | ||
| 5408 | |||
| 5409 | static void | ||
| 5410 | deliver_pipe_signal (int sig) | ||
| 5411 | { | ||
| 5412 | handle_on_main_thread (sig, handle_pipe_signal); | ||
| 5413 | } | ||
| 5414 | |||
| 5415 | /* In send_process, when a write fails temporarily, | 5388 | /* In send_process, when a write fails temporarily, |
| 5416 | wait_reading_process_output is called. It may execute user code, | 5389 | wait_reading_process_output is called. It may execute user code, |
| 5417 | e.g. timers, that attempts to write new data to the same process. | 5390 | e.g. timers, that attempts to write new data to the same process. |
| @@ -5495,14 +5468,12 @@ write_queue_pop (struct Lisp_Process *p, Lisp_Object *obj, | |||
| 5495 | This function can evaluate Lisp code and can garbage collect. */ | 5468 | This function can evaluate Lisp code and can garbage collect. */ |
| 5496 | 5469 | ||
| 5497 | static void | 5470 | static void |
| 5498 | send_process (volatile Lisp_Object proc, const char *volatile buf, | 5471 | send_process (Lisp_Object proc, const char *buf, ptrdiff_t len, |
| 5499 | volatile ptrdiff_t len, volatile Lisp_Object object) | 5472 | Lisp_Object object) |
| 5500 | { | 5473 | { |
| 5501 | /* Use volatile to protect variables from being clobbered by longjmp. */ | ||
| 5502 | struct Lisp_Process *p = XPROCESS (proc); | 5474 | struct Lisp_Process *p = XPROCESS (proc); |
| 5503 | ssize_t rv; | 5475 | ssize_t rv; |
| 5504 | struct coding_system *coding; | 5476 | struct coding_system *coding; |
| 5505 | struct sigaction old_sigpipe_action; | ||
| 5506 | 5477 | ||
| 5507 | if (p->raw_status_new) | 5478 | if (p->raw_status_new) |
| 5508 | update_status (p); | 5479 | update_status (p); |
| @@ -5609,145 +5580,126 @@ send_process (volatile Lisp_Object proc, const char *volatile buf, | |||
| 5609 | pty_max_bytes--; | 5580 | pty_max_bytes--; |
| 5610 | } | 5581 | } |
| 5611 | 5582 | ||
| 5612 | /* 2000-09-21: Emacs 20.7, sparc-sun-solaris-2.6, GCC 2.95.2, | 5583 | /* If there is already data in the write_queue, put the new data |
| 5613 | CFLAGS="-g -O": The value of the parameter `proc' is clobbered | 5584 | in the back of queue. Otherwise, ignore it. */ |
| 5614 | when returning with longjmp despite being declared volatile. */ | 5585 | if (!NILP (p->write_queue)) |
| 5615 | if (!sys_setjmp (send_process_frame)) | 5586 | write_queue_push (p, object, buf, len, 0); |
| 5616 | { | ||
| 5617 | p = XPROCESS (proc); /* Repair any setjmp clobbering. */ | ||
| 5618 | process_sent_to = proc; | ||
| 5619 | 5587 | ||
| 5620 | /* If there is already data in the write_queue, put the new data | 5588 | do /* while !NILP (p->write_queue) */ |
| 5621 | in the back of queue. Otherwise, ignore it. */ | 5589 | { |
| 5622 | if (!NILP (p->write_queue)) | 5590 | ptrdiff_t cur_len = -1; |
| 5623 | write_queue_push (p, object, buf, len, 0); | 5591 | const char *cur_buf; |
| 5592 | Lisp_Object cur_object; | ||
| 5624 | 5593 | ||
| 5625 | do /* while !NILP (p->write_queue) */ | 5594 | /* If write_queue is empty, ignore it. */ |
| 5595 | if (!write_queue_pop (p, &cur_object, &cur_buf, &cur_len)) | ||
| 5626 | { | 5596 | { |
| 5627 | ptrdiff_t cur_len = -1; | 5597 | cur_len = len; |
| 5628 | const char *cur_buf; | 5598 | cur_buf = buf; |
| 5629 | Lisp_Object cur_object; | 5599 | cur_object = object; |
| 5600 | } | ||
| 5630 | 5601 | ||
| 5631 | /* If write_queue is empty, ignore it. */ | 5602 | while (cur_len > 0) |
| 5632 | if (!write_queue_pop (p, &cur_object, &cur_buf, &cur_len)) | 5603 | { |
| 5604 | /* Send this batch, using one or more write calls. */ | ||
| 5605 | ptrdiff_t written = 0; | ||
| 5606 | int outfd = p->outfd; | ||
| 5607 | #ifdef DATAGRAM_SOCKETS | ||
| 5608 | if (DATAGRAM_CHAN_P (outfd)) | ||
| 5633 | { | 5609 | { |
| 5634 | cur_len = len; | 5610 | rv = sendto (outfd, cur_buf, cur_len, |
| 5635 | cur_buf = buf; | 5611 | 0, datagram_address[outfd].sa, |
| 5636 | cur_object = object; | 5612 | datagram_address[outfd].len); |
| 5613 | if (0 <= rv) | ||
| 5614 | written = rv; | ||
| 5615 | else if (errno == EMSGSIZE) | ||
| 5616 | report_file_error ("sending datagram", Fcons (proc, Qnil)); | ||
| 5637 | } | 5617 | } |
| 5638 | 5618 | else | |
| 5639 | while (cur_len > 0) | ||
| 5640 | { | ||
| 5641 | /* Send this batch, using one or more write calls. */ | ||
| 5642 | ptrdiff_t written = 0; | ||
| 5643 | int outfd = p->outfd; | ||
| 5644 | struct sigaction action; | ||
| 5645 | emacs_sigaction_init (&action, deliver_pipe_signal); | ||
| 5646 | sigaction (SIGPIPE, &action, &old_sigpipe_action); | ||
| 5647 | #ifdef DATAGRAM_SOCKETS | ||
| 5648 | if (DATAGRAM_CHAN_P (outfd)) | ||
| 5649 | { | ||
| 5650 | rv = sendto (outfd, cur_buf, cur_len, | ||
| 5651 | 0, datagram_address[outfd].sa, | ||
| 5652 | datagram_address[outfd].len); | ||
| 5653 | if (0 <= rv) | ||
| 5654 | written = rv; | ||
| 5655 | else if (errno == EMSGSIZE) | ||
| 5656 | { | ||
| 5657 | sigaction (SIGPIPE, &old_sigpipe_action, 0); | ||
| 5658 | report_file_error ("sending datagram", | ||
| 5659 | Fcons (proc, Qnil)); | ||
| 5660 | } | ||
| 5661 | } | ||
| 5662 | else | ||
| 5663 | #endif | 5619 | #endif |
| 5664 | { | 5620 | { |
| 5665 | #ifdef HAVE_GNUTLS | 5621 | #ifdef HAVE_GNUTLS |
| 5666 | if (p->gnutls_p) | 5622 | if (p->gnutls_p) |
| 5667 | written = emacs_gnutls_write (p, cur_buf, cur_len); | 5623 | written = emacs_gnutls_write (p, cur_buf, cur_len); |
| 5668 | else | 5624 | else |
| 5669 | #endif | 5625 | #endif |
| 5670 | written = emacs_write (outfd, cur_buf, cur_len); | 5626 | written = emacs_write (outfd, cur_buf, cur_len); |
| 5671 | rv = (written ? 0 : -1); | 5627 | rv = (written ? 0 : -1); |
| 5672 | #ifdef ADAPTIVE_READ_BUFFERING | 5628 | #ifdef ADAPTIVE_READ_BUFFERING |
| 5673 | if (p->read_output_delay > 0 | 5629 | if (p->read_output_delay > 0 |
| 5674 | && p->adaptive_read_buffering == 1) | 5630 | && p->adaptive_read_buffering == 1) |
| 5675 | { | 5631 | { |
| 5676 | p->read_output_delay = 0; | 5632 | p->read_output_delay = 0; |
| 5677 | process_output_delay_count--; | 5633 | process_output_delay_count--; |
| 5678 | p->read_output_skip = 0; | 5634 | p->read_output_skip = 0; |
| 5679 | } | ||
| 5680 | #endif | ||
| 5681 | } | 5635 | } |
| 5682 | sigaction (SIGPIPE, &old_sigpipe_action, 0); | 5636 | #endif |
| 5637 | } | ||
| 5683 | 5638 | ||
| 5684 | if (rv < 0) | 5639 | if (rv < 0) |
| 5685 | { | 5640 | { |
| 5686 | if (0 | 5641 | if (0 |
| 5687 | #ifdef EWOULDBLOCK | 5642 | #ifdef EWOULDBLOCK |
| 5688 | || errno == EWOULDBLOCK | 5643 | || errno == EWOULDBLOCK |
| 5689 | #endif | 5644 | #endif |
| 5690 | #ifdef EAGAIN | 5645 | #ifdef EAGAIN |
| 5691 | || errno == EAGAIN | 5646 | || errno == EAGAIN |
| 5692 | #endif | 5647 | #endif |
| 5693 | ) | 5648 | ) |
| 5694 | /* Buffer is full. Wait, accepting input; | 5649 | /* Buffer is full. Wait, accepting input; |
| 5695 | that may allow the program | 5650 | that may allow the program |
| 5696 | to finish doing output and read more. */ | 5651 | to finish doing output and read more. */ |
| 5697 | { | 5652 | { |
| 5698 | #ifdef BROKEN_PTY_READ_AFTER_EAGAIN | 5653 | #ifdef BROKEN_PTY_READ_AFTER_EAGAIN |
| 5699 | /* A gross hack to work around a bug in FreeBSD. | 5654 | /* A gross hack to work around a bug in FreeBSD. |
| 5700 | In the following sequence, read(2) returns | 5655 | In the following sequence, read(2) returns |
| 5701 | bogus data: | 5656 | bogus data: |
| 5702 | 5657 | ||
| 5703 | write(2) 1022 bytes | 5658 | write(2) 1022 bytes |
| 5704 | write(2) 954 bytes, get EAGAIN | 5659 | write(2) 954 bytes, get EAGAIN |
| 5705 | read(2) 1024 bytes in process_read_output | 5660 | read(2) 1024 bytes in process_read_output |
| 5706 | read(2) 11 bytes in process_read_output | 5661 | read(2) 11 bytes in process_read_output |
| 5707 | 5662 | ||
| 5708 | That is, read(2) returns more bytes than have | 5663 | That is, read(2) returns more bytes than have |
| 5709 | ever been written successfully. The 1033 bytes | 5664 | ever been written successfully. The 1033 bytes |
| 5710 | read are the 1022 bytes written successfully | 5665 | read are the 1022 bytes written successfully |
| 5711 | after processing (for example with CRs added if | 5666 | after processing (for example with CRs added if |
| 5712 | the terminal is set up that way which it is | 5667 | the terminal is set up that way which it is |
| 5713 | here). The same bytes will be seen again in a | 5668 | here). The same bytes will be seen again in a |
| 5714 | later read(2), without the CRs. */ | 5669 | later read(2), without the CRs. */ |
| 5715 | 5670 | ||
| 5716 | if (errno == EAGAIN) | 5671 | if (errno == EAGAIN) |
| 5717 | { | 5672 | { |
| 5718 | int flags = FWRITE; | 5673 | int flags = FWRITE; |
| 5719 | ioctl (p->outfd, TIOCFLUSH, &flags); | 5674 | ioctl (p->outfd, TIOCFLUSH, &flags); |
| 5720 | } | 5675 | } |
| 5721 | #endif /* BROKEN_PTY_READ_AFTER_EAGAIN */ | 5676 | #endif /* BROKEN_PTY_READ_AFTER_EAGAIN */ |
| 5722 | 5677 | ||
| 5723 | /* Put what we should have written in wait_queue. */ | 5678 | /* Put what we should have written in wait_queue. */ |
| 5724 | write_queue_push (p, cur_object, cur_buf, cur_len, 1); | 5679 | write_queue_push (p, cur_object, cur_buf, cur_len, 1); |
| 5725 | wait_reading_process_output (0, 20 * 1000 * 1000, | 5680 | wait_reading_process_output (0, 20 * 1000 * 1000, |
| 5726 | 0, 0, Qnil, NULL, 0); | 5681 | 0, 0, Qnil, NULL, 0); |
| 5727 | /* Reread queue, to see what is left. */ | 5682 | /* Reread queue, to see what is left. */ |
| 5728 | break; | 5683 | break; |
| 5729 | } | ||
| 5730 | else | ||
| 5731 | /* This is a real error. */ | ||
| 5732 | report_file_error ("writing to process", Fcons (proc, Qnil)); | ||
| 5733 | } | 5684 | } |
| 5734 | cur_buf += written; | 5685 | else if (errno == EPIPE) |
| 5735 | cur_len -= written; | 5686 | { |
| 5687 | p->raw_status_new = 0; | ||
| 5688 | pset_status (p, list2 (Qexit, make_number (256))); | ||
| 5689 | p->tick = ++process_tick; | ||
| 5690 | deactivate_process (proc); | ||
| 5691 | error ("process %s no longer connected to pipe; closed it", | ||
| 5692 | SDATA (p->name)); | ||
| 5693 | } | ||
| 5694 | else | ||
| 5695 | /* This is a real error. */ | ||
| 5696 | report_file_error ("writing to process", Fcons (proc, Qnil)); | ||
| 5736 | } | 5697 | } |
| 5698 | cur_buf += written; | ||
| 5699 | cur_len -= written; | ||
| 5737 | } | 5700 | } |
| 5738 | while (!NILP (p->write_queue)); | ||
| 5739 | } | ||
| 5740 | else | ||
| 5741 | { | ||
| 5742 | sigaction (SIGPIPE, &old_sigpipe_action, 0); | ||
| 5743 | proc = process_sent_to; | ||
| 5744 | p = XPROCESS (proc); | ||
| 5745 | p->raw_status_new = 0; | ||
| 5746 | pset_status (p, Fcons (Qexit, Fcons (make_number (256), Qnil))); | ||
| 5747 | p->tick = ++process_tick; | ||
| 5748 | deactivate_process (proc); | ||
| 5749 | error ("SIGPIPE raised on process %s; closed it", SDATA (p->name)); | ||
| 5750 | } | 5701 | } |
| 5702 | while (!NILP (p->write_queue)); | ||
| 5751 | } | 5703 | } |
| 5752 | 5704 | ||
| 5753 | DEFUN ("process-send-region", Fprocess_send_region, Sprocess_send_region, | 5705 | DEFUN ("process-send-region", Fprocess_send_region, Sprocess_send_region, |
| @@ -6178,39 +6130,27 @@ SIGCODE may be an integer, or a symbol whose name is a signal name. */) | |||
| 6178 | #ifdef SIGUSR2 | 6130 | #ifdef SIGUSR2 |
| 6179 | parse_signal ("usr2", SIGUSR2); | 6131 | parse_signal ("usr2", SIGUSR2); |
| 6180 | #endif | 6132 | #endif |
| 6181 | #ifdef SIGTERM | ||
| 6182 | parse_signal ("term", SIGTERM); | 6133 | parse_signal ("term", SIGTERM); |
| 6183 | #endif | ||
| 6184 | #ifdef SIGHUP | 6134 | #ifdef SIGHUP |
| 6185 | parse_signal ("hup", SIGHUP); | 6135 | parse_signal ("hup", SIGHUP); |
| 6186 | #endif | 6136 | #endif |
| 6187 | #ifdef SIGINT | ||
| 6188 | parse_signal ("int", SIGINT); | 6137 | parse_signal ("int", SIGINT); |
| 6189 | #endif | ||
| 6190 | #ifdef SIGQUIT | 6138 | #ifdef SIGQUIT |
| 6191 | parse_signal ("quit", SIGQUIT); | 6139 | parse_signal ("quit", SIGQUIT); |
| 6192 | #endif | 6140 | #endif |
| 6193 | #ifdef SIGILL | ||
| 6194 | parse_signal ("ill", SIGILL); | 6141 | parse_signal ("ill", SIGILL); |
| 6195 | #endif | ||
| 6196 | #ifdef SIGABRT | ||
| 6197 | parse_signal ("abrt", SIGABRT); | 6142 | parse_signal ("abrt", SIGABRT); |
| 6198 | #endif | ||
| 6199 | #ifdef SIGEMT | 6143 | #ifdef SIGEMT |
| 6200 | parse_signal ("emt", SIGEMT); | 6144 | parse_signal ("emt", SIGEMT); |
| 6201 | #endif | 6145 | #endif |
| 6202 | #ifdef SIGKILL | 6146 | #ifdef SIGKILL |
| 6203 | parse_signal ("kill", SIGKILL); | 6147 | parse_signal ("kill", SIGKILL); |
| 6204 | #endif | 6148 | #endif |
| 6205 | #ifdef SIGFPE | ||
| 6206 | parse_signal ("fpe", SIGFPE); | 6149 | parse_signal ("fpe", SIGFPE); |
| 6207 | #endif | ||
| 6208 | #ifdef SIGBUS | 6150 | #ifdef SIGBUS |
| 6209 | parse_signal ("bus", SIGBUS); | 6151 | parse_signal ("bus", SIGBUS); |
| 6210 | #endif | 6152 | #endif |
| 6211 | #ifdef SIGSEGV | ||
| 6212 | parse_signal ("segv", SIGSEGV); | 6153 | parse_signal ("segv", SIGSEGV); |
| 6213 | #endif | ||
| 6214 | #ifdef SIGSYS | 6154 | #ifdef SIGSYS |
| 6215 | parse_signal ("sys", SIGSYS); | 6155 | parse_signal ("sys", SIGSYS); |
| 6216 | #endif | 6156 | #endif |
| @@ -6375,27 +6315,15 @@ process has been transmitted to the serial port. */) | |||
| 6375 | ** Malloc WARNING: This should never call malloc either directly or | 6315 | ** Malloc WARNING: This should never call malloc either directly or |
| 6376 | indirectly; if it does, that is a bug */ | 6316 | indirectly; if it does, that is a bug */ |
| 6377 | 6317 | ||
| 6378 | #ifdef SIGCHLD | 6318 | /* Record the changed status of the child process PID with wait status W. */ |
| 6379 | 6319 | void | |
| 6380 | /* Record one child's changed status. Return true if a child was found. */ | 6320 | record_child_status_change (pid_t pid, int w) |
| 6381 | static bool | ||
| 6382 | record_child_status_change (void) | ||
| 6383 | { | 6321 | { |
| 6322 | #ifdef SIGCHLD | ||
| 6384 | Lisp_Object proc; | 6323 | Lisp_Object proc; |
| 6385 | struct Lisp_Process *p; | 6324 | struct Lisp_Process *p; |
| 6386 | pid_t pid; | ||
| 6387 | int w; | ||
| 6388 | Lisp_Object tail; | 6325 | Lisp_Object tail; |
| 6389 | 6326 | ||
| 6390 | do | ||
| 6391 | pid = waitpid (-1, &w, WNOHANG | WUNTRACED); | ||
| 6392 | while (pid < 0 && errno == EINTR); | ||
| 6393 | |||
| 6394 | /* PID == 0 means no processes found, PID == -1 means a real failure. | ||
| 6395 | Either way, we have done all our job. */ | ||
| 6396 | if (pid <= 0) | ||
| 6397 | return false; | ||
| 6398 | |||
| 6399 | /* Find the process that signaled us, and record its status. */ | 6327 | /* Find the process that signaled us, and record its status. */ |
| 6400 | 6328 | ||
| 6401 | /* The process can have been deleted by Fdelete_process. */ | 6329 | /* The process can have been deleted by Fdelete_process. */ |
| @@ -6406,7 +6334,7 @@ record_child_status_change (void) | |||
| 6406 | || (FLOATP (xpid) && pid == XFLOAT_DATA (xpid))) | 6334 | || (FLOATP (xpid) && pid == XFLOAT_DATA (xpid))) |
| 6407 | { | 6335 | { |
| 6408 | XSETCAR (tail, Qnil); | 6336 | XSETCAR (tail, Qnil); |
| 6409 | return true; | 6337 | return; |
| 6410 | } | 6338 | } |
| 6411 | } | 6339 | } |
| 6412 | 6340 | ||
| @@ -6476,10 +6404,11 @@ record_child_status_change (void) | |||
| 6476 | if (input_available_clear_time) | 6404 | if (input_available_clear_time) |
| 6477 | *input_available_clear_time = make_emacs_time (0, 0); | 6405 | *input_available_clear_time = make_emacs_time (0, 0); |
| 6478 | } | 6406 | } |
| 6479 | 6407 | #endif | |
| 6480 | return true; | ||
| 6481 | } | 6408 | } |
| 6482 | 6409 | ||
| 6410 | #ifdef SIGCHLD | ||
| 6411 | |||
| 6483 | /* On some systems, the SIGCHLD handler must return right away. If | 6412 | /* On some systems, the SIGCHLD handler must return right away. If |
| 6484 | any more processes want to signal us, we will get another signal. | 6413 | any more processes want to signal us, we will get another signal. |
| 6485 | Otherwise, loop around to use up all the processes that have | 6414 | Otherwise, loop around to use up all the processes that have |
| @@ -6495,14 +6424,29 @@ enum { CAN_HANDLE_MULTIPLE_CHILDREN = 1 }; | |||
| 6495 | static void | 6424 | static void |
| 6496 | handle_child_signal (int sig) | 6425 | handle_child_signal (int sig) |
| 6497 | { | 6426 | { |
| 6498 | while (record_child_status_change () && CAN_HANDLE_MULTIPLE_CHILDREN) | 6427 | do |
| 6499 | continue; | 6428 | { |
| 6429 | pid_t pid; | ||
| 6430 | int status; | ||
| 6431 | |||
| 6432 | do | ||
| 6433 | pid = waitpid (-1, &status, WNOHANG | WUNTRACED); | ||
| 6434 | while (pid < 0 && errno == EINTR); | ||
| 6435 | |||
| 6436 | /* PID == 0 means no processes found, PID == -1 means a real failure. | ||
| 6437 | Either way, we have done all our job. */ | ||
| 6438 | if (pid <= 0) | ||
| 6439 | break; | ||
| 6440 | |||
| 6441 | record_child_status_change (pid, status); | ||
| 6442 | } | ||
| 6443 | while (CAN_HANDLE_MULTIPLE_CHILDREN); | ||
| 6500 | } | 6444 | } |
| 6501 | 6445 | ||
| 6502 | static void | 6446 | static void |
| 6503 | deliver_child_signal (int sig) | 6447 | deliver_child_signal (int sig) |
| 6504 | { | 6448 | { |
| 6505 | handle_on_main_thread (sig, handle_child_signal); | 6449 | deliver_process_signal (sig, handle_child_signal); |
| 6506 | } | 6450 | } |
| 6507 | 6451 | ||
| 6508 | #endif /* SIGCHLD */ | 6452 | #endif /* SIGCHLD */ |
diff --git a/src/ralloc.c b/src/ralloc.c index 9a4b1ada229..ab91baae5b5 100644 --- a/src/ralloc.c +++ b/src/ralloc.c | |||
| @@ -1199,9 +1199,9 @@ r_alloc_init (void) | |||
| 1199 | #endif | 1199 | #endif |
| 1200 | 1200 | ||
| 1201 | #ifdef DOUG_LEA_MALLOC | 1201 | #ifdef DOUG_LEA_MALLOC |
| 1202 | BLOCK_INPUT; | 1202 | block_input (); |
| 1203 | mallopt (M_TOP_PAD, 64 * 4096); | 1203 | mallopt (M_TOP_PAD, 64 * 4096); |
| 1204 | UNBLOCK_INPUT; | 1204 | unblock_input (); |
| 1205 | #else | 1205 | #else |
| 1206 | #ifndef SYSTEM_MALLOC | 1206 | #ifndef SYSTEM_MALLOC |
| 1207 | /* Give GNU malloc's morecore some hysteresis so that we move all | 1207 | /* Give GNU malloc's morecore some hysteresis so that we move all |
diff --git a/src/search.c b/src/search.c index 5224556fa17..7c084c62e28 100644 --- a/src/search.c +++ b/src/search.c | |||
| @@ -156,7 +156,7 @@ compile_pattern_1 (struct regexp_cache *cp, Lisp_Object pattern, Lisp_Object tra | |||
| 156 | re_set_whitespace_regexp (NULL); | 156 | re_set_whitespace_regexp (NULL); |
| 157 | 157 | ||
| 158 | re_set_syntax (old); | 158 | re_set_syntax (old); |
| 159 | /* UNBLOCK_INPUT; */ | 159 | /* unblock_input (); */ |
| 160 | if (val) | 160 | if (val) |
| 161 | xsignal1 (Qinvalid_regexp, build_string (val)); | 161 | xsignal1 (Qinvalid_regexp, build_string (val)); |
| 162 | 162 | ||
diff --git a/src/sysdep.c b/src/sysdep.c index dbfd9efc7d4..dc7f6c2ad56 100644 --- a/src/sysdep.c +++ b/src/sysdep.c | |||
| @@ -279,10 +279,6 @@ init_baud_rate (int fd) | |||
| 279 | 279 | ||
| 280 | 280 | ||
| 281 | 281 | ||
| 282 | /* Set nonzero to make following function work under dbx | ||
| 283 | (at least for bsd). */ | ||
| 284 | int wait_debugging EXTERNALLY_VISIBLE; | ||
| 285 | |||
| 286 | #ifndef MSDOS | 282 | #ifndef MSDOS |
| 287 | 283 | ||
| 288 | static void | 284 | static void |
| @@ -290,48 +286,24 @@ wait_for_termination_1 (pid_t pid, int interruptible) | |||
| 290 | { | 286 | { |
| 291 | while (1) | 287 | while (1) |
| 292 | { | 288 | { |
| 293 | #if (defined (BSD_SYSTEM) || defined (HPUX)) && !defined (__GNU__) | ||
| 294 | /* Note that kill returns -1 even if the process is just a zombie now. | ||
| 295 | But inevitably a SIGCHLD interrupt should be generated | ||
| 296 | and child_sig will do waitpid and make the process go away. */ | ||
| 297 | /* There is some indication that there is a bug involved with | ||
| 298 | termination of subprocesses, perhaps involving a kernel bug too, | ||
| 299 | but no idea what it is. Just as a hunch we signal SIGCHLD to see | ||
| 300 | if that causes the problem to go away or get worse. */ | ||
| 301 | sigset_t sigchild_mask; | ||
| 302 | sigemptyset (&sigchild_mask); | ||
| 303 | sigaddset (&sigchild_mask, SIGCHLD); | ||
| 304 | pthread_sigmask (SIG_SETMASK, &sigchild_mask, 0); | ||
| 305 | |||
| 306 | if (0 > kill (pid, 0)) | ||
| 307 | { | ||
| 308 | pthread_sigmask (SIG_SETMASK, &empty_mask, 0); | ||
| 309 | kill (getpid (), SIGCHLD); | ||
| 310 | break; | ||
| 311 | } | ||
| 312 | if (wait_debugging) | ||
| 313 | sleep (1); | ||
| 314 | else | ||
| 315 | sigsuspend (&empty_mask); | ||
| 316 | #else /* not BSD_SYSTEM, and not HPUX version >= 6 */ | ||
| 317 | #ifdef WINDOWSNT | 289 | #ifdef WINDOWSNT |
| 318 | wait (0); | 290 | wait (0); |
| 319 | break; | 291 | break; |
| 320 | #else /* not WINDOWSNT */ | 292 | #else /* not WINDOWSNT */ |
| 321 | sigset_t blocked; | 293 | int status; |
| 322 | sigemptyset (&blocked); | 294 | int wait_result = waitpid (pid, &status, 0); |
| 323 | sigaddset (&blocked, SIGCHLD); | 295 | if (wait_result < 0) |
| 324 | pthread_sigmask (SIG_BLOCK, &blocked, 0); | ||
| 325 | errno = 0; | ||
| 326 | if (kill (pid, 0) == -1 && errno == ESRCH) | ||
| 327 | { | 296 | { |
| 328 | pthread_sigmask (SIG_UNBLOCK, &blocked, 0); | 297 | if (errno != EINTR) |
| 298 | break; | ||
| 299 | } | ||
| 300 | else | ||
| 301 | { | ||
| 302 | record_child_status_change (wait_result, status); | ||
| 329 | break; | 303 | break; |
| 330 | } | 304 | } |
| 331 | 305 | ||
| 332 | sigsuspend (&empty_mask); | ||
| 333 | #endif /* not WINDOWSNT */ | 306 | #endif /* not WINDOWSNT */ |
| 334 | #endif /* not BSD_SYSTEM, and not HPUX version >= 6 */ | ||
| 335 | if (interruptible) | 307 | if (interruptible) |
| 336 | QUIT; | 308 | QUIT; |
| 337 | } | 309 | } |
| @@ -1438,40 +1410,77 @@ init_system_name (void) | |||
| 1438 | 1410 | ||
| 1439 | sigset_t empty_mask; | 1411 | sigset_t empty_mask; |
| 1440 | 1412 | ||
| 1441 | /* Store into *ACTION a signal action suitable for Emacs, with handler | 1413 | static struct sigaction process_fatal_action; |
| 1442 | HANDLER. */ | 1414 | |
| 1443 | void | 1415 | static int |
| 1444 | emacs_sigaction_init (struct sigaction *action, signal_handler_t handler) | 1416 | emacs_sigaction_flags (void) |
| 1445 | { | 1417 | { |
| 1446 | sigemptyset (&action->sa_mask); | 1418 | #ifdef SA_RESTART |
| 1447 | action->sa_handler = handler; | ||
| 1448 | action->sa_flags = 0; | ||
| 1449 | #if defined (SA_RESTART) | ||
| 1450 | /* SA_RESTART causes interruptible functions with timeouts (e.g., | 1419 | /* SA_RESTART causes interruptible functions with timeouts (e.g., |
| 1451 | 'select') to reset their timeout on some platforms (e.g., | 1420 | 'select') to reset their timeout on some platforms (e.g., |
| 1452 | HP-UX 11), which is not what we want. Also, when Emacs is | 1421 | HP-UX 11), which is not what we want. Also, when Emacs is |
| 1453 | interactive, we don't want SA_RESTART because we need to poll | 1422 | interactive, we don't want SA_RESTART because we need to poll |
| 1454 | for pending input so we need long-running syscalls to be interrupted | 1423 | for pending input so we need long-running syscalls to be interrupted |
| 1455 | after a signal that sets the interrupt_input_pending flag. */ | 1424 | after a signal that sets pending_signals. |
| 1456 | /* Non-interactive keyboard input goes through stdio, where we always | 1425 | |
| 1457 | want restartable system calls. */ | 1426 | Non-interactive keyboard input goes through stdio, where we |
| 1427 | always want restartable system calls. */ | ||
| 1458 | if (noninteractive) | 1428 | if (noninteractive) |
| 1459 | action->sa_flags = SA_RESTART; | 1429 | return SA_RESTART; |
| 1460 | #endif | 1430 | #endif |
| 1431 | return 0; | ||
| 1432 | } | ||
| 1433 | |||
| 1434 | /* Store into *ACTION a signal action suitable for Emacs, with handler | ||
| 1435 | HANDLER. */ | ||
| 1436 | void | ||
| 1437 | emacs_sigaction_init (struct sigaction *action, signal_handler_t handler) | ||
| 1438 | { | ||
| 1439 | sigemptyset (&action->sa_mask); | ||
| 1440 | |||
| 1441 | /* When handling a signal, block nonfatal system signals that are caught | ||
| 1442 | by Emacs. This makes race conditions less likely. */ | ||
| 1443 | sigaddset (&action->sa_mask, SIGALRM); | ||
| 1444 | #ifdef SIGCHLD | ||
| 1445 | sigaddset (&action->sa_mask, SIGCHLD); | ||
| 1446 | #endif | ||
| 1447 | #ifdef SIGDANGER | ||
| 1448 | sigaddset (&action->sa_mask, SIGDANGER); | ||
| 1449 | #endif | ||
| 1450 | #ifdef SIGWINCH | ||
| 1451 | sigaddset (&action->sa_mask, SIGWINCH); | ||
| 1452 | #endif | ||
| 1453 | if (! noninteractive) | ||
| 1454 | { | ||
| 1455 | sigaddset (&action->sa_mask, SIGINT); | ||
| 1456 | sigaddset (&action->sa_mask, SIGQUIT); | ||
| 1457 | #ifdef USABLE_SIGIO | ||
| 1458 | sigaddset (&action->sa_mask, SIGIO); | ||
| 1459 | #endif | ||
| 1460 | } | ||
| 1461 | |||
| 1462 | if (! IEEE_FLOATING_POINT) | ||
| 1463 | sigaddset (&action->sa_mask, SIGFPE); | ||
| 1464 | |||
| 1465 | action->sa_handler = handler; | ||
| 1466 | action->sa_flags = emacs_sigaction_flags (); | ||
| 1461 | } | 1467 | } |
| 1462 | 1468 | ||
| 1463 | #ifdef FORWARD_SIGNAL_TO_MAIN_THREAD | 1469 | #ifdef FORWARD_SIGNAL_TO_MAIN_THREAD |
| 1464 | static pthread_t main_thread; | 1470 | static pthread_t main_thread; |
| 1465 | #endif | 1471 | #endif |
| 1466 | 1472 | ||
| 1467 | /* If we are on the main thread, handle the signal SIG with HANDLER. | 1473 | /* SIG has arrived at the current process. Deliver it to the main |
| 1474 | thread, which should handle it with HANDLER. | ||
| 1475 | |||
| 1476 | If we are on the main thread, handle the signal SIG with HANDLER. | ||
| 1468 | Otherwise, redirect the signal to the main thread, blocking it from | 1477 | Otherwise, redirect the signal to the main thread, blocking it from |
| 1469 | this thread. POSIX says any thread can receive a signal that is | 1478 | this thread. POSIX says any thread can receive a signal that is |
| 1470 | associated with a process, process group, or asynchronous event. | 1479 | associated with a process, process group, or asynchronous event. |
| 1471 | On GNU/Linux that is not true, but for other systems (FreeBSD at | 1480 | On GNU/Linux that is not true, but for other systems (FreeBSD at |
| 1472 | least) it is. */ | 1481 | least) it is. */ |
| 1473 | void | 1482 | void |
| 1474 | handle_on_main_thread (int sig, signal_handler_t handler) | 1483 | deliver_process_signal (int sig, signal_handler_t handler) |
| 1475 | { | 1484 | { |
| 1476 | /* Preserve errno, to avoid race conditions with signal handlers that | 1485 | /* Preserve errno, to avoid race conditions with signal handlers that |
| 1477 | might change errno. Races can occur even in single-threaded hosts. */ | 1486 | might change errno. Races can occur even in single-threaded hosts. */ |
| @@ -1494,6 +1503,39 @@ handle_on_main_thread (int sig, signal_handler_t handler) | |||
| 1494 | 1503 | ||
| 1495 | errno = old_errno; | 1504 | errno = old_errno; |
| 1496 | } | 1505 | } |
| 1506 | |||
| 1507 | /* Static location to save a fatal backtrace in a thread. | ||
| 1508 | FIXME: If two subsidiary threads fail simultaneously, the resulting | ||
| 1509 | backtrace may be garbage. */ | ||
| 1510 | enum { BACKTRACE_LIMIT_MAX = 500 }; | ||
| 1511 | static void *thread_backtrace_buffer[BACKTRACE_LIMIT_MAX + 1]; | ||
| 1512 | static int thread_backtrace_npointers; | ||
| 1513 | |||
| 1514 | /* SIG has arrived at the current thread. | ||
| 1515 | If we are on the main thread, handle the signal SIG with HANDLER. | ||
| 1516 | Otherwise, this is a fatal error in the handling thread. */ | ||
| 1517 | static void | ||
| 1518 | deliver_thread_signal (int sig, signal_handler_t handler) | ||
| 1519 | { | ||
| 1520 | int old_errno = errno; | ||
| 1521 | |||
| 1522 | #ifdef FORWARD_SIGNAL_TO_MAIN_THREAD | ||
| 1523 | if (! pthread_equal (pthread_self (), main_thread)) | ||
| 1524 | { | ||
| 1525 | thread_backtrace_npointers | ||
| 1526 | = backtrace (thread_backtrace_buffer, BACKTRACE_LIMIT_MAX); | ||
| 1527 | sigaction (sig, &process_fatal_action, 0); | ||
| 1528 | pthread_kill (main_thread, sig); | ||
| 1529 | |||
| 1530 | /* Avoid further damage while the main thread is exiting. */ | ||
| 1531 | while (1) | ||
| 1532 | sigsuspend (&empty_mask); | ||
| 1533 | } | ||
| 1534 | #endif | ||
| 1535 | |||
| 1536 | handler (sig); | ||
| 1537 | errno = old_errno; | ||
| 1538 | } | ||
| 1497 | 1539 | ||
| 1498 | #if !defined HAVE_STRSIGNAL && !HAVE_DECL_SYS_SIGLIST | 1540 | #if !defined HAVE_STRSIGNAL && !HAVE_DECL_SYS_SIGLIST |
| 1499 | static char *my_sys_siglist[NSIG]; | 1541 | static char *my_sys_siglist[NSIG]; |
| @@ -1503,9 +1545,60 @@ static char *my_sys_siglist[NSIG]; | |||
| 1503 | # define sys_siglist my_sys_siglist | 1545 | # define sys_siglist my_sys_siglist |
| 1504 | #endif | 1546 | #endif |
| 1505 | 1547 | ||
| 1548 | /* Handle bus errors, invalid instruction, etc. */ | ||
| 1549 | static void | ||
| 1550 | handle_fatal_signal (int sig) | ||
| 1551 | { | ||
| 1552 | terminate_due_to_signal (sig, 10); | ||
| 1553 | } | ||
| 1554 | |||
| 1555 | static void | ||
| 1556 | deliver_fatal_signal (int sig) | ||
| 1557 | { | ||
| 1558 | deliver_process_signal (sig, handle_fatal_signal); | ||
| 1559 | } | ||
| 1560 | |||
| 1561 | static void | ||
| 1562 | deliver_fatal_thread_signal (int sig) | ||
| 1563 | { | ||
| 1564 | deliver_thread_signal (sig, handle_fatal_signal); | ||
| 1565 | } | ||
| 1566 | |||
| 1567 | static _Noreturn void | ||
| 1568 | handle_arith_signal (int sig) | ||
| 1569 | { | ||
| 1570 | pthread_sigmask (SIG_SETMASK, &empty_mask, 0); | ||
| 1571 | xsignal0 (Qarith_error); | ||
| 1572 | } | ||
| 1573 | |||
| 1574 | static void | ||
| 1575 | deliver_arith_signal (int sig) | ||
| 1576 | { | ||
| 1577 | deliver_thread_signal (sig, handle_arith_signal); | ||
| 1578 | } | ||
| 1579 | |||
| 1580 | /* Treat SIG as a terminating signal, unless it is already ignored and | ||
| 1581 | we are in --batch mode. Among other things, this makes nohup work. */ | ||
| 1582 | static void | ||
| 1583 | maybe_fatal_sig (int sig) | ||
| 1584 | { | ||
| 1585 | bool catch_sig = !noninteractive; | ||
| 1586 | if (!catch_sig) | ||
| 1587 | { | ||
| 1588 | struct sigaction old_action; | ||
| 1589 | sigaction (sig, 0, &old_action); | ||
| 1590 | catch_sig = old_action.sa_handler != SIG_IGN; | ||
| 1591 | } | ||
| 1592 | if (catch_sig) | ||
| 1593 | sigaction (sig, &process_fatal_action, 0); | ||
| 1594 | } | ||
| 1595 | |||
| 1506 | void | 1596 | void |
| 1507 | init_signals (void) | 1597 | init_signals (bool dumping) |
| 1508 | { | 1598 | { |
| 1599 | struct sigaction thread_fatal_action; | ||
| 1600 | struct sigaction action; | ||
| 1601 | |||
| 1509 | sigemptyset (&empty_mask); | 1602 | sigemptyset (&empty_mask); |
| 1510 | 1603 | ||
| 1511 | #ifdef FORWARD_SIGNAL_TO_MAIN_THREAD | 1604 | #ifdef FORWARD_SIGNAL_TO_MAIN_THREAD |
| @@ -1515,9 +1608,7 @@ init_signals (void) | |||
| 1515 | #if !defined HAVE_STRSIGNAL && !HAVE_DECL_SYS_SIGLIST | 1608 | #if !defined HAVE_STRSIGNAL && !HAVE_DECL_SYS_SIGLIST |
| 1516 | if (! initialized) | 1609 | if (! initialized) |
| 1517 | { | 1610 | { |
| 1518 | # ifdef SIGABRT | ||
| 1519 | sys_siglist[SIGABRT] = "Aborted"; | 1611 | sys_siglist[SIGABRT] = "Aborted"; |
| 1520 | # endif | ||
| 1521 | # ifdef SIGAIO | 1612 | # ifdef SIGAIO |
| 1522 | sys_siglist[SIGAIO] = "LAN I/O interrupt"; | 1613 | sys_siglist[SIGAIO] = "LAN I/O interrupt"; |
| 1523 | # endif | 1614 | # endif |
| @@ -1545,9 +1636,7 @@ init_signals (void) | |||
| 1545 | # ifdef SIGEMT | 1636 | # ifdef SIGEMT |
| 1546 | sys_siglist[SIGEMT] = "Emulation trap"; | 1637 | sys_siglist[SIGEMT] = "Emulation trap"; |
| 1547 | # endif | 1638 | # endif |
| 1548 | # ifdef SIGFPE | ||
| 1549 | sys_siglist[SIGFPE] = "Arithmetic exception"; | 1639 | sys_siglist[SIGFPE] = "Arithmetic exception"; |
| 1550 | # endif | ||
| 1551 | # ifdef SIGFREEZE | 1640 | # ifdef SIGFREEZE |
| 1552 | sys_siglist[SIGFREEZE] = "SIGFREEZE"; | 1641 | sys_siglist[SIGFREEZE] = "SIGFREEZE"; |
| 1553 | # endif | 1642 | # endif |
| @@ -1557,12 +1646,8 @@ init_signals (void) | |||
| 1557 | # ifdef SIGHUP | 1646 | # ifdef SIGHUP |
| 1558 | sys_siglist[SIGHUP] = "Hangup"; | 1647 | sys_siglist[SIGHUP] = "Hangup"; |
| 1559 | # endif | 1648 | # endif |
| 1560 | # ifdef SIGILL | ||
| 1561 | sys_siglist[SIGILL] = "Illegal instruction"; | 1649 | sys_siglist[SIGILL] = "Illegal instruction"; |
| 1562 | # endif | ||
| 1563 | # ifdef SIGINT | ||
| 1564 | sys_siglist[SIGINT] = "Interrupt"; | 1650 | sys_siglist[SIGINT] = "Interrupt"; |
| 1565 | # endif | ||
| 1566 | # ifdef SIGIO | 1651 | # ifdef SIGIO |
| 1567 | sys_siglist[SIGIO] = "I/O possible"; | 1652 | sys_siglist[SIGIO] = "I/O possible"; |
| 1568 | # endif | 1653 | # endif |
| @@ -1611,9 +1696,7 @@ init_signals (void) | |||
| 1611 | # ifdef SIGSAK | 1696 | # ifdef SIGSAK |
| 1612 | sys_siglist[SIGSAK] = "Secure attention"; | 1697 | sys_siglist[SIGSAK] = "Secure attention"; |
| 1613 | # endif | 1698 | # endif |
| 1614 | # ifdef SIGSEGV | ||
| 1615 | sys_siglist[SIGSEGV] = "Segmentation violation"; | 1699 | sys_siglist[SIGSEGV] = "Segmentation violation"; |
| 1616 | # endif | ||
| 1617 | # ifdef SIGSOUND | 1700 | # ifdef SIGSOUND |
| 1618 | sys_siglist[SIGSOUND] = "Sound completed"; | 1701 | sys_siglist[SIGSOUND] = "Sound completed"; |
| 1619 | # endif | 1702 | # endif |
| @@ -1626,9 +1709,7 @@ init_signals (void) | |||
| 1626 | # ifdef SIGSYS | 1709 | # ifdef SIGSYS |
| 1627 | sys_siglist[SIGSYS] = "Bad argument to system call"; | 1710 | sys_siglist[SIGSYS] = "Bad argument to system call"; |
| 1628 | # endif | 1711 | # endif |
| 1629 | # ifdef SIGTERM | ||
| 1630 | sys_siglist[SIGTERM] = "Terminated"; | 1712 | sys_siglist[SIGTERM] = "Terminated"; |
| 1631 | # endif | ||
| 1632 | # ifdef SIGTHAW | 1713 | # ifdef SIGTHAW |
| 1633 | sys_siglist[SIGTHAW] = "SIGTHAW"; | 1714 | sys_siglist[SIGTHAW] = "SIGTHAW"; |
| 1634 | # endif | 1715 | # endif |
| @@ -1673,6 +1754,129 @@ init_signals (void) | |||
| 1673 | # endif | 1754 | # endif |
| 1674 | } | 1755 | } |
| 1675 | #endif /* !defined HAVE_STRSIGNAL && !defined HAVE_DECL_SYS_SIGLIST */ | 1756 | #endif /* !defined HAVE_STRSIGNAL && !defined HAVE_DECL_SYS_SIGLIST */ |
| 1757 | |||
| 1758 | /* Don't alter signal handlers if dumping. On some machines, | ||
| 1759 | changing signal handlers sets static data that would make signals | ||
| 1760 | fail to work right when the dumped Emacs is run. */ | ||
| 1761 | if (dumping) | ||
| 1762 | return; | ||
| 1763 | |||
| 1764 | sigfillset (&process_fatal_action.sa_mask); | ||
| 1765 | process_fatal_action.sa_handler = deliver_fatal_signal; | ||
| 1766 | process_fatal_action.sa_flags = emacs_sigaction_flags () | SA_NODEFER; | ||
| 1767 | |||
| 1768 | sigfillset (&thread_fatal_action.sa_mask); | ||
| 1769 | thread_fatal_action.sa_handler = deliver_fatal_thread_signal; | ||
| 1770 | thread_fatal_action.sa_flags = process_fatal_action.sa_flags; | ||
| 1771 | |||
| 1772 | /* SIGINT may need special treatment on MS-Windows. See | ||
| 1773 | http://lists.gnu.org/archive/html/emacs-devel/2010-09/msg01062.html | ||
| 1774 | Please update the doc of kill-emacs, kill-emacs-hook, and | ||
| 1775 | NEWS if you change this. */ | ||
| 1776 | |||
| 1777 | maybe_fatal_sig (SIGHUP); | ||
| 1778 | maybe_fatal_sig (SIGINT); | ||
| 1779 | maybe_fatal_sig (SIGTERM); | ||
| 1780 | |||
| 1781 | /* Emacs checks for write errors, so it can safely ignore SIGPIPE. | ||
| 1782 | However, in batch mode leave SIGPIPE alone, as that causes Emacs | ||
| 1783 | to behave more like typical batch applications do. */ | ||
| 1784 | if (! noninteractive) | ||
| 1785 | signal (SIGPIPE, SIG_IGN); | ||
| 1786 | |||
| 1787 | sigaction (SIGQUIT, &process_fatal_action, 0); | ||
| 1788 | sigaction (SIGILL, &thread_fatal_action, 0); | ||
| 1789 | sigaction (SIGTRAP, &thread_fatal_action, 0); | ||
| 1790 | |||
| 1791 | /* Typically SIGFPE is thread-specific and is fatal, like SIGILL. | ||
| 1792 | But on a non-IEEE host SIGFPE can come from a trap in the Lisp | ||
| 1793 | interpreter's floating point operations, so treat SIGFPE as an | ||
| 1794 | arith-error if it arises in the main thread. */ | ||
| 1795 | if (IEEE_FLOATING_POINT) | ||
| 1796 | sigaction (SIGFPE, &thread_fatal_action, 0); | ||
| 1797 | else | ||
| 1798 | { | ||
| 1799 | emacs_sigaction_init (&action, deliver_arith_signal); | ||
| 1800 | sigaction (SIGFPE, &action, 0); | ||
| 1801 | } | ||
| 1802 | |||
| 1803 | #ifdef SIGUSR1 | ||
| 1804 | add_user_signal (SIGUSR1, "sigusr1"); | ||
| 1805 | #endif | ||
| 1806 | #ifdef SIGUSR2 | ||
| 1807 | add_user_signal (SIGUSR2, "sigusr2"); | ||
| 1808 | #endif | ||
| 1809 | sigaction (SIGABRT, &thread_fatal_action, 0); | ||
| 1810 | #ifdef SIGPRE | ||
| 1811 | sigaction (SIGPRE, &thread_fatal_action, 0); | ||
| 1812 | #endif | ||
| 1813 | #ifdef SIGORE | ||
| 1814 | sigaction (SIGORE, &thread_fatal_action, 0); | ||
| 1815 | #endif | ||
| 1816 | #ifdef SIGUME | ||
| 1817 | sigaction (SIGUME, &thread_fatal_action, 0); | ||
| 1818 | #endif | ||
| 1819 | #ifdef SIGDLK | ||
| 1820 | sigaction (SIGDLK, &process_fatal_action, 0); | ||
| 1821 | #endif | ||
| 1822 | #ifdef SIGCPULIM | ||
| 1823 | sigaction (SIGCPULIM, &process_fatal_action, 0); | ||
| 1824 | #endif | ||
| 1825 | #ifdef SIGIOT | ||
| 1826 | sigaction (SIGIOT, &thread_fatal_action, 0); | ||
| 1827 | #endif | ||
| 1828 | #ifdef SIGEMT | ||
| 1829 | sigaction (SIGEMT, &thread_fatal_action, 0); | ||
| 1830 | #endif | ||
| 1831 | #ifdef SIGBUS | ||
| 1832 | sigaction (SIGBUS, &thread_fatal_action, 0); | ||
| 1833 | #endif | ||
| 1834 | sigaction (SIGSEGV, &thread_fatal_action, 0); | ||
| 1835 | #ifdef SIGSYS | ||
| 1836 | sigaction (SIGSYS, &thread_fatal_action, 0); | ||
| 1837 | #endif | ||
| 1838 | sigaction (SIGTERM, &process_fatal_action, 0); | ||
| 1839 | #ifdef SIGPROF | ||
| 1840 | sigaction (SIGPROF, &process_fatal_action, 0); | ||
| 1841 | #endif | ||
| 1842 | #ifdef SIGVTALRM | ||
| 1843 | sigaction (SIGVTALRM, &process_fatal_action, 0); | ||
| 1844 | #endif | ||
| 1845 | #ifdef SIGXCPU | ||
| 1846 | sigaction (SIGXCPU, &process_fatal_action, 0); | ||
| 1847 | #endif | ||
| 1848 | #ifdef SIGXFSZ | ||
| 1849 | sigaction (SIGXFSZ, &process_fatal_action, 0); | ||
| 1850 | #endif | ||
| 1851 | |||
| 1852 | #ifdef SIGDANGER | ||
| 1853 | /* This just means available memory is getting low. */ | ||
| 1854 | emacs_sigaction_init (&action, deliver_danger_signal); | ||
| 1855 | sigaction (SIGDANGER, &action, 0); | ||
| 1856 | #endif | ||
| 1857 | |||
| 1858 | /* AIX-specific signals. */ | ||
| 1859 | #ifdef SIGGRANT | ||
| 1860 | sigaction (SIGGRANT, &process_fatal_action, 0); | ||
| 1861 | #endif | ||
| 1862 | #ifdef SIGMIGRATE | ||
| 1863 | sigaction (SIGMIGRATE, &process_fatal_action, 0); | ||
| 1864 | #endif | ||
| 1865 | #ifdef SIGMSG | ||
| 1866 | sigaction (SIGMSG, &process_fatal_action, 0); | ||
| 1867 | #endif | ||
| 1868 | #ifdef SIGRETRACT | ||
| 1869 | sigaction (SIGRETRACT, &process_fatal_action, 0); | ||
| 1870 | #endif | ||
| 1871 | #ifdef SIGSAK | ||
| 1872 | sigaction (SIGSAK, &process_fatal_action, 0); | ||
| 1873 | #endif | ||
| 1874 | #ifdef SIGSOUND | ||
| 1875 | sigaction (SIGSOUND, &process_fatal_action, 0); | ||
| 1876 | #endif | ||
| 1877 | #ifdef SIGTALRM | ||
| 1878 | sigaction (SIGTALRM, &thread_fatal_action, 0); | ||
| 1879 | #endif | ||
| 1676 | } | 1880 | } |
| 1677 | 1881 | ||
| 1678 | #ifndef HAVE_RANDOM | 1882 | #ifndef HAVE_RANDOM |
| @@ -1811,23 +2015,37 @@ snprintf (char *buf, size_t bufsize, char const *format, ...) | |||
| 1811 | void | 2015 | void |
| 1812 | emacs_backtrace (int backtrace_limit) | 2016 | emacs_backtrace (int backtrace_limit) |
| 1813 | { | 2017 | { |
| 1814 | enum { BACKTRACE_LIMIT_MAX = 500 }; | 2018 | void *main_backtrace_buffer[BACKTRACE_LIMIT_MAX + 1]; |
| 1815 | void *buffer[BACKTRACE_LIMIT_MAX + 1]; | ||
| 1816 | int bounded_limit = min (backtrace_limit, BACKTRACE_LIMIT_MAX); | 2019 | int bounded_limit = min (backtrace_limit, BACKTRACE_LIMIT_MAX); |
| 1817 | int npointers = backtrace (buffer, bounded_limit + 1); | 2020 | void *buffer; |
| 2021 | int npointers; | ||
| 2022 | |||
| 2023 | if (thread_backtrace_npointers) | ||
| 2024 | { | ||
| 2025 | buffer = thread_backtrace_buffer; | ||
| 2026 | npointers = thread_backtrace_npointers; | ||
| 2027 | } | ||
| 2028 | else | ||
| 2029 | { | ||
| 2030 | buffer = main_backtrace_buffer; | ||
| 2031 | npointers = backtrace (buffer, bounded_limit + 1); | ||
| 2032 | } | ||
| 2033 | |||
| 1818 | if (npointers) | 2034 | if (npointers) |
| 1819 | ignore_value (write (STDERR_FILENO, "\nBacktrace:\n", 12)); | 2035 | { |
| 1820 | backtrace_symbols_fd (buffer, bounded_limit, STDERR_FILENO); | 2036 | ignore_value (write (STDERR_FILENO, "\nBacktrace:\n", 12)); |
| 1821 | if (bounded_limit < npointers) | 2037 | backtrace_symbols_fd (buffer, npointers, STDERR_FILENO); |
| 1822 | ignore_value (write (STDERR_FILENO, "...\n", 4)); | 2038 | if (bounded_limit < npointers) |
| 2039 | ignore_value (write (STDERR_FILENO, "...\n", 4)); | ||
| 2040 | } | ||
| 1823 | } | 2041 | } |
| 1824 | 2042 | ||
| 1825 | #ifndef HAVE_NTGUI | 2043 | #ifndef HAVE_NTGUI |
| 1826 | /* Using emacs_abort lets GDB return from a breakpoint here. */ | ||
| 1827 | void | 2044 | void |
| 1828 | emacs_abort (void) | 2045 | emacs_abort (void) |
| 1829 | { | 2046 | { |
| 1830 | fatal_error_backtrace (SIGABRT, 10); | 2047 | signal (SIGABRT, SIG_DFL); |
| 2048 | terminate_due_to_signal (SIGABRT, 10); | ||
| 1831 | } | 2049 | } |
| 1832 | #endif | 2050 | #endif |
| 1833 | 2051 | ||
| @@ -1910,7 +2128,8 @@ emacs_write (int fildes, const char *buf, ptrdiff_t nbyte) | |||
| 1910 | { | 2128 | { |
| 1911 | /* I originally used `QUIT' but that might causes files to | 2129 | /* I originally used `QUIT' but that might causes files to |
| 1912 | be truncated if you hit C-g in the middle of it. --Stef */ | 2130 | be truncated if you hit C-g in the middle of it. --Stef */ |
| 1913 | process_pending_signals (); | 2131 | if (pending_signals) |
| 2132 | process_pending_signals (); | ||
| 1914 | continue; | 2133 | continue; |
| 1915 | } | 2134 | } |
| 1916 | else | 2135 | else |
| @@ -1975,11 +2194,11 @@ getwd (char *pathname) | |||
| 1975 | char *npath, *spath; | 2194 | char *npath, *spath; |
| 1976 | extern char *getcwd (char *, size_t); | 2195 | extern char *getcwd (char *, size_t); |
| 1977 | 2196 | ||
| 1978 | BLOCK_INPUT; /* getcwd uses malloc */ | 2197 | block_input (); /* getcwd uses malloc */ |
| 1979 | spath = npath = getcwd ((char *) 0, MAXPATHLEN); | 2198 | spath = npath = getcwd ((char *) 0, MAXPATHLEN); |
| 1980 | if (spath == 0) | 2199 | if (spath == 0) |
| 1981 | { | 2200 | { |
| 1982 | UNBLOCK_INPUT; | 2201 | unblock_input (); |
| 1983 | return spath; | 2202 | return spath; |
| 1984 | } | 2203 | } |
| 1985 | /* On Altos 3068, getcwd can return @hostname/dir, so discard | 2204 | /* On Altos 3068, getcwd can return @hostname/dir, so discard |
| @@ -1988,7 +2207,7 @@ getwd (char *pathname) | |||
| 1988 | npath++; | 2207 | npath++; |
| 1989 | strcpy (pathname, npath); | 2208 | strcpy (pathname, npath); |
| 1990 | free (spath); /* getcwd uses malloc */ | 2209 | free (spath); /* getcwd uses malloc */ |
| 1991 | UNBLOCK_INPUT; | 2210 | unblock_input (); |
| 1992 | return pathname; | 2211 | return pathname; |
| 1993 | } | 2212 | } |
| 1994 | 2213 | ||
| @@ -2422,7 +2641,7 @@ get_up_time (void) | |||
| 2422 | FILE *fup; | 2641 | FILE *fup; |
| 2423 | EMACS_TIME up = make_emacs_time (0, 0); | 2642 | EMACS_TIME up = make_emacs_time (0, 0); |
| 2424 | 2643 | ||
| 2425 | BLOCK_INPUT; | 2644 | block_input (); |
| 2426 | fup = fopen ("/proc/uptime", "r"); | 2645 | fup = fopen ("/proc/uptime", "r"); |
| 2427 | 2646 | ||
| 2428 | if (fup) | 2647 | if (fup) |
| @@ -2453,7 +2672,7 @@ get_up_time (void) | |||
| 2453 | } | 2672 | } |
| 2454 | fclose (fup); | 2673 | fclose (fup); |
| 2455 | } | 2674 | } |
| 2456 | UNBLOCK_INPUT; | 2675 | unblock_input (); |
| 2457 | 2676 | ||
| 2458 | return up; | 2677 | return up; |
| 2459 | } | 2678 | } |
| @@ -2467,7 +2686,7 @@ procfs_ttyname (int rdev) | |||
| 2467 | FILE *fdev = NULL; | 2686 | FILE *fdev = NULL; |
| 2468 | char name[PATH_MAX]; | 2687 | char name[PATH_MAX]; |
| 2469 | 2688 | ||
| 2470 | BLOCK_INPUT; | 2689 | block_input (); |
| 2471 | fdev = fopen ("/proc/tty/drivers", "r"); | 2690 | fdev = fopen ("/proc/tty/drivers", "r"); |
| 2472 | 2691 | ||
| 2473 | if (fdev) | 2692 | if (fdev) |
| @@ -2499,7 +2718,7 @@ procfs_ttyname (int rdev) | |||
| 2499 | } | 2718 | } |
| 2500 | fclose (fdev); | 2719 | fclose (fdev); |
| 2501 | } | 2720 | } |
| 2502 | UNBLOCK_INPUT; | 2721 | unblock_input (); |
| 2503 | return build_string (name); | 2722 | return build_string (name); |
| 2504 | } | 2723 | } |
| 2505 | 2724 | ||
| @@ -2509,7 +2728,7 @@ procfs_get_total_memory (void) | |||
| 2509 | FILE *fmem = NULL; | 2728 | FILE *fmem = NULL; |
| 2510 | unsigned long retval = 2 * 1024 * 1024; /* default: 2GB */ | 2729 | unsigned long retval = 2 * 1024 * 1024; /* default: 2GB */ |
| 2511 | 2730 | ||
| 2512 | BLOCK_INPUT; | 2731 | block_input (); |
| 2513 | fmem = fopen ("/proc/meminfo", "r"); | 2732 | fmem = fopen ("/proc/meminfo", "r"); |
| 2514 | 2733 | ||
| 2515 | if (fmem) | 2734 | if (fmem) |
| @@ -2528,7 +2747,7 @@ procfs_get_total_memory (void) | |||
| 2528 | } | 2747 | } |
| 2529 | fclose (fmem); | 2748 | fclose (fmem); |
| 2530 | } | 2749 | } |
| 2531 | UNBLOCK_INPUT; | 2750 | unblock_input (); |
| 2532 | return retval; | 2751 | return retval; |
| 2533 | } | 2752 | } |
| 2534 | 2753 | ||
| @@ -2574,17 +2793,17 @@ system_process_attributes (Lisp_Object pid) | |||
| 2574 | /* euid egid */ | 2793 | /* euid egid */ |
| 2575 | uid = st.st_uid; | 2794 | uid = st.st_uid; |
| 2576 | attrs = Fcons (Fcons (Qeuid, make_fixnum_or_float (uid)), attrs); | 2795 | attrs = Fcons (Fcons (Qeuid, make_fixnum_or_float (uid)), attrs); |
| 2577 | BLOCK_INPUT; | 2796 | block_input (); |
| 2578 | pw = getpwuid (uid); | 2797 | pw = getpwuid (uid); |
| 2579 | UNBLOCK_INPUT; | 2798 | unblock_input (); |
| 2580 | if (pw) | 2799 | if (pw) |
| 2581 | attrs = Fcons (Fcons (Quser, build_string (pw->pw_name)), attrs); | 2800 | attrs = Fcons (Fcons (Quser, build_string (pw->pw_name)), attrs); |
| 2582 | 2801 | ||
| 2583 | gid = st.st_gid; | 2802 | gid = st.st_gid; |
| 2584 | attrs = Fcons (Fcons (Qegid, make_fixnum_or_float (gid)), attrs); | 2803 | attrs = Fcons (Fcons (Qegid, make_fixnum_or_float (gid)), attrs); |
| 2585 | BLOCK_INPUT; | 2804 | block_input (); |
| 2586 | gr = getgrgid (gid); | 2805 | gr = getgrgid (gid); |
| 2587 | UNBLOCK_INPUT; | 2806 | unblock_input (); |
| 2588 | if (gr) | 2807 | if (gr) |
| 2589 | attrs = Fcons (Fcons (Qgroup, build_string (gr->gr_name)), attrs); | 2808 | attrs = Fcons (Fcons (Qgroup, build_string (gr->gr_name)), attrs); |
| 2590 | 2809 | ||
| @@ -2812,17 +3031,17 @@ system_process_attributes (Lisp_Object pid) | |||
| 2812 | /* euid egid */ | 3031 | /* euid egid */ |
| 2813 | uid = st.st_uid; | 3032 | uid = st.st_uid; |
| 2814 | attrs = Fcons (Fcons (Qeuid, make_fixnum_or_float (uid)), attrs); | 3033 | attrs = Fcons (Fcons (Qeuid, make_fixnum_or_float (uid)), attrs); |
| 2815 | BLOCK_INPUT; | 3034 | block_input (); |
| 2816 | pw = getpwuid (uid); | 3035 | pw = getpwuid (uid); |
| 2817 | UNBLOCK_INPUT; | 3036 | unblock_input (); |
| 2818 | if (pw) | 3037 | if (pw) |
| 2819 | attrs = Fcons (Fcons (Quser, build_string (pw->pw_name)), attrs); | 3038 | attrs = Fcons (Fcons (Quser, build_string (pw->pw_name)), attrs); |
| 2820 | 3039 | ||
| 2821 | gid = st.st_gid; | 3040 | gid = st.st_gid; |
| 2822 | attrs = Fcons (Fcons (Qegid, make_fixnum_or_float (gid)), attrs); | 3041 | attrs = Fcons (Fcons (Qegid, make_fixnum_or_float (gid)), attrs); |
| 2823 | BLOCK_INPUT; | 3042 | block_input (); |
| 2824 | gr = getgrgid (gid); | 3043 | gr = getgrgid (gid); |
| 2825 | UNBLOCK_INPUT; | 3044 | unblock_input (); |
| 2826 | if (gr) | 3045 | if (gr) |
| 2827 | attrs = Fcons (Fcons (Qgroup, build_string (gr->gr_name)), attrs); | 3046 | attrs = Fcons (Fcons (Qgroup, build_string (gr->gr_name)), attrs); |
| 2828 | 3047 | ||
| @@ -2943,17 +3162,17 @@ system_process_attributes (Lisp_Object pid) | |||
| 2943 | 3162 | ||
| 2944 | attrs = Fcons (Fcons (Qeuid, make_fixnum_or_float (proc.ki_uid)), attrs); | 3163 | attrs = Fcons (Fcons (Qeuid, make_fixnum_or_float (proc.ki_uid)), attrs); |
| 2945 | 3164 | ||
| 2946 | BLOCK_INPUT; | 3165 | block_input (); |
| 2947 | pw = getpwuid (proc.ki_uid); | 3166 | pw = getpwuid (proc.ki_uid); |
| 2948 | UNBLOCK_INPUT; | 3167 | unblock_input (); |
| 2949 | if (pw) | 3168 | if (pw) |
| 2950 | attrs = Fcons (Fcons (Quser, build_string (pw->pw_name)), attrs); | 3169 | attrs = Fcons (Fcons (Quser, build_string (pw->pw_name)), attrs); |
| 2951 | 3170 | ||
| 2952 | attrs = Fcons (Fcons (Qegid, make_fixnum_or_float (proc.ki_svgid)), attrs); | 3171 | attrs = Fcons (Fcons (Qegid, make_fixnum_or_float (proc.ki_svgid)), attrs); |
| 2953 | 3172 | ||
| 2954 | BLOCK_INPUT; | 3173 | block_input (); |
| 2955 | gr = getgrgid (proc.ki_svgid); | 3174 | gr = getgrgid (proc.ki_svgid); |
| 2956 | UNBLOCK_INPUT; | 3175 | unblock_input (); |
| 2957 | if (gr) | 3176 | if (gr) |
| 2958 | attrs = Fcons (Fcons (Qgroup, build_string (gr->gr_name)), attrs); | 3177 | attrs = Fcons (Fcons (Qgroup, build_string (gr->gr_name)), attrs); |
| 2959 | 3178 | ||
| @@ -2993,9 +3212,9 @@ system_process_attributes (Lisp_Object pid) | |||
| 2993 | attrs = Fcons (Fcons (Qpgrp, make_fixnum_or_float (proc.ki_pgid)), attrs); | 3212 | attrs = Fcons (Fcons (Qpgrp, make_fixnum_or_float (proc.ki_pgid)), attrs); |
| 2994 | attrs = Fcons (Fcons (Qsess, make_fixnum_or_float (proc.ki_sid)), attrs); | 3213 | attrs = Fcons (Fcons (Qsess, make_fixnum_or_float (proc.ki_sid)), attrs); |
| 2995 | 3214 | ||
| 2996 | BLOCK_INPUT; | 3215 | block_input (); |
| 2997 | ttyname = proc.ki_tdev == NODEV ? NULL : devname (proc.ki_tdev, S_IFCHR); | 3216 | ttyname = proc.ki_tdev == NODEV ? NULL : devname (proc.ki_tdev, S_IFCHR); |
| 2998 | UNBLOCK_INPUT; | 3217 | unblock_input (); |
| 2999 | if (ttyname) | 3218 | if (ttyname) |
| 3000 | attrs = Fcons (Fcons (Qtty, build_string (ttyname)), attrs); | 3219 | attrs = Fcons (Fcons (Qtty, build_string (ttyname)), attrs); |
| 3001 | 3220 | ||
diff --git a/src/syssignal.h b/src/syssignal.h index e309e6725b7..5c0edaa591d 100644 --- a/src/syssignal.h +++ b/src/syssignal.h | |||
| @@ -18,8 +18,9 @@ You should have received a copy of the GNU General Public License | |||
| 18 | along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | 18 | along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ |
| 19 | 19 | ||
| 20 | #include <signal.h> | 20 | #include <signal.h> |
| 21 | #include <stdbool.h> | ||
| 21 | 22 | ||
| 22 | extern void init_signals (void); | 23 | extern void init_signals (bool); |
| 23 | 24 | ||
| 24 | #ifdef HAVE_PTHREAD | 25 | #ifdef HAVE_PTHREAD |
| 25 | #include <pthread.h> | 26 | #include <pthread.h> |
| @@ -39,6 +40,10 @@ extern void emacs_sigaction_init (struct sigaction *, signal_handler_t); | |||
| 39 | # define NSIG NSIG_MINIMUM | 40 | # define NSIG NSIG_MINIMUM |
| 40 | #endif | 41 | #endif |
| 41 | 42 | ||
| 43 | #ifndef emacs_raise | ||
| 44 | # define emacs_raise(sig) raise (sig) | ||
| 45 | #endif | ||
| 46 | |||
| 42 | /* On bsd, [man says] kill does not accept a negative number to kill a pgrp. | 47 | /* On bsd, [man says] kill does not accept a negative number to kill a pgrp. |
| 43 | Must do that using the killpg call. */ | 48 | Must do that using the killpg call. */ |
| 44 | #ifdef BSD_SYSTEM | 49 | #ifdef BSD_SYSTEM |
| @@ -64,4 +69,4 @@ extern void emacs_sigaction_init (struct sigaction *, signal_handler_t); | |||
| 64 | char *strsignal (int); | 69 | char *strsignal (int); |
| 65 | #endif | 70 | #endif |
| 66 | 71 | ||
| 67 | void handle_on_main_thread (int, signal_handler_t); | 72 | void deliver_process_signal (int, signal_handler_t); |
diff --git a/src/term.c b/src/term.c index f4117d67dec..189fb783cbc 100644 --- a/src/term.c +++ b/src/term.c | |||
| @@ -753,13 +753,13 @@ tty_write_glyphs (struct frame *f, struct glyph *string, int len) | |||
| 753 | conversion_buffer = encode_terminal_code (string, n, coding); | 753 | conversion_buffer = encode_terminal_code (string, n, coding); |
| 754 | if (coding->produced > 0) | 754 | if (coding->produced > 0) |
| 755 | { | 755 | { |
| 756 | BLOCK_INPUT; | 756 | block_input (); |
| 757 | fwrite (conversion_buffer, 1, coding->produced, tty->output); | 757 | fwrite (conversion_buffer, 1, coding->produced, tty->output); |
| 758 | if (ferror (tty->output)) | 758 | if (ferror (tty->output)) |
| 759 | clearerr (tty->output); | 759 | clearerr (tty->output); |
| 760 | if (tty->termscript) | 760 | if (tty->termscript) |
| 761 | fwrite (conversion_buffer, 1, coding->produced, tty->termscript); | 761 | fwrite (conversion_buffer, 1, coding->produced, tty->termscript); |
| 762 | UNBLOCK_INPUT; | 762 | unblock_input (); |
| 763 | } | 763 | } |
| 764 | string += n; | 764 | string += n; |
| 765 | 765 | ||
| @@ -814,13 +814,13 @@ tty_write_glyphs_with_face (register struct frame *f, register struct glyph *str | |||
| 814 | conversion_buffer = encode_terminal_code (string, len, coding); | 814 | conversion_buffer = encode_terminal_code (string, len, coding); |
| 815 | if (coding->produced > 0) | 815 | if (coding->produced > 0) |
| 816 | { | 816 | { |
| 817 | BLOCK_INPUT; | 817 | block_input (); |
| 818 | fwrite (conversion_buffer, 1, coding->produced, tty->output); | 818 | fwrite (conversion_buffer, 1, coding->produced, tty->output); |
| 819 | if (ferror (tty->output)) | 819 | if (ferror (tty->output)) |
| 820 | clearerr (tty->output); | 820 | clearerr (tty->output); |
| 821 | if (tty->termscript) | 821 | if (tty->termscript) |
| 822 | fwrite (conversion_buffer, 1, coding->produced, tty->termscript); | 822 | fwrite (conversion_buffer, 1, coding->produced, tty->termscript); |
| 823 | UNBLOCK_INPUT; | 823 | unblock_input (); |
| 824 | } | 824 | } |
| 825 | 825 | ||
| 826 | /* Turn appearance modes off. */ | 826 | /* Turn appearance modes off. */ |
| @@ -900,13 +900,13 @@ tty_insert_glyphs (struct frame *f, struct glyph *start, int len) | |||
| 900 | 900 | ||
| 901 | if (coding->produced > 0) | 901 | if (coding->produced > 0) |
| 902 | { | 902 | { |
| 903 | BLOCK_INPUT; | 903 | block_input (); |
| 904 | fwrite (conversion_buffer, 1, coding->produced, tty->output); | 904 | fwrite (conversion_buffer, 1, coding->produced, tty->output); |
| 905 | if (ferror (tty->output)) | 905 | if (ferror (tty->output)) |
| 906 | clearerr (tty->output); | 906 | clearerr (tty->output); |
| 907 | if (tty->termscript) | 907 | if (tty->termscript) |
| 908 | fwrite (conversion_buffer, 1, coding->produced, tty->termscript); | 908 | fwrite (conversion_buffer, 1, coding->produced, tty->termscript); |
| 909 | UNBLOCK_INPUT; | 909 | unblock_input (); |
| 910 | } | 910 | } |
| 911 | 911 | ||
| 912 | OUTPUT1_IF (tty, tty->TS_pad_inserted_char); | 912 | OUTPUT1_IF (tty, tty->TS_pad_inserted_char); |
diff --git a/src/termhooks.h b/src/termhooks.h index 53e401de409..f35bd929af1 100644 --- a/src/termhooks.h +++ b/src/termhooks.h | |||
| @@ -591,8 +591,7 @@ struct terminal | |||
| 591 | /* Called to read input events. | 591 | /* Called to read input events. |
| 592 | 592 | ||
| 593 | TERMINAL indicates which terminal device to read from. Input | 593 | TERMINAL indicates which terminal device to read from. Input |
| 594 | events should be read into BUF, the size of which is given in | 594 | events should be read into HOLD_QUIT. |
| 595 | SIZE. | ||
| 596 | 595 | ||
| 597 | A positive return value indicates that that many input events | 596 | A positive return value indicates that that many input events |
| 598 | were read into BUF. | 597 | were read into BUF. |
diff --git a/src/w16select.c b/src/w16select.c index a3f6f1fb9ae..b8aaa3619ba 100644 --- a/src/w16select.c +++ b/src/w16select.c | |||
| @@ -459,7 +459,7 @@ DEFUN ("w16-set-clipboard-data", Fw16_set_clipboard_data, Sw16_set_clipboard_dat | |||
| 459 | if ( !FRAME_MSDOS_P (XFRAME (frame))) | 459 | if ( !FRAME_MSDOS_P (XFRAME (frame))) |
| 460 | goto done; | 460 | goto done; |
| 461 | 461 | ||
| 462 | BLOCK_INPUT; | 462 | block_input (); |
| 463 | 463 | ||
| 464 | if (!open_clipboard ()) | 464 | if (!open_clipboard ()) |
| 465 | goto error; | 465 | goto error; |
| @@ -520,7 +520,7 @@ DEFUN ("w16-set-clipboard-data", Fw16_set_clipboard_data, Sw16_set_clipboard_dat | |||
| 520 | 520 | ||
| 521 | unblock: | 521 | unblock: |
| 522 | xfree (dst); | 522 | xfree (dst); |
| 523 | UNBLOCK_INPUT; | 523 | unblock_input (); |
| 524 | 524 | ||
| 525 | /* Notify user if the text is too large to fit into DOS memory. | 525 | /* Notify user if the text is too large to fit into DOS memory. |
| 526 | (This will happen somewhere after 600K bytes (470K in DJGPP v1.x), | 526 | (This will happen somewhere after 600K bytes (470K in DJGPP v1.x), |
| @@ -565,7 +565,7 @@ DEFUN ("w16-get-clipboard-data", Fw16_get_clipboard_data, Sw16_get_clipboard_dat | |||
| 565 | if ( !FRAME_MSDOS_P (XFRAME (frame))) | 565 | if ( !FRAME_MSDOS_P (XFRAME (frame))) |
| 566 | goto done; | 566 | goto done; |
| 567 | 567 | ||
| 568 | BLOCK_INPUT; | 568 | block_input (); |
| 569 | 569 | ||
| 570 | if (!open_clipboard ()) | 570 | if (!open_clipboard ()) |
| 571 | goto unblock; | 571 | goto unblock; |
| @@ -626,7 +626,7 @@ DEFUN ("w16-get-clipboard-data", Fw16_get_clipboard_data, Sw16_get_clipboard_dat | |||
| 626 | close_clipboard (); | 626 | close_clipboard (); |
| 627 | 627 | ||
| 628 | unblock: | 628 | unblock: |
| 629 | UNBLOCK_INPUT; | 629 | unblock_input (); |
| 630 | 630 | ||
| 631 | done: | 631 | done: |
| 632 | 632 | ||
diff --git a/src/w32fns.c b/src/w32fns.c index be008bb18c8..808e19d0b66 100644 --- a/src/w32fns.c +++ b/src/w32fns.c | |||
| @@ -364,7 +364,7 @@ if the entry is new. */) | |||
| 364 | 364 | ||
| 365 | XSETINT (rgb, RGB (XUINT (red), XUINT (green), XUINT (blue))); | 365 | XSETINT (rgb, RGB (XUINT (red), XUINT (green), XUINT (blue))); |
| 366 | 366 | ||
| 367 | BLOCK_INPUT; | 367 | block_input (); |
| 368 | 368 | ||
| 369 | /* replace existing entry in w32-color-map or add new entry. */ | 369 | /* replace existing entry in w32-color-map or add new entry. */ |
| 370 | entry = Fassoc (name, Vw32_color_map); | 370 | entry = Fassoc (name, Vw32_color_map); |
| @@ -379,7 +379,7 @@ if the entry is new. */) | |||
| 379 | Fsetcdr (entry, rgb); | 379 | Fsetcdr (entry, rgb); |
| 380 | } | 380 | } |
| 381 | 381 | ||
| 382 | UNBLOCK_INPUT; | 382 | unblock_input (); |
| 383 | 383 | ||
| 384 | return (oldrgb); | 384 | return (oldrgb); |
| 385 | } | 385 | } |
| @@ -642,7 +642,7 @@ w32_default_color_map (void) | |||
| 642 | colormap_t *pc = w32_color_map; | 642 | colormap_t *pc = w32_color_map; |
| 643 | Lisp_Object cmap; | 643 | Lisp_Object cmap; |
| 644 | 644 | ||
| 645 | BLOCK_INPUT; | 645 | block_input (); |
| 646 | 646 | ||
| 647 | cmap = Qnil; | 647 | cmap = Qnil; |
| 648 | 648 | ||
| @@ -652,7 +652,7 @@ w32_default_color_map (void) | |||
| 652 | make_number (pc->colorref)), | 652 | make_number (pc->colorref)), |
| 653 | cmap); | 653 | cmap); |
| 654 | 654 | ||
| 655 | UNBLOCK_INPUT; | 655 | unblock_input (); |
| 656 | 656 | ||
| 657 | return (cmap); | 657 | return (cmap); |
| 658 | } | 658 | } |
| @@ -669,7 +669,7 @@ w32_color_map_lookup (char *colorname) | |||
| 669 | { | 669 | { |
| 670 | Lisp_Object tail, ret = Qnil; | 670 | Lisp_Object tail, ret = Qnil; |
| 671 | 671 | ||
| 672 | BLOCK_INPUT; | 672 | block_input (); |
| 673 | 673 | ||
| 674 | for (tail = Vw32_color_map; CONSP (tail); tail = XCDR (tail)) | 674 | for (tail = Vw32_color_map; CONSP (tail); tail = XCDR (tail)) |
| 675 | { | 675 | { |
| @@ -689,7 +689,7 @@ w32_color_map_lookup (char *colorname) | |||
| 689 | QUIT; | 689 | QUIT; |
| 690 | } | 690 | } |
| 691 | 691 | ||
| 692 | UNBLOCK_INPUT; | 692 | unblock_input (); |
| 693 | 693 | ||
| 694 | return ret; | 694 | return ret; |
| 695 | } | 695 | } |
| @@ -701,7 +701,7 @@ add_system_logical_colors_to_map (Lisp_Object *system_colors) | |||
| 701 | HKEY colors_key; | 701 | HKEY colors_key; |
| 702 | 702 | ||
| 703 | /* Other registry operations are done with input blocked. */ | 703 | /* Other registry operations are done with input blocked. */ |
| 704 | BLOCK_INPUT; | 704 | block_input (); |
| 705 | 705 | ||
| 706 | /* Look for "Control Panel/Colors" under User and Machine registry | 706 | /* Look for "Control Panel/Colors" under User and Machine registry |
| 707 | settings. */ | 707 | settings. */ |
| @@ -739,7 +739,7 @@ add_system_logical_colors_to_map (Lisp_Object *system_colors) | |||
| 739 | RegCloseKey (colors_key); | 739 | RegCloseKey (colors_key); |
| 740 | } | 740 | } |
| 741 | 741 | ||
| 742 | UNBLOCK_INPUT; | 742 | unblock_input (); |
| 743 | } | 743 | } |
| 744 | 744 | ||
| 745 | 745 | ||
| @@ -748,7 +748,7 @@ x_to_w32_color (char * colorname) | |||
| 748 | { | 748 | { |
| 749 | register Lisp_Object ret = Qnil; | 749 | register Lisp_Object ret = Qnil; |
| 750 | 750 | ||
| 751 | BLOCK_INPUT; | 751 | block_input (); |
| 752 | 752 | ||
| 753 | if (colorname[0] == '#') | 753 | if (colorname[0] == '#') |
| 754 | { | 754 | { |
| @@ -801,7 +801,7 @@ x_to_w32_color (char * colorname) | |||
| 801 | pos += 0x8; | 801 | pos += 0x8; |
| 802 | if (i == 2) | 802 | if (i == 2) |
| 803 | { | 803 | { |
| 804 | UNBLOCK_INPUT; | 804 | unblock_input (); |
| 805 | XSETINT (ret, colorval); | 805 | XSETINT (ret, colorval); |
| 806 | return ret; | 806 | return ret; |
| 807 | } | 807 | } |
| @@ -855,7 +855,7 @@ x_to_w32_color (char * colorname) | |||
| 855 | { | 855 | { |
| 856 | if (*end != '\0') | 856 | if (*end != '\0') |
| 857 | break; | 857 | break; |
| 858 | UNBLOCK_INPUT; | 858 | unblock_input (); |
| 859 | XSETINT (ret, colorval); | 859 | XSETINT (ret, colorval); |
| 860 | return ret; | 860 | return ret; |
| 861 | } | 861 | } |
| @@ -897,7 +897,7 @@ x_to_w32_color (char * colorname) | |||
| 897 | { | 897 | { |
| 898 | if (*end != '\0') | 898 | if (*end != '\0') |
| 899 | break; | 899 | break; |
| 900 | UNBLOCK_INPUT; | 900 | unblock_input (); |
| 901 | XSETINT (ret, colorval); | 901 | XSETINT (ret, colorval); |
| 902 | return ret; | 902 | return ret; |
| 903 | } | 903 | } |
| @@ -932,7 +932,7 @@ x_to_w32_color (char * colorname) | |||
| 932 | } | 932 | } |
| 933 | } | 933 | } |
| 934 | 934 | ||
| 935 | UNBLOCK_INPUT; | 935 | unblock_input (); |
| 936 | return ret; | 936 | return ret; |
| 937 | } | 937 | } |
| 938 | 938 | ||
| @@ -1235,7 +1235,7 @@ x_set_mouse_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval) | |||
| 1235 | f->output_data.w32->mouse_pixel = FRAME_FOREGROUND_PIXEL (f); | 1235 | f->output_data.w32->mouse_pixel = FRAME_FOREGROUND_PIXEL (f); |
| 1236 | 1236 | ||
| 1237 | #if 0 /* TODO : Mouse cursor customization. */ | 1237 | #if 0 /* TODO : Mouse cursor customization. */ |
| 1238 | BLOCK_INPUT; | 1238 | block_input (); |
| 1239 | 1239 | ||
| 1240 | /* It's not okay to crash if the user selects a screwy cursor. */ | 1240 | /* It's not okay to crash if the user selects a screwy cursor. */ |
| 1241 | count = x_catch_errors (FRAME_W32_DISPLAY (f)); | 1241 | count = x_catch_errors (FRAME_W32_DISPLAY (f)); |
| @@ -1358,7 +1358,7 @@ x_set_mouse_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval) | |||
| 1358 | f->output_data.w32->hand_cursor = hand_cursor; | 1358 | f->output_data.w32->hand_cursor = hand_cursor; |
| 1359 | 1359 | ||
| 1360 | XFlush (FRAME_W32_DISPLAY (f)); | 1360 | XFlush (FRAME_W32_DISPLAY (f)); |
| 1361 | UNBLOCK_INPUT; | 1361 | unblock_input (); |
| 1362 | 1362 | ||
| 1363 | update_face_from_frame_parameter (f, Qmouse_color, arg); | 1363 | update_face_from_frame_parameter (f, Qmouse_color, arg); |
| 1364 | #endif /* TODO */ | 1364 | #endif /* TODO */ |
| @@ -1390,12 +1390,12 @@ x_set_cursor_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval) | |||
| 1390 | 1390 | ||
| 1391 | if (FRAME_W32_WINDOW (f) != 0) | 1391 | if (FRAME_W32_WINDOW (f) != 0) |
| 1392 | { | 1392 | { |
| 1393 | BLOCK_INPUT; | 1393 | block_input (); |
| 1394 | /* Update frame's cursor_gc. */ | 1394 | /* Update frame's cursor_gc. */ |
| 1395 | f->output_data.w32->cursor_gc->foreground = fore_pixel; | 1395 | f->output_data.w32->cursor_gc->foreground = fore_pixel; |
| 1396 | f->output_data.w32->cursor_gc->background = pixel; | 1396 | f->output_data.w32->cursor_gc->background = pixel; |
| 1397 | 1397 | ||
| 1398 | UNBLOCK_INPUT; | 1398 | unblock_input (); |
| 1399 | 1399 | ||
| 1400 | if (FRAME_VISIBLE_P (f)) | 1400 | if (FRAME_VISIBLE_P (f)) |
| 1401 | { | 1401 | { |
| @@ -1466,16 +1466,16 @@ x_set_icon_type (struct frame *f, Lisp_Object arg, Lisp_Object oldval) | |||
| 1466 | if (SYMBOLP (arg) && SYMBOLP (oldval) && EQ (arg, oldval)) | 1466 | if (SYMBOLP (arg) && SYMBOLP (oldval) && EQ (arg, oldval)) |
| 1467 | return; | 1467 | return; |
| 1468 | 1468 | ||
| 1469 | BLOCK_INPUT; | 1469 | block_input (); |
| 1470 | 1470 | ||
| 1471 | result = x_bitmap_icon (f, arg); | 1471 | result = x_bitmap_icon (f, arg); |
| 1472 | if (result) | 1472 | if (result) |
| 1473 | { | 1473 | { |
| 1474 | UNBLOCK_INPUT; | 1474 | unblock_input (); |
| 1475 | error ("No icon window available"); | 1475 | error ("No icon window available"); |
| 1476 | } | 1476 | } |
| 1477 | 1477 | ||
| 1478 | UNBLOCK_INPUT; | 1478 | unblock_input (); |
| 1479 | } | 1479 | } |
| 1480 | 1480 | ||
| 1481 | void | 1481 | void |
| @@ -1495,7 +1495,7 @@ x_set_icon_name (struct frame *f, Lisp_Object arg, Lisp_Object oldval) | |||
| 1495 | if (f->output_data.w32->icon_bitmap != 0) | 1495 | if (f->output_data.w32->icon_bitmap != 0) |
| 1496 | return; | 1496 | return; |
| 1497 | 1497 | ||
| 1498 | BLOCK_INPUT; | 1498 | block_input (); |
| 1499 | 1499 | ||
| 1500 | result = x_text_icon (f, | 1500 | result = x_text_icon (f, |
| 1501 | SSDATA ((!NILP (f->icon_name) | 1501 | SSDATA ((!NILP (f->icon_name) |
| @@ -1506,7 +1506,7 @@ x_set_icon_name (struct frame *f, Lisp_Object arg, Lisp_Object oldval) | |||
| 1506 | 1506 | ||
| 1507 | if (result) | 1507 | if (result) |
| 1508 | { | 1508 | { |
| 1509 | UNBLOCK_INPUT; | 1509 | unblock_input (); |
| 1510 | error ("No icon window available"); | 1510 | error ("No icon window available"); |
| 1511 | } | 1511 | } |
| 1512 | 1512 | ||
| @@ -1521,7 +1521,7 @@ x_set_icon_name (struct frame *f, Lisp_Object arg, Lisp_Object oldval) | |||
| 1521 | } | 1521 | } |
| 1522 | 1522 | ||
| 1523 | XFlush (FRAME_W32_DISPLAY (f)); | 1523 | XFlush (FRAME_W32_DISPLAY (f)); |
| 1524 | UNBLOCK_INPUT; | 1524 | unblock_input (); |
| 1525 | #endif | 1525 | #endif |
| 1526 | } | 1526 | } |
| 1527 | 1527 | ||
| @@ -1623,13 +1623,13 @@ x_set_tool_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval) | |||
| 1623 | int width = FRAME_PIXEL_WIDTH (f); | 1623 | int width = FRAME_PIXEL_WIDTH (f); |
| 1624 | int y = nlines * FRAME_LINE_HEIGHT (f); | 1624 | int y = nlines * FRAME_LINE_HEIGHT (f); |
| 1625 | 1625 | ||
| 1626 | BLOCK_INPUT; | 1626 | block_input (); |
| 1627 | { | 1627 | { |
| 1628 | HDC hdc = get_frame_dc (f); | 1628 | HDC hdc = get_frame_dc (f); |
| 1629 | w32_clear_area (f, hdc, 0, y, width, height); | 1629 | w32_clear_area (f, hdc, 0, y, width, height); |
| 1630 | release_frame_dc (f, hdc); | 1630 | release_frame_dc (f, hdc); |
| 1631 | } | 1631 | } |
| 1632 | UNBLOCK_INPUT; | 1632 | unblock_input (); |
| 1633 | 1633 | ||
| 1634 | if (WINDOWP (f->tool_bar_window)) | 1634 | if (WINDOWP (f->tool_bar_window)) |
| 1635 | clear_glyph_matrix (XWINDOW (f->tool_bar_window)->current_matrix); | 1635 | clear_glyph_matrix (XWINDOW (f->tool_bar_window)->current_matrix); |
| @@ -1697,9 +1697,9 @@ x_set_name (struct frame *f, Lisp_Object name, int explicit) | |||
| 1697 | if (STRING_MULTIBYTE (name)) | 1697 | if (STRING_MULTIBYTE (name)) |
| 1698 | name = ENCODE_SYSTEM (name); | 1698 | name = ENCODE_SYSTEM (name); |
| 1699 | 1699 | ||
| 1700 | BLOCK_INPUT; | 1700 | block_input (); |
| 1701 | SetWindowText (FRAME_W32_WINDOW (f), SDATA (name)); | 1701 | SetWindowText (FRAME_W32_WINDOW (f), SDATA (name)); |
| 1702 | UNBLOCK_INPUT; | 1702 | unblock_input (); |
| 1703 | } | 1703 | } |
| 1704 | } | 1704 | } |
| 1705 | 1705 | ||
| @@ -1743,9 +1743,9 @@ x_set_title (struct frame *f, Lisp_Object name, Lisp_Object old_name) | |||
| 1743 | if (STRING_MULTIBYTE (name)) | 1743 | if (STRING_MULTIBYTE (name)) |
| 1744 | name = ENCODE_SYSTEM (name); | 1744 | name = ENCODE_SYSTEM (name); |
| 1745 | 1745 | ||
| 1746 | BLOCK_INPUT; | 1746 | block_input (); |
| 1747 | SetWindowText (FRAME_W32_WINDOW (f), SDATA (name)); | 1747 | SetWindowText (FRAME_W32_WINDOW (f), SDATA (name)); |
| 1748 | UNBLOCK_INPUT; | 1748 | unblock_input (); |
| 1749 | } | 1749 | } |
| 1750 | } | 1750 | } |
| 1751 | 1751 | ||
| @@ -3896,7 +3896,7 @@ my_create_tip_window (struct frame *f) | |||
| 3896 | static void | 3896 | static void |
| 3897 | w32_window (struct frame *f, long window_prompting, int minibuffer_only) | 3897 | w32_window (struct frame *f, long window_prompting, int minibuffer_only) |
| 3898 | { | 3898 | { |
| 3899 | BLOCK_INPUT; | 3899 | block_input (); |
| 3900 | 3900 | ||
| 3901 | /* Use the resource name as the top-level window name | 3901 | /* Use the resource name as the top-level window name |
| 3902 | for looking up resources. Make a non-Lisp copy | 3902 | for looking up resources. Make a non-Lisp copy |
| @@ -3928,7 +3928,7 @@ w32_window (struct frame *f, long window_prompting, int minibuffer_only) | |||
| 3928 | x_set_name (f, name, explicit); | 3928 | x_set_name (f, name, explicit); |
| 3929 | } | 3929 | } |
| 3930 | 3930 | ||
| 3931 | UNBLOCK_INPUT; | 3931 | unblock_input (); |
| 3932 | 3932 | ||
| 3933 | if (!minibuffer_only && FRAME_EXTERNAL_MENU_BAR (f)) | 3933 | if (!minibuffer_only && FRAME_EXTERNAL_MENU_BAR (f)) |
| 3934 | initialize_frame_menubar (f); | 3934 | initialize_frame_menubar (f); |
| @@ -3959,7 +3959,7 @@ x_icon (struct frame *f, Lisp_Object parms) | |||
| 3959 | else if (!EQ (icon_x, Qunbound) || !EQ (icon_y, Qunbound)) | 3959 | else if (!EQ (icon_x, Qunbound) || !EQ (icon_y, Qunbound)) |
| 3960 | error ("Both left and top icon corners of icon must be specified"); | 3960 | error ("Both left and top icon corners of icon must be specified"); |
| 3961 | 3961 | ||
| 3962 | BLOCK_INPUT; | 3962 | block_input (); |
| 3963 | 3963 | ||
| 3964 | if (! EQ (icon_x, Qunbound)) | 3964 | if (! EQ (icon_x, Qunbound)) |
| 3965 | x_wm_set_icon_position (f, XINT (icon_x), XINT (icon_y)); | 3965 | x_wm_set_icon_position (f, XINT (icon_x), XINT (icon_y)); |
| @@ -3976,7 +3976,7 @@ x_icon (struct frame *f, Lisp_Object parms) | |||
| 3976 | : f->name))); | 3976 | : f->name))); |
| 3977 | #endif | 3977 | #endif |
| 3978 | 3978 | ||
| 3979 | UNBLOCK_INPUT; | 3979 | unblock_input (); |
| 3980 | } | 3980 | } |
| 3981 | 3981 | ||
| 3982 | 3982 | ||
| @@ -3985,7 +3985,7 @@ x_make_gc (struct frame *f) | |||
| 3985 | { | 3985 | { |
| 3986 | XGCValues gc_values; | 3986 | XGCValues gc_values; |
| 3987 | 3987 | ||
| 3988 | BLOCK_INPUT; | 3988 | block_input (); |
| 3989 | 3989 | ||
| 3990 | /* Create the GC's of this frame. | 3990 | /* Create the GC's of this frame. |
| 3991 | Note that many default values are used. */ | 3991 | Note that many default values are used. */ |
| @@ -4005,7 +4005,7 @@ x_make_gc (struct frame *f) | |||
| 4005 | f->output_data.w32->white_relief.gc = 0; | 4005 | f->output_data.w32->white_relief.gc = 0; |
| 4006 | f->output_data.w32->black_relief.gc = 0; | 4006 | f->output_data.w32->black_relief.gc = 0; |
| 4007 | 4007 | ||
| 4008 | UNBLOCK_INPUT; | 4008 | unblock_input (); |
| 4009 | } | 4009 | } |
| 4010 | 4010 | ||
| 4011 | 4011 | ||
| @@ -4351,9 +4351,9 @@ This function is an internal primitive--use `make-frame' instead. */) | |||
| 4351 | /* Tell the server what size and position, etc, we want, and how | 4351 | /* Tell the server what size and position, etc, we want, and how |
| 4352 | badly we want them. This should be done after we have the menu | 4352 | badly we want them. This should be done after we have the menu |
| 4353 | bar so that its size can be taken into account. */ | 4353 | bar so that its size can be taken into account. */ |
| 4354 | BLOCK_INPUT; | 4354 | block_input (); |
| 4355 | x_wm_set_size_hint (f, window_prompting, 0); | 4355 | x_wm_set_size_hint (f, window_prompting, 0); |
| 4356 | UNBLOCK_INPUT; | 4356 | unblock_input (); |
| 4357 | 4357 | ||
| 4358 | /* Make the window appear on the frame and enable display, unless | 4358 | /* Make the window appear on the frame and enable display, unless |
| 4359 | the caller says not to. However, with explicit parent, Emacs | 4359 | the caller says not to. However, with explicit parent, Emacs |
| @@ -4862,11 +4862,11 @@ If DISPLAY is nil, that stands for the selected frame's display. */) | |||
| 4862 | if (dpyinfo->reference_count > 0) | 4862 | if (dpyinfo->reference_count > 0) |
| 4863 | error ("Display still has frames on it"); | 4863 | error ("Display still has frames on it"); |
| 4864 | 4864 | ||
| 4865 | BLOCK_INPUT; | 4865 | block_input (); |
| 4866 | x_destroy_all_bitmaps (dpyinfo); | 4866 | x_destroy_all_bitmaps (dpyinfo); |
| 4867 | 4867 | ||
| 4868 | x_delete_display (dpyinfo); | 4868 | x_delete_display (dpyinfo); |
| 4869 | UNBLOCK_INPUT; | 4869 | unblock_input (); |
| 4870 | 4870 | ||
| 4871 | return Qnil; | 4871 | return Qnil; |
| 4872 | } | 4872 | } |
| @@ -4935,7 +4935,7 @@ FRAME. Default is to change on the edit X window. */) | |||
| 4935 | CHECK_STRING (prop); | 4935 | CHECK_STRING (prop); |
| 4936 | CHECK_STRING (value); | 4936 | CHECK_STRING (value); |
| 4937 | 4937 | ||
| 4938 | BLOCK_INPUT; | 4938 | block_input (); |
| 4939 | prop_atom = XInternAtom (FRAME_W32_DISPLAY (f), SDATA (prop), False); | 4939 | prop_atom = XInternAtom (FRAME_W32_DISPLAY (f), SDATA (prop), False); |
| 4940 | XChangeProperty (FRAME_W32_DISPLAY (f), FRAME_W32_WINDOW (f), | 4940 | XChangeProperty (FRAME_W32_DISPLAY (f), FRAME_W32_WINDOW (f), |
| 4941 | prop_atom, XA_STRING, 8, PropModeReplace, | 4941 | prop_atom, XA_STRING, 8, PropModeReplace, |
| @@ -4943,7 +4943,7 @@ FRAME. Default is to change on the edit X window. */) | |||
| 4943 | 4943 | ||
| 4944 | /* Make sure the property is set when we return. */ | 4944 | /* Make sure the property is set when we return. */ |
| 4945 | XFlush (FRAME_W32_DISPLAY (f)); | 4945 | XFlush (FRAME_W32_DISPLAY (f)); |
| 4946 | UNBLOCK_INPUT; | 4946 | unblock_input (); |
| 4947 | 4947 | ||
| 4948 | return value; | 4948 | return value; |
| 4949 | } | 4949 | } |
| @@ -4959,13 +4959,13 @@ FRAME nil or omitted means use the selected frame. Value is PROP. */) | |||
| 4959 | Atom prop_atom; | 4959 | Atom prop_atom; |
| 4960 | 4960 | ||
| 4961 | CHECK_STRING (prop); | 4961 | CHECK_STRING (prop); |
| 4962 | BLOCK_INPUT; | 4962 | block_input (); |
| 4963 | prop_atom = XInternAtom (FRAME_W32_DISPLAY (f), SDATA (prop), False); | 4963 | prop_atom = XInternAtom (FRAME_W32_DISPLAY (f), SDATA (prop), False); |
| 4964 | XDeleteProperty (FRAME_W32_DISPLAY (f), FRAME_W32_WINDOW (f), prop_atom); | 4964 | XDeleteProperty (FRAME_W32_DISPLAY (f), FRAME_W32_WINDOW (f), prop_atom); |
| 4965 | 4965 | ||
| 4966 | /* Make sure the property is removed when we return. */ | 4966 | /* Make sure the property is removed when we return. */ |
| 4967 | XFlush (FRAME_W32_DISPLAY (f)); | 4967 | XFlush (FRAME_W32_DISPLAY (f)); |
| 4968 | UNBLOCK_INPUT; | 4968 | unblock_input (); |
| 4969 | 4969 | ||
| 4970 | return prop; | 4970 | return prop; |
| 4971 | } | 4971 | } |
| @@ -5001,7 +5001,7 @@ no value of TYPE (always string in the MS Windows case). */) | |||
| 5001 | unsigned long actual_size, bytes_remaining; | 5001 | unsigned long actual_size, bytes_remaining; |
| 5002 | 5002 | ||
| 5003 | CHECK_STRING (prop); | 5003 | CHECK_STRING (prop); |
| 5004 | BLOCK_INPUT; | 5004 | block_input (); |
| 5005 | prop_atom = XInternAtom (FRAME_W32_DISPLAY (f), SDATA (prop), False); | 5005 | prop_atom = XInternAtom (FRAME_W32_DISPLAY (f), SDATA (prop), False); |
| 5006 | rc = XGetWindowProperty (FRAME_W32_DISPLAY (f), FRAME_W32_WINDOW (f), | 5006 | rc = XGetWindowProperty (FRAME_W32_DISPLAY (f), FRAME_W32_WINDOW (f), |
| 5007 | prop_atom, 0, 0, False, XA_STRING, | 5007 | prop_atom, 0, 0, False, XA_STRING, |
| @@ -5026,7 +5026,7 @@ no value of TYPE (always string in the MS Windows case). */) | |||
| 5026 | XFree (tmp_data); | 5026 | XFree (tmp_data); |
| 5027 | } | 5027 | } |
| 5028 | 5028 | ||
| 5029 | UNBLOCK_INPUT; | 5029 | unblock_input (); |
| 5030 | 5030 | ||
| 5031 | return prop_value; | 5031 | return prop_value; |
| 5032 | 5032 | ||
| @@ -5349,9 +5349,9 @@ x_create_tip_frame (struct w32_display_info *dpyinfo, | |||
| 5349 | f->left_fringe_width = 0; | 5349 | f->left_fringe_width = 0; |
| 5350 | f->right_fringe_width = 0; | 5350 | f->right_fringe_width = 0; |
| 5351 | 5351 | ||
| 5352 | BLOCK_INPUT; | 5352 | block_input (); |
| 5353 | my_create_tip_window (f); | 5353 | my_create_tip_window (f); |
| 5354 | UNBLOCK_INPUT; | 5354 | unblock_input (); |
| 5355 | 5355 | ||
| 5356 | x_make_gc (f); | 5356 | x_make_gc (f); |
| 5357 | 5357 | ||
| @@ -5457,11 +5457,11 @@ compute_tip_xy (struct frame *f, | |||
| 5457 | max_x = x_display_pixel_width (FRAME_W32_DISPLAY_INFO (f)); | 5457 | max_x = x_display_pixel_width (FRAME_W32_DISPLAY_INFO (f)); |
| 5458 | max_y = x_display_pixel_height (FRAME_W32_DISPLAY_INFO (f)); | 5458 | max_y = x_display_pixel_height (FRAME_W32_DISPLAY_INFO (f)); |
| 5459 | 5459 | ||
| 5460 | BLOCK_INPUT; | 5460 | block_input (); |
| 5461 | GetCursorPos (&pt); | 5461 | GetCursorPos (&pt); |
| 5462 | *root_x = pt.x; | 5462 | *root_x = pt.x; |
| 5463 | *root_y = pt.y; | 5463 | *root_y = pt.y; |
| 5464 | UNBLOCK_INPUT; | 5464 | unblock_input (); |
| 5465 | 5465 | ||
| 5466 | /* If multiple monitor support is available, constrain the tip onto | 5466 | /* If multiple monitor support is available, constrain the tip onto |
| 5467 | the current monitor. This improves the above by allowing negative | 5467 | the current monitor. This improves the above by allowing negative |
| @@ -5596,7 +5596,7 @@ Text larger than the specified size is clipped. */) | |||
| 5596 | call1 (Qcancel_timer, timer); | 5596 | call1 (Qcancel_timer, timer); |
| 5597 | } | 5597 | } |
| 5598 | 5598 | ||
| 5599 | BLOCK_INPUT; | 5599 | block_input (); |
| 5600 | compute_tip_xy (f, parms, dx, dy, FRAME_PIXEL_WIDTH (f), | 5600 | compute_tip_xy (f, parms, dx, dy, FRAME_PIXEL_WIDTH (f), |
| 5601 | FRAME_PIXEL_HEIGHT (f), &root_x, &root_y); | 5601 | FRAME_PIXEL_HEIGHT (f), &root_x, &root_y); |
| 5602 | 5602 | ||
| @@ -5610,7 +5610,7 @@ Text larger than the specified size is clipped. */) | |||
| 5610 | 0, 0, 0, 0, | 5610 | 0, 0, 0, 0, |
| 5611 | SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); | 5611 | SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); |
| 5612 | 5612 | ||
| 5613 | UNBLOCK_INPUT; | 5613 | unblock_input (); |
| 5614 | goto start_timer; | 5614 | goto start_timer; |
| 5615 | } | 5615 | } |
| 5616 | } | 5616 | } |
| @@ -5637,7 +5637,7 @@ Text larger than the specified size is clipped. */) | |||
| 5637 | 5637 | ||
| 5638 | /* Block input until the tip has been fully drawn, to avoid crashes | 5638 | /* Block input until the tip has been fully drawn, to avoid crashes |
| 5639 | when drawing tips in menus. */ | 5639 | when drawing tips in menus. */ |
| 5640 | BLOCK_INPUT; | 5640 | block_input (); |
| 5641 | 5641 | ||
| 5642 | /* Create a frame for the tooltip, and record it in the global | 5642 | /* Create a frame for the tooltip, and record it in the global |
| 5643 | variable tip_frame. */ | 5643 | variable tip_frame. */ |
| @@ -5809,7 +5809,7 @@ Text larger than the specified size is clipped. */) | |||
| 5809 | w->must_be_updated_p = 1; | 5809 | w->must_be_updated_p = 1; |
| 5810 | update_single_window (w, 1); | 5810 | update_single_window (w, 1); |
| 5811 | 5811 | ||
| 5812 | UNBLOCK_INPUT; | 5812 | unblock_input (); |
| 5813 | 5813 | ||
| 5814 | /* Restore original current buffer. */ | 5814 | /* Restore original current buffer. */ |
| 5815 | set_buffer_internal_1 (old_buffer); | 5815 | set_buffer_internal_1 (old_buffer); |
| @@ -6002,7 +6002,7 @@ Otherwise, if ONLY-DIR-P is non-nil, the user can only select directories. */) | |||
| 6002 | 6002 | ||
| 6003 | /* Prevent redisplay. */ | 6003 | /* Prevent redisplay. */ |
| 6004 | specbind (Qinhibit_redisplay, Qt); | 6004 | specbind (Qinhibit_redisplay, Qt); |
| 6005 | BLOCK_INPUT; | 6005 | block_input (); |
| 6006 | 6006 | ||
| 6007 | memset (&new_file_details, 0, sizeof (new_file_details)); | 6007 | memset (&new_file_details, 0, sizeof (new_file_details)); |
| 6008 | /* Apparently NT4 crashes if you give it an unexpected size. | 6008 | /* Apparently NT4 crashes if you give it an unexpected size. |
| @@ -6041,7 +6041,7 @@ Otherwise, if ONLY-DIR-P is non-nil, the user can only select directories. */) | |||
| 6041 | 6041 | ||
| 6042 | file_opened = GetOpenFileName (file_details); | 6042 | file_opened = GetOpenFileName (file_details); |
| 6043 | 6043 | ||
| 6044 | UNBLOCK_INPUT; | 6044 | unblock_input (); |
| 6045 | 6045 | ||
| 6046 | if (file_opened) | 6046 | if (file_opened) |
| 6047 | { | 6047 | { |
diff --git a/src/w32inevt.c b/src/w32inevt.c index a96d8d70483..ebb95dcace5 100644 --- a/src/w32inevt.c +++ b/src/w32inevt.c | |||
| @@ -567,7 +567,7 @@ w32_console_mouse_position (FRAME_PTR *f, | |||
| 567 | Lisp_Object *y, | 567 | Lisp_Object *y, |
| 568 | Time *time) | 568 | Time *time) |
| 569 | { | 569 | { |
| 570 | BLOCK_INPUT; | 570 | block_input (); |
| 571 | 571 | ||
| 572 | insist = insist; | 572 | insist = insist; |
| 573 | 573 | ||
| @@ -580,7 +580,7 @@ w32_console_mouse_position (FRAME_PTR *f, | |||
| 580 | XSETINT (*y, movement_pos.Y); | 580 | XSETINT (*y, movement_pos.Y); |
| 581 | *time = movement_time; | 581 | *time = movement_time; |
| 582 | 582 | ||
| 583 | UNBLOCK_INPUT; | 583 | unblock_input (); |
| 584 | } | 584 | } |
| 585 | 585 | ||
| 586 | /* Remember mouse motion and notify emacs. */ | 586 | /* Remember mouse motion and notify emacs. */ |
| @@ -749,14 +749,7 @@ w32_console_read_socket (struct terminal *terminal, | |||
| 749 | int nev, add; | 749 | int nev, add; |
| 750 | int isdead; | 750 | int isdead; |
| 751 | 751 | ||
| 752 | if (interrupt_input_blocked) | 752 | block_input (); |
| 753 | { | ||
| 754 | interrupt_input_pending = 1; | ||
| 755 | return -1; | ||
| 756 | } | ||
| 757 | |||
| 758 | interrupt_input_pending = 0; | ||
| 759 | BLOCK_INPUT; | ||
| 760 | 753 | ||
| 761 | for (;;) | 754 | for (;;) |
| 762 | { | 755 | { |
| @@ -818,6 +811,6 @@ w32_console_read_socket (struct terminal *terminal, | |||
| 818 | if (!w32_use_full_screen_buffer) | 811 | if (!w32_use_full_screen_buffer) |
| 819 | maybe_generate_resize_event (); | 812 | maybe_generate_resize_event (); |
| 820 | 813 | ||
| 821 | UNBLOCK_INPUT; | 814 | unblock_input (); |
| 822 | return nev; | 815 | return nev; |
| 823 | } | 816 | } |
diff --git a/src/w32menu.c b/src/w32menu.c index fa7db64f147..651364d5778 100644 --- a/src/w32menu.c +++ b/src/w32menu.c | |||
| @@ -221,9 +221,9 @@ otherwise it is "Question". */) | |||
| 221 | list_of_panes (Fcons (contents, Qnil)); | 221 | list_of_panes (Fcons (contents, Qnil)); |
| 222 | 222 | ||
| 223 | /* Display them in a dialog box. */ | 223 | /* Display them in a dialog box. */ |
| 224 | BLOCK_INPUT; | 224 | block_input (); |
| 225 | selection = w32_dialog_show (f, 0, title, header, &error_name); | 225 | selection = w32_dialog_show (f, 0, title, header, &error_name); |
| 226 | UNBLOCK_INPUT; | 226 | unblock_input (); |
| 227 | 227 | ||
| 228 | discard_menu_items (); | 228 | discard_menu_items (); |
| 229 | FRAME_X_DISPLAY_INFO (f)->grabbed = 0; | 229 | FRAME_X_DISPLAY_INFO (f)->grabbed = 0; |
| @@ -571,7 +571,7 @@ set_frame_menubar (FRAME_PTR f, int first_time, int deep_p) | |||
| 571 | 571 | ||
| 572 | /* Create or update the menu bar widget. */ | 572 | /* Create or update the menu bar widget. */ |
| 573 | 573 | ||
| 574 | BLOCK_INPUT; | 574 | block_input (); |
| 575 | 575 | ||
| 576 | if (menubar_widget) | 576 | if (menubar_widget) |
| 577 | { | 577 | { |
| @@ -601,7 +601,7 @@ set_frame_menubar (FRAME_PTR f, int first_time, int deep_p) | |||
| 601 | x_set_window_size (f, 0, FRAME_COLS (f), FRAME_LINES (f)); | 601 | x_set_window_size (f, 0, FRAME_COLS (f), FRAME_LINES (f)); |
| 602 | } | 602 | } |
| 603 | 603 | ||
| 604 | UNBLOCK_INPUT; | 604 | unblock_input (); |
| 605 | } | 605 | } |
| 606 | 606 | ||
| 607 | /* Called from Fx_create_frame to create the initial menubar of a frame | 607 | /* Called from Fx_create_frame to create the initial menubar of a frame |
| @@ -624,7 +624,7 @@ initialize_frame_menubar (FRAME_PTR f) | |||
| 624 | void | 624 | void |
| 625 | free_frame_menubar (FRAME_PTR f) | 625 | free_frame_menubar (FRAME_PTR f) |
| 626 | { | 626 | { |
| 627 | BLOCK_INPUT; | 627 | block_input (); |
| 628 | 628 | ||
| 629 | { | 629 | { |
| 630 | HMENU old = GetMenu (FRAME_W32_WINDOW (f)); | 630 | HMENU old = GetMenu (FRAME_W32_WINDOW (f)); |
| @@ -633,7 +633,7 @@ free_frame_menubar (FRAME_PTR f) | |||
| 633 | DestroyMenu (old); | 633 | DestroyMenu (old); |
| 634 | } | 634 | } |
| 635 | 635 | ||
| 636 | UNBLOCK_INPUT; | 636 | unblock_input (); |
| 637 | } | 637 | } |
| 638 | 638 | ||
| 639 | 639 | ||
diff --git a/src/w32reg.c b/src/w32reg.c index 8a6a3c853b1..8b6c76503a6 100644 --- a/src/w32reg.c +++ b/src/w32reg.c | |||
| @@ -84,7 +84,7 @@ w32_get_string_resource (char *name, char *class, DWORD dwexptype) | |||
| 84 | 84 | ||
| 85 | trykey: | 85 | trykey: |
| 86 | 86 | ||
| 87 | BLOCK_INPUT; | 87 | block_input (); |
| 88 | 88 | ||
| 89 | /* Check both the current user and the local machine to see if we have | 89 | /* Check both the current user and the local machine to see if we have |
| 90 | any resources */ | 90 | any resources */ |
| @@ -115,7 +115,7 @@ w32_get_string_resource (char *name, char *class, DWORD dwexptype) | |||
| 115 | RegCloseKey (hrootkey); | 115 | RegCloseKey (hrootkey); |
| 116 | } | 116 | } |
| 117 | 117 | ||
| 118 | UNBLOCK_INPUT; | 118 | unblock_input (); |
| 119 | 119 | ||
| 120 | if (!ok) | 120 | if (!ok) |
| 121 | { | 121 | { |
diff --git a/src/w32select.c b/src/w32select.c index 11c68c9c617..061f5a4a0a8 100644 --- a/src/w32select.c +++ b/src/w32select.c | |||
| @@ -391,7 +391,7 @@ run_protected (Lisp_Object (*code) (Lisp_Object), Lisp_Object arg) | |||
| 391 | extern int waiting_for_input; /* from keyboard.c */ | 391 | extern int waiting_for_input; /* from keyboard.c */ |
| 392 | int owfi; | 392 | int owfi; |
| 393 | 393 | ||
| 394 | BLOCK_INPUT; | 394 | block_input (); |
| 395 | 395 | ||
| 396 | /* Fsignal calls emacs_abort () if it sees that waiting_for_input is | 396 | /* Fsignal calls emacs_abort () if it sees that waiting_for_input is |
| 397 | set. */ | 397 | set. */ |
| @@ -402,7 +402,7 @@ run_protected (Lisp_Object (*code) (Lisp_Object), Lisp_Object arg) | |||
| 402 | 402 | ||
| 403 | waiting_for_input = owfi; | 403 | waiting_for_input = owfi; |
| 404 | 404 | ||
| 405 | UNBLOCK_INPUT; | 405 | unblock_input (); |
| 406 | } | 406 | } |
| 407 | 407 | ||
| 408 | static Lisp_Object | 408 | static Lisp_Object |
| @@ -694,7 +694,7 @@ DEFUN ("w32-set-clipboard-data", Fw32_set_clipboard_data, | |||
| 694 | current_num_nls = 0; | 694 | current_num_nls = 0; |
| 695 | current_requires_encoding = 0; | 695 | current_requires_encoding = 0; |
| 696 | 696 | ||
| 697 | BLOCK_INPUT; | 697 | block_input (); |
| 698 | 698 | ||
| 699 | /* Check for non-ASCII characters. While we are at it, count the | 699 | /* Check for non-ASCII characters. While we are at it, count the |
| 700 | number of LFs, so we know how many CRs we will have to add later | 700 | number of LFs, so we know how many CRs we will have to add later |
| @@ -782,7 +782,7 @@ DEFUN ("w32-set-clipboard-data", Fw32_set_clipboard_data, | |||
| 782 | current_coding_system = Qnil; | 782 | current_coding_system = Qnil; |
| 783 | 783 | ||
| 784 | done: | 784 | done: |
| 785 | UNBLOCK_INPUT; | 785 | unblock_input (); |
| 786 | 786 | ||
| 787 | return (ok ? string : Qnil); | 787 | return (ok ? string : Qnil); |
| 788 | } | 788 | } |
| @@ -810,7 +810,7 @@ DEFUN ("w32-get-clipboard-data", Fw32_get_clipboard_data, | |||
| 810 | setup_config (); | 810 | setup_config (); |
| 811 | actual_clipboard_type = cfg_clipboard_type; | 811 | actual_clipboard_type = cfg_clipboard_type; |
| 812 | 812 | ||
| 813 | BLOCK_INPUT; | 813 | block_input (); |
| 814 | 814 | ||
| 815 | if (!OpenClipboard (clipboard_owner)) | 815 | if (!OpenClipboard (clipboard_owner)) |
| 816 | goto done; | 816 | goto done; |
| @@ -1000,7 +1000,7 @@ DEFUN ("w32-get-clipboard-data", Fw32_get_clipboard_data, | |||
| 1000 | CloseClipboard (); | 1000 | CloseClipboard (); |
| 1001 | 1001 | ||
| 1002 | done: | 1002 | done: |
| 1003 | UNBLOCK_INPUT; | 1003 | unblock_input (); |
| 1004 | 1004 | ||
| 1005 | return (ret); | 1005 | return (ret); |
| 1006 | } | 1006 | } |
diff --git a/src/w32term.c b/src/w32term.c index b8227c52fed..feefea77684 100644 --- a/src/w32term.c +++ b/src/w32term.c | |||
| @@ -563,7 +563,7 @@ x_update_window_begin (struct window *w) | |||
| 563 | updated_window = w; | 563 | updated_window = w; |
| 564 | set_output_cursor (&w->cursor); | 564 | set_output_cursor (&w->cursor); |
| 565 | 565 | ||
| 566 | BLOCK_INPUT; | 566 | block_input (); |
| 567 | 567 | ||
| 568 | if (f == hlinfo->mouse_face_mouse_frame) | 568 | if (f == hlinfo->mouse_face_mouse_frame) |
| 569 | { | 569 | { |
| @@ -602,7 +602,7 @@ x_update_window_begin (struct window *w) | |||
| 602 | #endif /* 0 */ | 602 | #endif /* 0 */ |
| 603 | } | 603 | } |
| 604 | 604 | ||
| 605 | UNBLOCK_INPUT; | 605 | unblock_input (); |
| 606 | } | 606 | } |
| 607 | 607 | ||
| 608 | /* Draw a vertical window border from (x,y0) to (x,y1) */ | 608 | /* Draw a vertical window border from (x,y0) to (x,y1) */ |
| @@ -652,7 +652,7 @@ x_update_window_end (struct window *w, int cursor_on_p, | |||
| 652 | 652 | ||
| 653 | if (!w->pseudo_window_p) | 653 | if (!w->pseudo_window_p) |
| 654 | { | 654 | { |
| 655 | BLOCK_INPUT; | 655 | block_input (); |
| 656 | 656 | ||
| 657 | if (cursor_on_p) | 657 | if (cursor_on_p) |
| 658 | display_and_set_cursor (w, 1, output_cursor.hpos, | 658 | display_and_set_cursor (w, 1, output_cursor.hpos, |
| @@ -662,7 +662,7 @@ x_update_window_end (struct window *w, int cursor_on_p, | |||
| 662 | if (draw_window_fringes (w, 1)) | 662 | if (draw_window_fringes (w, 1)) |
| 663 | x_draw_vertical_border (w); | 663 | x_draw_vertical_border (w); |
| 664 | 664 | ||
| 665 | UNBLOCK_INPUT; | 665 | unblock_input (); |
| 666 | } | 666 | } |
| 667 | 667 | ||
| 668 | /* If a row with mouse-face was overwritten, arrange for | 668 | /* If a row with mouse-face was overwritten, arrange for |
| @@ -714,13 +714,13 @@ w32_frame_up_to_date (struct frame *f) | |||
| 714 | if (hlinfo->mouse_face_deferred_gc | 714 | if (hlinfo->mouse_face_deferred_gc |
| 715 | || f == hlinfo->mouse_face_mouse_frame) | 715 | || f == hlinfo->mouse_face_mouse_frame) |
| 716 | { | 716 | { |
| 717 | BLOCK_INPUT; | 717 | block_input (); |
| 718 | if (hlinfo->mouse_face_mouse_frame) | 718 | if (hlinfo->mouse_face_mouse_frame) |
| 719 | note_mouse_highlight (hlinfo->mouse_face_mouse_frame, | 719 | note_mouse_highlight (hlinfo->mouse_face_mouse_frame, |
| 720 | hlinfo->mouse_face_mouse_x, | 720 | hlinfo->mouse_face_mouse_x, |
| 721 | hlinfo->mouse_face_mouse_y); | 721 | hlinfo->mouse_face_mouse_y); |
| 722 | hlinfo->mouse_face_deferred_gc = 0; | 722 | hlinfo->mouse_face_deferred_gc = 0; |
| 723 | UNBLOCK_INPUT; | 723 | unblock_input (); |
| 724 | } | 724 | } |
| 725 | } | 725 | } |
| 726 | } | 726 | } |
| @@ -761,7 +761,7 @@ x_after_update_window_line (struct glyph_row *desired_row) | |||
| 761 | { | 761 | { |
| 762 | int y = WINDOW_TO_FRAME_PIXEL_Y (w, max (0, desired_row->y)); | 762 | int y = WINDOW_TO_FRAME_PIXEL_Y (w, max (0, desired_row->y)); |
| 763 | 763 | ||
| 764 | BLOCK_INPUT; | 764 | block_input (); |
| 765 | { | 765 | { |
| 766 | HDC hdc = get_frame_dc (f); | 766 | HDC hdc = get_frame_dc (f); |
| 767 | w32_clear_area (f, hdc, 0, y, width, height); | 767 | w32_clear_area (f, hdc, 0, y, width, height); |
| @@ -769,7 +769,7 @@ x_after_update_window_line (struct glyph_row *desired_row) | |||
| 769 | y, width, height); | 769 | y, width, height); |
| 770 | release_frame_dc (f, hdc); | 770 | release_frame_dc (f, hdc); |
| 771 | } | 771 | } |
| 772 | UNBLOCK_INPUT; | 772 | unblock_input (); |
| 773 | } | 773 | } |
| 774 | } | 774 | } |
| 775 | 775 | ||
| @@ -2646,7 +2646,7 @@ x_clear_frame (struct frame *f) | |||
| 2646 | 2646 | ||
| 2647 | /* We don't set the output cursor here because there will always | 2647 | /* We don't set the output cursor here because there will always |
| 2648 | follow an explicit cursor_to. */ | 2648 | follow an explicit cursor_to. */ |
| 2649 | BLOCK_INPUT; | 2649 | block_input (); |
| 2650 | 2650 | ||
| 2651 | w32_clear_window (f); | 2651 | w32_clear_window (f); |
| 2652 | 2652 | ||
| @@ -2654,7 +2654,7 @@ x_clear_frame (struct frame *f) | |||
| 2654 | colors or something like that, then they should be notified. */ | 2654 | colors or something like that, then they should be notified. */ |
| 2655 | x_scroll_bar_clear (f); | 2655 | x_scroll_bar_clear (f); |
| 2656 | 2656 | ||
| 2657 | UNBLOCK_INPUT; | 2657 | unblock_input (); |
| 2658 | } | 2658 | } |
| 2659 | 2659 | ||
| 2660 | 2660 | ||
| @@ -2663,7 +2663,7 @@ x_clear_frame (struct frame *f) | |||
| 2663 | static void | 2663 | static void |
| 2664 | w32_ring_bell (struct frame *f) | 2664 | w32_ring_bell (struct frame *f) |
| 2665 | { | 2665 | { |
| 2666 | BLOCK_INPUT; | 2666 | block_input (); |
| 2667 | 2667 | ||
| 2668 | if (FRAME_W32_P (f) && visible_bell) | 2668 | if (FRAME_W32_P (f) && visible_bell) |
| 2669 | { | 2669 | { |
| @@ -2680,7 +2680,7 @@ w32_ring_bell (struct frame *f) | |||
| 2680 | else | 2680 | else |
| 2681 | w32_sys_ring_bell (f); | 2681 | w32_sys_ring_bell (f); |
| 2682 | 2682 | ||
| 2683 | UNBLOCK_INPUT; | 2683 | unblock_input (); |
| 2684 | } | 2684 | } |
| 2685 | 2685 | ||
| 2686 | 2686 | ||
| @@ -2779,7 +2779,7 @@ x_scroll_run (struct window *w, struct run *run) | |||
| 2779 | expect_dirty = CreateRectRgn (x, y, x + width, to_y); | 2779 | expect_dirty = CreateRectRgn (x, y, x + width, to_y); |
| 2780 | } | 2780 | } |
| 2781 | 2781 | ||
| 2782 | BLOCK_INPUT; | 2782 | block_input (); |
| 2783 | 2783 | ||
| 2784 | /* Cursor off. Will be switched on again in x_update_window_end. */ | 2784 | /* Cursor off. Will be switched on again in x_update_window_end. */ |
| 2785 | updated_window = w; | 2785 | updated_window = w; |
| @@ -2813,7 +2813,7 @@ x_scroll_run (struct window *w, struct run *run) | |||
| 2813 | DeleteObject (combined); | 2813 | DeleteObject (combined); |
| 2814 | } | 2814 | } |
| 2815 | 2815 | ||
| 2816 | UNBLOCK_INPUT; | 2816 | unblock_input (); |
| 2817 | DeleteObject (expect_dirty); | 2817 | DeleteObject (expect_dirty); |
| 2818 | } | 2818 | } |
| 2819 | 2819 | ||
| @@ -2998,9 +2998,9 @@ x_get_keysym_name (int keysym) | |||
| 2998 | /* Make static so we can always return it */ | 2998 | /* Make static so we can always return it */ |
| 2999 | static char value[100]; | 2999 | static char value[100]; |
| 3000 | 3000 | ||
| 3001 | BLOCK_INPUT; | 3001 | block_input (); |
| 3002 | GetKeyNameText (keysym, value, 100); | 3002 | GetKeyNameText (keysym, value, 100); |
| 3003 | UNBLOCK_INPUT; | 3003 | unblock_input (); |
| 3004 | 3004 | ||
| 3005 | return value; | 3005 | return value; |
| 3006 | } | 3006 | } |
| @@ -3308,7 +3308,7 @@ w32_mouse_position (FRAME_PTR *fp, int insist, Lisp_Object *bar_window, | |||
| 3308 | { | 3308 | { |
| 3309 | FRAME_PTR f1; | 3309 | FRAME_PTR f1; |
| 3310 | 3310 | ||
| 3311 | BLOCK_INPUT; | 3311 | block_input (); |
| 3312 | 3312 | ||
| 3313 | if (! NILP (last_mouse_scroll_bar) && insist == 0) | 3313 | if (! NILP (last_mouse_scroll_bar) && insist == 0) |
| 3314 | x_scroll_bar_report_motion (fp, bar_window, part, x, y, time); | 3314 | x_scroll_bar_report_motion (fp, bar_window, part, x, y, time); |
| @@ -3382,7 +3382,7 @@ w32_mouse_position (FRAME_PTR *fp, int insist, Lisp_Object *bar_window, | |||
| 3382 | } | 3382 | } |
| 3383 | } | 3383 | } |
| 3384 | 3384 | ||
| 3385 | UNBLOCK_INPUT; | 3385 | unblock_input (); |
| 3386 | } | 3386 | } |
| 3387 | 3387 | ||
| 3388 | 3388 | ||
| @@ -3480,12 +3480,12 @@ w32_set_scroll_bar_thumb (struct scroll_bar *bar, | |||
| 3480 | if (draggingp) | 3480 | if (draggingp) |
| 3481 | { | 3481 | { |
| 3482 | int near_bottom_p; | 3482 | int near_bottom_p; |
| 3483 | BLOCK_INPUT; | 3483 | block_input (); |
| 3484 | si.cbSize = sizeof (si); | 3484 | si.cbSize = sizeof (si); |
| 3485 | si.fMask = SIF_POS | SIF_PAGE; | 3485 | si.fMask = SIF_POS | SIF_PAGE; |
| 3486 | GetScrollInfo (w, SB_CTL, &si); | 3486 | GetScrollInfo (w, SB_CTL, &si); |
| 3487 | near_bottom_p = si.nPos + si.nPage >= range; | 3487 | near_bottom_p = si.nPos + si.nPage >= range; |
| 3488 | UNBLOCK_INPUT; | 3488 | unblock_input (); |
| 3489 | if (!near_bottom_p) | 3489 | if (!near_bottom_p) |
| 3490 | return; | 3490 | return; |
| 3491 | } | 3491 | } |
| @@ -3514,7 +3514,7 @@ w32_set_scroll_bar_thumb (struct scroll_bar *bar, | |||
| 3514 | 3514 | ||
| 3515 | sb_page = max (sb_page, VERTICAL_SCROLL_BAR_MIN_HANDLE); | 3515 | sb_page = max (sb_page, VERTICAL_SCROLL_BAR_MIN_HANDLE); |
| 3516 | 3516 | ||
| 3517 | BLOCK_INPUT; | 3517 | block_input (); |
| 3518 | 3518 | ||
| 3519 | si.cbSize = sizeof (si); | 3519 | si.cbSize = sizeof (si); |
| 3520 | si.fMask = SIF_PAGE | SIF_POS; | 3520 | si.fMask = SIF_PAGE | SIF_POS; |
| @@ -3523,7 +3523,7 @@ w32_set_scroll_bar_thumb (struct scroll_bar *bar, | |||
| 3523 | 3523 | ||
| 3524 | SetScrollInfo (w, SB_CTL, &si, TRUE); | 3524 | SetScrollInfo (w, SB_CTL, &si, TRUE); |
| 3525 | 3525 | ||
| 3526 | UNBLOCK_INPUT; | 3526 | unblock_input (); |
| 3527 | } | 3527 | } |
| 3528 | 3528 | ||
| 3529 | 3529 | ||
| @@ -3614,7 +3614,7 @@ x_scroll_bar_create (struct window *w, int top, int left, int width, int height) | |||
| 3614 | = XSCROLL_BAR (Fmake_vector (make_number (SCROLL_BAR_VEC_SIZE), Qnil)); | 3614 | = XSCROLL_BAR (Fmake_vector (make_number (SCROLL_BAR_VEC_SIZE), Qnil)); |
| 3615 | Lisp_Object barobj; | 3615 | Lisp_Object barobj; |
| 3616 | 3616 | ||
| 3617 | BLOCK_INPUT; | 3617 | block_input (); |
| 3618 | 3618 | ||
| 3619 | XSETWINDOW (bar->window, w); | 3619 | XSETWINDOW (bar->window, w); |
| 3620 | XSETINT (bar->top, top); | 3620 | XSETINT (bar->top, top); |
| @@ -3650,7 +3650,7 @@ x_scroll_bar_create (struct window *w, int top, int left, int width, int height) | |||
| 3650 | if (! NILP (bar->next)) | 3650 | if (! NILP (bar->next)) |
| 3651 | XSETVECTOR (XSCROLL_BAR (bar->next)->prev, bar); | 3651 | XSETVECTOR (XSCROLL_BAR (bar->next)->prev, bar); |
| 3652 | 3652 | ||
| 3653 | UNBLOCK_INPUT; | 3653 | unblock_input (); |
| 3654 | 3654 | ||
| 3655 | return bar; | 3655 | return bar; |
| 3656 | } | 3656 | } |
| @@ -3664,7 +3664,7 @@ x_scroll_bar_remove (struct scroll_bar *bar) | |||
| 3664 | { | 3664 | { |
| 3665 | FRAME_PTR f = XFRAME (WINDOW_FRAME (XWINDOW (bar->window))); | 3665 | FRAME_PTR f = XFRAME (WINDOW_FRAME (XWINDOW (bar->window))); |
| 3666 | 3666 | ||
| 3667 | BLOCK_INPUT; | 3667 | block_input (); |
| 3668 | 3668 | ||
| 3669 | /* Destroy the window. */ | 3669 | /* Destroy the window. */ |
| 3670 | my_destroy_window (f, SCROLL_BAR_W32_WINDOW (bar)); | 3670 | my_destroy_window (f, SCROLL_BAR_W32_WINDOW (bar)); |
| @@ -3672,7 +3672,7 @@ x_scroll_bar_remove (struct scroll_bar *bar) | |||
| 3672 | /* Dissociate this scroll bar from its window. */ | 3672 | /* Dissociate this scroll bar from its window. */ |
| 3673 | wset_vertical_scroll_bar (XWINDOW (bar->window), Qnil); | 3673 | wset_vertical_scroll_bar (XWINDOW (bar->window), Qnil); |
| 3674 | 3674 | ||
| 3675 | UNBLOCK_INPUT; | 3675 | unblock_input (); |
| 3676 | } | 3676 | } |
| 3677 | 3677 | ||
| 3678 | /* Set the handle of the vertical scroll bar for WINDOW to indicate | 3678 | /* Set the handle of the vertical scroll bar for WINDOW to indicate |
| @@ -3727,7 +3727,7 @@ w32_set_vertical_scroll_bar (struct window *w, | |||
| 3727 | if (NILP (w->vertical_scroll_bar)) | 3727 | if (NILP (w->vertical_scroll_bar)) |
| 3728 | { | 3728 | { |
| 3729 | HDC hdc; | 3729 | HDC hdc; |
| 3730 | BLOCK_INPUT; | 3730 | block_input (); |
| 3731 | if (width > 0 && height > 0) | 3731 | if (width > 0 && height > 0) |
| 3732 | { | 3732 | { |
| 3733 | hdc = get_frame_dc (f); | 3733 | hdc = get_frame_dc (f); |
| @@ -3737,7 +3737,7 @@ w32_set_vertical_scroll_bar (struct window *w, | |||
| 3737 | w32_clear_area (f, hdc, left, top, width, height); | 3737 | w32_clear_area (f, hdc, left, top, width, height); |
| 3738 | release_frame_dc (f, hdc); | 3738 | release_frame_dc (f, hdc); |
| 3739 | } | 3739 | } |
| 3740 | UNBLOCK_INPUT; | 3740 | unblock_input (); |
| 3741 | 3741 | ||
| 3742 | bar = x_scroll_bar_create (w, top, sb_left, sb_width, height); | 3742 | bar = x_scroll_bar_create (w, top, sb_left, sb_width, height); |
| 3743 | } | 3743 | } |
| @@ -3765,7 +3765,7 @@ w32_set_vertical_scroll_bar (struct window *w, | |||
| 3765 | HDC hdc; | 3765 | HDC hdc; |
| 3766 | SCROLLINFO si; | 3766 | SCROLLINFO si; |
| 3767 | 3767 | ||
| 3768 | BLOCK_INPUT; | 3768 | block_input (); |
| 3769 | if (width && height) | 3769 | if (width && height) |
| 3770 | { | 3770 | { |
| 3771 | hdc = get_frame_dc (f); | 3771 | hdc = get_frame_dc (f); |
| @@ -3801,7 +3801,7 @@ w32_set_vertical_scroll_bar (struct window *w, | |||
| 3801 | XSETINT (bar->width, sb_width); | 3801 | XSETINT (bar->width, sb_width); |
| 3802 | XSETINT (bar->height, height); | 3802 | XSETINT (bar->height, height); |
| 3803 | 3803 | ||
| 3804 | UNBLOCK_INPUT; | 3804 | unblock_input (); |
| 3805 | } | 3805 | } |
| 3806 | } | 3806 | } |
| 3807 | bar->fringe_extended_p = fringe_extended_p ? Qt : Qnil; | 3807 | bar->fringe_extended_p = fringe_extended_p ? Qt : Qnil; |
| @@ -4043,7 +4043,7 @@ x_scroll_bar_report_motion (FRAME_PTR *fp, Lisp_Object *bar_window, | |||
| 4043 | int top_range = VERTICAL_SCROLL_BAR_TOP_RANGE (f, XINT (bar->height)); | 4043 | int top_range = VERTICAL_SCROLL_BAR_TOP_RANGE (f, XINT (bar->height)); |
| 4044 | SCROLLINFO si; | 4044 | SCROLLINFO si; |
| 4045 | 4045 | ||
| 4046 | BLOCK_INPUT; | 4046 | block_input (); |
| 4047 | 4047 | ||
| 4048 | *fp = f; | 4048 | *fp = f; |
| 4049 | *bar_window = bar->window; | 4049 | *bar_window = bar->window; |
| @@ -4080,7 +4080,7 @@ x_scroll_bar_report_motion (FRAME_PTR *fp, Lisp_Object *bar_window, | |||
| 4080 | 4080 | ||
| 4081 | *time = last_mouse_movement_time; | 4081 | *time = last_mouse_movement_time; |
| 4082 | 4082 | ||
| 4083 | UNBLOCK_INPUT; | 4083 | unblock_input (); |
| 4084 | } | 4084 | } |
| 4085 | 4085 | ||
| 4086 | 4086 | ||
| @@ -4157,15 +4157,8 @@ w32_read_socket (struct terminal *terminal, | |||
| 4157 | struct w32_display_info *dpyinfo = &one_w32_display_info; | 4157 | struct w32_display_info *dpyinfo = &one_w32_display_info; |
| 4158 | Mouse_HLInfo *hlinfo = &dpyinfo->mouse_highlight; | 4158 | Mouse_HLInfo *hlinfo = &dpyinfo->mouse_highlight; |
| 4159 | 4159 | ||
| 4160 | if (interrupt_input_blocked) | ||
| 4161 | { | ||
| 4162 | interrupt_input_pending = 1; | ||
| 4163 | pending_signals = 1; | ||
| 4164 | return -1; | ||
| 4165 | } | ||
| 4166 | |||
| 4167 | interrupt_input_pending = 0; | 4160 | interrupt_input_pending = 0; |
| 4168 | BLOCK_INPUT; | 4161 | block_input (); |
| 4169 | 4162 | ||
| 4170 | /* So people can tell when we have read the available input. */ | 4163 | /* So people can tell when we have read the available input. */ |
| 4171 | input_signal_count++; | 4164 | input_signal_count++; |
| @@ -4961,7 +4954,7 @@ w32_read_socket (struct terminal *terminal, | |||
| 4961 | } | 4954 | } |
| 4962 | } | 4955 | } |
| 4963 | 4956 | ||
| 4964 | UNBLOCK_INPUT; | 4957 | unblock_input (); |
| 4965 | return count; | 4958 | return count; |
| 4966 | } | 4959 | } |
| 4967 | 4960 | ||
| @@ -5476,7 +5469,7 @@ x_set_offset (struct frame *f, register int xoff, register int yoff, | |||
| 5476 | } | 5469 | } |
| 5477 | x_calc_absolute_position (f); | 5470 | x_calc_absolute_position (f); |
| 5478 | 5471 | ||
| 5479 | BLOCK_INPUT; | 5472 | block_input (); |
| 5480 | x_wm_set_size_hint (f, (long) 0, 0); | 5473 | x_wm_set_size_hint (f, (long) 0, 0); |
| 5481 | 5474 | ||
| 5482 | modified_left = f->left_pos; | 5475 | modified_left = f->left_pos; |
| @@ -5487,7 +5480,7 @@ x_set_offset (struct frame *f, register int xoff, register int yoff, | |||
| 5487 | modified_left, modified_top, | 5480 | modified_left, modified_top, |
| 5488 | 0, 0, | 5481 | 0, 0, |
| 5489 | SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE); | 5482 | SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE); |
| 5490 | UNBLOCK_INPUT; | 5483 | unblock_input (); |
| 5491 | } | 5484 | } |
| 5492 | 5485 | ||
| 5493 | 5486 | ||
| @@ -5528,7 +5521,7 @@ x_set_window_size (struct frame *f, int change_gravity, int cols, int rows) | |||
| 5528 | { | 5521 | { |
| 5529 | int pixelwidth, pixelheight; | 5522 | int pixelwidth, pixelheight; |
| 5530 | 5523 | ||
| 5531 | BLOCK_INPUT; | 5524 | block_input (); |
| 5532 | 5525 | ||
| 5533 | check_frame_size (f, &rows, &cols); | 5526 | check_frame_size (f, &rows, &cols); |
| 5534 | f->scroll_bar_actual_width | 5527 | f->scroll_bar_actual_width |
| @@ -5608,7 +5601,7 @@ x_set_window_size (struct frame *f, int change_gravity, int cols, int rows) | |||
| 5608 | cancel_mouse_face (f); | 5601 | cancel_mouse_face (f); |
| 5609 | #endif | 5602 | #endif |
| 5610 | 5603 | ||
| 5611 | UNBLOCK_INPUT; | 5604 | unblock_input (); |
| 5612 | } | 5605 | } |
| 5613 | 5606 | ||
| 5614 | /* Mouse warping. */ | 5607 | /* Mouse warping. */ |
| @@ -5638,7 +5631,7 @@ x_set_mouse_pixel_position (struct frame *f, int pix_x, int pix_y) | |||
| 5638 | RECT rect; | 5631 | RECT rect; |
| 5639 | POINT pt; | 5632 | POINT pt; |
| 5640 | 5633 | ||
| 5641 | BLOCK_INPUT; | 5634 | block_input (); |
| 5642 | 5635 | ||
| 5643 | GetClientRect (FRAME_W32_WINDOW (f), &rect); | 5636 | GetClientRect (FRAME_W32_WINDOW (f), &rect); |
| 5644 | pt.x = rect.left + pix_x; | 5637 | pt.x = rect.left + pix_x; |
| @@ -5647,7 +5640,7 @@ x_set_mouse_pixel_position (struct frame *f, int pix_x, int pix_y) | |||
| 5647 | 5640 | ||
| 5648 | SetCursorPos (pt.x, pt.y); | 5641 | SetCursorPos (pt.x, pt.y); |
| 5649 | 5642 | ||
| 5650 | UNBLOCK_INPUT; | 5643 | unblock_input (); |
| 5651 | } | 5644 | } |
| 5652 | 5645 | ||
| 5653 | 5646 | ||
| @@ -5659,7 +5652,7 @@ x_focus_on_frame (struct frame *f) | |||
| 5659 | struct w32_display_info *dpyinfo = &one_w32_display_info; | 5652 | struct w32_display_info *dpyinfo = &one_w32_display_info; |
| 5660 | 5653 | ||
| 5661 | /* Give input focus to frame. */ | 5654 | /* Give input focus to frame. */ |
| 5662 | BLOCK_INPUT; | 5655 | block_input (); |
| 5663 | #if 0 | 5656 | #if 0 |
| 5664 | /* Try not to change its Z-order if possible. */ | 5657 | /* Try not to change its Z-order if possible. */ |
| 5665 | if (x_window_to_frame (dpyinfo, GetForegroundWindow ())) | 5658 | if (x_window_to_frame (dpyinfo, GetForegroundWindow ())) |
| @@ -5667,7 +5660,7 @@ x_focus_on_frame (struct frame *f) | |||
| 5667 | else | 5660 | else |
| 5668 | #endif | 5661 | #endif |
| 5669 | my_set_foreground_window (FRAME_W32_WINDOW (f)); | 5662 | my_set_foreground_window (FRAME_W32_WINDOW (f)); |
| 5670 | UNBLOCK_INPUT; | 5663 | unblock_input (); |
| 5671 | } | 5664 | } |
| 5672 | 5665 | ||
| 5673 | void | 5666 | void |
| @@ -5679,7 +5672,7 @@ x_unfocus_frame (struct frame *f) | |||
| 5679 | void | 5672 | void |
| 5680 | x_raise_frame (struct frame *f) | 5673 | x_raise_frame (struct frame *f) |
| 5681 | { | 5674 | { |
| 5682 | BLOCK_INPUT; | 5675 | block_input (); |
| 5683 | 5676 | ||
| 5684 | /* Strictly speaking, raise-frame should only change the frame's Z | 5677 | /* Strictly speaking, raise-frame should only change the frame's Z |
| 5685 | order, leaving input focus unchanged. This is reasonable behavior | 5678 | order, leaving input focus unchanged. This is reasonable behavior |
| @@ -5734,19 +5727,19 @@ x_raise_frame (struct frame *f) | |||
| 5734 | my_bring_window_to_top (FRAME_W32_WINDOW (f)); | 5727 | my_bring_window_to_top (FRAME_W32_WINDOW (f)); |
| 5735 | } | 5728 | } |
| 5736 | 5729 | ||
| 5737 | UNBLOCK_INPUT; | 5730 | unblock_input (); |
| 5738 | } | 5731 | } |
| 5739 | 5732 | ||
| 5740 | /* Lower frame F. */ | 5733 | /* Lower frame F. */ |
| 5741 | void | 5734 | void |
| 5742 | x_lower_frame (struct frame *f) | 5735 | x_lower_frame (struct frame *f) |
| 5743 | { | 5736 | { |
| 5744 | BLOCK_INPUT; | 5737 | block_input (); |
| 5745 | my_set_window_pos (FRAME_W32_WINDOW (f), | 5738 | my_set_window_pos (FRAME_W32_WINDOW (f), |
| 5746 | HWND_BOTTOM, | 5739 | HWND_BOTTOM, |
| 5747 | 0, 0, 0, 0, | 5740 | 0, 0, 0, 0, |
| 5748 | SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE); | 5741 | SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE); |
| 5749 | UNBLOCK_INPUT; | 5742 | unblock_input (); |
| 5750 | } | 5743 | } |
| 5751 | 5744 | ||
| 5752 | static void | 5745 | static void |
| @@ -5775,7 +5768,7 @@ x_make_frame_visible (struct frame *f) | |||
| 5775 | { | 5768 | { |
| 5776 | Lisp_Object type; | 5769 | Lisp_Object type; |
| 5777 | 5770 | ||
| 5778 | BLOCK_INPUT; | 5771 | block_input (); |
| 5779 | 5772 | ||
| 5780 | type = x_icon_type (f); | 5773 | type = x_icon_type (f); |
| 5781 | if (!NILP (type)) | 5774 | if (!NILP (type)) |
| @@ -5827,7 +5820,7 @@ x_make_frame_visible (struct frame *f) | |||
| 5827 | int count; | 5820 | int count; |
| 5828 | 5821 | ||
| 5829 | /* This must come after we set COUNT. */ | 5822 | /* This must come after we set COUNT. */ |
| 5830 | UNBLOCK_INPUT; | 5823 | unblock_input (); |
| 5831 | 5824 | ||
| 5832 | XSETFRAME (frame, f); | 5825 | XSETFRAME (frame, f); |
| 5833 | 5826 | ||
| @@ -5870,7 +5863,7 @@ x_make_frame_invisible (struct frame *f) | |||
| 5870 | if (FRAME_W32_DISPLAY_INFO (f)->x_highlight_frame == f) | 5863 | if (FRAME_W32_DISPLAY_INFO (f)->x_highlight_frame == f) |
| 5871 | FRAME_W32_DISPLAY_INFO (f)->x_highlight_frame = 0; | 5864 | FRAME_W32_DISPLAY_INFO (f)->x_highlight_frame = 0; |
| 5872 | 5865 | ||
| 5873 | BLOCK_INPUT; | 5866 | block_input (); |
| 5874 | 5867 | ||
| 5875 | my_show_window (f, FRAME_W32_WINDOW (f), SW_HIDE); | 5868 | my_show_window (f, FRAME_W32_WINDOW (f), SW_HIDE); |
| 5876 | 5869 | ||
| @@ -5884,7 +5877,7 @@ x_make_frame_invisible (struct frame *f) | |||
| 5884 | f->async_visible = 0; | 5877 | f->async_visible = 0; |
| 5885 | f->async_iconified = 0; | 5878 | f->async_iconified = 0; |
| 5886 | 5879 | ||
| 5887 | UNBLOCK_INPUT; | 5880 | unblock_input (); |
| 5888 | } | 5881 | } |
| 5889 | 5882 | ||
| 5890 | /* Change window state from mapped to iconified. */ | 5883 | /* Change window state from mapped to iconified. */ |
| @@ -5901,7 +5894,7 @@ x_iconify_frame (struct frame *f) | |||
| 5901 | if (f->async_iconified) | 5894 | if (f->async_iconified) |
| 5902 | return; | 5895 | return; |
| 5903 | 5896 | ||
| 5904 | BLOCK_INPUT; | 5897 | block_input (); |
| 5905 | 5898 | ||
| 5906 | type = x_icon_type (f); | 5899 | type = x_icon_type (f); |
| 5907 | if (!NILP (type)) | 5900 | if (!NILP (type)) |
| @@ -5910,7 +5903,7 @@ x_iconify_frame (struct frame *f) | |||
| 5910 | /* Simulate the user minimizing the frame. */ | 5903 | /* Simulate the user minimizing the frame. */ |
| 5911 | SendMessage (FRAME_W32_WINDOW (f), WM_SYSCOMMAND, SC_MINIMIZE, 0); | 5904 | SendMessage (FRAME_W32_WINDOW (f), WM_SYSCOMMAND, SC_MINIMIZE, 0); |
| 5912 | 5905 | ||
| 5913 | UNBLOCK_INPUT; | 5906 | unblock_input (); |
| 5914 | } | 5907 | } |
| 5915 | 5908 | ||
| 5916 | 5909 | ||
| @@ -5922,7 +5915,7 @@ x_free_frame_resources (struct frame *f) | |||
| 5922 | struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (f); | 5915 | struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (f); |
| 5923 | Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f); | 5916 | Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f); |
| 5924 | 5917 | ||
| 5925 | BLOCK_INPUT; | 5918 | block_input (); |
| 5926 | 5919 | ||
| 5927 | /* We must free faces before destroying windows because some | 5920 | /* We must free faces before destroying windows because some |
| 5928 | font-driver (e.g. xft) access a window while finishing a | 5921 | font-driver (e.g. xft) access a window while finishing a |
| @@ -5970,7 +5963,7 @@ x_free_frame_resources (struct frame *f) | |||
| 5970 | hlinfo->mouse_face_mouse_frame = 0; | 5963 | hlinfo->mouse_face_mouse_frame = 0; |
| 5971 | } | 5964 | } |
| 5972 | 5965 | ||
| 5973 | UNBLOCK_INPUT; | 5966 | unblock_input (); |
| 5974 | } | 5967 | } |
| 5975 | 5968 | ||
| 5976 | 5969 | ||
| @@ -6254,10 +6247,10 @@ x_delete_terminal (struct terminal *terminal) | |||
| 6254 | if (!terminal->name) | 6247 | if (!terminal->name) |
| 6255 | return; | 6248 | return; |
| 6256 | 6249 | ||
| 6257 | BLOCK_INPUT; | 6250 | block_input (); |
| 6258 | 6251 | ||
| 6259 | x_delete_display (dpyinfo); | 6252 | x_delete_display (dpyinfo); |
| 6260 | UNBLOCK_INPUT; | 6253 | unblock_input (); |
| 6261 | } | 6254 | } |
| 6262 | 6255 | ||
| 6263 | struct w32_display_info * | 6256 | struct w32_display_info * |
| @@ -6267,7 +6260,7 @@ w32_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name) | |||
| 6267 | struct terminal *terminal; | 6260 | struct terminal *terminal; |
| 6268 | HDC hdc; | 6261 | HDC hdc; |
| 6269 | 6262 | ||
| 6270 | BLOCK_INPUT; | 6263 | block_input (); |
| 6271 | 6264 | ||
| 6272 | if (!w32_initialized) | 6265 | if (!w32_initialized) |
| 6273 | { | 6266 | { |
| @@ -6329,7 +6322,7 @@ w32_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name) | |||
| 6329 | init_sigio (connection); | 6322 | init_sigio (connection); |
| 6330 | #endif /* ! defined (SIGIO) */ | 6323 | #endif /* ! defined (SIGIO) */ |
| 6331 | 6324 | ||
| 6332 | UNBLOCK_INPUT; | 6325 | unblock_input (); |
| 6333 | 6326 | ||
| 6334 | return dpyinfo; | 6327 | return dpyinfo; |
| 6335 | } | 6328 | } |
diff --git a/src/widget.c b/src/widget.c index fd5ad167125..1f472c6231c 100644 --- a/src/widget.c +++ b/src/widget.c | |||
| @@ -677,13 +677,13 @@ EmacsFrameDestroy (Widget widget) | |||
| 677 | if (! s) emacs_abort (); | 677 | if (! s) emacs_abort (); |
| 678 | if (! s->output_data.x) emacs_abort (); | 678 | if (! s->output_data.x) emacs_abort (); |
| 679 | 679 | ||
| 680 | BLOCK_INPUT; | 680 | block_input (); |
| 681 | x_free_gcs (s); | 681 | x_free_gcs (s); |
| 682 | if (s->output_data.x->white_relief.gc) | 682 | if (s->output_data.x->white_relief.gc) |
| 683 | XFreeGC (XtDisplay (widget), s->output_data.x->white_relief.gc); | 683 | XFreeGC (XtDisplay (widget), s->output_data.x->white_relief.gc); |
| 684 | if (s->output_data.x->black_relief.gc) | 684 | if (s->output_data.x->black_relief.gc) |
| 685 | XFreeGC (XtDisplay (widget), s->output_data.x->black_relief.gc); | 685 | XFreeGC (XtDisplay (widget), s->output_data.x->black_relief.gc); |
| 686 | UNBLOCK_INPUT; | 686 | unblock_input (); |
| 687 | } | 687 | } |
| 688 | 688 | ||
| 689 | static void | 689 | static void |
diff --git a/src/window.c b/src/window.c index 6798be8231c..86f86deedb2 100644 --- a/src/window.c +++ b/src/window.c | |||
| @@ -2819,7 +2819,7 @@ window-start value is reasonable when this function is called. */) | |||
| 2819 | } | 2819 | } |
| 2820 | } | 2820 | } |
| 2821 | 2821 | ||
| 2822 | BLOCK_INPUT; | 2822 | block_input (); |
| 2823 | if (!FRAME_INITIAL_P (f)) | 2823 | if (!FRAME_INITIAL_P (f)) |
| 2824 | { | 2824 | { |
| 2825 | Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f); | 2825 | Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f); |
| @@ -2961,7 +2961,7 @@ window-start value is reasonable when this function is called. */) | |||
| 2961 | } | 2961 | } |
| 2962 | 2962 | ||
| 2963 | adjust_glyphs (f); | 2963 | adjust_glyphs (f); |
| 2964 | UNBLOCK_INPUT; | 2964 | unblock_input (); |
| 2965 | 2965 | ||
| 2966 | run_window_configuration_change_hook (f); | 2966 | run_window_configuration_change_hook (f); |
| 2967 | 2967 | ||
| @@ -3696,14 +3696,14 @@ be applied on the Elisp level. */) | |||
| 3696 | (horflag ? r->total_cols : r->total_lines))) | 3696 | (horflag ? r->total_cols : r->total_lines))) |
| 3697 | return Qnil; | 3697 | return Qnil; |
| 3698 | 3698 | ||
| 3699 | BLOCK_INPUT; | 3699 | block_input (); |
| 3700 | window_resize_apply (r, horflag); | 3700 | window_resize_apply (r, horflag); |
| 3701 | 3701 | ||
| 3702 | windows_or_buffers_changed++; | 3702 | windows_or_buffers_changed++; |
| 3703 | FRAME_WINDOW_SIZES_CHANGED (f) = 1; | 3703 | FRAME_WINDOW_SIZES_CHANGED (f) = 1; |
| 3704 | 3704 | ||
| 3705 | adjust_glyphs (f); | 3705 | adjust_glyphs (f); |
| 3706 | UNBLOCK_INPUT; | 3706 | unblock_input (); |
| 3707 | 3707 | ||
| 3708 | run_window_configuration_change_hook (f); | 3708 | run_window_configuration_change_hook (f); |
| 3709 | 3709 | ||
| @@ -3973,13 +3973,13 @@ set correctly. See the code of `split-window' for how this is done. */) | |||
| 3973 | wset_new_total (n, total_size); | 3973 | wset_new_total (n, total_size); |
| 3974 | wset_new_normal (n, normal_size); | 3974 | wset_new_normal (n, normal_size); |
| 3975 | 3975 | ||
| 3976 | BLOCK_INPUT; | 3976 | block_input (); |
| 3977 | window_resize_apply (p, horflag); | 3977 | window_resize_apply (p, horflag); |
| 3978 | adjust_glyphs (f); | 3978 | adjust_glyphs (f); |
| 3979 | /* Set buffer of NEW to buffer of reference window. Don't run | 3979 | /* Set buffer of NEW to buffer of reference window. Don't run |
| 3980 | any hooks. */ | 3980 | any hooks. */ |
| 3981 | set_window_buffer (new, r->buffer, 0, 1); | 3981 | set_window_buffer (new, r->buffer, 0, 1); |
| 3982 | UNBLOCK_INPUT; | 3982 | unblock_input (); |
| 3983 | 3983 | ||
| 3984 | /* Maybe we should run the scroll functions in Elisp (which already | 3984 | /* Maybe we should run the scroll functions in Elisp (which already |
| 3985 | runs the configuration change hook). */ | 3985 | runs the configuration change hook). */ |
| @@ -4060,7 +4060,7 @@ Signal an error when WINDOW is the only window on its frame. */) | |||
| 4060 | { | 4060 | { |
| 4061 | 4061 | ||
| 4062 | /* Block input. */ | 4062 | /* Block input. */ |
| 4063 | BLOCK_INPUT; | 4063 | block_input (); |
| 4064 | window_resize_apply (p, horflag); | 4064 | window_resize_apply (p, horflag); |
| 4065 | 4065 | ||
| 4066 | /* If this window is referred to by the dpyinfo's mouse | 4066 | /* If this window is referred to by the dpyinfo's mouse |
| @@ -4132,7 +4132,7 @@ Signal an error when WINDOW is the only window on its frame. */) | |||
| 4132 | else | 4132 | else |
| 4133 | fset_selected_window (f, new_selected_window); | 4133 | fset_selected_window (f, new_selected_window); |
| 4134 | 4134 | ||
| 4135 | UNBLOCK_INPUT; | 4135 | unblock_input (); |
| 4136 | 4136 | ||
| 4137 | /* Now look whether `get-mru-window' gets us something. */ | 4137 | /* Now look whether `get-mru-window' gets us something. */ |
| 4138 | mru_window = call1 (Qget_mru_window, frame); | 4138 | mru_window = call1 (Qget_mru_window, frame); |
| @@ -4147,7 +4147,7 @@ Signal an error when WINDOW is the only window on its frame. */) | |||
| 4147 | fset_selected_window (f, new_selected_window); | 4147 | fset_selected_window (f, new_selected_window); |
| 4148 | } | 4148 | } |
| 4149 | else | 4149 | else |
| 4150 | UNBLOCK_INPUT; | 4150 | unblock_input (); |
| 4151 | 4151 | ||
| 4152 | /* Must be run by the caller: | 4152 | /* Must be run by the caller: |
| 4153 | run_window_configuration_change_hook (f); */ | 4153 | run_window_configuration_change_hook (f); */ |
| @@ -4197,7 +4197,7 @@ grow_mini_window (struct window *w, int delta) | |||
| 4197 | root, make_number (- delta)); | 4197 | root, make_number (- delta)); |
| 4198 | if (INTEGERP (value) && window_resize_check (r, 0)) | 4198 | if (INTEGERP (value) && window_resize_check (r, 0)) |
| 4199 | { | 4199 | { |
| 4200 | BLOCK_INPUT; | 4200 | block_input (); |
| 4201 | window_resize_apply (r, 0); | 4201 | window_resize_apply (r, 0); |
| 4202 | 4202 | ||
| 4203 | /* Grow the mini-window. */ | 4203 | /* Grow the mini-window. */ |
| @@ -4209,7 +4209,7 @@ grow_mini_window (struct window *w, int delta) | |||
| 4209 | w->last_overlay_modified = 0; | 4209 | w->last_overlay_modified = 0; |
| 4210 | 4210 | ||
| 4211 | adjust_glyphs (f); | 4211 | adjust_glyphs (f); |
| 4212 | UNBLOCK_INPUT; | 4212 | unblock_input (); |
| 4213 | } | 4213 | } |
| 4214 | } | 4214 | } |
| 4215 | 4215 | ||
| @@ -4234,7 +4234,7 @@ shrink_mini_window (struct window *w) | |||
| 4234 | root, make_number (size - 1)); | 4234 | root, make_number (size - 1)); |
| 4235 | if (INTEGERP (value) && window_resize_check (r, 0)) | 4235 | if (INTEGERP (value) && window_resize_check (r, 0)) |
| 4236 | { | 4236 | { |
| 4237 | BLOCK_INPUT; | 4237 | block_input (); |
| 4238 | window_resize_apply (r, 0); | 4238 | window_resize_apply (r, 0); |
| 4239 | 4239 | ||
| 4240 | /* Shrink the mini-window. */ | 4240 | /* Shrink the mini-window. */ |
| @@ -4246,7 +4246,7 @@ shrink_mini_window (struct window *w) | |||
| 4246 | w->last_overlay_modified = 0; | 4246 | w->last_overlay_modified = 0; |
| 4247 | 4247 | ||
| 4248 | adjust_glyphs (f); | 4248 | adjust_glyphs (f); |
| 4249 | UNBLOCK_INPUT; | 4249 | unblock_input (); |
| 4250 | } | 4250 | } |
| 4251 | /* If the above failed for whatever strange reason we must make a | 4251 | /* If the above failed for whatever strange reason we must make a |
| 4252 | one window frame here. The same routine will be needed when | 4252 | one window frame here. The same routine will be needed when |
| @@ -4278,7 +4278,7 @@ DEFUN ("resize-mini-window-internal", Fresize_mini_window_internal, Sresize_mini | |||
| 4278 | && XINT (w->new_total) > 0 | 4278 | && XINT (w->new_total) > 0 |
| 4279 | && height == XINT (r->new_total) + XINT (w->new_total)) | 4279 | && height == XINT (r->new_total) + XINT (w->new_total)) |
| 4280 | { | 4280 | { |
| 4281 | BLOCK_INPUT; | 4281 | block_input (); |
| 4282 | window_resize_apply (r, 0); | 4282 | window_resize_apply (r, 0); |
| 4283 | 4283 | ||
| 4284 | wset_total_lines (w, w->new_total); | 4284 | wset_total_lines (w, w->new_total); |
| @@ -4288,7 +4288,7 @@ DEFUN ("resize-mini-window-internal", Fresize_mini_window_internal, Sresize_mini | |||
| 4288 | windows_or_buffers_changed++; | 4288 | windows_or_buffers_changed++; |
| 4289 | FRAME_WINDOW_SIZES_CHANGED (f) = 1; | 4289 | FRAME_WINDOW_SIZES_CHANGED (f) = 1; |
| 4290 | adjust_glyphs (f); | 4290 | adjust_glyphs (f); |
| 4291 | UNBLOCK_INPUT; | 4291 | unblock_input (); |
| 4292 | 4292 | ||
| 4293 | run_window_configuration_change_hook (f); | 4293 | run_window_configuration_change_hook (f); |
| 4294 | return Qt; | 4294 | return Qt; |
| @@ -5624,7 +5624,7 @@ the return value is nil. Otherwise the value is t. */) | |||
| 5624 | 5624 | ||
| 5625 | /* The mouse highlighting code could get screwed up | 5625 | /* The mouse highlighting code could get screwed up |
| 5626 | if it runs during this. */ | 5626 | if it runs during this. */ |
| 5627 | BLOCK_INPUT; | 5627 | block_input (); |
| 5628 | 5628 | ||
| 5629 | if (data->frame_lines != previous_frame_lines | 5629 | if (data->frame_lines != previous_frame_lines |
| 5630 | || data->frame_cols != previous_frame_cols) | 5630 | || data->frame_cols != previous_frame_cols) |
| @@ -5875,7 +5875,7 @@ the return value is nil. Otherwise the value is t. */) | |||
| 5875 | } | 5875 | } |
| 5876 | 5876 | ||
| 5877 | adjust_glyphs (f); | 5877 | adjust_glyphs (f); |
| 5878 | UNBLOCK_INPUT; | 5878 | unblock_input (); |
| 5879 | 5879 | ||
| 5880 | /* Scan dead buffer windows. */ | 5880 | /* Scan dead buffer windows. */ |
| 5881 | for (; CONSP (dead_windows); dead_windows = XCDR (dead_windows)) | 5881 | for (; CONSP (dead_windows); dead_windows = XCDR (dead_windows)) |
diff --git a/src/xdisp.c b/src/xdisp.c index c2032696a1c..423ecab8dc7 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -275,6 +275,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 275 | #include <limits.h> | 275 | #include <limits.h> |
| 276 | 276 | ||
| 277 | #include "lisp.h" | 277 | #include "lisp.h" |
| 278 | #include "atimer.h" | ||
| 278 | #include "keyboard.h" | 279 | #include "keyboard.h" |
| 279 | #include "frame.h" | 280 | #include "frame.h" |
| 280 | #include "window.h" | 281 | #include "window.h" |
| @@ -11402,11 +11403,11 @@ x_cursor_to (int vpos, int hpos, int y, int x) | |||
| 11402 | This will also set the cursor position of W. */ | 11403 | This will also set the cursor position of W. */ |
| 11403 | if (updated_window == NULL) | 11404 | if (updated_window == NULL) |
| 11404 | { | 11405 | { |
| 11405 | BLOCK_INPUT; | 11406 | block_input (); |
| 11406 | display_and_set_cursor (w, 1, hpos, vpos, x, y); | 11407 | display_and_set_cursor (w, 1, hpos, vpos, x, y); |
| 11407 | if (FRAME_RIF (SELECTED_FRAME ())->flush_display_optional) | 11408 | if (FRAME_RIF (SELECTED_FRAME ())->flush_display_optional) |
| 11408 | FRAME_RIF (SELECTED_FRAME ())->flush_display_optional (SELECTED_FRAME ()); | 11409 | FRAME_RIF (SELECTED_FRAME ())->flush_display_optional (SELECTED_FRAME ()); |
| 11409 | UNBLOCK_INPUT; | 11410 | unblock_input (); |
| 11410 | } | 11411 | } |
| 11411 | } | 11412 | } |
| 11412 | 11413 | ||
| @@ -11520,11 +11521,11 @@ update_tool_bar (struct frame *f, int save_match_data) | |||
| 11520 | /* Redisplay that happens asynchronously due to an expose event | 11521 | /* Redisplay that happens asynchronously due to an expose event |
| 11521 | may access f->tool_bar_items. Make sure we update both | 11522 | may access f->tool_bar_items. Make sure we update both |
| 11522 | variables within BLOCK_INPUT so no such event interrupts. */ | 11523 | variables within BLOCK_INPUT so no such event interrupts. */ |
| 11523 | BLOCK_INPUT; | 11524 | block_input (); |
| 11524 | fset_tool_bar_items (f, new_tool_bar); | 11525 | fset_tool_bar_items (f, new_tool_bar); |
| 11525 | f->n_tool_bar_items = new_n_tool_bar; | 11526 | f->n_tool_bar_items = new_n_tool_bar; |
| 11526 | w->update_mode_line = 1; | 11527 | w->update_mode_line = 1; |
| 11527 | UNBLOCK_INPUT; | 11528 | unblock_input (); |
| 11528 | } | 11529 | } |
| 11529 | 11530 | ||
| 11530 | UNGCPRO; | 11531 | UNGCPRO; |
| @@ -16205,10 +16206,10 @@ redisplay_window (Lisp_Object window, int just_this_one_p) | |||
| 16205 | || w->pseudo_window_p))) | 16206 | || w->pseudo_window_p))) |
| 16206 | { | 16207 | { |
| 16207 | update_begin (f); | 16208 | update_begin (f); |
| 16208 | BLOCK_INPUT; | 16209 | block_input (); |
| 16209 | if (draw_window_fringes (w, 1)) | 16210 | if (draw_window_fringes (w, 1)) |
| 16210 | x_draw_vertical_border (w); | 16211 | x_draw_vertical_border (w); |
| 16211 | UNBLOCK_INPUT; | 16212 | unblock_input (); |
| 16212 | update_end (f); | 16213 | update_end (f); |
| 16213 | } | 16214 | } |
| 16214 | #endif /* HAVE_WINDOW_SYSTEM */ | 16215 | #endif /* HAVE_WINDOW_SYSTEM */ |
| @@ -25327,7 +25328,7 @@ x_write_glyphs (struct glyph *start, int len) | |||
| 25327 | if (updated_row->reversed_p && chpos >= updated_row->used[TEXT_AREA]) | 25328 | if (updated_row->reversed_p && chpos >= updated_row->used[TEXT_AREA]) |
| 25328 | chpos = updated_row->used[TEXT_AREA] - 1; | 25329 | chpos = updated_row->used[TEXT_AREA] - 1; |
| 25329 | 25330 | ||
| 25330 | BLOCK_INPUT; | 25331 | block_input (); |
| 25331 | 25332 | ||
| 25332 | /* Write glyphs. */ | 25333 | /* Write glyphs. */ |
| 25333 | 25334 | ||
| @@ -25345,7 +25346,7 @@ x_write_glyphs (struct glyph *start, int len) | |||
| 25345 | && chpos < hpos + len) | 25346 | && chpos < hpos + len) |
| 25346 | updated_window->phys_cursor_on_p = 0; | 25347 | updated_window->phys_cursor_on_p = 0; |
| 25347 | 25348 | ||
| 25348 | UNBLOCK_INPUT; | 25349 | unblock_input (); |
| 25349 | 25350 | ||
| 25350 | /* Advance the output cursor. */ | 25351 | /* Advance the output cursor. */ |
| 25351 | output_cursor.hpos += len; | 25352 | output_cursor.hpos += len; |
| @@ -25368,7 +25369,7 @@ x_insert_glyphs (struct glyph *start, int len) | |||
| 25368 | ptrdiff_t hpos; | 25369 | ptrdiff_t hpos; |
| 25369 | 25370 | ||
| 25370 | eassert (updated_window && updated_row); | 25371 | eassert (updated_window && updated_row); |
| 25371 | BLOCK_INPUT; | 25372 | block_input (); |
| 25372 | w = updated_window; | 25373 | w = updated_window; |
| 25373 | f = XFRAME (WINDOW_FRAME (w)); | 25374 | f = XFRAME (WINDOW_FRAME (w)); |
| 25374 | 25375 | ||
| @@ -25402,7 +25403,7 @@ x_insert_glyphs (struct glyph *start, int len) | |||
| 25402 | /* Advance the output cursor. */ | 25403 | /* Advance the output cursor. */ |
| 25403 | output_cursor.hpos += len; | 25404 | output_cursor.hpos += len; |
| 25404 | output_cursor.x += shift_by_width; | 25405 | output_cursor.x += shift_by_width; |
| 25405 | UNBLOCK_INPUT; | 25406 | unblock_input (); |
| 25406 | } | 25407 | } |
| 25407 | 25408 | ||
| 25408 | 25409 | ||
| @@ -25471,10 +25472,10 @@ x_clear_end_of_line (int to_x) | |||
| 25471 | /* Prevent inadvertently clearing to end of the X window. */ | 25472 | /* Prevent inadvertently clearing to end of the X window. */ |
| 25472 | if (to_x > from_x && to_y > from_y) | 25473 | if (to_x > from_x && to_y > from_y) |
| 25473 | { | 25474 | { |
| 25474 | BLOCK_INPUT; | 25475 | block_input (); |
| 25475 | FRAME_RIF (f)->clear_frame_area (f, from_x, from_y, | 25476 | FRAME_RIF (f)->clear_frame_area (f, from_x, from_y, |
| 25476 | to_x - from_x, to_y - from_y); | 25477 | to_x - from_x, to_y - from_y); |
| 25477 | UNBLOCK_INPUT; | 25478 | unblock_input (); |
| 25478 | } | 25479 | } |
| 25479 | } | 25480 | } |
| 25480 | 25481 | ||
| @@ -25801,7 +25802,7 @@ x_fix_overlapping_area (struct window *w, struct glyph_row *row, | |||
| 25801 | { | 25802 | { |
| 25802 | int i, x; | 25803 | int i, x; |
| 25803 | 25804 | ||
| 25804 | BLOCK_INPUT; | 25805 | block_input (); |
| 25805 | 25806 | ||
| 25806 | x = 0; | 25807 | x = 0; |
| 25807 | for (i = 0; i < row->used[area];) | 25808 | for (i = 0; i < row->used[area];) |
| @@ -25829,7 +25830,7 @@ x_fix_overlapping_area (struct window *w, struct glyph_row *row, | |||
| 25829 | } | 25830 | } |
| 25830 | } | 25831 | } |
| 25831 | 25832 | ||
| 25832 | UNBLOCK_INPUT; | 25833 | unblock_input (); |
| 25833 | } | 25834 | } |
| 25834 | 25835 | ||
| 25835 | 25836 | ||
| @@ -26047,7 +26048,7 @@ display_and_set_cursor (struct window *w, int on, | |||
| 26047 | || (0 <= hpos && hpos < glyph_row->used[TEXT_AREA])) | 26048 | || (0 <= hpos && hpos < glyph_row->used[TEXT_AREA])) |
| 26048 | glyph = glyph_row->glyphs[TEXT_AREA] + hpos; | 26049 | glyph = glyph_row->glyphs[TEXT_AREA] + hpos; |
| 26049 | 26050 | ||
| 26050 | eassert (interrupt_input_blocked); | 26051 | eassert (input_blocked_p ()); |
| 26051 | 26052 | ||
| 26052 | /* Set new_cursor_type to the cursor we want to be displayed. */ | 26053 | /* Set new_cursor_type to the cursor we want to be displayed. */ |
| 26053 | new_cursor_type = get_window_cursor_type (w, glyph, | 26054 | new_cursor_type = get_window_cursor_type (w, glyph, |
| @@ -26117,10 +26118,10 @@ update_window_cursor (struct window *w, int on) | |||
| 26117 | if (row->reversed_p && hpos >= row->used[TEXT_AREA]) | 26118 | if (row->reversed_p && hpos >= row->used[TEXT_AREA]) |
| 26118 | hpos = row->used[TEXT_AREA] - 1; | 26119 | hpos = row->used[TEXT_AREA] - 1; |
| 26119 | 26120 | ||
| 26120 | BLOCK_INPUT; | 26121 | block_input (); |
| 26121 | display_and_set_cursor (w, on, hpos, vpos, | 26122 | display_and_set_cursor (w, on, hpos, vpos, |
| 26122 | w->phys_cursor.x, w->phys_cursor.y); | 26123 | w->phys_cursor.x, w->phys_cursor.y); |
| 26123 | UNBLOCK_INPUT; | 26124 | unblock_input (); |
| 26124 | } | 26125 | } |
| 26125 | } | 26126 | } |
| 26126 | 26127 | ||
| @@ -26298,10 +26299,10 @@ show_mouse_face (Mouse_HLInfo *hlinfo, enum draw_glyphs_face draw) | |||
| 26298 | if (row->reversed_p && hpos >= row->used[TEXT_AREA]) | 26299 | if (row->reversed_p && hpos >= row->used[TEXT_AREA]) |
| 26299 | hpos = row->used[TEXT_AREA] - 1; | 26300 | hpos = row->used[TEXT_AREA] - 1; |
| 26300 | 26301 | ||
| 26301 | BLOCK_INPUT; | 26302 | block_input (); |
| 26302 | display_and_set_cursor (w, 1, hpos, w->phys_cursor.vpos, | 26303 | display_and_set_cursor (w, 1, hpos, w->phys_cursor.vpos, |
| 26303 | w->phys_cursor.x, w->phys_cursor.y); | 26304 | w->phys_cursor.x, w->phys_cursor.y); |
| 26304 | UNBLOCK_INPUT; | 26305 | unblock_input (); |
| 26305 | } | 26306 | } |
| 26306 | #endif /* HAVE_WINDOW_SYSTEM */ | 26307 | #endif /* HAVE_WINDOW_SYSTEM */ |
| 26307 | } | 26308 | } |
| @@ -28116,11 +28117,11 @@ x_clear_window_mouse_face (struct window *w) | |||
| 28116 | Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (XFRAME (w->frame)); | 28117 | Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (XFRAME (w->frame)); |
| 28117 | Lisp_Object window; | 28118 | Lisp_Object window; |
| 28118 | 28119 | ||
| 28119 | BLOCK_INPUT; | 28120 | block_input (); |
| 28120 | XSETWINDOW (window, w); | 28121 | XSETWINDOW (window, w); |
| 28121 | if (EQ (window, hlinfo->mouse_face_window)) | 28122 | if (EQ (window, hlinfo->mouse_face_window)) |
| 28122 | clear_mouse_face (hlinfo); | 28123 | clear_mouse_face (hlinfo); |
| 28123 | UNBLOCK_INPUT; | 28124 | unblock_input (); |
| 28124 | } | 28125 | } |
| 28125 | 28126 | ||
| 28126 | 28127 | ||
diff --git a/src/xfaces.c b/src/xfaces.c index c240a05c6c0..a11440d5bd0 100644 --- a/src/xfaces.c +++ b/src/xfaces.c | |||
| @@ -605,9 +605,9 @@ static inline GC | |||
| 605 | x_create_gc (struct frame *f, long unsigned int mask, XGCValues *xgcv) | 605 | x_create_gc (struct frame *f, long unsigned int mask, XGCValues *xgcv) |
| 606 | { | 606 | { |
| 607 | GC gc; | 607 | GC gc; |
| 608 | BLOCK_INPUT; | 608 | block_input (); |
| 609 | gc = XCreateGC (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), mask, xgcv); | 609 | gc = XCreateGC (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), mask, xgcv); |
| 610 | UNBLOCK_INPUT; | 610 | unblock_input (); |
| 611 | IF_DEBUG (++ngcs); | 611 | IF_DEBUG (++ngcs); |
| 612 | return gc; | 612 | return gc; |
| 613 | } | 613 | } |
| @@ -618,7 +618,7 @@ x_create_gc (struct frame *f, long unsigned int mask, XGCValues *xgcv) | |||
| 618 | static inline void | 618 | static inline void |
| 619 | x_free_gc (struct frame *f, GC gc) | 619 | x_free_gc (struct frame *f, GC gc) |
| 620 | { | 620 | { |
| 621 | eassert (interrupt_input_blocked); | 621 | eassert (input_blocked_p ()); |
| 622 | IF_DEBUG (eassert (--ngcs >= 0)); | 622 | IF_DEBUG (eassert (--ngcs >= 0)); |
| 623 | XFreeGC (FRAME_X_DISPLAY (f), gc); | 623 | XFreeGC (FRAME_X_DISPLAY (f), gc); |
| 624 | } | 624 | } |
| @@ -632,9 +632,9 @@ static inline GC | |||
| 632 | x_create_gc (struct frame *f, unsigned long mask, XGCValues *xgcv) | 632 | x_create_gc (struct frame *f, unsigned long mask, XGCValues *xgcv) |
| 633 | { | 633 | { |
| 634 | GC gc; | 634 | GC gc; |
| 635 | BLOCK_INPUT; | 635 | block_input (); |
| 636 | gc = XCreateGC (NULL, FRAME_W32_WINDOW (f), mask, xgcv); | 636 | gc = XCreateGC (NULL, FRAME_W32_WINDOW (f), mask, xgcv); |
| 637 | UNBLOCK_INPUT; | 637 | unblock_input (); |
| 638 | IF_DEBUG (++ngcs); | 638 | IF_DEBUG (++ngcs); |
| 639 | return gc; | 639 | return gc; |
| 640 | } | 640 | } |
| @@ -907,7 +907,7 @@ load_pixmap (FRAME_PTR f, Lisp_Object name, unsigned int *w_ptr, | |||
| 907 | 907 | ||
| 908 | CHECK_TYPE (!NILP (Fbitmap_spec_p (name)), Qbitmap_spec_p, name); | 908 | CHECK_TYPE (!NILP (Fbitmap_spec_p (name)), Qbitmap_spec_p, name); |
| 909 | 909 | ||
| 910 | BLOCK_INPUT; | 910 | block_input (); |
| 911 | if (CONSP (name)) | 911 | if (CONSP (name)) |
| 912 | { | 912 | { |
| 913 | /* Decode a bitmap spec into a bitmap. */ | 913 | /* Decode a bitmap spec into a bitmap. */ |
| @@ -927,7 +927,7 @@ load_pixmap (FRAME_PTR f, Lisp_Object name, unsigned int *w_ptr, | |||
| 927 | /* It must be a string -- a file name. */ | 927 | /* It must be a string -- a file name. */ |
| 928 | bitmap_id = x_create_bitmap_from_file (f, name); | 928 | bitmap_id = x_create_bitmap_from_file (f, name); |
| 929 | } | 929 | } |
| 930 | UNBLOCK_INPUT; | 930 | unblock_input (); |
| 931 | 931 | ||
| 932 | if (bitmap_id < 0) | 932 | if (bitmap_id < 0) |
| 933 | { | 933 | { |
| @@ -1364,9 +1364,9 @@ unload_color (struct frame *f, long unsigned int pixel) | |||
| 1364 | #ifdef HAVE_X_WINDOWS | 1364 | #ifdef HAVE_X_WINDOWS |
| 1365 | if (pixel != -1) | 1365 | if (pixel != -1) |
| 1366 | { | 1366 | { |
| 1367 | BLOCK_INPUT; | 1367 | block_input (); |
| 1368 | x_free_colors (f, &pixel, 1); | 1368 | x_free_colors (f, &pixel, 1); |
| 1369 | UNBLOCK_INPUT; | 1369 | unblock_input (); |
| 1370 | } | 1370 | } |
| 1371 | #endif | 1371 | #endif |
| 1372 | } | 1372 | } |
| @@ -1382,7 +1382,7 @@ free_face_colors (struct frame *f, struct face *face) | |||
| 1382 | if (face->colors_copied_bitwise_p) | 1382 | if (face->colors_copied_bitwise_p) |
| 1383 | return; | 1383 | return; |
| 1384 | 1384 | ||
| 1385 | BLOCK_INPUT; | 1385 | block_input (); |
| 1386 | 1386 | ||
| 1387 | if (!face->foreground_defaulted_p) | 1387 | if (!face->foreground_defaulted_p) |
| 1388 | { | 1388 | { |
| @@ -1424,7 +1424,7 @@ free_face_colors (struct frame *f, struct face *face) | |||
| 1424 | IF_DEBUG (--ncolors_allocated); | 1424 | IF_DEBUG (--ncolors_allocated); |
| 1425 | } | 1425 | } |
| 1426 | 1426 | ||
| 1427 | UNBLOCK_INPUT; | 1427 | unblock_input (); |
| 1428 | #endif /* HAVE_X_WINDOWS */ | 1428 | #endif /* HAVE_X_WINDOWS */ |
| 1429 | } | 1429 | } |
| 1430 | 1430 | ||
| @@ -3438,10 +3438,10 @@ DEFUN ("internal-face-x-get-resource", Finternal_face_x_get_resource, | |||
| 3438 | CHECK_STRING (resource); | 3438 | CHECK_STRING (resource); |
| 3439 | CHECK_STRING (class); | 3439 | CHECK_STRING (class); |
| 3440 | CHECK_LIVE_FRAME (frame); | 3440 | CHECK_LIVE_FRAME (frame); |
| 3441 | BLOCK_INPUT; | 3441 | block_input (); |
| 3442 | value = display_x_get_resource (FRAME_X_DISPLAY_INFO (XFRAME (frame)), | 3442 | value = display_x_get_resource (FRAME_X_DISPLAY_INFO (XFRAME (frame)), |
| 3443 | resource, class, Qnil, Qnil); | 3443 | resource, class, Qnil, Qnil); |
| 3444 | UNBLOCK_INPUT; | 3444 | unblock_input (); |
| 3445 | return value; | 3445 | return value; |
| 3446 | } | 3446 | } |
| 3447 | 3447 | ||
| @@ -4114,12 +4114,12 @@ free_realized_face (struct frame *f, struct face *face) | |||
| 4114 | free_face_fontset (f, face); | 4114 | free_face_fontset (f, face); |
| 4115 | if (face->gc) | 4115 | if (face->gc) |
| 4116 | { | 4116 | { |
| 4117 | BLOCK_INPUT; | 4117 | block_input (); |
| 4118 | if (face->font) | 4118 | if (face->font) |
| 4119 | font_done_for_face (f, face); | 4119 | font_done_for_face (f, face); |
| 4120 | x_free_gc (f, face->gc); | 4120 | x_free_gc (f, face->gc); |
| 4121 | face->gc = 0; | 4121 | face->gc = 0; |
| 4122 | UNBLOCK_INPUT; | 4122 | unblock_input (); |
| 4123 | } | 4123 | } |
| 4124 | 4124 | ||
| 4125 | free_face_colors (f, face); | 4125 | free_face_colors (f, face); |
| @@ -4153,7 +4153,7 @@ prepare_face_for_display (struct frame *f, struct face *face) | |||
| 4153 | xgcv.graphics_exposures = False; | 4153 | xgcv.graphics_exposures = False; |
| 4154 | #endif | 4154 | #endif |
| 4155 | 4155 | ||
| 4156 | BLOCK_INPUT; | 4156 | block_input (); |
| 4157 | #ifdef HAVE_X_WINDOWS | 4157 | #ifdef HAVE_X_WINDOWS |
| 4158 | if (face->stipple) | 4158 | if (face->stipple) |
| 4159 | { | 4159 | { |
| @@ -4165,7 +4165,7 @@ prepare_face_for_display (struct frame *f, struct face *face) | |||
| 4165 | face->gc = x_create_gc (f, mask, &xgcv); | 4165 | face->gc = x_create_gc (f, mask, &xgcv); |
| 4166 | if (face->font) | 4166 | if (face->font) |
| 4167 | font_prepare_for_face (f, face); | 4167 | font_prepare_for_face (f, face); |
| 4168 | UNBLOCK_INPUT; | 4168 | unblock_input (); |
| 4169 | } | 4169 | } |
| 4170 | #endif /* HAVE_WINDOW_SYSTEM */ | 4170 | #endif /* HAVE_WINDOW_SYSTEM */ |
| 4171 | } | 4171 | } |
| @@ -4263,12 +4263,12 @@ clear_face_gcs (struct face_cache *c) | |||
| 4263 | struct face *face = c->faces_by_id[i]; | 4263 | struct face *face = c->faces_by_id[i]; |
| 4264 | if (face && face->gc) | 4264 | if (face && face->gc) |
| 4265 | { | 4265 | { |
| 4266 | BLOCK_INPUT; | 4266 | block_input (); |
| 4267 | if (face->font) | 4267 | if (face->font) |
| 4268 | font_done_for_face (c->f, face); | 4268 | font_done_for_face (c->f, face); |
| 4269 | x_free_gc (c->f, face->gc); | 4269 | x_free_gc (c->f, face->gc); |
| 4270 | face->gc = 0; | 4270 | face->gc = 0; |
| 4271 | UNBLOCK_INPUT; | 4271 | unblock_input (); |
| 4272 | } | 4272 | } |
| 4273 | } | 4273 | } |
| 4274 | #endif /* HAVE_WINDOW_SYSTEM */ | 4274 | #endif /* HAVE_WINDOW_SYSTEM */ |
| @@ -4292,7 +4292,7 @@ free_realized_faces (struct face_cache *c) | |||
| 4292 | /* We must block input here because we can't process X events | 4292 | /* We must block input here because we can't process X events |
| 4293 | safely while only some faces are freed, or when the frame's | 4293 | safely while only some faces are freed, or when the frame's |
| 4294 | current matrix still references freed faces. */ | 4294 | current matrix still references freed faces. */ |
| 4295 | BLOCK_INPUT; | 4295 | block_input (); |
| 4296 | 4296 | ||
| 4297 | for (i = 0; i < c->used; ++i) | 4297 | for (i = 0; i < c->used; ++i) |
| 4298 | { | 4298 | { |
| @@ -4314,7 +4314,7 @@ free_realized_faces (struct face_cache *c) | |||
| 4314 | ++windows_or_buffers_changed; | 4314 | ++windows_or_buffers_changed; |
| 4315 | } | 4315 | } |
| 4316 | 4316 | ||
| 4317 | UNBLOCK_INPUT; | 4317 | unblock_input (); |
| 4318 | } | 4318 | } |
| 4319 | } | 4319 | } |
| 4320 | 4320 | ||
| @@ -5275,7 +5275,7 @@ realize_basic_faces (struct frame *f) | |||
| 5275 | 5275 | ||
| 5276 | /* Block input here so that we won't be surprised by an X expose | 5276 | /* Block input here so that we won't be surprised by an X expose |
| 5277 | event, for instance, without having the faces set up. */ | 5277 | event, for instance, without having the faces set up. */ |
| 5278 | BLOCK_INPUT; | 5278 | block_input (); |
| 5279 | specbind (Qscalable_fonts_allowed, Qt); | 5279 | specbind (Qscalable_fonts_allowed, Qt); |
| 5280 | 5280 | ||
| 5281 | if (realize_default_face (f)) | 5281 | if (realize_default_face (f)) |
| @@ -5306,7 +5306,7 @@ realize_basic_faces (struct frame *f) | |||
| 5306 | } | 5306 | } |
| 5307 | 5307 | ||
| 5308 | unbind_to (count, Qnil); | 5308 | unbind_to (count, Qnil); |
| 5309 | UNBLOCK_INPUT; | 5309 | unblock_input (); |
| 5310 | return success_p; | 5310 | return success_p; |
| 5311 | } | 5311 | } |
| 5312 | 5312 | ||
| @@ -6352,7 +6352,7 @@ where R,G,B are numbers between 0 and 255 and name is an arbitrary string. */) | |||
| 6352 | int red, green, blue; | 6352 | int red, green, blue; |
| 6353 | int num; | 6353 | int num; |
| 6354 | 6354 | ||
| 6355 | BLOCK_INPUT; | 6355 | block_input (); |
| 6356 | 6356 | ||
| 6357 | while (fgets (buf, sizeof (buf), fp) != NULL) { | 6357 | while (fgets (buf, sizeof (buf), fp) != NULL) { |
| 6358 | if (sscanf (buf, "%u %u %u %n", &red, &green, &blue, &num) == 3) | 6358 | if (sscanf (buf, "%u %u %u %n", &red, &green, &blue, &num) == 3) |
| @@ -6372,7 +6372,7 @@ where R,G,B are numbers between 0 and 255 and name is an arbitrary string. */) | |||
| 6372 | } | 6372 | } |
| 6373 | fclose (fp); | 6373 | fclose (fp); |
| 6374 | 6374 | ||
| 6375 | UNBLOCK_INPUT; | 6375 | unblock_input (); |
| 6376 | } | 6376 | } |
| 6377 | 6377 | ||
| 6378 | return cmap; | 6378 | return cmap; |
diff --git a/src/xfns.c b/src/xfns.c index 8304a3df04f..192ccb71a09 100644 --- a/src/xfns.c +++ b/src/xfns.c | |||
| @@ -425,7 +425,7 @@ x_real_positions (FRAME_PTR f, int *xptr, int *yptr) | |||
| 425 | unsigned char *tmp_data = NULL; | 425 | unsigned char *tmp_data = NULL; |
| 426 | Atom target_type = XA_CARDINAL; | 426 | Atom target_type = XA_CARDINAL; |
| 427 | 427 | ||
| 428 | BLOCK_INPUT; | 428 | block_input (); |
| 429 | 429 | ||
| 430 | x_catch_errors (dpy); | 430 | x_catch_errors (dpy); |
| 431 | 431 | ||
| @@ -543,7 +543,7 @@ x_real_positions (FRAME_PTR f, int *xptr, int *yptr) | |||
| 543 | 543 | ||
| 544 | x_uncatch_errors (); | 544 | x_uncatch_errors (); |
| 545 | 545 | ||
| 546 | UNBLOCK_INPUT; | 546 | unblock_input (); |
| 547 | 547 | ||
| 548 | if (had_errors) return; | 548 | if (had_errors) return; |
| 549 | 549 | ||
| @@ -587,7 +587,7 @@ x_defined_color (struct frame *f, const char *color_name, | |||
| 587 | Display *dpy = FRAME_X_DISPLAY (f); | 587 | Display *dpy = FRAME_X_DISPLAY (f); |
| 588 | Colormap cmap = FRAME_X_COLORMAP (f); | 588 | Colormap cmap = FRAME_X_COLORMAP (f); |
| 589 | 589 | ||
| 590 | BLOCK_INPUT; | 590 | block_input (); |
| 591 | #ifdef USE_GTK | 591 | #ifdef USE_GTK |
| 592 | success_p = xg_check_special_colors (f, color_name, color); | 592 | success_p = xg_check_special_colors (f, color_name, color); |
| 593 | #endif | 593 | #endif |
| @@ -595,7 +595,7 @@ x_defined_color (struct frame *f, const char *color_name, | |||
| 595 | success_p = XParseColor (dpy, cmap, color_name, color); | 595 | success_p = XParseColor (dpy, cmap, color_name, color); |
| 596 | if (success_p && alloc_p) | 596 | if (success_p && alloc_p) |
| 597 | success_p = x_alloc_nearest_color (f, cmap, color); | 597 | success_p = x_alloc_nearest_color (f, cmap, color); |
| 598 | UNBLOCK_INPUT; | 598 | unblock_input (); |
| 599 | 599 | ||
| 600 | return success_p; | 600 | return success_p; |
| 601 | } | 601 | } |
| @@ -679,7 +679,7 @@ xg_set_icon (FRAME_PTR f, Lisp_Object file) | |||
| 679 | GdkPixbuf *pixbuf; | 679 | GdkPixbuf *pixbuf; |
| 680 | GError *err = NULL; | 680 | GError *err = NULL; |
| 681 | char *filename = SSDATA (found); | 681 | char *filename = SSDATA (found); |
| 682 | BLOCK_INPUT; | 682 | block_input (); |
| 683 | 683 | ||
| 684 | pixbuf = gdk_pixbuf_new_from_file (filename, &err); | 684 | pixbuf = gdk_pixbuf_new_from_file (filename, &err); |
| 685 | 685 | ||
| @@ -694,7 +694,7 @@ xg_set_icon (FRAME_PTR f, Lisp_Object file) | |||
| 694 | else | 694 | else |
| 695 | g_error_free (err); | 695 | g_error_free (err); |
| 696 | 696 | ||
| 697 | UNBLOCK_INPUT; | 697 | unblock_input (); |
| 698 | } | 698 | } |
| 699 | 699 | ||
| 700 | return result; | 700 | return result; |
| @@ -737,7 +737,7 @@ x_set_foreground_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval) | |||
| 737 | { | 737 | { |
| 738 | Display *dpy = FRAME_X_DISPLAY (f); | 738 | Display *dpy = FRAME_X_DISPLAY (f); |
| 739 | 739 | ||
| 740 | BLOCK_INPUT; | 740 | block_input (); |
| 741 | XSetForeground (dpy, x->normal_gc, fg); | 741 | XSetForeground (dpy, x->normal_gc, fg); |
| 742 | XSetBackground (dpy, x->reverse_gc, fg); | 742 | XSetBackground (dpy, x->reverse_gc, fg); |
| 743 | 743 | ||
| @@ -748,7 +748,7 @@ x_set_foreground_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval) | |||
| 748 | XSetBackground (dpy, x->cursor_gc, x->cursor_pixel); | 748 | XSetBackground (dpy, x->cursor_gc, x->cursor_pixel); |
| 749 | } | 749 | } |
| 750 | 750 | ||
| 751 | UNBLOCK_INPUT; | 751 | unblock_input (); |
| 752 | 752 | ||
| 753 | update_face_from_frame_parameter (f, Qforeground_color, arg); | 753 | update_face_from_frame_parameter (f, Qforeground_color, arg); |
| 754 | 754 | ||
| @@ -773,7 +773,7 @@ x_set_background_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval) | |||
| 773 | { | 773 | { |
| 774 | Display *dpy = FRAME_X_DISPLAY (f); | 774 | Display *dpy = FRAME_X_DISPLAY (f); |
| 775 | 775 | ||
| 776 | BLOCK_INPUT; | 776 | block_input (); |
| 777 | XSetBackground (dpy, x->normal_gc, bg); | 777 | XSetBackground (dpy, x->normal_gc, bg); |
| 778 | XSetForeground (dpy, x->reverse_gc, bg); | 778 | XSetForeground (dpy, x->reverse_gc, bg); |
| 779 | XSetWindowBackground (dpy, FRAME_X_WINDOW (f), bg); | 779 | XSetWindowBackground (dpy, FRAME_X_WINDOW (f), bg); |
| @@ -797,7 +797,7 @@ x_set_background_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval) | |||
| 797 | } | 797 | } |
| 798 | #endif /* USE_TOOLKIT_SCROLL_BARS */ | 798 | #endif /* USE_TOOLKIT_SCROLL_BARS */ |
| 799 | 799 | ||
| 800 | UNBLOCK_INPUT; | 800 | unblock_input (); |
| 801 | update_face_from_frame_parameter (f, Qbackground_color, arg); | 801 | update_face_from_frame_parameter (f, Qbackground_color, arg); |
| 802 | 802 | ||
| 803 | if (FRAME_VISIBLE_P (f)) | 803 | if (FRAME_VISIBLE_P (f)) |
| @@ -854,7 +854,7 @@ x_set_mouse_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval) | |||
| 854 | unload_color (f, x->mouse_pixel); | 854 | unload_color (f, x->mouse_pixel); |
| 855 | x->mouse_pixel = pixel; | 855 | x->mouse_pixel = pixel; |
| 856 | 856 | ||
| 857 | BLOCK_INPUT; | 857 | block_input (); |
| 858 | 858 | ||
| 859 | /* It's not okay to crash if the user selects a screwy cursor. */ | 859 | /* It's not okay to crash if the user selects a screwy cursor. */ |
| 860 | x_catch_errors (dpy); | 860 | x_catch_errors (dpy); |
| @@ -974,7 +974,7 @@ x_set_mouse_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval) | |||
| 974 | x->horizontal_drag_cursor = horizontal_drag_cursor; | 974 | x->horizontal_drag_cursor = horizontal_drag_cursor; |
| 975 | 975 | ||
| 976 | XFlush (dpy); | 976 | XFlush (dpy); |
| 977 | UNBLOCK_INPUT; | 977 | unblock_input (); |
| 978 | 978 | ||
| 979 | update_face_from_frame_parameter (f, Qmouse_color, arg); | 979 | update_face_from_frame_parameter (f, Qmouse_color, arg); |
| 980 | } | 980 | } |
| @@ -1031,10 +1031,10 @@ x_set_cursor_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval) | |||
| 1031 | 1031 | ||
| 1032 | if (FRAME_X_WINDOW (f) != 0) | 1032 | if (FRAME_X_WINDOW (f) != 0) |
| 1033 | { | 1033 | { |
| 1034 | BLOCK_INPUT; | 1034 | block_input (); |
| 1035 | XSetBackground (FRAME_X_DISPLAY (f), x->cursor_gc, x->cursor_pixel); | 1035 | XSetBackground (FRAME_X_DISPLAY (f), x->cursor_gc, x->cursor_pixel); |
| 1036 | XSetForeground (FRAME_X_DISPLAY (f), x->cursor_gc, fore_pixel); | 1036 | XSetForeground (FRAME_X_DISPLAY (f), x->cursor_gc, fore_pixel); |
| 1037 | UNBLOCK_INPUT; | 1037 | unblock_input (); |
| 1038 | 1038 | ||
| 1039 | if (FRAME_VISIBLE_P (f)) | 1039 | if (FRAME_VISIBLE_P (f)) |
| 1040 | { | 1040 | { |
| @@ -1058,9 +1058,9 @@ x_set_border_pixel (struct frame *f, int pix) | |||
| 1058 | 1058 | ||
| 1059 | if (FRAME_X_WINDOW (f) != 0 && f->border_width > 0) | 1059 | if (FRAME_X_WINDOW (f) != 0 && f->border_width > 0) |
| 1060 | { | 1060 | { |
| 1061 | BLOCK_INPUT; | 1061 | block_input (); |
| 1062 | XSetWindowBorder (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), pix); | 1062 | XSetWindowBorder (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), pix); |
| 1063 | UNBLOCK_INPUT; | 1063 | unblock_input (); |
| 1064 | 1064 | ||
| 1065 | if (FRAME_VISIBLE_P (f)) | 1065 | if (FRAME_VISIBLE_P (f)) |
| 1066 | redraw_frame (f); | 1066 | redraw_frame (f); |
| @@ -1112,7 +1112,7 @@ x_set_icon_type (struct frame *f, Lisp_Object arg, Lisp_Object oldval) | |||
| 1112 | else if (!STRINGP (oldval) && EQ (oldval, Qnil) == EQ (arg, Qnil)) | 1112 | else if (!STRINGP (oldval) && EQ (oldval, Qnil) == EQ (arg, Qnil)) |
| 1113 | return; | 1113 | return; |
| 1114 | 1114 | ||
| 1115 | BLOCK_INPUT; | 1115 | block_input (); |
| 1116 | if (NILP (arg)) | 1116 | if (NILP (arg)) |
| 1117 | result = x_text_icon (f, | 1117 | result = x_text_icon (f, |
| 1118 | SSDATA ((!NILP (f->icon_name) | 1118 | SSDATA ((!NILP (f->icon_name) |
| @@ -1123,12 +1123,12 @@ x_set_icon_type (struct frame *f, Lisp_Object arg, Lisp_Object oldval) | |||
| 1123 | 1123 | ||
| 1124 | if (result) | 1124 | if (result) |
| 1125 | { | 1125 | { |
| 1126 | UNBLOCK_INPUT; | 1126 | unblock_input (); |
| 1127 | error ("No icon window available"); | 1127 | error ("No icon window available"); |
| 1128 | } | 1128 | } |
| 1129 | 1129 | ||
| 1130 | XFlush (FRAME_X_DISPLAY (f)); | 1130 | XFlush (FRAME_X_DISPLAY (f)); |
| 1131 | UNBLOCK_INPUT; | 1131 | unblock_input (); |
| 1132 | } | 1132 | } |
| 1133 | 1133 | ||
| 1134 | static void | 1134 | static void |
| @@ -1149,7 +1149,7 @@ x_set_icon_name (struct frame *f, Lisp_Object arg, Lisp_Object oldval) | |||
| 1149 | if (f->output_data.x->icon_bitmap != 0) | 1149 | if (f->output_data.x->icon_bitmap != 0) |
| 1150 | return; | 1150 | return; |
| 1151 | 1151 | ||
| 1152 | BLOCK_INPUT; | 1152 | block_input (); |
| 1153 | 1153 | ||
| 1154 | result = x_text_icon (f, | 1154 | result = x_text_icon (f, |
| 1155 | SSDATA ((!NILP (f->icon_name) | 1155 | SSDATA ((!NILP (f->icon_name) |
| @@ -1160,12 +1160,12 @@ x_set_icon_name (struct frame *f, Lisp_Object arg, Lisp_Object oldval) | |||
| 1160 | 1160 | ||
| 1161 | if (result) | 1161 | if (result) |
| 1162 | { | 1162 | { |
| 1163 | UNBLOCK_INPUT; | 1163 | unblock_input (); |
| 1164 | error ("No icon window available"); | 1164 | error ("No icon window available"); |
| 1165 | } | 1165 | } |
| 1166 | 1166 | ||
| 1167 | XFlush (FRAME_X_DISPLAY (f)); | 1167 | XFlush (FRAME_X_DISPLAY (f)); |
| 1168 | UNBLOCK_INPUT; | 1168 | unblock_input (); |
| 1169 | } | 1169 | } |
| 1170 | 1170 | ||
| 1171 | 1171 | ||
| @@ -1228,10 +1228,10 @@ x_set_menu_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval) | |||
| 1228 | { | 1228 | { |
| 1229 | y = FRAME_TOP_MARGIN_HEIGHT (f); | 1229 | y = FRAME_TOP_MARGIN_HEIGHT (f); |
| 1230 | 1230 | ||
| 1231 | BLOCK_INPUT; | 1231 | block_input (); |
| 1232 | x_clear_area (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), | 1232 | x_clear_area (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), |
| 1233 | 0, y, width, height, False); | 1233 | 0, y, width, height, False); |
| 1234 | UNBLOCK_INPUT; | 1234 | unblock_input (); |
| 1235 | } | 1235 | } |
| 1236 | 1236 | ||
| 1237 | if (nlines > 1 && nlines > olines) | 1237 | if (nlines > 1 && nlines > olines) |
| @@ -1239,10 +1239,10 @@ x_set_menu_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval) | |||
| 1239 | y = (olines == 0 ? 1 : olines) * FRAME_LINE_HEIGHT (f); | 1239 | y = (olines == 0 ? 1 : olines) * FRAME_LINE_HEIGHT (f); |
| 1240 | height = nlines * FRAME_LINE_HEIGHT (f) - y; | 1240 | height = nlines * FRAME_LINE_HEIGHT (f) - y; |
| 1241 | 1241 | ||
| 1242 | BLOCK_INPUT; | 1242 | block_input (); |
| 1243 | x_clear_area (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), | 1243 | x_clear_area (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), |
| 1244 | 0, y, width, height, False); | 1244 | 0, y, width, height, False); |
| 1245 | UNBLOCK_INPUT; | 1245 | unblock_input (); |
| 1246 | } | 1246 | } |
| 1247 | 1247 | ||
| 1248 | if (nlines == 0 && WINDOWP (f->menu_bar_window)) | 1248 | if (nlines == 0 && WINDOWP (f->menu_bar_window)) |
| @@ -1338,10 +1338,10 @@ x_set_tool_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval) | |||
| 1338 | /* height can be zero here. */ | 1338 | /* height can be zero here. */ |
| 1339 | if (height > 0 && width > 0) | 1339 | if (height > 0 && width > 0) |
| 1340 | { | 1340 | { |
| 1341 | BLOCK_INPUT; | 1341 | block_input (); |
| 1342 | x_clear_area (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), | 1342 | x_clear_area (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), |
| 1343 | 0, y, width, height, False); | 1343 | 0, y, width, height, False); |
| 1344 | UNBLOCK_INPUT; | 1344 | unblock_input (); |
| 1345 | } | 1345 | } |
| 1346 | 1346 | ||
| 1347 | if (WINDOWP (f->tool_bar_window)) | 1347 | if (WINDOWP (f->tool_bar_window)) |
| @@ -1494,7 +1494,7 @@ x_set_name_internal (FRAME_PTR f, Lisp_Object name) | |||
| 1494 | { | 1494 | { |
| 1495 | if (FRAME_X_WINDOW (f)) | 1495 | if (FRAME_X_WINDOW (f)) |
| 1496 | { | 1496 | { |
| 1497 | BLOCK_INPUT; | 1497 | block_input (); |
| 1498 | { | 1498 | { |
| 1499 | XTextProperty text, icon; | 1499 | XTextProperty text, icon; |
| 1500 | ptrdiff_t bytes; | 1500 | ptrdiff_t bytes; |
| @@ -1586,7 +1586,7 @@ x_set_name_internal (FRAME_PTR f, Lisp_Object name) | |||
| 1586 | if (do_free_text_value) | 1586 | if (do_free_text_value) |
| 1587 | xfree (text.value); | 1587 | xfree (text.value); |
| 1588 | } | 1588 | } |
| 1589 | UNBLOCK_INPUT; | 1589 | unblock_input (); |
| 1590 | } | 1590 | } |
| 1591 | } | 1591 | } |
| 1592 | 1592 | ||
| @@ -1779,7 +1779,7 @@ hack_wm_protocols (FRAME_PTR f, Widget widget) | |||
| 1779 | int need_focus = 1; | 1779 | int need_focus = 1; |
| 1780 | int need_save = 1; | 1780 | int need_save = 1; |
| 1781 | 1781 | ||
| 1782 | BLOCK_INPUT; | 1782 | block_input (); |
| 1783 | { | 1783 | { |
| 1784 | Atom type; | 1784 | Atom type; |
| 1785 | unsigned char *catoms; | 1785 | unsigned char *catoms; |
| @@ -1827,7 +1827,7 @@ hack_wm_protocols (FRAME_PTR f, Widget widget) | |||
| 1827 | XA_ATOM, 32, PropModeAppend, | 1827 | XA_ATOM, 32, PropModeAppend, |
| 1828 | (unsigned char *) props, count); | 1828 | (unsigned char *) props, count); |
| 1829 | } | 1829 | } |
| 1830 | UNBLOCK_INPUT; | 1830 | unblock_input (); |
| 1831 | } | 1831 | } |
| 1832 | #endif | 1832 | #endif |
| 1833 | 1833 | ||
| @@ -2350,7 +2350,7 @@ x_window (struct frame *f, long window_prompting, int minibuffer_only) | |||
| 2350 | Arg al [25]; | 2350 | Arg al [25]; |
| 2351 | int ac; | 2351 | int ac; |
| 2352 | 2352 | ||
| 2353 | BLOCK_INPUT; | 2353 | block_input (); |
| 2354 | 2354 | ||
| 2355 | /* Use the resource name as the top-level widget name | 2355 | /* Use the resource name as the top-level widget name |
| 2356 | for looking up resources. Make a non-Lisp copy | 2356 | for looking up resources. Make a non-Lisp copy |
| @@ -2572,7 +2572,7 @@ x_window (struct frame *f, long window_prompting, int minibuffer_only) | |||
| 2572 | f->output_data.x->current_cursor | 2572 | f->output_data.x->current_cursor |
| 2573 | = f->output_data.x->text_cursor); | 2573 | = f->output_data.x->text_cursor); |
| 2574 | 2574 | ||
| 2575 | UNBLOCK_INPUT; | 2575 | unblock_input (); |
| 2576 | 2576 | ||
| 2577 | /* This is a no-op, except under Motif. Make sure main areas are | 2577 | /* This is a no-op, except under Motif. Make sure main areas are |
| 2578 | set to something reasonable, in case we get an error later. */ | 2578 | set to something reasonable, in case we get an error later. */ |
| @@ -2591,7 +2591,7 @@ x_window (FRAME_PTR f) | |||
| 2591 | FRAME_XIC (f) = NULL; | 2591 | FRAME_XIC (f) = NULL; |
| 2592 | if (use_xim) | 2592 | if (use_xim) |
| 2593 | { | 2593 | { |
| 2594 | BLOCK_INPUT; | 2594 | block_input (); |
| 2595 | create_frame_xic (f); | 2595 | create_frame_xic (f); |
| 2596 | if (FRAME_XIC (f)) | 2596 | if (FRAME_XIC (f)) |
| 2597 | { | 2597 | { |
| @@ -2613,7 +2613,7 @@ x_window (FRAME_PTR f) | |||
| 2613 | attribute_mask, &attributes); | 2613 | attribute_mask, &attributes); |
| 2614 | } | 2614 | } |
| 2615 | } | 2615 | } |
| 2616 | UNBLOCK_INPUT; | 2616 | unblock_input (); |
| 2617 | } | 2617 | } |
| 2618 | #endif | 2618 | #endif |
| 2619 | } | 2619 | } |
| @@ -2638,7 +2638,7 @@ x_window (struct frame *f) | |||
| 2638 | attribute_mask = (CWBackPixel | CWBorderPixel | CWBitGravity | CWEventMask | 2638 | attribute_mask = (CWBackPixel | CWBorderPixel | CWBitGravity | CWEventMask |
| 2639 | | CWColormap); | 2639 | | CWColormap); |
| 2640 | 2640 | ||
| 2641 | BLOCK_INPUT; | 2641 | block_input (); |
| 2642 | FRAME_X_WINDOW (f) | 2642 | FRAME_X_WINDOW (f) |
| 2643 | = XCreateWindow (FRAME_X_DISPLAY (f), | 2643 | = XCreateWindow (FRAME_X_DISPLAY (f), |
| 2644 | f->output_data.x->parent_desc, | 2644 | f->output_data.x->parent_desc, |
| @@ -2715,7 +2715,7 @@ x_window (struct frame *f) | |||
| 2715 | f->output_data.x->current_cursor | 2715 | f->output_data.x->current_cursor |
| 2716 | = f->output_data.x->text_cursor); | 2716 | = f->output_data.x->text_cursor); |
| 2717 | 2717 | ||
| 2718 | UNBLOCK_INPUT; | 2718 | unblock_input (); |
| 2719 | 2719 | ||
| 2720 | if (FRAME_X_WINDOW (f) == 0) | 2720 | if (FRAME_X_WINDOW (f) == 0) |
| 2721 | error ("Unable to create window"); | 2721 | error ("Unable to create window"); |
| @@ -2768,7 +2768,7 @@ x_icon (struct frame *f, Lisp_Object parms) | |||
| 2768 | else if (!EQ (icon_x, Qunbound) || !EQ (icon_y, Qunbound)) | 2768 | else if (!EQ (icon_x, Qunbound) || !EQ (icon_y, Qunbound)) |
| 2769 | error ("Both left and top icon corners of icon must be specified"); | 2769 | error ("Both left and top icon corners of icon must be specified"); |
| 2770 | 2770 | ||
| 2771 | BLOCK_INPUT; | 2771 | block_input (); |
| 2772 | 2772 | ||
| 2773 | if (! EQ (icon_x, Qunbound)) | 2773 | if (! EQ (icon_x, Qunbound)) |
| 2774 | x_wm_set_icon_position (f, XINT (icon_x), XINT (icon_y)); | 2774 | x_wm_set_icon_position (f, XINT (icon_x), XINT (icon_y)); |
| @@ -2787,7 +2787,7 @@ x_icon (struct frame *f, Lisp_Object parms) | |||
| 2787 | ? f->icon_name | 2787 | ? f->icon_name |
| 2788 | : f->name))); | 2788 | : f->name))); |
| 2789 | 2789 | ||
| 2790 | UNBLOCK_INPUT; | 2790 | unblock_input (); |
| 2791 | } | 2791 | } |
| 2792 | 2792 | ||
| 2793 | /* Make the GCs needed for this window, setting the | 2793 | /* Make the GCs needed for this window, setting the |
| @@ -2799,7 +2799,7 @@ x_make_gc (struct frame *f) | |||
| 2799 | { | 2799 | { |
| 2800 | XGCValues gc_values; | 2800 | XGCValues gc_values; |
| 2801 | 2801 | ||
| 2802 | BLOCK_INPUT; | 2802 | block_input (); |
| 2803 | 2803 | ||
| 2804 | /* Create the GCs of this frame. | 2804 | /* Create the GCs of this frame. |
| 2805 | Note that many default values are used. */ | 2805 | Note that many default values are used. */ |
| @@ -2847,7 +2847,7 @@ x_make_gc (struct frame *f) | |||
| 2847 | FRAME_BACKGROUND_PIXEL (f), | 2847 | FRAME_BACKGROUND_PIXEL (f), |
| 2848 | DefaultDepth (FRAME_X_DISPLAY (f), FRAME_X_SCREEN_NUMBER (f)))); | 2848 | DefaultDepth (FRAME_X_DISPLAY (f), FRAME_X_SCREEN_NUMBER (f)))); |
| 2849 | 2849 | ||
| 2850 | UNBLOCK_INPUT; | 2850 | unblock_input (); |
| 2851 | } | 2851 | } |
| 2852 | 2852 | ||
| 2853 | 2853 | ||
| @@ -2858,7 +2858,7 @@ x_free_gcs (struct frame *f) | |||
| 2858 | { | 2858 | { |
| 2859 | Display *dpy = FRAME_X_DISPLAY (f); | 2859 | Display *dpy = FRAME_X_DISPLAY (f); |
| 2860 | 2860 | ||
| 2861 | BLOCK_INPUT; | 2861 | block_input (); |
| 2862 | 2862 | ||
| 2863 | if (f->output_data.x->normal_gc) | 2863 | if (f->output_data.x->normal_gc) |
| 2864 | { | 2864 | { |
| @@ -2884,7 +2884,7 @@ x_free_gcs (struct frame *f) | |||
| 2884 | f->output_data.x->border_tile = 0; | 2884 | f->output_data.x->border_tile = 0; |
| 2885 | } | 2885 | } |
| 2886 | 2886 | ||
| 2887 | UNBLOCK_INPUT; | 2887 | unblock_input (); |
| 2888 | } | 2888 | } |
| 2889 | 2889 | ||
| 2890 | 2890 | ||
| @@ -3007,10 +3007,10 @@ If FRAME is nil, use the selected frame. */) | |||
| 3007 | if (NILP (frame)) | 3007 | if (NILP (frame)) |
| 3008 | frame = selected_frame; | 3008 | frame = selected_frame; |
| 3009 | f = XFRAME (frame); | 3009 | f = XFRAME (frame); |
| 3010 | BLOCK_INPUT; | 3010 | block_input (); |
| 3011 | if (FRAME_X_P (f)) | 3011 | if (FRAME_X_P (f)) |
| 3012 | x_wm_set_size_hint (f, 0, 0); | 3012 | x_wm_set_size_hint (f, 0, 0); |
| 3013 | UNBLOCK_INPUT; | 3013 | unblock_input (); |
| 3014 | return Qnil; | 3014 | return Qnil; |
| 3015 | } | 3015 | } |
| 3016 | 3016 | ||
| @@ -3405,9 +3405,9 @@ This function is an internal primitive--use `make-frame' instead. */) | |||
| 3405 | /* Tell the server what size and position, etc, we want, and how | 3405 | /* Tell the server what size and position, etc, we want, and how |
| 3406 | badly we want them. This should be done after we have the menu | 3406 | badly we want them. This should be done after we have the menu |
| 3407 | bar so that its size can be taken into account. */ | 3407 | bar so that its size can be taken into account. */ |
| 3408 | BLOCK_INPUT; | 3408 | block_input (); |
| 3409 | x_wm_set_size_hint (f, window_prompting, 0); | 3409 | x_wm_set_size_hint (f, window_prompting, 0); |
| 3410 | UNBLOCK_INPUT; | 3410 | unblock_input (); |
| 3411 | 3411 | ||
| 3412 | /* Make the window appear on the frame and enable display, unless | 3412 | /* Make the window appear on the frame and enable display, unless |
| 3413 | the caller says not to. However, with explicit parent, Emacs | 3413 | the caller says not to. However, with explicit parent, Emacs |
| @@ -3431,7 +3431,7 @@ This function is an internal primitive--use `make-frame' instead. */) | |||
| 3431 | } | 3431 | } |
| 3432 | } | 3432 | } |
| 3433 | 3433 | ||
| 3434 | BLOCK_INPUT; | 3434 | block_input (); |
| 3435 | 3435 | ||
| 3436 | /* Set machine name and pid for the purpose of window managers. */ | 3436 | /* Set machine name and pid for the purpose of window managers. */ |
| 3437 | set_machine_and_pid_properties (f); | 3437 | set_machine_and_pid_properties (f); |
| @@ -3447,7 +3447,7 @@ This function is an internal primitive--use `make-frame' instead. */) | |||
| 3447 | (unsigned char *) &dpyinfo->client_leader_window, 1); | 3447 | (unsigned char *) &dpyinfo->client_leader_window, 1); |
| 3448 | } | 3448 | } |
| 3449 | 3449 | ||
| 3450 | UNBLOCK_INPUT; | 3450 | unblock_input (); |
| 3451 | 3451 | ||
| 3452 | /* Initialize `default-minibuffer-frame' in case this is the first | 3452 | /* Initialize `default-minibuffer-frame' in case this is the first |
| 3453 | frame on this terminal. */ | 3453 | frame on this terminal. */ |
| @@ -3506,7 +3506,7 @@ FRAME nil means use the selected frame. */) | |||
| 3506 | struct frame *f = check_x_frame (frame); | 3506 | struct frame *f = check_x_frame (frame); |
| 3507 | Display *dpy = FRAME_X_DISPLAY (f); | 3507 | Display *dpy = FRAME_X_DISPLAY (f); |
| 3508 | 3508 | ||
| 3509 | BLOCK_INPUT; | 3509 | block_input (); |
| 3510 | x_catch_errors (dpy); | 3510 | x_catch_errors (dpy); |
| 3511 | 3511 | ||
| 3512 | if (FRAME_X_EMBEDDED_P (f)) | 3512 | if (FRAME_X_EMBEDDED_P (f)) |
| @@ -3524,7 +3524,7 @@ FRAME nil means use the selected frame. */) | |||
| 3524 | } | 3524 | } |
| 3525 | 3525 | ||
| 3526 | x_uncatch_errors (); | 3526 | x_uncatch_errors (); |
| 3527 | UNBLOCK_INPUT; | 3527 | unblock_input (); |
| 3528 | 3528 | ||
| 3529 | return Qnil; | 3529 | return Qnil; |
| 3530 | } | 3530 | } |
| @@ -4152,9 +4152,9 @@ If TERMINAL is omitted or nil, that stands for the selected frame's display. */ | |||
| 4152 | void | 4152 | void |
| 4153 | x_sync (FRAME_PTR f) | 4153 | x_sync (FRAME_PTR f) |
| 4154 | { | 4154 | { |
| 4155 | BLOCK_INPUT; | 4155 | block_input (); |
| 4156 | XSync (FRAME_X_DISPLAY (f), False); | 4156 | XSync (FRAME_X_DISPLAY (f), False); |
| 4157 | UNBLOCK_INPUT; | 4157 | unblock_input (); |
| 4158 | } | 4158 | } |
| 4159 | 4159 | ||
| 4160 | 4160 | ||
| @@ -4229,7 +4229,7 @@ FRAME. Default is to change on the edit X window. */) | |||
| 4229 | nelements = SBYTES (value); | 4229 | nelements = SBYTES (value); |
| 4230 | } | 4230 | } |
| 4231 | 4231 | ||
| 4232 | BLOCK_INPUT; | 4232 | block_input (); |
| 4233 | prop_atom = XInternAtom (FRAME_X_DISPLAY (f), SSDATA (prop), False); | 4233 | prop_atom = XInternAtom (FRAME_X_DISPLAY (f), SSDATA (prop), False); |
| 4234 | if (! NILP (type)) | 4234 | if (! NILP (type)) |
| 4235 | { | 4235 | { |
| @@ -4248,7 +4248,7 @@ FRAME. Default is to change on the edit X window. */) | |||
| 4248 | 4248 | ||
| 4249 | /* Make sure the property is set when we return. */ | 4249 | /* Make sure the property is set when we return. */ |
| 4250 | XFlush (FRAME_X_DISPLAY (f)); | 4250 | XFlush (FRAME_X_DISPLAY (f)); |
| 4251 | UNBLOCK_INPUT; | 4251 | unblock_input (); |
| 4252 | 4252 | ||
| 4253 | return value; | 4253 | return value; |
| 4254 | } | 4254 | } |
| @@ -4264,13 +4264,13 @@ FRAME nil or omitted means use the selected frame. Value is PROP. */) | |||
| 4264 | Atom prop_atom; | 4264 | Atom prop_atom; |
| 4265 | 4265 | ||
| 4266 | CHECK_STRING (prop); | 4266 | CHECK_STRING (prop); |
| 4267 | BLOCK_INPUT; | 4267 | block_input (); |
| 4268 | prop_atom = XInternAtom (FRAME_X_DISPLAY (f), SSDATA (prop), False); | 4268 | prop_atom = XInternAtom (FRAME_X_DISPLAY (f), SSDATA (prop), False); |
| 4269 | XDeleteProperty (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), prop_atom); | 4269 | XDeleteProperty (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), prop_atom); |
| 4270 | 4270 | ||
| 4271 | /* Make sure the property is removed when we return. */ | 4271 | /* Make sure the property is removed when we return. */ |
| 4272 | XFlush (FRAME_X_DISPLAY (f)); | 4272 | XFlush (FRAME_X_DISPLAY (f)); |
| 4273 | UNBLOCK_INPUT; | 4273 | unblock_input (); |
| 4274 | 4274 | ||
| 4275 | return prop; | 4275 | return prop; |
| 4276 | } | 4276 | } |
| @@ -4318,7 +4318,7 @@ no value of TYPE (always string in the MS Windows case). */) | |||
| 4318 | target_window = FRAME_X_DISPLAY_INFO (f)->root_window; | 4318 | target_window = FRAME_X_DISPLAY_INFO (f)->root_window; |
| 4319 | } | 4319 | } |
| 4320 | 4320 | ||
| 4321 | BLOCK_INPUT; | 4321 | block_input (); |
| 4322 | if (STRINGP (type)) | 4322 | if (STRINGP (type)) |
| 4323 | { | 4323 | { |
| 4324 | if (strcmp ("AnyPropertyType", SSDATA (type)) == 0) | 4324 | if (strcmp ("AnyPropertyType", SSDATA (type)) == 0) |
| @@ -4384,7 +4384,7 @@ no value of TYPE (always string in the MS Windows case). */) | |||
| 4384 | if (tmp_data) XFree (tmp_data); | 4384 | if (tmp_data) XFree (tmp_data); |
| 4385 | } | 4385 | } |
| 4386 | 4386 | ||
| 4387 | UNBLOCK_INPUT; | 4387 | unblock_input (); |
| 4388 | UNGCPRO; | 4388 | UNGCPRO; |
| 4389 | return prop_value; | 4389 | return prop_value; |
| 4390 | } | 4390 | } |
| @@ -4415,7 +4415,7 @@ show_hourglass (struct atimer *timer) | |||
| 4415 | { | 4415 | { |
| 4416 | Lisp_Object rest, frame; | 4416 | Lisp_Object rest, frame; |
| 4417 | 4417 | ||
| 4418 | BLOCK_INPUT; | 4418 | block_input (); |
| 4419 | 4419 | ||
| 4420 | FOR_EACH_FRAME (rest, frame) | 4420 | FOR_EACH_FRAME (rest, frame) |
| 4421 | { | 4421 | { |
| @@ -4459,7 +4459,7 @@ show_hourglass (struct atimer *timer) | |||
| 4459 | } | 4459 | } |
| 4460 | 4460 | ||
| 4461 | hourglass_shown_p = 1; | 4461 | hourglass_shown_p = 1; |
| 4462 | UNBLOCK_INPUT; | 4462 | unblock_input (); |
| 4463 | } | 4463 | } |
| 4464 | } | 4464 | } |
| 4465 | 4465 | ||
| @@ -4474,7 +4474,7 @@ hide_hourglass (void) | |||
| 4474 | { | 4474 | { |
| 4475 | Lisp_Object rest, frame; | 4475 | Lisp_Object rest, frame; |
| 4476 | 4476 | ||
| 4477 | BLOCK_INPUT; | 4477 | block_input (); |
| 4478 | FOR_EACH_FRAME (rest, frame) | 4478 | FOR_EACH_FRAME (rest, frame) |
| 4479 | { | 4479 | { |
| 4480 | struct frame *f = XFRAME (frame); | 4480 | struct frame *f = XFRAME (frame); |
| @@ -4493,7 +4493,7 @@ hide_hourglass (void) | |||
| 4493 | } | 4493 | } |
| 4494 | 4494 | ||
| 4495 | hourglass_shown_p = 0; | 4495 | hourglass_shown_p = 0; |
| 4496 | UNBLOCK_INPUT; | 4496 | unblock_input (); |
| 4497 | } | 4497 | } |
| 4498 | } | 4498 | } |
| 4499 | 4499 | ||
| @@ -4743,7 +4743,7 @@ x_create_tip_frame (struct x_display_info *dpyinfo, | |||
| 4743 | unsigned long mask; | 4743 | unsigned long mask; |
| 4744 | Atom type = FRAME_X_DISPLAY_INFO (f)->Xatom_net_window_type_tooltip; | 4744 | Atom type = FRAME_X_DISPLAY_INFO (f)->Xatom_net_window_type_tooltip; |
| 4745 | 4745 | ||
| 4746 | BLOCK_INPUT; | 4746 | block_input (); |
| 4747 | mask = CWBackPixel | CWOverrideRedirect | CWEventMask; | 4747 | mask = CWBackPixel | CWOverrideRedirect | CWEventMask; |
| 4748 | if (DoesSaveUnders (dpyinfo->screen)) | 4748 | if (DoesSaveUnders (dpyinfo->screen)) |
| 4749 | mask |= CWSaveUnder; | 4749 | mask |= CWSaveUnder; |
| @@ -4770,7 +4770,7 @@ x_create_tip_frame (struct x_display_info *dpyinfo, | |||
| 4770 | FRAME_X_DISPLAY_INFO (f)->Xatom_net_window_type, | 4770 | FRAME_X_DISPLAY_INFO (f)->Xatom_net_window_type, |
| 4771 | XA_ATOM, 32, PropModeReplace, | 4771 | XA_ATOM, 32, PropModeReplace, |
| 4772 | (unsigned char *)&type, 1); | 4772 | (unsigned char *)&type, 1); |
| 4773 | UNBLOCK_INPUT; | 4773 | unblock_input (); |
| 4774 | } | 4774 | } |
| 4775 | 4775 | ||
| 4776 | x_make_gc (f); | 4776 | x_make_gc (f); |
| @@ -4884,10 +4884,10 @@ compute_tip_xy (struct frame *f, Lisp_Object parms, Lisp_Object dx, Lisp_Object | |||
| 4884 | show it. */ | 4884 | show it. */ |
| 4885 | if (!INTEGERP (left) || !INTEGERP (top)) | 4885 | if (!INTEGERP (left) || !INTEGERP (top)) |
| 4886 | { | 4886 | { |
| 4887 | BLOCK_INPUT; | 4887 | block_input (); |
| 4888 | XQueryPointer (FRAME_X_DISPLAY (f), FRAME_X_DISPLAY_INFO (f)->root_window, | 4888 | XQueryPointer (FRAME_X_DISPLAY (f), FRAME_X_DISPLAY_INFO (f)->root_window, |
| 4889 | &root, &child, root_x, root_y, &win_x, &win_y, &pmask); | 4889 | &root, &child, root_x, root_y, &win_x, &win_y, &pmask); |
| 4890 | UNBLOCK_INPUT; | 4890 | unblock_input (); |
| 4891 | } | 4891 | } |
| 4892 | 4892 | ||
| 4893 | if (INTEGERP (top)) | 4893 | if (INTEGERP (top)) |
| @@ -4990,7 +4990,7 @@ Text larger than the specified size is clipped. */) | |||
| 4990 | /* Hide a previous tip, if any. */ | 4990 | /* Hide a previous tip, if any. */ |
| 4991 | Fx_hide_tip (); | 4991 | Fx_hide_tip (); |
| 4992 | 4992 | ||
| 4993 | BLOCK_INPUT; | 4993 | block_input (); |
| 4994 | if ((ok = xg_prepare_tooltip (f, string, &width, &height)) != 0) | 4994 | if ((ok = xg_prepare_tooltip (f, string, &width, &height)) != 0) |
| 4995 | { | 4995 | { |
| 4996 | compute_tip_xy (f, parms, dx, dy, width, height, &root_x, &root_y); | 4996 | compute_tip_xy (f, parms, dx, dy, width, height, &root_x, &root_y); |
| @@ -4998,7 +4998,7 @@ Text larger than the specified size is clipped. */) | |||
| 4998 | /* This is used in Fx_hide_tip. */ | 4998 | /* This is used in Fx_hide_tip. */ |
| 4999 | XSETFRAME (tip_frame, f); | 4999 | XSETFRAME (tip_frame, f); |
| 5000 | } | 5000 | } |
| 5001 | UNBLOCK_INPUT; | 5001 | unblock_input (); |
| 5002 | if (ok) goto start_timer; | 5002 | if (ok) goto start_timer; |
| 5003 | } | 5003 | } |
| 5004 | #endif /* USE_GTK */ | 5004 | #endif /* USE_GTK */ |
| @@ -5026,12 +5026,12 @@ Text larger than the specified size is clipped. */) | |||
| 5026 | call1 (Qcancel_timer, timer); | 5026 | call1 (Qcancel_timer, timer); |
| 5027 | } | 5027 | } |
| 5028 | 5028 | ||
| 5029 | BLOCK_INPUT; | 5029 | block_input (); |
| 5030 | compute_tip_xy (tip_f, parms, dx, dy, FRAME_PIXEL_WIDTH (tip_f), | 5030 | compute_tip_xy (tip_f, parms, dx, dy, FRAME_PIXEL_WIDTH (tip_f), |
| 5031 | FRAME_PIXEL_HEIGHT (tip_f), &root_x, &root_y); | 5031 | FRAME_PIXEL_HEIGHT (tip_f), &root_x, &root_y); |
| 5032 | XMoveWindow (FRAME_X_DISPLAY (tip_f), FRAME_X_WINDOW (tip_f), | 5032 | XMoveWindow (FRAME_X_DISPLAY (tip_f), FRAME_X_WINDOW (tip_f), |
| 5033 | root_x, root_y); | 5033 | root_x, root_y); |
| 5034 | UNBLOCK_INPUT; | 5034 | unblock_input (); |
| 5035 | goto start_timer; | 5035 | goto start_timer; |
| 5036 | } | 5036 | } |
| 5037 | } | 5037 | } |
| @@ -5185,11 +5185,11 @@ Text larger than the specified size is clipped. */) | |||
| 5185 | show it. */ | 5185 | show it. */ |
| 5186 | compute_tip_xy (f, parms, dx, dy, width, height, &root_x, &root_y); | 5186 | compute_tip_xy (f, parms, dx, dy, width, height, &root_x, &root_y); |
| 5187 | 5187 | ||
| 5188 | BLOCK_INPUT; | 5188 | block_input (); |
| 5189 | XMoveResizeWindow (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), | 5189 | XMoveResizeWindow (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), |
| 5190 | root_x, root_y, width, height); | 5190 | root_x, root_y, width, height); |
| 5191 | XMapRaised (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f)); | 5191 | XMapRaised (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f)); |
| 5192 | UNBLOCK_INPUT; | 5192 | unblock_input (); |
| 5193 | 5193 | ||
| 5194 | /* Draw into the window. */ | 5194 | /* Draw into the window. */ |
| 5195 | w->must_be_updated_p = 1; | 5195 | w->must_be_updated_p = 1; |
| @@ -5261,9 +5261,9 @@ Value is t if tooltip was open, nil otherwise. */) | |||
| 5261 | if (!DoesSaveUnders (FRAME_X_DISPLAY_INFO (f)->screen) | 5261 | if (!DoesSaveUnders (FRAME_X_DISPLAY_INFO (f)->screen) |
| 5262 | && w != NULL) | 5262 | && w != NULL) |
| 5263 | { | 5263 | { |
| 5264 | BLOCK_INPUT; | 5264 | block_input (); |
| 5265 | xlwmenu_redisplay (w); | 5265 | xlwmenu_redisplay (w); |
| 5266 | UNBLOCK_INPUT; | 5266 | unblock_input (); |
| 5267 | } | 5267 | } |
| 5268 | } | 5268 | } |
| 5269 | #endif /* USE_LUCID */ | 5269 | #endif /* USE_LUCID */ |
| @@ -5327,11 +5327,11 @@ clean_up_file_dialog (Lisp_Object arg) | |||
| 5327 | Widget dialog = (Widget) p->pointer; | 5327 | Widget dialog = (Widget) p->pointer; |
| 5328 | 5328 | ||
| 5329 | /* Clean up. */ | 5329 | /* Clean up. */ |
| 5330 | BLOCK_INPUT; | 5330 | block_input (); |
| 5331 | XtUnmanageChild (dialog); | 5331 | XtUnmanageChild (dialog); |
| 5332 | XtDestroyWidget (dialog); | 5332 | XtDestroyWidget (dialog); |
| 5333 | x_menu_set_in_use (0); | 5333 | x_menu_set_in_use (0); |
| 5334 | UNBLOCK_INPUT; | 5334 | unblock_input (); |
| 5335 | 5335 | ||
| 5336 | return Qnil; | 5336 | return Qnil; |
| 5337 | } | 5337 | } |
| @@ -5372,7 +5372,7 @@ Otherwise, if ONLY-DIR-P is non-nil, the user can only select directories. */) | |||
| 5372 | /* Prevent redisplay. */ | 5372 | /* Prevent redisplay. */ |
| 5373 | specbind (Qinhibit_redisplay, Qt); | 5373 | specbind (Qinhibit_redisplay, Qt); |
| 5374 | 5374 | ||
| 5375 | BLOCK_INPUT; | 5375 | block_input (); |
| 5376 | 5376 | ||
| 5377 | /* Create the dialog with PROMPT as title, using DIR as initial | 5377 | /* Create the dialog with PROMPT as title, using DIR as initial |
| 5378 | directory and using "*" as pattern. */ | 5378 | directory and using "*" as pattern. */ |
| @@ -5486,7 +5486,7 @@ Otherwise, if ONLY-DIR-P is non-nil, the user can only select directories. */) | |||
| 5486 | else | 5486 | else |
| 5487 | file = Qnil; | 5487 | file = Qnil; |
| 5488 | 5488 | ||
| 5489 | UNBLOCK_INPUT; | 5489 | unblock_input (); |
| 5490 | UNGCPRO; | 5490 | UNGCPRO; |
| 5491 | 5491 | ||
| 5492 | /* Make "Cancel" equivalent to C-g. */ | 5492 | /* Make "Cancel" equivalent to C-g. */ |
| @@ -5543,7 +5543,7 @@ Otherwise, if ONLY-DIR-P is non-nil, the user can only select directories. */) | |||
| 5543 | specbind (Qinhibit_redisplay, Qt); | 5543 | specbind (Qinhibit_redisplay, Qt); |
| 5544 | record_unwind_protect (clean_up_dialog, Qnil); | 5544 | record_unwind_protect (clean_up_dialog, Qnil); |
| 5545 | 5545 | ||
| 5546 | BLOCK_INPUT; | 5546 | block_input (); |
| 5547 | 5547 | ||
| 5548 | if (STRINGP (default_filename)) | 5548 | if (STRINGP (default_filename)) |
| 5549 | cdef_file = SSDATA (default_filename); | 5549 | cdef_file = SSDATA (default_filename); |
| @@ -5560,7 +5560,7 @@ Otherwise, if ONLY-DIR-P is non-nil, the user can only select directories. */) | |||
| 5560 | xfree (fn); | 5560 | xfree (fn); |
| 5561 | } | 5561 | } |
| 5562 | 5562 | ||
| 5563 | UNBLOCK_INPUT; | 5563 | unblock_input (); |
| 5564 | UNGCPRO; | 5564 | UNGCPRO; |
| 5565 | 5565 | ||
| 5566 | /* Make "Cancel" equivalent to C-g. */ | 5566 | /* Make "Cancel" equivalent to C-g. */ |
| @@ -5600,7 +5600,7 @@ nil, it defaults to the selected frame. */) | |||
| 5600 | specbind (Qinhibit_redisplay, Qt); | 5600 | specbind (Qinhibit_redisplay, Qt); |
| 5601 | record_unwind_protect (clean_up_dialog, Qnil); | 5601 | record_unwind_protect (clean_up_dialog, Qnil); |
| 5602 | 5602 | ||
| 5603 | BLOCK_INPUT; | 5603 | block_input (); |
| 5604 | 5604 | ||
| 5605 | GCPRO2 (font_param, font); | 5605 | GCPRO2 (font_param, font); |
| 5606 | 5606 | ||
| @@ -5618,7 +5618,7 @@ nil, it defaults to the selected frame. */) | |||
| 5618 | font = xg_get_font (f, default_name); | 5618 | font = xg_get_font (f, default_name); |
| 5619 | xfree (default_name); | 5619 | xfree (default_name); |
| 5620 | 5620 | ||
| 5621 | UNBLOCK_INPUT; | 5621 | unblock_input (); |
| 5622 | 5622 | ||
| 5623 | if (NILP (font)) | 5623 | if (NILP (font)) |
| 5624 | Fsignal (Qquit, Qnil); | 5624 | Fsignal (Qquit, Qnil); |
| @@ -5655,14 +5655,14 @@ present and mapped to the usual X keysyms. */) | |||
| 5655 | Lisp_Object have_keys; | 5655 | Lisp_Object have_keys; |
| 5656 | int major, minor, op, event, error_code; | 5656 | int major, minor, op, event, error_code; |
| 5657 | 5657 | ||
| 5658 | BLOCK_INPUT; | 5658 | block_input (); |
| 5659 | 5659 | ||
| 5660 | /* Check library version in case we're dynamically linked. */ | 5660 | /* Check library version in case we're dynamically linked. */ |
| 5661 | major = XkbMajorVersion; | 5661 | major = XkbMajorVersion; |
| 5662 | minor = XkbMinorVersion; | 5662 | minor = XkbMinorVersion; |
| 5663 | if (!XkbLibraryVersion (&major, &minor)) | 5663 | if (!XkbLibraryVersion (&major, &minor)) |
| 5664 | { | 5664 | { |
| 5665 | UNBLOCK_INPUT; | 5665 | unblock_input (); |
| 5666 | return Qlambda; | 5666 | return Qlambda; |
| 5667 | } | 5667 | } |
| 5668 | 5668 | ||
| @@ -5671,7 +5671,7 @@ present and mapped to the usual X keysyms. */) | |||
| 5671 | minor = XkbMinorVersion; | 5671 | minor = XkbMinorVersion; |
| 5672 | if (!XkbQueryExtension (dpy, &op, &event, &error_code, &major, &minor)) | 5672 | if (!XkbQueryExtension (dpy, &op, &event, &error_code, &major, &minor)) |
| 5673 | { | 5673 | { |
| 5674 | UNBLOCK_INPUT; | 5674 | unblock_input (); |
| 5675 | return Qlambda; | 5675 | return Qlambda; |
| 5676 | } | 5676 | } |
| 5677 | 5677 | ||
| @@ -5724,7 +5724,7 @@ present and mapped to the usual X keysyms. */) | |||
| 5724 | && XKeysymToKeycode (dpy, XK_BackSpace) == backspace_keycode) | 5724 | && XKeysymToKeycode (dpy, XK_BackSpace) == backspace_keycode) |
| 5725 | have_keys = Qt; | 5725 | have_keys = Qt; |
| 5726 | } | 5726 | } |
| 5727 | UNBLOCK_INPUT; | 5727 | unblock_input (); |
| 5728 | return have_keys; | 5728 | return have_keys; |
| 5729 | #else /* not HAVE_XKBGETKEYBOARD */ | 5729 | #else /* not HAVE_XKBGETKEYBOARD */ |
| 5730 | return Qlambda; | 5730 | return Qlambda; |
diff --git a/src/xfont.c b/src/xfont.c index 1f2fd13f1b7..2d493088b0b 100644 --- a/src/xfont.c +++ b/src/xfont.c | |||
| @@ -362,7 +362,7 @@ xfont_list_pattern (Display *display, const char *pattern, | |||
| 362 | } | 362 | } |
| 363 | } | 363 | } |
| 364 | 364 | ||
| 365 | BLOCK_INPUT; | 365 | block_input (); |
| 366 | x_catch_errors (display); | 366 | x_catch_errors (display); |
| 367 | 367 | ||
| 368 | for (limit = 512; ; limit *= 2) | 368 | for (limit = 512; ; limit *= 2) |
| @@ -479,7 +479,7 @@ xfont_list_pattern (Display *display, const char *pattern, | |||
| 479 | } | 479 | } |
| 480 | 480 | ||
| 481 | x_uncatch_errors (); | 481 | x_uncatch_errors (); |
| 482 | UNBLOCK_INPUT; | 482 | unblock_input (); |
| 483 | 483 | ||
| 484 | FONT_ADD_LOG ("xfont-list", build_string (pattern), list); | 484 | FONT_ADD_LOG ("xfont-list", build_string (pattern), list); |
| 485 | return list; | 485 | return list; |
| @@ -588,7 +588,7 @@ xfont_match (Lisp_Object frame, Lisp_Object spec) | |||
| 588 | if (xfont_encode_coding_xlfd (name) < 0) | 588 | if (xfont_encode_coding_xlfd (name) < 0) |
| 589 | return Qnil; | 589 | return Qnil; |
| 590 | 590 | ||
| 591 | BLOCK_INPUT; | 591 | block_input (); |
| 592 | entity = Qnil; | 592 | entity = Qnil; |
| 593 | xfont = XLoadQueryFont (display, name); | 593 | xfont = XLoadQueryFont (display, name); |
| 594 | if (xfont) | 594 | if (xfont) |
| @@ -615,7 +615,7 @@ xfont_match (Lisp_Object frame, Lisp_Object spec) | |||
| 615 | } | 615 | } |
| 616 | XFreeFont (display, xfont); | 616 | XFreeFont (display, xfont); |
| 617 | } | 617 | } |
| 618 | UNBLOCK_INPUT; | 618 | unblock_input (); |
| 619 | 619 | ||
| 620 | FONT_ADD_LOG ("xfont-match", spec, entity); | 620 | FONT_ADD_LOG ("xfont-match", spec, entity); |
| 621 | return entity; | 621 | return entity; |
| @@ -632,7 +632,7 @@ xfont_list_family (Lisp_Object frame) | |||
| 632 | char *last_family IF_LINT (= 0); | 632 | char *last_family IF_LINT (= 0); |
| 633 | int last_len; | 633 | int last_len; |
| 634 | 634 | ||
| 635 | BLOCK_INPUT; | 635 | block_input (); |
| 636 | x_catch_errors (dpyinfo->display); | 636 | x_catch_errors (dpyinfo->display); |
| 637 | names = XListFonts (dpyinfo->display, "-*-*-*-*-*-*-*-*-*-*-*-*-*-*", | 637 | names = XListFonts (dpyinfo->display, "-*-*-*-*-*-*-*-*-*-*-*-*-*-*", |
| 638 | 0x8000, &num_fonts); | 638 | 0x8000, &num_fonts); |
| @@ -673,7 +673,7 @@ xfont_list_family (Lisp_Object frame) | |||
| 673 | 673 | ||
| 674 | XFreeFontNames (names); | 674 | XFreeFontNames (names); |
| 675 | x_uncatch_errors (); | 675 | x_uncatch_errors (); |
| 676 | UNBLOCK_INPUT; | 676 | unblock_input (); |
| 677 | 677 | ||
| 678 | return list; | 678 | return list; |
| 679 | } | 679 | } |
| @@ -717,7 +717,7 @@ xfont_open (FRAME_PTR f, Lisp_Object entity, int pixel_size) | |||
| 717 | return Qnil; | 717 | return Qnil; |
| 718 | } | 718 | } |
| 719 | 719 | ||
| 720 | BLOCK_INPUT; | 720 | block_input (); |
| 721 | x_catch_errors (display); | 721 | x_catch_errors (display); |
| 722 | xfont = XLoadQueryFont (display, name); | 722 | xfont = XLoadQueryFont (display, name); |
| 723 | if (x_had_errors_p (display)) | 723 | if (x_had_errors_p (display)) |
| @@ -784,7 +784,7 @@ xfont_open (FRAME_PTR f, Lisp_Object entity, int pixel_size) | |||
| 784 | XFree (p0); | 784 | XFree (p0); |
| 785 | } | 785 | } |
| 786 | x_uncatch_errors (); | 786 | x_uncatch_errors (); |
| 787 | UNBLOCK_INPUT; | 787 | unblock_input (); |
| 788 | 788 | ||
| 789 | if (! xfont) | 789 | if (! xfont) |
| 790 | { | 790 | { |
| @@ -866,7 +866,7 @@ xfont_open (FRAME_PTR f, Lisp_Object entity, int pixel_size) | |||
| 866 | } | 866 | } |
| 867 | } | 867 | } |
| 868 | 868 | ||
| 869 | BLOCK_INPUT; | 869 | block_input (); |
| 870 | font->underline_thickness | 870 | font->underline_thickness |
| 871 | = (XGetFontProperty (xfont, XA_UNDERLINE_THICKNESS, &value) | 871 | = (XGetFontProperty (xfont, XA_UNDERLINE_THICKNESS, &value) |
| 872 | ? (long) value : 0); | 872 | ? (long) value : 0); |
| @@ -882,7 +882,7 @@ xfont_open (FRAME_PTR f, Lisp_Object entity, int pixel_size) | |||
| 882 | font->default_ascent | 882 | font->default_ascent |
| 883 | = (XGetFontProperty (xfont, dpyinfo->Xatom_MULE_DEFAULT_ASCENT, &value) | 883 | = (XGetFontProperty (xfont, dpyinfo->Xatom_MULE_DEFAULT_ASCENT, &value) |
| 884 | ? (long) value : 0); | 884 | ? (long) value : 0); |
| 885 | UNBLOCK_INPUT; | 885 | unblock_input (); |
| 886 | 886 | ||
| 887 | if (NILP (fullname)) | 887 | if (NILP (fullname)) |
| 888 | fullname = AREF (font_object, FONT_NAME_INDEX); | 888 | fullname = AREF (font_object, FONT_NAME_INDEX); |
| @@ -897,18 +897,18 @@ xfont_open (FRAME_PTR f, Lisp_Object entity, int pixel_size) | |||
| 897 | static void | 897 | static void |
| 898 | xfont_close (FRAME_PTR f, struct font *font) | 898 | xfont_close (FRAME_PTR f, struct font *font) |
| 899 | { | 899 | { |
| 900 | BLOCK_INPUT; | 900 | block_input (); |
| 901 | XFreeFont (FRAME_X_DISPLAY (f), ((struct xfont_info *) font)->xfont); | 901 | XFreeFont (FRAME_X_DISPLAY (f), ((struct xfont_info *) font)->xfont); |
| 902 | UNBLOCK_INPUT; | 902 | unblock_input (); |
| 903 | } | 903 | } |
| 904 | 904 | ||
| 905 | static int | 905 | static int |
| 906 | xfont_prepare_face (FRAME_PTR f, struct face *face) | 906 | xfont_prepare_face (FRAME_PTR f, struct face *face) |
| 907 | { | 907 | { |
| 908 | BLOCK_INPUT; | 908 | block_input (); |
| 909 | XSetFont (FRAME_X_DISPLAY (f), face->gc, | 909 | XSetFont (FRAME_X_DISPLAY (f), face->gc, |
| 910 | ((struct xfont_info *) face->font)->xfont->fid); | 910 | ((struct xfont_info *) face->font)->xfont->fid); |
| 911 | UNBLOCK_INPUT; | 911 | unblock_input (); |
| 912 | 912 | ||
| 913 | return 0; | 913 | return 0; |
| 914 | } | 914 | } |
| @@ -1028,9 +1028,9 @@ xfont_draw (struct glyph_string *s, int from, int to, int x, int y, | |||
| 1028 | 1028 | ||
| 1029 | if (s->gc != s->face->gc) | 1029 | if (s->gc != s->face->gc) |
| 1030 | { | 1030 | { |
| 1031 | BLOCK_INPUT; | 1031 | block_input (); |
| 1032 | XSetFont (s->display, gc, xfont->fid); | 1032 | XSetFont (s->display, gc, xfont->fid); |
| 1033 | UNBLOCK_INPUT; | 1033 | unblock_input (); |
| 1034 | } | 1034 | } |
| 1035 | 1035 | ||
| 1036 | if (xfont->min_byte1 == 0 && xfont->max_byte1 == 0) | 1036 | if (xfont->min_byte1 == 0 && xfont->max_byte1 == 0) |
| @@ -1039,7 +1039,7 @@ xfont_draw (struct glyph_string *s, int from, int to, int x, int y, | |||
| 1039 | char *str = SAFE_ALLOCA (len); | 1039 | char *str = SAFE_ALLOCA (len); |
| 1040 | for (i = 0; i < len ; i++) | 1040 | for (i = 0; i < len ; i++) |
| 1041 | str[i] = XCHAR2B_BYTE2 (s->char2b + from + i); | 1041 | str[i] = XCHAR2B_BYTE2 (s->char2b + from + i); |
| 1042 | BLOCK_INPUT; | 1042 | block_input (); |
| 1043 | if (with_background) | 1043 | if (with_background) |
| 1044 | { | 1044 | { |
| 1045 | if (s->padding_p) | 1045 | if (s->padding_p) |
| @@ -1060,12 +1060,12 @@ xfont_draw (struct glyph_string *s, int from, int to, int x, int y, | |||
| 1060 | XDrawString (FRAME_X_DISPLAY (s->f), FRAME_X_WINDOW (s->f), | 1060 | XDrawString (FRAME_X_DISPLAY (s->f), FRAME_X_WINDOW (s->f), |
| 1061 | gc, x, y, str, len); | 1061 | gc, x, y, str, len); |
| 1062 | } | 1062 | } |
| 1063 | UNBLOCK_INPUT; | 1063 | unblock_input (); |
| 1064 | SAFE_FREE (); | 1064 | SAFE_FREE (); |
| 1065 | return s->nchars; | 1065 | return s->nchars; |
| 1066 | } | 1066 | } |
| 1067 | 1067 | ||
| 1068 | BLOCK_INPUT; | 1068 | block_input (); |
| 1069 | if (with_background) | 1069 | if (with_background) |
| 1070 | { | 1070 | { |
| 1071 | if (s->padding_p) | 1071 | if (s->padding_p) |
| @@ -1086,7 +1086,7 @@ xfont_draw (struct glyph_string *s, int from, int to, int x, int y, | |||
| 1086 | XDrawString16 (FRAME_X_DISPLAY (s->f), FRAME_X_WINDOW (s->f), | 1086 | XDrawString16 (FRAME_X_DISPLAY (s->f), FRAME_X_WINDOW (s->f), |
| 1087 | gc, x, y, s->char2b + from, len); | 1087 | gc, x, y, s->char2b + from, len); |
| 1088 | } | 1088 | } |
| 1089 | UNBLOCK_INPUT; | 1089 | unblock_input (); |
| 1090 | 1090 | ||
| 1091 | return len; | 1091 | return len; |
| 1092 | } | 1092 | } |
diff --git a/src/xftfont.c b/src/xftfont.c index 9f52eb8b233..372ed87705f 100644 --- a/src/xftfont.c +++ b/src/xftfont.c | |||
| @@ -93,7 +93,7 @@ xftfont_get_colors (FRAME_PTR f, struct face *face, GC gc, struct xftface_info * | |||
| 93 | XGCValues xgcv; | 93 | XGCValues xgcv; |
| 94 | bool fg_done = 0, bg_done = 0; | 94 | bool fg_done = 0, bg_done = 0; |
| 95 | 95 | ||
| 96 | BLOCK_INPUT; | 96 | block_input (); |
| 97 | XGetGCValues (FRAME_X_DISPLAY (f), gc, | 97 | XGetGCValues (FRAME_X_DISPLAY (f), gc, |
| 98 | GCForeground | GCBackground, &xgcv); | 98 | GCForeground | GCBackground, &xgcv); |
| 99 | if (xftface_info) | 99 | if (xftface_info) |
| @@ -131,7 +131,7 @@ xftfont_get_colors (FRAME_PTR f, struct face *face, GC gc, struct xftface_info * | |||
| 131 | bg->color.blue = colors[1].blue; | 131 | bg->color.blue = colors[1].blue; |
| 132 | } | 132 | } |
| 133 | } | 133 | } |
| 134 | UNBLOCK_INPUT; | 134 | unblock_input (); |
| 135 | } | 135 | } |
| 136 | } | 136 | } |
| 137 | 137 | ||
| @@ -324,7 +324,7 @@ xftfont_open (FRAME_PTR f, Lisp_Object entity, int pixel_size) | |||
| 324 | FcPatternAddInteger (pat, FC_INDEX, XINT (idx)); | 324 | FcPatternAddInteger (pat, FC_INDEX, XINT (idx)); |
| 325 | 325 | ||
| 326 | 326 | ||
| 327 | BLOCK_INPUT; | 327 | block_input (); |
| 328 | /* Make sure that the Xrender extension is added before the Xft one. | 328 | /* Make sure that the Xrender extension is added before the Xft one. |
| 329 | Otherwise, the close-display hook set by Xft is called after the | 329 | Otherwise, the close-display hook set by Xft is called after the |
| 330 | one for Xrender, and the former tries to re-add the latter. This | 330 | one for Xrender, and the former tries to re-add the latter. This |
| @@ -345,12 +345,12 @@ xftfont_open (FRAME_PTR f, Lisp_Object entity, int pixel_size) | |||
| 345 | xftfont = XftFontOpenPattern (display, match); | 345 | xftfont = XftFontOpenPattern (display, match); |
| 346 | if (!xftfont) | 346 | if (!xftfont) |
| 347 | { | 347 | { |
| 348 | UNBLOCK_INPUT; | 348 | unblock_input (); |
| 349 | XftPatternDestroy (match); | 349 | XftPatternDestroy (match); |
| 350 | return Qnil; | 350 | return Qnil; |
| 351 | } | 351 | } |
| 352 | ft_face = XftLockFace (xftfont); | 352 | ft_face = XftLockFace (xftfont); |
| 353 | UNBLOCK_INPUT; | 353 | unblock_input (); |
| 354 | 354 | ||
| 355 | /* We should not destroy PAT here because it is kept in XFTFONT and | 355 | /* We should not destroy PAT here because it is kept in XFTFONT and |
| 356 | destroyed automatically when XFTFONT is closed. */ | 356 | destroyed automatically when XFTFONT is closed. */ |
| @@ -399,7 +399,7 @@ xftfont_open (FRAME_PTR f, Lisp_Object entity, int pixel_size) | |||
| 399 | for (ch = 0; ch < 95; ch++) | 399 | for (ch = 0; ch < 95; ch++) |
| 400 | ascii_printable[ch] = ' ' + ch; | 400 | ascii_printable[ch] = ' ' + ch; |
| 401 | } | 401 | } |
| 402 | BLOCK_INPUT; | 402 | block_input (); |
| 403 | 403 | ||
| 404 | /* Unfortunately Xft doesn't provide a way to get minimum char | 404 | /* Unfortunately Xft doesn't provide a way to get minimum char |
| 405 | width. So, we set min_width to space_width. */ | 405 | width. So, we set min_width to space_width. */ |
| @@ -425,7 +425,7 @@ xftfont_open (FRAME_PTR f, Lisp_Object entity, int pixel_size) | |||
| 425 | XftTextExtents8 (display, xftfont, ascii_printable + 1, 94, &extents); | 425 | XftTextExtents8 (display, xftfont, ascii_printable + 1, 94, &extents); |
| 426 | font->average_width = (font->space_width + extents.xOff) / 95; | 426 | font->average_width = (font->space_width + extents.xOff) / 95; |
| 427 | } | 427 | } |
| 428 | UNBLOCK_INPUT; | 428 | unblock_input (); |
| 429 | 429 | ||
| 430 | font->ascent = xftfont->ascent; | 430 | font->ascent = xftfont->ascent; |
| 431 | font->descent = xftfont->descent; | 431 | font->descent = xftfont->descent; |
| @@ -494,10 +494,10 @@ xftfont_close (FRAME_PTR f, struct font *font) | |||
| 494 | if (xftfont_info->otf) | 494 | if (xftfont_info->otf) |
| 495 | OTF_close (xftfont_info->otf); | 495 | OTF_close (xftfont_info->otf); |
| 496 | #endif | 496 | #endif |
| 497 | BLOCK_INPUT; | 497 | block_input (); |
| 498 | XftUnlockFace (xftfont_info->xftfont); | 498 | XftUnlockFace (xftfont_info->xftfont); |
| 499 | XftFontClose (xftfont_info->display, xftfont_info->xftfont); | 499 | XftFontClose (xftfont_info->display, xftfont_info->xftfont); |
| 500 | UNBLOCK_INPUT; | 500 | unblock_input (); |
| 501 | } | 501 | } |
| 502 | 502 | ||
| 503 | static int | 503 | static int |
| @@ -581,10 +581,10 @@ xftfont_text_extents (struct font *font, unsigned int *code, int nglyphs, struct | |||
| 581 | struct xftfont_info *xftfont_info = (struct xftfont_info *) font; | 581 | struct xftfont_info *xftfont_info = (struct xftfont_info *) font; |
| 582 | XGlyphInfo extents; | 582 | XGlyphInfo extents; |
| 583 | 583 | ||
| 584 | BLOCK_INPUT; | 584 | block_input (); |
| 585 | XftGlyphExtents (xftfont_info->display, xftfont_info->xftfont, code, nglyphs, | 585 | XftGlyphExtents (xftfont_info->display, xftfont_info->xftfont, code, nglyphs, |
| 586 | &extents); | 586 | &extents); |
| 587 | UNBLOCK_INPUT; | 587 | unblock_input (); |
| 588 | if (metrics) | 588 | if (metrics) |
| 589 | { | 589 | { |
| 590 | metrics->lbearing = - extents.x; | 590 | metrics->lbearing = - extents.x; |
| @@ -603,12 +603,12 @@ xftfont_get_xft_draw (FRAME_PTR f) | |||
| 603 | 603 | ||
| 604 | if (! xft_draw) | 604 | if (! xft_draw) |
| 605 | { | 605 | { |
| 606 | BLOCK_INPUT; | 606 | block_input (); |
| 607 | xft_draw= XftDrawCreate (FRAME_X_DISPLAY (f), | 607 | xft_draw= XftDrawCreate (FRAME_X_DISPLAY (f), |
| 608 | FRAME_X_WINDOW (f), | 608 | FRAME_X_WINDOW (f), |
| 609 | FRAME_X_VISUAL (f), | 609 | FRAME_X_VISUAL (f), |
| 610 | FRAME_X_COLORMAP (f)); | 610 | FRAME_X_COLORMAP (f)); |
| 611 | UNBLOCK_INPUT; | 611 | unblock_input (); |
| 612 | eassert (xft_draw != NULL); | 612 | eassert (xft_draw != NULL); |
| 613 | font_put_frame_data (f, &xftfont_driver, xft_draw); | 613 | font_put_frame_data (f, &xftfont_driver, xft_draw); |
| 614 | } | 614 | } |
| @@ -633,7 +633,7 @@ xftfont_draw (struct glyph_string *s, int from, int to, int x, int y, | |||
| 633 | xftface_info = (struct xftface_info *) face->extra; | 633 | xftface_info = (struct xftface_info *) face->extra; |
| 634 | xftfont_get_colors (f, face, s->gc, xftface_info, | 634 | xftfont_get_colors (f, face, s->gc, xftface_info, |
| 635 | &fg, with_background ? &bg : NULL); | 635 | &fg, with_background ? &bg : NULL); |
| 636 | BLOCK_INPUT; | 636 | block_input (); |
| 637 | if (s->num_clips > 0) | 637 | if (s->num_clips > 0) |
| 638 | XftDrawSetClipRectangles (xft_draw, 0, 0, s->clip, s->num_clips); | 638 | XftDrawSetClipRectangles (xft_draw, 0, 0, s->clip, s->num_clips); |
| 639 | else | 639 | else |
| @@ -654,7 +654,7 @@ xftfont_draw (struct glyph_string *s, int from, int to, int x, int y, | |||
| 654 | else | 654 | else |
| 655 | XftDrawGlyphs (xft_draw, &fg, xftfont_info->xftfont, | 655 | XftDrawGlyphs (xft_draw, &fg, xftfont_info->xftfont, |
| 656 | x, y, code, len); | 656 | x, y, code, len); |
| 657 | UNBLOCK_INPUT; | 657 | unblock_input (); |
| 658 | 658 | ||
| 659 | return len; | 659 | return len; |
| 660 | } | 660 | } |
| @@ -690,9 +690,9 @@ xftfont_end_for_frame (FRAME_PTR f) | |||
| 690 | 690 | ||
| 691 | if (xft_draw) | 691 | if (xft_draw) |
| 692 | { | 692 | { |
| 693 | BLOCK_INPUT; | 693 | block_input (); |
| 694 | XftDrawDestroy (xft_draw); | 694 | XftDrawDestroy (xft_draw); |
| 695 | UNBLOCK_INPUT; | 695 | unblock_input (); |
| 696 | font_put_frame_data (f, &xftfont_driver, NULL); | 696 | font_put_frame_data (f, &xftfont_driver, NULL); |
| 697 | } | 697 | } |
| 698 | return 0; | 698 | return 0; |
diff --git a/src/xmenu.c b/src/xmenu.c index d03a4bc974b..06d6cb055c0 100644 --- a/src/xmenu.c +++ b/src/xmenu.c | |||
| @@ -165,7 +165,7 @@ mouse_position_for_popup (FRAME_PTR f, int *x, int *y) | |||
| 165 | if (! FRAME_X_P (f)) | 165 | if (! FRAME_X_P (f)) |
| 166 | emacs_abort (); | 166 | emacs_abort (); |
| 167 | 167 | ||
| 168 | BLOCK_INPUT; | 168 | block_input (); |
| 169 | 169 | ||
| 170 | XQueryPointer (FRAME_X_DISPLAY (f), | 170 | XQueryPointer (FRAME_X_DISPLAY (f), |
| 171 | DefaultRootWindow (FRAME_X_DISPLAY (f)), | 171 | DefaultRootWindow (FRAME_X_DISPLAY (f)), |
| @@ -186,7 +186,7 @@ mouse_position_for_popup (FRAME_PTR f, int *x, int *y) | |||
| 186 | we don't care. */ | 186 | we don't care. */ |
| 187 | (unsigned int *) &dummy); | 187 | (unsigned int *) &dummy); |
| 188 | 188 | ||
| 189 | UNBLOCK_INPUT; | 189 | unblock_input (); |
| 190 | 190 | ||
| 191 | /* xmenu_show expects window coordinates, not root window | 191 | /* xmenu_show expects window coordinates, not root window |
| 192 | coordinates. Translate. */ | 192 | coordinates. Translate. */ |
| @@ -328,9 +328,9 @@ for instance using the window manager, then this produces a quit and | |||
| 328 | list_of_panes (Fcons (contents, Qnil)); | 328 | list_of_panes (Fcons (contents, Qnil)); |
| 329 | 329 | ||
| 330 | /* Display them in a dialog box. */ | 330 | /* Display them in a dialog box. */ |
| 331 | BLOCK_INPUT; | 331 | block_input (); |
| 332 | selection = xdialog_show (f, 0, title, header, &error_name); | 332 | selection = xdialog_show (f, 0, title, header, &error_name); |
| 333 | UNBLOCK_INPUT; | 333 | unblock_input (); |
| 334 | 334 | ||
| 335 | unbind_to (specpdl_count, Qnil); | 335 | unbind_to (specpdl_count, Qnil); |
| 336 | discard_menu_items (); | 336 | discard_menu_items (); |
| @@ -490,7 +490,7 @@ If FRAME is nil or not given, use the selected frame. */) | |||
| 490 | XEvent ev; | 490 | XEvent ev; |
| 491 | FRAME_PTR f = check_x_frame (frame); | 491 | FRAME_PTR f = check_x_frame (frame); |
| 492 | Widget menubar; | 492 | Widget menubar; |
| 493 | BLOCK_INPUT; | 493 | block_input (); |
| 494 | 494 | ||
| 495 | if (FRAME_EXTERNAL_MENU_BAR (f)) | 495 | if (FRAME_EXTERNAL_MENU_BAR (f)) |
| 496 | set_frame_menubar (f, 0, 1); | 496 | set_frame_menubar (f, 0, 1); |
| @@ -548,7 +548,7 @@ If FRAME is nil or not given, use the selected frame. */) | |||
| 548 | } | 548 | } |
| 549 | } | 549 | } |
| 550 | 550 | ||
| 551 | UNBLOCK_INPUT; | 551 | unblock_input (); |
| 552 | 552 | ||
| 553 | return Qnil; | 553 | return Qnil; |
| 554 | } | 554 | } |
| @@ -569,9 +569,9 @@ If FRAME is nil or not given, use the selected frame. */) | |||
| 569 | FRAME_PTR f; | 569 | FRAME_PTR f; |
| 570 | 570 | ||
| 571 | /* gcc 2.95 doesn't accept the FRAME_PTR declaration after | 571 | /* gcc 2.95 doesn't accept the FRAME_PTR declaration after |
| 572 | BLOCK_INPUT. */ | 572 | block_input (). */ |
| 573 | 573 | ||
| 574 | BLOCK_INPUT; | 574 | block_input (); |
| 575 | f = check_x_frame (frame); | 575 | f = check_x_frame (frame); |
| 576 | 576 | ||
| 577 | if (FRAME_EXTERNAL_MENU_BAR (f)) | 577 | if (FRAME_EXTERNAL_MENU_BAR (f)) |
| @@ -590,7 +590,7 @@ If FRAME is nil or not given, use the selected frame. */) | |||
| 590 | g_list_free (children); | 590 | g_list_free (children); |
| 591 | } | 591 | } |
| 592 | } | 592 | } |
| 593 | UNBLOCK_INPUT; | 593 | unblock_input (); |
| 594 | 594 | ||
| 595 | return Qnil; | 595 | return Qnil; |
| 596 | } | 596 | } |
| @@ -642,7 +642,7 @@ x_activate_menubar (FRAME_PTR f) | |||
| 642 | #endif | 642 | #endif |
| 643 | 643 | ||
| 644 | set_frame_menubar (f, 0, 1); | 644 | set_frame_menubar (f, 0, 1); |
| 645 | BLOCK_INPUT; | 645 | block_input (); |
| 646 | popup_activated_flag = 1; | 646 | popup_activated_flag = 1; |
| 647 | #ifdef USE_GTK | 647 | #ifdef USE_GTK |
| 648 | XPutBackEvent (f->output_data.x->display_info->display, | 648 | XPutBackEvent (f->output_data.x->display_info->display, |
| @@ -650,7 +650,7 @@ x_activate_menubar (FRAME_PTR f) | |||
| 650 | #else | 650 | #else |
| 651 | XtDispatchEvent (f->output_data.x->saved_menu_event); | 651 | XtDispatchEvent (f->output_data.x->saved_menu_event); |
| 652 | #endif | 652 | #endif |
| 653 | UNBLOCK_INPUT; | 653 | unblock_input (); |
| 654 | 654 | ||
| 655 | /* Ignore this if we get it a second time. */ | 655 | /* Ignore this if we get it a second time. */ |
| 656 | f->output_data.x->saved_menu_event->type = 0; | 656 | f->output_data.x->saved_menu_event->type = 0; |
| @@ -803,10 +803,10 @@ menubar_selection_callback (GtkWidget *widget, gpointer client_data) | |||
| 803 | sit-for will exit at once if the focus event follows the menu selection | 803 | sit-for will exit at once if the focus event follows the menu selection |
| 804 | event. */ | 804 | event. */ |
| 805 | 805 | ||
| 806 | BLOCK_INPUT; | 806 | block_input (); |
| 807 | while (gtk_events_pending ()) | 807 | while (gtk_events_pending ()) |
| 808 | gtk_main_iteration (); | 808 | gtk_main_iteration (); |
| 809 | UNBLOCK_INPUT; | 809 | unblock_input (); |
| 810 | 810 | ||
| 811 | find_and_call_menu_selection (cb_data->cl_data->f, | 811 | find_and_call_menu_selection (cb_data->cl_data->f, |
| 812 | cb_data->cl_data->menu_bar_items_used, | 812 | cb_data->cl_data->menu_bar_items_used, |
| @@ -853,7 +853,7 @@ update_frame_menubar (FRAME_PTR f) | |||
| 853 | if (!x->menubar_widget || XtIsManaged (x->menubar_widget)) | 853 | if (!x->menubar_widget || XtIsManaged (x->menubar_widget)) |
| 854 | return 0; | 854 | return 0; |
| 855 | 855 | ||
| 856 | BLOCK_INPUT; | 856 | block_input (); |
| 857 | /* Save the size of the frame because the pane widget doesn't accept | 857 | /* Save the size of the frame because the pane widget doesn't accept |
| 858 | to resize itself. So force it. */ | 858 | to resize itself. So force it. */ |
| 859 | columns = FRAME_COLS (f); | 859 | columns = FRAME_COLS (f); |
| @@ -880,7 +880,7 @@ update_frame_menubar (FRAME_PTR f) | |||
| 880 | 880 | ||
| 881 | /* Force the pane widget to resize itself with the right values. */ | 881 | /* Force the pane widget to resize itself with the right values. */ |
| 882 | EmacsFrameSetCharSize (x->edit_widget, columns, rows); | 882 | EmacsFrameSetCharSize (x->edit_widget, columns, rows); |
| 883 | UNBLOCK_INPUT; | 883 | unblock_input (); |
| 884 | #endif | 884 | #endif |
| 885 | return 1; | 885 | return 1; |
| 886 | } | 886 | } |
| @@ -1164,7 +1164,7 @@ set_frame_menubar (FRAME_PTR f, int first_time, int deep_p) | |||
| 1164 | 1164 | ||
| 1165 | /* Create or update the menu bar widget. */ | 1165 | /* Create or update the menu bar widget. */ |
| 1166 | 1166 | ||
| 1167 | BLOCK_INPUT; | 1167 | block_input (); |
| 1168 | 1168 | ||
| 1169 | #ifdef USE_GTK | 1169 | #ifdef USE_GTK |
| 1170 | xg_crazy_callback_abort = 1; | 1170 | xg_crazy_callback_abort = 1; |
| @@ -1264,7 +1264,7 @@ set_frame_menubar (FRAME_PTR f, int first_time, int deep_p) | |||
| 1264 | xg_crazy_callback_abort = 0; | 1264 | xg_crazy_callback_abort = 0; |
| 1265 | #endif | 1265 | #endif |
| 1266 | 1266 | ||
| 1267 | UNBLOCK_INPUT; | 1267 | unblock_input (); |
| 1268 | } | 1268 | } |
| 1269 | 1269 | ||
| 1270 | /* Called from Fx_create_frame to create the initial menubar of a frame | 1270 | /* Called from Fx_create_frame to create the initial menubar of a frame |
| @@ -1313,7 +1313,7 @@ free_frame_menubar (FRAME_PTR f) | |||
| 1313 | Position x0, y0, x1, y1; | 1313 | Position x0, y0, x1, y1; |
| 1314 | #endif | 1314 | #endif |
| 1315 | 1315 | ||
| 1316 | BLOCK_INPUT; | 1316 | block_input (); |
| 1317 | 1317 | ||
| 1318 | #ifdef USE_MOTIF | 1318 | #ifdef USE_MOTIF |
| 1319 | if (f->output_data.x->widget) | 1319 | if (f->output_data.x->widget) |
| @@ -1332,7 +1332,7 @@ free_frame_menubar (FRAME_PTR f) | |||
| 1332 | #endif | 1332 | #endif |
| 1333 | x_set_window_size (f, 0, FRAME_COLS (f), FRAME_LINES (f)); | 1333 | x_set_window_size (f, 0, FRAME_COLS (f), FRAME_LINES (f)); |
| 1334 | } | 1334 | } |
| 1335 | UNBLOCK_INPUT; | 1335 | unblock_input (); |
| 1336 | } | 1336 | } |
| 1337 | } | 1337 | } |
| 1338 | #endif /* not USE_GTK */ | 1338 | #endif /* not USE_GTK */ |
| @@ -1417,9 +1417,9 @@ pop_down_menu (Lisp_Object arg) | |||
| 1417 | struct Lisp_Save_Value *p = XSAVE_VALUE (arg); | 1417 | struct Lisp_Save_Value *p = XSAVE_VALUE (arg); |
| 1418 | 1418 | ||
| 1419 | popup_activated_flag = 0; | 1419 | popup_activated_flag = 0; |
| 1420 | BLOCK_INPUT; | 1420 | block_input (); |
| 1421 | gtk_widget_destroy (GTK_WIDGET (p->pointer)); | 1421 | gtk_widget_destroy (GTK_WIDGET (p->pointer)); |
| 1422 | UNBLOCK_INPUT; | 1422 | unblock_input (); |
| 1423 | return Qnil; | 1423 | return Qnil; |
| 1424 | } | 1424 | } |
| 1425 | 1425 | ||
| @@ -1527,9 +1527,9 @@ pop_down_menu (Lisp_Object arg) | |||
| 1527 | LWLIB_ID id = (XINT (XCAR (arg)) << 4 * sizeof (LWLIB_ID) | 1527 | LWLIB_ID id = (XINT (XCAR (arg)) << 4 * sizeof (LWLIB_ID) |
| 1528 | | XINT (XCDR (arg))); | 1528 | | XINT (XCDR (arg))); |
| 1529 | 1529 | ||
| 1530 | BLOCK_INPUT; | 1530 | block_input (); |
| 1531 | lw_destroy_all_widgets (id); | 1531 | lw_destroy_all_widgets (id); |
| 1532 | UNBLOCK_INPUT; | 1532 | unblock_input (); |
| 1533 | popup_activated_flag = 0; | 1533 | popup_activated_flag = 0; |
| 1534 | 1534 | ||
| 1535 | return Qnil; | 1535 | return Qnil; |
| @@ -1955,9 +1955,9 @@ dialog_selection_callback (Widget widget, LWLIB_ID id, XtPointer client_data) | |||
| 1955 | if ((intptr_t) client_data != -1) | 1955 | if ((intptr_t) client_data != -1) |
| 1956 | menu_item_selection = (Lisp_Object *) client_data; | 1956 | menu_item_selection = (Lisp_Object *) client_data; |
| 1957 | 1957 | ||
| 1958 | BLOCK_INPUT; | 1958 | block_input (); |
| 1959 | lw_destroy_all_widgets (id); | 1959 | lw_destroy_all_widgets (id); |
| 1960 | UNBLOCK_INPUT; | 1960 | unblock_input (); |
| 1961 | popup_activated_flag = 0; | 1961 | popup_activated_flag = 0; |
| 1962 | } | 1962 | } |
| 1963 | 1963 | ||
| @@ -2251,7 +2251,7 @@ pop_down_menu (Lisp_Object arg) | |||
| 2251 | FRAME_PTR f = p1->pointer; | 2251 | FRAME_PTR f = p1->pointer; |
| 2252 | XMenu *menu = p2->pointer; | 2252 | XMenu *menu = p2->pointer; |
| 2253 | 2253 | ||
| 2254 | BLOCK_INPUT; | 2254 | block_input (); |
| 2255 | #ifndef MSDOS | 2255 | #ifndef MSDOS |
| 2256 | XUngrabPointer (FRAME_X_DISPLAY (f), CurrentTime); | 2256 | XUngrabPointer (FRAME_X_DISPLAY (f), CurrentTime); |
| 2257 | XUngrabKeyboard (FRAME_X_DISPLAY (f), CurrentTime); | 2257 | XUngrabKeyboard (FRAME_X_DISPLAY (f), CurrentTime); |
| @@ -2271,7 +2271,7 @@ pop_down_menu (Lisp_Object arg) | |||
| 2271 | 2271 | ||
| 2272 | #endif /* HAVE_X_WINDOWS */ | 2272 | #endif /* HAVE_X_WINDOWS */ |
| 2273 | 2273 | ||
| 2274 | UNBLOCK_INPUT; | 2274 | unblock_input (); |
| 2275 | 2275 | ||
| 2276 | return Qnil; | 2276 | return Qnil; |
| 2277 | } | 2277 | } |
diff --git a/src/xselect.c b/src/xselect.c index ab199e0b9b9..de9386bd7d9 100644 --- a/src/xselect.c +++ b/src/xselect.c | |||
| @@ -247,9 +247,9 @@ symbol_to_x_atom (struct x_display_info *dpyinfo, Lisp_Object sym) | |||
| 247 | if (!SYMBOLP (sym)) emacs_abort (); | 247 | if (!SYMBOLP (sym)) emacs_abort (); |
| 248 | 248 | ||
| 249 | TRACE1 (" XInternAtom %s", SSDATA (SYMBOL_NAME (sym))); | 249 | TRACE1 (" XInternAtom %s", SSDATA (SYMBOL_NAME (sym))); |
| 250 | BLOCK_INPUT; | 250 | block_input (); |
| 251 | val = XInternAtom (dpyinfo->display, SSDATA (SYMBOL_NAME (sym)), False); | 251 | val = XInternAtom (dpyinfo->display, SSDATA (SYMBOL_NAME (sym)), False); |
| 252 | UNBLOCK_INPUT; | 252 | unblock_input (); |
| 253 | return val; | 253 | return val; |
| 254 | } | 254 | } |
| 255 | 255 | ||
| @@ -307,16 +307,16 @@ x_atom_to_symbol (Display *dpy, Atom atom) | |||
| 307 | if (atom == dpyinfo->Xatom_NULL) | 307 | if (atom == dpyinfo->Xatom_NULL) |
| 308 | return QNULL; | 308 | return QNULL; |
| 309 | 309 | ||
| 310 | BLOCK_INPUT; | 310 | block_input (); |
| 311 | str = XGetAtomName (dpy, atom); | 311 | str = XGetAtomName (dpy, atom); |
| 312 | UNBLOCK_INPUT; | 312 | unblock_input (); |
| 313 | TRACE1 ("XGetAtomName --> %s", str); | 313 | TRACE1 ("XGetAtomName --> %s", str); |
| 314 | if (! str) return Qnil; | 314 | if (! str) return Qnil; |
| 315 | val = intern (str); | 315 | val = intern (str); |
| 316 | BLOCK_INPUT; | 316 | block_input (); |
| 317 | /* This was allocated by Xlib, so use XFree. */ | 317 | /* This was allocated by Xlib, so use XFree. */ |
| 318 | XFree (str); | 318 | XFree (str); |
| 319 | UNBLOCK_INPUT; | 319 | unblock_input (); |
| 320 | return val; | 320 | return val; |
| 321 | } | 321 | } |
| 322 | 322 | ||
| @@ -336,12 +336,12 @@ x_own_selection (Lisp_Object selection_name, Lisp_Object selection_value, | |||
| 336 | Time timestamp = last_event_timestamp; | 336 | Time timestamp = last_event_timestamp; |
| 337 | Atom selection_atom = symbol_to_x_atom (dpyinfo, selection_name); | 337 | Atom selection_atom = symbol_to_x_atom (dpyinfo, selection_name); |
| 338 | 338 | ||
| 339 | BLOCK_INPUT; | 339 | block_input (); |
| 340 | x_catch_errors (display); | 340 | x_catch_errors (display); |
| 341 | XSetSelectionOwner (display, selection_atom, selecting_window, timestamp); | 341 | XSetSelectionOwner (display, selection_atom, selecting_window, timestamp); |
| 342 | x_check_errors (display, "Can't set selection: %s"); | 342 | x_check_errors (display, "Can't set selection: %s"); |
| 343 | x_uncatch_errors (); | 343 | x_uncatch_errors (); |
| 344 | UNBLOCK_INPUT; | 344 | unblock_input (); |
| 345 | 345 | ||
| 346 | /* Now update the local cache */ | 346 | /* Now update the local cache */ |
| 347 | { | 347 | { |
| @@ -469,12 +469,12 @@ x_decline_selection_request (struct input_event *event) | |||
| 469 | 469 | ||
| 470 | /* The reason for the error may be that the receiver has | 470 | /* The reason for the error may be that the receiver has |
| 471 | died in the meantime. Handle that case. */ | 471 | died in the meantime. Handle that case. */ |
| 472 | BLOCK_INPUT; | 472 | block_input (); |
| 473 | x_catch_errors (reply->display); | 473 | x_catch_errors (reply->display); |
| 474 | XSendEvent (reply->display, reply->requestor, False, 0L, &reply_base); | 474 | XSendEvent (reply->display, reply->requestor, False, 0L, &reply_base); |
| 475 | XFlush (reply->display); | 475 | XFlush (reply->display); |
| 476 | x_uncatch_errors (); | 476 | x_uncatch_errors (); |
| 477 | UNBLOCK_INPUT; | 477 | unblock_input (); |
| 478 | } | 478 | } |
| 479 | 479 | ||
| 480 | /* This is the selection request currently being processed. | 480 | /* This is the selection request currently being processed. |
| @@ -536,9 +536,9 @@ x_selection_request_lisp_error (Lisp_Object ignore) | |||
| 536 | static Lisp_Object | 536 | static Lisp_Object |
| 537 | x_catch_errors_unwind (Lisp_Object dummy) | 537 | x_catch_errors_unwind (Lisp_Object dummy) |
| 538 | { | 538 | { |
| 539 | BLOCK_INPUT; | 539 | block_input (); |
| 540 | x_uncatch_errors (); | 540 | x_uncatch_errors (); |
| 541 | UNBLOCK_INPUT; | 541 | unblock_input (); |
| 542 | return Qnil; | 542 | return Qnil; |
| 543 | } | 543 | } |
| 544 | 544 | ||
| @@ -610,7 +610,7 @@ x_reply_selection_request (struct input_event *event, | |||
| 610 | if (reply->property == None) | 610 | if (reply->property == None) |
| 611 | reply->property = reply->target; | 611 | reply->property = reply->target; |
| 612 | 612 | ||
| 613 | BLOCK_INPUT; | 613 | block_input (); |
| 614 | /* The protected block contains wait_for_property_change, which can | 614 | /* The protected block contains wait_for_property_change, which can |
| 615 | run random lisp code (process handlers) or signal. Therefore, we | 615 | run random lisp code (process handlers) or signal. Therefore, we |
| 616 | put the x_uncatch_errors call in an unwind. */ | 616 | put the x_uncatch_errors call in an unwind. */ |
| @@ -682,7 +682,7 @@ x_reply_selection_request (struct input_event *event, | |||
| 682 | { | 682 | { |
| 683 | int format_bytes = cs->format / 8; | 683 | int format_bytes = cs->format / 8; |
| 684 | int had_errors = x_had_errors_p (display); | 684 | int had_errors = x_had_errors_p (display); |
| 685 | UNBLOCK_INPUT; | 685 | unblock_input (); |
| 686 | 686 | ||
| 687 | bytes_remaining = cs->size; | 687 | bytes_remaining = cs->size; |
| 688 | bytes_remaining *= format_bytes; | 688 | bytes_remaining *= format_bytes; |
| @@ -703,7 +703,7 @@ x_reply_selection_request (struct input_event *event, | |||
| 703 | int i = ((bytes_remaining < max_bytes) | 703 | int i = ((bytes_remaining < max_bytes) |
| 704 | ? bytes_remaining | 704 | ? bytes_remaining |
| 705 | : max_bytes) / format_bytes; | 705 | : max_bytes) / format_bytes; |
| 706 | BLOCK_INPUT; | 706 | block_input (); |
| 707 | 707 | ||
| 708 | cs->wait_object | 708 | cs->wait_object |
| 709 | = expect_property_change (display, window, cs->property, | 709 | = expect_property_change (display, window, cs->property, |
| @@ -722,7 +722,7 @@ x_reply_selection_request (struct input_event *event, | |||
| 722 | : format_bytes); | 722 | : format_bytes); |
| 723 | XFlush (display); | 723 | XFlush (display); |
| 724 | had_errors = x_had_errors_p (display); | 724 | had_errors = x_had_errors_p (display); |
| 725 | UNBLOCK_INPUT; | 725 | unblock_input (); |
| 726 | 726 | ||
| 727 | if (had_errors) break; | 727 | if (had_errors) break; |
| 728 | 728 | ||
| @@ -735,7 +735,7 @@ x_reply_selection_request (struct input_event *event, | |||
| 735 | 735 | ||
| 736 | /* Now write a zero-length chunk to the property to tell the | 736 | /* Now write a zero-length chunk to the property to tell the |
| 737 | requestor that we're done. */ | 737 | requestor that we're done. */ |
| 738 | BLOCK_INPUT; | 738 | block_input (); |
| 739 | if (! waiting_for_other_props_on_window (display, window)) | 739 | if (! waiting_for_other_props_on_window (display, window)) |
| 740 | XSelectInput (display, window, 0L); | 740 | XSelectInput (display, window, 0L); |
| 741 | 741 | ||
| @@ -757,15 +757,15 @@ x_reply_selection_request (struct input_event *event, | |||
| 757 | /* 2004-09-10: XSync and UNBLOCK so that possible protocol errors are | 757 | /* 2004-09-10: XSync and UNBLOCK so that possible protocol errors are |
| 758 | delivered before uncatch errors. */ | 758 | delivered before uncatch errors. */ |
| 759 | XSync (display, False); | 759 | XSync (display, False); |
| 760 | UNBLOCK_INPUT; | 760 | unblock_input (); |
| 761 | 761 | ||
| 762 | /* GTK queues events in addition to the queue in Xlib. So we | 762 | /* GTK queues events in addition to the queue in Xlib. So we |
| 763 | UNBLOCK to enter the event loop and get possible errors delivered, | 763 | UNBLOCK to enter the event loop and get possible errors delivered, |
| 764 | and then BLOCK again because x_uncatch_errors requires it. */ | 764 | and then BLOCK again because x_uncatch_errors requires it. */ |
| 765 | BLOCK_INPUT; | 765 | block_input (); |
| 766 | /* This calls x_uncatch_errors. */ | 766 | /* This calls x_uncatch_errors. */ |
| 767 | unbind_to (count, Qnil); | 767 | unbind_to (count, Qnil); |
| 768 | UNBLOCK_INPUT; | 768 | unblock_input (); |
| 769 | } | 769 | } |
| 770 | 770 | ||
| 771 | /* Handle a SelectionRequest event EVENT. | 771 | /* Handle a SelectionRequest event EVENT. |
| @@ -1232,7 +1232,7 @@ x_get_foreign_selection (Lisp_Object selection_symbol, Lisp_Object target_type, | |||
| 1232 | if (! NILP (time_stamp)) | 1232 | if (! NILP (time_stamp)) |
| 1233 | CONS_TO_INTEGER (time_stamp, Time, requestor_time); | 1233 | CONS_TO_INTEGER (time_stamp, Time, requestor_time); |
| 1234 | 1234 | ||
| 1235 | BLOCK_INPUT; | 1235 | block_input (); |
| 1236 | TRACE2 ("Get selection %s, type %s", | 1236 | TRACE2 ("Get selection %s, type %s", |
| 1237 | XGetAtomName (display, type_atom), | 1237 | XGetAtomName (display, type_atom), |
| 1238 | XGetAtomName (display, target_property)); | 1238 | XGetAtomName (display, target_property)); |
| @@ -1257,7 +1257,7 @@ x_get_foreign_selection (Lisp_Object selection_symbol, Lisp_Object target_type, | |||
| 1257 | record_unwind_protect (queue_selection_requests_unwind, Qnil); | 1257 | record_unwind_protect (queue_selection_requests_unwind, Qnil); |
| 1258 | #endif | 1258 | #endif |
| 1259 | 1259 | ||
| 1260 | UNBLOCK_INPUT; | 1260 | unblock_input (); |
| 1261 | 1261 | ||
| 1262 | /* This allows quits. Also, don't wait forever. */ | 1262 | /* This allows quits. Also, don't wait forever. */ |
| 1263 | timeout = max (0, x_selection_timeout); | 1263 | timeout = max (0, x_selection_timeout); |
| @@ -1309,7 +1309,7 @@ x_get_window_property (Display *display, Window window, Atom property, | |||
| 1309 | ? min (PTRDIFF_MAX, SIZE_MAX) - 1 | 1309 | ? min (PTRDIFF_MAX, SIZE_MAX) - 1 |
| 1310 | : LONG_MAX * x_long_size); | 1310 | : LONG_MAX * x_long_size); |
| 1311 | 1311 | ||
| 1312 | BLOCK_INPUT; | 1312 | block_input (); |
| 1313 | 1313 | ||
| 1314 | /* First probe the thing to find out how big it is. */ | 1314 | /* First probe the thing to find out how big it is. */ |
| 1315 | result = XGetWindowProperty (display, window, property, | 1315 | result = XGetWindowProperty (display, window, property, |
| @@ -1410,19 +1410,19 @@ x_get_window_property (Display *display, Window window, Atom property, | |||
| 1410 | data[offset] = '\0'; | 1410 | data[offset] = '\0'; |
| 1411 | 1411 | ||
| 1412 | done: | 1412 | done: |
| 1413 | UNBLOCK_INPUT; | 1413 | unblock_input (); |
| 1414 | *data_ret = data; | 1414 | *data_ret = data; |
| 1415 | *bytes_ret = offset; | 1415 | *bytes_ret = offset; |
| 1416 | return; | 1416 | return; |
| 1417 | 1417 | ||
| 1418 | size_overflow: | 1418 | size_overflow: |
| 1419 | free (data); | 1419 | free (data); |
| 1420 | UNBLOCK_INPUT; | 1420 | unblock_input (); |
| 1421 | memory_full (SIZE_MAX); | 1421 | memory_full (SIZE_MAX); |
| 1422 | 1422 | ||
| 1423 | memory_exhausted: | 1423 | memory_exhausted: |
| 1424 | free (data); | 1424 | free (data); |
| 1425 | UNBLOCK_INPUT; | 1425 | unblock_input (); |
| 1426 | memory_full (total_size + 1); | 1426 | memory_full (total_size + 1); |
| 1427 | } | 1427 | } |
| 1428 | 1428 | ||
| @@ -1454,7 +1454,7 @@ receive_incremental_selection (Display *display, Window window, Atom property, | |||
| 1454 | that property, then reading the property, then deleting it to ack. | 1454 | that property, then reading the property, then deleting it to ack. |
| 1455 | We are done when the sender places a property of length 0. | 1455 | We are done when the sender places a property of length 0. |
| 1456 | */ | 1456 | */ |
| 1457 | BLOCK_INPUT; | 1457 | block_input (); |
| 1458 | XSelectInput (display, window, STANDARD_EVENT_SET | PropertyChangeMask); | 1458 | XSelectInput (display, window, STANDARD_EVENT_SET | PropertyChangeMask); |
| 1459 | TRACE1 (" Delete property %s", | 1459 | TRACE1 (" Delete property %s", |
| 1460 | SDATA (SYMBOL_NAME (x_atom_to_symbol (display, property)))); | 1460 | SDATA (SYMBOL_NAME (x_atom_to_symbol (display, property)))); |
| @@ -1464,7 +1464,7 @@ receive_incremental_selection (Display *display, Window window, Atom property, | |||
| 1464 | wait_object = expect_property_change (display, window, property, | 1464 | wait_object = expect_property_change (display, window, property, |
| 1465 | PropertyNewValue); | 1465 | PropertyNewValue); |
| 1466 | XFlush (display); | 1466 | XFlush (display); |
| 1467 | UNBLOCK_INPUT; | 1467 | unblock_input (); |
| 1468 | 1468 | ||
| 1469 | while (1) | 1469 | while (1) |
| 1470 | { | 1470 | { |
| @@ -1496,14 +1496,14 @@ receive_incremental_selection (Display *display, Window window, Atom property, | |||
| 1496 | break; | 1496 | break; |
| 1497 | } | 1497 | } |
| 1498 | 1498 | ||
| 1499 | BLOCK_INPUT; | 1499 | block_input (); |
| 1500 | TRACE1 (" ACK by deleting property %s", | 1500 | TRACE1 (" ACK by deleting property %s", |
| 1501 | XGetAtomName (display, property)); | 1501 | XGetAtomName (display, property)); |
| 1502 | XDeleteProperty (display, window, property); | 1502 | XDeleteProperty (display, window, property); |
| 1503 | wait_object = expect_property_change (display, window, property, | 1503 | wait_object = expect_property_change (display, window, property, |
| 1504 | PropertyNewValue); | 1504 | PropertyNewValue); |
| 1505 | XFlush (display); | 1505 | XFlush (display); |
| 1506 | UNBLOCK_INPUT; | 1506 | unblock_input (); |
| 1507 | 1507 | ||
| 1508 | if (*size_bytes_ret - offset < tmp_size_bytes) | 1508 | if (*size_bytes_ret - offset < tmp_size_bytes) |
| 1509 | *data_ret = xpalloc (*data_ret, size_bytes_ret, | 1509 | *data_ret = xpalloc (*data_ret, size_bytes_ret, |
| @@ -1545,10 +1545,10 @@ x_get_window_property_as_lisp_data (Display *display, Window window, | |||
| 1545 | if (! data) | 1545 | if (! data) |
| 1546 | { | 1546 | { |
| 1547 | int there_is_a_selection_owner; | 1547 | int there_is_a_selection_owner; |
| 1548 | BLOCK_INPUT; | 1548 | block_input (); |
| 1549 | there_is_a_selection_owner | 1549 | there_is_a_selection_owner |
| 1550 | = XGetSelectionOwner (display, selection_atom); | 1550 | = XGetSelectionOwner (display, selection_atom); |
| 1551 | UNBLOCK_INPUT; | 1551 | unblock_input (); |
| 1552 | if (there_is_a_selection_owner) | 1552 | if (there_is_a_selection_owner) |
| 1553 | signal_error ("Selection owner couldn't convert", | 1553 | signal_error ("Selection owner couldn't convert", |
| 1554 | actual_type | 1554 | actual_type |
| @@ -1565,22 +1565,22 @@ x_get_window_property_as_lisp_data (Display *display, Window window, | |||
| 1565 | /* That wasn't really the data, just the beginning. */ | 1565 | /* That wasn't really the data, just the beginning. */ |
| 1566 | 1566 | ||
| 1567 | unsigned int min_size_bytes = * ((unsigned int *) data); | 1567 | unsigned int min_size_bytes = * ((unsigned int *) data); |
| 1568 | BLOCK_INPUT; | 1568 | block_input (); |
| 1569 | /* Use xfree, not XFree, because x_get_window_property | 1569 | /* Use xfree, not XFree, because x_get_window_property |
| 1570 | calls xmalloc itself. */ | 1570 | calls xmalloc itself. */ |
| 1571 | xfree (data); | 1571 | xfree (data); |
| 1572 | UNBLOCK_INPUT; | 1572 | unblock_input (); |
| 1573 | receive_incremental_selection (display, window, property, target_type, | 1573 | receive_incremental_selection (display, window, property, target_type, |
| 1574 | min_size_bytes, &data, &bytes, | 1574 | min_size_bytes, &data, &bytes, |
| 1575 | &actual_type, &actual_format, | 1575 | &actual_type, &actual_format, |
| 1576 | &actual_size); | 1576 | &actual_size); |
| 1577 | } | 1577 | } |
| 1578 | 1578 | ||
| 1579 | BLOCK_INPUT; | 1579 | block_input (); |
| 1580 | TRACE1 (" Delete property %s", XGetAtomName (display, property)); | 1580 | TRACE1 (" Delete property %s", XGetAtomName (display, property)); |
| 1581 | XDeleteProperty (display, window, property); | 1581 | XDeleteProperty (display, window, property); |
| 1582 | XFlush (display); | 1582 | XFlush (display); |
| 1583 | UNBLOCK_INPUT; | 1583 | unblock_input (); |
| 1584 | 1584 | ||
| 1585 | /* It's been read. Now convert it to a lisp object in some semi-rational | 1585 | /* It's been read. Now convert it to a lisp object in some semi-rational |
| 1586 | manner. */ | 1586 | manner. */ |
| @@ -2096,13 +2096,13 @@ On MS-DOS, all this does is return non-nil if we own the selection. */) | |||
| 2096 | 2096 | ||
| 2097 | selection_atom = symbol_to_x_atom (dpyinfo, selection); | 2097 | selection_atom = symbol_to_x_atom (dpyinfo, selection); |
| 2098 | 2098 | ||
| 2099 | BLOCK_INPUT; | 2099 | block_input (); |
| 2100 | if (NILP (time_object)) | 2100 | if (NILP (time_object)) |
| 2101 | timestamp = last_event_timestamp; | 2101 | timestamp = last_event_timestamp; |
| 2102 | else | 2102 | else |
| 2103 | CONS_TO_INTEGER (time_object, Time, timestamp); | 2103 | CONS_TO_INTEGER (time_object, Time, timestamp); |
| 2104 | XSetSelectionOwner (dpyinfo->display, selection_atom, None, timestamp); | 2104 | XSetSelectionOwner (dpyinfo->display, selection_atom, None, timestamp); |
| 2105 | UNBLOCK_INPUT; | 2105 | unblock_input (); |
| 2106 | 2106 | ||
| 2107 | /* It doesn't seem to be guaranteed that a SelectionClear event will be | 2107 | /* It doesn't seem to be guaranteed that a SelectionClear event will be |
| 2108 | generated for a window which owns the selection when that window sets | 2108 | generated for a window which owns the selection when that window sets |
| @@ -2179,9 +2179,9 @@ On Nextstep, TERMINAL is unused. */) | |||
| 2179 | 2179 | ||
| 2180 | atom = symbol_to_x_atom (dpyinfo, selection); | 2180 | atom = symbol_to_x_atom (dpyinfo, selection); |
| 2181 | if (atom == 0) return Qnil; | 2181 | if (atom == 0) return Qnil; |
| 2182 | BLOCK_INPUT; | 2182 | block_input (); |
| 2183 | owner = XGetSelectionOwner (dpyinfo->display, atom); | 2183 | owner = XGetSelectionOwner (dpyinfo->display, atom); |
| 2184 | UNBLOCK_INPUT; | 2184 | unblock_input (); |
| 2185 | return (owner ? Qt : Qnil); | 2185 | return (owner ? Qt : Qnil); |
| 2186 | } | 2186 | } |
| 2187 | 2187 | ||
| @@ -2353,9 +2353,9 @@ x_fill_property_data (Display *dpy, Lisp_Object data, void *ret, int format) | |||
| 2353 | val = cons_to_signed (o, LONG_MIN, LONG_MAX); | 2353 | val = cons_to_signed (o, LONG_MIN, LONG_MAX); |
| 2354 | else if (STRINGP (o)) | 2354 | else if (STRINGP (o)) |
| 2355 | { | 2355 | { |
| 2356 | BLOCK_INPUT; | 2356 | block_input (); |
| 2357 | val = (long) XInternAtom (dpy, SSDATA (o), False); | 2357 | val = (long) XInternAtom (dpy, SSDATA (o), False); |
| 2358 | UNBLOCK_INPUT; | 2358 | unblock_input (); |
| 2359 | } | 2359 | } |
| 2360 | else | 2360 | else |
| 2361 | error ("Wrong type, must be string, number or cons"); | 2361 | error ("Wrong type, must be string, number or cons"); |
| @@ -2413,7 +2413,7 @@ mouse_position_for_drop (FRAME_PTR f, int *x, int *y) | |||
| 2413 | Window root, dummy_window; | 2413 | Window root, dummy_window; |
| 2414 | int dummy; | 2414 | int dummy; |
| 2415 | 2415 | ||
| 2416 | BLOCK_INPUT; | 2416 | block_input (); |
| 2417 | 2417 | ||
| 2418 | XQueryPointer (FRAME_X_DISPLAY (f), | 2418 | XQueryPointer (FRAME_X_DISPLAY (f), |
| 2419 | DefaultRootWindow (FRAME_X_DISPLAY (f)), | 2419 | DefaultRootWindow (FRAME_X_DISPLAY (f)), |
| @@ -2439,7 +2439,7 @@ mouse_position_for_drop (FRAME_PTR f, int *x, int *y) | |||
| 2439 | *x -= f->left_pos + FRAME_OUTER_TO_INNER_DIFF_X (f); | 2439 | *x -= f->left_pos + FRAME_OUTER_TO_INNER_DIFF_X (f); |
| 2440 | *y -= f->top_pos + FRAME_OUTER_TO_INNER_DIFF_Y (f); | 2440 | *y -= f->top_pos + FRAME_OUTER_TO_INNER_DIFF_Y (f); |
| 2441 | 2441 | ||
| 2442 | UNBLOCK_INPUT; | 2442 | unblock_input (); |
| 2443 | } | 2443 | } |
| 2444 | 2444 | ||
| 2445 | DEFUN ("x-get-atom-name", Fx_get_atom_name, | 2445 | DEFUN ("x-get-atom-name", Fx_get_atom_name, |
| @@ -2462,7 +2462,7 @@ If the value is 0 or the atom is not known, return the empty string. */) | |||
| 2462 | 2462 | ||
| 2463 | CONS_TO_INTEGER (value, Atom, atom); | 2463 | CONS_TO_INTEGER (value, Atom, atom); |
| 2464 | 2464 | ||
| 2465 | BLOCK_INPUT; | 2465 | block_input (); |
| 2466 | x_catch_errors (dpy); | 2466 | x_catch_errors (dpy); |
| 2467 | name = atom ? XGetAtomName (dpy, atom) : empty; | 2467 | name = atom ? XGetAtomName (dpy, atom) : empty; |
| 2468 | had_errors = x_had_errors_p (dpy); | 2468 | had_errors = x_had_errors_p (dpy); |
| @@ -2474,7 +2474,7 @@ If the value is 0 or the atom is not known, return the empty string. */) | |||
| 2474 | if (atom && name) XFree (name); | 2474 | if (atom && name) XFree (name); |
| 2475 | if (NILP (ret)) ret = empty_unibyte_string; | 2475 | if (NILP (ret)) ret = empty_unibyte_string; |
| 2476 | 2476 | ||
| 2477 | UNBLOCK_INPUT; | 2477 | unblock_input (); |
| 2478 | 2478 | ||
| 2479 | return ret; | 2479 | return ret; |
| 2480 | } | 2480 | } |
| @@ -2496,9 +2496,9 @@ FRAME is on. If FRAME is nil, the selected frame is used. */) | |||
| 2496 | x_atom = symbol_to_x_atom (dpyinfo, atom); | 2496 | x_atom = symbol_to_x_atom (dpyinfo, atom); |
| 2497 | else if (STRINGP (atom)) | 2497 | else if (STRINGP (atom)) |
| 2498 | { | 2498 | { |
| 2499 | BLOCK_INPUT; | 2499 | block_input (); |
| 2500 | x_atom = XInternAtom (FRAME_X_DISPLAY (f), SSDATA (atom), False); | 2500 | x_atom = XInternAtom (FRAME_X_DISPLAY (f), SSDATA (atom), False); |
| 2501 | UNBLOCK_INPUT; | 2501 | unblock_input (); |
| 2502 | } | 2502 | } |
| 2503 | else | 2503 | else |
| 2504 | error ("ATOM must be a symbol or a string"); | 2504 | error ("ATOM must be a symbol or a string"); |
| @@ -2657,7 +2657,7 @@ x_send_client_event (Lisp_Object display, Lisp_Object dest, Lisp_Object from, | |||
| 2657 | if (wdest == 0) wdest = dpyinfo->root_window; | 2657 | if (wdest == 0) wdest = dpyinfo->root_window; |
| 2658 | to_root = wdest == dpyinfo->root_window; | 2658 | to_root = wdest == dpyinfo->root_window; |
| 2659 | 2659 | ||
| 2660 | BLOCK_INPUT; | 2660 | block_input (); |
| 2661 | 2661 | ||
| 2662 | event.xclient.message_type = message_type; | 2662 | event.xclient.message_type = message_type; |
| 2663 | event.xclient.display = dpyinfo->display; | 2663 | event.xclient.display = dpyinfo->display; |
| @@ -2683,7 +2683,7 @@ x_send_client_event (Lisp_Object display, Lisp_Object dest, Lisp_Object from, | |||
| 2683 | XFlush (dpyinfo->display); | 2683 | XFlush (dpyinfo->display); |
| 2684 | } | 2684 | } |
| 2685 | x_uncatch_errors (); | 2685 | x_uncatch_errors (); |
| 2686 | UNBLOCK_INPUT; | 2686 | unblock_input (); |
| 2687 | } | 2687 | } |
| 2688 | 2688 | ||
| 2689 | 2689 | ||
diff --git a/src/xsettings.c b/src/xsettings.c index 58c84495489..7c68ff295cf 100644 --- a/src/xsettings.c +++ b/src/xsettings.c | |||
| @@ -929,7 +929,7 @@ init_xsettings (struct x_display_info *dpyinfo) | |||
| 929 | { | 929 | { |
| 930 | Display *dpy = dpyinfo->display; | 930 | Display *dpy = dpyinfo->display; |
| 931 | 931 | ||
| 932 | BLOCK_INPUT; | 932 | block_input (); |
| 933 | 933 | ||
| 934 | /* Select events so we can detect client messages sent when selection | 934 | /* Select events so we can detect client messages sent when selection |
| 935 | owner changes. */ | 935 | owner changes. */ |
| @@ -939,7 +939,7 @@ init_xsettings (struct x_display_info *dpyinfo) | |||
| 939 | if (dpyinfo->xsettings_window != None) | 939 | if (dpyinfo->xsettings_window != None) |
| 940 | read_and_apply_settings (dpyinfo, False); | 940 | read_and_apply_settings (dpyinfo, False); |
| 941 | 941 | ||
| 942 | UNBLOCK_INPUT; | 942 | unblock_input (); |
| 943 | } | 943 | } |
| 944 | 944 | ||
| 945 | void | 945 | void |
diff --git a/src/xterm.c b/src/xterm.c index 8c955d0e576..5b34cc39815 100644 --- a/src/xterm.c +++ b/src/xterm.c | |||
| @@ -353,7 +353,7 @@ x_flush (struct frame *f) | |||
| 353 | if (!NILP (Vinhibit_redisplay)) | 353 | if (!NILP (Vinhibit_redisplay)) |
| 354 | return; | 354 | return; |
| 355 | 355 | ||
| 356 | BLOCK_INPUT; | 356 | block_input (); |
| 357 | if (f == NULL) | 357 | if (f == NULL) |
| 358 | { | 358 | { |
| 359 | Lisp_Object rest, frame; | 359 | Lisp_Object rest, frame; |
| @@ -363,7 +363,7 @@ x_flush (struct frame *f) | |||
| 363 | } | 363 | } |
| 364 | else if (FRAME_X_P (f)) | 364 | else if (FRAME_X_P (f)) |
| 365 | XFlush (FRAME_X_DISPLAY (f)); | 365 | XFlush (FRAME_X_DISPLAY (f)); |
| 366 | UNBLOCK_INPUT; | 366 | unblock_input (); |
| 367 | } | 367 | } |
| 368 | 368 | ||
| 369 | 369 | ||
| @@ -564,7 +564,7 @@ x_update_window_begin (struct window *w) | |||
| 564 | updated_window = w; | 564 | updated_window = w; |
| 565 | set_output_cursor (&w->cursor); | 565 | set_output_cursor (&w->cursor); |
| 566 | 566 | ||
| 567 | BLOCK_INPUT; | 567 | block_input (); |
| 568 | 568 | ||
| 569 | if (f == hlinfo->mouse_face_mouse_frame) | 569 | if (f == hlinfo->mouse_face_mouse_frame) |
| 570 | { | 570 | { |
| @@ -577,7 +577,7 @@ x_update_window_begin (struct window *w) | |||
| 577 | hlinfo->mouse_face_window = Qnil; | 577 | hlinfo->mouse_face_window = Qnil; |
| 578 | } | 578 | } |
| 579 | 579 | ||
| 580 | UNBLOCK_INPUT; | 580 | unblock_input (); |
| 581 | } | 581 | } |
| 582 | 582 | ||
| 583 | 583 | ||
| @@ -618,7 +618,7 @@ x_update_window_end (struct window *w, int cursor_on_p, int mouse_face_overwritt | |||
| 618 | 618 | ||
| 619 | if (!w->pseudo_window_p) | 619 | if (!w->pseudo_window_p) |
| 620 | { | 620 | { |
| 621 | BLOCK_INPUT; | 621 | block_input (); |
| 622 | 622 | ||
| 623 | if (cursor_on_p) | 623 | if (cursor_on_p) |
| 624 | display_and_set_cursor (w, 1, output_cursor.hpos, | 624 | display_and_set_cursor (w, 1, output_cursor.hpos, |
| @@ -628,7 +628,7 @@ x_update_window_end (struct window *w, int cursor_on_p, int mouse_face_overwritt | |||
| 628 | if (draw_window_fringes (w, 1)) | 628 | if (draw_window_fringes (w, 1)) |
| 629 | x_draw_vertical_border (w); | 629 | x_draw_vertical_border (w); |
| 630 | 630 | ||
| 631 | UNBLOCK_INPUT; | 631 | unblock_input (); |
| 632 | } | 632 | } |
| 633 | 633 | ||
| 634 | /* If a row with mouse-face was overwritten, arrange for | 634 | /* If a row with mouse-face was overwritten, arrange for |
| @@ -654,9 +654,9 @@ x_update_end (struct frame *f) | |||
| 654 | MOUSE_HL_INFO (f)->mouse_face_defer = 0; | 654 | MOUSE_HL_INFO (f)->mouse_face_defer = 0; |
| 655 | 655 | ||
| 656 | #ifndef XFlush | 656 | #ifndef XFlush |
| 657 | BLOCK_INPUT; | 657 | block_input (); |
| 658 | XFlush (FRAME_X_DISPLAY (f)); | 658 | XFlush (FRAME_X_DISPLAY (f)); |
| 659 | UNBLOCK_INPUT; | 659 | unblock_input (); |
| 660 | #endif | 660 | #endif |
| 661 | } | 661 | } |
| 662 | 662 | ||
| @@ -675,13 +675,13 @@ XTframe_up_to_date (struct frame *f) | |||
| 675 | if (hlinfo->mouse_face_deferred_gc | 675 | if (hlinfo->mouse_face_deferred_gc |
| 676 | || f == hlinfo->mouse_face_mouse_frame) | 676 | || f == hlinfo->mouse_face_mouse_frame) |
| 677 | { | 677 | { |
| 678 | BLOCK_INPUT; | 678 | block_input (); |
| 679 | if (hlinfo->mouse_face_mouse_frame) | 679 | if (hlinfo->mouse_face_mouse_frame) |
| 680 | note_mouse_highlight (hlinfo->mouse_face_mouse_frame, | 680 | note_mouse_highlight (hlinfo->mouse_face_mouse_frame, |
| 681 | hlinfo->mouse_face_mouse_x, | 681 | hlinfo->mouse_face_mouse_x, |
| 682 | hlinfo->mouse_face_mouse_y); | 682 | hlinfo->mouse_face_mouse_y); |
| 683 | hlinfo->mouse_face_deferred_gc = 0; | 683 | hlinfo->mouse_face_deferred_gc = 0; |
| 684 | UNBLOCK_INPUT; | 684 | unblock_input (); |
| 685 | } | 685 | } |
| 686 | } | 686 | } |
| 687 | } | 687 | } |
| @@ -722,13 +722,13 @@ x_after_update_window_line (struct glyph_row *desired_row) | |||
| 722 | { | 722 | { |
| 723 | int y = WINDOW_TO_FRAME_PIXEL_Y (w, max (0, desired_row->y)); | 723 | int y = WINDOW_TO_FRAME_PIXEL_Y (w, max (0, desired_row->y)); |
| 724 | 724 | ||
| 725 | BLOCK_INPUT; | 725 | block_input (); |
| 726 | x_clear_area (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), | 726 | x_clear_area (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), |
| 727 | 0, y, width, height, False); | 727 | 0, y, width, height, False); |
| 728 | x_clear_area (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), | 728 | x_clear_area (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), |
| 729 | FRAME_PIXEL_WIDTH (f) - width, | 729 | FRAME_PIXEL_WIDTH (f) - width, |
| 730 | y, width, height, False); | 730 | y, width, height, False); |
| 731 | UNBLOCK_INPUT; | 731 | unblock_input (); |
| 732 | } | 732 | } |
| 733 | } | 733 | } |
| 734 | 734 | ||
| @@ -1789,10 +1789,10 @@ x_copy_color (struct frame *f, long unsigned int pixel) | |||
| 1789 | XColor color; | 1789 | XColor color; |
| 1790 | 1790 | ||
| 1791 | color.pixel = pixel; | 1791 | color.pixel = pixel; |
| 1792 | BLOCK_INPUT; | 1792 | block_input (); |
| 1793 | x_query_color (f, &color); | 1793 | x_query_color (f, &color); |
| 1794 | XAllocColor (FRAME_X_DISPLAY (f), FRAME_X_COLORMAP (f), &color); | 1794 | XAllocColor (FRAME_X_DISPLAY (f), FRAME_X_COLORMAP (f), &color); |
| 1795 | UNBLOCK_INPUT; | 1795 | unblock_input (); |
| 1796 | #ifdef DEBUG_X_COLORS | 1796 | #ifdef DEBUG_X_COLORS |
| 1797 | register_color (pixel); | 1797 | register_color (pixel); |
| 1798 | #endif | 1798 | #endif |
| @@ -3028,7 +3028,7 @@ x_clear_frame (struct frame *f) | |||
| 3028 | 3028 | ||
| 3029 | /* We don't set the output cursor here because there will always | 3029 | /* We don't set the output cursor here because there will always |
| 3030 | follow an explicit cursor_to. */ | 3030 | follow an explicit cursor_to. */ |
| 3031 | BLOCK_INPUT; | 3031 | block_input (); |
| 3032 | 3032 | ||
| 3033 | XClearWindow (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f)); | 3033 | XClearWindow (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f)); |
| 3034 | 3034 | ||
| @@ -3045,7 +3045,7 @@ x_clear_frame (struct frame *f) | |||
| 3045 | 3045 | ||
| 3046 | XFlush (FRAME_X_DISPLAY (f)); | 3046 | XFlush (FRAME_X_DISPLAY (f)); |
| 3047 | 3047 | ||
| 3048 | UNBLOCK_INPUT; | 3048 | unblock_input (); |
| 3049 | } | 3049 | } |
| 3050 | 3050 | ||
| 3051 | 3051 | ||
| @@ -3055,7 +3055,7 @@ x_clear_frame (struct frame *f) | |||
| 3055 | static void | 3055 | static void |
| 3056 | XTflash (struct frame *f) | 3056 | XTflash (struct frame *f) |
| 3057 | { | 3057 | { |
| 3058 | BLOCK_INPUT; | 3058 | block_input (); |
| 3059 | 3059 | ||
| 3060 | { | 3060 | { |
| 3061 | #ifdef USE_GTK | 3061 | #ifdef USE_GTK |
| @@ -3208,14 +3208,14 @@ XTflash (struct frame *f) | |||
| 3208 | } | 3208 | } |
| 3209 | } | 3209 | } |
| 3210 | 3210 | ||
| 3211 | UNBLOCK_INPUT; | 3211 | unblock_input (); |
| 3212 | } | 3212 | } |
| 3213 | 3213 | ||
| 3214 | 3214 | ||
| 3215 | static void | 3215 | static void |
| 3216 | XTtoggle_invisible_pointer (FRAME_PTR f, int invisible) | 3216 | XTtoggle_invisible_pointer (FRAME_PTR f, int invisible) |
| 3217 | { | 3217 | { |
| 3218 | BLOCK_INPUT; | 3218 | block_input (); |
| 3219 | if (invisible) | 3219 | if (invisible) |
| 3220 | { | 3220 | { |
| 3221 | if (FRAME_X_DISPLAY_INFO (f)->invisible_cursor != 0) | 3221 | if (FRAME_X_DISPLAY_INFO (f)->invisible_cursor != 0) |
| @@ -3226,7 +3226,7 @@ XTtoggle_invisible_pointer (FRAME_PTR f, int invisible) | |||
| 3226 | XDefineCursor (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), | 3226 | XDefineCursor (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), |
| 3227 | f->output_data.x->current_cursor); | 3227 | f->output_data.x->current_cursor); |
| 3228 | f->pointer_invisible = invisible; | 3228 | f->pointer_invisible = invisible; |
| 3229 | UNBLOCK_INPUT; | 3229 | unblock_input (); |
| 3230 | } | 3230 | } |
| 3231 | 3231 | ||
| 3232 | 3232 | ||
| @@ -3241,10 +3241,10 @@ XTring_bell (struct frame *f) | |||
| 3241 | XTflash (f); | 3241 | XTflash (f); |
| 3242 | else | 3242 | else |
| 3243 | { | 3243 | { |
| 3244 | BLOCK_INPUT; | 3244 | block_input (); |
| 3245 | XBell (FRAME_X_DISPLAY (f), 0); | 3245 | XBell (FRAME_X_DISPLAY (f), 0); |
| 3246 | XFlush (FRAME_X_DISPLAY (f)); | 3246 | XFlush (FRAME_X_DISPLAY (f)); |
| 3247 | UNBLOCK_INPUT; | 3247 | unblock_input (); |
| 3248 | } | 3248 | } |
| 3249 | } | 3249 | } |
| 3250 | } | 3250 | } |
| @@ -3341,7 +3341,7 @@ x_scroll_run (struct window *w, struct run *run) | |||
| 3341 | height = run->height; | 3341 | height = run->height; |
| 3342 | } | 3342 | } |
| 3343 | 3343 | ||
| 3344 | BLOCK_INPUT; | 3344 | block_input (); |
| 3345 | 3345 | ||
| 3346 | /* Cursor off. Will be switched on again in x_update_window_end. */ | 3346 | /* Cursor off. Will be switched on again in x_update_window_end. */ |
| 3347 | updated_window = w; | 3347 | updated_window = w; |
| @@ -3354,7 +3354,7 @@ x_scroll_run (struct window *w, struct run *run) | |||
| 3354 | width, height, | 3354 | width, height, |
| 3355 | x, to_y); | 3355 | x, to_y); |
| 3356 | 3356 | ||
| 3357 | UNBLOCK_INPUT; | 3357 | unblock_input (); |
| 3358 | } | 3358 | } |
| 3359 | 3359 | ||
| 3360 | 3360 | ||
| @@ -3371,7 +3371,7 @@ frame_highlight (struct frame *f) | |||
| 3371 | the ICCCM (section 4.1.6) says that the window's border pixmap | 3371 | the ICCCM (section 4.1.6) says that the window's border pixmap |
| 3372 | and border pixel are window attributes which are "private to the | 3372 | and border pixel are window attributes which are "private to the |
| 3373 | client", so we can always change it to whatever we want. */ | 3373 | client", so we can always change it to whatever we want. */ |
| 3374 | BLOCK_INPUT; | 3374 | block_input (); |
| 3375 | /* I recently started to get errors in this XSetWindowBorder, depending on | 3375 | /* I recently started to get errors in this XSetWindowBorder, depending on |
| 3376 | the window-manager in use, tho something more is at play since I've been | 3376 | the window-manager in use, tho something more is at play since I've been |
| 3377 | using that same window-manager binary for ever. Let's not crash just | 3377 | using that same window-manager binary for ever. Let's not crash just |
| @@ -3380,7 +3380,7 @@ frame_highlight (struct frame *f) | |||
| 3380 | XSetWindowBorder (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), | 3380 | XSetWindowBorder (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), |
| 3381 | f->output_data.x->border_pixel); | 3381 | f->output_data.x->border_pixel); |
| 3382 | x_uncatch_errors (); | 3382 | x_uncatch_errors (); |
| 3383 | UNBLOCK_INPUT; | 3383 | unblock_input (); |
| 3384 | x_update_cursor (f, 1); | 3384 | x_update_cursor (f, 1); |
| 3385 | x_set_frame_alpha (f); | 3385 | x_set_frame_alpha (f); |
| 3386 | } | 3386 | } |
| @@ -3392,13 +3392,13 @@ frame_unhighlight (struct frame *f) | |||
| 3392 | the ICCCM (section 4.1.6) says that the window's border pixmap | 3392 | the ICCCM (section 4.1.6) says that the window's border pixmap |
| 3393 | and border pixel are window attributes which are "private to the | 3393 | and border pixel are window attributes which are "private to the |
| 3394 | client", so we can always change it to whatever we want. */ | 3394 | client", so we can always change it to whatever we want. */ |
| 3395 | BLOCK_INPUT; | 3395 | block_input (); |
| 3396 | /* Same as above for XSetWindowBorder (bug#9310). */ | 3396 | /* Same as above for XSetWindowBorder (bug#9310). */ |
| 3397 | x_catch_errors (FRAME_X_DISPLAY (f)); | 3397 | x_catch_errors (FRAME_X_DISPLAY (f)); |
| 3398 | XSetWindowBorderPixmap (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), | 3398 | XSetWindowBorderPixmap (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), |
| 3399 | f->output_data.x->border_tile); | 3399 | f->output_data.x->border_tile); |
| 3400 | x_uncatch_errors (); | 3400 | x_uncatch_errors (); |
| 3401 | UNBLOCK_INPUT; | 3401 | unblock_input (); |
| 3402 | x_update_cursor (f, 1); | 3402 | x_update_cursor (f, 1); |
| 3403 | x_set_frame_alpha (f); | 3403 | x_set_frame_alpha (f); |
| 3404 | } | 3404 | } |
| @@ -3765,9 +3765,9 @@ x_get_keysym_name (int keysym) | |||
| 3765 | { | 3765 | { |
| 3766 | char *value; | 3766 | char *value; |
| 3767 | 3767 | ||
| 3768 | BLOCK_INPUT; | 3768 | block_input (); |
| 3769 | value = XKeysymToString (keysym); | 3769 | value = XKeysymToString (keysym); |
| 3770 | UNBLOCK_INPUT; | 3770 | unblock_input (); |
| 3771 | 3771 | ||
| 3772 | return value; | 3772 | return value; |
| 3773 | } | 3773 | } |
| @@ -3897,7 +3897,7 @@ XTmouse_position (FRAME_PTR *fp, int insist, Lisp_Object *bar_window, | |||
| 3897 | { | 3897 | { |
| 3898 | FRAME_PTR f1; | 3898 | FRAME_PTR f1; |
| 3899 | 3899 | ||
| 3900 | BLOCK_INPUT; | 3900 | block_input (); |
| 3901 | 3901 | ||
| 3902 | if (! NILP (last_mouse_scroll_bar) && insist == 0) | 3902 | if (! NILP (last_mouse_scroll_bar) && insist == 0) |
| 3903 | x_scroll_bar_report_motion (fp, bar_window, part, x, y, timestamp); | 3903 | x_scroll_bar_report_motion (fp, bar_window, part, x, y, timestamp); |
| @@ -4078,7 +4078,7 @@ XTmouse_position (FRAME_PTR *fp, int insist, Lisp_Object *bar_window, | |||
| 4078 | } | 4078 | } |
| 4079 | } | 4079 | } |
| 4080 | 4080 | ||
| 4081 | UNBLOCK_INPUT; | 4081 | unblock_input (); |
| 4082 | } | 4082 | } |
| 4083 | 4083 | ||
| 4084 | 4084 | ||
| @@ -4267,7 +4267,7 @@ x_send_scroll_bar_event (Lisp_Object window, int part, int portion, int whole) | |||
| 4267 | struct frame *f = XFRAME (w->frame); | 4267 | struct frame *f = XFRAME (w->frame); |
| 4268 | ptrdiff_t i; | 4268 | ptrdiff_t i; |
| 4269 | 4269 | ||
| 4270 | BLOCK_INPUT; | 4270 | block_input (); |
| 4271 | 4271 | ||
| 4272 | /* Construct a ClientMessage event to send to the frame. */ | 4272 | /* Construct a ClientMessage event to send to the frame. */ |
| 4273 | ev->type = ClientMessage; | 4273 | ev->type = ClientMessage; |
| @@ -4314,7 +4314,7 @@ x_send_scroll_bar_event (Lisp_Object window, int part, int portion, int whole) | |||
| 4314 | be sent to the client that created the window, and if that | 4314 | be sent to the client that created the window, and if that |
| 4315 | window no longer exists, no event will be sent. */ | 4315 | window no longer exists, no event will be sent. */ |
| 4316 | XSendEvent (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), False, 0, &event); | 4316 | XSendEvent (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), False, 0, &event); |
| 4317 | UNBLOCK_INPUT; | 4317 | unblock_input (); |
| 4318 | } | 4318 | } |
| 4319 | 4319 | ||
| 4320 | 4320 | ||
| @@ -4405,9 +4405,9 @@ xm_scroll_callback (Widget widget, XtPointer client_data, XtPointer call_data) | |||
| 4405 | int slider_size; | 4405 | int slider_size; |
| 4406 | 4406 | ||
| 4407 | /* Get the slider size. */ | 4407 | /* Get the slider size. */ |
| 4408 | BLOCK_INPUT; | 4408 | block_input (); |
| 4409 | XtVaGetValues (widget, XmNsliderSize, &slider_size, NULL); | 4409 | XtVaGetValues (widget, XmNsliderSize, &slider_size, NULL); |
| 4410 | UNBLOCK_INPUT; | 4410 | unblock_input (); |
| 4411 | 4411 | ||
| 4412 | whole = XM_SB_MAX - slider_size; | 4412 | whole = XM_SB_MAX - slider_size; |
| 4413 | portion = min (cs->value, whole); | 4413 | portion = min (cs->value, whole); |
| @@ -4528,9 +4528,9 @@ xaw_jump_callback (Widget widget, XtPointer client_data, XtPointer call_data) | |||
| 4528 | int part; | 4528 | int part; |
| 4529 | 4529 | ||
| 4530 | /* Get the size of the thumb, a value between 0 and 1. */ | 4530 | /* Get the size of the thumb, a value between 0 and 1. */ |
| 4531 | BLOCK_INPUT; | 4531 | block_input (); |
| 4532 | XtVaGetValues (widget, XtNshown, &shown, XtNheight, &height, NULL); | 4532 | XtVaGetValues (widget, XtNshown, &shown, XtNheight, &height, NULL); |
| 4533 | UNBLOCK_INPUT; | 4533 | unblock_input (); |
| 4534 | 4534 | ||
| 4535 | whole = 10000000; | 4535 | whole = 10000000; |
| 4536 | portion = shown < 1 ? top * whole : 0; | 4536 | portion = shown < 1 ? top * whole : 0; |
| @@ -4570,9 +4570,9 @@ xaw_scroll_callback (Widget widget, XtPointer client_data, XtPointer call_data) | |||
| 4570 | int part; | 4570 | int part; |
| 4571 | 4571 | ||
| 4572 | /* Get the height of the scroll bar. */ | 4572 | /* Get the height of the scroll bar. */ |
| 4573 | BLOCK_INPUT; | 4573 | block_input (); |
| 4574 | XtVaGetValues (widget, XtNheight, &height, NULL); | 4574 | XtVaGetValues (widget, XtNheight, &height, NULL); |
| 4575 | UNBLOCK_INPUT; | 4575 | unblock_input (); |
| 4576 | 4576 | ||
| 4577 | if (eabs (position) >= height) | 4577 | if (eabs (position) >= height) |
| 4578 | part = (position < 0) ? scroll_bar_above_handle : scroll_bar_below_handle; | 4578 | part = (position < 0) ? scroll_bar_above_handle : scroll_bar_below_handle; |
| @@ -4603,11 +4603,11 @@ x_create_toolkit_scroll_bar (struct frame *f, struct scroll_bar *bar) | |||
| 4603 | { | 4603 | { |
| 4604 | const char *scroll_bar_name = SCROLL_BAR_NAME; | 4604 | const char *scroll_bar_name = SCROLL_BAR_NAME; |
| 4605 | 4605 | ||
| 4606 | BLOCK_INPUT; | 4606 | block_input (); |
| 4607 | xg_create_scroll_bar (f, bar, G_CALLBACK (xg_scroll_callback), | 4607 | xg_create_scroll_bar (f, bar, G_CALLBACK (xg_scroll_callback), |
| 4608 | G_CALLBACK (xg_end_scroll_callback), | 4608 | G_CALLBACK (xg_end_scroll_callback), |
| 4609 | scroll_bar_name); | 4609 | scroll_bar_name); |
| 4610 | UNBLOCK_INPUT; | 4610 | unblock_input (); |
| 4611 | } | 4611 | } |
| 4612 | 4612 | ||
| 4613 | #else /* not USE_GTK */ | 4613 | #else /* not USE_GTK */ |
| @@ -4622,7 +4622,7 @@ x_create_toolkit_scroll_bar (struct frame *f, struct scroll_bar *bar) | |||
| 4622 | const char *scroll_bar_name = SCROLL_BAR_NAME; | 4622 | const char *scroll_bar_name = SCROLL_BAR_NAME; |
| 4623 | unsigned long pixel; | 4623 | unsigned long pixel; |
| 4624 | 4624 | ||
| 4625 | BLOCK_INPUT; | 4625 | block_input (); |
| 4626 | 4626 | ||
| 4627 | #ifdef USE_MOTIF | 4627 | #ifdef USE_MOTIF |
| 4628 | /* Set resources. Create the widget. */ | 4628 | /* Set resources. Create the widget. */ |
| @@ -4806,7 +4806,7 @@ x_create_toolkit_scroll_bar (struct frame *f, struct scroll_bar *bar) | |||
| 4806 | xwindow = XtWindow (widget); | 4806 | xwindow = XtWindow (widget); |
| 4807 | bar->x_window = xwindow; | 4807 | bar->x_window = xwindow; |
| 4808 | 4808 | ||
| 4809 | UNBLOCK_INPUT; | 4809 | unblock_input (); |
| 4810 | } | 4810 | } |
| 4811 | #endif /* not USE_GTK */ | 4811 | #endif /* not USE_GTK */ |
| 4812 | 4812 | ||
| @@ -4830,7 +4830,7 @@ x_set_toolkit_scroll_bar_thumb (struct scroll_bar *bar, int portion, int positio | |||
| 4830 | Widget widget = SCROLL_BAR_X_WIDGET (FRAME_X_DISPLAY (f), bar); | 4830 | Widget widget = SCROLL_BAR_X_WIDGET (FRAME_X_DISPLAY (f), bar); |
| 4831 | float top, shown; | 4831 | float top, shown; |
| 4832 | 4832 | ||
| 4833 | BLOCK_INPUT; | 4833 | block_input (); |
| 4834 | 4834 | ||
| 4835 | #ifdef USE_MOTIF | 4835 | #ifdef USE_MOTIF |
| 4836 | 4836 | ||
| @@ -4921,7 +4921,7 @@ x_set_toolkit_scroll_bar_thumb (struct scroll_bar *bar, int portion, int positio | |||
| 4921 | } | 4921 | } |
| 4922 | #endif /* !USE_MOTIF */ | 4922 | #endif /* !USE_MOTIF */ |
| 4923 | 4923 | ||
| 4924 | UNBLOCK_INPUT; | 4924 | unblock_input (); |
| 4925 | } | 4925 | } |
| 4926 | #endif /* not USE_GTK */ | 4926 | #endif /* not USE_GTK */ |
| 4927 | 4927 | ||
| @@ -4946,7 +4946,7 @@ x_scroll_bar_create (struct window *w, int top, int left, int width, int height) | |||
| 4946 | = ALLOCATE_PSEUDOVECTOR (struct scroll_bar, x_window, PVEC_OTHER); | 4946 | = ALLOCATE_PSEUDOVECTOR (struct scroll_bar, x_window, PVEC_OTHER); |
| 4947 | Lisp_Object barobj; | 4947 | Lisp_Object barobj; |
| 4948 | 4948 | ||
| 4949 | BLOCK_INPUT; | 4949 | block_input (); |
| 4950 | 4950 | ||
| 4951 | #ifdef USE_TOOLKIT_SCROLL_BARS | 4951 | #ifdef USE_TOOLKIT_SCROLL_BARS |
| 4952 | x_create_toolkit_scroll_bar (f, bar); | 4952 | x_create_toolkit_scroll_bar (f, bar); |
| @@ -5034,7 +5034,7 @@ x_scroll_bar_create (struct window *w, int top, int left, int width, int height) | |||
| 5034 | XMapRaised (FRAME_X_DISPLAY (f), bar->x_window); | 5034 | XMapRaised (FRAME_X_DISPLAY (f), bar->x_window); |
| 5035 | #endif /* not USE_TOOLKIT_SCROLL_BARS */ | 5035 | #endif /* not USE_TOOLKIT_SCROLL_BARS */ |
| 5036 | 5036 | ||
| 5037 | UNBLOCK_INPUT; | 5037 | unblock_input (); |
| 5038 | return bar; | 5038 | return bar; |
| 5039 | } | 5039 | } |
| 5040 | 5040 | ||
| @@ -5068,7 +5068,7 @@ x_scroll_bar_set_handle (struct scroll_bar *bar, int start, int end, int rebuild | |||
| 5068 | && end == bar->end) | 5068 | && end == bar->end) |
| 5069 | return; | 5069 | return; |
| 5070 | 5070 | ||
| 5071 | BLOCK_INPUT; | 5071 | block_input (); |
| 5072 | 5072 | ||
| 5073 | { | 5073 | { |
| 5074 | int inside_width = VERTICAL_SCROLL_BAR_INSIDE_WIDTH (f, bar->width); | 5074 | int inside_width = VERTICAL_SCROLL_BAR_INSIDE_WIDTH (f, bar->width); |
| @@ -5144,7 +5144,7 @@ x_scroll_bar_set_handle (struct scroll_bar *bar, int start, int end, int rebuild | |||
| 5144 | 5144 | ||
| 5145 | } | 5145 | } |
| 5146 | 5146 | ||
| 5147 | UNBLOCK_INPUT; | 5147 | unblock_input (); |
| 5148 | } | 5148 | } |
| 5149 | 5149 | ||
| 5150 | #endif /* !USE_TOOLKIT_SCROLL_BARS */ | 5150 | #endif /* !USE_TOOLKIT_SCROLL_BARS */ |
| @@ -5156,7 +5156,7 @@ static void | |||
| 5156 | x_scroll_bar_remove (struct scroll_bar *bar) | 5156 | x_scroll_bar_remove (struct scroll_bar *bar) |
| 5157 | { | 5157 | { |
| 5158 | struct frame *f = XFRAME (WINDOW_FRAME (XWINDOW (bar->window))); | 5158 | struct frame *f = XFRAME (WINDOW_FRAME (XWINDOW (bar->window))); |
| 5159 | BLOCK_INPUT; | 5159 | block_input (); |
| 5160 | 5160 | ||
| 5161 | #ifdef USE_TOOLKIT_SCROLL_BARS | 5161 | #ifdef USE_TOOLKIT_SCROLL_BARS |
| 5162 | #ifdef USE_GTK | 5162 | #ifdef USE_GTK |
| @@ -5171,7 +5171,7 @@ x_scroll_bar_remove (struct scroll_bar *bar) | |||
| 5171 | /* Dissociate this scroll bar from its window. */ | 5171 | /* Dissociate this scroll bar from its window. */ |
| 5172 | wset_vertical_scroll_bar (XWINDOW (bar->window), Qnil); | 5172 | wset_vertical_scroll_bar (XWINDOW (bar->window), Qnil); |
| 5173 | 5173 | ||
| 5174 | UNBLOCK_INPUT; | 5174 | unblock_input (); |
| 5175 | } | 5175 | } |
| 5176 | 5176 | ||
| 5177 | 5177 | ||
| @@ -5239,7 +5239,7 @@ XTset_vertical_scroll_bar (struct window *w, int portion, int whole, int positio | |||
| 5239 | { | 5239 | { |
| 5240 | if (width > 0 && height > 0) | 5240 | if (width > 0 && height > 0) |
| 5241 | { | 5241 | { |
| 5242 | BLOCK_INPUT; | 5242 | block_input (); |
| 5243 | #ifdef USE_TOOLKIT_SCROLL_BARS | 5243 | #ifdef USE_TOOLKIT_SCROLL_BARS |
| 5244 | if (fringe_extended_p) | 5244 | if (fringe_extended_p) |
| 5245 | x_clear_area (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), | 5245 | x_clear_area (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), |
| @@ -5248,7 +5248,7 @@ XTset_vertical_scroll_bar (struct window *w, int portion, int whole, int positio | |||
| 5248 | #endif | 5248 | #endif |
| 5249 | x_clear_area (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), | 5249 | x_clear_area (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), |
| 5250 | left, top, width, height, False); | 5250 | left, top, width, height, False); |
| 5251 | UNBLOCK_INPUT; | 5251 | unblock_input (); |
| 5252 | } | 5252 | } |
| 5253 | 5253 | ||
| 5254 | bar = x_scroll_bar_create (w, top, sb_left, sb_width, height); | 5254 | bar = x_scroll_bar_create (w, top, sb_left, sb_width, height); |
| @@ -5260,7 +5260,7 @@ XTset_vertical_scroll_bar (struct window *w, int portion, int whole, int positio | |||
| 5260 | 5260 | ||
| 5261 | bar = XSCROLL_BAR (w->vertical_scroll_bar); | 5261 | bar = XSCROLL_BAR (w->vertical_scroll_bar); |
| 5262 | 5262 | ||
| 5263 | BLOCK_INPUT; | 5263 | block_input (); |
| 5264 | 5264 | ||
| 5265 | if (sb_left != bar->left) | 5265 | if (sb_left != bar->left) |
| 5266 | mask |= CWX; | 5266 | mask |= CWX; |
| @@ -5357,7 +5357,7 @@ XTset_vertical_scroll_bar (struct window *w, int portion, int whole, int positio | |||
| 5357 | bar->width = sb_width; | 5357 | bar->width = sb_width; |
| 5358 | bar->height = height; | 5358 | bar->height = height; |
| 5359 | 5359 | ||
| 5360 | UNBLOCK_INPUT; | 5360 | unblock_input (); |
| 5361 | } | 5361 | } |
| 5362 | 5362 | ||
| 5363 | #ifdef USE_TOOLKIT_SCROLL_BARS | 5363 | #ifdef USE_TOOLKIT_SCROLL_BARS |
| @@ -5508,7 +5508,7 @@ x_scroll_bar_expose (struct scroll_bar *bar, XEvent *event) | |||
| 5508 | GC gc = f->output_data.x->normal_gc; | 5508 | GC gc = f->output_data.x->normal_gc; |
| 5509 | int width_trim = VERTICAL_SCROLL_BAR_WIDTH_TRIM; | 5509 | int width_trim = VERTICAL_SCROLL_BAR_WIDTH_TRIM; |
| 5510 | 5510 | ||
| 5511 | BLOCK_INPUT; | 5511 | block_input (); |
| 5512 | 5512 | ||
| 5513 | x_scroll_bar_set_handle (bar, bar->start, bar->end, 1); | 5513 | x_scroll_bar_set_handle (bar, bar->start, bar->end, 1); |
| 5514 | 5514 | ||
| @@ -5530,7 +5530,7 @@ x_scroll_bar_expose (struct scroll_bar *bar, XEvent *event) | |||
| 5530 | XSetForeground (FRAME_X_DISPLAY (f), gc, | 5530 | XSetForeground (FRAME_X_DISPLAY (f), gc, |
| 5531 | FRAME_FOREGROUND_PIXEL (f)); | 5531 | FRAME_FOREGROUND_PIXEL (f)); |
| 5532 | 5532 | ||
| 5533 | UNBLOCK_INPUT; | 5533 | unblock_input (); |
| 5534 | 5534 | ||
| 5535 | } | 5535 | } |
| 5536 | #endif /* not USE_TOOLKIT_SCROLL_BARS */ | 5536 | #endif /* not USE_TOOLKIT_SCROLL_BARS */ |
| @@ -5643,7 +5643,7 @@ x_scroll_bar_report_motion (FRAME_PTR *fp, Lisp_Object *bar_window, | |||
| 5643 | int dummy_coord; | 5643 | int dummy_coord; |
| 5644 | unsigned int dummy_mask; | 5644 | unsigned int dummy_mask; |
| 5645 | 5645 | ||
| 5646 | BLOCK_INPUT; | 5646 | block_input (); |
| 5647 | 5647 | ||
| 5648 | /* Get the mouse's position relative to the scroll bar window, and | 5648 | /* Get the mouse's position relative to the scroll bar window, and |
| 5649 | report that. */ | 5649 | report that. */ |
| @@ -5695,7 +5695,7 @@ x_scroll_bar_report_motion (FRAME_PTR *fp, Lisp_Object *bar_window, | |||
| 5695 | 5695 | ||
| 5696 | *timestamp = last_mouse_movement_time; | 5696 | *timestamp = last_mouse_movement_time; |
| 5697 | 5697 | ||
| 5698 | UNBLOCK_INPUT; | 5698 | unblock_input (); |
| 5699 | } | 5699 | } |
| 5700 | 5700 | ||
| 5701 | 5701 | ||
| @@ -5816,7 +5816,7 @@ event_handler_gdk (GdkXEvent *gxev, GdkEvent *ev, gpointer data) | |||
| 5816 | { | 5816 | { |
| 5817 | XEvent *xev = (XEvent *) gxev; | 5817 | XEvent *xev = (XEvent *) gxev; |
| 5818 | 5818 | ||
| 5819 | BLOCK_INPUT; | 5819 | block_input (); |
| 5820 | if (current_count >= 0) | 5820 | if (current_count >= 0) |
| 5821 | { | 5821 | { |
| 5822 | struct x_display_info *dpyinfo; | 5822 | struct x_display_info *dpyinfo; |
| @@ -5831,7 +5831,7 @@ event_handler_gdk (GdkXEvent *gxev, GdkEvent *ev, gpointer data) | |||
| 5831 | && dpyinfo | 5831 | && dpyinfo |
| 5832 | && x_filter_event (dpyinfo, xev)) | 5832 | && x_filter_event (dpyinfo, xev)) |
| 5833 | { | 5833 | { |
| 5834 | UNBLOCK_INPUT; | 5834 | unblock_input (); |
| 5835 | return GDK_FILTER_REMOVE; | 5835 | return GDK_FILTER_REMOVE; |
| 5836 | } | 5836 | } |
| 5837 | #endif | 5837 | #endif |
| @@ -5846,7 +5846,7 @@ event_handler_gdk (GdkXEvent *gxev, GdkEvent *ev, gpointer data) | |||
| 5846 | else | 5846 | else |
| 5847 | current_finish = x_dispatch_event (xev, xev->xany.display); | 5847 | current_finish = x_dispatch_event (xev, xev->xany.display); |
| 5848 | 5848 | ||
| 5849 | UNBLOCK_INPUT; | 5849 | unblock_input (); |
| 5850 | 5850 | ||
| 5851 | if (current_finish == X_EVENT_GOTO_OUT || current_finish == X_EVENT_DROP) | 5851 | if (current_finish == X_EVENT_GOTO_OUT || current_finish == X_EVENT_DROP) |
| 5852 | return GDK_FILTER_REMOVE; | 5852 | return GDK_FILTER_REMOVE; |
| @@ -7041,10 +7041,10 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr, | |||
| 7041 | default: | 7041 | default: |
| 7042 | OTHER: | 7042 | OTHER: |
| 7043 | #ifdef USE_X_TOOLKIT | 7043 | #ifdef USE_X_TOOLKIT |
| 7044 | BLOCK_INPUT; | 7044 | block_input (); |
| 7045 | if (*finish != X_EVENT_DROP) | 7045 | if (*finish != X_EVENT_DROP) |
| 7046 | XtDispatchEvent (&event); | 7046 | XtDispatchEvent (&event); |
| 7047 | UNBLOCK_INPUT; | 7047 | unblock_input (); |
| 7048 | #endif /* USE_X_TOOLKIT */ | 7048 | #endif /* USE_X_TOOLKIT */ |
| 7049 | break; | 7049 | break; |
| 7050 | } | 7050 | } |
| @@ -7122,16 +7122,7 @@ XTread_socket (struct terminal *terminal, struct input_event *hold_quit) | |||
| 7122 | int count = 0; | 7122 | int count = 0; |
| 7123 | int event_found = 0; | 7123 | int event_found = 0; |
| 7124 | 7124 | ||
| 7125 | if (interrupt_input_blocked) | 7125 | block_input (); |
| 7126 | { | ||
| 7127 | interrupt_input_pending = 1; | ||
| 7128 | pending_signals = 1; | ||
| 7129 | return -1; | ||
| 7130 | } | ||
| 7131 | |||
| 7132 | interrupt_input_pending = 0; | ||
| 7133 | pending_signals = pending_atimers; | ||
| 7134 | BLOCK_INPUT; | ||
| 7135 | 7126 | ||
| 7136 | /* So people can tell when we have read the available input. */ | 7127 | /* So people can tell when we have read the available input. */ |
| 7137 | input_signal_count++; | 7128 | input_signal_count++; |
| @@ -7224,7 +7215,7 @@ XTread_socket (struct terminal *terminal, struct input_event *hold_quit) | |||
| 7224 | pending_autoraise_frame = 0; | 7215 | pending_autoraise_frame = 0; |
| 7225 | } | 7216 | } |
| 7226 | 7217 | ||
| 7227 | UNBLOCK_INPUT; | 7218 | unblock_input (); |
| 7228 | 7219 | ||
| 7229 | return count; | 7220 | return count; |
| 7230 | } | 7221 | } |
| @@ -7660,7 +7651,7 @@ x_uncatch_errors (void) | |||
| 7660 | { | 7651 | { |
| 7661 | struct x_error_message_stack *tmp; | 7652 | struct x_error_message_stack *tmp; |
| 7662 | 7653 | ||
| 7663 | BLOCK_INPUT; | 7654 | block_input (); |
| 7664 | 7655 | ||
| 7665 | /* The display may have been closed before this function is called. | 7656 | /* The display may have been closed before this function is called. |
| 7666 | Check if it is still open before calling XSync. */ | 7657 | Check if it is still open before calling XSync. */ |
| @@ -7670,7 +7661,7 @@ x_uncatch_errors (void) | |||
| 7670 | tmp = x_error_message; | 7661 | tmp = x_error_message; |
| 7671 | x_error_message = x_error_message->prev; | 7662 | x_error_message = x_error_message->prev; |
| 7672 | xfree (tmp); | 7663 | xfree (tmp); |
| 7673 | UNBLOCK_INPUT; | 7664 | unblock_input (); |
| 7674 | } | 7665 | } |
| 7675 | 7666 | ||
| 7676 | /* If any X protocol errors have arrived since the last call to | 7667 | /* If any X protocol errors have arrived since the last call to |
| @@ -7733,26 +7724,6 @@ x_trace_wire (void) | |||
| 7733 | #endif /* ! 0 */ | 7724 | #endif /* ! 0 */ |
| 7734 | 7725 | ||
| 7735 | 7726 | ||
| 7736 | /* Handle SIGPIPE, which can happen when the connection to a server | ||
| 7737 | simply goes away. SIGPIPE is handled by x_connection_signal. | ||
| 7738 | Don't need to do anything, because the write which caused the | ||
| 7739 | SIGPIPE will fail, causing Xlib to invoke the X IO error handler, | ||
| 7740 | which will do the appropriate cleanup for us. */ | ||
| 7741 | |||
| 7742 | static void | ||
| 7743 | x_connection_signal (int signalnum) /* If we don't have an argument, */ | ||
| 7744 | /* some compilers complain in signal calls. */ | ||
| 7745 | { | ||
| 7746 | #ifdef USG | ||
| 7747 | /* USG systems forget handlers when they are used; | ||
| 7748 | must reestablish each time */ | ||
| 7749 | struct sigaction action; | ||
| 7750 | emacs_sigaction_init (&action, x_connection_signal); | ||
| 7751 | sigaction (signalnum, &action, 0); | ||
| 7752 | #endif /* USG */ | ||
| 7753 | } | ||
| 7754 | |||
| 7755 | |||
| 7756 | /************************************************************************ | 7727 | /************************************************************************ |
| 7757 | Handling X errors | 7728 | Handling X errors |
| 7758 | ************************************************************************/ | 7729 | ************************************************************************/ |
| @@ -7856,17 +7827,7 @@ For details, see etc/PROBLEMS.\n", | |||
| 7856 | /* NOTREACHED */ | 7827 | /* NOTREACHED */ |
| 7857 | } | 7828 | } |
| 7858 | 7829 | ||
| 7859 | /* Ordinary stack unwind doesn't deal with these. */ | 7830 | totally_unblock_input (); |
| 7860 | { | ||
| 7861 | sigset_t unblocked; | ||
| 7862 | sigemptyset (&unblocked); | ||
| 7863 | #ifdef USABLE_SIGIO | ||
| 7864 | sigaddset (&unblocked, SIGIO); | ||
| 7865 | #endif | ||
| 7866 | sigaddset (&unblocked, SIGALRM); | ||
| 7867 | pthread_sigmask (SIG_UNBLOCK, &unblocked, 0); | ||
| 7868 | } | ||
| 7869 | TOTALLY_UNBLOCK_INPUT; | ||
| 7870 | 7831 | ||
| 7871 | unbind_to (idx, Qnil); | 7832 | unbind_to (idx, Qnil); |
| 7872 | clear_waiting_for_input (); | 7833 | clear_waiting_for_input (); |
| @@ -8005,9 +7966,9 @@ x_new_font (struct frame *f, Lisp_Object font_object, int fontset) | |||
| 8005 | if (FRAME_XIC (f) | 7966 | if (FRAME_XIC (f) |
| 8006 | && (FRAME_XIC_STYLE (f) & (XIMPreeditPosition | XIMStatusArea))) | 7967 | && (FRAME_XIC_STYLE (f) & (XIMPreeditPosition | XIMStatusArea))) |
| 8007 | { | 7968 | { |
| 8008 | BLOCK_INPUT; | 7969 | block_input (); |
| 8009 | xic_set_xfontset (f, SSDATA (fontset_ascii (fontset))); | 7970 | xic_set_xfontset (f, SSDATA (fontset_ascii (fontset))); |
| 8010 | UNBLOCK_INPUT; | 7971 | unblock_input (); |
| 8011 | } | 7972 | } |
| 8012 | #endif | 7973 | #endif |
| 8013 | 7974 | ||
| @@ -8033,7 +7994,7 @@ xim_destroy_callback (XIM xim, XPointer client_data, XPointer call_data) | |||
| 8033 | struct x_display_info *dpyinfo = (struct x_display_info *) client_data; | 7994 | struct x_display_info *dpyinfo = (struct x_display_info *) client_data; |
| 8034 | Lisp_Object frame, tail; | 7995 | Lisp_Object frame, tail; |
| 8035 | 7996 | ||
| 8036 | BLOCK_INPUT; | 7997 | block_input (); |
| 8037 | 7998 | ||
| 8038 | /* No need to call XDestroyIC.. */ | 7999 | /* No need to call XDestroyIC.. */ |
| 8039 | FOR_EACH_FRAME (tail, frame) | 8000 | FOR_EACH_FRAME (tail, frame) |
| @@ -8049,7 +8010,7 @@ xim_destroy_callback (XIM xim, XPointer client_data, XPointer call_data) | |||
| 8049 | /* No need to call XCloseIM. */ | 8010 | /* No need to call XCloseIM. */ |
| 8050 | dpyinfo->xim = NULL; | 8011 | dpyinfo->xim = NULL; |
| 8051 | XFree (dpyinfo->xim_styles); | 8012 | XFree (dpyinfo->xim_styles); |
| 8052 | UNBLOCK_INPUT; | 8013 | unblock_input (); |
| 8053 | } | 8014 | } |
| 8054 | 8015 | ||
| 8055 | #endif /* HAVE_X11R6 */ | 8016 | #endif /* HAVE_X11R6 */ |
| @@ -8124,7 +8085,7 @@ xim_instantiate_callback (Display *display, XPointer client_data, XPointer call_ | |||
| 8124 | { | 8085 | { |
| 8125 | Lisp_Object tail, frame; | 8086 | Lisp_Object tail, frame; |
| 8126 | 8087 | ||
| 8127 | BLOCK_INPUT; | 8088 | block_input (); |
| 8128 | FOR_EACH_FRAME (tail, frame) | 8089 | FOR_EACH_FRAME (tail, frame) |
| 8129 | { | 8090 | { |
| 8130 | struct frame *f = XFRAME (frame); | 8091 | struct frame *f = XFRAME (frame); |
| @@ -8144,7 +8105,7 @@ xim_instantiate_callback (Display *display, XPointer client_data, XPointer call_ | |||
| 8144 | } | 8105 | } |
| 8145 | } | 8106 | } |
| 8146 | 8107 | ||
| 8147 | UNBLOCK_INPUT; | 8108 | unblock_input (); |
| 8148 | } | 8109 | } |
| 8149 | } | 8110 | } |
| 8150 | 8111 | ||
| @@ -8291,7 +8252,7 @@ x_set_offset (struct frame *f, register int xoff, register int yoff, int change_ | |||
| 8291 | } | 8252 | } |
| 8292 | x_calc_absolute_position (f); | 8253 | x_calc_absolute_position (f); |
| 8293 | 8254 | ||
| 8294 | BLOCK_INPUT; | 8255 | block_input (); |
| 8295 | x_wm_set_size_hint (f, (long) 0, 0); | 8256 | x_wm_set_size_hint (f, (long) 0, 0); |
| 8296 | 8257 | ||
| 8297 | modified_left = f->left_pos; | 8258 | modified_left = f->left_pos; |
| @@ -8330,7 +8291,7 @@ x_set_offset (struct frame *f, register int xoff, register int yoff, int change_ | |||
| 8330 | && FRAME_X_OUTPUT (f)->move_offset_top == 0)))) | 8291 | && FRAME_X_OUTPUT (f)->move_offset_top == 0)))) |
| 8331 | x_check_expected_move (f, modified_left, modified_top); | 8292 | x_check_expected_move (f, modified_left, modified_top); |
| 8332 | 8293 | ||
| 8333 | UNBLOCK_INPUT; | 8294 | unblock_input (); |
| 8334 | } | 8295 | } |
| 8335 | 8296 | ||
| 8336 | /* Return non-zero if _NET_SUPPORTING_WM_CHECK window exists and _NET_SUPPORTED | 8297 | /* Return non-zero if _NET_SUPPORTING_WM_CHECK window exists and _NET_SUPPORTED |
| @@ -8353,7 +8314,7 @@ wm_supports (struct frame *f, Atom want_atom) | |||
| 8353 | unsigned char *tmp_data = NULL; | 8314 | unsigned char *tmp_data = NULL; |
| 8354 | Atom target_type = XA_WINDOW; | 8315 | Atom target_type = XA_WINDOW; |
| 8355 | 8316 | ||
| 8356 | BLOCK_INPUT; | 8317 | block_input (); |
| 8357 | 8318 | ||
| 8358 | x_catch_errors (dpy); | 8319 | x_catch_errors (dpy); |
| 8359 | rc = XGetWindowProperty (dpy, target_window, | 8320 | rc = XGetWindowProperty (dpy, target_window, |
| @@ -8366,7 +8327,7 @@ wm_supports (struct frame *f, Atom want_atom) | |||
| 8366 | { | 8327 | { |
| 8367 | if (tmp_data) XFree (tmp_data); | 8328 | if (tmp_data) XFree (tmp_data); |
| 8368 | x_uncatch_errors (); | 8329 | x_uncatch_errors (); |
| 8369 | UNBLOCK_INPUT; | 8330 | unblock_input (); |
| 8370 | return 0; | 8331 | return 0; |
| 8371 | } | 8332 | } |
| 8372 | 8333 | ||
| @@ -8379,7 +8340,7 @@ wm_supports (struct frame *f, Atom want_atom) | |||
| 8379 | if (x_had_errors_p (dpy)) | 8340 | if (x_had_errors_p (dpy)) |
| 8380 | { | 8341 | { |
| 8381 | x_uncatch_errors (); | 8342 | x_uncatch_errors (); |
| 8382 | UNBLOCK_INPUT; | 8343 | unblock_input (); |
| 8383 | return 0; | 8344 | return 0; |
| 8384 | } | 8345 | } |
| 8385 | 8346 | ||
| @@ -8404,7 +8365,7 @@ wm_supports (struct frame *f, Atom want_atom) | |||
| 8404 | { | 8365 | { |
| 8405 | if (tmp_data) XFree (tmp_data); | 8366 | if (tmp_data) XFree (tmp_data); |
| 8406 | x_uncatch_errors (); | 8367 | x_uncatch_errors (); |
| 8407 | UNBLOCK_INPUT; | 8368 | unblock_input (); |
| 8408 | return 0; | 8369 | return 0; |
| 8409 | } | 8370 | } |
| 8410 | 8371 | ||
| @@ -8419,7 +8380,7 @@ wm_supports (struct frame *f, Atom want_atom) | |||
| 8419 | rc = dpyinfo->net_supported_atoms[i] == want_atom; | 8380 | rc = dpyinfo->net_supported_atoms[i] == want_atom; |
| 8420 | 8381 | ||
| 8421 | x_uncatch_errors (); | 8382 | x_uncatch_errors (); |
| 8422 | UNBLOCK_INPUT; | 8383 | unblock_input (); |
| 8423 | 8384 | ||
| 8424 | return rc; | 8385 | return rc; |
| 8425 | } | 8386 | } |
| @@ -8478,7 +8439,7 @@ get_current_wm_state (struct frame *f, | |||
| 8478 | *sticky = 0; | 8439 | *sticky = 0; |
| 8479 | *size_state = FULLSCREEN_NONE; | 8440 | *size_state = FULLSCREEN_NONE; |
| 8480 | 8441 | ||
| 8481 | BLOCK_INPUT; | 8442 | block_input (); |
| 8482 | x_catch_errors (dpy); | 8443 | x_catch_errors (dpy); |
| 8483 | rc = XGetWindowProperty (dpy, window, dpyinfo->Xatom_net_wm_state, | 8444 | rc = XGetWindowProperty (dpy, window, dpyinfo->Xatom_net_wm_state, |
| 8484 | 0, max_len, False, target_type, | 8445 | 0, max_len, False, target_type, |
| @@ -8489,7 +8450,7 @@ get_current_wm_state (struct frame *f, | |||
| 8489 | { | 8450 | { |
| 8490 | if (tmp_data) XFree (tmp_data); | 8451 | if (tmp_data) XFree (tmp_data); |
| 8491 | x_uncatch_errors (); | 8452 | x_uncatch_errors (); |
| 8492 | UNBLOCK_INPUT; | 8453 | unblock_input (); |
| 8493 | return ! f->iconified; | 8454 | return ! f->iconified; |
| 8494 | } | 8455 | } |
| 8495 | 8456 | ||
| @@ -8524,7 +8485,7 @@ get_current_wm_state (struct frame *f, | |||
| 8524 | } | 8485 | } |
| 8525 | 8486 | ||
| 8526 | if (tmp_data) XFree (tmp_data); | 8487 | if (tmp_data) XFree (tmp_data); |
| 8527 | UNBLOCK_INPUT; | 8488 | unblock_input (); |
| 8528 | return ! is_hidden; | 8489 | return ! is_hidden; |
| 8529 | } | 8490 | } |
| 8530 | 8491 | ||
| @@ -8604,10 +8565,10 @@ XTfullscreen_hook (FRAME_PTR f) | |||
| 8604 | { | 8565 | { |
| 8605 | if (f->async_visible) | 8566 | if (f->async_visible) |
| 8606 | { | 8567 | { |
| 8607 | BLOCK_INPUT; | 8568 | block_input (); |
| 8608 | x_check_fullscreen (f); | 8569 | x_check_fullscreen (f); |
| 8609 | x_sync (f); | 8570 | x_sync (f); |
| 8610 | UNBLOCK_INPUT; | 8571 | unblock_input (); |
| 8611 | } | 8572 | } |
| 8612 | } | 8573 | } |
| 8613 | 8574 | ||
| @@ -8792,10 +8753,10 @@ x_wait_for_event (struct frame *f, int eventtype) | |||
| 8792 | 8753 | ||
| 8793 | while (pending_event_wait.eventtype) | 8754 | while (pending_event_wait.eventtype) |
| 8794 | { | 8755 | { |
| 8795 | interrupt_input_pending = 1; | 8756 | pending_signals = 1; |
| 8796 | TOTALLY_UNBLOCK_INPUT; | 8757 | totally_unblock_input (); |
| 8797 | /* XTread_socket is called after unblock. */ | 8758 | /* XTread_socket is called after unblock. */ |
| 8798 | BLOCK_INPUT; | 8759 | block_input (); |
| 8799 | interrupt_input_blocked = level; | 8760 | interrupt_input_blocked = level; |
| 8800 | 8761 | ||
| 8801 | FD_ZERO (&fds); | 8762 | FD_ZERO (&fds); |
| @@ -8886,7 +8847,7 @@ x_set_window_size_1 (struct frame *f, int change_gravity, int cols, int rows) | |||
| 8886 | void | 8847 | void |
| 8887 | x_set_window_size (struct frame *f, int change_gravity, int cols, int rows) | 8848 | x_set_window_size (struct frame *f, int change_gravity, int cols, int rows) |
| 8888 | { | 8849 | { |
| 8889 | BLOCK_INPUT; | 8850 | block_input (); |
| 8890 | 8851 | ||
| 8891 | if (NILP (tip_frame) || XFRAME (tip_frame) != f) | 8852 | if (NILP (tip_frame) || XFRAME (tip_frame) != f) |
| 8892 | { | 8853 | { |
| @@ -8934,7 +8895,7 @@ x_set_window_size (struct frame *f, int change_gravity, int cols, int rows) | |||
| 8934 | so don't try--just let the highlighting be done afresh with new size. */ | 8895 | so don't try--just let the highlighting be done afresh with new size. */ |
| 8935 | cancel_mouse_face (f); | 8896 | cancel_mouse_face (f); |
| 8936 | 8897 | ||
| 8937 | UNBLOCK_INPUT; | 8898 | unblock_input (); |
| 8938 | } | 8899 | } |
| 8939 | 8900 | ||
| 8940 | /* Mouse warping. */ | 8901 | /* Mouse warping. */ |
| @@ -8953,11 +8914,11 @@ x_set_mouse_position (struct frame *f, int x, int y) | |||
| 8953 | if (pix_y < 0) pix_y = 0; | 8914 | if (pix_y < 0) pix_y = 0; |
| 8954 | if (pix_y > FRAME_PIXEL_HEIGHT (f)) pix_y = FRAME_PIXEL_HEIGHT (f); | 8915 | if (pix_y > FRAME_PIXEL_HEIGHT (f)) pix_y = FRAME_PIXEL_HEIGHT (f); |
| 8955 | 8916 | ||
| 8956 | BLOCK_INPUT; | 8917 | block_input (); |
| 8957 | 8918 | ||
| 8958 | XWarpPointer (FRAME_X_DISPLAY (f), None, FRAME_X_WINDOW (f), | 8919 | XWarpPointer (FRAME_X_DISPLAY (f), None, FRAME_X_WINDOW (f), |
| 8959 | 0, 0, 0, 0, pix_x, pix_y); | 8920 | 0, 0, 0, 0, pix_x, pix_y); |
| 8960 | UNBLOCK_INPUT; | 8921 | unblock_input (); |
| 8961 | } | 8922 | } |
| 8962 | 8923 | ||
| 8963 | /* Move the mouse to position pixel PIX_X, PIX_Y relative to frame F. */ | 8924 | /* Move the mouse to position pixel PIX_X, PIX_Y relative to frame F. */ |
| @@ -8965,11 +8926,11 @@ x_set_mouse_position (struct frame *f, int x, int y) | |||
| 8965 | void | 8926 | void |
| 8966 | x_set_mouse_pixel_position (struct frame *f, int pix_x, int pix_y) | 8927 | x_set_mouse_pixel_position (struct frame *f, int pix_x, int pix_y) |
| 8967 | { | 8928 | { |
| 8968 | BLOCK_INPUT; | 8929 | block_input (); |
| 8969 | 8930 | ||
| 8970 | XWarpPointer (FRAME_X_DISPLAY (f), None, FRAME_X_WINDOW (f), | 8931 | XWarpPointer (FRAME_X_DISPLAY (f), None, FRAME_X_WINDOW (f), |
| 8971 | 0, 0, 0, 0, pix_x, pix_y); | 8932 | 0, 0, 0, 0, pix_x, pix_y); |
| 8972 | UNBLOCK_INPUT; | 8933 | unblock_input (); |
| 8973 | } | 8934 | } |
| 8974 | 8935 | ||
| 8975 | /* Raise frame F. */ | 8936 | /* Raise frame F. */ |
| @@ -8977,12 +8938,12 @@ x_set_mouse_pixel_position (struct frame *f, int pix_x, int pix_y) | |||
| 8977 | void | 8938 | void |
| 8978 | x_raise_frame (struct frame *f) | 8939 | x_raise_frame (struct frame *f) |
| 8979 | { | 8940 | { |
| 8980 | BLOCK_INPUT; | 8941 | block_input (); |
| 8981 | if (f->async_visible) | 8942 | if (f->async_visible) |
| 8982 | XRaiseWindow (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f)); | 8943 | XRaiseWindow (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f)); |
| 8983 | 8944 | ||
| 8984 | XFlush (FRAME_X_DISPLAY (f)); | 8945 | XFlush (FRAME_X_DISPLAY (f)); |
| 8985 | UNBLOCK_INPUT; | 8946 | unblock_input (); |
| 8986 | } | 8947 | } |
| 8987 | 8948 | ||
| 8988 | /* Lower frame F. */ | 8949 | /* Lower frame F. */ |
| @@ -8992,10 +8953,10 @@ x_lower_frame (struct frame *f) | |||
| 8992 | { | 8953 | { |
| 8993 | if (f->async_visible) | 8954 | if (f->async_visible) |
| 8994 | { | 8955 | { |
| 8995 | BLOCK_INPUT; | 8956 | block_input (); |
| 8996 | XLowerWindow (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f)); | 8957 | XLowerWindow (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f)); |
| 8997 | XFlush (FRAME_X_DISPLAY (f)); | 8958 | XFlush (FRAME_X_DISPLAY (f)); |
| 8998 | UNBLOCK_INPUT; | 8959 | unblock_input (); |
| 8999 | } | 8960 | } |
| 9000 | } | 8961 | } |
| 9001 | 8962 | ||
| @@ -9104,7 +9065,7 @@ x_make_frame_visible (struct frame *f) | |||
| 9104 | 9065 | ||
| 9105 | retry: | 9066 | retry: |
| 9106 | 9067 | ||
| 9107 | BLOCK_INPUT; | 9068 | block_input (); |
| 9108 | 9069 | ||
| 9109 | type = x_icon_type (f); | 9070 | type = x_icon_type (f); |
| 9110 | if (!NILP (type)) | 9071 | if (!NILP (type)) |
| @@ -9163,7 +9124,7 @@ x_make_frame_visible (struct frame *f) | |||
| 9163 | original_top = f->top_pos; | 9124 | original_top = f->top_pos; |
| 9164 | 9125 | ||
| 9165 | /* This must come after we set COUNT. */ | 9126 | /* This must come after we set COUNT. */ |
| 9166 | UNBLOCK_INPUT; | 9127 | unblock_input (); |
| 9167 | 9128 | ||
| 9168 | /* We unblock here so that arriving X events are processed. */ | 9129 | /* We unblock here so that arriving X events are processed. */ |
| 9169 | 9130 | ||
| @@ -9186,7 +9147,7 @@ x_make_frame_visible (struct frame *f) | |||
| 9186 | int x, y; | 9147 | int x, y; |
| 9187 | unsigned int width, height, border, depth; | 9148 | unsigned int width, height, border, depth; |
| 9188 | 9149 | ||
| 9189 | BLOCK_INPUT; | 9150 | block_input (); |
| 9190 | 9151 | ||
| 9191 | /* On some window managers (such as FVWM) moving an existing | 9152 | /* On some window managers (such as FVWM) moving an existing |
| 9192 | window, even to the same place, causes the window manager | 9153 | window, even to the same place, causes the window manager |
| @@ -9202,7 +9163,7 @@ x_make_frame_visible (struct frame *f) | |||
| 9202 | XMoveWindow (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f), | 9163 | XMoveWindow (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f), |
| 9203 | original_left, original_top); | 9164 | original_left, original_top); |
| 9204 | 9165 | ||
| 9205 | UNBLOCK_INPUT; | 9166 | unblock_input (); |
| 9206 | } | 9167 | } |
| 9207 | 9168 | ||
| 9208 | XSETFRAME (frame, f); | 9169 | XSETFRAME (frame, f); |
| @@ -9269,7 +9230,7 @@ x_make_frame_invisible (struct frame *f) | |||
| 9269 | if (FRAME_X_DISPLAY_INFO (f)->x_highlight_frame == f) | 9230 | if (FRAME_X_DISPLAY_INFO (f)->x_highlight_frame == f) |
| 9270 | FRAME_X_DISPLAY_INFO (f)->x_highlight_frame = 0; | 9231 | FRAME_X_DISPLAY_INFO (f)->x_highlight_frame = 0; |
| 9271 | 9232 | ||
| 9272 | BLOCK_INPUT; | 9233 | block_input (); |
| 9273 | 9234 | ||
| 9274 | /* Before unmapping the window, update the WM_SIZE_HINTS property to claim | 9235 | /* Before unmapping the window, update the WM_SIZE_HINTS property to claim |
| 9275 | that the current position of the window is user-specified, rather than | 9236 | that the current position of the window is user-specified, rather than |
| @@ -9292,7 +9253,7 @@ x_make_frame_invisible (struct frame *f) | |||
| 9292 | if (! XWithdrawWindow (FRAME_X_DISPLAY (f), window, | 9253 | if (! XWithdrawWindow (FRAME_X_DISPLAY (f), window, |
| 9293 | DefaultScreen (FRAME_X_DISPLAY (f)))) | 9254 | DefaultScreen (FRAME_X_DISPLAY (f)))) |
| 9294 | { | 9255 | { |
| 9295 | UNBLOCK_INPUT_RESIGNAL; | 9256 | unblock_input (); |
| 9296 | error ("Can't notify window manager of window withdrawal"); | 9257 | error ("Can't notify window manager of window withdrawal"); |
| 9297 | } | 9258 | } |
| 9298 | } | 9259 | } |
| @@ -9309,7 +9270,7 @@ x_make_frame_invisible (struct frame *f) | |||
| 9309 | 9270 | ||
| 9310 | x_sync (f); | 9271 | x_sync (f); |
| 9311 | 9272 | ||
| 9312 | UNBLOCK_INPUT; | 9273 | unblock_input (); |
| 9313 | } | 9274 | } |
| 9314 | 9275 | ||
| 9315 | /* Change window state from mapped to iconified. */ | 9276 | /* Change window state from mapped to iconified. */ |
| @@ -9329,7 +9290,7 @@ x_iconify_frame (struct frame *f) | |||
| 9329 | if (f->async_iconified) | 9290 | if (f->async_iconified) |
| 9330 | return; | 9291 | return; |
| 9331 | 9292 | ||
| 9332 | BLOCK_INPUT; | 9293 | block_input (); |
| 9333 | 9294 | ||
| 9334 | FRAME_SAMPLE_VISIBILITY (f); | 9295 | FRAME_SAMPLE_VISIBILITY (f); |
| 9335 | 9296 | ||
| @@ -9348,7 +9309,7 @@ x_iconify_frame (struct frame *f) | |||
| 9348 | f->visible = 1; | 9309 | f->visible = 1; |
| 9349 | f->async_iconified = 1; | 9310 | f->async_iconified = 1; |
| 9350 | f->async_visible = 0; | 9311 | f->async_visible = 0; |
| 9351 | UNBLOCK_INPUT; | 9312 | unblock_input (); |
| 9352 | return; | 9313 | return; |
| 9353 | } | 9314 | } |
| 9354 | #endif | 9315 | #endif |
| @@ -9368,14 +9329,14 @@ x_iconify_frame (struct frame *f) | |||
| 9368 | f->visible = 1; | 9329 | f->visible = 1; |
| 9369 | f->async_iconified = 1; | 9330 | f->async_iconified = 1; |
| 9370 | f->async_visible = 0; | 9331 | f->async_visible = 0; |
| 9371 | UNBLOCK_INPUT; | 9332 | unblock_input (); |
| 9372 | return; | 9333 | return; |
| 9373 | } | 9334 | } |
| 9374 | 9335 | ||
| 9375 | result = XIconifyWindow (FRAME_X_DISPLAY (f), | 9336 | result = XIconifyWindow (FRAME_X_DISPLAY (f), |
| 9376 | XtWindow (f->output_data.x->widget), | 9337 | XtWindow (f->output_data.x->widget), |
| 9377 | DefaultScreen (FRAME_X_DISPLAY (f))); | 9338 | DefaultScreen (FRAME_X_DISPLAY (f))); |
| 9378 | UNBLOCK_INPUT; | 9339 | unblock_input (); |
| 9379 | 9340 | ||
| 9380 | if (!result) | 9341 | if (!result) |
| 9381 | error ("Can't notify window manager of iconification"); | 9342 | error ("Can't notify window manager of iconification"); |
| @@ -9384,9 +9345,9 @@ x_iconify_frame (struct frame *f) | |||
| 9384 | f->async_visible = 0; | 9345 | f->async_visible = 0; |
| 9385 | 9346 | ||
| 9386 | 9347 | ||
| 9387 | BLOCK_INPUT; | 9348 | block_input (); |
| 9388 | XFlush (FRAME_X_DISPLAY (f)); | 9349 | XFlush (FRAME_X_DISPLAY (f)); |
| 9389 | UNBLOCK_INPUT; | 9350 | unblock_input (); |
| 9390 | #else /* not USE_X_TOOLKIT */ | 9351 | #else /* not USE_X_TOOLKIT */ |
| 9391 | 9352 | ||
| 9392 | /* Make sure the X server knows where the window should be positioned, | 9353 | /* Make sure the X server knows where the window should be positioned, |
| @@ -9416,7 +9377,7 @@ x_iconify_frame (struct frame *f) | |||
| 9416 | SubstructureRedirectMask | SubstructureNotifyMask, | 9377 | SubstructureRedirectMask | SubstructureNotifyMask, |
| 9417 | &msg)) | 9378 | &msg)) |
| 9418 | { | 9379 | { |
| 9419 | UNBLOCK_INPUT_RESIGNAL; | 9380 | unblock_input (); |
| 9420 | error ("Can't notify window manager of iconification"); | 9381 | error ("Can't notify window manager of iconification"); |
| 9421 | } | 9382 | } |
| 9422 | } | 9383 | } |
| @@ -9435,7 +9396,7 @@ x_iconify_frame (struct frame *f) | |||
| 9435 | f->async_visible = 0; | 9396 | f->async_visible = 0; |
| 9436 | 9397 | ||
| 9437 | XFlush (FRAME_X_DISPLAY (f)); | 9398 | XFlush (FRAME_X_DISPLAY (f)); |
| 9438 | UNBLOCK_INPUT; | 9399 | unblock_input (); |
| 9439 | #endif /* not USE_X_TOOLKIT */ | 9400 | #endif /* not USE_X_TOOLKIT */ |
| 9440 | } | 9401 | } |
| 9441 | 9402 | ||
| @@ -9452,7 +9413,7 @@ x_free_frame_resources (struct frame *f) | |||
| 9452 | struct scroll_bar *b; | 9413 | struct scroll_bar *b; |
| 9453 | #endif | 9414 | #endif |
| 9454 | 9415 | ||
| 9455 | BLOCK_INPUT; | 9416 | block_input (); |
| 9456 | 9417 | ||
| 9457 | /* If a display connection is dead, don't try sending more | 9418 | /* If a display connection is dead, don't try sending more |
| 9458 | commands to the X server. */ | 9419 | commands to the X server. */ |
| @@ -9555,7 +9516,7 @@ x_free_frame_resources (struct frame *f) | |||
| 9555 | hlinfo->mouse_face_mouse_frame = 0; | 9516 | hlinfo->mouse_face_mouse_frame = 0; |
| 9556 | } | 9517 | } |
| 9557 | 9518 | ||
| 9558 | UNBLOCK_INPUT; | 9519 | unblock_input (); |
| 9559 | } | 9520 | } |
| 9560 | 9521 | ||
| 9561 | 9522 | ||
| @@ -9935,7 +9896,7 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name) | |||
| 9935 | Mouse_HLInfo *hlinfo; | 9896 | Mouse_HLInfo *hlinfo; |
| 9936 | ptrdiff_t lim; | 9897 | ptrdiff_t lim; |
| 9937 | 9898 | ||
| 9938 | BLOCK_INPUT; | 9899 | block_input (); |
| 9939 | 9900 | ||
| 9940 | if (!x_initialized) | 9901 | if (!x_initialized) |
| 9941 | { | 9902 | { |
| @@ -10067,7 +10028,7 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name) | |||
| 10067 | /* Detect failure. */ | 10028 | /* Detect failure. */ |
| 10068 | if (dpy == 0) | 10029 | if (dpy == 0) |
| 10069 | { | 10030 | { |
| 10070 | UNBLOCK_INPUT; | 10031 | unblock_input (); |
| 10071 | return 0; | 10032 | return 0; |
| 10072 | } | 10033 | } |
| 10073 | 10034 | ||
| @@ -10114,12 +10075,12 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name) | |||
| 10114 | 10075 | ||
| 10115 | /* Temporarily hide the partially initialized terminal. */ | 10076 | /* Temporarily hide the partially initialized terminal. */ |
| 10116 | terminal_list = terminal->next_terminal; | 10077 | terminal_list = terminal->next_terminal; |
| 10117 | UNBLOCK_INPUT; | 10078 | unblock_input (); |
| 10118 | kset_system_key_alist | 10079 | kset_system_key_alist |
| 10119 | (terminal->kboard, | 10080 | (terminal->kboard, |
| 10120 | call1 (Qvendor_specific_keysyms, | 10081 | call1 (Qvendor_specific_keysyms, |
| 10121 | vendor ? build_string (vendor) : empty_unibyte_string)); | 10082 | vendor ? build_string (vendor) : empty_unibyte_string)); |
| 10122 | BLOCK_INPUT; | 10083 | block_input (); |
| 10123 | terminal->next_terminal = terminal_list; | 10084 | terminal->next_terminal = terminal_list; |
| 10124 | terminal_list = terminal; | 10085 | terminal_list = terminal; |
| 10125 | UNGCPRO; | 10086 | UNGCPRO; |
| @@ -10468,7 +10429,7 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name) | |||
| 10468 | x_session_initialize (dpyinfo); | 10429 | x_session_initialize (dpyinfo); |
| 10469 | #endif | 10430 | #endif |
| 10470 | 10431 | ||
| 10471 | UNBLOCK_INPUT; | 10432 | unblock_input (); |
| 10472 | 10433 | ||
| 10473 | return dpyinfo; | 10434 | return dpyinfo; |
| 10474 | } | 10435 | } |
| @@ -10548,7 +10509,7 @@ x_delete_display (struct x_display_info *dpyinfo) | |||
| 10548 | static void | 10509 | static void |
| 10549 | x_process_timeouts (struct atimer *timer) | 10510 | x_process_timeouts (struct atimer *timer) |
| 10550 | { | 10511 | { |
| 10551 | BLOCK_INPUT; | 10512 | block_input (); |
| 10552 | x_timeout_atimer_activated_flag = 0; | 10513 | x_timeout_atimer_activated_flag = 0; |
| 10553 | if (toolkit_scroll_bar_interaction || popup_activated ()) | 10514 | if (toolkit_scroll_bar_interaction || popup_activated ()) |
| 10554 | { | 10515 | { |
| @@ -10557,7 +10518,7 @@ x_process_timeouts (struct atimer *timer) | |||
| 10557 | /* Reactivate the atimer for next time. */ | 10518 | /* Reactivate the atimer for next time. */ |
| 10558 | x_activate_timeout_atimer (); | 10519 | x_activate_timeout_atimer (); |
| 10559 | } | 10520 | } |
| 10560 | UNBLOCK_INPUT; | 10521 | unblock_input (); |
| 10561 | } | 10522 | } |
| 10562 | 10523 | ||
| 10563 | /* Install an asynchronous timer that processes Xt timeout events | 10524 | /* Install an asynchronous timer that processes Xt timeout events |
| @@ -10571,14 +10532,14 @@ x_process_timeouts (struct atimer *timer) | |||
| 10571 | void | 10532 | void |
| 10572 | x_activate_timeout_atimer (void) | 10533 | x_activate_timeout_atimer (void) |
| 10573 | { | 10534 | { |
| 10574 | BLOCK_INPUT; | 10535 | block_input (); |
| 10575 | if (!x_timeout_atimer_activated_flag) | 10536 | if (!x_timeout_atimer_activated_flag) |
| 10576 | { | 10537 | { |
| 10577 | EMACS_TIME interval = make_emacs_time (0, 100 * 1000 * 1000); | 10538 | EMACS_TIME interval = make_emacs_time (0, 100 * 1000 * 1000); |
| 10578 | start_atimer (ATIMER_RELATIVE, interval, x_process_timeouts, 0); | 10539 | start_atimer (ATIMER_RELATIVE, interval, x_process_timeouts, 0); |
| 10579 | x_timeout_atimer_activated_flag = 1; | 10540 | x_timeout_atimer_activated_flag = 1; |
| 10580 | } | 10541 | } |
| 10581 | UNBLOCK_INPUT; | 10542 | unblock_input (); |
| 10582 | } | 10543 | } |
| 10583 | 10544 | ||
| 10584 | #endif /* USE_X_TOOLKIT */ | 10545 | #endif /* USE_X_TOOLKIT */ |
| @@ -10631,7 +10592,7 @@ x_delete_terminal (struct terminal *terminal) | |||
| 10631 | if (!terminal->name) | 10592 | if (!terminal->name) |
| 10632 | return; | 10593 | return; |
| 10633 | 10594 | ||
| 10634 | BLOCK_INPUT; | 10595 | block_input (); |
| 10635 | #ifdef HAVE_X_I18N | 10596 | #ifdef HAVE_X_I18N |
| 10636 | /* We must close our connection to the XIM server before closing the | 10597 | /* We must close our connection to the XIM server before closing the |
| 10637 | X display. */ | 10598 | X display. */ |
| @@ -10686,7 +10647,7 @@ x_delete_terminal (struct terminal *terminal) | |||
| 10686 | /* Mark as dead. */ | 10647 | /* Mark as dead. */ |
| 10687 | dpyinfo->display = NULL; | 10648 | dpyinfo->display = NULL; |
| 10688 | x_delete_display (dpyinfo); | 10649 | x_delete_display (dpyinfo); |
| 10689 | UNBLOCK_INPUT; | 10650 | unblock_input (); |
| 10690 | } | 10651 | } |
| 10691 | 10652 | ||
| 10692 | /* Create a struct terminal, initialize it with the X11 specific | 10653 | /* Create a struct terminal, initialize it with the X11 specific |
| @@ -10743,8 +10704,6 @@ x_create_terminal (struct x_display_info *dpyinfo) | |||
| 10743 | void | 10704 | void |
| 10744 | x_initialize (void) | 10705 | x_initialize (void) |
| 10745 | { | 10706 | { |
| 10746 | struct sigaction action; | ||
| 10747 | |||
| 10748 | baud_rate = 19200; | 10707 | baud_rate = 19200; |
| 10749 | 10708 | ||
| 10750 | x_noop_count = 0; | 10709 | x_noop_count = 0; |
| @@ -10790,9 +10749,6 @@ x_initialize (void) | |||
| 10790 | original error handler. */ | 10749 | original error handler. */ |
| 10791 | XSetErrorHandler (x_error_handler); | 10750 | XSetErrorHandler (x_error_handler); |
| 10792 | XSetIOErrorHandler (x_io_error_quitter); | 10751 | XSetIOErrorHandler (x_io_error_quitter); |
| 10793 | |||
| 10794 | emacs_sigaction_init (&action, x_connection_signal); | ||
| 10795 | sigaction (SIGPIPE, &action, 0); | ||
| 10796 | } | 10752 | } |
| 10797 | 10753 | ||
| 10798 | 10754 | ||