aboutsummaryrefslogtreecommitdiffstats
path: root/src/keyboard.c
diff options
context:
space:
mode:
authorJoakim Verona2012-09-03 17:30:17 +0200
committerJoakim Verona2012-09-03 17:30:17 +0200
commit4a37733c693d59a9b83a3fb2d0c7f9461d149f60 (patch)
treea33402e09342f748baebf0e4f5a1e40538e620f4 /src/keyboard.c
parent5436d1df5e2ba0b4d4f72b03a1cd09b20403654b (diff)
parentdcde497f27945c3ca4ce8c21f655ef6f627acdd2 (diff)
downloademacs-4a37733c693d59a9b83a3fb2d0c7f9461d149f60.tar.gz
emacs-4a37733c693d59a9b83a3fb2d0c7f9461d149f60.zip
upstream
Diffstat (limited to 'src/keyboard.c')
-rw-r--r--src/keyboard.c52
1 files changed, 18 insertions, 34 deletions
diff --git a/src/keyboard.c b/src/keyboard.c
index 7b9be358caa..9d103d673b2 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -63,20 +63,11 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
63#include <unistd.h> 63#include <unistd.h>
64#include <fcntl.h> 64#include <fcntl.h>
65 65
66/* This is to get the definitions of the XK_ symbols. */ 66#ifdef HAVE_WINDOW_SYSTEM
67#ifdef HAVE_X_WINDOWS 67#include TERM_HEADER
68#include "xterm.h" 68#endif /* HAVE_WINDOW_SYSTEM */
69#endif
70
71#ifdef HAVE_NTGUI
72#include "w32term.h"
73#endif /* HAVE_NTGUI */
74
75#ifdef HAVE_NS
76#include "nsterm.h"
77#endif
78 69
79/* Variables for blockinput.h: */ 70/* Variables for blockinput.h: */
80 71
81/* Non-zero if interrupt input is blocked right now. */ 72/* Non-zero if interrupt input is blocked right now. */
82volatile int interrupt_input_blocked; 73volatile int interrupt_input_blocked;
@@ -1437,8 +1428,7 @@ command_loop_1 (void)
1437 Fkill_emacs (Qnil); 1428 Fkill_emacs (Qnil);
1438 1429
1439 /* Make sure the current window's buffer is selected. */ 1430 /* Make sure the current window's buffer is selected. */
1440 if (XBUFFER (XWINDOW (selected_window)->buffer) != current_buffer) 1431 set_buffer_internal (XBUFFER (XWINDOW (selected_window)->buffer));
1441 set_buffer_internal (XBUFFER (XWINDOW (selected_window)->buffer));
1442 1432
1443 /* Display any malloc warning that just came out. Use while because 1433 /* Display any malloc warning that just came out. Use while because
1444 displaying one warning can cause another. */ 1434 displaying one warning can cause another. */
@@ -1516,8 +1506,7 @@ command_loop_1 (void)
1516 /* A filter may have run while we were reading the input. */ 1506 /* A filter may have run while we were reading the input. */
1517 if (! FRAME_LIVE_P (XFRAME (selected_frame))) 1507 if (! FRAME_LIVE_P (XFRAME (selected_frame)))
1518 Fkill_emacs (Qnil); 1508 Fkill_emacs (Qnil);
1519 if (XBUFFER (XWINDOW (selected_window)->buffer) != current_buffer) 1509 set_buffer_internal (XBUFFER (XWINDOW (selected_window)->buffer));
1520 set_buffer_internal (XBUFFER (XWINDOW (selected_window)->buffer));
1521 1510
1522 ++num_input_keys; 1511 ++num_input_keys;
1523 1512
@@ -4360,9 +4349,8 @@ struct input_event last_timer_event EXTERNALLY_VISIBLE;
4360 ...). Each element has the form (FUN . ARGS). */ 4349 ...). Each element has the form (FUN . ARGS). */
4361Lisp_Object pending_funcalls; 4350Lisp_Object pending_funcalls;
4362 4351
4363/* If TIMER is a valid timer, return nonzero and place its value into 4352/* Return true if TIMER is a valid timer, placing its value into *RESULT. */
4364 *RESULT. Otherwise return zero. */ 4353static bool
4365static int
4366decode_timer (Lisp_Object timer, EMACS_TIME *result) 4354decode_timer (Lisp_Object timer, EMACS_TIME *result)
4367{ 4355{
4368 Lisp_Object *vector; 4356 Lisp_Object *vector;
@@ -4429,7 +4417,6 @@ timer_check_2 (void)
4429 4417
4430 while (CONSP (timers) || CONSP (idle_timers)) 4418 while (CONSP (timers) || CONSP (idle_timers))
4431 { 4419 {
4432 Lisp_Object *vector;
4433 Lisp_Object timer = Qnil, idle_timer = Qnil; 4420 Lisp_Object timer = Qnil, idle_timer = Qnil;
4434 EMACS_TIME timer_time, idle_timer_time; 4421 EMACS_TIME timer_time, idle_timer_time;
4435 EMACS_TIME difference; 4422 EMACS_TIME difference;
@@ -4505,15 +4492,14 @@ timer_check_2 (void)
4505 /* If timer is ripe, run it if it hasn't been run. */ 4492 /* If timer is ripe, run it if it hasn't been run. */
4506 if (ripe) 4493 if (ripe)
4507 { 4494 {
4508 vector = XVECTOR (chosen_timer)->contents; 4495 if (NILP (AREF (chosen_timer, 0)))
4509 if (NILP (vector[0]))
4510 { 4496 {
4511 ptrdiff_t count = SPECPDL_INDEX (); 4497 ptrdiff_t count = SPECPDL_INDEX ();
4512 Lisp_Object old_deactivate_mark = Vdeactivate_mark; 4498 Lisp_Object old_deactivate_mark = Vdeactivate_mark;
4513 4499
4514 /* Mark the timer as triggered to prevent problems if the lisp 4500 /* Mark the timer as triggered to prevent problems if the lisp
4515 code fails to reschedule it right. */ 4501 code fails to reschedule it right. */
4516 vector[0] = Qt; 4502 ASET (chosen_timer, 0, Qt);
4517 4503
4518 specbind (Qinhibit_quit, Qt); 4504 specbind (Qinhibit_quit, Qt);
4519 4505
@@ -8463,7 +8449,6 @@ init_tool_bar_items (Lisp_Object reuse)
8463static void 8449static void
8464append_tool_bar_item (void) 8450append_tool_bar_item (void)
8465{ 8451{
8466 Lisp_Object *to, *from;
8467 ptrdiff_t incr = 8452 ptrdiff_t incr =
8468 (ntool_bar_items 8453 (ntool_bar_items
8469 - (ASIZE (tool_bar_items_vector) - TOOL_BAR_ITEM_NSLOTS)); 8454 - (ASIZE (tool_bar_items_vector) - TOOL_BAR_ITEM_NSLOTS));
@@ -8475,9 +8460,8 @@ append_tool_bar_item (void)
8475 8460
8476 /* Append entries from tool_bar_item_properties to the end of 8461 /* Append entries from tool_bar_item_properties to the end of
8477 tool_bar_items_vector. */ 8462 tool_bar_items_vector. */
8478 to = XVECTOR (tool_bar_items_vector)->contents + ntool_bar_items; 8463 vcopy (tool_bar_items_vector, ntool_bar_items,
8479 from = XVECTOR (tool_bar_item_properties)->contents; 8464 XVECTOR (tool_bar_item_properties)->contents, TOOL_BAR_ITEM_NSLOTS);
8480 memcpy (to, from, TOOL_BAR_ITEM_NSLOTS * sizeof *to);
8481 ntool_bar_items += TOOL_BAR_ITEM_NSLOTS; 8465 ntool_bar_items += TOOL_BAR_ITEM_NSLOTS;
8482} 8466}
8483 8467
@@ -9594,7 +9578,7 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt,
9594 because we may get input from a subprocess which 9578 because we may get input from a subprocess which
9595 wants to change the selected window and stuff (say, 9579 wants to change the selected window and stuff (say,
9596 emacsclient). */ 9580 emacsclient). */
9597 record_unwind_protect (Fset_buffer, Fcurrent_buffer ()); 9581 record_unwind_current_buffer ();
9598 9582
9599 if (! FRAME_LIVE_P (XFRAME (selected_frame))) 9583 if (! FRAME_LIVE_P (XFRAME (selected_frame)))
9600 Fkill_emacs (Qnil); 9584 Fkill_emacs (Qnil);
@@ -10506,10 +10490,10 @@ DEFUN ("recent-keys", Frecent_keys, Srecent_keys, 0, 0, 0,
10506 else 10490 else
10507 { 10491 {
10508 val = Fvector (NUM_RECENT_KEYS, keys); 10492 val = Fvector (NUM_RECENT_KEYS, keys);
10509 memcpy (XVECTOR (val)->contents, keys + recent_keys_index, 10493 vcopy (val, 0, keys + recent_keys_index,
10510 (NUM_RECENT_KEYS - recent_keys_index) * word_size); 10494 NUM_RECENT_KEYS - recent_keys_index);
10511 memcpy (XVECTOR (val)->contents + NUM_RECENT_KEYS - recent_keys_index, 10495 vcopy (val, NUM_RECENT_KEYS - recent_keys_index,
10512 keys, recent_keys_index * word_size); 10496 keys, recent_keys_index);
10513 return val; 10497 return val;
10514 } 10498 }
10515} 10499}
@@ -11271,7 +11255,7 @@ The `posn-' functions access elements of such lists. */)
11271 11255
11272 if (WINDOWP (frame_or_window)) 11256 if (WINDOWP (frame_or_window))
11273 { 11257 {
11274 struct window *w = decode_valid_window (frame_or_window); 11258 struct window *w = decode_live_window (frame_or_window);
11275 11259
11276 XSETINT (x, (XINT (x) 11260 XSETINT (x, (XINT (x)
11277 + WINDOW_LEFT_EDGE_X (w) 11261 + WINDOW_LEFT_EDGE_X (w)