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
This commit is contained in:
parent
8f4635e97e
commit
4d7e6e51dd
61 changed files with 1731 additions and 1851 deletions
|
@ -1,3 +1,8 @@
|
|||
2012-09-23 Paul Eggert <eggert@cs.ucla.edu>
|
||||
|
||||
Simplify and avoid signal-handling races (Bug#12471).
|
||||
* inc/ms-w32.h (emacs_raise): New macro.
|
||||
|
||||
2012-09-18 Eli Zaretskii <eliz@gnu.org>
|
||||
|
||||
* configure.bat: Include stddef.h before gif_lib.h, to have size_t
|
||||
|
|
|
@ -203,6 +203,9 @@ struct sigaction {
|
|||
#define kill sys_kill
|
||||
#define signal sys_signal
|
||||
|
||||
/* Internal signals. */
|
||||
#define emacs_raise(sig) kill (getpid (), sig)
|
||||
|
||||
/* termcap.c calls that are emulated. */
|
||||
#define tputs sys_tputs
|
||||
#define tgetstr sys_tgetstr
|
||||
|
|
134
src/ChangeLog
134
src/ChangeLog
|
@ -1,3 +1,137 @@
|
|||
2012-09-23 Paul Eggert <eggert@cs.ucla.edu>
|
||||
|
||||
Simplify and avoid signal-handling races (Bug#12471).
|
||||
* alloc.c (die):
|
||||
* sysdep.c (emacs_abort) [HAVE_NTGUI]:
|
||||
Avoid recursive loop if there's a fatal error in the function itself.
|
||||
* atimer.c (pending_atimers):
|
||||
* 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.
|
||||
* 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.
|
||||
* atimer.c (turn_on_atimers):
|
||||
* dispnew.c (handle_window_change_signal):
|
||||
* emacs.c (handle_danger_signal):
|
||||
* keyboard.c (kbd_buffer_get_event):
|
||||
Don't reestablish signal handler; not needed with sigaction.
|
||||
* 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.
|
||||
* data.c (handle_arith_signal, deliver_arith_signal): Move to sysdep.c
|
||||
(init_data): Remove. Necessary stuff now done in init_signal.
|
||||
* emacs.c, xdisp.c: Include "atimer.h", since we invoke atimer functions.
|
||||
* 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
|
||||
* floatfns.c: Do not include "syssignal.h"; no longer needed.
|
||||
* gtkutil.c (xg_get_file_name, xg_get_font):
|
||||
Remove no-longer-needed signal-mask manipulation.
|
||||
* keyboard.c, process.c (POLL_FOR_INPUT):
|
||||
Don't depend on USE_ASYNC_EVENTS, a symbol that is never defined.
|
||||
* 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.
|
||||
* keyboard.c (gobble_input, handle_user_signal):
|
||||
* process.c (wait_reading_process_output):
|
||||
Call signal-handling code rather than killing ourselves.
|
||||
* 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.
|
||||
* 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.
|
||||
* 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.
|
||||
* syssignal.h: Include <stdbool.h>.
|
||||
(emacs_raise): New macro.
|
||||
* 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.
|
||||
|
||||
2012-09-23 Jan Djärv <jan.h.d@swipnet.se>
|
||||
|
||||
* nsterm.m (ns_dumpglyphs_image): dr is a new rect to draw image into,
|
||||
|
|
11
src/alloc.c
11
src/alloc.c
|
@ -633,13 +633,13 @@ static void
|
|||
malloc_block_input (void)
|
||||
{
|
||||
if (block_input_in_memory_allocators)
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
}
|
||||
static void
|
||||
malloc_unblock_input (void)
|
||||
{
|
||||
if (block_input_in_memory_allocators)
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
}
|
||||
# define MALLOC_BLOCK_INPUT malloc_block_input ()
|
||||
# define MALLOC_UNBLOCK_INPUT malloc_unblock_input ()
|
||||
|
@ -5125,7 +5125,7 @@ See Info node `(elisp)Garbage Collection'. */)
|
|||
if (garbage_collection_messages)
|
||||
message1_nolog ("Garbage collecting...");
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
|
||||
shrink_regexp_cache ();
|
||||
|
||||
|
@ -5242,7 +5242,7 @@ See Info node `(elisp)Garbage Collection'. */)
|
|||
dump_zombies ();
|
||||
#endif
|
||||
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
|
||||
check_cons_list ();
|
||||
|
||||
|
@ -6393,9 +6393,10 @@ bool suppress_checking;
|
|||
void
|
||||
die (const char *msg, const char *file, int line)
|
||||
{
|
||||
signal (SIGABRT, SIG_DFL);
|
||||
fprintf (stderr, "\r\n%s:%d: Emacs fatal error: %s\r\n",
|
||||
file, line, msg);
|
||||
fatal_error_backtrace (SIGABRT, INT_MAX);
|
||||
terminate_due_to_signal (SIGABRT, INT_MAX);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
51
src/atimer.c
51
src/atimer.c
|
@ -40,14 +40,6 @@ static struct atimer *stopped_atimers;
|
|||
|
||||
static struct atimer *atimers;
|
||||
|
||||
/* Non-zero means alarm signal handler has found ripe timers but
|
||||
interrupt_input_blocked was non-zero. In this case, timer
|
||||
functions are not called until the next UNBLOCK_INPUT because timer
|
||||
functions are expected to call X, and X cannot be assumed to be
|
||||
reentrant. */
|
||||
|
||||
int pending_atimers;
|
||||
|
||||
/* Block/unblock SIGALRM. */
|
||||
|
||||
static void
|
||||
|
@ -341,16 +333,11 @@ schedule_atimer (struct atimer *t)
|
|||
static void
|
||||
run_timers (void)
|
||||
{
|
||||
EMACS_TIME now;
|
||||
EMACS_TIME now = current_emacs_time ();
|
||||
|
||||
while (atimers
|
||||
&& (pending_atimers = interrupt_input_blocked) == 0
|
||||
&& (now = current_emacs_time (),
|
||||
EMACS_TIME_LE (atimers->expiration, now)))
|
||||
while (atimers && EMACS_TIME_LE (atimers->expiration, now))
|
||||
{
|
||||
struct atimer *t;
|
||||
|
||||
t = atimers;
|
||||
struct atimer *t = atimers;
|
||||
atimers = atimers->next;
|
||||
t->fn (t);
|
||||
|
||||
|
@ -366,16 +353,7 @@ run_timers (void)
|
|||
}
|
||||
}
|
||||
|
||||
if (! atimers)
|
||||
pending_atimers = 0;
|
||||
|
||||
if (pending_atimers)
|
||||
pending_signals = 1;
|
||||
else
|
||||
{
|
||||
pending_signals = interrupt_input_pending;
|
||||
set_alarm ();
|
||||
}
|
||||
set_alarm ();
|
||||
}
|
||||
|
||||
|
||||
|
@ -385,23 +363,16 @@ run_timers (void)
|
|||
static void
|
||||
handle_alarm_signal (int sig)
|
||||
{
|
||||
pending_atimers = 1;
|
||||
pending_signals = 1;
|
||||
}
|
||||
|
||||
static void
|
||||
deliver_alarm_signal (int sig)
|
||||
{
|
||||
handle_on_main_thread (sig, handle_alarm_signal);
|
||||
}
|
||||
|
||||
|
||||
/* Call alarm signal handler for pending timers. */
|
||||
/* Do pending timers. */
|
||||
|
||||
void
|
||||
do_pending_atimers (void)
|
||||
{
|
||||
if (pending_atimers)
|
||||
if (atimers)
|
||||
{
|
||||
block_atimers ();
|
||||
run_timers ();
|
||||
|
@ -417,12 +388,7 @@ void
|
|||
turn_on_atimers (bool on)
|
||||
{
|
||||
if (on)
|
||||
{
|
||||
struct sigaction action;
|
||||
emacs_sigaction_init (&action, deliver_alarm_signal);
|
||||
sigaction (SIGALRM, &action, 0);
|
||||
set_alarm ();
|
||||
}
|
||||
set_alarm ();
|
||||
else
|
||||
alarm (0);
|
||||
}
|
||||
|
@ -433,8 +399,7 @@ init_atimer (void)
|
|||
{
|
||||
struct sigaction action;
|
||||
free_atimers = stopped_atimers = atimers = NULL;
|
||||
pending_atimers = 0;
|
||||
/* pending_signals is initialized in init_keyboard.*/
|
||||
emacs_sigaction_init (&action, deliver_alarm_signal);
|
||||
emacs_sigaction_init (&action, handle_alarm_signal);
|
||||
sigaction (SIGALRM, &action, 0);
|
||||
}
|
||||
|
|
116
src/blockinput.h
116
src/blockinput.h
|
@ -19,103 +19,57 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
|
|||
#ifndef EMACS_BLOCKINPUT_H
|
||||
#define EMACS_BLOCKINPUT_H
|
||||
|
||||
#include "atimer.h"
|
||||
INLINE_HEADER_BEGIN
|
||||
#ifndef BLOCKINPUT_INLINE
|
||||
# define BLOCKINPUT_INLINE INLINE
|
||||
#endif
|
||||
|
||||
/* When Emacs is using signal-driven input, the processing of those
|
||||
input signals can get pretty hairy. For example, when Emacs is
|
||||
running under X windows, handling an input signal can entail
|
||||
retrieving events from the X event queue, or making other X calls.
|
||||
|
||||
If an input signal occurs while Emacs is in the midst of some
|
||||
non-reentrant code, and the signal processing invokes that same
|
||||
code, we lose. For example, malloc and the Xlib functions aren't
|
||||
usually re-entrant, and both are used by the X input signal handler
|
||||
- if we try to process an input signal in the midst of executing
|
||||
any of these functions, we'll lose.
|
||||
/* Emacs should avoid doing anything hairy in a signal handler, because
|
||||
so many system functions are non-reentrant. For example, malloc
|
||||
and the Xlib functions aren't usually re-entrant, so if they were
|
||||
used by the SIGIO handler, we'd lose.
|
||||
|
||||
To avoid this, we make the following requirements:
|
||||
|
||||
* Everyone must evaluate BLOCK_INPUT before entering these functions,
|
||||
and then call UNBLOCK_INPUT after performing them. Calls
|
||||
BLOCK_INPUT and UNBLOCK_INPUT may be nested.
|
||||
* Everyone must evaluate BLOCK_INPUT before performing actions that
|
||||
might conflict with a signal handler, and then call UNBLOCK_INPUT
|
||||
after performing them. Calls BLOCK_INPUT and UNBLOCK_INPUT may be
|
||||
nested.
|
||||
|
||||
* Any complicated interrupt handling code should test
|
||||
interrupt_input_blocked, and put off its work until later.
|
||||
INPUT_BLOCKED_P, and put off its work until later.
|
||||
|
||||
* If the interrupt handling code wishes, it may set
|
||||
interrupt_input_pending to a non-zero value. If that flag is set
|
||||
when input becomes unblocked, UNBLOCK_INPUT will send a new SIGIO. */
|
||||
pending_signals to a non-zero value. If that flag is set
|
||||
when input becomes unblocked, UNBLOCK_INPUT will then read
|
||||
input and process timers.
|
||||
|
||||
Historically, Emacs signal handlers did much more than they do now,
|
||||
and this caused many BLOCK_INPUT calls to be sprinkled around the code.
|
||||
FIXME: Remove calls that aren't needed now. */
|
||||
|
||||
extern volatile int interrupt_input_blocked;
|
||||
|
||||
/* Nonzero means an input interrupt has arrived
|
||||
during the current critical section. */
|
||||
extern int interrupt_input_pending;
|
||||
|
||||
|
||||
/* Non-zero means asynchronous timers should be run when input is
|
||||
unblocked. */
|
||||
|
||||
extern int pending_atimers;
|
||||
|
||||
|
||||
/* Begin critical section. */
|
||||
#define BLOCK_INPUT (interrupt_input_blocked++)
|
||||
|
||||
/* End critical section.
|
||||
BLOCKINPUT_INLINE void
|
||||
block_input (void)
|
||||
{
|
||||
interrupt_input_blocked++;
|
||||
}
|
||||
|
||||
If doing signal-driven input, and a signal came in when input was
|
||||
blocked, reinvoke the signal handler now to deal with it.
|
||||
|
||||
Always test interrupt_input_pending; that's not too expensive, and
|
||||
it'll never get set if we don't need to resignal. This is simpler
|
||||
than dealing here with every configuration option that might affect
|
||||
whether interrupt_input_pending can be nonzero. */
|
||||
|
||||
#define UNBLOCK_INPUT \
|
||||
do \
|
||||
{ \
|
||||
--interrupt_input_blocked; \
|
||||
if (interrupt_input_blocked == 0) \
|
||||
{ \
|
||||
if (interrupt_input_pending) \
|
||||
reinvoke_input_signal (); \
|
||||
if (pending_atimers) \
|
||||
do_pending_atimers (); \
|
||||
} \
|
||||
else if (interrupt_input_blocked < 0) \
|
||||
emacs_abort (); \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
/* Undo any number of BLOCK_INPUT calls,
|
||||
and also reinvoke any pending signal. */
|
||||
|
||||
#define TOTALLY_UNBLOCK_INPUT \
|
||||
do if (interrupt_input_blocked != 0) \
|
||||
{ \
|
||||
interrupt_input_blocked = 1; \
|
||||
UNBLOCK_INPUT; \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
/* Undo any number of BLOCK_INPUT calls down to level LEVEL,
|
||||
and also (if the level is now 0) reinvoke any pending signal. */
|
||||
|
||||
#define UNBLOCK_INPUT_TO(LEVEL) \
|
||||
do \
|
||||
{ \
|
||||
interrupt_input_blocked = (LEVEL) + 1; \
|
||||
UNBLOCK_INPUT; \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
#define UNBLOCK_INPUT_RESIGNAL UNBLOCK_INPUT
|
||||
extern void unblock_input (void);
|
||||
extern void totally_unblock_input (void);
|
||||
extern void unblock_input_to (int);
|
||||
|
||||
/* In critical section ? */
|
||||
#define INPUT_BLOCKED_P (interrupt_input_blocked > 0)
|
||||
|
||||
/* Defined in keyboard.c */
|
||||
extern void reinvoke_input_signal (void);
|
||||
BLOCKINPUT_INLINE bool
|
||||
input_blocked_p (void)
|
||||
{
|
||||
return 0 < interrupt_input_blocked;
|
||||
}
|
||||
|
||||
INLINE_HEADER_END
|
||||
|
||||
#endif /* EMACS_BLOCKINPUT_H */
|
||||
|
|
24
src/buffer.c
24
src/buffer.c
|
@ -550,11 +550,11 @@ even if it is dead. The return value is never nil. */)
|
|||
b->indirections = 0;
|
||||
|
||||
BUF_GAP_SIZE (b) = 20;
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
/* We allocate extra 1-byte at the tail and keep it always '\0' for
|
||||
anchoring a search. */
|
||||
alloc_buffer_text (b, BUF_GAP_SIZE (b) + 1);
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
if (! BUF_BEG_ADDR (b))
|
||||
buffer_memory_full (BUF_GAP_SIZE (b) + 1);
|
||||
|
||||
|
@ -1923,7 +1923,7 @@ cleaning up all windows currently displaying the buffer to be killed. */)
|
|||
|
||||
bset_name (b, Qnil);
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
if (b->base_buffer)
|
||||
{
|
||||
/* 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. */)
|
|||
b->width_run_cache = 0;
|
||||
}
|
||||
bset_width_table (b, Qnil);
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
bset_undo_list (b, Qnil);
|
||||
|
||||
/* Run buffer-list-update-hook. */
|
||||
|
@ -5032,7 +5032,7 @@ alloc_buffer_text (struct buffer *b, ptrdiff_t nbytes)
|
|||
{
|
||||
void *p;
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
#if defined USE_MMAP_FOR_BUFFERS
|
||||
p = mmap_alloc ((void **) &b->text->beg, nbytes);
|
||||
#elif defined REL_ALLOC
|
||||
|
@ -5043,12 +5043,12 @@ alloc_buffer_text (struct buffer *b, ptrdiff_t nbytes)
|
|||
|
||||
if (p == NULL)
|
||||
{
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
memory_full (nbytes);
|
||||
}
|
||||
|
||||
b->text->beg = (unsigned char *) p;
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
}
|
||||
|
||||
/* 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)
|
|||
void *p;
|
||||
ptrdiff_t nbytes = (BUF_Z_BYTE (b) - BUF_BEG_BYTE (b) + BUF_GAP_SIZE (b) + 1
|
||||
+ delta);
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
#if defined USE_MMAP_FOR_BUFFERS
|
||||
p = mmap_realloc ((void **) &b->text->beg, nbytes);
|
||||
#elif defined REL_ALLOC
|
||||
|
@ -5071,12 +5071,12 @@ enlarge_buffer_text (struct buffer *b, ptrdiff_t delta)
|
|||
|
||||
if (p == NULL)
|
||||
{
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
memory_full (nbytes);
|
||||
}
|
||||
|
||||
BUF_BEG_ADDR (b) = (unsigned char *) p;
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
}
|
||||
|
||||
|
||||
|
@ -5085,7 +5085,7 @@ enlarge_buffer_text (struct buffer *b, ptrdiff_t delta)
|
|||
static void
|
||||
free_buffer_text (struct buffer *b)
|
||||
{
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
|
||||
#if defined USE_MMAP_FOR_BUFFERS
|
||||
mmap_free ((void **) &b->text->beg);
|
||||
|
@ -5096,7 +5096,7 @@ free_buffer_text (struct buffer *b)
|
|||
#endif
|
||||
|
||||
BUF_BEG_ADDR (b) = NULL;
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -582,7 +582,7 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */)
|
|||
0, current_dir);
|
||||
#else /* not WINDOWSNT */
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
|
||||
/* vfork, and prevent local vars from being clobbered by the vfork. */
|
||||
{
|
||||
|
@ -626,15 +626,14 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */)
|
|||
setpgrp (pid, pid);
|
||||
#endif /* USG */
|
||||
|
||||
/* GConf causes us to ignore SIGPIPE, make sure it is restored
|
||||
in the child. */
|
||||
/* Emacs ignores SIGPIPE, but the child should not. */
|
||||
signal (SIGPIPE, SIG_DFL);
|
||||
|
||||
child_setup (filefd, fd1, fd_error, (char **) new_argv,
|
||||
0, current_dir);
|
||||
}
|
||||
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
|
||||
#endif /* not WINDOWSNT */
|
||||
|
||||
|
@ -976,9 +975,9 @@ usage: (call-process-region START END PROGRAM &optional DELETE BUFFER DISPLAY &r
|
|||
{
|
||||
int fd;
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
fd = mkstemp (tempfile);
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
if (fd == -1)
|
||||
report_file_error ("Failed to open temporary file",
|
||||
Fcons (build_string (tempfile), Qnil));
|
||||
|
|
37
src/data.c
37
src/data.c
|
@ -34,14 +34,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
|
|||
#include "font.h"
|
||||
#include "keymap.h"
|
||||
|
||||
#include <float.h>
|
||||
#if (FLT_RADIX == 2 && FLT_MANT_DIG == 24 \
|
||||
&& FLT_MIN_EXP == -125 && FLT_MAX_EXP == 128)
|
||||
#define IEEE_FLOATING_POINT 1
|
||||
#else
|
||||
#define IEEE_FLOATING_POINT 0
|
||||
#endif
|
||||
|
||||
Lisp_Object Qnil, Qt, Qquote, Qlambda, Qunbound;
|
||||
static Lisp_Object Qsubr;
|
||||
Lisp_Object Qerror_conditions, Qerror_message, Qtop_level;
|
||||
|
@ -3179,32 +3171,3 @@ syms_of_data (void)
|
|||
Vmost_negative_fixnum = make_number (MOST_NEGATIVE_FIXNUM);
|
||||
XSYMBOL (intern_c_string ("most-negative-fixnum"))->constant = 1;
|
||||
}
|
||||
|
||||
static _Noreturn void
|
||||
handle_arith_signal (int sig)
|
||||
{
|
||||
pthread_sigmask (SIG_SETMASK, &empty_mask, 0);
|
||||
xsignal0 (Qarith_error);
|
||||
}
|
||||
|
||||
static void
|
||||
deliver_arith_signal (int sig)
|
||||
{
|
||||
handle_on_main_thread (sig, handle_arith_signal);
|
||||
}
|
||||
|
||||
void
|
||||
init_data (void)
|
||||
{
|
||||
struct sigaction action;
|
||||
/* Don't do this if just dumping out.
|
||||
We don't want to call `signal' in this case
|
||||
so that we don't have trouble with dumping
|
||||
signal-delivering routines in an inconsistent state. */
|
||||
#ifndef CANNOT_DUMP
|
||||
if (!initialized)
|
||||
return;
|
||||
#endif /* CANNOT_DUMP */
|
||||
emacs_sigaction_init (&action, deliver_arith_signal);
|
||||
sigaction (SIGFPE, &action, 0);
|
||||
}
|
||||
|
|
20
src/dired.c
20
src/dired.c
|
@ -101,9 +101,9 @@ static Lisp_Object
|
|||
directory_files_internal_unwind (Lisp_Object dh)
|
||||
{
|
||||
DIR *d = (DIR *) XSAVE_VALUE (dh)->pointer;
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
closedir (d);
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
|
@ -164,9 +164,9 @@ directory_files_internal (Lisp_Object directory, Lisp_Object full,
|
|||
/* Now *bufp is the compiled form of MATCH; don't call anything
|
||||
which might compile a new regexp until we're done with the loop! */
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
d = opendir (SSDATA (dirfilename));
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
if (d == NULL)
|
||||
report_file_error ("Opening directory", Fcons (directory, Qnil));
|
||||
|
||||
|
@ -310,9 +310,9 @@ directory_files_internal (Lisp_Object directory, Lisp_Object full,
|
|||
}
|
||||
}
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
closedir (d);
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
#ifdef WINDOWSNT
|
||||
if (attrs)
|
||||
Vw32_get_true_file_attributes = w32_save;
|
||||
|
@ -486,9 +486,9 @@ file_name_completion (Lisp_Object file, Lisp_Object dirname, bool all_flag,
|
|||
|
||||
encoded_dir = ENCODE_FILE (dirname);
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
d = opendir (SSDATA (Fdirectory_file_name (encoded_dir)));
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
if (!d)
|
||||
report_file_error ("Opening directory", Fcons (dirname, Qnil));
|
||||
|
||||
|
@ -962,10 +962,10 @@ so last access time will always be midnight of that day. */)
|
|||
|
||||
if (!(NILP (id_format) || EQ (id_format, Qinteger)))
|
||||
{
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
uname = stat_uname (&s);
|
||||
gname = stat_gname (&s);
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
}
|
||||
if (uname)
|
||||
values[2] = DECODE_SYSTEM (build_string (uname));
|
||||
|
|
|
@ -1834,7 +1834,7 @@ adjust_glyphs (struct frame *f)
|
|||
{
|
||||
/* Block input so that expose events and other events that access
|
||||
glyph matrices are not processed while we are changing them. */
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
|
||||
if (f)
|
||||
adjust_frame_glyphs (f);
|
||||
|
@ -1846,7 +1846,7 @@ adjust_glyphs (struct frame *f)
|
|||
adjust_frame_glyphs (XFRAME (lisp_frame));
|
||||
}
|
||||
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
}
|
||||
|
||||
|
||||
|
@ -2242,7 +2242,7 @@ free_glyphs (struct frame *f)
|
|||
{
|
||||
/* Block interrupt input so that we don't get surprised by an X
|
||||
event while we're in an inconsistent state. */
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
f->glyphs_initialized_p = 0;
|
||||
|
||||
/* Release window sub-matrices. */
|
||||
|
@ -2287,7 +2287,7 @@ free_glyphs (struct frame *f)
|
|||
f->desired_pool = f->current_pool = NULL;
|
||||
}
|
||||
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5563,10 +5563,6 @@ handle_window_change_signal (int sig)
|
|||
int width, height;
|
||||
struct tty_display_info *tty;
|
||||
|
||||
struct sigaction action;
|
||||
emacs_sigaction_init (&action, deliver_window_change_signal);
|
||||
sigaction (SIGWINCH, &action, 0);
|
||||
|
||||
/* The frame size change obviously applies to a single
|
||||
termcap-controlled terminal, but we can't decide which.
|
||||
Therefore, we resize the frames corresponding to each tty.
|
||||
|
@ -5599,7 +5595,7 @@ handle_window_change_signal (int sig)
|
|||
static void
|
||||
deliver_window_change_signal (int sig)
|
||||
{
|
||||
handle_on_main_thread (sig, handle_window_change_signal);
|
||||
deliver_process_signal (sig, handle_window_change_signal);
|
||||
}
|
||||
#endif /* SIGWINCH */
|
||||
|
||||
|
@ -5708,7 +5704,7 @@ change_frame_size_1 (struct frame *f, int newheight, int newwidth,
|
|||
&& new_frame_total_cols == FRAME_TOTAL_COLS (f))
|
||||
return;
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
|
||||
#ifdef MSDOS
|
||||
/* 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,
|
|||
SET_FRAME_GARBAGED (f);
|
||||
f->resized_p = 1;
|
||||
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
|
||||
record_unwind_current_buffer ();
|
||||
|
||||
|
@ -5791,9 +5787,9 @@ FILE = nil means just close any termscript file currently open. */)
|
|||
|
||||
if (tty->termscript != 0)
|
||||
{
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
fclose (tty->termscript);
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
}
|
||||
tty->termscript = 0;
|
||||
|
||||
|
@ -5824,7 +5820,7 @@ when TERMINAL is nil. */)
|
|||
|
||||
/* ??? Perhaps we should do something special for multibyte strings here. */
|
||||
CHECK_STRING (string);
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
|
||||
if (!t)
|
||||
error ("Unknown terminal device");
|
||||
|
@ -5849,7 +5845,7 @@ when TERMINAL is nil. */)
|
|||
}
|
||||
fwrite (SDATA (string), 1, SBYTES (string), out);
|
||||
fflush (out);
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
|
|
|
@ -480,9 +480,9 @@ x_set_title (struct frame *f, Lisp_Object name)
|
|||
|
||||
if (FRAME_MSDOS_P (f))
|
||||
{
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
w95_set_virtual_machine_title (SDATA (name));
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
}
|
||||
}
|
||||
#endif /* !HAVE_X_WINDOWS */
|
||||
|
|
|
@ -1219,9 +1219,9 @@ of the user with that uid, or nil if there is no such user. */)
|
|||
return Vuser_login_name;
|
||||
|
||||
CONS_TO_INTEGER (uid, uid_t, id);
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
pw = getpwuid (id);
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
return (pw ? build_string (pw->pw_name) : Qnil);
|
||||
}
|
||||
|
||||
|
@ -1279,15 +1279,15 @@ name, or nil if there is no such user. */)
|
|||
{
|
||||
uid_t u;
|
||||
CONS_TO_INTEGER (uid, uid_t, u);
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
pw = getpwuid (u);
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
}
|
||||
else if (STRINGP (uid))
|
||||
{
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
pw = getpwnam (SSDATA (uid));
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
}
|
||||
else
|
||||
error ("Invalid UID specification");
|
||||
|
@ -1763,14 +1763,14 @@ format_time_string (char const *format, ptrdiff_t formatlen,
|
|||
while (1)
|
||||
{
|
||||
time_t *taddr = emacs_secs_addr (&t);
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
|
||||
synchronize_system_time_locale ();
|
||||
|
||||
tm = ut ? gmtime (taddr) : localtime (taddr);
|
||||
if (! tm)
|
||||
{
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
time_overflow ();
|
||||
}
|
||||
*tmp = *tm;
|
||||
|
@ -1782,14 +1782,14 @@ format_time_string (char const *format, ptrdiff_t formatlen,
|
|||
|
||||
/* Buffer was too small, so make it bigger and try again. */
|
||||
len = emacs_nmemftime (NULL, SIZE_MAX, format, formatlen, tm, ut, ns);
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
if (STRING_BYTES_BOUND <= len)
|
||||
string_overflow ();
|
||||
size = len + 1;
|
||||
buf = SAFE_ALLOCA (size);
|
||||
}
|
||||
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
bufstring = make_unibyte_string (buf, len);
|
||||
SAFE_FREE ();
|
||||
return code_convert_string_norecord (bufstring, Vlocale_coding_system, 0);
|
||||
|
@ -1817,11 +1817,11 @@ DOW and ZONE.) */)
|
|||
struct tm *decoded_time;
|
||||
Lisp_Object list_args[9];
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
decoded_time = localtime (&time_spec);
|
||||
if (decoded_time)
|
||||
save_tm = *decoded_time;
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
if (! (decoded_time
|
||||
&& MOST_NEGATIVE_FIXNUM - TM_YEAR_BASE <= save_tm.tm_year
|
||||
&& save_tm.tm_year <= MOST_POSITIVE_FIXNUM - TM_YEAR_BASE))
|
||||
|
@ -1837,13 +1837,13 @@ DOW and ZONE.) */)
|
|||
XSETFASTINT (list_args[6], save_tm.tm_wday);
|
||||
list_args[7] = save_tm.tm_isdst ? Qt : Qnil;
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
decoded_time = gmtime (&time_spec);
|
||||
if (decoded_time == 0)
|
||||
list_args[8] = Qnil;
|
||||
else
|
||||
XSETINT (list_args[8], tm_diff (&save_tm, decoded_time));
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
return Flist (9, list_args);
|
||||
}
|
||||
|
||||
|
@ -1901,9 +1901,9 @@ usage: (encode-time SECOND MINUTE HOUR DAY MONTH YEAR &optional ZONE) */)
|
|||
zone = XCAR (zone);
|
||||
if (NILP (zone))
|
||||
{
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
value = mktime (&tm);
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1928,7 +1928,7 @@ usage: (encode-time SECOND MINUTE HOUR DAY MONTH YEAR &optional ZONE) */)
|
|||
else
|
||||
error ("Invalid time zone specification");
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
|
||||
/* Set TZ before calling mktime; merely adjusting mktime's returned
|
||||
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) */)
|
|||
#ifdef LOCALTIME_CACHE
|
||||
tzset ();
|
||||
#endif
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
|
||||
xfree (newenv);
|
||||
}
|
||||
|
@ -1978,7 +1978,7 @@ but this is considered obsolete. */)
|
|||
newline, and without the 4-digit year limit. Don't use asctime
|
||||
or ctime, as they might dump core if the year is outside the
|
||||
range -999 .. 9999. */
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
tm = localtime (&value);
|
||||
if (tm)
|
||||
{
|
||||
|
@ -1994,7 +1994,7 @@ but this is considered obsolete. */)
|
|||
tm->tm_hour, tm->tm_min, tm->tm_sec,
|
||||
tm->tm_year + year_base);
|
||||
}
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
if (! tm)
|
||||
time_overflow ();
|
||||
|
||||
|
@ -2050,11 +2050,11 @@ the data it can't find. */)
|
|||
zone_offset = Qnil;
|
||||
value = make_emacs_time (lisp_seconds_argument (specified_time), 0);
|
||||
zone_name = format_time_string ("%Z", sizeof "%Z" - 1, value, 0, &localtm);
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
t = gmtime (emacs_secs_addr (&value));
|
||||
if (t)
|
||||
offset = tm_diff (&localtm, t);
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
|
||||
if (t)
|
||||
{
|
||||
|
@ -2101,7 +2101,7 @@ only the former. */)
|
|||
if (! (NILP (tz) || EQ (tz, Qt)))
|
||||
CHECK_STRING (tz);
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
|
||||
/* When called for the first time, save the original TZ. */
|
||||
old_environbuf = environbuf;
|
||||
|
@ -2118,7 +2118,7 @@ only the former. */)
|
|||
set_time_zone_rule (tzstring);
|
||||
environbuf = environ;
|
||||
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
|
||||
xfree (old_environbuf);
|
||||
return Qnil;
|
||||
|
|
168
src/emacs.c
168
src/emacs.c
|
@ -54,6 +54,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
|
|||
#include "window.h"
|
||||
|
||||
#include "systty.h"
|
||||
#include "atimer.h"
|
||||
#include "blockinput.h"
|
||||
#include "syssignal.h"
|
||||
#include "process.h"
|
||||
|
@ -269,9 +270,6 @@ Report bugs to bug-gnu-emacs@gnu.org. First, please see the Bugs\n\
|
|||
section of the Emacs manual or the file BUGS.\n"
|
||||
|
||||
|
||||
/* Signal code for the fatal signal that was received. */
|
||||
static int fatal_error_code;
|
||||
|
||||
/* True if handling a fatal error already. */
|
||||
bool fatal_error_in_progress;
|
||||
|
||||
|
@ -282,28 +280,12 @@ static void *ns_pool;
|
|||
|
||||
|
||||
|
||||
/* Handle bus errors, invalid instruction, etc. */
|
||||
static void
|
||||
handle_fatal_signal (int sig)
|
||||
{
|
||||
fatal_error_backtrace (sig, 10);
|
||||
}
|
||||
|
||||
static void
|
||||
deliver_fatal_signal (int sig)
|
||||
{
|
||||
handle_on_main_thread (sig, handle_fatal_signal);
|
||||
}
|
||||
|
||||
/* Report a fatal error due to signal SIG, output a backtrace of at
|
||||
most BACKTRACE_LIMIT lines, and exit. */
|
||||
_Noreturn void
|
||||
fatal_error_backtrace (int sig, int backtrace_limit)
|
||||
terminate_due_to_signal (int sig, int backtrace_limit)
|
||||
{
|
||||
fatal_error_code = sig;
|
||||
signal (sig, SIG_DFL);
|
||||
|
||||
TOTALLY_UNBLOCK_INPUT;
|
||||
totally_unblock_input ();
|
||||
|
||||
/* If fatal error occurs in code below, avoid infinite recursion. */
|
||||
if (! fatal_error_in_progress)
|
||||
|
@ -318,19 +300,18 @@ fatal_error_backtrace (int sig, int backtrace_limit)
|
|||
}
|
||||
|
||||
/* Signal the same code; this time it will really be fatal.
|
||||
Remember that since we're in a signal handler, the signal we're
|
||||
going to send is probably blocked, so we have to unblock it if we
|
||||
want to really receive it. */
|
||||
Since we're in a signal handler, the signal is blocked, so we
|
||||
have to unblock it if we want to really receive it. */
|
||||
#ifndef MSDOS
|
||||
{
|
||||
sigset_t unblocked;
|
||||
sigemptyset (&unblocked);
|
||||
sigaddset (&unblocked, fatal_error_code);
|
||||
sigaddset (&unblocked, sig);
|
||||
pthread_sigmask (SIG_UNBLOCK, &unblocked, 0);
|
||||
}
|
||||
#endif
|
||||
|
||||
kill (getpid (), fatal_error_code);
|
||||
emacs_raise (sig);
|
||||
|
||||
/* This shouldn't be executed, but it prevents a warning. */
|
||||
exit (1);
|
||||
|
@ -339,15 +320,9 @@ fatal_error_backtrace (int sig, int backtrace_limit)
|
|||
#ifdef SIGDANGER
|
||||
|
||||
/* Handler for SIGDANGER. */
|
||||
static void deliver_danger_signal (int);
|
||||
|
||||
static void
|
||||
handle_danger_signal (int sig)
|
||||
{
|
||||
struct sigaction action;
|
||||
emacs_sigaction_init (&action, deliver_danger_signal);
|
||||
sigaction (sig, &action, 0);
|
||||
|
||||
malloc_warning ("Operating system warns that virtual memory is running low.\n");
|
||||
|
||||
/* It might be unsafe to call do_auto_save now. */
|
||||
|
@ -357,7 +332,7 @@ handle_danger_signal (int sig)
|
|||
static void
|
||||
deliver_danger_signal (int sig)
|
||||
{
|
||||
handle_on_main_thread (sig, handle_danger_signal);
|
||||
deliver_process_signal (sig, handle_danger_signal);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -680,6 +655,7 @@ main (int argc, char **argv)
|
|||
#endif
|
||||
char stack_bottom_variable;
|
||||
bool do_initial_setlocale;
|
||||
bool dumping;
|
||||
int skip_args = 0;
|
||||
#ifdef HAVE_SETRLIMIT
|
||||
struct rlimit rlim;
|
||||
|
@ -691,7 +667,6 @@ main (int argc, char **argv)
|
|||
char dname_arg2[80];
|
||||
#endif
|
||||
char *ch_to_dir;
|
||||
struct sigaction fatal_error_action;
|
||||
|
||||
#if GC_MARK_STACK
|
||||
stack_base = &dummy;
|
||||
|
@ -777,12 +752,11 @@ main (int argc, char **argv)
|
|||
exit (1);
|
||||
}
|
||||
|
||||
dumping = !initialized && (strcmp (argv[argc - 1], "dump") == 0
|
||||
|| strcmp (argv[argc - 1], "bootstrap") == 0);
|
||||
|
||||
#ifdef HAVE_PERSONALITY_LINUX32
|
||||
if (!initialized
|
||||
&& (strcmp (argv[argc-1], "dump") == 0
|
||||
|| strcmp (argv[argc-1], "bootstrap") == 0)
|
||||
&& ! getenv ("EMACS_HEAP_EXEC"))
|
||||
if (dumping && ! getenv ("EMACS_HEAP_EXEC"))
|
||||
{
|
||||
static char heapexec[] = "EMACS_HEAP_EXEC=true";
|
||||
/* 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
|
|||
#endif
|
||||
}
|
||||
|
||||
init_signals ();
|
||||
emacs_sigaction_init (&fatal_error_action, deliver_fatal_signal);
|
||||
|
||||
/* Don't catch SIGHUP if dumping. */
|
||||
if (1
|
||||
#ifndef CANNOT_DUMP
|
||||
&& initialized
|
||||
#endif
|
||||
)
|
||||
{
|
||||
/* In --batch mode, don't catch SIGHUP if already ignored.
|
||||
That makes nohup work. */
|
||||
bool catch_SIGHUP = !noninteractive;
|
||||
if (!catch_SIGHUP)
|
||||
{
|
||||
struct sigaction old_action;
|
||||
sigaction (SIGHUP, 0, &old_action);
|
||||
catch_SIGHUP = old_action.sa_handler != SIG_IGN;
|
||||
}
|
||||
if (catch_SIGHUP)
|
||||
sigaction (SIGHUP, &fatal_error_action, 0);
|
||||
}
|
||||
|
||||
if (
|
||||
#ifndef CANNOT_DUMP
|
||||
! noninteractive || initialized
|
||||
#else
|
||||
1
|
||||
#endif
|
||||
)
|
||||
{
|
||||
/* Don't catch these signals in batch mode if dumping.
|
||||
On some machines, this sets static data that would make
|
||||
signal fail to work right when the dumped Emacs is run. */
|
||||
sigaction (SIGQUIT, &fatal_error_action, 0);
|
||||
sigaction (SIGILL, &fatal_error_action, 0);
|
||||
sigaction (SIGTRAP, &fatal_error_action, 0);
|
||||
#ifdef SIGUSR1
|
||||
add_user_signal (SIGUSR1, "sigusr1");
|
||||
#endif
|
||||
#ifdef SIGUSR2
|
||||
add_user_signal (SIGUSR2, "sigusr2");
|
||||
#endif
|
||||
#ifdef SIGABRT
|
||||
sigaction (SIGABRT, &fatal_error_action, 0);
|
||||
#endif
|
||||
#ifdef SIGHWE
|
||||
sigaction (SIGHWE, &fatal_error_action, 0);
|
||||
#endif
|
||||
#ifdef SIGPRE
|
||||
sigaction (SIGPRE, &fatal_error_action, 0);
|
||||
#endif
|
||||
#ifdef SIGORE
|
||||
sigaction (SIGORE, &fatal_error_action, 0);
|
||||
#endif
|
||||
#ifdef SIGUME
|
||||
sigaction (SIGUME, &fatal_error_action, 0);
|
||||
#endif
|
||||
#ifdef SIGDLK
|
||||
sigaction (SIGDLK, &fatal_error_action, 0);
|
||||
#endif
|
||||
#ifdef SIGCPULIM
|
||||
sigaction (SIGCPULIM, &fatal_error_action, 0);
|
||||
#endif
|
||||
#ifdef SIGIOT
|
||||
/* This is missing on some systems - OS/2, for example. */
|
||||
sigaction (SIGIOT, &fatal_error_action, 0);
|
||||
#endif
|
||||
#ifdef SIGEMT
|
||||
sigaction (SIGEMT, &fatal_error_action, 0);
|
||||
#endif
|
||||
sigaction (SIGFPE, &fatal_error_action, 0);
|
||||
#ifdef SIGBUS
|
||||
sigaction (SIGBUS, &fatal_error_action, 0);
|
||||
#endif
|
||||
sigaction (SIGSEGV, &fatal_error_action, 0);
|
||||
#ifdef SIGSYS
|
||||
sigaction (SIGSYS, &fatal_error_action, 0);
|
||||
#endif
|
||||
/* May need special treatment on MS-Windows. See
|
||||
http://lists.gnu.org/archive/html/emacs-devel/2010-09/msg01062.html
|
||||
Please update the doc of kill-emacs, kill-emacs-hook, and
|
||||
NEWS if you change this.
|
||||
*/
|
||||
if (noninteractive)
|
||||
sigaction (SIGINT, &fatal_error_action, 0);
|
||||
sigaction (SIGTERM, &fatal_error_action, 0);
|
||||
#ifdef SIGXCPU
|
||||
sigaction (SIGXCPU, &fatal_error_action, 0);
|
||||
#endif
|
||||
#ifdef SIGXFSZ
|
||||
sigaction (SIGXFSZ, &fatal_error_action, 0);
|
||||
#endif /* SIGXFSZ */
|
||||
|
||||
#ifdef SIGDANGER
|
||||
/* This just means available memory is getting low. */
|
||||
{
|
||||
struct sigaction action;
|
||||
emacs_sigaction_init (&action, deliver_danger_signal);
|
||||
sigaction (SIGDANGER, &action, 0);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef AIX
|
||||
/* 20 is SIGCHLD, 21 is SIGTTIN, 22 is SIGTTOU. */
|
||||
sigaction (SIGXCPU, &fatal_error_action, 0);
|
||||
sigaction (SIGIOINT, &fatal_error_action, 0);
|
||||
sigaction (SIGGRANT, &fatal_error_action, 0);
|
||||
sigaction (SIGRETRACT, &fatal_error_action, 0);
|
||||
sigaction (SIGSOUND, &fatal_error_action, 0);
|
||||
sigaction (SIGMSG, &fatal_error_action, 0);
|
||||
#endif /* AIX */
|
||||
}
|
||||
init_signals (dumping);
|
||||
|
||||
noninteractive1 = noninteractive;
|
||||
|
||||
|
@ -1281,7 +1143,6 @@ Using an Emacs configured with --with-x-toolkit=lucid does not have this problem
|
|||
}
|
||||
|
||||
init_eval ();
|
||||
init_data ();
|
||||
init_atimer ();
|
||||
running_asynch_code = 0;
|
||||
init_random ();
|
||||
|
@ -1407,8 +1268,7 @@ Using an Emacs configured with --with-x-toolkit=lucid does not have this problem
|
|||
/* egetenv is a pretty low-level facility, which may get called in
|
||||
many circumstances; it seems flimsy to put off initializing it
|
||||
until calling init_callproc. Do not do it when dumping. */
|
||||
if (initialized || ((strcmp (argv[argc-1], "dump") != 0
|
||||
&& strcmp (argv[argc-1], "bootstrap") != 0)))
|
||||
if (! dumping)
|
||||
set_initial_environment ();
|
||||
|
||||
/* AIX crashes are reported in system versions 3.2.3 and 3.2.4
|
||||
|
|
18
src/eval.c
18
src/eval.c
|
@ -1076,7 +1076,7 @@ internal_catch (Lisp_Object tag, Lisp_Object (*func) (Lisp_Object), Lisp_Object
|
|||
/* Unwind the specbind, catch, and handler stacks back to CATCH, and
|
||||
jump to that CATCH, returning VALUE as the value of that catch.
|
||||
|
||||
This is the guts Fthrow and Fsignal; they differ only in the way
|
||||
This is the guts of Fthrow and Fsignal; they differ only in the way
|
||||
they choose the catch tag to throw to. A catch tag for a
|
||||
condition-case form has a TAG of Qnil.
|
||||
|
||||
|
@ -1085,7 +1085,7 @@ internal_catch (Lisp_Object tag, Lisp_Object (*func) (Lisp_Object), Lisp_Object
|
|||
the handler stack as we go, so that the proper handlers are in
|
||||
effect for each unwind-protect clause we run. At the end, restore
|
||||
some static info saved in CATCH, and longjmp to the location
|
||||
specified in the
|
||||
specified there.
|
||||
|
||||
This is used for correct unwinding in Fthrow and Fsignal. */
|
||||
|
||||
|
@ -1099,7 +1099,7 @@ unwind_to_catch (struct catchtag *catch, Lisp_Object value)
|
|||
|
||||
/* Restore certain special C variables. */
|
||||
set_poll_suppress_count (catch->poll_suppress_count);
|
||||
UNBLOCK_INPUT_TO (catch->interrupt_input_blocked);
|
||||
unblock_input_to (catch->interrupt_input_blocked);
|
||||
immediate_quit = 0;
|
||||
|
||||
do
|
||||
|
@ -1114,16 +1114,6 @@ unwind_to_catch (struct catchtag *catch, Lisp_Object value)
|
|||
}
|
||||
while (! last_time);
|
||||
|
||||
#if HAVE_X_WINDOWS
|
||||
/* If x_catch_errors was done, turn it off now.
|
||||
(First we give unbind_to a chance to do that.) */
|
||||
#if 0 /* This would disable x_catch_errors after x_connection_closed.
|
||||
The catch must remain in effect during that delicate
|
||||
state. --lorentey */
|
||||
x_fully_uncatch_errors ();
|
||||
#endif
|
||||
#endif
|
||||
|
||||
byte_stack_list = catch->byte_stack;
|
||||
gcprolist = catch->gcpro;
|
||||
#ifdef DEBUG_GCPRO
|
||||
|
@ -1713,7 +1703,7 @@ maybe_call_debugger (Lisp_Object conditions, Lisp_Object sig, Lisp_Object data)
|
|||
if (
|
||||
/* Don't try to run the debugger with interrupts blocked.
|
||||
The editing loop would return anyway. */
|
||||
! INPUT_BLOCKED_P
|
||||
! input_blocked_p ()
|
||||
&& NILP (Vinhibit_debugger)
|
||||
/* Does user want to enter debugger for this kind of error? */
|
||||
&& (EQ (sig, Qquit)
|
||||
|
|
24
src/fileio.c
24
src/fileio.c
|
@ -1025,9 +1025,9 @@ filesystem tree, not (expand-file-name ".." dirname). */)
|
|||
memcpy (o, nm, p - nm);
|
||||
o [p - nm] = 0;
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
pw = (struct passwd *) getpwnam (o + 1);
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
if (pw)
|
||||
{
|
||||
newdir = pw->pw_dir;
|
||||
|
@ -1413,9 +1413,9 @@ See also the function `substitute-in-file-name'.")
|
|||
o[len] = 0;
|
||||
|
||||
/* Look up the user name. */
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
pw = (struct passwd *) getpwnam (o + 1);
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
if (!pw)
|
||||
error ("\"%s\" isn't a registered user", o + 1);
|
||||
|
||||
|
@ -1531,9 +1531,9 @@ search_embedded_absfilename (char *nm, char *endp)
|
|||
/* If we have ~user and `user' exists, discard
|
||||
everything up to ~. But if `user' does not exist, leave
|
||||
~user alone, it might be a literal file name. */
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
pw = getpwnam (o + 1);
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
if (pw)
|
||||
return p;
|
||||
}
|
||||
|
@ -2999,10 +2999,10 @@ The value is an integer. */)
|
|||
mode_t realmask;
|
||||
Lisp_Object value;
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
realmask = umask (0);
|
||||
umask (realmask);
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
|
||||
XSETINT (value, (~ realmask) & 0777);
|
||||
return value;
|
||||
|
@ -5235,9 +5235,9 @@ do_auto_save_unwind (Lisp_Object arg) /* used as unwind-protect function */
|
|||
auto_saving = 0;
|
||||
if (stream != NULL)
|
||||
{
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
fclose (stream);
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
}
|
||||
return Qnil;
|
||||
}
|
||||
|
@ -5368,7 +5368,7 @@ A non-nil CURRENT-ONLY argument means save only current buffer. */)
|
|||
if (STRINGP (BVAR (b, auto_save_file_name))
|
||||
&& stream != NULL && do_handled_files == 0)
|
||||
{
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
if (!NILP (BVAR (b, filename)))
|
||||
{
|
||||
fwrite (SDATA (BVAR (b, filename)), 1,
|
||||
|
@ -5378,7 +5378,7 @@ A non-nil CURRENT-ONLY argument means save only current buffer. */)
|
|||
fwrite (SDATA (BVAR (b, auto_save_file_name)), 1,
|
||||
SBYTES (BVAR (b, auto_save_file_name)), stream);
|
||||
putc ('\n', stream);
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
}
|
||||
|
||||
if (!NILP (current_only)
|
||||
|
|
|
@ -31,15 +31,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
|
|||
#include <config.h>
|
||||
|
||||
#include "lisp.h"
|
||||
#include "syssignal.h"
|
||||
|
||||
#include <float.h>
|
||||
#if (FLT_RADIX == 2 && FLT_MANT_DIG == 24 \
|
||||
&& FLT_MIN_EXP == -125 && FLT_MAX_EXP == 128)
|
||||
#define IEEE_FLOATING_POINT 1
|
||||
#else
|
||||
#define IEEE_FLOATING_POINT 0
|
||||
#endif
|
||||
|
||||
#include <math.h>
|
||||
|
||||
|
|
|
@ -1838,13 +1838,6 @@ properties on the list. This function never signals an error. */)
|
|||
halftail = XCDR (halftail);
|
||||
if (EQ (tail, halftail))
|
||||
break;
|
||||
|
||||
#if 0 /* Unsafe version. */
|
||||
/* This function can be called asynchronously
|
||||
(setup_coding_system). Don't QUIT in that case. */
|
||||
if (!interrupt_input_blocked)
|
||||
QUIT;
|
||||
#endif
|
||||
}
|
||||
|
||||
return Qnil;
|
||||
|
|
|
@ -1275,7 +1275,7 @@ free_realized_fontsets (Lisp_Object base)
|
|||
doesn't remove FACE from a cache. Until we find a solution, we
|
||||
suppress this code, and simply use Fclear_face_cache even though
|
||||
that is not efficient. */
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
for (id = 0; id < ASIZE (Vfontset_table); id++)
|
||||
{
|
||||
Lisp_Object this = AREF (Vfontset_table, id);
|
||||
|
@ -1296,7 +1296,7 @@ free_realized_fontsets (Lisp_Object base)
|
|||
}
|
||||
}
|
||||
}
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
#else /* not 0 */
|
||||
/* But, we don't have to call Fclear_face_cache if no fontset has
|
||||
been realized from BASE. */
|
||||
|
|
|
@ -3533,9 +3533,9 @@ x_set_alpha (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
|
|||
f->alpha[i] = newval[i];
|
||||
|
||||
#if defined (HAVE_X_WINDOWS) || defined (HAVE_NTGUI) || defined (NS_IMPL_COCOA)
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
x_set_frame_alpha (f);
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
#endif
|
||||
|
||||
return;
|
||||
|
|
|
@ -872,7 +872,7 @@ draw_fringe_bitmap (struct window *w, struct glyph_row *row, int left_p)
|
|||
void
|
||||
draw_row_fringe_bitmaps (struct window *w, struct glyph_row *row)
|
||||
{
|
||||
eassert (interrupt_input_blocked);
|
||||
eassert (input_blocked_p ());
|
||||
|
||||
/* If row is completely invisible, because of vscrolling, we
|
||||
don't have to draw anything. */
|
||||
|
|
|
@ -98,7 +98,7 @@ ftxfont_get_gcs (FRAME_PTR f, long unsigned int foreground, long unsigned int ba
|
|||
new->colors[0].pixel = background;
|
||||
new->colors[1].pixel = foreground;
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
XQueryColors (FRAME_X_DISPLAY (f), FRAME_X_COLORMAP (f), new->colors, 2);
|
||||
for (i = 1; i < 7; i++)
|
||||
{
|
||||
|
@ -115,14 +115,14 @@ ftxfont_get_gcs (FRAME_PTR f, long unsigned int foreground, long unsigned int ba
|
|||
new->gcs[i - 1] = XCreateGC (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
|
||||
GCForeground, &xgcv);
|
||||
}
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
|
||||
if (i < 7)
|
||||
{
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
for (i--; i >= 0; i--)
|
||||
XFreeGC (FRAME_X_DISPLAY (f), new->gcs[i]);
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
if (prev)
|
||||
prev->next = new->next;
|
||||
else if (data)
|
||||
|
@ -282,7 +282,7 @@ ftxfont_draw (struct glyph_string *s, int from, int to, int x, int y,
|
|||
|
||||
n[0] = n[1] = n[2] = n[3] = n[4] = n[5] = n[6] = 0;
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
if (with_background)
|
||||
ftxfont_draw_background (f, font, s->gc, x, y, s->width);
|
||||
code = alloca (sizeof (unsigned) * len);
|
||||
|
@ -332,7 +332,7 @@ ftxfont_draw (struct glyph_string *s, int from, int to, int x, int y,
|
|||
}
|
||||
}
|
||||
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
|
||||
return len;
|
||||
}
|
||||
|
@ -342,7 +342,7 @@ ftxfont_end_for_frame (FRAME_PTR f)
|
|||
{
|
||||
struct ftxfont_frame_data *data = font_get_frame_data (f, &ftxfont_driver);
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
while (data)
|
||||
{
|
||||
struct ftxfont_frame_data *next = data->next;
|
||||
|
@ -353,7 +353,7 @@ ftxfont_end_for_frame (FRAME_PTR f)
|
|||
free (data);
|
||||
data = next;
|
||||
}
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
font_put_frame_data (f, &ftxfont_driver, NULL);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -590,7 +590,7 @@ xg_check_special_colors (struct frame *f,
|
|||
if (! FRAME_GTK_WIDGET (f) || ! (get_bg || get_fg))
|
||||
return success_p;
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
{
|
||||
#ifdef HAVE_GTK3
|
||||
GtkStyleContext *gsty
|
||||
|
@ -620,7 +620,7 @@ xg_check_special_colors (struct frame *f,
|
|||
#endif
|
||||
|
||||
}
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
return success_p;
|
||||
}
|
||||
|
||||
|
@ -725,7 +725,7 @@ xg_prepare_tooltip (FRAME_PTR f,
|
|||
|
||||
if (!x->ttip_lbl) return 0;
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
encoded_string = ENCODE_UTF_8 (string);
|
||||
widget = GTK_WIDGET (x->ttip_lbl);
|
||||
gwin = gtk_widget_get_window (GTK_WIDGET (x->ttip_window));
|
||||
|
@ -753,7 +753,7 @@ xg_prepare_tooltip (FRAME_PTR f,
|
|||
if (width) *width = req.width;
|
||||
if (height) *height = req.height;
|
||||
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
|
||||
return 1;
|
||||
#endif /* USE_GTK_TOOLTIP */
|
||||
|
@ -769,10 +769,10 @@ xg_show_tooltip (FRAME_PTR f, int root_x, int root_y)
|
|||
struct x_output *x = f->output_data.x;
|
||||
if (x->ttip_window)
|
||||
{
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
gtk_window_move (x->ttip_window, root_x, root_y);
|
||||
gtk_widget_show_all (GTK_WIDGET (x->ttip_window));
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
@ -789,7 +789,7 @@ xg_hide_tooltip (FRAME_PTR f)
|
|||
if (f->output_data.x->ttip_window)
|
||||
{
|
||||
GtkWindow *win = f->output_data.x->ttip_window;
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
gtk_widget_hide (GTK_WIDGET (win));
|
||||
|
||||
if (g_object_get_data (G_OBJECT (win), "restore-tt"))
|
||||
|
@ -799,7 +799,7 @@ xg_hide_tooltip (FRAME_PTR f)
|
|||
GtkSettings *settings = gtk_settings_get_for_screen (screen);
|
||||
g_object_set (settings, "gtk-enable-tooltips", TRUE, NULL);
|
||||
}
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
|
||||
ret = 1;
|
||||
}
|
||||
|
@ -1007,7 +1007,7 @@ xg_win_to_widget (Display *dpy, Window wdesc)
|
|||
gpointer gdkwin;
|
||||
GtkWidget *gwdesc = 0;
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
|
||||
gdkwin = gdk_x11_window_lookup_for_display (gdk_x11_lookup_xdisplay (dpy),
|
||||
wdesc);
|
||||
|
@ -1019,7 +1019,7 @@ xg_win_to_widget (Display *dpy, Window wdesc)
|
|||
gwdesc = gtk_get_event_widget (&event);
|
||||
}
|
||||
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
return gwdesc;
|
||||
}
|
||||
|
||||
|
@ -1123,7 +1123,7 @@ xg_create_frame_widgets (FRAME_PTR f)
|
|||
#endif
|
||||
char *title = 0;
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
|
||||
if (FRAME_X_EMBEDDED_P (f))
|
||||
{
|
||||
|
@ -1161,7 +1161,7 @@ xg_create_frame_widgets (FRAME_PTR f)
|
|||
if (whbox) gtk_widget_destroy (whbox);
|
||||
if (wfixed) gtk_widget_destroy (wfixed);
|
||||
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1275,7 +1275,7 @@ xg_create_frame_widgets (FRAME_PTR f)
|
|||
}
|
||||
}
|
||||
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
@ -1397,12 +1397,12 @@ x_wm_set_size_hint (FRAME_PTR f, long int flags, int user_position)
|
|||
&f->output_data.x->size_hints,
|
||||
sizeof (size_hints)) != 0)
|
||||
{
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
gtk_window_set_geometry_hints (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
|
||||
NULL, &size_hints, hint_flags);
|
||||
f->output_data.x->size_hints = size_hints;
|
||||
f->output_data.x->hint_flags = hint_flags;
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1417,9 +1417,9 @@ xg_set_background_color (FRAME_PTR f, long unsigned int bg)
|
|||
{
|
||||
if (FRAME_GTK_WIDGET (f))
|
||||
{
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
xg_set_widget_bg (f, FRAME_GTK_WIDGET (f), FRAME_BACKGROUND_PIXEL (f));
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1637,14 +1637,14 @@ pop_down_dialog (Lisp_Object arg)
|
|||
struct Lisp_Save_Value *p = XSAVE_VALUE (arg);
|
||||
struct xg_dialog_data *dd = (struct xg_dialog_data *) p->pointer;
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
if (dd->w) gtk_widget_destroy (dd->w);
|
||||
if (dd->timerid != 0) g_source_remove (dd->timerid);
|
||||
|
||||
g_main_loop_quit (dd->loop);
|
||||
g_main_loop_unref (dd->loop);
|
||||
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
|
||||
return Qnil;
|
||||
}
|
||||
|
@ -1973,16 +1973,6 @@ xg_get_file_name (FRAME_PTR f,
|
|||
int filesel_done = 0;
|
||||
xg_get_file_func func;
|
||||
|
||||
#if defined (HAVE_PTHREAD) && defined (__SIGRTMIN)
|
||||
/* I really don't know why this is needed, but without this the GLIBC add on
|
||||
library linuxthreads hangs when the Gnome file chooser backend creates
|
||||
threads. */
|
||||
sigset_t blocked;
|
||||
sigemptyset (&blocked);
|
||||
sigaddset (&blocked, __SIGRTMIN);
|
||||
pthread_sigmask (SIG_BLOCK, &blocked, 0);
|
||||
#endif /* HAVE_PTHREAD */
|
||||
|
||||
#ifdef HAVE_GTK_FILE_SELECTION_NEW
|
||||
|
||||
if (xg_uses_old_file_dialog ())
|
||||
|
@ -2000,11 +1990,6 @@ xg_get_file_name (FRAME_PTR f,
|
|||
gtk_widget_set_name (w, "emacs-filedialog");
|
||||
|
||||
filesel_done = xg_dialog_run (f, w);
|
||||
|
||||
#if defined (HAVE_PTHREAD) && defined (__SIGRTMIN)
|
||||
pthread_sigmask (SIG_UNBLOCK, &blocked, 0);
|
||||
#endif
|
||||
|
||||
if (filesel_done == GTK_RESPONSE_OK)
|
||||
fn = (*func) (w);
|
||||
|
||||
|
@ -2057,13 +2042,6 @@ xg_get_font (FRAME_PTR f, const char *default_name)
|
|||
int done = 0;
|
||||
Lisp_Object font = Qnil;
|
||||
|
||||
#if defined (HAVE_PTHREAD) && defined (__SIGRTMIN)
|
||||
sigset_t blocked;
|
||||
sigemptyset (&blocked);
|
||||
sigaddset (&blocked, __SIGRTMIN);
|
||||
pthread_sigmask (SIG_BLOCK, &blocked, 0);
|
||||
#endif /* HAVE_PTHREAD */
|
||||
|
||||
w = gtk_font_chooser_dialog_new
|
||||
("Pick a font", GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)));
|
||||
|
||||
|
@ -2088,11 +2066,6 @@ xg_get_font (FRAME_PTR f, const char *default_name)
|
|||
|
||||
gtk_widget_set_name (w, "emacs-fontdialog");
|
||||
done = xg_dialog_run (f, w);
|
||||
|
||||
#if defined (HAVE_PTHREAD) && defined (__SIGRTMIN)
|
||||
pthread_sigmask (SIG_UNBLOCK, &blocked, 0);
|
||||
#endif
|
||||
|
||||
if (done == GTK_RESPONSE_OK)
|
||||
{
|
||||
#if USE_NEW_GTK_FONT_CHOOSER
|
||||
|
@ -3358,7 +3331,7 @@ xg_update_frame_menubar (FRAME_PTR f)
|
|||
if (x->menubar_widget && gtk_widget_get_parent (x->menubar_widget))
|
||||
return 0; /* Already done this, happens for frames created invisible. */
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (x->vbox_widget), x->menubar_widget,
|
||||
FALSE, FALSE, 0);
|
||||
|
@ -3378,7 +3351,7 @@ xg_update_frame_menubar (FRAME_PTR f)
|
|||
FRAME_MENUBAR_HEIGHT (f) = req.height;
|
||||
xg_height_or_width_changed (f);
|
||||
}
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
@ -3393,7 +3366,7 @@ free_frame_menubar (FRAME_PTR f)
|
|||
|
||||
if (x->menubar_widget)
|
||||
{
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
|
||||
gtk_container_remove (GTK_CONTAINER (x->vbox_widget), x->menubar_widget);
|
||||
/* The menubar and its children shall be deleted when removed from
|
||||
|
@ -3401,7 +3374,7 @@ free_frame_menubar (FRAME_PTR f)
|
|||
x->menubar_widget = 0;
|
||||
FRAME_MENUBAR_HEIGHT (f) = 0;
|
||||
xg_height_or_width_changed (f);
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3838,7 +3811,7 @@ xg_set_toolkit_scroll_bar_thumb (struct scroll_bar *bar,
|
|||
|
||||
if (changed || int_gtk_range_get_value (GTK_RANGE (wscroll)) != value)
|
||||
{
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
|
||||
/* gtk_range_set_value invokes the callback. Set
|
||||
ignore_gtk_scrollbar to make the callback do nothing */
|
||||
|
@ -3851,7 +3824,7 @@ xg_set_toolkit_scroll_bar_thumb (struct scroll_bar *bar,
|
|||
|
||||
xg_ignore_gtk_scrollbar = 0;
|
||||
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4642,7 +4615,7 @@ update_frame_tool_bar (FRAME_PTR f)
|
|||
if (! FRAME_GTK_WIDGET (f))
|
||||
return;
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
|
||||
if (RANGED_INTEGERP (1, Vtool_bar_button_margin, INT_MAX))
|
||||
{
|
||||
|
@ -4684,7 +4657,7 @@ update_frame_tool_bar (FRAME_PTR f)
|
|||
&& ! NILP (Fequal (tbinfo->style, style))
|
||||
&& ! NILP (Fequal (tbinfo->last_tool_bar, f->tool_bar_items)))
|
||||
{
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -4895,7 +4868,7 @@ update_frame_tool_bar (FRAME_PTR f)
|
|||
xg_height_or_width_changed (f);
|
||||
}
|
||||
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
}
|
||||
|
||||
/* Deallocate all resources for the tool bar on frame F.
|
||||
|
@ -4910,7 +4883,7 @@ free_frame_tool_bar (FRAME_PTR f)
|
|||
{
|
||||
struct xg_frame_tb_info *tbinfo;
|
||||
int is_packed = x->handlebox_widget != 0;
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
/* We may have created the toolbar_widget in xg_create_tool_bar, but
|
||||
not the x->handlebox_widget which is created in xg_pack_tool_bar. */
|
||||
if (is_packed)
|
||||
|
@ -4942,7 +4915,7 @@ free_frame_tool_bar (FRAME_PTR f)
|
|||
|
||||
xg_height_or_width_changed (f);
|
||||
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4954,7 +4927,7 @@ xg_change_toolbar_position (FRAME_PTR f, Lisp_Object pos)
|
|||
if (! x->toolbar_widget || ! x->handlebox_widget)
|
||||
return 1;
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
g_object_ref (x->handlebox_widget);
|
||||
if (x->toolbar_in_hbox)
|
||||
gtk_container_remove (GTK_CONTAINER (x->hbox_widget),
|
||||
|
@ -4967,7 +4940,7 @@ xg_change_toolbar_position (FRAME_PTR f, Lisp_Object pos)
|
|||
if (xg_update_tool_bar_sizes (f))
|
||||
xg_height_or_width_changed (f);
|
||||
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
50
src/image.c
50
src/image.c
|
@ -407,9 +407,9 @@ x_destroy_bitmap (FRAME_PTR f, ptrdiff_t id)
|
|||
|
||||
if (--bm->refcount == 0)
|
||||
{
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
free_bitmap_record (dpyinfo, bm);
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -470,19 +470,19 @@ x_create_bitmap_mask (struct frame *f, ptrdiff_t id)
|
|||
width = x_bitmap_width (f, id);
|
||||
height = x_bitmap_height (f, id);
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
ximg = XGetImage (FRAME_X_DISPLAY (f), pixmap, 0, 0, width, height,
|
||||
~0, ZPixmap);
|
||||
|
||||
if (!ximg)
|
||||
{
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
return -1;
|
||||
}
|
||||
|
||||
result = x_create_x_image_and_pixmap (f, width, height, 1, &mask_img, &mask);
|
||||
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
if (!result)
|
||||
{
|
||||
XDestroyImage (ximg);
|
||||
|
@ -514,7 +514,7 @@ x_create_bitmap_mask (struct frame *f, ptrdiff_t id)
|
|||
}
|
||||
}
|
||||
|
||||
eassert (interrupt_input_blocked);
|
||||
eassert (input_blocked_p ());
|
||||
gc = XCreateGC (FRAME_X_DISPLAY (f), mask, 0, NULL);
|
||||
XPutImage (FRAME_X_DISPLAY (f), mask, gc, mask_img, 0, 0, 0, 0,
|
||||
width, height);
|
||||
|
@ -593,7 +593,7 @@ define_image_type (struct image_type *type, Lisp_Object libraries)
|
|||
Lisp_Object target_type = *type->type;
|
||||
int type_valid = 1;
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
|
||||
for (p = image_types; p; p = p->next)
|
||||
if (EQ (*p->type, target_type))
|
||||
|
@ -625,7 +625,7 @@ define_image_type (struct image_type *type, Lisp_Object libraries)
|
|||
}
|
||||
|
||||
done:
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
return p;
|
||||
}
|
||||
|
||||
|
@ -1328,9 +1328,9 @@ x_clear_image_1 (struct frame *f, struct image *img, int pixmap_p, int mask_p,
|
|||
static void
|
||||
x_clear_image (struct frame *f, struct image *img)
|
||||
{
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
x_clear_image_1 (f, img, 1, 1, 1);
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
}
|
||||
|
||||
|
||||
|
@ -1485,7 +1485,7 @@ clear_image_cache (struct frame *f, Lisp_Object filter)
|
|||
|
||||
/* Block input so that we won't be interrupted by a SIGIO
|
||||
while being in an inconsistent state. */
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
|
||||
if (!NILP (filter))
|
||||
{
|
||||
|
@ -1551,7 +1551,7 @@ clear_image_cache (struct frame *f, Lisp_Object filter)
|
|||
++windows_or_buffers_changed;
|
||||
}
|
||||
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1716,7 +1716,7 @@ lookup_image (struct frame *f, Lisp_Object spec)
|
|||
/* If not found, create a new image and cache it. */
|
||||
if (img == NULL)
|
||||
{
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
img = make_image (spec, hash);
|
||||
cache_image (f, img);
|
||||
img->load_failed_p = img->type->load (f, img) == 0;
|
||||
|
@ -1787,7 +1787,7 @@ lookup_image (struct frame *f, Lisp_Object spec)
|
|||
postprocess_image (f, img);
|
||||
}
|
||||
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
}
|
||||
|
||||
/* 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,
|
|||
Window window = FRAME_X_WINDOW (f);
|
||||
Screen *screen = FRAME_X_SCREEN (f);
|
||||
|
||||
eassert (interrupt_input_blocked);
|
||||
eassert (input_blocked_p ());
|
||||
|
||||
if (depth <= 0)
|
||||
depth = DefaultDepthOfScreen (screen);
|
||||
|
@ -2078,7 +2078,7 @@ x_create_x_image_and_pixmap (struct frame *f, int width, int height, int depth,
|
|||
static void
|
||||
x_destroy_x_image (XImagePtr ximg)
|
||||
{
|
||||
eassert (interrupt_input_blocked);
|
||||
eassert (input_blocked_p ());
|
||||
if (ximg)
|
||||
{
|
||||
#ifdef HAVE_X_WINDOWS
|
||||
|
@ -2107,7 +2107,7 @@ x_put_x_image (struct frame *f, XImagePtr ximg, Pixmap pixmap, int width, int he
|
|||
#ifdef HAVE_X_WINDOWS
|
||||
GC gc;
|
||||
|
||||
eassert (interrupt_input_blocked);
|
||||
eassert (input_blocked_p ());
|
||||
gc = XCreateGC (FRAME_X_DISPLAY (f), pixmap, 0, NULL);
|
||||
XPutImage (FRAME_X_DISPLAY (f), pixmap, gc, ximg, 0, 0, 0, 0, width, height);
|
||||
XFreeGC (FRAME_X_DISPLAY (f), gc);
|
||||
|
@ -4311,12 +4311,12 @@ lookup_pixel_color (struct frame *f, unsigned long pixel)
|
|||
x_query_color (f, &color);
|
||||
rc = x_alloc_nearest_color (f, cmap, &color);
|
||||
#else
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
cmap = DefaultColormapOfScreen (FRAME_X_SCREEN (f));
|
||||
color.pixel = pixel;
|
||||
XQueryColor (NULL, cmap, &color);
|
||||
rc = x_alloc_nearest_color (f, cmap, &color);
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
#endif /* HAVE_X_WINDOWS */
|
||||
|
||||
if (rc)
|
||||
|
@ -8656,11 +8656,11 @@ gs_load (struct frame *f, struct image *img)
|
|||
if (x_check_image_size (0, img->width, img->height))
|
||||
{
|
||||
/* Only W32 version did BLOCK_INPUT here. ++kfs */
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
img->pixmap = XCreatePixmap (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
|
||||
img->width, img->height,
|
||||
DefaultDepthOfScreen (FRAME_X_SCREEN (f)));
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
}
|
||||
|
||||
if (!img->pixmap)
|
||||
|
@ -8736,7 +8736,7 @@ x_kill_gs_process (Pixmap pixmap, struct frame *f)
|
|||
{
|
||||
XImagePtr ximg;
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
|
||||
/* Try to get an XImage for img->pixmep. */
|
||||
ximg = XGetImage (FRAME_X_DISPLAY (f), img->pixmap,
|
||||
|
@ -8779,15 +8779,15 @@ x_kill_gs_process (Pixmap pixmap, struct frame *f)
|
|||
image_error ("Cannot get X image of `%s'; colors will not be freed",
|
||||
img->spec, Qnil);
|
||||
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
}
|
||||
#endif /* HAVE_X_WINDOWS */
|
||||
|
||||
/* Now that we have the pixmap, compute mask and transform the
|
||||
image if requested. */
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
postprocess_image (f, img);
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
}
|
||||
|
||||
#endif /* HAVE_GHOSTSCRIPT */
|
||||
|
|
269
src/keyboard.c
269
src/keyboard.c
|
@ -19,6 +19,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
|
|||
|
||||
#include <config.h>
|
||||
|
||||
#define BLOCKINPUT_INLINE EXTERN_INLINE
|
||||
#define KEYBOARD_INLINE EXTERN_INLINE
|
||||
|
||||
#include <stdio.h>
|
||||
|
@ -72,19 +73,12 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
|
|||
|
||||
/* Variables for blockinput.h: */
|
||||
|
||||
/* Non-zero if interrupt input is blocked right now. */
|
||||
/* Positive if interrupt input is blocked right now. */
|
||||
volatile int interrupt_input_blocked;
|
||||
|
||||
/* Nonzero means an input interrupt has arrived
|
||||
during the current critical section. */
|
||||
int interrupt_input_pending;
|
||||
|
||||
/* This var should be (interrupt_input_pending || pending_atimers).
|
||||
The QUIT macro checks this instead of interrupt_input_pending and
|
||||
pending_atimers separately, to reduce code size. So, any code that
|
||||
changes interrupt_input_pending or pending_atimers should update
|
||||
this too. */
|
||||
int pending_signals;
|
||||
/* Nonzero means an input interrupt or alarm signal has arrived.
|
||||
The QUIT macro checks this. */
|
||||
volatile int pending_signals;
|
||||
|
||||
#define KBD_BUFFER_SIZE 4096
|
||||
|
||||
|
@ -225,7 +219,11 @@ static Lisp_Object last_point_position_window;
|
|||
last event came from a macro. We use this to determine when to
|
||||
generate switch-frame events. This may be cleared by functions
|
||||
like Fselect_frame, to make sure that a switch-frame event is
|
||||
generated by the next character. */
|
||||
generated by the next character.
|
||||
|
||||
FIXME: This is modified by a signal handler so it should be volatile.
|
||||
It's exported to Lisp, though, so it can't simply be marked
|
||||
'volatile' here. */
|
||||
Lisp_Object internal_last_event_frame;
|
||||
|
||||
/* The timestamp of the last input event we received from the X server.
|
||||
|
@ -389,7 +387,7 @@ int interrupts_deferred;
|
|||
|
||||
/* If we support a window system, turn on the code to poll periodically
|
||||
to detect C-g. It isn't actually used when doing interrupt input. */
|
||||
#if defined (HAVE_WINDOW_SYSTEM) && !defined (USE_ASYNC_EVENTS)
|
||||
#ifdef HAVE_WINDOW_SYSTEM
|
||||
#define POLL_FOR_INPUT
|
||||
#endif
|
||||
|
||||
|
@ -413,7 +411,6 @@ static EMACS_TIME timer_last_idleness_start_time;
|
|||
/* Function for init_keyboard to call with no args (if nonzero). */
|
||||
static void (*keyboard_init_hook) (void);
|
||||
|
||||
static int read_avail_input (void);
|
||||
static void get_input_pending (int *, int);
|
||||
static int readable_events (int);
|
||||
static Lisp_Object read_char_x_menu_prompt (ptrdiff_t, Lisp_Object *,
|
||||
|
@ -440,7 +437,7 @@ static Lisp_Object restore_kboard_configuration (Lisp_Object);
|
|||
#ifdef USABLE_SIGIO
|
||||
static void deliver_input_available_signal (int signo);
|
||||
#endif
|
||||
static void handle_interrupt (void);
|
||||
static void handle_interrupt (bool);
|
||||
static _Noreturn void quit_throw_to_read_char (int);
|
||||
static void process_special_events (void);
|
||||
static void timer_start_idle (void);
|
||||
|
@ -823,7 +820,7 @@ This function is called by the editor initialization to begin editing. */)
|
|||
|
||||
/* If we enter while input is blocked, don't lock up here.
|
||||
This may happen through the debugger during redisplay. */
|
||||
if (INPUT_BLOCKED_P)
|
||||
if (input_blocked_p ())
|
||||
return Qnil;
|
||||
|
||||
command_loop_level++;
|
||||
|
@ -1216,8 +1213,7 @@ This also exits all active minibuffers. */)
|
|||
|
||||
/* Unblock input if we enter with input blocked. This may happen if
|
||||
redisplay traps e.g. during tool-bar update with input blocked. */
|
||||
while (INPUT_BLOCKED_P)
|
||||
UNBLOCK_INPUT;
|
||||
totally_unblock_input ();
|
||||
|
||||
Fthrow (Qtop_level, Qnil);
|
||||
}
|
||||
|
@ -1460,15 +1456,6 @@ command_loop_1 (void)
|
|||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
/* Select the frame that the last event came from. Usually,
|
||||
switch-frame events will take care of this, but if some lisp
|
||||
code swallows a switch-frame event, we'll fix things up here.
|
||||
Is this a good idea? */
|
||||
if (FRAMEP (internal_last_event_frame)
|
||||
&& !EQ (internal_last_event_frame, selected_frame))
|
||||
Fselect_frame (internal_last_event_frame, Qnil);
|
||||
#endif
|
||||
/* If it has changed current-menubar from previous value,
|
||||
really recompute the menubar from the value. */
|
||||
if (! NILP (Vlucid_menu_bar_dirty_flag)
|
||||
|
@ -2008,9 +1995,9 @@ static struct atimer *poll_timer;
|
|||
void
|
||||
poll_for_input_1 (void)
|
||||
{
|
||||
if (interrupt_input_blocked == 0
|
||||
if (! input_blocked_p ()
|
||||
&& !waiting_for_input)
|
||||
read_avail_input ();
|
||||
gobble_input ();
|
||||
}
|
||||
|
||||
/* Timer callback function for poll_timer. TIMER is equal to
|
||||
|
@ -2020,10 +2007,7 @@ static void
|
|||
poll_for_input (struct atimer *timer)
|
||||
{
|
||||
if (poll_suppress_count == 0)
|
||||
{
|
||||
interrupt_input_pending = 1;
|
||||
pending_signals = 1;
|
||||
}
|
||||
pending_signals = 1;
|
||||
}
|
||||
|
||||
#endif /* POLL_FOR_INPUT */
|
||||
|
@ -3344,7 +3328,7 @@ record_char (Lisp_Object c)
|
|||
If you, dear reader, have a better idea, you've got the source. :-) */
|
||||
if (dribble)
|
||||
{
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
if (INTEGERP (c))
|
||||
{
|
||||
if (XUINT (c) < 0x100)
|
||||
|
@ -3370,7 +3354,7 @@ record_char (Lisp_Object c)
|
|||
}
|
||||
|
||||
fflush (dribble);
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3514,10 +3498,8 @@ kbd_buffer_store_event (register struct input_event *event)
|
|||
Else, if EVENT is a quit event, store the quit event
|
||||
in HOLD_QUIT, and return (thus ignoring further events).
|
||||
|
||||
This is used in read_avail_input to postpone the processing
|
||||
of the quit event until all subsequent input events have been
|
||||
parsed (and discarded).
|
||||
*/
|
||||
This is used to postpone the processing of the quit event until all
|
||||
subsequent input events have been parsed (and discarded). */
|
||||
|
||||
void
|
||||
kbd_buffer_store_event_hold (register struct input_event *event,
|
||||
|
@ -3587,7 +3569,8 @@ kbd_buffer_store_event_hold (register struct input_event *event,
|
|||
}
|
||||
|
||||
last_event_timestamp = event->timestamp;
|
||||
handle_interrupt ();
|
||||
|
||||
handle_interrupt (0);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -3643,7 +3626,6 @@ kbd_buffer_store_event_hold (register struct input_event *event,
|
|||
if (immediate_quit && NILP (Vinhibit_quit))
|
||||
{
|
||||
immediate_quit = 0;
|
||||
pthread_sigmask (SIG_SETMASK, &empty_mask, 0);
|
||||
QUIT;
|
||||
}
|
||||
}
|
||||
|
@ -3793,14 +3775,6 @@ kbd_buffer_get_event (KBOARD **kbp,
|
|||
/* Start reading input again, we have processed enough so we can
|
||||
accept new events again. */
|
||||
unhold_keyboard_input ();
|
||||
#ifdef USABLE_SIGIO
|
||||
if (!noninteractive)
|
||||
{
|
||||
struct sigaction action;
|
||||
emacs_sigaction_init (&action, deliver_input_available_signal);
|
||||
sigaction (SIGIO, &action, 0);
|
||||
}
|
||||
#endif
|
||||
start_polling ();
|
||||
}
|
||||
#endif /* subprocesses */
|
||||
|
@ -3869,7 +3843,7 @@ kbd_buffer_get_event (KBOARD **kbp,
|
|||
wait_reading_process_output (0, 0, -1, 1, Qnil, NULL, 0);
|
||||
|
||||
if (!interrupt_input && kbd_fetch_ptr == kbd_store_ptr)
|
||||
read_avail_input ();
|
||||
gobble_input ();
|
||||
}
|
||||
|
||||
if (CONSP (Vunread_command_events))
|
||||
|
@ -6752,41 +6726,6 @@ get_input_pending (int *addr, int flags)
|
|||
*addr = (!NILP (Vquit_flag) || readable_events (flags));
|
||||
}
|
||||
|
||||
/* Interface to read_avail_input, blocking SIGIO or SIGALRM if necessary. */
|
||||
|
||||
void
|
||||
gobble_input (void)
|
||||
{
|
||||
#ifdef USABLE_SIGIO
|
||||
if (interrupt_input)
|
||||
{
|
||||
sigset_t blocked, procmask;
|
||||
sigemptyset (&blocked);
|
||||
sigaddset (&blocked, SIGIO);
|
||||
pthread_sigmask (SIG_BLOCK, &blocked, &procmask);
|
||||
read_avail_input ();
|
||||
pthread_sigmask (SIG_SETMASK, &procmask, 0);
|
||||
}
|
||||
else
|
||||
#ifdef POLL_FOR_INPUT
|
||||
/* XXX This condition was (read_socket_hook && !interrupt_input),
|
||||
but read_socket_hook is not global anymore. Let's pretend that
|
||||
it's always set. */
|
||||
if (!interrupt_input && poll_suppress_count == 0)
|
||||
{
|
||||
sigset_t blocked, procmask;
|
||||
sigemptyset (&blocked);
|
||||
sigaddset (&blocked, SIGALRM);
|
||||
pthread_sigmask (SIG_BLOCK, &blocked, &procmask);
|
||||
read_avail_input ();
|
||||
pthread_sigmask (SIG_SETMASK, &procmask, 0);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
#endif
|
||||
read_avail_input ();
|
||||
}
|
||||
|
||||
/* Put a BUFFER_SWITCH_EVENT in the buffer
|
||||
so that read_key_sequence will notice the new current buffer. */
|
||||
|
||||
|
@ -6814,14 +6753,7 @@ record_asynch_buffer_change (void)
|
|||
/* Make sure no interrupt happens while storing the event. */
|
||||
#ifdef USABLE_SIGIO
|
||||
if (interrupt_input)
|
||||
{
|
||||
sigset_t blocked, procmask;
|
||||
sigemptyset (&blocked);
|
||||
sigaddset (&blocked, SIGIO);
|
||||
pthread_sigmask (SIG_BLOCK, &blocked, &procmask);
|
||||
kbd_buffer_store_event (&event);
|
||||
pthread_sigmask (SIG_SETMASK, &procmask, 0);
|
||||
}
|
||||
kbd_buffer_store_event (&event);
|
||||
else
|
||||
#endif
|
||||
{
|
||||
|
@ -6834,13 +6766,11 @@ record_asynch_buffer_change (void)
|
|||
/* Read any terminal input already buffered up by the system
|
||||
into the kbd_buffer, but do not wait.
|
||||
|
||||
EXPECTED should be nonzero if the caller knows there is some input.
|
||||
|
||||
Returns the number of keyboard chars read, or -1 meaning
|
||||
Return the number of keyboard chars read, or -1 meaning
|
||||
this is a bad time to try to read input. */
|
||||
|
||||
static int
|
||||
read_avail_input (void)
|
||||
int
|
||||
gobble_input (void)
|
||||
{
|
||||
int nread = 0;
|
||||
int err = 0;
|
||||
|
@ -6860,11 +6790,17 @@ read_avail_input (void)
|
|||
int nr;
|
||||
struct input_event hold_quit;
|
||||
|
||||
if (input_blocked_p ())
|
||||
{
|
||||
pending_signals = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
EVENT_INIT (hold_quit);
|
||||
hold_quit.kind = NO_EVENT;
|
||||
|
||||
/* No need for FIONREAD or fcntl; just say don't wait. */
|
||||
while (0 < (nr = (*t->read_socket_hook) (t, &hold_quit)))
|
||||
while (0 < (nr = (*t->read_socket_hook) (t, &hold_quit)))
|
||||
nread += nr;
|
||||
|
||||
if (nr == -1) /* Not OK to read input now. */
|
||||
|
@ -6885,7 +6821,7 @@ read_avail_input (void)
|
|||
this process rather than to the whole process
|
||||
group? Perhaps on systems with FIONREAD Emacs is
|
||||
alone in its group. */
|
||||
kill (getpid (), SIGHUP);
|
||||
terminate_due_to_signal (SIGHUP, 10);
|
||||
|
||||
/* XXX Is calling delete_terminal safe here? It calls delete_frame. */
|
||||
{
|
||||
|
@ -7174,34 +7110,68 @@ tty_read_avail_input (struct terminal *terminal,
|
|||
static void
|
||||
handle_async_input (void)
|
||||
{
|
||||
interrupt_input_pending = 0;
|
||||
pending_signals = pending_atimers;
|
||||
|
||||
#ifdef USABLE_SIGIO
|
||||
while (1)
|
||||
{
|
||||
int nread = read_avail_input ();
|
||||
int nread = gobble_input ();
|
||||
/* -1 means it's not ok to read the input now.
|
||||
UNBLOCK_INPUT will read it later; now, avoid infinite loop.
|
||||
0 means there was no keyboard input available. */
|
||||
if (nread <= 0)
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
process_pending_signals (void)
|
||||
{
|
||||
if (interrupt_input_pending)
|
||||
handle_async_input ();
|
||||
pending_signals = 0;
|
||||
handle_async_input ();
|
||||
do_pending_atimers ();
|
||||
}
|
||||
|
||||
/* Undo any number of BLOCK_INPUT calls down to level LEVEL,
|
||||
and also (if the level is now 0) reinvoke any pending signal. */
|
||||
|
||||
void
|
||||
unblock_input_to (int level)
|
||||
{
|
||||
interrupt_input_blocked = level;
|
||||
if (level == 0)
|
||||
{
|
||||
if (pending_signals)
|
||||
process_pending_signals ();
|
||||
}
|
||||
else if (level < 0)
|
||||
emacs_abort ();
|
||||
}
|
||||
|
||||
/* End critical section.
|
||||
|
||||
If doing signal-driven input, and a signal came in when input was
|
||||
blocked, reinvoke the signal handler now to deal with it. */
|
||||
|
||||
void
|
||||
unblock_input (void)
|
||||
{
|
||||
unblock_input_to (interrupt_input_blocked - 1);
|
||||
}
|
||||
|
||||
/* Undo any number of BLOCK_INPUT calls,
|
||||
and also reinvoke any pending signal. */
|
||||
|
||||
void
|
||||
totally_unblock_input (void)
|
||||
{
|
||||
unblock_input_to (0);
|
||||
}
|
||||
|
||||
#ifdef USABLE_SIGIO
|
||||
|
||||
static void
|
||||
void
|
||||
handle_input_available_signal (int sig)
|
||||
{
|
||||
interrupt_input_pending = 1;
|
||||
pending_signals = 1;
|
||||
|
||||
if (input_available_clear_time)
|
||||
|
@ -7211,25 +7181,10 @@ handle_input_available_signal (int sig)
|
|||
static void
|
||||
deliver_input_available_signal (int sig)
|
||||
{
|
||||
handle_on_main_thread (sig, handle_input_available_signal);
|
||||
deliver_process_signal (sig, handle_input_available_signal);
|
||||
}
|
||||
#endif /* USABLE_SIGIO */
|
||||
|
||||
/* Send ourselves a SIGIO.
|
||||
|
||||
This function exists so that the UNBLOCK_INPUT macro in
|
||||
blockinput.h can have some way to take care of input we put off
|
||||
dealing with, without assuming that every file which uses
|
||||
UNBLOCK_INPUT also has #included the files necessary to get SIGIO. */
|
||||
void
|
||||
reinvoke_input_signal (void)
|
||||
{
|
||||
#ifdef USABLE_SIGIO
|
||||
handle_async_input ();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* User signal events. */
|
||||
|
||||
|
@ -7300,7 +7255,7 @@ handle_user_signal (int sig)
|
|||
p->npending++;
|
||||
#ifdef USABLE_SIGIO
|
||||
if (interrupt_input)
|
||||
kill (getpid (), SIGIO);
|
||||
handle_input_available_signal (sig);
|
||||
else
|
||||
#endif
|
||||
{
|
||||
|
@ -7316,7 +7271,7 @@ handle_user_signal (int sig)
|
|||
static void
|
||||
deliver_user_signal (int sig)
|
||||
{
|
||||
handle_on_main_thread (sig, handle_user_signal);
|
||||
deliver_process_signal (sig, handle_user_signal);
|
||||
}
|
||||
|
||||
static char *
|
||||
|
@ -7341,8 +7296,6 @@ store_user_signal_events (void)
|
|||
for (p = user_signals; p; p = p->next)
|
||||
if (p->npending > 0)
|
||||
{
|
||||
sigset_t blocked, procmask;
|
||||
|
||||
if (! buf_initialized)
|
||||
{
|
||||
memset (&buf, 0, sizeof buf);
|
||||
|
@ -7351,10 +7304,6 @@ store_user_signal_events (void)
|
|||
buf_initialized = 1;
|
||||
}
|
||||
|
||||
sigemptyset (&blocked);
|
||||
sigaddset (&blocked, p->sig);
|
||||
pthread_sigmask (SIG_BLOCK, &blocked, &procmask);
|
||||
|
||||
do
|
||||
{
|
||||
buf.code = p->sig;
|
||||
|
@ -7362,8 +7311,6 @@ store_user_signal_events (void)
|
|||
p->npending--;
|
||||
}
|
||||
while (p->npending > 0);
|
||||
|
||||
pthread_sigmask (SIG_SETMASK, &procmask, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -10568,9 +10515,9 @@ The file will be closed when Emacs exits. */)
|
|||
{
|
||||
if (dribble)
|
||||
{
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
fclose (dribble);
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
dribble = 0;
|
||||
}
|
||||
if (!NILP (file))
|
||||
|
@ -10759,21 +10706,21 @@ handle_interrupt_signal (int sig)
|
|||
from the controlling tty. */
|
||||
internal_last_event_frame = terminal->display_info.tty->top_frame;
|
||||
|
||||
handle_interrupt ();
|
||||
handle_interrupt (1);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
deliver_interrupt_signal (int sig)
|
||||
{
|
||||
handle_on_main_thread (sig, handle_interrupt_signal);
|
||||
deliver_process_signal (sig, handle_interrupt_signal);
|
||||
}
|
||||
|
||||
|
||||
/* If Emacs is stuck because `inhibit-quit' is true, then keep track
|
||||
of the number of times C-g has been requested. If C-g is pressed
|
||||
enough times, then quit anyway. See bug#6585. */
|
||||
static int force_quit_count;
|
||||
static int volatile force_quit_count;
|
||||
|
||||
/* This routine is called at interrupt level in response to C-g.
|
||||
|
||||
|
@ -10787,7 +10734,7 @@ static int force_quit_count;
|
|||
non-nil, it stops the job right away. */
|
||||
|
||||
static void
|
||||
handle_interrupt (void)
|
||||
handle_interrupt (bool in_signal_handler)
|
||||
{
|
||||
char c;
|
||||
|
||||
|
@ -10796,13 +10743,16 @@ handle_interrupt (void)
|
|||
/* XXX This code needs to be revised for multi-tty support. */
|
||||
if (!NILP (Vquit_flag) && get_named_tty ("/dev/tty"))
|
||||
{
|
||||
/* If SIGINT isn't blocked, don't let us be interrupted by
|
||||
another SIGINT, it might be harmful due to non-reentrancy
|
||||
in I/O functions. */
|
||||
sigset_t blocked;
|
||||
sigemptyset (&blocked);
|
||||
sigaddset (&blocked, SIGINT);
|
||||
pthread_sigmask (SIG_BLOCK, &blocked, 0);
|
||||
if (! in_signal_handler)
|
||||
{
|
||||
/* If SIGINT isn't blocked, don't let us be interrupted by
|
||||
a SIGINT. It might be harmful due to non-reentrancy
|
||||
in I/O functions. */
|
||||
sigset_t blocked;
|
||||
sigemptyset (&blocked);
|
||||
sigaddset (&blocked, SIGINT);
|
||||
pthread_sigmask (SIG_BLOCK, &blocked, 0);
|
||||
}
|
||||
|
||||
fflush (stdout);
|
||||
reset_all_sys_modes ();
|
||||
|
@ -10873,7 +10823,6 @@ handle_interrupt (void)
|
|||
#endif /* not MSDOS */
|
||||
fflush (stdout);
|
||||
init_all_sys_modes ();
|
||||
pthread_sigmask (SIG_SETMASK, &empty_mask, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -10891,15 +10840,14 @@ handle_interrupt (void)
|
|||
GCPRO4 (saved.object, saved.global_code,
|
||||
saved.current_syntax_table, saved.old_prop);
|
||||
Fsignal (Qquit, Qnil);
|
||||
/* FIXME: AFAIK, `quit' can never return, so this code is dead! */
|
||||
gl_state = saved;
|
||||
UNGCPRO;
|
||||
}
|
||||
else
|
||||
{ /* Else request quit when it's safe. */
|
||||
if (NILP (Vquit_flag))
|
||||
force_quit_count = 0;
|
||||
if (++force_quit_count == 3)
|
||||
int count = NILP (Vquit_flag) ? 1 : force_quit_count + 1;
|
||||
force_quit_count = count;
|
||||
if (count == 3)
|
||||
{
|
||||
immediate_quit = 1;
|
||||
Vinhibit_quit = Qnil;
|
||||
|
@ -10908,6 +10856,8 @@ handle_interrupt (void)
|
|||
}
|
||||
}
|
||||
|
||||
pthread_sigmask (SIG_SETMASK, &empty_mask, 0);
|
||||
|
||||
/* TODO: The longjmp in this call throws the NS event loop integration off,
|
||||
and it seems to do fine without this. Probably some attention
|
||||
needs to be paid to the setting of waiting_for_input in
|
||||
|
@ -10917,7 +10867,7 @@ handle_interrupt (void)
|
|||
separate event loop thread like W32. */
|
||||
#ifndef HAVE_NS
|
||||
if (waiting_for_input && !echoing)
|
||||
quit_throw_to_read_char (1);
|
||||
quit_throw_to_read_char (in_signal_handler);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -10931,22 +10881,12 @@ quit_throw_to_read_char (int from_signal)
|
|||
if (!from_signal && EQ (Vquit_flag, Qkill_emacs))
|
||||
Fkill_emacs (Qnil);
|
||||
|
||||
pthread_sigmask (SIG_SETMASK, &empty_mask, 0);
|
||||
/* Prevent another signal from doing this before we finish. */
|
||||
clear_waiting_for_input ();
|
||||
input_pending = 0;
|
||||
|
||||
Vunread_command_events = Qnil;
|
||||
|
||||
#if 0 /* Currently, sit_for is called from read_char without turning
|
||||
off polling. And that can call set_waiting_for_input.
|
||||
It seems to be harmless. */
|
||||
#ifdef POLL_FOR_INPUT
|
||||
/* May be > 1 if in recursive minibuffer. */
|
||||
if (poll_suppress_count == 0)
|
||||
emacs_abort ();
|
||||
#endif
|
||||
#endif
|
||||
if (FRAMEP (internal_last_event_frame)
|
||||
&& !EQ (internal_last_event_frame, selected_frame))
|
||||
do_switch_frame (make_lispy_switch_frame (internal_last_event_frame),
|
||||
|
@ -11337,7 +11277,6 @@ init_keyboard (void)
|
|||
#endif
|
||||
input_pending = 0;
|
||||
interrupt_input_blocked = 0;
|
||||
interrupt_input_pending = 0;
|
||||
pending_signals = 0;
|
||||
|
||||
/* This means that command_loop_1 won't try to select anything the first
|
||||
|
@ -11358,7 +11297,7 @@ init_keyboard (void)
|
|||
/* Before multi-tty support, these handlers used to be installed
|
||||
only if the current session was a tty session. Now an Emacs
|
||||
session may have multiple display types, so we always handle
|
||||
SIGINT. There is special code in interrupt_signal to exit
|
||||
SIGINT. There is special code in handle_interrupt_signal to exit
|
||||
Emacs on SIGINT when there are no termcap frames on the
|
||||
controlling terminal. */
|
||||
struct sigaction action;
|
||||
|
|
|
@ -523,7 +523,7 @@ extern void input_poll_signal (int);
|
|||
extern void start_polling (void);
|
||||
extern void stop_polling (void);
|
||||
extern void set_poll_suppress_count (int);
|
||||
extern void gobble_input (void);
|
||||
extern int gobble_input (void);
|
||||
extern int input_polling_used (void);
|
||||
extern void clear_input_pending (void);
|
||||
extern int requeued_events_pending_p (void);
|
||||
|
|
|
@ -1477,7 +1477,7 @@ current_minor_maps (Lisp_Object **modeptr, Lisp_Object **mapptr)
|
|||
|
||||
/* Use malloc here. See the comment above this function.
|
||||
Avoid realloc here; it causes spurious traps on GNU/Linux [KFS] */
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
newmodes = malloc (allocsize);
|
||||
if (newmodes)
|
||||
{
|
||||
|
@ -1501,7 +1501,7 @@ current_minor_maps (Lisp_Object **modeptr, Lisp_Object **mapptr)
|
|||
}
|
||||
cmm_maps = newmaps;
|
||||
}
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
|
||||
if (newmodes == NULL || newmaps == NULL)
|
||||
break;
|
||||
|
|
20
src/lisp.h
20
src/lisp.h
|
@ -25,6 +25,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
|
|||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
#include <float.h>
|
||||
#include <inttypes.h>
|
||||
#include <limits.h>
|
||||
|
||||
|
@ -1487,6 +1488,16 @@ struct Lisp_Float
|
|||
#define XFLOAT_DATA(f) (0 ? XFLOAT (f)->u.data : XFLOAT (f)->u.data)
|
||||
#define XFLOAT_INIT(f, n) (XFLOAT (f)->u.data = (n))
|
||||
|
||||
/* Most hosts nowadays use IEEE floating point, so they use IEC 60559
|
||||
representations, have infinities and NaNs, and do not trap on
|
||||
exceptions. Define IEEE_FLOATING_POINT if this host is one of the
|
||||
typical ones. The C11 macro __STDC_IEC_559__ is close to what is
|
||||
wanted here, but is not quite right because Emacs does not require
|
||||
all the features of C11 Annex F (and does not require C11 at all,
|
||||
for that matter). */
|
||||
#define IEEE_FLOATING_POINT (FLT_RADIX == 2 && FLT_MANT_DIG == 24 \
|
||||
&& FLT_MIN_EXP == -125 && FLT_MAX_EXP == 128)
|
||||
|
||||
/* A character, declared with the following typedef, is a member
|
||||
of some character set associated with the current buffer. */
|
||||
#ifndef _UCHAR_T /* Protect against something in ctab.h on AIX. */
|
||||
|
@ -2108,7 +2119,7 @@ extern char *stack_bottom;
|
|||
a request to exit Emacs when it is safe to do. */
|
||||
|
||||
extern void process_pending_signals (void);
|
||||
extern int pending_signals;
|
||||
extern int volatile pending_signals;
|
||||
|
||||
extern void process_quit_flag (void);
|
||||
#define QUIT \
|
||||
|
@ -2633,7 +2644,6 @@ extern _Noreturn Lisp_Object wrong_type_argument (Lisp_Object, Lisp_Object);
|
|||
extern Lisp_Object do_symval_forwarding (union Lisp_Fwd *);
|
||||
extern void set_internal (Lisp_Object, Lisp_Object, Lisp_Object, bool);
|
||||
extern void syms_of_data (void);
|
||||
extern void init_data (void);
|
||||
extern void swap_in_global_binding (struct Lisp_Symbol *);
|
||||
|
||||
/* Defined in cmds.c */
|
||||
|
@ -3227,6 +3237,9 @@ extern int input_pending;
|
|||
extern Lisp_Object menu_bar_items (Lisp_Object);
|
||||
extern Lisp_Object tool_bar_items (Lisp_Object, int *);
|
||||
extern void discard_mouse_events (void);
|
||||
#ifdef USABLE_SIGIO
|
||||
void handle_input_available_signal (int);
|
||||
#endif
|
||||
extern Lisp_Object pending_funcalls;
|
||||
extern int detect_input_pending (void);
|
||||
extern int detect_input_pending_ignore_squeezables (void);
|
||||
|
@ -3269,7 +3282,7 @@ extern bool display_arg;
|
|||
extern Lisp_Object decode_env_path (const char *, const char *);
|
||||
extern Lisp_Object empty_unibyte_string, empty_multibyte_string;
|
||||
extern Lisp_Object Qfile_name_handler_alist;
|
||||
extern _Noreturn void fatal_error_backtrace (int, int);
|
||||
extern _Noreturn void terminate_due_to_signal (int, int);
|
||||
extern Lisp_Object Qkill_emacs;
|
||||
#if HAVE_SETLOCALE
|
||||
void fixup_locale (void);
|
||||
|
@ -3320,6 +3333,7 @@ extern int wait_reading_process_output (intmax_t, int, int, int,
|
|||
#endif
|
||||
extern void add_keyboard_wait_descriptor (int);
|
||||
extern void delete_keyboard_wait_descriptor (int);
|
||||
extern void record_child_status_change (pid_t, int);
|
||||
#ifdef HAVE_GPM
|
||||
extern void add_gpm_wait_descriptor (int);
|
||||
extern void delete_gpm_wait_descriptor (int);
|
||||
|
|
24
src/lread.c
24
src/lread.c
|
@ -408,9 +408,9 @@ unreadchar (Lisp_Object readcharfun, int c)
|
|||
{
|
||||
if (load_each_byte)
|
||||
{
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
ungetc (c, instream);
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
}
|
||||
else
|
||||
unread_char = c;
|
||||
|
@ -431,28 +431,28 @@ readbyte_from_file (int c, Lisp_Object readcharfun)
|
|||
{
|
||||
if (c >= 0)
|
||||
{
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
ungetc (c, instream);
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
return 0;
|
||||
}
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
c = getc (instream);
|
||||
|
||||
#ifdef EINTR
|
||||
/* Interrupted reads have been observed while reading over the network. */
|
||||
while (c == EOF && ferror (instream) && errno == EINTR)
|
||||
{
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
QUIT;
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
clearerr (instream);
|
||||
c = getc (instream);
|
||||
}
|
||||
#endif
|
||||
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
|
||||
return (c == EOF ? -1 : c);
|
||||
}
|
||||
|
@ -753,9 +753,9 @@ DEFUN ("get-file-char", Fget_file_char, Sget_file_char, 0, 0, 0,
|
|||
(void)
|
||||
{
|
||||
register Lisp_Object val;
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
XSETINT (val, getc (instream));
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
return val;
|
||||
}
|
||||
|
||||
|
@ -1350,9 +1350,9 @@ load_unwind (Lisp_Object arg) /* Used as unwind-protect function in load. */
|
|||
FILE *stream = (FILE *) XSAVE_VALUE (arg)->pointer;
|
||||
if (stream != NULL)
|
||||
{
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
fclose (stream);
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
}
|
||||
return Qnil;
|
||||
}
|
||||
|
|
12
src/menu.c
12
src/menu.c
|
@ -573,9 +573,9 @@ xmalloc_widget_value (void)
|
|||
{
|
||||
widget_value *value;
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
value = malloc_widget_value ();
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
|
||||
return value;
|
||||
}
|
||||
|
@ -602,9 +602,9 @@ free_menubar_widget_value_tree (widget_value *wv)
|
|||
free_menubar_widget_value_tree (wv->next);
|
||||
wv->next = (widget_value *) 0xDEADBEEF;
|
||||
}
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
free_widget_value (wv);
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
}
|
||||
|
||||
/* Create a tree of widget_value objects
|
||||
|
@ -1313,7 +1313,7 @@ no quit occurs and `x-popup-menu' returns nil. */)
|
|||
#endif
|
||||
|
||||
/* Display them in a menu. */
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
|
||||
/* FIXME: Use a terminal hook! */
|
||||
#if defined HAVE_NTGUI
|
||||
|
@ -1332,7 +1332,7 @@ no quit occurs and `x-popup-menu' returns nil. */)
|
|||
last_event_timestamp);
|
||||
#endif
|
||||
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
|
||||
#ifdef HAVE_NS
|
||||
unbind_to (specpdl_count, Qnil);
|
||||
|
|
|
@ -1229,7 +1229,7 @@ IT_update_begin (struct frame *f)
|
|||
if (display_info->termscript)
|
||||
fprintf (display_info->termscript, "\n\n<UPDATE_BEGIN");
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
|
||||
if (f && f == mouse_face_frame)
|
||||
{
|
||||
|
@ -1279,7 +1279,7 @@ IT_update_begin (struct frame *f)
|
|||
hlinfo->mouse_face_mouse_frame = NULL;
|
||||
}
|
||||
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -1302,13 +1302,13 @@ IT_frame_up_to_date (struct frame *f)
|
|||
if (hlinfo->mouse_face_deferred_gc
|
||||
|| (f && f == hlinfo->mouse_face_mouse_frame))
|
||||
{
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
if (hlinfo->mouse_face_mouse_frame)
|
||||
note_mouse_highlight (hlinfo->mouse_face_mouse_frame,
|
||||
hlinfo->mouse_face_mouse_x,
|
||||
hlinfo->mouse_face_mouse_y);
|
||||
hlinfo->mouse_face_deferred_gc = 0;
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
}
|
||||
|
||||
/* Set the cursor type to whatever they wanted. In a minibuffer
|
||||
|
|
42
src/nsfns.m
42
src/nsfns.m
|
@ -615,7 +615,7 @@ Turn the input menu (an NSMenu) into a lisp list for tracking on lisp side
|
|||
if (f->explicit_name || ! NILP (f->title) || ns_in_resize)
|
||||
return;
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
pool = [[NSAutoreleasePool alloc] init];
|
||||
filename = BVAR (XBUFFER (buf), filename);
|
||||
name = BVAR (XBUFFER (buf), name);
|
||||
|
@ -640,7 +640,7 @@ Turn the input menu (an NSMenu) into a lisp list for tracking on lisp side
|
|||
if (title && (! strcmp (title, SSDATA (encoded_name))))
|
||||
{
|
||||
[pool release];
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -678,7 +678,7 @@ Turn the input menu (an NSMenu) into a lisp list for tracking on lisp side
|
|||
}
|
||||
|
||||
[pool release];
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
}
|
||||
|
||||
|
||||
|
@ -689,11 +689,11 @@ Turn the input menu (an NSMenu) into a lisp list for tracking on lisp side
|
|||
NSAutoreleasePool *pool;
|
||||
if (!MINI_WINDOW_P (XWINDOW (f->selected_window)))
|
||||
{
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
pool = [[NSAutoreleasePool alloc] init];
|
||||
[[view window] setDocumentEdited: !NILP (arg)];
|
||||
[pool release];
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -771,14 +771,14 @@ Turn the input menu (an NSMenu) into a lisp list for tracking on lisp side
|
|||
|
||||
NSTRACE (ns_implicitly_set_icon_type);
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
pool = [[NSAutoreleasePool alloc] init];
|
||||
if (f->output_data.ns->miniimage
|
||||
&& [[NSString stringWithUTF8String: SSDATA (f->name)]
|
||||
isEqualToString: [(NSImage *)f->output_data.ns->miniimage name]])
|
||||
{
|
||||
[pool release];
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -786,7 +786,7 @@ Turn the input menu (an NSMenu) into a lisp list for tracking on lisp side
|
|||
if (CONSP (tem) && ! NILP (XCDR (tem)))
|
||||
{
|
||||
[pool release];
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -826,7 +826,7 @@ Turn the input menu (an NSMenu) into a lisp list for tracking on lisp side
|
|||
f->output_data.ns->miniimage = image;
|
||||
[view setMiniwindowImage: setMini];
|
||||
[pool release];
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
}
|
||||
|
||||
|
||||
|
@ -1232,7 +1232,7 @@ Turn the input menu (an NSMenu) into a lisp list for tracking on lisp side
|
|||
f->resx = dpyinfo->resx;
|
||||
f->resy = dpyinfo->resy;
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
register_font_driver (&nsfont_driver, f);
|
||||
x_default_parameter (f, parms, Qfont_backend, Qnil,
|
||||
"fontBackend", "FontBackend", RES_TYPE_STRING);
|
||||
|
@ -1247,7 +1247,7 @@ Turn the input menu (an NSMenu) into a lisp list for tracking on lisp side
|
|||
build_string ([[font fontName] UTF8String]),
|
||||
"font", "Font", RES_TYPE_STRING);
|
||||
}
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
|
||||
x_default_parameter (f, parms, Qborder_width, make_number (0),
|
||||
"borderwidth", "BorderWidth", RES_TYPE_NUMBER);
|
||||
|
@ -1411,10 +1411,10 @@ Turn the input menu (an NSMenu) into a lisp list for tracking on lisp side
|
|||
if (dpyinfo->x_focus_frame != f)
|
||||
{
|
||||
EmacsView *view = FRAME_NS_VIEW (f);
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
[NSApp activateIgnoringOtherApps: YES];
|
||||
[[view window] makeKeyAndOrderFront: view];
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
}
|
||||
|
||||
return Qnil;
|
||||
|
@ -1511,7 +1511,7 @@ Turn the input menu (an NSMenu) into a lisp list for tracking on lisp side
|
|||
[panel setDelegate: fileDelegate];
|
||||
|
||||
panelOK = 0;
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
if (NILP (mustmatch))
|
||||
{
|
||||
ret = [panel runModalForDirectory: dirS file: initS];
|
||||
|
@ -1528,7 +1528,7 @@ Turn the input menu (an NSMenu) into a lisp list for tracking on lisp side
|
|||
fname = build_string ([[panel filename] UTF8String]);
|
||||
|
||||
[[FRAME_NS_VIEW (SELECTED_FRAME ()) window] makeKeyWindow];
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
|
||||
return ret ? fname : Qnil;
|
||||
}
|
||||
|
@ -1899,7 +1899,7 @@ and GNUstep implementations ("distributor-specific release
|
|||
error ("non-Nextstep frame used in `ns-list-colors'");
|
||||
}
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
|
||||
colorlists = [[NSColorList availableColorLists] objectEnumerator];
|
||||
while ((clist = [colorlists nextObject]))
|
||||
|
@ -1917,7 +1917,7 @@ and GNUstep implementations ("distributor-specific release
|
|||
}
|
||||
}
|
||||
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
|
||||
return list;
|
||||
}
|
||||
|
@ -2115,7 +2115,7 @@ and GNUstep implementations ("distributor-specific release
|
|||
CHECK_STRING (script);
|
||||
check_ns ();
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
|
||||
as_script = script;
|
||||
as_result = &result;
|
||||
|
@ -2141,7 +2141,7 @@ and GNUstep implementations ("distributor-specific release
|
|||
as_status = 0;
|
||||
as_script = Qnil;
|
||||
as_result = 0;
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
if (status == 0)
|
||||
return result;
|
||||
else if (!STRINGP (result))
|
||||
|
@ -2548,7 +2548,7 @@ DY added (default is -10).
|
|||
else
|
||||
CHECK_NUMBER (dy);
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
if (ns_tooltip == nil)
|
||||
ns_tooltip = [[EmacsTooltip alloc] init];
|
||||
else
|
||||
|
@ -2563,7 +2563,7 @@ DY added (default is -10).
|
|||
&root_x, &root_y);
|
||||
|
||||
[ns_tooltip showAtX: root_x Y: root_y for: XINT (timeout)];
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
|
||||
UNGCPRO;
|
||||
return unbind_to (count, Qnil);
|
||||
|
|
12
src/nsfont.m
12
src/nsfont.m
|
@ -821,7 +821,7 @@ when setting family in ns_spec_to_descriptor(). */
|
|||
font_info->glyphs = xzalloc (0x100 * sizeof *font_info->glyphs);
|
||||
font_info->metrics = xzalloc (0x100 * sizeof *font_info->metrics);
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
|
||||
/* for metrics */
|
||||
sfont = [nsfont screenFont];
|
||||
|
@ -932,7 +932,7 @@ when setting family in ns_spec_to_descriptor(). */
|
|||
font->props[FONT_FULLNAME_INDEX] =
|
||||
make_unibyte_string (font_info->name, strlen (font_info->name));
|
||||
}
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
|
||||
return font_object;
|
||||
}
|
||||
|
@ -1316,7 +1316,7 @@ is false when (FROM > 0 || TO < S->nchars). */
|
|||
fprintf (stderr, "%p\tFinding glyphs for glyphs in block %d\n",
|
||||
font_info, block);
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
|
||||
#ifdef NS_IMPL_COCOA
|
||||
if (firstTime)
|
||||
|
@ -1373,7 +1373,7 @@ is false when (FROM > 0 || TO < S->nchars). */
|
|||
#endif
|
||||
}
|
||||
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
xfree (unichars);
|
||||
}
|
||||
|
||||
|
@ -1398,7 +1398,7 @@ is false when (FROM > 0 || TO < S->nchars). */
|
|||
numGlyphs = 0x10000;
|
||||
#endif
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
sfont = [font_info->nsfont screenFont];
|
||||
|
||||
font_info->metrics[block] = xzalloc (0x100 * sizeof (struct font_metrics));
|
||||
|
@ -1427,7 +1427,7 @@ is false when (FROM > 0 || TO < S->nchars). */
|
|||
metrics->ascent = r.size.height - metrics->descent;
|
||||
/*-lrint (hshrink* [sfont descender] - expand * hd/2); */
|
||||
}
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
}
|
||||
|
||||
|
||||
|
|
28
src/nsmenu.m
28
src/nsmenu.m
|
@ -146,7 +146,7 @@
|
|||
XSETFRAME (Vmenu_updating_frame, f);
|
||||
/*fprintf (stderr, "ns_update_menubar: frame: %p\tdeep: %d\tsub: %p\n", f, deep_p, submenu); */
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
pool = [[NSAutoreleasePool alloc] init];
|
||||
|
||||
/* Menu may have been created automatically; if so, discard it. */
|
||||
|
@ -271,7 +271,7 @@
|
|||
discard_menu_items ();
|
||||
unbind_to (specpdl_count, Qnil);
|
||||
[pool release];
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -333,7 +333,7 @@
|
|||
discard_menu_items ();
|
||||
unbind_to (specpdl_count, Qnil);
|
||||
[pool release];
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -404,7 +404,7 @@
|
|||
{
|
||||
free_menubar_widget_value_tree (first_wv);
|
||||
[pool release];
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -435,7 +435,7 @@
|
|||
{
|
||||
free_menubar_widget_value_tree (first_wv);
|
||||
[pool release];
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -498,7 +498,7 @@
|
|||
[NSApp setMainMenu: menu];
|
||||
|
||||
[pool release];
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
|
||||
}
|
||||
|
||||
|
@ -1012,10 +1012,10 @@ - (Lisp_Object)runMenuAt: (NSPoint)p forFrame: (struct frame *)f
|
|||
Under NS we just hide the toolbar until it might be needed again.
|
||||
-------------------------------------------------------------------------- */
|
||||
{
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
[[FRAME_NS_VIEW (f) toolbar] setVisible: NO];
|
||||
FRAME_TOOLBAR_HEIGHT (f) = 0;
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1029,7 +1029,7 @@ - (Lisp_Object)runMenuAt: (NSPoint)p forFrame: (struct frame *)f
|
|||
NSWindow *window = [view window];
|
||||
EmacsToolbar *toolbar = [view toolbar];
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
[toolbar clearActive];
|
||||
|
||||
/* update EmacsToolbar as in GtkUtils, build items list */
|
||||
|
@ -1115,7 +1115,7 @@ - (Lisp_Object)runMenuAt: (NSPoint)p forFrame: (struct frame *)f
|
|||
FRAME_TOOLBAR_HEIGHT (f) =
|
||||
NSHeight ([window frameRectForContentRect: NSMakeRect (0, 0, 0, 0)])
|
||||
- FRAME_NS_TITLEBAR_HEIGHT (f);
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
}
|
||||
|
||||
|
||||
|
@ -1355,7 +1355,7 @@ - (NSRect) frame
|
|||
struct Lisp_Save_Value *p = XSAVE_VALUE (arg);
|
||||
struct Popdown_data *unwind_data = (struct Popdown_data *) p->pointer;
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
if (popup_activated_flag)
|
||||
{
|
||||
EmacsDialogPanel *panel = unwind_data->dialog;
|
||||
|
@ -1366,7 +1366,7 @@ - (NSRect) frame
|
|||
}
|
||||
|
||||
xfree (unwind_data);
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
|
||||
return Qnil;
|
||||
}
|
||||
|
@ -1434,7 +1434,7 @@ - (NSRect) frame
|
|||
the dialog. */
|
||||
contents = Fcons (title, Fcons (Fcons (build_string ("Ok"), Qt), Qnil));
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
pool = [[NSAutoreleasePool alloc] init];
|
||||
dialog = [[EmacsDialogPanel alloc] initFromContents: contents
|
||||
isQuestion: isQ];
|
||||
|
@ -1452,7 +1452,7 @@ - (NSRect) frame
|
|||
unbind_to (specpdl_count, Qnil); /* calls pop_down_menu */
|
||||
}
|
||||
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
|
||||
return tem;
|
||||
}
|
||||
|
|
128
src/nsterm.m
128
src/nsterm.m
|
@ -581,7 +581,7 @@ Free a pool and temporary objects it refers to (callable from C)
|
|||
#endif
|
||||
#ifdef NS_IMPL_COCOA
|
||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
|
||||
NSTRACE (ns_update_auto_hide_menu_bar);
|
||||
|
||||
|
@ -612,7 +612,7 @@ Free a pool and temporary objects it refers to (callable from C)
|
|||
}
|
||||
}
|
||||
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
@ -662,7 +662,7 @@ Free a pool and temporary objects it refers to (callable from C)
|
|||
updated_window = w;
|
||||
set_output_cursor (&w->cursor);
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
|
||||
if (f == hlinfo->mouse_face_mouse_frame)
|
||||
{
|
||||
|
@ -677,7 +677,7 @@ Free a pool and temporary objects it refers to (callable from C)
|
|||
/* (further code for mouse faces ifdef'd out in other terms elided) */
|
||||
}
|
||||
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
}
|
||||
|
||||
|
||||
|
@ -694,7 +694,7 @@ Free a pool and temporary objects it refers to (callable from C)
|
|||
/* note: this fn is nearly identical in all terms */
|
||||
if (!w->pseudo_window_p)
|
||||
{
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
|
||||
if (cursor_on_p)
|
||||
display_and_set_cursor (w, 1,
|
||||
|
@ -704,7 +704,7 @@ Free a pool and temporary objects it refers to (callable from C)
|
|||
if (draw_window_fringes (w, 1))
|
||||
x_draw_vertical_border (w);
|
||||
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
}
|
||||
|
||||
/* If a row with mouse-face was overwritten, arrange for
|
||||
|
@ -733,7 +733,7 @@ Free a pool and temporary objects it refers to (callable from C)
|
|||
/* if (f == MOUSE_HL_INFO (f)->mouse_face_mouse_frame) */
|
||||
MOUSE_HL_INFO (f)->mouse_face_defer = 0;
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
|
||||
#ifdef NS_IMPL_GNUSTEP
|
||||
/* trigger flush only in the rectangle we tracked as being drawn */
|
||||
|
@ -745,7 +745,7 @@ Free a pool and temporary objects it refers to (callable from C)
|
|||
[view unlockFocus];
|
||||
[[view window] flushWindow];
|
||||
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
ns_updating_frame = NULL;
|
||||
NSTRACE (ns_update_end);
|
||||
}
|
||||
|
@ -902,7 +902,7 @@ Free a pool and temporary objects it refers to (callable from C)
|
|||
struct frame *frame = SELECTED_FRAME ();
|
||||
NSView *view;
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
pool = [[NSAutoreleasePool alloc] init];
|
||||
|
||||
view = FRAME_NS_VIEW (frame);
|
||||
|
@ -929,7 +929,7 @@ Free a pool and temporary objects it refers to (callable from C)
|
|||
ns_unfocus (frame);
|
||||
}
|
||||
[pool release];
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -970,13 +970,13 @@ Free a pool and temporary objects it refers to (callable from C)
|
|||
{
|
||||
NSView *view = FRAME_NS_VIEW (f);
|
||||
check_ns ();
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
FRAME_SAMPLE_VISIBILITY (f);
|
||||
if (FRAME_VISIBLE_P (f))
|
||||
{
|
||||
[[view window] makeKeyAndOrderFront: NSApp];
|
||||
}
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
}
|
||||
|
||||
|
||||
|
@ -988,9 +988,9 @@ Free a pool and temporary objects it refers to (callable from C)
|
|||
{
|
||||
NSView *view = FRAME_NS_VIEW (f);
|
||||
check_ns ();
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
[[view window] orderBack: NSApp];
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
}
|
||||
|
||||
|
||||
|
@ -1126,7 +1126,7 @@ Free a pool and temporary objects it refers to (callable from C)
|
|||
|
||||
[(EmacsView *)view setWindowClosing: YES]; /* may not have been informed */
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
|
||||
free_frame_menubar (f);
|
||||
|
||||
|
@ -1154,7 +1154,7 @@ Free a pool and temporary objects it refers to (callable from C)
|
|||
|
||||
xfree (f->output_data.ns);
|
||||
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1183,7 +1183,7 @@ Free a pool and temporary objects it refers to (callable from C)
|
|||
|
||||
NSTRACE (x_set_offset);
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
|
||||
f->left_pos = xoff;
|
||||
f->top_pos = yoff;
|
||||
|
@ -1215,7 +1215,7 @@ Free a pool and temporary objects it refers to (callable from C)
|
|||
f->size_hint_flags &= ~(XNegative|YNegative);
|
||||
}
|
||||
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
}
|
||||
|
||||
|
||||
|
@ -1240,7 +1240,7 @@ Free a pool and temporary objects it refers to (callable from C)
|
|||
|
||||
/*fprintf (stderr, "\tsetWindowSize: %d x %d, font size %d x %d\n", cols, rows, FRAME_COLUMN_WIDTH (f), FRAME_LINE_HEIGHT (f)); */
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
|
||||
check_frame_size (f, &rows, &cols);
|
||||
|
||||
|
@ -1302,7 +1302,7 @@ Free a pool and temporary objects it refers to (callable from C)
|
|||
mark_window_cursors_off (XWINDOW (f->root_window));
|
||||
cancel_mouse_face (f);
|
||||
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
}
|
||||
|
||||
|
||||
|
@ -1414,7 +1414,7 @@ Free a pool and temporary objects it refers to (callable from C)
|
|||
NSString *nsname = [NSString stringWithUTF8String: name];
|
||||
|
||||
/*fprintf (stderr, "ns_get_color: '%s'\n", name); */
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
|
||||
if ([nsname isEqualToString: @"ns_selection_color"])
|
||||
{
|
||||
|
@ -1461,7 +1461,7 @@ Free a pool and temporary objects it refers to (callable from C)
|
|||
if (r >= 0.0)
|
||||
{
|
||||
*col = [NSColor colorWithCalibratedRed: r green: g blue: b alpha: 1.0];
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1493,7 +1493,7 @@ Free a pool and temporary objects it refers to (callable from C)
|
|||
|
||||
if (new)
|
||||
*col = [new colorUsingColorSpaceName: NSCalibratedRGBColorSpace];
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
return new ? 0 : 1;
|
||||
}
|
||||
|
||||
|
@ -1524,12 +1524,12 @@ Free a pool and temporary objects it refers to (callable from C)
|
|||
const char *str;
|
||||
NSTRACE (ns_color_to_lisp);
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
if ([[col colorSpaceName] isEqualToString: NSNamedColorSpace])
|
||||
|
||||
if ((str =[[col colorNameComponent] UTF8String]))
|
||||
{
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
return build_string ((char *)str);
|
||||
}
|
||||
|
||||
|
@ -1541,14 +1541,14 @@ Free a pool and temporary objects it refers to (callable from C)
|
|||
getWhite: &gray alpha: &alpha];
|
||||
snprintf (buf, sizeof (buf), "#%2.2lx%2.2lx%2.2lx",
|
||||
lrint (gray * 0xff), lrint (gray * 0xff), lrint (gray * 0xff));
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
return build_string (buf);
|
||||
}
|
||||
|
||||
snprintf (buf, sizeof (buf), "#%2.2lx%2.2lx%2.2lx",
|
||||
lrint (red*0xff), lrint (green*0xff), lrint (blue*0xff));
|
||||
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
return build_string (buf);
|
||||
}
|
||||
|
||||
|
@ -1592,16 +1592,16 @@ Free a pool and temporary objects it refers to (callable from C)
|
|||
NSColor *col;
|
||||
NSTRACE (ns_defined_color);
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
if (ns_get_color (name, &col) != 0) /* Color not found */
|
||||
{
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
return 0;
|
||||
}
|
||||
if (makeIndex && alloc)
|
||||
color_def->pixel = ns_index_color (col, f);
|
||||
ns_query_color (col, color_def, !makeIndex);
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -1767,7 +1767,7 @@ Free a pool and temporary objects it refers to (callable from C)
|
|||
|
||||
dpyinfo = FRAME_NS_DISPLAY_INFO (*fp);
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
|
||||
if (last_mouse_scroll_bar != nil && insist == 0)
|
||||
{
|
||||
|
@ -1812,7 +1812,7 @@ Free a pool and temporary objects it refers to (callable from C)
|
|||
}
|
||||
}
|
||||
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
}
|
||||
|
||||
|
||||
|
@ -1832,7 +1832,7 @@ Free a pool and temporary objects it refers to (callable from C)
|
|||
if ((hlinfo->mouse_face_deferred_gc || f ==hlinfo->mouse_face_mouse_frame)
|
||||
/*&& hlinfo->mouse_face_mouse_frame*/)
|
||||
{
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
ns_update_begin(f);
|
||||
if (hlinfo->mouse_face_mouse_frame)
|
||||
note_mouse_highlight (hlinfo->mouse_face_mouse_frame,
|
||||
|
@ -1840,7 +1840,7 @@ Free a pool and temporary objects it refers to (callable from C)
|
|||
hlinfo->mouse_face_mouse_y);
|
||||
hlinfo->mouse_face_deferred_gc = 0;
|
||||
ns_update_end(f);
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1955,7 +1955,7 @@ Free a pool and temporary objects it refers to (callable from C)
|
|||
|
||||
r = [view bounds];
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
ns_focus (f, &r, 1);
|
||||
[ns_lookup_indexed_color (NS_FACE_BACKGROUND (FRAME_DEFAULT_FACE (f)), f) set];
|
||||
NSRectFill (r);
|
||||
|
@ -1967,7 +1967,7 @@ Free a pool and temporary objects it refers to (callable from C)
|
|||
|
||||
/* as of 2006/11 or so this is now needed */
|
||||
ns_redraw_scroll_bars (f);
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
}
|
||||
|
||||
|
||||
|
@ -2068,7 +2068,7 @@ Free a pool and temporary objects it refers to (callable from C)
|
|||
if (height == 0)
|
||||
return;
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
|
||||
updated_window = w;
|
||||
x_clear_cursor (w);
|
||||
|
@ -2083,7 +2083,7 @@ Free a pool and temporary objects it refers to (callable from C)
|
|||
ns_unfocus (f);
|
||||
}
|
||||
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
}
|
||||
|
||||
|
||||
|
@ -2117,12 +2117,12 @@ Free a pool and temporary objects it refers to (callable from C)
|
|||
{
|
||||
int y = WINDOW_TO_FRAME_PIXEL_Y (w, max (0, desired_row->y));
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
ns_clear_frame_area (f, 0, y, width, height);
|
||||
ns_clear_frame_area (f,
|
||||
FRAME_PIXEL_WIDTH (f) - width,
|
||||
y, width, height);
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2489,12 +2489,12 @@ Note that CURSOR_WIDTH is meaningful only for (h)bar cursors.
|
|||
if (hourglass_shown_p)
|
||||
return;
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
|
||||
/* TODO: add NSProgressIndicator to selected frame (see macfns.c) */
|
||||
|
||||
hourglass_shown_p = 1;
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
}
|
||||
|
||||
|
||||
|
@ -2504,12 +2504,12 @@ Note that CURSOR_WIDTH is meaningful only for (h)bar cursors.
|
|||
if (!hourglass_shown_p)
|
||||
return;
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
|
||||
/* TODO: remove NSProgressIndicator from all frames */
|
||||
|
||||
hourglass_shown_p = 0;
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
}
|
||||
|
||||
|
||||
|
@ -3352,17 +3352,7 @@ overwriting cursor (usually when cursor on a tab) */
|
|||
if ([NSApp modalWindow] != nil)
|
||||
return -1;
|
||||
|
||||
if (interrupt_input_blocked)
|
||||
{
|
||||
interrupt_input_pending = 1;
|
||||
pending_signals = 1;
|
||||
return -1;
|
||||
}
|
||||
|
||||
interrupt_input_pending = 0;
|
||||
pending_signals = pending_atimers;
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
n_emacs_events_pending = 0;
|
||||
EVENT_INIT (ev);
|
||||
emacs_event = &ev;
|
||||
|
@ -3407,7 +3397,7 @@ overwriting cursor (usually when cursor on a tab) */
|
|||
nevents = n_emacs_events_pending;
|
||||
n_emacs_events_pending = 0;
|
||||
emacs_event = q_event_ptr = NULL;
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
|
||||
return nevents;
|
||||
}
|
||||
|
@ -3487,7 +3477,7 @@ overwriting cursor (usually when cursor on a tab) */
|
|||
}
|
||||
|
||||
EVENT_INIT (event);
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
emacs_event = &event;
|
||||
if (++apploopnr != 1)
|
||||
{
|
||||
|
@ -3501,7 +3491,7 @@ overwriting cursor (usually when cursor on a tab) */
|
|||
c = 's';
|
||||
write (selfds[1], &c, 1);
|
||||
}
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
|
||||
ev = last_appdefined_event;
|
||||
|
||||
|
@ -3613,7 +3603,7 @@ overwriting cursor (usually when cursor on a tab) */
|
|||
|| WINDOW_RIGHT_MARGIN_COLS (window) == 0));
|
||||
|
||||
XSETWINDOW (win, window);
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
|
||||
/* we want at least 5 lines to display a scrollbar */
|
||||
if (WINDOW_TOTAL_LINES (window) < 5)
|
||||
|
@ -3625,7 +3615,7 @@ overwriting cursor (usually when cursor on a tab) */
|
|||
wset_vertical_scroll_bar (window, Qnil);
|
||||
}
|
||||
ns_clear_frame_area (f, sb_left, top, width, height);
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -3657,7 +3647,7 @@ overwriting cursor (usually when cursor on a tab) */
|
|||
}
|
||||
|
||||
[bar setPosition: position portion: portion whole: whole];
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
}
|
||||
|
||||
|
||||
|
@ -3901,11 +3891,11 @@ static Lisp_Object ns_string_to_lispmod (const char *s)
|
|||
if (!terminal->name)
|
||||
return;
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
|
||||
x_destroy_all_bitmaps (dpyinfo);
|
||||
ns_delete_display (dpyinfo);
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
}
|
||||
|
||||
|
||||
|
@ -3983,7 +3973,7 @@ static Lisp_Object ns_string_to_lispmod (const char *s)
|
|||
|
||||
/* count object allocs (About, click icon); on OS X use ObjectAlloc tool */
|
||||
/*GSDebugAllocationActive (YES); */
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
|
||||
baud_rate = 38400;
|
||||
Fset_input_interrupt_mode (Qnil);
|
||||
|
@ -4052,7 +4042,7 @@ Needs to be here because ns_initialize_display_info () uses AppKit classes.
|
|||
|
||||
terminal->name = xstrdup (SSDATA (display_name));
|
||||
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
|
||||
if (!inhibit_x_resources)
|
||||
{
|
||||
|
@ -6370,13 +6360,13 @@ + (CGFloat) scrollerWidth
|
|||
- (void)setFrame: (NSRect)newRect
|
||||
{
|
||||
NSTRACE (EmacsScroller_setFrame);
|
||||
/* BLOCK_INPUT; */
|
||||
/* block_input (); */
|
||||
pixel_height = NSHeight (newRect);
|
||||
if (pixel_height == 0) pixel_height = 1;
|
||||
min_portion = 20 / pixel_height;
|
||||
[super setFrame: newRect];
|
||||
[self display];
|
||||
/* UNBLOCK_INPUT; */
|
||||
/* unblock_input (); */
|
||||
}
|
||||
|
||||
|
||||
|
@ -6411,14 +6401,14 @@ - (void)dealloc
|
|||
if (condemned)
|
||||
{
|
||||
EmacsView *view;
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
/* ensure other scrollbar updates after deletion */
|
||||
view = (EmacsView *)FRAME_NS_VIEW (frame);
|
||||
if (view != nil)
|
||||
view->scrollbarsNeedingUpdate++;
|
||||
[self removeFromSuperview];
|
||||
[self release];
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
|
|
@ -753,9 +753,9 @@ append to existing target file. */)
|
|||
{
|
||||
if (initial_stderr_stream != NULL)
|
||||
{
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
fclose (stderr);
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
}
|
||||
stderr = initial_stderr_stream;
|
||||
initial_stderr_stream = NULL;
|
||||
|
|
574
src/process.c
574
src/process.c
|
@ -255,11 +255,12 @@ static int keyboard_bit_set (SELECT_TYPE *);
|
|||
static void deactivate_process (Lisp_Object);
|
||||
static void status_notify (struct Lisp_Process *);
|
||||
static int read_process_output (Lisp_Object, int);
|
||||
static void handle_child_signal (int);
|
||||
static void create_pty (Lisp_Object);
|
||||
|
||||
/* If we support a window system, turn on the code to poll periodically
|
||||
to detect C-g. It isn't actually used when doing interrupt input. */
|
||||
#if defined (HAVE_WINDOW_SYSTEM) && !defined (USE_ASYNC_EVENTS)
|
||||
#ifdef HAVE_WINDOW_SYSTEM
|
||||
#define POLL_FOR_INPUT
|
||||
#endif
|
||||
|
||||
|
@ -1610,11 +1611,16 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir)
|
|||
int wait_child_setup[2];
|
||||
#endif
|
||||
#ifdef SIGCHLD
|
||||
sigset_t blocked, procmask;
|
||||
sigset_t blocked;
|
||||
#endif
|
||||
/* Use volatile to protect variables from being clobbered by vfork. */
|
||||
volatile int forkin, forkout;
|
||||
volatile int pty_flag = 0;
|
||||
volatile Lisp_Object lisp_pty_name = Qnil;
|
||||
volatile Lisp_Object encoded_current_dir;
|
||||
#if HAVE_WORKING_VFORK
|
||||
char **volatile save_environ;
|
||||
#endif
|
||||
|
||||
inchannel = outchannel = -1;
|
||||
|
||||
|
@ -1640,6 +1646,7 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir)
|
|||
forkin = forkout = -1;
|
||||
#endif /* not USG, or USG_SUBTTY_WORKS */
|
||||
pty_flag = 1;
|
||||
lisp_pty_name = build_string (pty_name);
|
||||
}
|
||||
else
|
||||
#endif /* HAVE_PTYS */
|
||||
|
@ -1704,14 +1711,6 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir)
|
|||
XPROCESS (process)->pty_flag = pty_flag;
|
||||
pset_status (XPROCESS (process), Qrun);
|
||||
|
||||
#ifdef SIGCHLD
|
||||
/* Delay interrupts until we have a chance to store
|
||||
the new fork's pid in its process structure */
|
||||
sigemptyset (&blocked);
|
||||
sigaddset (&blocked, SIGCHLD);
|
||||
pthread_sigmask (SIG_BLOCK, &blocked, &procmask);
|
||||
#endif
|
||||
|
||||
FD_SET (inchannel, &input_wait_mask);
|
||||
FD_SET (inchannel, &non_keyboard_wait_mask);
|
||||
if (inchannel > max_process_desc)
|
||||
|
@ -1729,89 +1728,99 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir)
|
|||
error. */
|
||||
setup_process_coding_systems (process);
|
||||
|
||||
BLOCK_INPUT;
|
||||
encoded_current_dir = ENCODE_FILE (current_dir);
|
||||
|
||||
{
|
||||
/* child_setup must clobber environ on systems with true vfork.
|
||||
Protect it from permanent change. */
|
||||
char **save_environ = environ;
|
||||
volatile Lisp_Object encoded_current_dir = ENCODE_FILE (current_dir);
|
||||
block_input ();
|
||||
|
||||
#ifdef SIGCHLD
|
||||
/* Block SIGCHLD until we have a chance to store the new fork's
|
||||
pid in its process structure. */
|
||||
sigemptyset (&blocked);
|
||||
sigaddset (&blocked, SIGCHLD);
|
||||
pthread_sigmask (SIG_BLOCK, &blocked, 0);
|
||||
#endif
|
||||
|
||||
#if HAVE_WORKING_VFORK
|
||||
/* child_setup must clobber environ on systems with true vfork.
|
||||
Protect it from permanent change. */
|
||||
save_environ = environ;
|
||||
#endif
|
||||
|
||||
#ifndef WINDOWSNT
|
||||
pid = vfork ();
|
||||
if (pid == 0)
|
||||
pid = vfork ();
|
||||
if (pid == 0)
|
||||
#endif /* not WINDOWSNT */
|
||||
{
|
||||
int xforkin = forkin;
|
||||
int xforkout = forkout;
|
||||
{
|
||||
int xforkin = forkin;
|
||||
int xforkout = forkout;
|
||||
|
||||
/* Make the pty be the controlling terminal of the process. */
|
||||
/* Make the pty be the controlling terminal of the process. */
|
||||
#ifdef HAVE_PTYS
|
||||
/* First, disconnect its current controlling terminal. */
|
||||
/* First, disconnect its current controlling terminal. */
|
||||
#ifdef HAVE_SETSID
|
||||
/* We tried doing setsid only if pty_flag, but it caused
|
||||
process_set_signal to fail on SGI when using a pipe. */
|
||||
setsid ();
|
||||
/* Make the pty's terminal the controlling terminal. */
|
||||
if (pty_flag && xforkin >= 0)
|
||||
{
|
||||
/* We tried doing setsid only if pty_flag, but it caused
|
||||
process_set_signal to fail on SGI when using a pipe. */
|
||||
setsid ();
|
||||
/* Make the pty's terminal the controlling terminal. */
|
||||
if (pty_flag && xforkin >= 0)
|
||||
{
|
||||
#ifdef TIOCSCTTY
|
||||
/* We ignore the return value
|
||||
because faith@cs.unc.edu says that is necessary on Linux. */
|
||||
ioctl (xforkin, TIOCSCTTY, 0);
|
||||
/* We ignore the return value
|
||||
because faith@cs.unc.edu says that is necessary on Linux. */
|
||||
ioctl (xforkin, TIOCSCTTY, 0);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#else /* not HAVE_SETSID */
|
||||
#ifdef USG
|
||||
/* It's very important to call setpgrp here and no time
|
||||
afterwards. Otherwise, we lose our controlling tty which
|
||||
is set when we open the pty. */
|
||||
setpgrp ();
|
||||
/* It's very important to call setpgrp here and no time
|
||||
afterwards. Otherwise, we lose our controlling tty which
|
||||
is set when we open the pty. */
|
||||
setpgrp ();
|
||||
#endif /* USG */
|
||||
#endif /* not HAVE_SETSID */
|
||||
#if defined (LDISC1)
|
||||
if (pty_flag && xforkin >= 0)
|
||||
{
|
||||
struct termios t;
|
||||
tcgetattr (xforkin, &t);
|
||||
t.c_lflag = LDISC1;
|
||||
if (tcsetattr (xforkin, TCSANOW, &t) < 0)
|
||||
emacs_write (1, "create_process/tcsetattr LDISC1 failed\n", 39);
|
||||
}
|
||||
if (pty_flag && xforkin >= 0)
|
||||
{
|
||||
struct termios t;
|
||||
tcgetattr (xforkin, &t);
|
||||
t.c_lflag = LDISC1;
|
||||
if (tcsetattr (xforkin, TCSANOW, &t) < 0)
|
||||
emacs_write (1, "create_process/tcsetattr LDISC1 failed\n", 39);
|
||||
}
|
||||
#else
|
||||
#if defined (NTTYDISC) && defined (TIOCSETD)
|
||||
if (pty_flag && xforkin >= 0)
|
||||
{
|
||||
/* Use new line discipline. */
|
||||
int ldisc = NTTYDISC;
|
||||
ioctl (xforkin, TIOCSETD, &ldisc);
|
||||
}
|
||||
if (pty_flag && xforkin >= 0)
|
||||
{
|
||||
/* Use new line discipline. */
|
||||
int ldisc = NTTYDISC;
|
||||
ioctl (xforkin, TIOCSETD, &ldisc);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
#ifdef TIOCNOTTY
|
||||
/* In 4.3BSD, the TIOCSPGRP bug has been fixed, and now you
|
||||
can do TIOCSPGRP only to the process's controlling tty. */
|
||||
if (pty_flag)
|
||||
{
|
||||
/* I wonder: would just ioctl (0, TIOCNOTTY, 0) work here?
|
||||
I can't test it since I don't have 4.3. */
|
||||
int j = emacs_open ("/dev/tty", O_RDWR, 0);
|
||||
if (j >= 0)
|
||||
{
|
||||
ioctl (j, TIOCNOTTY, 0);
|
||||
emacs_close (j);
|
||||
}
|
||||
/* In 4.3BSD, the TIOCSPGRP bug has been fixed, and now you
|
||||
can do TIOCSPGRP only to the process's controlling tty. */
|
||||
if (pty_flag)
|
||||
{
|
||||
/* I wonder: would just ioctl (0, TIOCNOTTY, 0) work here?
|
||||
I can't test it since I don't have 4.3. */
|
||||
int j = emacs_open ("/dev/tty", O_RDWR, 0);
|
||||
if (j >= 0)
|
||||
{
|
||||
ioctl (j, TIOCNOTTY, 0);
|
||||
emacs_close (j);
|
||||
}
|
||||
#ifndef USG
|
||||
/* In order to get a controlling terminal on some versions
|
||||
of BSD, it is necessary to put the process in pgrp 0
|
||||
before it opens the terminal. */
|
||||
/* In order to get a controlling terminal on some versions
|
||||
of BSD, it is necessary to put the process in pgrp 0
|
||||
before it opens the terminal. */
|
||||
#ifdef HAVE_SETPGID
|
||||
setpgid (0, 0);
|
||||
setpgid (0, 0);
|
||||
#else
|
||||
setpgrp (0, 0);
|
||||
setpgrp (0, 0);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#endif /* TIOCNOTTY */
|
||||
|
||||
#if !defined (DONT_REOPEN_PTY)
|
||||
|
@ -1823,70 +1832,79 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir)
|
|||
both HAVE_SETSID and TIOCSCTTY are defined. */
|
||||
/* Now close the pty (if we had it open) and reopen it.
|
||||
This makes the pty the controlling terminal of the subprocess. */
|
||||
if (pty_flag)
|
||||
{
|
||||
if (pty_flag)
|
||||
{
|
||||
|
||||
/* I wonder if emacs_close (emacs_open (pty_name, ...))
|
||||
would work? */
|
||||
if (xforkin >= 0)
|
||||
emacs_close (xforkin);
|
||||
xforkout = xforkin = emacs_open (pty_name, O_RDWR, 0);
|
||||
/* I wonder if emacs_close (emacs_open (pty_name, ...))
|
||||
would work? */
|
||||
if (xforkin >= 0)
|
||||
emacs_close (xforkin);
|
||||
xforkout = xforkin = emacs_open (pty_name, O_RDWR, 0);
|
||||
|
||||
if (xforkin < 0)
|
||||
{
|
||||
emacs_write (1, "Couldn't open the pty terminal ", 31);
|
||||
emacs_write (1, pty_name, strlen (pty_name));
|
||||
emacs_write (1, "\n", 1);
|
||||
_exit (1);
|
||||
}
|
||||
if (xforkin < 0)
|
||||
{
|
||||
emacs_write (1, "Couldn't open the pty terminal ", 31);
|
||||
emacs_write (1, pty_name, strlen (pty_name));
|
||||
emacs_write (1, "\n", 1);
|
||||
_exit (1);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
#endif /* not DONT_REOPEN_PTY */
|
||||
|
||||
#ifdef SETUP_SLAVE_PTY
|
||||
if (pty_flag)
|
||||
{
|
||||
SETUP_SLAVE_PTY;
|
||||
}
|
||||
if (pty_flag)
|
||||
{
|
||||
SETUP_SLAVE_PTY;
|
||||
}
|
||||
#endif /* SETUP_SLAVE_PTY */
|
||||
#ifdef AIX
|
||||
/* On AIX, we've disabled SIGHUP above once we start a child on a pty.
|
||||
Now reenable it in the child, so it will die when we want it to. */
|
||||
if (pty_flag)
|
||||
signal (SIGHUP, SIG_DFL);
|
||||
/* On AIX, we've disabled SIGHUP above once we start a child on a pty.
|
||||
Now reenable it in the child, so it will die when we want it to. */
|
||||
if (pty_flag)
|
||||
signal (SIGHUP, SIG_DFL);
|
||||
#endif
|
||||
#endif /* HAVE_PTYS */
|
||||
|
||||
signal (SIGINT, SIG_DFL);
|
||||
signal (SIGQUIT, SIG_DFL);
|
||||
/* GConf causes us to ignore SIGPIPE, make sure it is restored
|
||||
in the child. */
|
||||
signal (SIGPIPE, SIG_DFL);
|
||||
signal (SIGINT, SIG_DFL);
|
||||
signal (SIGQUIT, SIG_DFL);
|
||||
|
||||
/* Emacs ignores SIGPIPE, but the child should not. */
|
||||
signal (SIGPIPE, SIG_DFL);
|
||||
|
||||
#ifdef SIGCHLD
|
||||
/* Stop blocking signals in the child. */
|
||||
pthread_sigmask (SIG_SETMASK, &procmask, 0);
|
||||
pthread_sigmask (SIG_SETMASK, &empty_mask, 0);
|
||||
#endif
|
||||
|
||||
if (pty_flag)
|
||||
child_setup_tty (xforkout);
|
||||
if (pty_flag)
|
||||
child_setup_tty (xforkout);
|
||||
#ifdef WINDOWSNT
|
||||
pid = child_setup (xforkin, xforkout, xforkout,
|
||||
new_argv, 1, encoded_current_dir);
|
||||
pid = child_setup (xforkin, xforkout, xforkout,
|
||||
new_argv, 1, encoded_current_dir);
|
||||
#else /* not WINDOWSNT */
|
||||
#ifdef FD_CLOEXEC
|
||||
emacs_close (wait_child_setup[0]);
|
||||
emacs_close (wait_child_setup[0]);
|
||||
#endif
|
||||
child_setup (xforkin, xforkout, xforkout,
|
||||
new_argv, 1, encoded_current_dir);
|
||||
child_setup (xforkin, xforkout, xforkout,
|
||||
new_argv, 1, encoded_current_dir);
|
||||
#endif /* not WINDOWSNT */
|
||||
}
|
||||
environ = save_environ;
|
||||
}
|
||||
}
|
||||
|
||||
UNBLOCK_INPUT;
|
||||
/* Back in the parent process. */
|
||||
|
||||
#if HAVE_WORKING_VFORK
|
||||
environ = save_environ;
|
||||
#endif
|
||||
|
||||
XPROCESS (process)->pid = pid;
|
||||
|
||||
/* Stop blocking signals in the parent. */
|
||||
#ifdef SIGCHLD
|
||||
pthread_sigmask (SIG_SETMASK, &empty_mask, 0);
|
||||
#endif
|
||||
unblock_input ();
|
||||
|
||||
/* This runs in the Emacs process. */
|
||||
if (pid < 0)
|
||||
{
|
||||
if (forkin >= 0)
|
||||
|
@ -1897,7 +1915,6 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir)
|
|||
else
|
||||
{
|
||||
/* vfork succeeded. */
|
||||
XPROCESS (process)->pid = pid;
|
||||
|
||||
#ifdef WINDOWSNT
|
||||
register_child (pid, inchannel);
|
||||
|
@ -1923,12 +1940,7 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir)
|
|||
if (forkin != forkout && forkout >= 0)
|
||||
emacs_close (forkout);
|
||||
|
||||
#ifdef HAVE_PTYS
|
||||
if (pty_flag)
|
||||
pset_tty_name (XPROCESS (process), build_string (pty_name));
|
||||
else
|
||||
#endif
|
||||
pset_tty_name (XPROCESS (process), Qnil);
|
||||
pset_tty_name (XPROCESS (process), lisp_pty_name);
|
||||
|
||||
#if !defined (WINDOWSNT) && defined (FD_CLOEXEC)
|
||||
/* 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)
|
|||
#endif
|
||||
}
|
||||
|
||||
#ifdef SIGCHLD
|
||||
/* Stop blocking signals in the parent. */
|
||||
pthread_sigmask (SIG_SETMASK, &procmask, 0);
|
||||
#endif
|
||||
|
||||
/* Now generate the error if vfork failed. */
|
||||
if (pid < 0)
|
||||
report_file_error ("Doing vfork", Qnil);
|
||||
|
@ -3402,9 +3409,9 @@ usage: (make-network-process &rest ARGS) */)
|
|||
#ifdef HAVE_GETADDRINFO
|
||||
if (res != &ai)
|
||||
{
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
freeaddrinfo (res);
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -4372,7 +4379,7 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd,
|
|||
Otherwise, do pending quit if requested. */
|
||||
if (read_kbd >= 0)
|
||||
QUIT;
|
||||
else
|
||||
else if (pending_signals)
|
||||
process_pending_signals ();
|
||||
|
||||
/* 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,
|
|||
check_write = 0;
|
||||
}
|
||||
|
||||
#if 0 /* When polling is used, interrupt_input is 0,
|
||||
so get_input_pending should read the input.
|
||||
So this should not be needed. */
|
||||
/* If we are using polling for input,
|
||||
and we see input available, make it get read now.
|
||||
Otherwise it might not actually get read for a second.
|
||||
And on hpux, since we turn off polling in wait_reading_process_output,
|
||||
it might never get read at all if we don't spend much time
|
||||
outside of wait_reading_process_output. */
|
||||
if (read_kbd && interrupt_input
|
||||
&& keyboard_bit_set (&Available)
|
||||
&& input_polling_used ())
|
||||
kill (getpid (), SIGALRM);
|
||||
#endif
|
||||
|
||||
/* Check for keyboard input */
|
||||
/* If there is any, return immediately
|
||||
to give it higher priority than subprocesses */
|
||||
|
@ -4817,7 +4809,7 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd,
|
|||
|
||||
if (read_kbd && interrupt_input
|
||||
&& keyboard_bit_set (&Available) && ! noninteractive)
|
||||
kill (getpid (), SIGIO);
|
||||
handle_input_available_signal (SIGIO);
|
||||
#endif
|
||||
|
||||
if (! wait_proc)
|
||||
|
@ -4937,7 +4929,7 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd,
|
|||
pset_status (p, Qfailed);
|
||||
}
|
||||
else
|
||||
kill (getpid (), SIGCHLD);
|
||||
handle_child_signal (SIGCHLD);
|
||||
}
|
||||
#endif /* HAVE_PTYS */
|
||||
/* If we can detect process termination, don't consider the
|
||||
|
@ -5393,25 +5385,6 @@ read_process_output (Lisp_Object proc, register int channel)
|
|||
|
||||
/* Sending data to subprocess */
|
||||
|
||||
static sys_jmp_buf send_process_frame;
|
||||
static Lisp_Object process_sent_to;
|
||||
|
||||
static _Noreturn void
|
||||
handle_pipe_signal (int sig)
|
||||
{
|
||||
sigset_t unblocked;
|
||||
sigemptyset (&unblocked);
|
||||
sigaddset (&unblocked, SIGPIPE);
|
||||
pthread_sigmask (SIG_UNBLOCK, &unblocked, 0);
|
||||
sys_longjmp (send_process_frame, 1);
|
||||
}
|
||||
|
||||
static void
|
||||
deliver_pipe_signal (int sig)
|
||||
{
|
||||
handle_on_main_thread (sig, handle_pipe_signal);
|
||||
}
|
||||
|
||||
/* In send_process, when a write fails temporarily,
|
||||
wait_reading_process_output is called. It may execute user code,
|
||||
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,
|
|||
This function can evaluate Lisp code and can garbage collect. */
|
||||
|
||||
static void
|
||||
send_process (volatile Lisp_Object proc, const char *volatile buf,
|
||||
volatile ptrdiff_t len, volatile Lisp_Object object)
|
||||
send_process (Lisp_Object proc, const char *buf, ptrdiff_t len,
|
||||
Lisp_Object object)
|
||||
{
|
||||
/* Use volatile to protect variables from being clobbered by longjmp. */
|
||||
struct Lisp_Process *p = XPROCESS (proc);
|
||||
ssize_t rv;
|
||||
struct coding_system *coding;
|
||||
struct sigaction old_sigpipe_action;
|
||||
|
||||
if (p->raw_status_new)
|
||||
update_status (p);
|
||||
|
@ -5609,145 +5580,126 @@ send_process (volatile Lisp_Object proc, const char *volatile buf,
|
|||
pty_max_bytes--;
|
||||
}
|
||||
|
||||
/* 2000-09-21: Emacs 20.7, sparc-sun-solaris-2.6, GCC 2.95.2,
|
||||
CFLAGS="-g -O": The value of the parameter `proc' is clobbered
|
||||
when returning with longjmp despite being declared volatile. */
|
||||
if (!sys_setjmp (send_process_frame))
|
||||
/* If there is already data in the write_queue, put the new data
|
||||
in the back of queue. Otherwise, ignore it. */
|
||||
if (!NILP (p->write_queue))
|
||||
write_queue_push (p, object, buf, len, 0);
|
||||
|
||||
do /* while !NILP (p->write_queue) */
|
||||
{
|
||||
p = XPROCESS (proc); /* Repair any setjmp clobbering. */
|
||||
process_sent_to = proc;
|
||||
ptrdiff_t cur_len = -1;
|
||||
const char *cur_buf;
|
||||
Lisp_Object cur_object;
|
||||
|
||||
/* If there is already data in the write_queue, put the new data
|
||||
in the back of queue. Otherwise, ignore it. */
|
||||
if (!NILP (p->write_queue))
|
||||
write_queue_push (p, object, buf, len, 0);
|
||||
|
||||
do /* while !NILP (p->write_queue) */
|
||||
/* If write_queue is empty, ignore it. */
|
||||
if (!write_queue_pop (p, &cur_object, &cur_buf, &cur_len))
|
||||
{
|
||||
ptrdiff_t cur_len = -1;
|
||||
const char *cur_buf;
|
||||
Lisp_Object cur_object;
|
||||
cur_len = len;
|
||||
cur_buf = buf;
|
||||
cur_object = object;
|
||||
}
|
||||
|
||||
/* If write_queue is empty, ignore it. */
|
||||
if (!write_queue_pop (p, &cur_object, &cur_buf, &cur_len))
|
||||
{
|
||||
cur_len = len;
|
||||
cur_buf = buf;
|
||||
cur_object = object;
|
||||
}
|
||||
|
||||
while (cur_len > 0)
|
||||
{
|
||||
/* Send this batch, using one or more write calls. */
|
||||
ptrdiff_t written = 0;
|
||||
int outfd = p->outfd;
|
||||
struct sigaction action;
|
||||
emacs_sigaction_init (&action, deliver_pipe_signal);
|
||||
sigaction (SIGPIPE, &action, &old_sigpipe_action);
|
||||
while (cur_len > 0)
|
||||
{
|
||||
/* Send this batch, using one or more write calls. */
|
||||
ptrdiff_t written = 0;
|
||||
int outfd = p->outfd;
|
||||
#ifdef DATAGRAM_SOCKETS
|
||||
if (DATAGRAM_CHAN_P (outfd))
|
||||
{
|
||||
rv = sendto (outfd, cur_buf, cur_len,
|
||||
0, datagram_address[outfd].sa,
|
||||
datagram_address[outfd].len);
|
||||
if (0 <= rv)
|
||||
written = rv;
|
||||
else if (errno == EMSGSIZE)
|
||||
{
|
||||
sigaction (SIGPIPE, &old_sigpipe_action, 0);
|
||||
report_file_error ("sending datagram",
|
||||
Fcons (proc, Qnil));
|
||||
}
|
||||
}
|
||||
if (DATAGRAM_CHAN_P (outfd))
|
||||
{
|
||||
rv = sendto (outfd, cur_buf, cur_len,
|
||||
0, datagram_address[outfd].sa,
|
||||
datagram_address[outfd].len);
|
||||
if (0 <= rv)
|
||||
written = rv;
|
||||
else if (errno == EMSGSIZE)
|
||||
report_file_error ("sending datagram", Fcons (proc, Qnil));
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
#ifdef HAVE_GNUTLS
|
||||
if (p->gnutls_p)
|
||||
written = emacs_gnutls_write (p, cur_buf, cur_len);
|
||||
else
|
||||
#endif
|
||||
{
|
||||
#ifdef HAVE_GNUTLS
|
||||
if (p->gnutls_p)
|
||||
written = emacs_gnutls_write (p, cur_buf, cur_len);
|
||||
else
|
||||
#endif
|
||||
written = emacs_write (outfd, cur_buf, cur_len);
|
||||
rv = (written ? 0 : -1);
|
||||
written = emacs_write (outfd, cur_buf, cur_len);
|
||||
rv = (written ? 0 : -1);
|
||||
#ifdef ADAPTIVE_READ_BUFFERING
|
||||
if (p->read_output_delay > 0
|
||||
&& p->adaptive_read_buffering == 1)
|
||||
{
|
||||
p->read_output_delay = 0;
|
||||
process_output_delay_count--;
|
||||
p->read_output_skip = 0;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
sigaction (SIGPIPE, &old_sigpipe_action, 0);
|
||||
|
||||
if (rv < 0)
|
||||
if (p->read_output_delay > 0
|
||||
&& p->adaptive_read_buffering == 1)
|
||||
{
|
||||
if (0
|
||||
p->read_output_delay = 0;
|
||||
process_output_delay_count--;
|
||||
p->read_output_skip = 0;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
if (rv < 0)
|
||||
{
|
||||
if (0
|
||||
#ifdef EWOULDBLOCK
|
||||
|| errno == EWOULDBLOCK
|
||||
|| errno == EWOULDBLOCK
|
||||
#endif
|
||||
#ifdef EAGAIN
|
||||
|| errno == EAGAIN
|
||||
|| errno == EAGAIN
|
||||
#endif
|
||||
)
|
||||
/* Buffer is full. Wait, accepting input;
|
||||
that may allow the program
|
||||
to finish doing output and read more. */
|
||||
{
|
||||
)
|
||||
/* Buffer is full. Wait, accepting input;
|
||||
that may allow the program
|
||||
to finish doing output and read more. */
|
||||
{
|
||||
#ifdef BROKEN_PTY_READ_AFTER_EAGAIN
|
||||
/* A gross hack to work around a bug in FreeBSD.
|
||||
In the following sequence, read(2) returns
|
||||
bogus data:
|
||||
/* A gross hack to work around a bug in FreeBSD.
|
||||
In the following sequence, read(2) returns
|
||||
bogus data:
|
||||
|
||||
write(2) 1022 bytes
|
||||
write(2) 954 bytes, get EAGAIN
|
||||
read(2) 1024 bytes in process_read_output
|
||||
read(2) 11 bytes in process_read_output
|
||||
write(2) 1022 bytes
|
||||
write(2) 954 bytes, get EAGAIN
|
||||
read(2) 1024 bytes in process_read_output
|
||||
read(2) 11 bytes in process_read_output
|
||||
|
||||
That is, read(2) returns more bytes than have
|
||||
ever been written successfully. The 1033 bytes
|
||||
read are the 1022 bytes written successfully
|
||||
after processing (for example with CRs added if
|
||||
the terminal is set up that way which it is
|
||||
here). The same bytes will be seen again in a
|
||||
later read(2), without the CRs. */
|
||||
That is, read(2) returns more bytes than have
|
||||
ever been written successfully. The 1033 bytes
|
||||
read are the 1022 bytes written successfully
|
||||
after processing (for example with CRs added if
|
||||
the terminal is set up that way which it is
|
||||
here). The same bytes will be seen again in a
|
||||
later read(2), without the CRs. */
|
||||
|
||||
if (errno == EAGAIN)
|
||||
{
|
||||
int flags = FWRITE;
|
||||
ioctl (p->outfd, TIOCFLUSH, &flags);
|
||||
}
|
||||
if (errno == EAGAIN)
|
||||
{
|
||||
int flags = FWRITE;
|
||||
ioctl (p->outfd, TIOCFLUSH, &flags);
|
||||
}
|
||||
#endif /* BROKEN_PTY_READ_AFTER_EAGAIN */
|
||||
|
||||
/* Put what we should have written in wait_queue. */
|
||||
write_queue_push (p, cur_object, cur_buf, cur_len, 1);
|
||||
wait_reading_process_output (0, 20 * 1000 * 1000,
|
||||
0, 0, Qnil, NULL, 0);
|
||||
/* Reread queue, to see what is left. */
|
||||
break;
|
||||
}
|
||||
else
|
||||
/* This is a real error. */
|
||||
report_file_error ("writing to process", Fcons (proc, Qnil));
|
||||
/* Put what we should have written in wait_queue. */
|
||||
write_queue_push (p, cur_object, cur_buf, cur_len, 1);
|
||||
wait_reading_process_output (0, 20 * 1000 * 1000,
|
||||
0, 0, Qnil, NULL, 0);
|
||||
/* Reread queue, to see what is left. */
|
||||
break;
|
||||
}
|
||||
cur_buf += written;
|
||||
cur_len -= written;
|
||||
else if (errno == EPIPE)
|
||||
{
|
||||
p->raw_status_new = 0;
|
||||
pset_status (p, list2 (Qexit, make_number (256)));
|
||||
p->tick = ++process_tick;
|
||||
deactivate_process (proc);
|
||||
error ("process %s no longer connected to pipe; closed it",
|
||||
SDATA (p->name));
|
||||
}
|
||||
else
|
||||
/* This is a real error. */
|
||||
report_file_error ("writing to process", Fcons (proc, Qnil));
|
||||
}
|
||||
cur_buf += written;
|
||||
cur_len -= written;
|
||||
}
|
||||
while (!NILP (p->write_queue));
|
||||
}
|
||||
else
|
||||
{
|
||||
sigaction (SIGPIPE, &old_sigpipe_action, 0);
|
||||
proc = process_sent_to;
|
||||
p = XPROCESS (proc);
|
||||
p->raw_status_new = 0;
|
||||
pset_status (p, Fcons (Qexit, Fcons (make_number (256), Qnil)));
|
||||
p->tick = ++process_tick;
|
||||
deactivate_process (proc);
|
||||
error ("SIGPIPE raised on process %s; closed it", SDATA (p->name));
|
||||
}
|
||||
while (!NILP (p->write_queue));
|
||||
}
|
||||
|
||||
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. */)
|
|||
#ifdef SIGUSR2
|
||||
parse_signal ("usr2", SIGUSR2);
|
||||
#endif
|
||||
#ifdef SIGTERM
|
||||
parse_signal ("term", SIGTERM);
|
||||
#endif
|
||||
#ifdef SIGHUP
|
||||
parse_signal ("hup", SIGHUP);
|
||||
#endif
|
||||
#ifdef SIGINT
|
||||
parse_signal ("int", SIGINT);
|
||||
#endif
|
||||
#ifdef SIGQUIT
|
||||
parse_signal ("quit", SIGQUIT);
|
||||
#endif
|
||||
#ifdef SIGILL
|
||||
parse_signal ("ill", SIGILL);
|
||||
#endif
|
||||
#ifdef SIGABRT
|
||||
parse_signal ("abrt", SIGABRT);
|
||||
#endif
|
||||
#ifdef SIGEMT
|
||||
parse_signal ("emt", SIGEMT);
|
||||
#endif
|
||||
#ifdef SIGKILL
|
||||
parse_signal ("kill", SIGKILL);
|
||||
#endif
|
||||
#ifdef SIGFPE
|
||||
parse_signal ("fpe", SIGFPE);
|
||||
#endif
|
||||
#ifdef SIGBUS
|
||||
parse_signal ("bus", SIGBUS);
|
||||
#endif
|
||||
#ifdef SIGSEGV
|
||||
parse_signal ("segv", SIGSEGV);
|
||||
#endif
|
||||
#ifdef SIGSYS
|
||||
parse_signal ("sys", SIGSYS);
|
||||
#endif
|
||||
|
@ -6375,27 +6315,15 @@ process has been transmitted to the serial port. */)
|
|||
** Malloc WARNING: This should never call malloc either directly or
|
||||
indirectly; if it does, that is a bug */
|
||||
|
||||
#ifdef SIGCHLD
|
||||
|
||||
/* Record one child's changed status. Return true if a child was found. */
|
||||
static bool
|
||||
record_child_status_change (void)
|
||||
/* Record the changed status of the child process PID with wait status W. */
|
||||
void
|
||||
record_child_status_change (pid_t pid, int w)
|
||||
{
|
||||
#ifdef SIGCHLD
|
||||
Lisp_Object proc;
|
||||
struct Lisp_Process *p;
|
||||
pid_t pid;
|
||||
int w;
|
||||
Lisp_Object tail;
|
||||
|
||||
do
|
||||
pid = waitpid (-1, &w, WNOHANG | WUNTRACED);
|
||||
while (pid < 0 && errno == EINTR);
|
||||
|
||||
/* PID == 0 means no processes found, PID == -1 means a real failure.
|
||||
Either way, we have done all our job. */
|
||||
if (pid <= 0)
|
||||
return false;
|
||||
|
||||
/* Find the process that signaled us, and record its status. */
|
||||
|
||||
/* The process can have been deleted by Fdelete_process. */
|
||||
|
@ -6406,7 +6334,7 @@ record_child_status_change (void)
|
|||
|| (FLOATP (xpid) && pid == XFLOAT_DATA (xpid)))
|
||||
{
|
||||
XSETCAR (tail, Qnil);
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6476,10 +6404,11 @@ record_child_status_change (void)
|
|||
if (input_available_clear_time)
|
||||
*input_available_clear_time = make_emacs_time (0, 0);
|
||||
}
|
||||
|
||||
return true;
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef SIGCHLD
|
||||
|
||||
/* On some systems, the SIGCHLD handler must return right away. If
|
||||
any more processes want to signal us, we will get another signal.
|
||||
Otherwise, loop around to use up all the processes that have
|
||||
|
@ -6495,14 +6424,29 @@ enum { CAN_HANDLE_MULTIPLE_CHILDREN = 1 };
|
|||
static void
|
||||
handle_child_signal (int sig)
|
||||
{
|
||||
while (record_child_status_change () && CAN_HANDLE_MULTIPLE_CHILDREN)
|
||||
continue;
|
||||
do
|
||||
{
|
||||
pid_t pid;
|
||||
int status;
|
||||
|
||||
do
|
||||
pid = waitpid (-1, &status, WNOHANG | WUNTRACED);
|
||||
while (pid < 0 && errno == EINTR);
|
||||
|
||||
/* PID == 0 means no processes found, PID == -1 means a real failure.
|
||||
Either way, we have done all our job. */
|
||||
if (pid <= 0)
|
||||
break;
|
||||
|
||||
record_child_status_change (pid, status);
|
||||
}
|
||||
while (CAN_HANDLE_MULTIPLE_CHILDREN);
|
||||
}
|
||||
|
||||
static void
|
||||
deliver_child_signal (int sig)
|
||||
{
|
||||
handle_on_main_thread (sig, handle_child_signal);
|
||||
deliver_process_signal (sig, handle_child_signal);
|
||||
}
|
||||
|
||||
#endif /* SIGCHLD */
|
||||
|
|
|
@ -1199,9 +1199,9 @@ r_alloc_init (void)
|
|||
#endif
|
||||
|
||||
#ifdef DOUG_LEA_MALLOC
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
mallopt (M_TOP_PAD, 64 * 4096);
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
#else
|
||||
#ifndef SYSTEM_MALLOC
|
||||
/* Give GNU malloc's morecore some hysteresis so that we move all
|
||||
|
|
|
@ -156,7 +156,7 @@ compile_pattern_1 (struct regexp_cache *cp, Lisp_Object pattern, Lisp_Object tra
|
|||
re_set_whitespace_regexp (NULL);
|
||||
|
||||
re_set_syntax (old);
|
||||
/* UNBLOCK_INPUT; */
|
||||
/* unblock_input (); */
|
||||
if (val)
|
||||
xsignal1 (Qinvalid_regexp, build_string (val));
|
||||
|
||||
|
|
417
src/sysdep.c
417
src/sysdep.c
|
@ -279,10 +279,6 @@ init_baud_rate (int fd)
|
|||
|
||||
|
||||
|
||||
/* Set nonzero to make following function work under dbx
|
||||
(at least for bsd). */
|
||||
int wait_debugging EXTERNALLY_VISIBLE;
|
||||
|
||||
#ifndef MSDOS
|
||||
|
||||
static void
|
||||
|
@ -290,48 +286,24 @@ wait_for_termination_1 (pid_t pid, int interruptible)
|
|||
{
|
||||
while (1)
|
||||
{
|
||||
#if (defined (BSD_SYSTEM) || defined (HPUX)) && !defined (__GNU__)
|
||||
/* Note that kill returns -1 even if the process is just a zombie now.
|
||||
But inevitably a SIGCHLD interrupt should be generated
|
||||
and child_sig will do waitpid and make the process go away. */
|
||||
/* There is some indication that there is a bug involved with
|
||||
termination of subprocesses, perhaps involving a kernel bug too,
|
||||
but no idea what it is. Just as a hunch we signal SIGCHLD to see
|
||||
if that causes the problem to go away or get worse. */
|
||||
sigset_t sigchild_mask;
|
||||
sigemptyset (&sigchild_mask);
|
||||
sigaddset (&sigchild_mask, SIGCHLD);
|
||||
pthread_sigmask (SIG_SETMASK, &sigchild_mask, 0);
|
||||
|
||||
if (0 > kill (pid, 0))
|
||||
{
|
||||
pthread_sigmask (SIG_SETMASK, &empty_mask, 0);
|
||||
kill (getpid (), SIGCHLD);
|
||||
break;
|
||||
}
|
||||
if (wait_debugging)
|
||||
sleep (1);
|
||||
else
|
||||
sigsuspend (&empty_mask);
|
||||
#else /* not BSD_SYSTEM, and not HPUX version >= 6 */
|
||||
#ifdef WINDOWSNT
|
||||
wait (0);
|
||||
break;
|
||||
#else /* not WINDOWSNT */
|
||||
sigset_t blocked;
|
||||
sigemptyset (&blocked);
|
||||
sigaddset (&blocked, SIGCHLD);
|
||||
pthread_sigmask (SIG_BLOCK, &blocked, 0);
|
||||
errno = 0;
|
||||
if (kill (pid, 0) == -1 && errno == ESRCH)
|
||||
int status;
|
||||
int wait_result = waitpid (pid, &status, 0);
|
||||
if (wait_result < 0)
|
||||
{
|
||||
pthread_sigmask (SIG_UNBLOCK, &blocked, 0);
|
||||
if (errno != EINTR)
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
record_child_status_change (wait_result, status);
|
||||
break;
|
||||
}
|
||||
|
||||
sigsuspend (&empty_mask);
|
||||
#endif /* not WINDOWSNT */
|
||||
#endif /* not BSD_SYSTEM, and not HPUX version >= 6 */
|
||||
if (interruptible)
|
||||
QUIT;
|
||||
}
|
||||
|
@ -1438,40 +1410,77 @@ init_system_name (void)
|
|||
|
||||
sigset_t empty_mask;
|
||||
|
||||
static struct sigaction process_fatal_action;
|
||||
|
||||
static int
|
||||
emacs_sigaction_flags (void)
|
||||
{
|
||||
#ifdef SA_RESTART
|
||||
/* SA_RESTART causes interruptible functions with timeouts (e.g.,
|
||||
'select') to reset their timeout on some platforms (e.g.,
|
||||
HP-UX 11), which is not what we want. Also, when Emacs is
|
||||
interactive, we don't want SA_RESTART because we need to poll
|
||||
for pending input so we need long-running syscalls to be interrupted
|
||||
after a signal that sets pending_signals.
|
||||
|
||||
Non-interactive keyboard input goes through stdio, where we
|
||||
always want restartable system calls. */
|
||||
if (noninteractive)
|
||||
return SA_RESTART;
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Store into *ACTION a signal action suitable for Emacs, with handler
|
||||
HANDLER. */
|
||||
void
|
||||
emacs_sigaction_init (struct sigaction *action, signal_handler_t handler)
|
||||
{
|
||||
sigemptyset (&action->sa_mask);
|
||||
action->sa_handler = handler;
|
||||
action->sa_flags = 0;
|
||||
#if defined (SA_RESTART)
|
||||
/* SA_RESTART causes interruptible functions with timeouts (e.g.,
|
||||
'select') to reset their timeout on some platforms (e.g.,
|
||||
HP-UX 11), which is not what we want. Also, when Emacs is
|
||||
interactive, we don't want SA_RESTART because we need to poll
|
||||
for pending input so we need long-running syscalls to be interrupted
|
||||
after a signal that sets the interrupt_input_pending flag. */
|
||||
/* Non-interactive keyboard input goes through stdio, where we always
|
||||
want restartable system calls. */
|
||||
if (noninteractive)
|
||||
action->sa_flags = SA_RESTART;
|
||||
|
||||
/* When handling a signal, block nonfatal system signals that are caught
|
||||
by Emacs. This makes race conditions less likely. */
|
||||
sigaddset (&action->sa_mask, SIGALRM);
|
||||
#ifdef SIGCHLD
|
||||
sigaddset (&action->sa_mask, SIGCHLD);
|
||||
#endif
|
||||
#ifdef SIGDANGER
|
||||
sigaddset (&action->sa_mask, SIGDANGER);
|
||||
#endif
|
||||
#ifdef SIGWINCH
|
||||
sigaddset (&action->sa_mask, SIGWINCH);
|
||||
#endif
|
||||
if (! noninteractive)
|
||||
{
|
||||
sigaddset (&action->sa_mask, SIGINT);
|
||||
sigaddset (&action->sa_mask, SIGQUIT);
|
||||
#ifdef USABLE_SIGIO
|
||||
sigaddset (&action->sa_mask, SIGIO);
|
||||
#endif
|
||||
}
|
||||
|
||||
if (! IEEE_FLOATING_POINT)
|
||||
sigaddset (&action->sa_mask, SIGFPE);
|
||||
|
||||
action->sa_handler = handler;
|
||||
action->sa_flags = emacs_sigaction_flags ();
|
||||
}
|
||||
|
||||
#ifdef FORWARD_SIGNAL_TO_MAIN_THREAD
|
||||
static pthread_t main_thread;
|
||||
#endif
|
||||
|
||||
/* If we are on the main thread, handle the signal SIG with HANDLER.
|
||||
/* SIG has arrived at the current process. Deliver it to the main
|
||||
thread, which should handle it with HANDLER.
|
||||
|
||||
If we are on the main thread, handle the signal SIG with HANDLER.
|
||||
Otherwise, redirect the signal to the main thread, blocking it from
|
||||
this thread. POSIX says any thread can receive a signal that is
|
||||
associated with a process, process group, or asynchronous event.
|
||||
On GNU/Linux that is not true, but for other systems (FreeBSD at
|
||||
least) it is. */
|
||||
void
|
||||
handle_on_main_thread (int sig, signal_handler_t handler)
|
||||
deliver_process_signal (int sig, signal_handler_t handler)
|
||||
{
|
||||
/* Preserve errno, to avoid race conditions with signal handlers that
|
||||
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)
|
|||
|
||||
errno = old_errno;
|
||||
}
|
||||
|
||||
/* Static location to save a fatal backtrace in a thread.
|
||||
FIXME: If two subsidiary threads fail simultaneously, the resulting
|
||||
backtrace may be garbage. */
|
||||
enum { BACKTRACE_LIMIT_MAX = 500 };
|
||||
static void *thread_backtrace_buffer[BACKTRACE_LIMIT_MAX + 1];
|
||||
static int thread_backtrace_npointers;
|
||||
|
||||
/* SIG has arrived at the current thread.
|
||||
If we are on the main thread, handle the signal SIG with HANDLER.
|
||||
Otherwise, this is a fatal error in the handling thread. */
|
||||
static void
|
||||
deliver_thread_signal (int sig, signal_handler_t handler)
|
||||
{
|
||||
int old_errno = errno;
|
||||
|
||||
#ifdef FORWARD_SIGNAL_TO_MAIN_THREAD
|
||||
if (! pthread_equal (pthread_self (), main_thread))
|
||||
{
|
||||
thread_backtrace_npointers
|
||||
= backtrace (thread_backtrace_buffer, BACKTRACE_LIMIT_MAX);
|
||||
sigaction (sig, &process_fatal_action, 0);
|
||||
pthread_kill (main_thread, sig);
|
||||
|
||||
/* Avoid further damage while the main thread is exiting. */
|
||||
while (1)
|
||||
sigsuspend (&empty_mask);
|
||||
}
|
||||
#endif
|
||||
|
||||
handler (sig);
|
||||
errno = old_errno;
|
||||
}
|
||||
|
||||
#if !defined HAVE_STRSIGNAL && !HAVE_DECL_SYS_SIGLIST
|
||||
static char *my_sys_siglist[NSIG];
|
||||
|
@ -1503,9 +1545,60 @@ static char *my_sys_siglist[NSIG];
|
|||
# define sys_siglist my_sys_siglist
|
||||
#endif
|
||||
|
||||
void
|
||||
init_signals (void)
|
||||
/* Handle bus errors, invalid instruction, etc. */
|
||||
static void
|
||||
handle_fatal_signal (int sig)
|
||||
{
|
||||
terminate_due_to_signal (sig, 10);
|
||||
}
|
||||
|
||||
static void
|
||||
deliver_fatal_signal (int sig)
|
||||
{
|
||||
deliver_process_signal (sig, handle_fatal_signal);
|
||||
}
|
||||
|
||||
static void
|
||||
deliver_fatal_thread_signal (int sig)
|
||||
{
|
||||
deliver_thread_signal (sig, handle_fatal_signal);
|
||||
}
|
||||
|
||||
static _Noreturn void
|
||||
handle_arith_signal (int sig)
|
||||
{
|
||||
pthread_sigmask (SIG_SETMASK, &empty_mask, 0);
|
||||
xsignal0 (Qarith_error);
|
||||
}
|
||||
|
||||
static void
|
||||
deliver_arith_signal (int sig)
|
||||
{
|
||||
deliver_thread_signal (sig, handle_arith_signal);
|
||||
}
|
||||
|
||||
/* Treat SIG as a terminating signal, unless it is already ignored and
|
||||
we are in --batch mode. Among other things, this makes nohup work. */
|
||||
static void
|
||||
maybe_fatal_sig (int sig)
|
||||
{
|
||||
bool catch_sig = !noninteractive;
|
||||
if (!catch_sig)
|
||||
{
|
||||
struct sigaction old_action;
|
||||
sigaction (sig, 0, &old_action);
|
||||
catch_sig = old_action.sa_handler != SIG_IGN;
|
||||
}
|
||||
if (catch_sig)
|
||||
sigaction (sig, &process_fatal_action, 0);
|
||||
}
|
||||
|
||||
void
|
||||
init_signals (bool dumping)
|
||||
{
|
||||
struct sigaction thread_fatal_action;
|
||||
struct sigaction action;
|
||||
|
||||
sigemptyset (&empty_mask);
|
||||
|
||||
#ifdef FORWARD_SIGNAL_TO_MAIN_THREAD
|
||||
|
@ -1515,9 +1608,7 @@ init_signals (void)
|
|||
#if !defined HAVE_STRSIGNAL && !HAVE_DECL_SYS_SIGLIST
|
||||
if (! initialized)
|
||||
{
|
||||
# ifdef SIGABRT
|
||||
sys_siglist[SIGABRT] = "Aborted";
|
||||
# endif
|
||||
# ifdef SIGAIO
|
||||
sys_siglist[SIGAIO] = "LAN I/O interrupt";
|
||||
# endif
|
||||
|
@ -1545,9 +1636,7 @@ init_signals (void)
|
|||
# ifdef SIGEMT
|
||||
sys_siglist[SIGEMT] = "Emulation trap";
|
||||
# endif
|
||||
# ifdef SIGFPE
|
||||
sys_siglist[SIGFPE] = "Arithmetic exception";
|
||||
# endif
|
||||
# ifdef SIGFREEZE
|
||||
sys_siglist[SIGFREEZE] = "SIGFREEZE";
|
||||
# endif
|
||||
|
@ -1557,12 +1646,8 @@ init_signals (void)
|
|||
# ifdef SIGHUP
|
||||
sys_siglist[SIGHUP] = "Hangup";
|
||||
# endif
|
||||
# ifdef SIGILL
|
||||
sys_siglist[SIGILL] = "Illegal instruction";
|
||||
# endif
|
||||
# ifdef SIGINT
|
||||
sys_siglist[SIGINT] = "Interrupt";
|
||||
# endif
|
||||
# ifdef SIGIO
|
||||
sys_siglist[SIGIO] = "I/O possible";
|
||||
# endif
|
||||
|
@ -1611,9 +1696,7 @@ init_signals (void)
|
|||
# ifdef SIGSAK
|
||||
sys_siglist[SIGSAK] = "Secure attention";
|
||||
# endif
|
||||
# ifdef SIGSEGV
|
||||
sys_siglist[SIGSEGV] = "Segmentation violation";
|
||||
# endif
|
||||
# ifdef SIGSOUND
|
||||
sys_siglist[SIGSOUND] = "Sound completed";
|
||||
# endif
|
||||
|
@ -1626,9 +1709,7 @@ init_signals (void)
|
|||
# ifdef SIGSYS
|
||||
sys_siglist[SIGSYS] = "Bad argument to system call";
|
||||
# endif
|
||||
# ifdef SIGTERM
|
||||
sys_siglist[SIGTERM] = "Terminated";
|
||||
# endif
|
||||
# ifdef SIGTHAW
|
||||
sys_siglist[SIGTHAW] = "SIGTHAW";
|
||||
# endif
|
||||
|
@ -1673,6 +1754,129 @@ init_signals (void)
|
|||
# endif
|
||||
}
|
||||
#endif /* !defined HAVE_STRSIGNAL && !defined HAVE_DECL_SYS_SIGLIST */
|
||||
|
||||
/* Don't alter signal handlers if dumping. On some machines,
|
||||
changing signal handlers sets static data that would make signals
|
||||
fail to work right when the dumped Emacs is run. */
|
||||
if (dumping)
|
||||
return;
|
||||
|
||||
sigfillset (&process_fatal_action.sa_mask);
|
||||
process_fatal_action.sa_handler = deliver_fatal_signal;
|
||||
process_fatal_action.sa_flags = emacs_sigaction_flags () | SA_NODEFER;
|
||||
|
||||
sigfillset (&thread_fatal_action.sa_mask);
|
||||
thread_fatal_action.sa_handler = deliver_fatal_thread_signal;
|
||||
thread_fatal_action.sa_flags = process_fatal_action.sa_flags;
|
||||
|
||||
/* SIGINT may need special treatment on MS-Windows. See
|
||||
http://lists.gnu.org/archive/html/emacs-devel/2010-09/msg01062.html
|
||||
Please update the doc of kill-emacs, kill-emacs-hook, and
|
||||
NEWS if you change this. */
|
||||
|
||||
maybe_fatal_sig (SIGHUP);
|
||||
maybe_fatal_sig (SIGINT);
|
||||
maybe_fatal_sig (SIGTERM);
|
||||
|
||||
/* Emacs checks for write errors, so it can safely ignore SIGPIPE.
|
||||
However, in batch mode leave SIGPIPE alone, as that causes Emacs
|
||||
to behave more like typical batch applications do. */
|
||||
if (! noninteractive)
|
||||
signal (SIGPIPE, SIG_IGN);
|
||||
|
||||
sigaction (SIGQUIT, &process_fatal_action, 0);
|
||||
sigaction (SIGILL, &thread_fatal_action, 0);
|
||||
sigaction (SIGTRAP, &thread_fatal_action, 0);
|
||||
|
||||
/* Typically SIGFPE is thread-specific and is fatal, like SIGILL.
|
||||
But on a non-IEEE host SIGFPE can come from a trap in the Lisp
|
||||
interpreter's floating point operations, so treat SIGFPE as an
|
||||
arith-error if it arises in the main thread. */
|
||||
if (IEEE_FLOATING_POINT)
|
||||
sigaction (SIGFPE, &thread_fatal_action, 0);
|
||||
else
|
||||
{
|
||||
emacs_sigaction_init (&action, deliver_arith_signal);
|
||||
sigaction (SIGFPE, &action, 0);
|
||||
}
|
||||
|
||||
#ifdef SIGUSR1
|
||||
add_user_signal (SIGUSR1, "sigusr1");
|
||||
#endif
|
||||
#ifdef SIGUSR2
|
||||
add_user_signal (SIGUSR2, "sigusr2");
|
||||
#endif
|
||||
sigaction (SIGABRT, &thread_fatal_action, 0);
|
||||
#ifdef SIGPRE
|
||||
sigaction (SIGPRE, &thread_fatal_action, 0);
|
||||
#endif
|
||||
#ifdef SIGORE
|
||||
sigaction (SIGORE, &thread_fatal_action, 0);
|
||||
#endif
|
||||
#ifdef SIGUME
|
||||
sigaction (SIGUME, &thread_fatal_action, 0);
|
||||
#endif
|
||||
#ifdef SIGDLK
|
||||
sigaction (SIGDLK, &process_fatal_action, 0);
|
||||
#endif
|
||||
#ifdef SIGCPULIM
|
||||
sigaction (SIGCPULIM, &process_fatal_action, 0);
|
||||
#endif
|
||||
#ifdef SIGIOT
|
||||
sigaction (SIGIOT, &thread_fatal_action, 0);
|
||||
#endif
|
||||
#ifdef SIGEMT
|
||||
sigaction (SIGEMT, &thread_fatal_action, 0);
|
||||
#endif
|
||||
#ifdef SIGBUS
|
||||
sigaction (SIGBUS, &thread_fatal_action, 0);
|
||||
#endif
|
||||
sigaction (SIGSEGV, &thread_fatal_action, 0);
|
||||
#ifdef SIGSYS
|
||||
sigaction (SIGSYS, &thread_fatal_action, 0);
|
||||
#endif
|
||||
sigaction (SIGTERM, &process_fatal_action, 0);
|
||||
#ifdef SIGPROF
|
||||
sigaction (SIGPROF, &process_fatal_action, 0);
|
||||
#endif
|
||||
#ifdef SIGVTALRM
|
||||
sigaction (SIGVTALRM, &process_fatal_action, 0);
|
||||
#endif
|
||||
#ifdef SIGXCPU
|
||||
sigaction (SIGXCPU, &process_fatal_action, 0);
|
||||
#endif
|
||||
#ifdef SIGXFSZ
|
||||
sigaction (SIGXFSZ, &process_fatal_action, 0);
|
||||
#endif
|
||||
|
||||
#ifdef SIGDANGER
|
||||
/* This just means available memory is getting low. */
|
||||
emacs_sigaction_init (&action, deliver_danger_signal);
|
||||
sigaction (SIGDANGER, &action, 0);
|
||||
#endif
|
||||
|
||||
/* AIX-specific signals. */
|
||||
#ifdef SIGGRANT
|
||||
sigaction (SIGGRANT, &process_fatal_action, 0);
|
||||
#endif
|
||||
#ifdef SIGMIGRATE
|
||||
sigaction (SIGMIGRATE, &process_fatal_action, 0);
|
||||
#endif
|
||||
#ifdef SIGMSG
|
||||
sigaction (SIGMSG, &process_fatal_action, 0);
|
||||
#endif
|
||||
#ifdef SIGRETRACT
|
||||
sigaction (SIGRETRACT, &process_fatal_action, 0);
|
||||
#endif
|
||||
#ifdef SIGSAK
|
||||
sigaction (SIGSAK, &process_fatal_action, 0);
|
||||
#endif
|
||||
#ifdef SIGSOUND
|
||||
sigaction (SIGSOUND, &process_fatal_action, 0);
|
||||
#endif
|
||||
#ifdef SIGTALRM
|
||||
sigaction (SIGTALRM, &thread_fatal_action, 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifndef HAVE_RANDOM
|
||||
|
@ -1811,23 +2015,37 @@ snprintf (char *buf, size_t bufsize, char const *format, ...)
|
|||
void
|
||||
emacs_backtrace (int backtrace_limit)
|
||||
{
|
||||
enum { BACKTRACE_LIMIT_MAX = 500 };
|
||||
void *buffer[BACKTRACE_LIMIT_MAX + 1];
|
||||
void *main_backtrace_buffer[BACKTRACE_LIMIT_MAX + 1];
|
||||
int bounded_limit = min (backtrace_limit, BACKTRACE_LIMIT_MAX);
|
||||
int npointers = backtrace (buffer, bounded_limit + 1);
|
||||
void *buffer;
|
||||
int npointers;
|
||||
|
||||
if (thread_backtrace_npointers)
|
||||
{
|
||||
buffer = thread_backtrace_buffer;
|
||||
npointers = thread_backtrace_npointers;
|
||||
}
|
||||
else
|
||||
{
|
||||
buffer = main_backtrace_buffer;
|
||||
npointers = backtrace (buffer, bounded_limit + 1);
|
||||
}
|
||||
|
||||
if (npointers)
|
||||
ignore_value (write (STDERR_FILENO, "\nBacktrace:\n", 12));
|
||||
backtrace_symbols_fd (buffer, bounded_limit, STDERR_FILENO);
|
||||
if (bounded_limit < npointers)
|
||||
ignore_value (write (STDERR_FILENO, "...\n", 4));
|
||||
{
|
||||
ignore_value (write (STDERR_FILENO, "\nBacktrace:\n", 12));
|
||||
backtrace_symbols_fd (buffer, npointers, STDERR_FILENO);
|
||||
if (bounded_limit < npointers)
|
||||
ignore_value (write (STDERR_FILENO, "...\n", 4));
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef HAVE_NTGUI
|
||||
/* Using emacs_abort lets GDB return from a breakpoint here. */
|
||||
void
|
||||
emacs_abort (void)
|
||||
{
|
||||
fatal_error_backtrace (SIGABRT, 10);
|
||||
signal (SIGABRT, SIG_DFL);
|
||||
terminate_due_to_signal (SIGABRT, 10);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -1910,7 +2128,8 @@ emacs_write (int fildes, const char *buf, ptrdiff_t nbyte)
|
|||
{
|
||||
/* I originally used `QUIT' but that might causes files to
|
||||
be truncated if you hit C-g in the middle of it. --Stef */
|
||||
process_pending_signals ();
|
||||
if (pending_signals)
|
||||
process_pending_signals ();
|
||||
continue;
|
||||
}
|
||||
else
|
||||
|
@ -1975,11 +2194,11 @@ getwd (char *pathname)
|
|||
char *npath, *spath;
|
||||
extern char *getcwd (char *, size_t);
|
||||
|
||||
BLOCK_INPUT; /* getcwd uses malloc */
|
||||
block_input (); /* getcwd uses malloc */
|
||||
spath = npath = getcwd ((char *) 0, MAXPATHLEN);
|
||||
if (spath == 0)
|
||||
{
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
return spath;
|
||||
}
|
||||
/* On Altos 3068, getcwd can return @hostname/dir, so discard
|
||||
|
@ -1988,7 +2207,7 @@ getwd (char *pathname)
|
|||
npath++;
|
||||
strcpy (pathname, npath);
|
||||
free (spath); /* getcwd uses malloc */
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
return pathname;
|
||||
}
|
||||
|
||||
|
@ -2422,7 +2641,7 @@ get_up_time (void)
|
|||
FILE *fup;
|
||||
EMACS_TIME up = make_emacs_time (0, 0);
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
fup = fopen ("/proc/uptime", "r");
|
||||
|
||||
if (fup)
|
||||
|
@ -2453,7 +2672,7 @@ get_up_time (void)
|
|||
}
|
||||
fclose (fup);
|
||||
}
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
|
||||
return up;
|
||||
}
|
||||
|
@ -2467,7 +2686,7 @@ procfs_ttyname (int rdev)
|
|||
FILE *fdev = NULL;
|
||||
char name[PATH_MAX];
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
fdev = fopen ("/proc/tty/drivers", "r");
|
||||
|
||||
if (fdev)
|
||||
|
@ -2499,7 +2718,7 @@ procfs_ttyname (int rdev)
|
|||
}
|
||||
fclose (fdev);
|
||||
}
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
return build_string (name);
|
||||
}
|
||||
|
||||
|
@ -2509,7 +2728,7 @@ procfs_get_total_memory (void)
|
|||
FILE *fmem = NULL;
|
||||
unsigned long retval = 2 * 1024 * 1024; /* default: 2GB */
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
fmem = fopen ("/proc/meminfo", "r");
|
||||
|
||||
if (fmem)
|
||||
|
@ -2528,7 +2747,7 @@ procfs_get_total_memory (void)
|
|||
}
|
||||
fclose (fmem);
|
||||
}
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
@ -2574,17 +2793,17 @@ system_process_attributes (Lisp_Object pid)
|
|||
/* euid egid */
|
||||
uid = st.st_uid;
|
||||
attrs = Fcons (Fcons (Qeuid, make_fixnum_or_float (uid)), attrs);
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
pw = getpwuid (uid);
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
if (pw)
|
||||
attrs = Fcons (Fcons (Quser, build_string (pw->pw_name)), attrs);
|
||||
|
||||
gid = st.st_gid;
|
||||
attrs = Fcons (Fcons (Qegid, make_fixnum_or_float (gid)), attrs);
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
gr = getgrgid (gid);
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
if (gr)
|
||||
attrs = Fcons (Fcons (Qgroup, build_string (gr->gr_name)), attrs);
|
||||
|
||||
|
@ -2812,17 +3031,17 @@ system_process_attributes (Lisp_Object pid)
|
|||
/* euid egid */
|
||||
uid = st.st_uid;
|
||||
attrs = Fcons (Fcons (Qeuid, make_fixnum_or_float (uid)), attrs);
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
pw = getpwuid (uid);
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
if (pw)
|
||||
attrs = Fcons (Fcons (Quser, build_string (pw->pw_name)), attrs);
|
||||
|
||||
gid = st.st_gid;
|
||||
attrs = Fcons (Fcons (Qegid, make_fixnum_or_float (gid)), attrs);
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
gr = getgrgid (gid);
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
if (gr)
|
||||
attrs = Fcons (Fcons (Qgroup, build_string (gr->gr_name)), attrs);
|
||||
|
||||
|
@ -2943,17 +3162,17 @@ system_process_attributes (Lisp_Object pid)
|
|||
|
||||
attrs = Fcons (Fcons (Qeuid, make_fixnum_or_float (proc.ki_uid)), attrs);
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
pw = getpwuid (proc.ki_uid);
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
if (pw)
|
||||
attrs = Fcons (Fcons (Quser, build_string (pw->pw_name)), attrs);
|
||||
|
||||
attrs = Fcons (Fcons (Qegid, make_fixnum_or_float (proc.ki_svgid)), attrs);
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
gr = getgrgid (proc.ki_svgid);
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
if (gr)
|
||||
attrs = Fcons (Fcons (Qgroup, build_string (gr->gr_name)), attrs);
|
||||
|
||||
|
@ -2993,9 +3212,9 @@ system_process_attributes (Lisp_Object pid)
|
|||
attrs = Fcons (Fcons (Qpgrp, make_fixnum_or_float (proc.ki_pgid)), attrs);
|
||||
attrs = Fcons (Fcons (Qsess, make_fixnum_or_float (proc.ki_sid)), attrs);
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
ttyname = proc.ki_tdev == NODEV ? NULL : devname (proc.ki_tdev, S_IFCHR);
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
if (ttyname)
|
||||
attrs = Fcons (Fcons (Qtty, build_string (ttyname)), attrs);
|
||||
|
||||
|
|
|
@ -18,8 +18,9 @@ You should have received a copy of the GNU General Public License
|
|||
along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#include <signal.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
extern void init_signals (void);
|
||||
extern void init_signals (bool);
|
||||
|
||||
#ifdef HAVE_PTHREAD
|
||||
#include <pthread.h>
|
||||
|
@ -39,6 +40,10 @@ extern void emacs_sigaction_init (struct sigaction *, signal_handler_t);
|
|||
# define NSIG NSIG_MINIMUM
|
||||
#endif
|
||||
|
||||
#ifndef emacs_raise
|
||||
# define emacs_raise(sig) raise (sig)
|
||||
#endif
|
||||
|
||||
/* On bsd, [man says] kill does not accept a negative number to kill a pgrp.
|
||||
Must do that using the killpg call. */
|
||||
#ifdef BSD_SYSTEM
|
||||
|
@ -64,4 +69,4 @@ extern void emacs_sigaction_init (struct sigaction *, signal_handler_t);
|
|||
char *strsignal (int);
|
||||
#endif
|
||||
|
||||
void handle_on_main_thread (int, signal_handler_t);
|
||||
void deliver_process_signal (int, signal_handler_t);
|
||||
|
|
12
src/term.c
12
src/term.c
|
@ -753,13 +753,13 @@ tty_write_glyphs (struct frame *f, struct glyph *string, int len)
|
|||
conversion_buffer = encode_terminal_code (string, n, coding);
|
||||
if (coding->produced > 0)
|
||||
{
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
fwrite (conversion_buffer, 1, coding->produced, tty->output);
|
||||
if (ferror (tty->output))
|
||||
clearerr (tty->output);
|
||||
if (tty->termscript)
|
||||
fwrite (conversion_buffer, 1, coding->produced, tty->termscript);
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
}
|
||||
string += n;
|
||||
|
||||
|
@ -814,13 +814,13 @@ tty_write_glyphs_with_face (register struct frame *f, register struct glyph *str
|
|||
conversion_buffer = encode_terminal_code (string, len, coding);
|
||||
if (coding->produced > 0)
|
||||
{
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
fwrite (conversion_buffer, 1, coding->produced, tty->output);
|
||||
if (ferror (tty->output))
|
||||
clearerr (tty->output);
|
||||
if (tty->termscript)
|
||||
fwrite (conversion_buffer, 1, coding->produced, tty->termscript);
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
}
|
||||
|
||||
/* Turn appearance modes off. */
|
||||
|
@ -900,13 +900,13 @@ tty_insert_glyphs (struct frame *f, struct glyph *start, int len)
|
|||
|
||||
if (coding->produced > 0)
|
||||
{
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
fwrite (conversion_buffer, 1, coding->produced, tty->output);
|
||||
if (ferror (tty->output))
|
||||
clearerr (tty->output);
|
||||
if (tty->termscript)
|
||||
fwrite (conversion_buffer, 1, coding->produced, tty->termscript);
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
}
|
||||
|
||||
OUTPUT1_IF (tty, tty->TS_pad_inserted_char);
|
||||
|
|
|
@ -591,8 +591,7 @@ struct terminal
|
|||
/* Called to read input events.
|
||||
|
||||
TERMINAL indicates which terminal device to read from. Input
|
||||
events should be read into BUF, the size of which is given in
|
||||
SIZE.
|
||||
events should be read into HOLD_QUIT.
|
||||
|
||||
A positive return value indicates that that many input events
|
||||
were read into BUF.
|
||||
|
|
|
@ -459,7 +459,7 @@ DEFUN ("w16-set-clipboard-data", Fw16_set_clipboard_data, Sw16_set_clipboard_dat
|
|||
if ( !FRAME_MSDOS_P (XFRAME (frame)))
|
||||
goto done;
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
|
||||
if (!open_clipboard ())
|
||||
goto error;
|
||||
|
@ -520,7 +520,7 @@ DEFUN ("w16-set-clipboard-data", Fw16_set_clipboard_data, Sw16_set_clipboard_dat
|
|||
|
||||
unblock:
|
||||
xfree (dst);
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
|
||||
/* Notify user if the text is too large to fit into DOS memory.
|
||||
(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
|
|||
if ( !FRAME_MSDOS_P (XFRAME (frame)))
|
||||
goto done;
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
|
||||
if (!open_clipboard ())
|
||||
goto unblock;
|
||||
|
@ -626,7 +626,7 @@ DEFUN ("w16-get-clipboard-data", Fw16_get_clipboard_data, Sw16_get_clipboard_dat
|
|||
close_clipboard ();
|
||||
|
||||
unblock:
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
|
||||
done:
|
||||
|
||||
|
|
110
src/w32fns.c
110
src/w32fns.c
|
@ -364,7 +364,7 @@ if the entry is new. */)
|
|||
|
||||
XSETINT (rgb, RGB (XUINT (red), XUINT (green), XUINT (blue)));
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
|
||||
/* replace existing entry in w32-color-map or add new entry. */
|
||||
entry = Fassoc (name, Vw32_color_map);
|
||||
|
@ -379,7 +379,7 @@ if the entry is new. */)
|
|||
Fsetcdr (entry, rgb);
|
||||
}
|
||||
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
|
||||
return (oldrgb);
|
||||
}
|
||||
|
@ -642,7 +642,7 @@ w32_default_color_map (void)
|
|||
colormap_t *pc = w32_color_map;
|
||||
Lisp_Object cmap;
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
|
||||
cmap = Qnil;
|
||||
|
||||
|
@ -652,7 +652,7 @@ w32_default_color_map (void)
|
|||
make_number (pc->colorref)),
|
||||
cmap);
|
||||
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
|
||||
return (cmap);
|
||||
}
|
||||
|
@ -669,7 +669,7 @@ w32_color_map_lookup (char *colorname)
|
|||
{
|
||||
Lisp_Object tail, ret = Qnil;
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
|
||||
for (tail = Vw32_color_map; CONSP (tail); tail = XCDR (tail))
|
||||
{
|
||||
|
@ -689,7 +689,7 @@ w32_color_map_lookup (char *colorname)
|
|||
QUIT;
|
||||
}
|
||||
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -701,7 +701,7 @@ add_system_logical_colors_to_map (Lisp_Object *system_colors)
|
|||
HKEY colors_key;
|
||||
|
||||
/* Other registry operations are done with input blocked. */
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
|
||||
/* Look for "Control Panel/Colors" under User and Machine registry
|
||||
settings. */
|
||||
|
@ -739,7 +739,7 @@ add_system_logical_colors_to_map (Lisp_Object *system_colors)
|
|||
RegCloseKey (colors_key);
|
||||
}
|
||||
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
}
|
||||
|
||||
|
||||
|
@ -748,7 +748,7 @@ x_to_w32_color (char * colorname)
|
|||
{
|
||||
register Lisp_Object ret = Qnil;
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
|
||||
if (colorname[0] == '#')
|
||||
{
|
||||
|
@ -801,7 +801,7 @@ x_to_w32_color (char * colorname)
|
|||
pos += 0x8;
|
||||
if (i == 2)
|
||||
{
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
XSETINT (ret, colorval);
|
||||
return ret;
|
||||
}
|
||||
|
@ -855,7 +855,7 @@ x_to_w32_color (char * colorname)
|
|||
{
|
||||
if (*end != '\0')
|
||||
break;
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
XSETINT (ret, colorval);
|
||||
return ret;
|
||||
}
|
||||
|
@ -897,7 +897,7 @@ x_to_w32_color (char * colorname)
|
|||
{
|
||||
if (*end != '\0')
|
||||
break;
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
XSETINT (ret, colorval);
|
||||
return ret;
|
||||
}
|
||||
|
@ -932,7 +932,7 @@ x_to_w32_color (char * colorname)
|
|||
}
|
||||
}
|
||||
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -1235,7 +1235,7 @@ x_set_mouse_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
|
|||
f->output_data.w32->mouse_pixel = FRAME_FOREGROUND_PIXEL (f);
|
||||
|
||||
#if 0 /* TODO : Mouse cursor customization. */
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
|
||||
/* It's not okay to crash if the user selects a screwy cursor. */
|
||||
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)
|
|||
f->output_data.w32->hand_cursor = hand_cursor;
|
||||
|
||||
XFlush (FRAME_W32_DISPLAY (f));
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
|
||||
update_face_from_frame_parameter (f, Qmouse_color, arg);
|
||||
#endif /* TODO */
|
||||
|
@ -1390,12 +1390,12 @@ x_set_cursor_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
|
|||
|
||||
if (FRAME_W32_WINDOW (f) != 0)
|
||||
{
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
/* Update frame's cursor_gc. */
|
||||
f->output_data.w32->cursor_gc->foreground = fore_pixel;
|
||||
f->output_data.w32->cursor_gc->background = pixel;
|
||||
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
|
||||
if (FRAME_VISIBLE_P (f))
|
||||
{
|
||||
|
@ -1466,16 +1466,16 @@ x_set_icon_type (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
|
|||
if (SYMBOLP (arg) && SYMBOLP (oldval) && EQ (arg, oldval))
|
||||
return;
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
|
||||
result = x_bitmap_icon (f, arg);
|
||||
if (result)
|
||||
{
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
error ("No icon window available");
|
||||
}
|
||||
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1495,7 +1495,7 @@ x_set_icon_name (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
|
|||
if (f->output_data.w32->icon_bitmap != 0)
|
||||
return;
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
|
||||
result = x_text_icon (f,
|
||||
SSDATA ((!NILP (f->icon_name)
|
||||
|
@ -1506,7 +1506,7 @@ x_set_icon_name (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
|
|||
|
||||
if (result)
|
||||
{
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
error ("No icon window available");
|
||||
}
|
||||
|
||||
|
@ -1521,7 +1521,7 @@ x_set_icon_name (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
|
|||
}
|
||||
|
||||
XFlush (FRAME_W32_DISPLAY (f));
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -1623,13 +1623,13 @@ x_set_tool_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval)
|
|||
int width = FRAME_PIXEL_WIDTH (f);
|
||||
int y = nlines * FRAME_LINE_HEIGHT (f);
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
{
|
||||
HDC hdc = get_frame_dc (f);
|
||||
w32_clear_area (f, hdc, 0, y, width, height);
|
||||
release_frame_dc (f, hdc);
|
||||
}
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
|
||||
if (WINDOWP (f->tool_bar_window))
|
||||
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)
|
|||
if (STRING_MULTIBYTE (name))
|
||||
name = ENCODE_SYSTEM (name);
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
SetWindowText (FRAME_W32_WINDOW (f), SDATA (name));
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1743,9 +1743,9 @@ x_set_title (struct frame *f, Lisp_Object name, Lisp_Object old_name)
|
|||
if (STRING_MULTIBYTE (name))
|
||||
name = ENCODE_SYSTEM (name);
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
SetWindowText (FRAME_W32_WINDOW (f), SDATA (name));
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3896,7 +3896,7 @@ my_create_tip_window (struct frame *f)
|
|||
static void
|
||||
w32_window (struct frame *f, long window_prompting, int minibuffer_only)
|
||||
{
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
|
||||
/* Use the resource name as the top-level window name
|
||||
for looking up resources. Make a non-Lisp copy
|
||||
|
@ -3928,7 +3928,7 @@ w32_window (struct frame *f, long window_prompting, int minibuffer_only)
|
|||
x_set_name (f, name, explicit);
|
||||
}
|
||||
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
|
||||
if (!minibuffer_only && FRAME_EXTERNAL_MENU_BAR (f))
|
||||
initialize_frame_menubar (f);
|
||||
|
@ -3959,7 +3959,7 @@ x_icon (struct frame *f, Lisp_Object parms)
|
|||
else if (!EQ (icon_x, Qunbound) || !EQ (icon_y, Qunbound))
|
||||
error ("Both left and top icon corners of icon must be specified");
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
|
||||
if (! EQ (icon_x, Qunbound))
|
||||
x_wm_set_icon_position (f, XINT (icon_x), XINT (icon_y));
|
||||
|
@ -3976,7 +3976,7 @@ x_icon (struct frame *f, Lisp_Object parms)
|
|||
: f->name)));
|
||||
#endif
|
||||
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
}
|
||||
|
||||
|
||||
|
@ -3985,7 +3985,7 @@ x_make_gc (struct frame *f)
|
|||
{
|
||||
XGCValues gc_values;
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
|
||||
/* Create the GC's of this frame.
|
||||
Note that many default values are used. */
|
||||
|
@ -4005,7 +4005,7 @@ x_make_gc (struct frame *f)
|
|||
f->output_data.w32->white_relief.gc = 0;
|
||||
f->output_data.w32->black_relief.gc = 0;
|
||||
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
}
|
||||
|
||||
|
||||
|
@ -4351,9 +4351,9 @@ This function is an internal primitive--use `make-frame' instead. */)
|
|||
/* Tell the server what size and position, etc, we want, and how
|
||||
badly we want them. This should be done after we have the menu
|
||||
bar so that its size can be taken into account. */
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
x_wm_set_size_hint (f, window_prompting, 0);
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
|
||||
/* Make the window appear on the frame and enable display, unless
|
||||
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. */)
|
|||
if (dpyinfo->reference_count > 0)
|
||||
error ("Display still has frames on it");
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
x_destroy_all_bitmaps (dpyinfo);
|
||||
|
||||
x_delete_display (dpyinfo);
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
|
||||
return Qnil;
|
||||
}
|
||||
|
@ -4935,7 +4935,7 @@ FRAME. Default is to change on the edit X window. */)
|
|||
CHECK_STRING (prop);
|
||||
CHECK_STRING (value);
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
prop_atom = XInternAtom (FRAME_W32_DISPLAY (f), SDATA (prop), False);
|
||||
XChangeProperty (FRAME_W32_DISPLAY (f), FRAME_W32_WINDOW (f),
|
||||
prop_atom, XA_STRING, 8, PropModeReplace,
|
||||
|
@ -4943,7 +4943,7 @@ FRAME. Default is to change on the edit X window. */)
|
|||
|
||||
/* Make sure the property is set when we return. */
|
||||
XFlush (FRAME_W32_DISPLAY (f));
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
|
||||
return value;
|
||||
}
|
||||
|
@ -4959,13 +4959,13 @@ FRAME nil or omitted means use the selected frame. Value is PROP. */)
|
|||
Atom prop_atom;
|
||||
|
||||
CHECK_STRING (prop);
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
prop_atom = XInternAtom (FRAME_W32_DISPLAY (f), SDATA (prop), False);
|
||||
XDeleteProperty (FRAME_W32_DISPLAY (f), FRAME_W32_WINDOW (f), prop_atom);
|
||||
|
||||
/* Make sure the property is removed when we return. */
|
||||
XFlush (FRAME_W32_DISPLAY (f));
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
|
||||
return prop;
|
||||
}
|
||||
|
@ -5001,7 +5001,7 @@ no value of TYPE (always string in the MS Windows case). */)
|
|||
unsigned long actual_size, bytes_remaining;
|
||||
|
||||
CHECK_STRING (prop);
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
prop_atom = XInternAtom (FRAME_W32_DISPLAY (f), SDATA (prop), False);
|
||||
rc = XGetWindowProperty (FRAME_W32_DISPLAY (f), FRAME_W32_WINDOW (f),
|
||||
prop_atom, 0, 0, False, XA_STRING,
|
||||
|
@ -5026,7 +5026,7 @@ no value of TYPE (always string in the MS Windows case). */)
|
|||
XFree (tmp_data);
|
||||
}
|
||||
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
|
||||
return prop_value;
|
||||
|
||||
|
@ -5349,9 +5349,9 @@ x_create_tip_frame (struct w32_display_info *dpyinfo,
|
|||
f->left_fringe_width = 0;
|
||||
f->right_fringe_width = 0;
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
my_create_tip_window (f);
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
|
||||
x_make_gc (f);
|
||||
|
||||
|
@ -5457,11 +5457,11 @@ compute_tip_xy (struct frame *f,
|
|||
max_x = x_display_pixel_width (FRAME_W32_DISPLAY_INFO (f));
|
||||
max_y = x_display_pixel_height (FRAME_W32_DISPLAY_INFO (f));
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
GetCursorPos (&pt);
|
||||
*root_x = pt.x;
|
||||
*root_y = pt.y;
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
|
||||
/* If multiple monitor support is available, constrain the tip onto
|
||||
the current monitor. This improves the above by allowing negative
|
||||
|
@ -5596,7 +5596,7 @@ Text larger than the specified size is clipped. */)
|
|||
call1 (Qcancel_timer, timer);
|
||||
}
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
compute_tip_xy (f, parms, dx, dy, FRAME_PIXEL_WIDTH (f),
|
||||
FRAME_PIXEL_HEIGHT (f), &root_x, &root_y);
|
||||
|
||||
|
@ -5610,7 +5610,7 @@ Text larger than the specified size is clipped. */)
|
|||
0, 0, 0, 0,
|
||||
SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
|
||||
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
goto start_timer;
|
||||
}
|
||||
}
|
||||
|
@ -5637,7 +5637,7 @@ Text larger than the specified size is clipped. */)
|
|||
|
||||
/* Block input until the tip has been fully drawn, to avoid crashes
|
||||
when drawing tips in menus. */
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
|
||||
/* Create a frame for the tooltip, and record it in the global
|
||||
variable tip_frame. */
|
||||
|
@ -5809,7 +5809,7 @@ Text larger than the specified size is clipped. */)
|
|||
w->must_be_updated_p = 1;
|
||||
update_single_window (w, 1);
|
||||
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
|
||||
/* Restore original current buffer. */
|
||||
set_buffer_internal_1 (old_buffer);
|
||||
|
@ -6002,7 +6002,7 @@ Otherwise, if ONLY-DIR-P is non-nil, the user can only select directories. */)
|
|||
|
||||
/* Prevent redisplay. */
|
||||
specbind (Qinhibit_redisplay, Qt);
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
|
||||
memset (&new_file_details, 0, sizeof (new_file_details));
|
||||
/* 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. */)
|
|||
|
||||
file_opened = GetOpenFileName (file_details);
|
||||
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
|
||||
if (file_opened)
|
||||
{
|
||||
|
|
|
@ -567,7 +567,7 @@ w32_console_mouse_position (FRAME_PTR *f,
|
|||
Lisp_Object *y,
|
||||
Time *time)
|
||||
{
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
|
||||
insist = insist;
|
||||
|
||||
|
@ -580,7 +580,7 @@ w32_console_mouse_position (FRAME_PTR *f,
|
|||
XSETINT (*y, movement_pos.Y);
|
||||
*time = movement_time;
|
||||
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
}
|
||||
|
||||
/* Remember mouse motion and notify emacs. */
|
||||
|
@ -749,14 +749,7 @@ w32_console_read_socket (struct terminal *terminal,
|
|||
int nev, add;
|
||||
int isdead;
|
||||
|
||||
if (interrupt_input_blocked)
|
||||
{
|
||||
interrupt_input_pending = 1;
|
||||
return -1;
|
||||
}
|
||||
|
||||
interrupt_input_pending = 0;
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
|
||||
for (;;)
|
||||
{
|
||||
|
@ -818,6 +811,6 @@ w32_console_read_socket (struct terminal *terminal,
|
|||
if (!w32_use_full_screen_buffer)
|
||||
maybe_generate_resize_event ();
|
||||
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
return nev;
|
||||
}
|
||||
|
|
|
@ -221,9 +221,9 @@ otherwise it is "Question". */)
|
|||
list_of_panes (Fcons (contents, Qnil));
|
||||
|
||||
/* Display them in a dialog box. */
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
selection = w32_dialog_show (f, 0, title, header, &error_name);
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
|
||||
discard_menu_items ();
|
||||
FRAME_X_DISPLAY_INFO (f)->grabbed = 0;
|
||||
|
@ -571,7 +571,7 @@ set_frame_menubar (FRAME_PTR f, int first_time, int deep_p)
|
|||
|
||||
/* Create or update the menu bar widget. */
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
|
||||
if (menubar_widget)
|
||||
{
|
||||
|
@ -601,7 +601,7 @@ set_frame_menubar (FRAME_PTR f, int first_time, int deep_p)
|
|||
x_set_window_size (f, 0, FRAME_COLS (f), FRAME_LINES (f));
|
||||
}
|
||||
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
}
|
||||
|
||||
/* Called from Fx_create_frame to create the initial menubar of a frame
|
||||
|
@ -624,7 +624,7 @@ initialize_frame_menubar (FRAME_PTR f)
|
|||
void
|
||||
free_frame_menubar (FRAME_PTR f)
|
||||
{
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
|
||||
{
|
||||
HMENU old = GetMenu (FRAME_W32_WINDOW (f));
|
||||
|
@ -633,7 +633,7 @@ free_frame_menubar (FRAME_PTR f)
|
|||
DestroyMenu (old);
|
||||
}
|
||||
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -84,7 +84,7 @@ w32_get_string_resource (char *name, char *class, DWORD dwexptype)
|
|||
|
||||
trykey:
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
|
||||
/* Check both the current user and the local machine to see if we have
|
||||
any resources */
|
||||
|
@ -115,7 +115,7 @@ w32_get_string_resource (char *name, char *class, DWORD dwexptype)
|
|||
RegCloseKey (hrootkey);
|
||||
}
|
||||
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
|
||||
if (!ok)
|
||||
{
|
||||
|
|
|
@ -391,7 +391,7 @@ run_protected (Lisp_Object (*code) (Lisp_Object), Lisp_Object arg)
|
|||
extern int waiting_for_input; /* from keyboard.c */
|
||||
int owfi;
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
|
||||
/* Fsignal calls emacs_abort () if it sees that waiting_for_input is
|
||||
set. */
|
||||
|
@ -402,7 +402,7 @@ run_protected (Lisp_Object (*code) (Lisp_Object), Lisp_Object arg)
|
|||
|
||||
waiting_for_input = owfi;
|
||||
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
}
|
||||
|
||||
static Lisp_Object
|
||||
|
@ -694,7 +694,7 @@ DEFUN ("w32-set-clipboard-data", Fw32_set_clipboard_data,
|
|||
current_num_nls = 0;
|
||||
current_requires_encoding = 0;
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
|
||||
/* Check for non-ASCII characters. While we are at it, count the
|
||||
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,
|
|||
current_coding_system = Qnil;
|
||||
|
||||
done:
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
|
||||
return (ok ? string : Qnil);
|
||||
}
|
||||
|
@ -810,7 +810,7 @@ DEFUN ("w32-get-clipboard-data", Fw32_get_clipboard_data,
|
|||
setup_config ();
|
||||
actual_clipboard_type = cfg_clipboard_type;
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
|
||||
if (!OpenClipboard (clipboard_owner))
|
||||
goto done;
|
||||
|
@ -1000,7 +1000,7 @@ DEFUN ("w32-get-clipboard-data", Fw32_get_clipboard_data,
|
|||
CloseClipboard ();
|
||||
|
||||
done:
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
|
||||
return (ret);
|
||||
}
|
||||
|
|
123
src/w32term.c
123
src/w32term.c
|
@ -563,7 +563,7 @@ x_update_window_begin (struct window *w)
|
|||
updated_window = w;
|
||||
set_output_cursor (&w->cursor);
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
|
||||
if (f == hlinfo->mouse_face_mouse_frame)
|
||||
{
|
||||
|
@ -602,7 +602,7 @@ x_update_window_begin (struct window *w)
|
|||
#endif /* 0 */
|
||||
}
|
||||
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
}
|
||||
|
||||
/* 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,
|
|||
|
||||
if (!w->pseudo_window_p)
|
||||
{
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
|
||||
if (cursor_on_p)
|
||||
display_and_set_cursor (w, 1, output_cursor.hpos,
|
||||
|
@ -662,7 +662,7 @@ x_update_window_end (struct window *w, int cursor_on_p,
|
|||
if (draw_window_fringes (w, 1))
|
||||
x_draw_vertical_border (w);
|
||||
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
}
|
||||
|
||||
/* If a row with mouse-face was overwritten, arrange for
|
||||
|
@ -714,13 +714,13 @@ w32_frame_up_to_date (struct frame *f)
|
|||
if (hlinfo->mouse_face_deferred_gc
|
||||
|| f == hlinfo->mouse_face_mouse_frame)
|
||||
{
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
if (hlinfo->mouse_face_mouse_frame)
|
||||
note_mouse_highlight (hlinfo->mouse_face_mouse_frame,
|
||||
hlinfo->mouse_face_mouse_x,
|
||||
hlinfo->mouse_face_mouse_y);
|
||||
hlinfo->mouse_face_deferred_gc = 0;
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -761,7 +761,7 @@ x_after_update_window_line (struct glyph_row *desired_row)
|
|||
{
|
||||
int y = WINDOW_TO_FRAME_PIXEL_Y (w, max (0, desired_row->y));
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
{
|
||||
HDC hdc = get_frame_dc (f);
|
||||
w32_clear_area (f, hdc, 0, y, width, height);
|
||||
|
@ -769,7 +769,7 @@ x_after_update_window_line (struct glyph_row *desired_row)
|
|||
y, width, height);
|
||||
release_frame_dc (f, hdc);
|
||||
}
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2646,7 +2646,7 @@ x_clear_frame (struct frame *f)
|
|||
|
||||
/* We don't set the output cursor here because there will always
|
||||
follow an explicit cursor_to. */
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
|
||||
w32_clear_window (f);
|
||||
|
||||
|
@ -2654,7 +2654,7 @@ x_clear_frame (struct frame *f)
|
|||
colors or something like that, then they should be notified. */
|
||||
x_scroll_bar_clear (f);
|
||||
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
}
|
||||
|
||||
|
||||
|
@ -2663,7 +2663,7 @@ x_clear_frame (struct frame *f)
|
|||
static void
|
||||
w32_ring_bell (struct frame *f)
|
||||
{
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
|
||||
if (FRAME_W32_P (f) && visible_bell)
|
||||
{
|
||||
|
@ -2680,7 +2680,7 @@ w32_ring_bell (struct frame *f)
|
|||
else
|
||||
w32_sys_ring_bell (f);
|
||||
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
}
|
||||
|
||||
|
||||
|
@ -2779,7 +2779,7 @@ x_scroll_run (struct window *w, struct run *run)
|
|||
expect_dirty = CreateRectRgn (x, y, x + width, to_y);
|
||||
}
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
|
||||
/* Cursor off. Will be switched on again in x_update_window_end. */
|
||||
updated_window = w;
|
||||
|
@ -2813,7 +2813,7 @@ x_scroll_run (struct window *w, struct run *run)
|
|||
DeleteObject (combined);
|
||||
}
|
||||
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
DeleteObject (expect_dirty);
|
||||
}
|
||||
|
||||
|
@ -2998,9 +2998,9 @@ x_get_keysym_name (int keysym)
|
|||
/* Make static so we can always return it */
|
||||
static char value[100];
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
GetKeyNameText (keysym, value, 100);
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
|
||||
return value;
|
||||
}
|
||||
|
@ -3308,7 +3308,7 @@ w32_mouse_position (FRAME_PTR *fp, int insist, Lisp_Object *bar_window,
|
|||
{
|
||||
FRAME_PTR f1;
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
|
||||
if (! NILP (last_mouse_scroll_bar) && insist == 0)
|
||||
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,
|
|||
}
|
||||
}
|
||||
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
}
|
||||
|
||||
|
||||
|
@ -3480,12 +3480,12 @@ w32_set_scroll_bar_thumb (struct scroll_bar *bar,
|
|||
if (draggingp)
|
||||
{
|
||||
int near_bottom_p;
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
si.cbSize = sizeof (si);
|
||||
si.fMask = SIF_POS | SIF_PAGE;
|
||||
GetScrollInfo (w, SB_CTL, &si);
|
||||
near_bottom_p = si.nPos + si.nPage >= range;
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
if (!near_bottom_p)
|
||||
return;
|
||||
}
|
||||
|
@ -3514,7 +3514,7 @@ w32_set_scroll_bar_thumb (struct scroll_bar *bar,
|
|||
|
||||
sb_page = max (sb_page, VERTICAL_SCROLL_BAR_MIN_HANDLE);
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
|
||||
si.cbSize = sizeof (si);
|
||||
si.fMask = SIF_PAGE | SIF_POS;
|
||||
|
@ -3523,7 +3523,7 @@ w32_set_scroll_bar_thumb (struct scroll_bar *bar,
|
|||
|
||||
SetScrollInfo (w, SB_CTL, &si, TRUE);
|
||||
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
}
|
||||
|
||||
|
||||
|
@ -3614,7 +3614,7 @@ x_scroll_bar_create (struct window *w, int top, int left, int width, int height)
|
|||
= XSCROLL_BAR (Fmake_vector (make_number (SCROLL_BAR_VEC_SIZE), Qnil));
|
||||
Lisp_Object barobj;
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
|
||||
XSETWINDOW (bar->window, w);
|
||||
XSETINT (bar->top, top);
|
||||
|
@ -3650,7 +3650,7 @@ x_scroll_bar_create (struct window *w, int top, int left, int width, int height)
|
|||
if (! NILP (bar->next))
|
||||
XSETVECTOR (XSCROLL_BAR (bar->next)->prev, bar);
|
||||
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
|
||||
return bar;
|
||||
}
|
||||
|
@ -3664,7 +3664,7 @@ x_scroll_bar_remove (struct scroll_bar *bar)
|
|||
{
|
||||
FRAME_PTR f = XFRAME (WINDOW_FRAME (XWINDOW (bar->window)));
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
|
||||
/* Destroy the window. */
|
||||
my_destroy_window (f, SCROLL_BAR_W32_WINDOW (bar));
|
||||
|
@ -3672,7 +3672,7 @@ x_scroll_bar_remove (struct scroll_bar *bar)
|
|||
/* Dissociate this scroll bar from its window. */
|
||||
wset_vertical_scroll_bar (XWINDOW (bar->window), Qnil);
|
||||
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
}
|
||||
|
||||
/* Set the handle of the vertical scroll bar for WINDOW to indicate
|
||||
|
@ -3727,7 +3727,7 @@ w32_set_vertical_scroll_bar (struct window *w,
|
|||
if (NILP (w->vertical_scroll_bar))
|
||||
{
|
||||
HDC hdc;
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
if (width > 0 && height > 0)
|
||||
{
|
||||
hdc = get_frame_dc (f);
|
||||
|
@ -3737,7 +3737,7 @@ w32_set_vertical_scroll_bar (struct window *w,
|
|||
w32_clear_area (f, hdc, left, top, width, height);
|
||||
release_frame_dc (f, hdc);
|
||||
}
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
|
||||
bar = x_scroll_bar_create (w, top, sb_left, sb_width, height);
|
||||
}
|
||||
|
@ -3765,7 +3765,7 @@ w32_set_vertical_scroll_bar (struct window *w,
|
|||
HDC hdc;
|
||||
SCROLLINFO si;
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
if (width && height)
|
||||
{
|
||||
hdc = get_frame_dc (f);
|
||||
|
@ -3801,7 +3801,7 @@ w32_set_vertical_scroll_bar (struct window *w,
|
|||
XSETINT (bar->width, sb_width);
|
||||
XSETINT (bar->height, height);
|
||||
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
}
|
||||
}
|
||||
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,
|
|||
int top_range = VERTICAL_SCROLL_BAR_TOP_RANGE (f, XINT (bar->height));
|
||||
SCROLLINFO si;
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
|
||||
*fp = f;
|
||||
*bar_window = bar->window;
|
||||
|
@ -4080,7 +4080,7 @@ x_scroll_bar_report_motion (FRAME_PTR *fp, Lisp_Object *bar_window,
|
|||
|
||||
*time = last_mouse_movement_time;
|
||||
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
}
|
||||
|
||||
|
||||
|
@ -4157,15 +4157,8 @@ w32_read_socket (struct terminal *terminal,
|
|||
struct w32_display_info *dpyinfo = &one_w32_display_info;
|
||||
Mouse_HLInfo *hlinfo = &dpyinfo->mouse_highlight;
|
||||
|
||||
if (interrupt_input_blocked)
|
||||
{
|
||||
interrupt_input_pending = 1;
|
||||
pending_signals = 1;
|
||||
return -1;
|
||||
}
|
||||
|
||||
interrupt_input_pending = 0;
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
|
||||
/* So people can tell when we have read the available input. */
|
||||
input_signal_count++;
|
||||
|
@ -4961,7 +4954,7 @@ w32_read_socket (struct terminal *terminal,
|
|||
}
|
||||
}
|
||||
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
return count;
|
||||
}
|
||||
|
||||
|
@ -5476,7 +5469,7 @@ x_set_offset (struct frame *f, register int xoff, register int yoff,
|
|||
}
|
||||
x_calc_absolute_position (f);
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
x_wm_set_size_hint (f, (long) 0, 0);
|
||||
|
||||
modified_left = f->left_pos;
|
||||
|
@ -5487,7 +5480,7 @@ x_set_offset (struct frame *f, register int xoff, register int yoff,
|
|||
modified_left, modified_top,
|
||||
0, 0,
|
||||
SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE);
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
}
|
||||
|
||||
|
||||
|
@ -5528,7 +5521,7 @@ x_set_window_size (struct frame *f, int change_gravity, int cols, int rows)
|
|||
{
|
||||
int pixelwidth, pixelheight;
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
|
||||
check_frame_size (f, &rows, &cols);
|
||||
f->scroll_bar_actual_width
|
||||
|
@ -5608,7 +5601,7 @@ x_set_window_size (struct frame *f, int change_gravity, int cols, int rows)
|
|||
cancel_mouse_face (f);
|
||||
#endif
|
||||
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
}
|
||||
|
||||
/* Mouse warping. */
|
||||
|
@ -5638,7 +5631,7 @@ x_set_mouse_pixel_position (struct frame *f, int pix_x, int pix_y)
|
|||
RECT rect;
|
||||
POINT pt;
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
|
||||
GetClientRect (FRAME_W32_WINDOW (f), &rect);
|
||||
pt.x = rect.left + pix_x;
|
||||
|
@ -5647,7 +5640,7 @@ x_set_mouse_pixel_position (struct frame *f, int pix_x, int pix_y)
|
|||
|
||||
SetCursorPos (pt.x, pt.y);
|
||||
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
}
|
||||
|
||||
|
||||
|
@ -5659,7 +5652,7 @@ x_focus_on_frame (struct frame *f)
|
|||
struct w32_display_info *dpyinfo = &one_w32_display_info;
|
||||
|
||||
/* Give input focus to frame. */
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
#if 0
|
||||
/* Try not to change its Z-order if possible. */
|
||||
if (x_window_to_frame (dpyinfo, GetForegroundWindow ()))
|
||||
|
@ -5667,7 +5660,7 @@ x_focus_on_frame (struct frame *f)
|
|||
else
|
||||
#endif
|
||||
my_set_foreground_window (FRAME_W32_WINDOW (f));
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -5679,7 +5672,7 @@ x_unfocus_frame (struct frame *f)
|
|||
void
|
||||
x_raise_frame (struct frame *f)
|
||||
{
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
|
||||
/* Strictly speaking, raise-frame should only change the frame's Z
|
||||
order, leaving input focus unchanged. This is reasonable behavior
|
||||
|
@ -5734,19 +5727,19 @@ x_raise_frame (struct frame *f)
|
|||
my_bring_window_to_top (FRAME_W32_WINDOW (f));
|
||||
}
|
||||
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
}
|
||||
|
||||
/* Lower frame F. */
|
||||
void
|
||||
x_lower_frame (struct frame *f)
|
||||
{
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
my_set_window_pos (FRAME_W32_WINDOW (f),
|
||||
HWND_BOTTOM,
|
||||
0, 0, 0, 0,
|
||||
SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE);
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -5775,7 +5768,7 @@ x_make_frame_visible (struct frame *f)
|
|||
{
|
||||
Lisp_Object type;
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
|
||||
type = x_icon_type (f);
|
||||
if (!NILP (type))
|
||||
|
@ -5827,7 +5820,7 @@ x_make_frame_visible (struct frame *f)
|
|||
int count;
|
||||
|
||||
/* This must come after we set COUNT. */
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
|
||||
XSETFRAME (frame, f);
|
||||
|
||||
|
@ -5870,7 +5863,7 @@ x_make_frame_invisible (struct frame *f)
|
|||
if (FRAME_W32_DISPLAY_INFO (f)->x_highlight_frame == f)
|
||||
FRAME_W32_DISPLAY_INFO (f)->x_highlight_frame = 0;
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
|
||||
my_show_window (f, FRAME_W32_WINDOW (f), SW_HIDE);
|
||||
|
||||
|
@ -5884,7 +5877,7 @@ x_make_frame_invisible (struct frame *f)
|
|||
f->async_visible = 0;
|
||||
f->async_iconified = 0;
|
||||
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
}
|
||||
|
||||
/* Change window state from mapped to iconified. */
|
||||
|
@ -5901,7 +5894,7 @@ x_iconify_frame (struct frame *f)
|
|||
if (f->async_iconified)
|
||||
return;
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
|
||||
type = x_icon_type (f);
|
||||
if (!NILP (type))
|
||||
|
@ -5910,7 +5903,7 @@ x_iconify_frame (struct frame *f)
|
|||
/* Simulate the user minimizing the frame. */
|
||||
SendMessage (FRAME_W32_WINDOW (f), WM_SYSCOMMAND, SC_MINIMIZE, 0);
|
||||
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
}
|
||||
|
||||
|
||||
|
@ -5922,7 +5915,7 @@ x_free_frame_resources (struct frame *f)
|
|||
struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (f);
|
||||
Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f);
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
|
||||
/* We must free faces before destroying windows because some
|
||||
font-driver (e.g. xft) access a window while finishing a
|
||||
|
@ -5970,7 +5963,7 @@ x_free_frame_resources (struct frame *f)
|
|||
hlinfo->mouse_face_mouse_frame = 0;
|
||||
}
|
||||
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
}
|
||||
|
||||
|
||||
|
@ -6254,10 +6247,10 @@ x_delete_terminal (struct terminal *terminal)
|
|||
if (!terminal->name)
|
||||
return;
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
|
||||
x_delete_display (dpyinfo);
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
}
|
||||
|
||||
struct w32_display_info *
|
||||
|
@ -6267,7 +6260,7 @@ w32_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name)
|
|||
struct terminal *terminal;
|
||||
HDC hdc;
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
|
||||
if (!w32_initialized)
|
||||
{
|
||||
|
@ -6329,7 +6322,7 @@ w32_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name)
|
|||
init_sigio (connection);
|
||||
#endif /* ! defined (SIGIO) */
|
||||
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
|
||||
return dpyinfo;
|
||||
}
|
||||
|
|
|
@ -677,13 +677,13 @@ EmacsFrameDestroy (Widget widget)
|
|||
if (! s) emacs_abort ();
|
||||
if (! s->output_data.x) emacs_abort ();
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
x_free_gcs (s);
|
||||
if (s->output_data.x->white_relief.gc)
|
||||
XFreeGC (XtDisplay (widget), s->output_data.x->white_relief.gc);
|
||||
if (s->output_data.x->black_relief.gc)
|
||||
XFreeGC (XtDisplay (widget), s->output_data.x->black_relief.gc);
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
34
src/window.c
34
src/window.c
|
@ -2819,7 +2819,7 @@ window-start value is reasonable when this function is called. */)
|
|||
}
|
||||
}
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
if (!FRAME_INITIAL_P (f))
|
||||
{
|
||||
Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f);
|
||||
|
@ -2961,7 +2961,7 @@ window-start value is reasonable when this function is called. */)
|
|||
}
|
||||
|
||||
adjust_glyphs (f);
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
|
||||
run_window_configuration_change_hook (f);
|
||||
|
||||
|
@ -3696,14 +3696,14 @@ be applied on the Elisp level. */)
|
|||
(horflag ? r->total_cols : r->total_lines)))
|
||||
return Qnil;
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
window_resize_apply (r, horflag);
|
||||
|
||||
windows_or_buffers_changed++;
|
||||
FRAME_WINDOW_SIZES_CHANGED (f) = 1;
|
||||
|
||||
adjust_glyphs (f);
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
|
||||
run_window_configuration_change_hook (f);
|
||||
|
||||
|
@ -3973,13 +3973,13 @@ set correctly. See the code of `split-window' for how this is done. */)
|
|||
wset_new_total (n, total_size);
|
||||
wset_new_normal (n, normal_size);
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
window_resize_apply (p, horflag);
|
||||
adjust_glyphs (f);
|
||||
/* Set buffer of NEW to buffer of reference window. Don't run
|
||||
any hooks. */
|
||||
set_window_buffer (new, r->buffer, 0, 1);
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
|
||||
/* Maybe we should run the scroll functions in Elisp (which already
|
||||
runs the configuration change hook). */
|
||||
|
@ -4060,7 +4060,7 @@ Signal an error when WINDOW is the only window on its frame. */)
|
|||
{
|
||||
|
||||
/* Block input. */
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
window_resize_apply (p, horflag);
|
||||
|
||||
/* 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. */)
|
|||
else
|
||||
fset_selected_window (f, new_selected_window);
|
||||
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
|
||||
/* Now look whether `get-mru-window' gets us something. */
|
||||
mru_window = call1 (Qget_mru_window, frame);
|
||||
|
@ -4147,7 +4147,7 @@ Signal an error when WINDOW is the only window on its frame. */)
|
|||
fset_selected_window (f, new_selected_window);
|
||||
}
|
||||
else
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
|
||||
/* Must be run by the caller:
|
||||
run_window_configuration_change_hook (f); */
|
||||
|
@ -4197,7 +4197,7 @@ grow_mini_window (struct window *w, int delta)
|
|||
root, make_number (- delta));
|
||||
if (INTEGERP (value) && window_resize_check (r, 0))
|
||||
{
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
window_resize_apply (r, 0);
|
||||
|
||||
/* Grow the mini-window. */
|
||||
|
@ -4209,7 +4209,7 @@ grow_mini_window (struct window *w, int delta)
|
|||
w->last_overlay_modified = 0;
|
||||
|
||||
adjust_glyphs (f);
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4234,7 +4234,7 @@ shrink_mini_window (struct window *w)
|
|||
root, make_number (size - 1));
|
||||
if (INTEGERP (value) && window_resize_check (r, 0))
|
||||
{
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
window_resize_apply (r, 0);
|
||||
|
||||
/* Shrink the mini-window. */
|
||||
|
@ -4246,7 +4246,7 @@ shrink_mini_window (struct window *w)
|
|||
w->last_overlay_modified = 0;
|
||||
|
||||
adjust_glyphs (f);
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
}
|
||||
/* If the above failed for whatever strange reason we must make a
|
||||
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
|
|||
&& XINT (w->new_total) > 0
|
||||
&& height == XINT (r->new_total) + XINT (w->new_total))
|
||||
{
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
window_resize_apply (r, 0);
|
||||
|
||||
wset_total_lines (w, w->new_total);
|
||||
|
@ -4288,7 +4288,7 @@ DEFUN ("resize-mini-window-internal", Fresize_mini_window_internal, Sresize_mini
|
|||
windows_or_buffers_changed++;
|
||||
FRAME_WINDOW_SIZES_CHANGED (f) = 1;
|
||||
adjust_glyphs (f);
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
|
||||
run_window_configuration_change_hook (f);
|
||||
return Qt;
|
||||
|
@ -5624,7 +5624,7 @@ the return value is nil. Otherwise the value is t. */)
|
|||
|
||||
/* The mouse highlighting code could get screwed up
|
||||
if it runs during this. */
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
|
||||
if (data->frame_lines != previous_frame_lines
|
||||
|| data->frame_cols != previous_frame_cols)
|
||||
|
@ -5875,7 +5875,7 @@ the return value is nil. Otherwise the value is t. */)
|
|||
}
|
||||
|
||||
adjust_glyphs (f);
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
|
||||
/* Scan dead buffer windows. */
|
||||
for (; CONSP (dead_windows); dead_windows = XCDR (dead_windows))
|
||||
|
|
43
src/xdisp.c
43
src/xdisp.c
|
@ -275,6 +275,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
|
|||
#include <limits.h>
|
||||
|
||||
#include "lisp.h"
|
||||
#include "atimer.h"
|
||||
#include "keyboard.h"
|
||||
#include "frame.h"
|
||||
#include "window.h"
|
||||
|
@ -11402,11 +11403,11 @@ x_cursor_to (int vpos, int hpos, int y, int x)
|
|||
This will also set the cursor position of W. */
|
||||
if (updated_window == NULL)
|
||||
{
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
display_and_set_cursor (w, 1, hpos, vpos, x, y);
|
||||
if (FRAME_RIF (SELECTED_FRAME ())->flush_display_optional)
|
||||
FRAME_RIF (SELECTED_FRAME ())->flush_display_optional (SELECTED_FRAME ());
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -11520,11 +11521,11 @@ update_tool_bar (struct frame *f, int save_match_data)
|
|||
/* Redisplay that happens asynchronously due to an expose event
|
||||
may access f->tool_bar_items. Make sure we update both
|
||||
variables within BLOCK_INPUT so no such event interrupts. */
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
fset_tool_bar_items (f, new_tool_bar);
|
||||
f->n_tool_bar_items = new_n_tool_bar;
|
||||
w->update_mode_line = 1;
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
}
|
||||
|
||||
UNGCPRO;
|
||||
|
@ -16205,10 +16206,10 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
|
|||
|| w->pseudo_window_p)))
|
||||
{
|
||||
update_begin (f);
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
if (draw_window_fringes (w, 1))
|
||||
x_draw_vertical_border (w);
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
update_end (f);
|
||||
}
|
||||
#endif /* HAVE_WINDOW_SYSTEM */
|
||||
|
@ -25327,7 +25328,7 @@ x_write_glyphs (struct glyph *start, int len)
|
|||
if (updated_row->reversed_p && chpos >= updated_row->used[TEXT_AREA])
|
||||
chpos = updated_row->used[TEXT_AREA] - 1;
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
|
||||
/* Write glyphs. */
|
||||
|
||||
|
@ -25345,7 +25346,7 @@ x_write_glyphs (struct glyph *start, int len)
|
|||
&& chpos < hpos + len)
|
||||
updated_window->phys_cursor_on_p = 0;
|
||||
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
|
||||
/* Advance the output cursor. */
|
||||
output_cursor.hpos += len;
|
||||
|
@ -25368,7 +25369,7 @@ x_insert_glyphs (struct glyph *start, int len)
|
|||
ptrdiff_t hpos;
|
||||
|
||||
eassert (updated_window && updated_row);
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
w = updated_window;
|
||||
f = XFRAME (WINDOW_FRAME (w));
|
||||
|
||||
|
@ -25402,7 +25403,7 @@ x_insert_glyphs (struct glyph *start, int len)
|
|||
/* Advance the output cursor. */
|
||||
output_cursor.hpos += len;
|
||||
output_cursor.x += shift_by_width;
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
}
|
||||
|
||||
|
||||
|
@ -25471,10 +25472,10 @@ x_clear_end_of_line (int to_x)
|
|||
/* Prevent inadvertently clearing to end of the X window. */
|
||||
if (to_x > from_x && to_y > from_y)
|
||||
{
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
FRAME_RIF (f)->clear_frame_area (f, from_x, from_y,
|
||||
to_x - from_x, to_y - from_y);
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -25801,7 +25802,7 @@ x_fix_overlapping_area (struct window *w, struct glyph_row *row,
|
|||
{
|
||||
int i, x;
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
|
||||
x = 0;
|
||||
for (i = 0; i < row->used[area];)
|
||||
|
@ -25829,7 +25830,7 @@ x_fix_overlapping_area (struct window *w, struct glyph_row *row,
|
|||
}
|
||||
}
|
||||
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
}
|
||||
|
||||
|
||||
|
@ -26047,7 +26048,7 @@ display_and_set_cursor (struct window *w, int on,
|
|||
|| (0 <= hpos && hpos < glyph_row->used[TEXT_AREA]))
|
||||
glyph = glyph_row->glyphs[TEXT_AREA] + hpos;
|
||||
|
||||
eassert (interrupt_input_blocked);
|
||||
eassert (input_blocked_p ());
|
||||
|
||||
/* Set new_cursor_type to the cursor we want to be displayed. */
|
||||
new_cursor_type = get_window_cursor_type (w, glyph,
|
||||
|
@ -26117,10 +26118,10 @@ update_window_cursor (struct window *w, int on)
|
|||
if (row->reversed_p && hpos >= row->used[TEXT_AREA])
|
||||
hpos = row->used[TEXT_AREA] - 1;
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
display_and_set_cursor (w, on, hpos, vpos,
|
||||
w->phys_cursor.x, w->phys_cursor.y);
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -26298,10 +26299,10 @@ show_mouse_face (Mouse_HLInfo *hlinfo, enum draw_glyphs_face draw)
|
|||
if (row->reversed_p && hpos >= row->used[TEXT_AREA])
|
||||
hpos = row->used[TEXT_AREA] - 1;
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
display_and_set_cursor (w, 1, hpos, w->phys_cursor.vpos,
|
||||
w->phys_cursor.x, w->phys_cursor.y);
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
}
|
||||
#endif /* HAVE_WINDOW_SYSTEM */
|
||||
}
|
||||
|
@ -28116,11 +28117,11 @@ x_clear_window_mouse_face (struct window *w)
|
|||
Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (XFRAME (w->frame));
|
||||
Lisp_Object window;
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
XSETWINDOW (window, w);
|
||||
if (EQ (window, hlinfo->mouse_face_window))
|
||||
clear_mouse_face (hlinfo);
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
}
|
||||
|
||||
|
||||
|
|
50
src/xfaces.c
50
src/xfaces.c
|
@ -605,9 +605,9 @@ static inline GC
|
|||
x_create_gc (struct frame *f, long unsigned int mask, XGCValues *xgcv)
|
||||
{
|
||||
GC gc;
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
gc = XCreateGC (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), mask, xgcv);
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
IF_DEBUG (++ngcs);
|
||||
return gc;
|
||||
}
|
||||
|
@ -618,7 +618,7 @@ x_create_gc (struct frame *f, long unsigned int mask, XGCValues *xgcv)
|
|||
static inline void
|
||||
x_free_gc (struct frame *f, GC gc)
|
||||
{
|
||||
eassert (interrupt_input_blocked);
|
||||
eassert (input_blocked_p ());
|
||||
IF_DEBUG (eassert (--ngcs >= 0));
|
||||
XFreeGC (FRAME_X_DISPLAY (f), gc);
|
||||
}
|
||||
|
@ -632,9 +632,9 @@ static inline GC
|
|||
x_create_gc (struct frame *f, unsigned long mask, XGCValues *xgcv)
|
||||
{
|
||||
GC gc;
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
gc = XCreateGC (NULL, FRAME_W32_WINDOW (f), mask, xgcv);
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
IF_DEBUG (++ngcs);
|
||||
return gc;
|
||||
}
|
||||
|
@ -907,7 +907,7 @@ load_pixmap (FRAME_PTR f, Lisp_Object name, unsigned int *w_ptr,
|
|||
|
||||
CHECK_TYPE (!NILP (Fbitmap_spec_p (name)), Qbitmap_spec_p, name);
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
if (CONSP (name))
|
||||
{
|
||||
/* Decode a bitmap spec into a bitmap. */
|
||||
|
@ -927,7 +927,7 @@ load_pixmap (FRAME_PTR f, Lisp_Object name, unsigned int *w_ptr,
|
|||
/* It must be a string -- a file name. */
|
||||
bitmap_id = x_create_bitmap_from_file (f, name);
|
||||
}
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
|
||||
if (bitmap_id < 0)
|
||||
{
|
||||
|
@ -1364,9 +1364,9 @@ unload_color (struct frame *f, long unsigned int pixel)
|
|||
#ifdef HAVE_X_WINDOWS
|
||||
if (pixel != -1)
|
||||
{
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
x_free_colors (f, &pixel, 1);
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
@ -1382,7 +1382,7 @@ free_face_colors (struct frame *f, struct face *face)
|
|||
if (face->colors_copied_bitwise_p)
|
||||
return;
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
|
||||
if (!face->foreground_defaulted_p)
|
||||
{
|
||||
|
@ -1424,7 +1424,7 @@ free_face_colors (struct frame *f, struct face *face)
|
|||
IF_DEBUG (--ncolors_allocated);
|
||||
}
|
||||
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
#endif /* HAVE_X_WINDOWS */
|
||||
}
|
||||
|
||||
|
@ -3438,10 +3438,10 @@ DEFUN ("internal-face-x-get-resource", Finternal_face_x_get_resource,
|
|||
CHECK_STRING (resource);
|
||||
CHECK_STRING (class);
|
||||
CHECK_LIVE_FRAME (frame);
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
value = display_x_get_resource (FRAME_X_DISPLAY_INFO (XFRAME (frame)),
|
||||
resource, class, Qnil, Qnil);
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
return value;
|
||||
}
|
||||
|
||||
|
@ -4114,12 +4114,12 @@ free_realized_face (struct frame *f, struct face *face)
|
|||
free_face_fontset (f, face);
|
||||
if (face->gc)
|
||||
{
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
if (face->font)
|
||||
font_done_for_face (f, face);
|
||||
x_free_gc (f, face->gc);
|
||||
face->gc = 0;
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
}
|
||||
|
||||
free_face_colors (f, face);
|
||||
|
@ -4153,7 +4153,7 @@ prepare_face_for_display (struct frame *f, struct face *face)
|
|||
xgcv.graphics_exposures = False;
|
||||
#endif
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
#ifdef HAVE_X_WINDOWS
|
||||
if (face->stipple)
|
||||
{
|
||||
|
@ -4165,7 +4165,7 @@ prepare_face_for_display (struct frame *f, struct face *face)
|
|||
face->gc = x_create_gc (f, mask, &xgcv);
|
||||
if (face->font)
|
||||
font_prepare_for_face (f, face);
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
}
|
||||
#endif /* HAVE_WINDOW_SYSTEM */
|
||||
}
|
||||
|
@ -4263,12 +4263,12 @@ clear_face_gcs (struct face_cache *c)
|
|||
struct face *face = c->faces_by_id[i];
|
||||
if (face && face->gc)
|
||||
{
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
if (face->font)
|
||||
font_done_for_face (c->f, face);
|
||||
x_free_gc (c->f, face->gc);
|
||||
face->gc = 0;
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
}
|
||||
}
|
||||
#endif /* HAVE_WINDOW_SYSTEM */
|
||||
|
@ -4292,7 +4292,7 @@ free_realized_faces (struct face_cache *c)
|
|||
/* We must block input here because we can't process X events
|
||||
safely while only some faces are freed, or when the frame's
|
||||
current matrix still references freed faces. */
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
|
||||
for (i = 0; i < c->used; ++i)
|
||||
{
|
||||
|
@ -4314,7 +4314,7 @@ free_realized_faces (struct face_cache *c)
|
|||
++windows_or_buffers_changed;
|
||||
}
|
||||
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5275,7 +5275,7 @@ realize_basic_faces (struct frame *f)
|
|||
|
||||
/* Block input here so that we won't be surprised by an X expose
|
||||
event, for instance, without having the faces set up. */
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
specbind (Qscalable_fonts_allowed, Qt);
|
||||
|
||||
if (realize_default_face (f))
|
||||
|
@ -5306,7 +5306,7 @@ realize_basic_faces (struct frame *f)
|
|||
}
|
||||
|
||||
unbind_to (count, Qnil);
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
return success_p;
|
||||
}
|
||||
|
||||
|
@ -6352,7 +6352,7 @@ where R,G,B are numbers between 0 and 255 and name is an arbitrary string. */)
|
|||
int red, green, blue;
|
||||
int num;
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
|
||||
while (fgets (buf, sizeof (buf), fp) != NULL) {
|
||||
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. */)
|
|||
}
|
||||
fclose (fp);
|
||||
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
}
|
||||
|
||||
return cmap;
|
||||
|
|
176
src/xfns.c
176
src/xfns.c
|
@ -425,7 +425,7 @@ x_real_positions (FRAME_PTR f, int *xptr, int *yptr)
|
|||
unsigned char *tmp_data = NULL;
|
||||
Atom target_type = XA_CARDINAL;
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
|
||||
x_catch_errors (dpy);
|
||||
|
||||
|
@ -543,7 +543,7 @@ x_real_positions (FRAME_PTR f, int *xptr, int *yptr)
|
|||
|
||||
x_uncatch_errors ();
|
||||
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
|
||||
if (had_errors) return;
|
||||
|
||||
|
@ -587,7 +587,7 @@ x_defined_color (struct frame *f, const char *color_name,
|
|||
Display *dpy = FRAME_X_DISPLAY (f);
|
||||
Colormap cmap = FRAME_X_COLORMAP (f);
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
#ifdef USE_GTK
|
||||
success_p = xg_check_special_colors (f, color_name, color);
|
||||
#endif
|
||||
|
@ -595,7 +595,7 @@ x_defined_color (struct frame *f, const char *color_name,
|
|||
success_p = XParseColor (dpy, cmap, color_name, color);
|
||||
if (success_p && alloc_p)
|
||||
success_p = x_alloc_nearest_color (f, cmap, color);
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
|
||||
return success_p;
|
||||
}
|
||||
|
@ -679,7 +679,7 @@ xg_set_icon (FRAME_PTR f, Lisp_Object file)
|
|||
GdkPixbuf *pixbuf;
|
||||
GError *err = NULL;
|
||||
char *filename = SSDATA (found);
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
|
||||
pixbuf = gdk_pixbuf_new_from_file (filename, &err);
|
||||
|
||||
|
@ -694,7 +694,7 @@ xg_set_icon (FRAME_PTR f, Lisp_Object file)
|
|||
else
|
||||
g_error_free (err);
|
||||
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
}
|
||||
|
||||
return result;
|
||||
|
@ -737,7 +737,7 @@ x_set_foreground_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
|
|||
{
|
||||
Display *dpy = FRAME_X_DISPLAY (f);
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
XSetForeground (dpy, x->normal_gc, fg);
|
||||
XSetBackground (dpy, x->reverse_gc, fg);
|
||||
|
||||
|
@ -748,7 +748,7 @@ x_set_foreground_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
|
|||
XSetBackground (dpy, x->cursor_gc, x->cursor_pixel);
|
||||
}
|
||||
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
|
||||
update_face_from_frame_parameter (f, Qforeground_color, arg);
|
||||
|
||||
|
@ -773,7 +773,7 @@ x_set_background_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
|
|||
{
|
||||
Display *dpy = FRAME_X_DISPLAY (f);
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
XSetBackground (dpy, x->normal_gc, bg);
|
||||
XSetForeground (dpy, x->reverse_gc, bg);
|
||||
XSetWindowBackground (dpy, FRAME_X_WINDOW (f), bg);
|
||||
|
@ -797,7 +797,7 @@ x_set_background_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
|
|||
}
|
||||
#endif /* USE_TOOLKIT_SCROLL_BARS */
|
||||
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
update_face_from_frame_parameter (f, Qbackground_color, arg);
|
||||
|
||||
if (FRAME_VISIBLE_P (f))
|
||||
|
@ -854,7 +854,7 @@ x_set_mouse_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
|
|||
unload_color (f, x->mouse_pixel);
|
||||
x->mouse_pixel = pixel;
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
|
||||
/* It's not okay to crash if the user selects a screwy cursor. */
|
||||
x_catch_errors (dpy);
|
||||
|
@ -974,7 +974,7 @@ x_set_mouse_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
|
|||
x->horizontal_drag_cursor = horizontal_drag_cursor;
|
||||
|
||||
XFlush (dpy);
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
|
||||
update_face_from_frame_parameter (f, Qmouse_color, arg);
|
||||
}
|
||||
|
@ -1031,10 +1031,10 @@ x_set_cursor_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
|
|||
|
||||
if (FRAME_X_WINDOW (f) != 0)
|
||||
{
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
XSetBackground (FRAME_X_DISPLAY (f), x->cursor_gc, x->cursor_pixel);
|
||||
XSetForeground (FRAME_X_DISPLAY (f), x->cursor_gc, fore_pixel);
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
|
||||
if (FRAME_VISIBLE_P (f))
|
||||
{
|
||||
|
@ -1058,9 +1058,9 @@ x_set_border_pixel (struct frame *f, int pix)
|
|||
|
||||
if (FRAME_X_WINDOW (f) != 0 && f->border_width > 0)
|
||||
{
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
XSetWindowBorder (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), pix);
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
|
||||
if (FRAME_VISIBLE_P (f))
|
||||
redraw_frame (f);
|
||||
|
@ -1112,7 +1112,7 @@ x_set_icon_type (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
|
|||
else if (!STRINGP (oldval) && EQ (oldval, Qnil) == EQ (arg, Qnil))
|
||||
return;
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
if (NILP (arg))
|
||||
result = x_text_icon (f,
|
||||
SSDATA ((!NILP (f->icon_name)
|
||||
|
@ -1123,12 +1123,12 @@ x_set_icon_type (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
|
|||
|
||||
if (result)
|
||||
{
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
error ("No icon window available");
|
||||
}
|
||||
|
||||
XFlush (FRAME_X_DISPLAY (f));
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -1149,7 +1149,7 @@ x_set_icon_name (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
|
|||
if (f->output_data.x->icon_bitmap != 0)
|
||||
return;
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
|
||||
result = x_text_icon (f,
|
||||
SSDATA ((!NILP (f->icon_name)
|
||||
|
@ -1160,12 +1160,12 @@ x_set_icon_name (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
|
|||
|
||||
if (result)
|
||||
{
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
error ("No icon window available");
|
||||
}
|
||||
|
||||
XFlush (FRAME_X_DISPLAY (f));
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
}
|
||||
|
||||
|
||||
|
@ -1228,10 +1228,10 @@ x_set_menu_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval)
|
|||
{
|
||||
y = FRAME_TOP_MARGIN_HEIGHT (f);
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
x_clear_area (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
|
||||
0, y, width, height, False);
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
}
|
||||
|
||||
if (nlines > 1 && nlines > olines)
|
||||
|
@ -1239,10 +1239,10 @@ x_set_menu_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval)
|
|||
y = (olines == 0 ? 1 : olines) * FRAME_LINE_HEIGHT (f);
|
||||
height = nlines * FRAME_LINE_HEIGHT (f) - y;
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
x_clear_area (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
|
||||
0, y, width, height, False);
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
}
|
||||
|
||||
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)
|
|||
/* height can be zero here. */
|
||||
if (height > 0 && width > 0)
|
||||
{
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
x_clear_area (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
|
||||
0, y, width, height, False);
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
}
|
||||
|
||||
if (WINDOWP (f->tool_bar_window))
|
||||
|
@ -1494,7 +1494,7 @@ x_set_name_internal (FRAME_PTR f, Lisp_Object name)
|
|||
{
|
||||
if (FRAME_X_WINDOW (f))
|
||||
{
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
{
|
||||
XTextProperty text, icon;
|
||||
ptrdiff_t bytes;
|
||||
|
@ -1586,7 +1586,7 @@ x_set_name_internal (FRAME_PTR f, Lisp_Object name)
|
|||
if (do_free_text_value)
|
||||
xfree (text.value);
|
||||
}
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1779,7 +1779,7 @@ hack_wm_protocols (FRAME_PTR f, Widget widget)
|
|||
int need_focus = 1;
|
||||
int need_save = 1;
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
{
|
||||
Atom type;
|
||||
unsigned char *catoms;
|
||||
|
@ -1827,7 +1827,7 @@ hack_wm_protocols (FRAME_PTR f, Widget widget)
|
|||
XA_ATOM, 32, PropModeAppend,
|
||||
(unsigned char *) props, count);
|
||||
}
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -2350,7 +2350,7 @@ x_window (struct frame *f, long window_prompting, int minibuffer_only)
|
|||
Arg al [25];
|
||||
int ac;
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
|
||||
/* Use the resource name as the top-level widget name
|
||||
for looking up resources. Make a non-Lisp copy
|
||||
|
@ -2572,7 +2572,7 @@ x_window (struct frame *f, long window_prompting, int minibuffer_only)
|
|||
f->output_data.x->current_cursor
|
||||
= f->output_data.x->text_cursor);
|
||||
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
|
||||
/* This is a no-op, except under Motif. Make sure main areas are
|
||||
set to something reasonable, in case we get an error later. */
|
||||
|
@ -2591,7 +2591,7 @@ x_window (FRAME_PTR f)
|
|||
FRAME_XIC (f) = NULL;
|
||||
if (use_xim)
|
||||
{
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
create_frame_xic (f);
|
||||
if (FRAME_XIC (f))
|
||||
{
|
||||
|
@ -2613,7 +2613,7 @@ x_window (FRAME_PTR f)
|
|||
attribute_mask, &attributes);
|
||||
}
|
||||
}
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
@ -2638,7 +2638,7 @@ x_window (struct frame *f)
|
|||
attribute_mask = (CWBackPixel | CWBorderPixel | CWBitGravity | CWEventMask
|
||||
| CWColormap);
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
FRAME_X_WINDOW (f)
|
||||
= XCreateWindow (FRAME_X_DISPLAY (f),
|
||||
f->output_data.x->parent_desc,
|
||||
|
@ -2715,7 +2715,7 @@ x_window (struct frame *f)
|
|||
f->output_data.x->current_cursor
|
||||
= f->output_data.x->text_cursor);
|
||||
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
|
||||
if (FRAME_X_WINDOW (f) == 0)
|
||||
error ("Unable to create window");
|
||||
|
@ -2768,7 +2768,7 @@ x_icon (struct frame *f, Lisp_Object parms)
|
|||
else if (!EQ (icon_x, Qunbound) || !EQ (icon_y, Qunbound))
|
||||
error ("Both left and top icon corners of icon must be specified");
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
|
||||
if (! EQ (icon_x, Qunbound))
|
||||
x_wm_set_icon_position (f, XINT (icon_x), XINT (icon_y));
|
||||
|
@ -2787,7 +2787,7 @@ x_icon (struct frame *f, Lisp_Object parms)
|
|||
? f->icon_name
|
||||
: f->name)));
|
||||
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
}
|
||||
|
||||
/* Make the GCs needed for this window, setting the
|
||||
|
@ -2799,7 +2799,7 @@ x_make_gc (struct frame *f)
|
|||
{
|
||||
XGCValues gc_values;
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
|
||||
/* Create the GCs of this frame.
|
||||
Note that many default values are used. */
|
||||
|
@ -2847,7 +2847,7 @@ x_make_gc (struct frame *f)
|
|||
FRAME_BACKGROUND_PIXEL (f),
|
||||
DefaultDepth (FRAME_X_DISPLAY (f), FRAME_X_SCREEN_NUMBER (f))));
|
||||
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
}
|
||||
|
||||
|
||||
|
@ -2858,7 +2858,7 @@ x_free_gcs (struct frame *f)
|
|||
{
|
||||
Display *dpy = FRAME_X_DISPLAY (f);
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
|
||||
if (f->output_data.x->normal_gc)
|
||||
{
|
||||
|
@ -2884,7 +2884,7 @@ x_free_gcs (struct frame *f)
|
|||
f->output_data.x->border_tile = 0;
|
||||
}
|
||||
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
}
|
||||
|
||||
|
||||
|
@ -3007,10 +3007,10 @@ If FRAME is nil, use the selected frame. */)
|
|||
if (NILP (frame))
|
||||
frame = selected_frame;
|
||||
f = XFRAME (frame);
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
if (FRAME_X_P (f))
|
||||
x_wm_set_size_hint (f, 0, 0);
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
|
@ -3405,9 +3405,9 @@ This function is an internal primitive--use `make-frame' instead. */)
|
|||
/* Tell the server what size and position, etc, we want, and how
|
||||
badly we want them. This should be done after we have the menu
|
||||
bar so that its size can be taken into account. */
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
x_wm_set_size_hint (f, window_prompting, 0);
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
|
||||
/* Make the window appear on the frame and enable display, unless
|
||||
the caller says not to. However, with explicit parent, Emacs
|
||||
|
@ -3431,7 +3431,7 @@ This function is an internal primitive--use `make-frame' instead. */)
|
|||
}
|
||||
}
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
|
||||
/* Set machine name and pid for the purpose of window managers. */
|
||||
set_machine_and_pid_properties (f);
|
||||
|
@ -3447,7 +3447,7 @@ This function is an internal primitive--use `make-frame' instead. */)
|
|||
(unsigned char *) &dpyinfo->client_leader_window, 1);
|
||||
}
|
||||
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
|
||||
/* Initialize `default-minibuffer-frame' in case this is the first
|
||||
frame on this terminal. */
|
||||
|
@ -3506,7 +3506,7 @@ FRAME nil means use the selected frame. */)
|
|||
struct frame *f = check_x_frame (frame);
|
||||
Display *dpy = FRAME_X_DISPLAY (f);
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
x_catch_errors (dpy);
|
||||
|
||||
if (FRAME_X_EMBEDDED_P (f))
|
||||
|
@ -3524,7 +3524,7 @@ FRAME nil means use the selected frame. */)
|
|||
}
|
||||
|
||||
x_uncatch_errors ();
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
|
||||
return Qnil;
|
||||
}
|
||||
|
@ -4152,9 +4152,9 @@ If TERMINAL is omitted or nil, that stands for the selected frame's display. */
|
|||
void
|
||||
x_sync (FRAME_PTR f)
|
||||
{
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
XSync (FRAME_X_DISPLAY (f), False);
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
}
|
||||
|
||||
|
||||
|
@ -4229,7 +4229,7 @@ FRAME. Default is to change on the edit X window. */)
|
|||
nelements = SBYTES (value);
|
||||
}
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
prop_atom = XInternAtom (FRAME_X_DISPLAY (f), SSDATA (prop), False);
|
||||
if (! NILP (type))
|
||||
{
|
||||
|
@ -4248,7 +4248,7 @@ FRAME. Default is to change on the edit X window. */)
|
|||
|
||||
/* Make sure the property is set when we return. */
|
||||
XFlush (FRAME_X_DISPLAY (f));
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
|
||||
return value;
|
||||
}
|
||||
|
@ -4264,13 +4264,13 @@ FRAME nil or omitted means use the selected frame. Value is PROP. */)
|
|||
Atom prop_atom;
|
||||
|
||||
CHECK_STRING (prop);
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
prop_atom = XInternAtom (FRAME_X_DISPLAY (f), SSDATA (prop), False);
|
||||
XDeleteProperty (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), prop_atom);
|
||||
|
||||
/* Make sure the property is removed when we return. */
|
||||
XFlush (FRAME_X_DISPLAY (f));
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
|
||||
return prop;
|
||||
}
|
||||
|
@ -4318,7 +4318,7 @@ no value of TYPE (always string in the MS Windows case). */)
|
|||
target_window = FRAME_X_DISPLAY_INFO (f)->root_window;
|
||||
}
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
if (STRINGP (type))
|
||||
{
|
||||
if (strcmp ("AnyPropertyType", SSDATA (type)) == 0)
|
||||
|
@ -4384,7 +4384,7 @@ no value of TYPE (always string in the MS Windows case). */)
|
|||
if (tmp_data) XFree (tmp_data);
|
||||
}
|
||||
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
UNGCPRO;
|
||||
return prop_value;
|
||||
}
|
||||
|
@ -4415,7 +4415,7 @@ show_hourglass (struct atimer *timer)
|
|||
{
|
||||
Lisp_Object rest, frame;
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
|
||||
FOR_EACH_FRAME (rest, frame)
|
||||
{
|
||||
|
@ -4459,7 +4459,7 @@ show_hourglass (struct atimer *timer)
|
|||
}
|
||||
|
||||
hourglass_shown_p = 1;
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4474,7 +4474,7 @@ hide_hourglass (void)
|
|||
{
|
||||
Lisp_Object rest, frame;
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
FOR_EACH_FRAME (rest, frame)
|
||||
{
|
||||
struct frame *f = XFRAME (frame);
|
||||
|
@ -4493,7 +4493,7 @@ hide_hourglass (void)
|
|||
}
|
||||
|
||||
hourglass_shown_p = 0;
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4743,7 +4743,7 @@ x_create_tip_frame (struct x_display_info *dpyinfo,
|
|||
unsigned long mask;
|
||||
Atom type = FRAME_X_DISPLAY_INFO (f)->Xatom_net_window_type_tooltip;
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
mask = CWBackPixel | CWOverrideRedirect | CWEventMask;
|
||||
if (DoesSaveUnders (dpyinfo->screen))
|
||||
mask |= CWSaveUnder;
|
||||
|
@ -4770,7 +4770,7 @@ x_create_tip_frame (struct x_display_info *dpyinfo,
|
|||
FRAME_X_DISPLAY_INFO (f)->Xatom_net_window_type,
|
||||
XA_ATOM, 32, PropModeReplace,
|
||||
(unsigned char *)&type, 1);
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
}
|
||||
|
||||
x_make_gc (f);
|
||||
|
@ -4884,10 +4884,10 @@ compute_tip_xy (struct frame *f, Lisp_Object parms, Lisp_Object dx, Lisp_Object
|
|||
show it. */
|
||||
if (!INTEGERP (left) || !INTEGERP (top))
|
||||
{
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
XQueryPointer (FRAME_X_DISPLAY (f), FRAME_X_DISPLAY_INFO (f)->root_window,
|
||||
&root, &child, root_x, root_y, &win_x, &win_y, &pmask);
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
}
|
||||
|
||||
if (INTEGERP (top))
|
||||
|
@ -4990,7 +4990,7 @@ Text larger than the specified size is clipped. */)
|
|||
/* Hide a previous tip, if any. */
|
||||
Fx_hide_tip ();
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
if ((ok = xg_prepare_tooltip (f, string, &width, &height)) != 0)
|
||||
{
|
||||
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. */)
|
|||
/* This is used in Fx_hide_tip. */
|
||||
XSETFRAME (tip_frame, f);
|
||||
}
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
if (ok) goto start_timer;
|
||||
}
|
||||
#endif /* USE_GTK */
|
||||
|
@ -5026,12 +5026,12 @@ Text larger than the specified size is clipped. */)
|
|||
call1 (Qcancel_timer, timer);
|
||||
}
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
compute_tip_xy (tip_f, parms, dx, dy, FRAME_PIXEL_WIDTH (tip_f),
|
||||
FRAME_PIXEL_HEIGHT (tip_f), &root_x, &root_y);
|
||||
XMoveWindow (FRAME_X_DISPLAY (tip_f), FRAME_X_WINDOW (tip_f),
|
||||
root_x, root_y);
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
goto start_timer;
|
||||
}
|
||||
}
|
||||
|
@ -5185,11 +5185,11 @@ Text larger than the specified size is clipped. */)
|
|||
show it. */
|
||||
compute_tip_xy (f, parms, dx, dy, width, height, &root_x, &root_y);
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
XMoveResizeWindow (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
|
||||
root_x, root_y, width, height);
|
||||
XMapRaised (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f));
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
|
||||
/* Draw into the window. */
|
||||
w->must_be_updated_p = 1;
|
||||
|
@ -5261,9 +5261,9 @@ Value is t if tooltip was open, nil otherwise. */)
|
|||
if (!DoesSaveUnders (FRAME_X_DISPLAY_INFO (f)->screen)
|
||||
&& w != NULL)
|
||||
{
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
xlwmenu_redisplay (w);
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
}
|
||||
}
|
||||
#endif /* USE_LUCID */
|
||||
|
@ -5327,11 +5327,11 @@ clean_up_file_dialog (Lisp_Object arg)
|
|||
Widget dialog = (Widget) p->pointer;
|
||||
|
||||
/* Clean up. */
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
XtUnmanageChild (dialog);
|
||||
XtDestroyWidget (dialog);
|
||||
x_menu_set_in_use (0);
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
|
||||
return Qnil;
|
||||
}
|
||||
|
@ -5372,7 +5372,7 @@ Otherwise, if ONLY-DIR-P is non-nil, the user can only select directories. */)
|
|||
/* Prevent redisplay. */
|
||||
specbind (Qinhibit_redisplay, Qt);
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
|
||||
/* Create the dialog with PROMPT as title, using DIR as initial
|
||||
directory and using "*" as pattern. */
|
||||
|
@ -5486,7 +5486,7 @@ Otherwise, if ONLY-DIR-P is non-nil, the user can only select directories. */)
|
|||
else
|
||||
file = Qnil;
|
||||
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
UNGCPRO;
|
||||
|
||||
/* Make "Cancel" equivalent to C-g. */
|
||||
|
@ -5543,7 +5543,7 @@ Otherwise, if ONLY-DIR-P is non-nil, the user can only select directories. */)
|
|||
specbind (Qinhibit_redisplay, Qt);
|
||||
record_unwind_protect (clean_up_dialog, Qnil);
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
|
||||
if (STRINGP (default_filename))
|
||||
cdef_file = SSDATA (default_filename);
|
||||
|
@ -5560,7 +5560,7 @@ Otherwise, if ONLY-DIR-P is non-nil, the user can only select directories. */)
|
|||
xfree (fn);
|
||||
}
|
||||
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
UNGCPRO;
|
||||
|
||||
/* Make "Cancel" equivalent to C-g. */
|
||||
|
@ -5600,7 +5600,7 @@ nil, it defaults to the selected frame. */)
|
|||
specbind (Qinhibit_redisplay, Qt);
|
||||
record_unwind_protect (clean_up_dialog, Qnil);
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
|
||||
GCPRO2 (font_param, font);
|
||||
|
||||
|
@ -5618,7 +5618,7 @@ nil, it defaults to the selected frame. */)
|
|||
font = xg_get_font (f, default_name);
|
||||
xfree (default_name);
|
||||
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
|
||||
if (NILP (font))
|
||||
Fsignal (Qquit, Qnil);
|
||||
|
@ -5655,14 +5655,14 @@ present and mapped to the usual X keysyms. */)
|
|||
Lisp_Object have_keys;
|
||||
int major, minor, op, event, error_code;
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
|
||||
/* Check library version in case we're dynamically linked. */
|
||||
major = XkbMajorVersion;
|
||||
minor = XkbMinorVersion;
|
||||
if (!XkbLibraryVersion (&major, &minor))
|
||||
{
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
return Qlambda;
|
||||
}
|
||||
|
||||
|
@ -5671,7 +5671,7 @@ present and mapped to the usual X keysyms. */)
|
|||
minor = XkbMinorVersion;
|
||||
if (!XkbQueryExtension (dpy, &op, &event, &error_code, &major, &minor))
|
||||
{
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
return Qlambda;
|
||||
}
|
||||
|
||||
|
@ -5724,7 +5724,7 @@ present and mapped to the usual X keysyms. */)
|
|||
&& XKeysymToKeycode (dpy, XK_BackSpace) == backspace_keycode)
|
||||
have_keys = Qt;
|
||||
}
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
return have_keys;
|
||||
#else /* not HAVE_XKBGETKEYBOARD */
|
||||
return Qlambda;
|
||||
|
|
40
src/xfont.c
40
src/xfont.c
|
@ -362,7 +362,7 @@ xfont_list_pattern (Display *display, const char *pattern,
|
|||
}
|
||||
}
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
x_catch_errors (display);
|
||||
|
||||
for (limit = 512; ; limit *= 2)
|
||||
|
@ -479,7 +479,7 @@ xfont_list_pattern (Display *display, const char *pattern,
|
|||
}
|
||||
|
||||
x_uncatch_errors ();
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
|
||||
FONT_ADD_LOG ("xfont-list", build_string (pattern), list);
|
||||
return list;
|
||||
|
@ -588,7 +588,7 @@ xfont_match (Lisp_Object frame, Lisp_Object spec)
|
|||
if (xfont_encode_coding_xlfd (name) < 0)
|
||||
return Qnil;
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
entity = Qnil;
|
||||
xfont = XLoadQueryFont (display, name);
|
||||
if (xfont)
|
||||
|
@ -615,7 +615,7 @@ xfont_match (Lisp_Object frame, Lisp_Object spec)
|
|||
}
|
||||
XFreeFont (display, xfont);
|
||||
}
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
|
||||
FONT_ADD_LOG ("xfont-match", spec, entity);
|
||||
return entity;
|
||||
|
@ -632,7 +632,7 @@ xfont_list_family (Lisp_Object frame)
|
|||
char *last_family IF_LINT (= 0);
|
||||
int last_len;
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
x_catch_errors (dpyinfo->display);
|
||||
names = XListFonts (dpyinfo->display, "-*-*-*-*-*-*-*-*-*-*-*-*-*-*",
|
||||
0x8000, &num_fonts);
|
||||
|
@ -673,7 +673,7 @@ xfont_list_family (Lisp_Object frame)
|
|||
|
||||
XFreeFontNames (names);
|
||||
x_uncatch_errors ();
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
|
||||
return list;
|
||||
}
|
||||
|
@ -717,7 +717,7 @@ xfont_open (FRAME_PTR f, Lisp_Object entity, int pixel_size)
|
|||
return Qnil;
|
||||
}
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
x_catch_errors (display);
|
||||
xfont = XLoadQueryFont (display, name);
|
||||
if (x_had_errors_p (display))
|
||||
|
@ -784,7 +784,7 @@ xfont_open (FRAME_PTR f, Lisp_Object entity, int pixel_size)
|
|||
XFree (p0);
|
||||
}
|
||||
x_uncatch_errors ();
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
|
||||
if (! xfont)
|
||||
{
|
||||
|
@ -866,7 +866,7 @@ xfont_open (FRAME_PTR f, Lisp_Object entity, int pixel_size)
|
|||
}
|
||||
}
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
font->underline_thickness
|
||||
= (XGetFontProperty (xfont, XA_UNDERLINE_THICKNESS, &value)
|
||||
? (long) value : 0);
|
||||
|
@ -882,7 +882,7 @@ xfont_open (FRAME_PTR f, Lisp_Object entity, int pixel_size)
|
|||
font->default_ascent
|
||||
= (XGetFontProperty (xfont, dpyinfo->Xatom_MULE_DEFAULT_ASCENT, &value)
|
||||
? (long) value : 0);
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
|
||||
if (NILP (fullname))
|
||||
fullname = AREF (font_object, FONT_NAME_INDEX);
|
||||
|
@ -897,18 +897,18 @@ xfont_open (FRAME_PTR f, Lisp_Object entity, int pixel_size)
|
|||
static void
|
||||
xfont_close (FRAME_PTR f, struct font *font)
|
||||
{
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
XFreeFont (FRAME_X_DISPLAY (f), ((struct xfont_info *) font)->xfont);
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
}
|
||||
|
||||
static int
|
||||
xfont_prepare_face (FRAME_PTR f, struct face *face)
|
||||
{
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
XSetFont (FRAME_X_DISPLAY (f), face->gc,
|
||||
((struct xfont_info *) face->font)->xfont->fid);
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -1028,9 +1028,9 @@ xfont_draw (struct glyph_string *s, int from, int to, int x, int y,
|
|||
|
||||
if (s->gc != s->face->gc)
|
||||
{
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
XSetFont (s->display, gc, xfont->fid);
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
}
|
||||
|
||||
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,
|
|||
char *str = SAFE_ALLOCA (len);
|
||||
for (i = 0; i < len ; i++)
|
||||
str[i] = XCHAR2B_BYTE2 (s->char2b + from + i);
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
if (with_background)
|
||||
{
|
||||
if (s->padding_p)
|
||||
|
@ -1060,12 +1060,12 @@ xfont_draw (struct glyph_string *s, int from, int to, int x, int y,
|
|||
XDrawString (FRAME_X_DISPLAY (s->f), FRAME_X_WINDOW (s->f),
|
||||
gc, x, y, str, len);
|
||||
}
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
SAFE_FREE ();
|
||||
return s->nchars;
|
||||
}
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
if (with_background)
|
||||
{
|
||||
if (s->padding_p)
|
||||
|
@ -1086,7 +1086,7 @@ xfont_draw (struct glyph_string *s, int from, int to, int x, int y,
|
|||
XDrawString16 (FRAME_X_DISPLAY (s->f), FRAME_X_WINDOW (s->f),
|
||||
gc, x, y, s->char2b + from, len);
|
||||
}
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
|
||||
return len;
|
||||
}
|
||||
|
|
|
@ -93,7 +93,7 @@ xftfont_get_colors (FRAME_PTR f, struct face *face, GC gc, struct xftface_info *
|
|||
XGCValues xgcv;
|
||||
bool fg_done = 0, bg_done = 0;
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
XGetGCValues (FRAME_X_DISPLAY (f), gc,
|
||||
GCForeground | GCBackground, &xgcv);
|
||||
if (xftface_info)
|
||||
|
@ -131,7 +131,7 @@ xftfont_get_colors (FRAME_PTR f, struct face *face, GC gc, struct xftface_info *
|
|||
bg->color.blue = colors[1].blue;
|
||||
}
|
||||
}
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -324,7 +324,7 @@ xftfont_open (FRAME_PTR f, Lisp_Object entity, int pixel_size)
|
|||
FcPatternAddInteger (pat, FC_INDEX, XINT (idx));
|
||||
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
/* Make sure that the Xrender extension is added before the Xft one.
|
||||
Otherwise, the close-display hook set by Xft is called after the
|
||||
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)
|
|||
xftfont = XftFontOpenPattern (display, match);
|
||||
if (!xftfont)
|
||||
{
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
XftPatternDestroy (match);
|
||||
return Qnil;
|
||||
}
|
||||
ft_face = XftLockFace (xftfont);
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
|
||||
/* We should not destroy PAT here because it is kept in XFTFONT and
|
||||
destroyed automatically when XFTFONT is closed. */
|
||||
|
@ -399,7 +399,7 @@ xftfont_open (FRAME_PTR f, Lisp_Object entity, int pixel_size)
|
|||
for (ch = 0; ch < 95; ch++)
|
||||
ascii_printable[ch] = ' ' + ch;
|
||||
}
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
|
||||
/* Unfortunately Xft doesn't provide a way to get minimum char
|
||||
width. So, we set min_width to space_width. */
|
||||
|
@ -425,7 +425,7 @@ xftfont_open (FRAME_PTR f, Lisp_Object entity, int pixel_size)
|
|||
XftTextExtents8 (display, xftfont, ascii_printable + 1, 94, &extents);
|
||||
font->average_width = (font->space_width + extents.xOff) / 95;
|
||||
}
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
|
||||
font->ascent = xftfont->ascent;
|
||||
font->descent = xftfont->descent;
|
||||
|
@ -494,10 +494,10 @@ xftfont_close (FRAME_PTR f, struct font *font)
|
|||
if (xftfont_info->otf)
|
||||
OTF_close (xftfont_info->otf);
|
||||
#endif
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
XftUnlockFace (xftfont_info->xftfont);
|
||||
XftFontClose (xftfont_info->display, xftfont_info->xftfont);
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -581,10 +581,10 @@ xftfont_text_extents (struct font *font, unsigned int *code, int nglyphs, struct
|
|||
struct xftfont_info *xftfont_info = (struct xftfont_info *) font;
|
||||
XGlyphInfo extents;
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
XftGlyphExtents (xftfont_info->display, xftfont_info->xftfont, code, nglyphs,
|
||||
&extents);
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
if (metrics)
|
||||
{
|
||||
metrics->lbearing = - extents.x;
|
||||
|
@ -603,12 +603,12 @@ xftfont_get_xft_draw (FRAME_PTR f)
|
|||
|
||||
if (! xft_draw)
|
||||
{
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
xft_draw= XftDrawCreate (FRAME_X_DISPLAY (f),
|
||||
FRAME_X_WINDOW (f),
|
||||
FRAME_X_VISUAL (f),
|
||||
FRAME_X_COLORMAP (f));
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
eassert (xft_draw != NULL);
|
||||
font_put_frame_data (f, &xftfont_driver, xft_draw);
|
||||
}
|
||||
|
@ -633,7 +633,7 @@ xftfont_draw (struct glyph_string *s, int from, int to, int x, int y,
|
|||
xftface_info = (struct xftface_info *) face->extra;
|
||||
xftfont_get_colors (f, face, s->gc, xftface_info,
|
||||
&fg, with_background ? &bg : NULL);
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
if (s->num_clips > 0)
|
||||
XftDrawSetClipRectangles (xft_draw, 0, 0, s->clip, s->num_clips);
|
||||
else
|
||||
|
@ -654,7 +654,7 @@ xftfont_draw (struct glyph_string *s, int from, int to, int x, int y,
|
|||
else
|
||||
XftDrawGlyphs (xft_draw, &fg, xftfont_info->xftfont,
|
||||
x, y, code, len);
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
|
||||
return len;
|
||||
}
|
||||
|
@ -690,9 +690,9 @@ xftfont_end_for_frame (FRAME_PTR f)
|
|||
|
||||
if (xft_draw)
|
||||
{
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
XftDrawDestroy (xft_draw);
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
font_put_frame_data (f, &xftfont_driver, NULL);
|
||||
}
|
||||
return 0;
|
||||
|
|
54
src/xmenu.c
54
src/xmenu.c
|
@ -165,7 +165,7 @@ mouse_position_for_popup (FRAME_PTR f, int *x, int *y)
|
|||
if (! FRAME_X_P (f))
|
||||
emacs_abort ();
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
|
||||
XQueryPointer (FRAME_X_DISPLAY (f),
|
||||
DefaultRootWindow (FRAME_X_DISPLAY (f)),
|
||||
|
@ -186,7 +186,7 @@ mouse_position_for_popup (FRAME_PTR f, int *x, int *y)
|
|||
we don't care. */
|
||||
(unsigned int *) &dummy);
|
||||
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
|
||||
/* xmenu_show expects window coordinates, not root window
|
||||
coordinates. Translate. */
|
||||
|
@ -328,9 +328,9 @@ for instance using the window manager, then this produces a quit and
|
|||
list_of_panes (Fcons (contents, Qnil));
|
||||
|
||||
/* Display them in a dialog box. */
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
selection = xdialog_show (f, 0, title, header, &error_name);
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
|
||||
unbind_to (specpdl_count, Qnil);
|
||||
discard_menu_items ();
|
||||
|
@ -490,7 +490,7 @@ If FRAME is nil or not given, use the selected frame. */)
|
|||
XEvent ev;
|
||||
FRAME_PTR f = check_x_frame (frame);
|
||||
Widget menubar;
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
|
||||
if (FRAME_EXTERNAL_MENU_BAR (f))
|
||||
set_frame_menubar (f, 0, 1);
|
||||
|
@ -548,7 +548,7 @@ If FRAME is nil or not given, use the selected frame. */)
|
|||
}
|
||||
}
|
||||
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
|
||||
return Qnil;
|
||||
}
|
||||
|
@ -569,9 +569,9 @@ If FRAME is nil or not given, use the selected frame. */)
|
|||
FRAME_PTR f;
|
||||
|
||||
/* gcc 2.95 doesn't accept the FRAME_PTR declaration after
|
||||
BLOCK_INPUT. */
|
||||
block_input (). */
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
f = check_x_frame (frame);
|
||||
|
||||
if (FRAME_EXTERNAL_MENU_BAR (f))
|
||||
|
@ -590,7 +590,7 @@ If FRAME is nil or not given, use the selected frame. */)
|
|||
g_list_free (children);
|
||||
}
|
||||
}
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
|
||||
return Qnil;
|
||||
}
|
||||
|
@ -642,7 +642,7 @@ x_activate_menubar (FRAME_PTR f)
|
|||
#endif
|
||||
|
||||
set_frame_menubar (f, 0, 1);
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
popup_activated_flag = 1;
|
||||
#ifdef USE_GTK
|
||||
XPutBackEvent (f->output_data.x->display_info->display,
|
||||
|
@ -650,7 +650,7 @@ x_activate_menubar (FRAME_PTR f)
|
|||
#else
|
||||
XtDispatchEvent (f->output_data.x->saved_menu_event);
|
||||
#endif
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
|
||||
/* Ignore this if we get it a second time. */
|
||||
f->output_data.x->saved_menu_event->type = 0;
|
||||
|
@ -803,10 +803,10 @@ menubar_selection_callback (GtkWidget *widget, gpointer client_data)
|
|||
sit-for will exit at once if the focus event follows the menu selection
|
||||
event. */
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
while (gtk_events_pending ())
|
||||
gtk_main_iteration ();
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
|
||||
find_and_call_menu_selection (cb_data->cl_data->f,
|
||||
cb_data->cl_data->menu_bar_items_used,
|
||||
|
@ -853,7 +853,7 @@ update_frame_menubar (FRAME_PTR f)
|
|||
if (!x->menubar_widget || XtIsManaged (x->menubar_widget))
|
||||
return 0;
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
/* Save the size of the frame because the pane widget doesn't accept
|
||||
to resize itself. So force it. */
|
||||
columns = FRAME_COLS (f);
|
||||
|
@ -880,7 +880,7 @@ update_frame_menubar (FRAME_PTR f)
|
|||
|
||||
/* Force the pane widget to resize itself with the right values. */
|
||||
EmacsFrameSetCharSize (x->edit_widget, columns, rows);
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
|
@ -1164,7 +1164,7 @@ set_frame_menubar (FRAME_PTR f, int first_time, int deep_p)
|
|||
|
||||
/* Create or update the menu bar widget. */
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
|
||||
#ifdef USE_GTK
|
||||
xg_crazy_callback_abort = 1;
|
||||
|
@ -1264,7 +1264,7 @@ set_frame_menubar (FRAME_PTR f, int first_time, int deep_p)
|
|||
xg_crazy_callback_abort = 0;
|
||||
#endif
|
||||
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
}
|
||||
|
||||
/* Called from Fx_create_frame to create the initial menubar of a frame
|
||||
|
@ -1313,7 +1313,7 @@ free_frame_menubar (FRAME_PTR f)
|
|||
Position x0, y0, x1, y1;
|
||||
#endif
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
|
||||
#ifdef USE_MOTIF
|
||||
if (f->output_data.x->widget)
|
||||
|
@ -1332,7 +1332,7 @@ free_frame_menubar (FRAME_PTR f)
|
|||
#endif
|
||||
x_set_window_size (f, 0, FRAME_COLS (f), FRAME_LINES (f));
|
||||
}
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
}
|
||||
}
|
||||
#endif /* not USE_GTK */
|
||||
|
@ -1417,9 +1417,9 @@ pop_down_menu (Lisp_Object arg)
|
|||
struct Lisp_Save_Value *p = XSAVE_VALUE (arg);
|
||||
|
||||
popup_activated_flag = 0;
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
gtk_widget_destroy (GTK_WIDGET (p->pointer));
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
|
@ -1527,9 +1527,9 @@ pop_down_menu (Lisp_Object arg)
|
|||
LWLIB_ID id = (XINT (XCAR (arg)) << 4 * sizeof (LWLIB_ID)
|
||||
| XINT (XCDR (arg)));
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
lw_destroy_all_widgets (id);
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
popup_activated_flag = 0;
|
||||
|
||||
return Qnil;
|
||||
|
@ -1955,9 +1955,9 @@ dialog_selection_callback (Widget widget, LWLIB_ID id, XtPointer client_data)
|
|||
if ((intptr_t) client_data != -1)
|
||||
menu_item_selection = (Lisp_Object *) client_data;
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
lw_destroy_all_widgets (id);
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
popup_activated_flag = 0;
|
||||
}
|
||||
|
||||
|
@ -2251,7 +2251,7 @@ pop_down_menu (Lisp_Object arg)
|
|||
FRAME_PTR f = p1->pointer;
|
||||
XMenu *menu = p2->pointer;
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
#ifndef MSDOS
|
||||
XUngrabPointer (FRAME_X_DISPLAY (f), CurrentTime);
|
||||
XUngrabKeyboard (FRAME_X_DISPLAY (f), CurrentTime);
|
||||
|
@ -2271,7 +2271,7 @@ pop_down_menu (Lisp_Object arg)
|
|||
|
||||
#endif /* HAVE_X_WINDOWS */
|
||||
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
|
||||
return Qnil;
|
||||
}
|
||||
|
|
100
src/xselect.c
100
src/xselect.c
|
@ -247,9 +247,9 @@ symbol_to_x_atom (struct x_display_info *dpyinfo, Lisp_Object sym)
|
|||
if (!SYMBOLP (sym)) emacs_abort ();
|
||||
|
||||
TRACE1 (" XInternAtom %s", SSDATA (SYMBOL_NAME (sym)));
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
val = XInternAtom (dpyinfo->display, SSDATA (SYMBOL_NAME (sym)), False);
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
return val;
|
||||
}
|
||||
|
||||
|
@ -307,16 +307,16 @@ x_atom_to_symbol (Display *dpy, Atom atom)
|
|||
if (atom == dpyinfo->Xatom_NULL)
|
||||
return QNULL;
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
str = XGetAtomName (dpy, atom);
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
TRACE1 ("XGetAtomName --> %s", str);
|
||||
if (! str) return Qnil;
|
||||
val = intern (str);
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
/* This was allocated by Xlib, so use XFree. */
|
||||
XFree (str);
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
return val;
|
||||
}
|
||||
|
||||
|
@ -336,12 +336,12 @@ x_own_selection (Lisp_Object selection_name, Lisp_Object selection_value,
|
|||
Time timestamp = last_event_timestamp;
|
||||
Atom selection_atom = symbol_to_x_atom (dpyinfo, selection_name);
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
x_catch_errors (display);
|
||||
XSetSelectionOwner (display, selection_atom, selecting_window, timestamp);
|
||||
x_check_errors (display, "Can't set selection: %s");
|
||||
x_uncatch_errors ();
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
|
||||
/* Now update the local cache */
|
||||
{
|
||||
|
@ -469,12 +469,12 @@ x_decline_selection_request (struct input_event *event)
|
|||
|
||||
/* The reason for the error may be that the receiver has
|
||||
died in the meantime. Handle that case. */
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
x_catch_errors (reply->display);
|
||||
XSendEvent (reply->display, reply->requestor, False, 0L, &reply_base);
|
||||
XFlush (reply->display);
|
||||
x_uncatch_errors ();
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
}
|
||||
|
||||
/* This is the selection request currently being processed.
|
||||
|
@ -536,9 +536,9 @@ x_selection_request_lisp_error (Lisp_Object ignore)
|
|||
static Lisp_Object
|
||||
x_catch_errors_unwind (Lisp_Object dummy)
|
||||
{
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
x_uncatch_errors ();
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
|
@ -610,7 +610,7 @@ x_reply_selection_request (struct input_event *event,
|
|||
if (reply->property == None)
|
||||
reply->property = reply->target;
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
/* The protected block contains wait_for_property_change, which can
|
||||
run random lisp code (process handlers) or signal. Therefore, we
|
||||
put the x_uncatch_errors call in an unwind. */
|
||||
|
@ -682,7 +682,7 @@ x_reply_selection_request (struct input_event *event,
|
|||
{
|
||||
int format_bytes = cs->format / 8;
|
||||
int had_errors = x_had_errors_p (display);
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
|
||||
bytes_remaining = cs->size;
|
||||
bytes_remaining *= format_bytes;
|
||||
|
@ -703,7 +703,7 @@ x_reply_selection_request (struct input_event *event,
|
|||
int i = ((bytes_remaining < max_bytes)
|
||||
? bytes_remaining
|
||||
: max_bytes) / format_bytes;
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
|
||||
cs->wait_object
|
||||
= expect_property_change (display, window, cs->property,
|
||||
|
@ -722,7 +722,7 @@ x_reply_selection_request (struct input_event *event,
|
|||
: format_bytes);
|
||||
XFlush (display);
|
||||
had_errors = x_had_errors_p (display);
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
|
||||
if (had_errors) break;
|
||||
|
||||
|
@ -735,7 +735,7 @@ x_reply_selection_request (struct input_event *event,
|
|||
|
||||
/* Now write a zero-length chunk to the property to tell the
|
||||
requestor that we're done. */
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
if (! waiting_for_other_props_on_window (display, window))
|
||||
XSelectInput (display, window, 0L);
|
||||
|
||||
|
@ -757,15 +757,15 @@ x_reply_selection_request (struct input_event *event,
|
|||
/* 2004-09-10: XSync and UNBLOCK so that possible protocol errors are
|
||||
delivered before uncatch errors. */
|
||||
XSync (display, False);
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
|
||||
/* GTK queues events in addition to the queue in Xlib. So we
|
||||
UNBLOCK to enter the event loop and get possible errors delivered,
|
||||
and then BLOCK again because x_uncatch_errors requires it. */
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
/* This calls x_uncatch_errors. */
|
||||
unbind_to (count, Qnil);
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
}
|
||||
|
||||
/* Handle a SelectionRequest event EVENT.
|
||||
|
@ -1232,7 +1232,7 @@ x_get_foreign_selection (Lisp_Object selection_symbol, Lisp_Object target_type,
|
|||
if (! NILP (time_stamp))
|
||||
CONS_TO_INTEGER (time_stamp, Time, requestor_time);
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
TRACE2 ("Get selection %s, type %s",
|
||||
XGetAtomName (display, type_atom),
|
||||
XGetAtomName (display, target_property));
|
||||
|
@ -1257,7 +1257,7 @@ x_get_foreign_selection (Lisp_Object selection_symbol, Lisp_Object target_type,
|
|||
record_unwind_protect (queue_selection_requests_unwind, Qnil);
|
||||
#endif
|
||||
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
|
||||
/* This allows quits. Also, don't wait forever. */
|
||||
timeout = max (0, x_selection_timeout);
|
||||
|
@ -1309,7 +1309,7 @@ x_get_window_property (Display *display, Window window, Atom property,
|
|||
? min (PTRDIFF_MAX, SIZE_MAX) - 1
|
||||
: LONG_MAX * x_long_size);
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
|
||||
/* First probe the thing to find out how big it is. */
|
||||
result = XGetWindowProperty (display, window, property,
|
||||
|
@ -1410,19 +1410,19 @@ x_get_window_property (Display *display, Window window, Atom property,
|
|||
data[offset] = '\0';
|
||||
|
||||
done:
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
*data_ret = data;
|
||||
*bytes_ret = offset;
|
||||
return;
|
||||
|
||||
size_overflow:
|
||||
free (data);
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
memory_full (SIZE_MAX);
|
||||
|
||||
memory_exhausted:
|
||||
free (data);
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
memory_full (total_size + 1);
|
||||
}
|
||||
|
||||
|
@ -1454,7 +1454,7 @@ receive_incremental_selection (Display *display, Window window, Atom property,
|
|||
that property, then reading the property, then deleting it to ack.
|
||||
We are done when the sender places a property of length 0.
|
||||
*/
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
XSelectInput (display, window, STANDARD_EVENT_SET | PropertyChangeMask);
|
||||
TRACE1 (" Delete property %s",
|
||||
SDATA (SYMBOL_NAME (x_atom_to_symbol (display, property))));
|
||||
|
@ -1464,7 +1464,7 @@ receive_incremental_selection (Display *display, Window window, Atom property,
|
|||
wait_object = expect_property_change (display, window, property,
|
||||
PropertyNewValue);
|
||||
XFlush (display);
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
|
||||
while (1)
|
||||
{
|
||||
|
@ -1496,14 +1496,14 @@ receive_incremental_selection (Display *display, Window window, Atom property,
|
|||
break;
|
||||
}
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
TRACE1 (" ACK by deleting property %s",
|
||||
XGetAtomName (display, property));
|
||||
XDeleteProperty (display, window, property);
|
||||
wait_object = expect_property_change (display, window, property,
|
||||
PropertyNewValue);
|
||||
XFlush (display);
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
|
||||
if (*size_bytes_ret - offset < tmp_size_bytes)
|
||||
*data_ret = xpalloc (*data_ret, size_bytes_ret,
|
||||
|
@ -1545,10 +1545,10 @@ x_get_window_property_as_lisp_data (Display *display, Window window,
|
|||
if (! data)
|
||||
{
|
||||
int there_is_a_selection_owner;
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
there_is_a_selection_owner
|
||||
= XGetSelectionOwner (display, selection_atom);
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
if (there_is_a_selection_owner)
|
||||
signal_error ("Selection owner couldn't convert",
|
||||
actual_type
|
||||
|
@ -1565,22 +1565,22 @@ x_get_window_property_as_lisp_data (Display *display, Window window,
|
|||
/* That wasn't really the data, just the beginning. */
|
||||
|
||||
unsigned int min_size_bytes = * ((unsigned int *) data);
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
/* Use xfree, not XFree, because x_get_window_property
|
||||
calls xmalloc itself. */
|
||||
xfree (data);
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
receive_incremental_selection (display, window, property, target_type,
|
||||
min_size_bytes, &data, &bytes,
|
||||
&actual_type, &actual_format,
|
||||
&actual_size);
|
||||
}
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
TRACE1 (" Delete property %s", XGetAtomName (display, property));
|
||||
XDeleteProperty (display, window, property);
|
||||
XFlush (display);
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
|
||||
/* It's been read. Now convert it to a lisp object in some semi-rational
|
||||
manner. */
|
||||
|
@ -2096,13 +2096,13 @@ On MS-DOS, all this does is return non-nil if we own the selection. */)
|
|||
|
||||
selection_atom = symbol_to_x_atom (dpyinfo, selection);
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
if (NILP (time_object))
|
||||
timestamp = last_event_timestamp;
|
||||
else
|
||||
CONS_TO_INTEGER (time_object, Time, timestamp);
|
||||
XSetSelectionOwner (dpyinfo->display, selection_atom, None, timestamp);
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
|
||||
/* It doesn't seem to be guaranteed that a SelectionClear event will be
|
||||
generated for a window which owns the selection when that window sets
|
||||
|
@ -2179,9 +2179,9 @@ On Nextstep, TERMINAL is unused. */)
|
|||
|
||||
atom = symbol_to_x_atom (dpyinfo, selection);
|
||||
if (atom == 0) return Qnil;
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
owner = XGetSelectionOwner (dpyinfo->display, atom);
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
return (owner ? Qt : Qnil);
|
||||
}
|
||||
|
||||
|
@ -2353,9 +2353,9 @@ x_fill_property_data (Display *dpy, Lisp_Object data, void *ret, int format)
|
|||
val = cons_to_signed (o, LONG_MIN, LONG_MAX);
|
||||
else if (STRINGP (o))
|
||||
{
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
val = (long) XInternAtom (dpy, SSDATA (o), False);
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
}
|
||||
else
|
||||
error ("Wrong type, must be string, number or cons");
|
||||
|
@ -2413,7 +2413,7 @@ mouse_position_for_drop (FRAME_PTR f, int *x, int *y)
|
|||
Window root, dummy_window;
|
||||
int dummy;
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
|
||||
XQueryPointer (FRAME_X_DISPLAY (f),
|
||||
DefaultRootWindow (FRAME_X_DISPLAY (f)),
|
||||
|
@ -2439,7 +2439,7 @@ mouse_position_for_drop (FRAME_PTR f, int *x, int *y)
|
|||
*x -= f->left_pos + FRAME_OUTER_TO_INNER_DIFF_X (f);
|
||||
*y -= f->top_pos + FRAME_OUTER_TO_INNER_DIFF_Y (f);
|
||||
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
}
|
||||
|
||||
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. */)
|
|||
|
||||
CONS_TO_INTEGER (value, Atom, atom);
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
x_catch_errors (dpy);
|
||||
name = atom ? XGetAtomName (dpy, atom) : empty;
|
||||
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. */)
|
|||
if (atom && name) XFree (name);
|
||||
if (NILP (ret)) ret = empty_unibyte_string;
|
||||
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -2496,9 +2496,9 @@ FRAME is on. If FRAME is nil, the selected frame is used. */)
|
|||
x_atom = symbol_to_x_atom (dpyinfo, atom);
|
||||
else if (STRINGP (atom))
|
||||
{
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
x_atom = XInternAtom (FRAME_X_DISPLAY (f), SSDATA (atom), False);
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
}
|
||||
else
|
||||
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,
|
|||
if (wdest == 0) wdest = dpyinfo->root_window;
|
||||
to_root = wdest == dpyinfo->root_window;
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
|
||||
event.xclient.message_type = message_type;
|
||||
event.xclient.display = dpyinfo->display;
|
||||
|
@ -2683,7 +2683,7 @@ x_send_client_event (Lisp_Object display, Lisp_Object dest, Lisp_Object from,
|
|||
XFlush (dpyinfo->display);
|
||||
}
|
||||
x_uncatch_errors ();
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -929,7 +929,7 @@ init_xsettings (struct x_display_info *dpyinfo)
|
|||
{
|
||||
Display *dpy = dpyinfo->display;
|
||||
|
||||
BLOCK_INPUT;
|
||||
block_input ();
|
||||
|
||||
/* Select events so we can detect client messages sent when selection
|
||||
owner changes. */
|
||||
|
@ -939,7 +939,7 @@ init_xsettings (struct x_display_info *dpyinfo)
|
|||
if (dpyinfo->xsettings_window != None)
|
||||
read_and_apply_settings (dpyinfo, False);
|
||||
|
||||
UNBLOCK_INPUT;
|
||||
unblock_input ();
|
||||
}
|
||||
|
||||
void
|
||||
|
|
302
src/xterm.c
302
src/xterm.c
File diff suppressed because it is too large
Load diff
Loading…
Add table
Reference in a new issue