aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKenichi Handa2011-05-19 09:37:36 +0900
committerKenichi Handa2011-05-19 09:37:36 +0900
commit23373930daa192623bfda56960ccb04b2703fbe5 (patch)
tree4350ad7774b3d4dc6f2ccf0e6343b505582e0112 /src
parenta28d4396018e48479916fd624e2371aa1f75e6e7 (diff)
parent627abcddd1c45a07d58b9c0cbfd6bb62caf256a9 (diff)
downloademacs-23373930daa192623bfda56960ccb04b2703fbe5.tar.gz
emacs-23373930daa192623bfda56960ccb04b2703fbe5.zip
merge trunk
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog164
-rw-r--r--src/alloc.c7
-rw-r--r--src/character.c30
-rw-r--r--src/character.h2
-rw-r--r--src/dispextern.h2
-rw-r--r--src/fns.c12
-rw-r--r--src/frame.c4
-rw-r--r--src/frame.h2
-rw-r--r--src/image.c2
-rw-r--r--src/insdel.c12
-rw-r--r--src/keyboard.c22
-rw-r--r--src/keyboard.h4
-rw-r--r--src/lisp.h5
-rw-r--r--src/makefile.w32-in37
-rw-r--r--src/menu.c7
-rw-r--r--src/menu.h5
-rw-r--r--src/msdos.c2
-rw-r--r--src/nsterm.m6
-rw-r--r--src/systime.h6
-rw-r--r--src/term.c8
-rw-r--r--src/termhooks.h6
-rw-r--r--src/w32gui.h4
-rw-r--r--src/w32inevt.c5
-rw-r--r--src/w32menu.c2
-rw-r--r--src/window.c5
-rw-r--r--src/xmenu.c24
-rw-r--r--src/xselect.c6
-rw-r--r--src/xterm.c46
-rw-r--r--src/xterm.h3
29 files changed, 311 insertions, 129 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index fd6f42acb91..372bf383fb8 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -4,6 +4,114 @@
4 (BACKWARD_CHAR): Wrap the arg STOP by parenthesis. 4 (BACKWARD_CHAR): Wrap the arg STOP by parenthesis.
5 (find_automatic_composition): Mostly rewrite for efficiency. 5 (find_automatic_composition): Mostly rewrite for efficiency.
6 6
72011-05-18 Juanma Barranquero <lekktu@gmail.com>
8
9 * makefile.w32-in: Update dependencies.
10
112011-05-18 Christoph Scholtes <cschol2112@googlemail.com>
12
13 * menu.c: Include limits.h (fixes the MS-Windows build broken by
14 revision 104625).
15
162011-05-18 Paul Eggert <eggert@cs.ucla.edu>
17
18 Fix some integer overflow issues, such as string length overflow.
19
20 * insdel.c (count_size_as_multibyte): Check for string overflow.
21
22 * character.c (lisp_string_width): Check for string overflow.
23 Use EMACS_INT, not int, for string indexes and lengths; in
24 particular, 2nd arg is now EMACS_INT, not int. Do not crash if
25 the resulting string length overflows an EMACS_INT; instead,
26 report a string overflow if no precision given. When checking for
27 precision exhaustion, use a check that cannot possibly have
28 integer overflow. (Bug#8675)
29 * character.h (lisp_string_width): Adjust to new signature.
30
31 * alloc.c (string_overflow): New function.
32 (Fmake_string): Use it. This doesn't change behavior, but saves
33 a few bytes and will simplify future changes.
34 * character.c (string_escape_byte8): Likewise.
35 * lisp.h (string_overflow): New decl.
36
37 Fixups, following up to the user-interface timestamp change.
38 * nsterm.m (last_mouse_movement_time, ns_mouse_position): Use Time
39 for UI timestamps, instead of unsigned long.
40 * msdos.c (mouse_get_pos): Likewise.
41 * w32inevt.c (movement_time, w32_console_mouse_position): Likewise.
42 * w32gui.h (Time): Define by including "systime.h" rather than by
43 declaring it ourselves. (Bug#8664)
44
45 * dispextern.h (struct image): Don't assume time_t <= unsigned long.
46 * image.c (clear_image_cache): Likewise.
47
48 * term.c (term_mouse_position): Don't assume time_t wraparound.
49
50 Be more systematic about user-interface timestamps.
51 Before, the code sometimes used 'Time', sometimes 'unsigned long',
52 and sometimes 'EMACS_UINT', to represent these timestamps. This
53 change causes it to use 'Time' uniformly, as that's what X uses.
54 This makes the code easier to follow, and makes it easier to catch
55 integer overflow bugs such as Bug#8664.
56 * frame.c (Fmouse_position, Fmouse_pixel_position):
57 Use Time, not unsigned long, for user-interface timestamps.
58 * keyboard.c (last_event_timestamp, kbd_buffer_get_event): Likewise.
59 (button_down_time, make_lispy_position, make_lispy_movement): Likewise.
60 * keyboard.h (last_event_timestamp): Likewise.
61 * menu.c (Fx_popup_menu) [!HAVE_X_WINDOWS]: Likewise.
62 * menu.h (xmenu_show): Likewise.
63 * term.c (term_mouse_position): Likewise.
64 * termhooks.h (struct input_event.timestamp): Likewise.
65 (struct terminal.mouse_position_hook): Likewise.
66 * xmenu.c (create_and_show_popup_menu, xmenu_show): Likewise.
67 * xterm.c (XTmouse_position, x_scroll_bar_report_motion): Likewise.
68 * systime.h (Time): New decl. Pull it in from <X11/X.h> if
69 HAVE_X_WINDOWS, otherwise define it as unsigned long, which is
70 what it was before.
71 * menu.h, termhooks.h: Include "systime.h", for Time.
72
73 * keyboard.c (make_lispy_event): Fix problem in integer overflow.
74 Don't assume that the difference between two unsigned long values
75 can fit into an integer. At this point, we know button_down_time
76 <= event->timestamp, so the difference must be nonnegative, so
77 there's no need to cast the result if double-click-time is
78 nonnegative, as it should be; check that it's nonnegative, just in
79 case. This bug is triggered when events are more than 2**31 ms
80 apart (about 25 days). (Bug#8664)
81
82 * xselect.c (last_event_timestamp): Remove duplicate decl.
83 (x_own_selection): Remove needless cast to unsigned long.
84
85 * xmenu.c (set_frame_menubar): Use int, not EMACS_UINT, for indexes
86 that always fit in int. Use a sentinel instead of a counter, to
87 avoid a temp and to allay GCC's concerns about possible int overflow.
88 * frame.h (struct frame): Use int for menu_bar_items_used
89 instead of EMACS_INT, since it always fits in int.
90
91 * menu.c (grow_menu_items): Check for int overflow.
92
93 * xmenu.c (set_frame_menubar): Don't mishandle vectors with no nils.
94
95 * xterm.c: Use EMACS_INT for Emacs modifiers, and int for X modifiers.
96 Before, the code was not consistent. These values cannot exceed
97 2**31 - 1 so there's no need to make them unsigned.
98 (x_x_to_emacs_modifiers): Accept int and return EMACS_INT.
99 (x_emacs_to_x_modifiers): Accept EMACS_INT and return int.
100 (x_x_to_emacs_modifiers, x_emacs_to_x_modifiers): Reject non-integers
101 as modifiers.
102 * xterm.h (x_x_to_emacs_modifiers): Adjust to signature change.
103
104 * lisp.h (XINT) [USE_LISP_UNION_TYPE]: Cast to EMACS_INT.
105 (XUINT) [USE_LISP_UNION_TYPE]: Cast to EMACS_UINT.
106 Otherwise, GCC 4.6.0 warns about printf (pI, XINT (...)),
107 presumably because the widths might not match.
108
109 * window.c (size_window): Avoid needless test at loop start.
110
1112011-05-18 Courtney Bane <emacs-bugs-7626@cbane.org> (tiny change)
112
113 * term.c (Fresume_tty): Restore hooks before reinitializing (bug#8687).
114
72011-05-12 Drew Adams <drew.adams@oracle.com> 1152011-05-12 Drew Adams <drew.adams@oracle.com>
8 116
9 * textprop.c (Fprevious_single_char_property_change): Doc fix (bug#8655). 117 * textprop.c (Fprevious_single_char_property_change): Doc fix (bug#8655).
@@ -14,8 +122,8 @@
14 `width' to `bar_area_x' and `bar_area_width', respectively. 122 `width' to `bar_area_x' and `bar_area_width', respectively.
15 (x_scroll_run): Take account of fringe background extension. 123 (x_scroll_run): Take account of fringe background extension.
16 124
17 * xterm.c (x_draw_fringe_bitmap) [USE_TOOLKIT_SCROLL_BARS]: Rename 125 * xterm.c (x_draw_fringe_bitmap) [USE_TOOLKIT_SCROLL_BARS]:
18 local vars `left' and `width' to `bar_area_x' and 126 Rename local vars `left' and `width' to `bar_area_x' and
19 `bar_area_width', respectively. 127 `bar_area_width', respectively.
20 (x_scroll_run) [USE_TOOLKIT_SCROLL_BARS]: Take account of fringe 128 (x_scroll_run) [USE_TOOLKIT_SCROLL_BARS]: Take account of fringe
21 background extension. 129 background extension.
@@ -132,8 +240,8 @@
132 * dbusbind.c: Do not use XPNTR on a value that may be an integer. 240 * dbusbind.c: Do not use XPNTR on a value that may be an integer.
133 Reported by Stefan Monnier in 241 Reported by Stefan Monnier in
134 <http://lists.gnu.org/archive/html/emacs-devel/2011-04/msg00919.html>. 242 <http://lists.gnu.org/archive/html/emacs-devel/2011-04/msg00919.html>.
135 (xd_remove_watch, Fdbus_init_bus, xd_read_queued_messages): Use 243 (xd_remove_watch, Fdbus_init_bus, xd_read_queued_messages):
136 SYMBOLP-guarded XSYMBOL, not XPNTR. 244 Use SYMBOLP-guarded XSYMBOL, not XPNTR.
137 245
138 * lisp.h (EMACS_INTPTR): Remove. All uses changed to intptr_t. 246 * lisp.h (EMACS_INTPTR): Remove. All uses changed to intptr_t.
139 (EMACS_UINTPTR): Likewise, with uintptr_t. 247 (EMACS_UINTPTR): Likewise, with uintptr_t.
@@ -319,8 +427,8 @@
319 * callproc.c: Indentation fixup. 427 * callproc.c: Indentation fixup.
320 428
321 * sysdep.c (wait_for_termination_1): Make static. 429 * sysdep.c (wait_for_termination_1): Make static.
322 (wait_for_termination, interruptible_wait_for_termination): Move 430 (wait_for_termination, interruptible_wait_for_termination):
323 after wait_for_termination_1. 431 Move after wait_for_termination_1.
324 432
3252011-05-01 Lars Magne Ingebrigtsen <larsi@gnus.org> 4332011-05-01 Lars Magne Ingebrigtsen <larsi@gnus.org>
326 434
@@ -436,8 +544,8 @@
436 (emacs_gnutls_write): Don't use uninitialized rtnval if nbyte <= 0. 544 (emacs_gnutls_write): Don't use uninitialized rtnval if nbyte <= 0.
437 545
438 * lisp.h: Fix a problem with aliasing and vector headers. (Bug#8546) 546 * lisp.h: Fix a problem with aliasing and vector headers. (Bug#8546)
439 GCC 4.6.0 optimizes based on type-based alias analysis. For 547 GCC 4.6.0 optimizes based on type-based alias analysis.
440 example, if b is of type struct buffer * and v of type struct 548 For example, if b is of type struct buffer * and v of type struct
441 Lisp_Vector *, then gcc -O2 was incorrectly assuming that &b->size 549 Lisp_Vector *, then gcc -O2 was incorrectly assuming that &b->size
442 != &v->size, and therefore "v->size = 1; b->size = 2; return 550 != &v->size, and therefore "v->size = 1; b->size = 2; return
443 v->size;" must therefore return 1. This assumption is incorrect 551 v->size;" must therefore return 1. This assumption is incorrect
@@ -457,8 +565,8 @@
457 (XSETPSEUDOVECTOR): Rewrite in terms of XSETTYPED_PSEUDOVECTOR. 565 (XSETPSEUDOVECTOR): Rewrite in terms of XSETTYPED_PSEUDOVECTOR.
458 (XSETSUBR): Rewrite in terms of XSETTYPED_PSEUDOVECTOR and XSIZE, 566 (XSETSUBR): Rewrite in terms of XSETTYPED_PSEUDOVECTOR and XSIZE,
459 since Lisp_Subr is a special case (no "next" field). 567 since Lisp_Subr is a special case (no "next" field).
460 (ASIZE): Now uses header.size rather than size. All 568 (ASIZE): Now uses header.size rather than size.
461 previous uses of XVECTOR (foo)->size replaced to use this macro, 569 All previous uses of XVECTOR (foo)->size replaced to use this macro,
462 to avoid the hassle of writing XVECTOR (foo)->header.size. 570 to avoid the hassle of writing XVECTOR (foo)->header.size.
463 (struct vectorlike_header): New type. 571 (struct vectorlike_header): New type.
464 (TYPED_PSEUDOVECTORP): New macro, also specifying the C type of the 572 (TYPED_PSEUDOVECTORP): New macro, also specifying the C type of the
@@ -507,7 +615,7 @@
507 Break out the floating-point parsing into a new 615 Break out the floating-point parsing into a new
508 function string_to_number, so that Fstring_to_number parses 616 function string_to_number, so that Fstring_to_number parses
509 floating point numbers consistently with the Lisp reader. 617 floating point numbers consistently with the Lisp reader.
510 (digit_to_number): Moved here from data.c. Make it static inline. 618 (digit_to_number): Move here from data.c. Make it static inline.
511 (E_CHAR, EXP_INT): Remove, replacing with ... 619 (E_CHAR, EXP_INT): Remove, replacing with ...
512 (E_EXP): New macro, to solve the "1.0e+" problem mentioned below. 620 (E_EXP): New macro, to solve the "1.0e+" problem mentioned below.
513 (string_to_number): New function, replacing isfloat_string. 621 (string_to_number): New function, replacing isfloat_string.
@@ -744,8 +852,8 @@
744 Fix doprnt so it could be used again safely in `verror'. (Bug#8435) 852 Fix doprnt so it could be used again safely in `verror'. (Bug#8435)
745 * doprnt.c: Include limits.h. 853 * doprnt.c: Include limits.h.
746 (SIZE_MAX): New macro. 854 (SIZE_MAX): New macro.
747 (doprnt): Return a size_t value. 2nd arg is now size_t. Many 855 (doprnt): Return a size_t value. 2nd arg is now size_t.
748 local variables are now size_t instead of int or unsigned. 856 Many local variables are now size_t instead of int or unsigned.
749 Improve overflow protection. Support `l' modifier for integer 857 Improve overflow protection. Support `l' modifier for integer
750 conversions. Support %l conversion. Don't assume an EMACS_INT 858 conversions. Support %l conversion. Don't assume an EMACS_INT
751 argument for integer conversions and for %c. 859 argument for integer conversions and for %c.
@@ -946,8 +1054,8 @@
946 1054
947 * syntax.c (update_syntax_table): Declare 2nd argument EMACS_INT. 1055 * syntax.c (update_syntax_table): Declare 2nd argument EMACS_INT.
948 1056
949 * textprop.c (verify_interval_modification, interval_of): Declare 1057 * textprop.c (verify_interval_modification, interval_of):
950 arguments EMACS_INT. 1058 Declare arguments EMACS_INT.
951 1059
952 * intervals.c (adjust_intervals_for_insertion): Declare arguments 1060 * intervals.c (adjust_intervals_for_insertion): Declare arguments
953 EMACS_INT. 1061 EMACS_INT.
@@ -1198,8 +1306,8 @@
1198 (free_realized_fontset) #if-0 the body, which does nothing. 1306 (free_realized_fontset) #if-0 the body, which does nothing.
1199 (face_suitable_for_char_p): #if-0, as it's never called. 1307 (face_suitable_for_char_p): #if-0, as it's never called.
1200 * fontset.h (face_suitable_for_char_p): Remove decl. 1308 * fontset.h (face_suitable_for_char_p): Remove decl.
1201 * xfaces.c (face_at_string_position): Use 1309 * xfaces.c (face_at_string_position):
1202 FACE_SUITABLE_FOR_ASCII_CHAR_P, not FACE_SUITABLE_FOR_CHAR_P, 1310 Use FACE_SUITABLE_FOR_ASCII_CHAR_P, not FACE_SUITABLE_FOR_CHAR_P,
1203 since 0 is always ASCII. 1311 since 0 is always ASCII.
1204 1312
1205 * fns.c (weak_hash_tables): Now static. 1313 * fns.c (weak_hash_tables): Now static.
@@ -1308,8 +1416,8 @@
1308 (last_point_position_window): Remove decls. 1416 (last_point_position_window): Remove decls.
1309 * keyboard.c: Make these variables static. 1417 * keyboard.c: Make these variables static.
1310 1418
1311 * coding.h (coding, code_convert_region, encode_coding_gap): Remove 1419 * coding.h (coding, code_convert_region, encode_coding_gap):
1312 decls. 1420 Remove decls.
1313 * coding.c (Vsjis_coding_system, Vbig5_coding_system): 1421 * coding.c (Vsjis_coding_system, Vbig5_coding_system):
1314 (iso_code_class, detect_coding, code_convert_region): Now static. 1422 (iso_code_class, detect_coding, code_convert_region): Now static.
1315 (encode_coding_gap): Remove; unused. 1423 (encode_coding_gap): Remove; unused.
@@ -1340,7 +1448,7 @@
1340 exported only to the debugger. 1448 exported only to the debugger.
1341 1449
1342 * atimer.c (alarm_signal_handler, run_all_atimers): Now static. 1450 * atimer.c (alarm_signal_handler, run_all_atimers): Now static.
1343 * atimer.h (run_all_atimers): Removed; not exported. 1451 * atimer.h (run_all_atimers): Remove; not exported.
1344 1452
1345 font.c: Make copy_font_spec and merge_font_spec ordinary C functions. 1453 font.c: Make copy_font_spec and merge_font_spec ordinary C functions.
1346 * font.c (copy_font_spec): Rename from Fcopy_font_spec, since it 1454 * font.c (copy_font_spec): Rename from Fcopy_font_spec, since it
@@ -1595,8 +1703,8 @@
1595 1703
15962011-04-09 Chong Yidong <cyd@stupidchicken.com> 17042011-04-09 Chong Yidong <cyd@stupidchicken.com>
1597 1705
1598 * ftfont.c (get_adstyle_property, ftfont_pattern_entity): Use 1706 * ftfont.c (get_adstyle_property, ftfont_pattern_entity):
1599 unsigned char, to match FcChar8 type definition. 1707 Use unsigned char, to match FcChar8 type definition.
1600 1708
1601 * xterm.c (handle_one_xevent): 1709 * xterm.c (handle_one_xevent):
1602 * xmenu.c (create_and_show_popup_menu): 1710 * xmenu.c (create_and_show_popup_menu):
@@ -1669,8 +1777,8 @@
1669 1777
16702011-04-06 Chong Yidong <cyd@stupidchicken.com> 17782011-04-06 Chong Yidong <cyd@stupidchicken.com>
1671 1779
1672 * process.c (Flist_processes): Removed to Lisp. 1780 * process.c (Flist_processes): Remove to Lisp.
1673 (list_processes_1): Deleted. 1781 (list_processes_1): Delete.
1674 1782
16752011-04-06 Eli Zaretskii <eliz@gnu.org> 17832011-04-06 Eli Zaretskii <eliz@gnu.org>
1676 1784
@@ -1928,8 +2036,8 @@
1928 * callint.c (Fcall_interactively): Preserve lexical-binding mode for 2036 * callint.c (Fcall_interactively): Preserve lexical-binding mode for
1929 interactive spec. 2037 interactive spec.
1930 2038
1931 * bytecode.c (Bstack_ref, Bstack_set, Bstack_set2, BdiscardN): New 2039 * bytecode.c (Bstack_ref, Bstack_set, Bstack_set2, BdiscardN):
1932 byte-codes. 2040 New byte-codes.
1933 (exec_byte_code): New function extracted from Fbyte_code to handle new 2041 (exec_byte_code): New function extracted from Fbyte_code to handle new
1934 calling convention for byte-code-functions. Add new byte-codes. 2042 calling convention for byte-code-functions. Add new byte-codes.
1935 2043
@@ -1944,8 +2052,8 @@
19442011-03-31 Eli Zaretskii <eliz@gnu.org> 20522011-03-31 Eli Zaretskii <eliz@gnu.org>
1945 2053
1946 * xdisp.c (SCROLL_LIMIT): New macro. 2054 * xdisp.c (SCROLL_LIMIT): New macro.
1947 (try_scrolling): Use it when setting scroll_limit. Limit 2055 (try_scrolling): Use it when setting scroll_limit.
1948 scrolling to 100 screen lines. 2056 Limit scrolling to 100 screen lines.
1949 (redisplay_window): Even when falling back on "recentering", 2057 (redisplay_window): Even when falling back on "recentering",
1950 position point in the window according to scroll-conservatively, 2058 position point in the window according to scroll-conservatively,
1951 scroll-margin, and scroll-*-aggressively variables. (Bug#6671) 2059 scroll-margin, and scroll-*-aggressively variables. (Bug#6671)
diff --git a/src/alloc.c b/src/alloc.c
index 0bce83bfae7..71ab54bcab5 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -2174,6 +2174,11 @@ compact_small_strings (void)
2174 current_sblock = tb; 2174 current_sblock = tb;
2175} 2175}
2176 2176
2177void
2178string_overflow (void)
2179{
2180 error ("Maximum string size exceeded");
2181}
2177 2182
2178DEFUN ("make-string", Fmake_string, Smake_string, 2, 2, 0, 2183DEFUN ("make-string", Fmake_string, Smake_string, 2, 2, 0,
2179 doc: /* Return a newly created string of length LENGTH, with INIT in each element. 2184 doc: /* Return a newly created string of length LENGTH, with INIT in each element.
@@ -2206,7 +2211,7 @@ INIT must be an integer that represents a character. */)
2206 EMACS_INT string_len = XINT (length); 2211 EMACS_INT string_len = XINT (length);
2207 2212
2208 if (string_len > MOST_POSITIVE_FIXNUM / len) 2213 if (string_len > MOST_POSITIVE_FIXNUM / len)
2209 error ("Maximum string size exceeded"); 2214 string_overflow ();
2210 nbytes = len * string_len; 2215 nbytes = len * string_len;
2211 val = make_uninit_multibyte_string (string_len, nbytes); 2216 val = make_uninit_multibyte_string (string_len, nbytes);
2212 p = SDATA (val); 2217 p = SDATA (val);
diff --git a/src/character.c b/src/character.c
index 64ea2625abb..b9595f97ec7 100644
--- a/src/character.c
+++ b/src/character.c
@@ -35,6 +35,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
35 35
36#include <sys/types.h> 36#include <sys/types.h>
37#include <setjmp.h> 37#include <setjmp.h>
38#include <intprops.h>
38#include "lisp.h" 39#include "lisp.h"
39#include "character.h" 40#include "character.h"
40#include "buffer.h" 41#include "buffer.h"
@@ -404,7 +405,7 @@ strwidth (const char *str, EMACS_INT len)
404 in *NCHARS and *NBYTES respectively. */ 405 in *NCHARS and *NBYTES respectively. */
405 406
406EMACS_INT 407EMACS_INT
407lisp_string_width (Lisp_Object string, int precision, 408lisp_string_width (Lisp_Object string, EMACS_INT precision,
408 EMACS_INT *nchars, EMACS_INT *nbytes) 409 EMACS_INT *nchars, EMACS_INT *nbytes)
409{ 410{
410 EMACS_INT len = SCHARS (string); 411 EMACS_INT len = SCHARS (string);
@@ -419,7 +420,7 @@ lisp_string_width (Lisp_Object string, int precision,
419 420
420 while (i < len) 421 while (i < len)
421 { 422 {
422 int chars, bytes, thiswidth; 423 EMACS_INT chars, bytes, thiswidth;
423 Lisp_Object val; 424 Lisp_Object val;
424 int cmp_id; 425 int cmp_id;
425 EMACS_INT ignore, end; 426 EMACS_INT ignore, end;
@@ -437,7 +438,11 @@ lisp_string_width (Lisp_Object string, int precision,
437 int c; 438 int c;
438 439
439 if (multibyte) 440 if (multibyte)
440 c = STRING_CHAR_AND_LENGTH (str + i_byte, bytes); 441 {
442 int cbytes;
443 c = STRING_CHAR_AND_LENGTH (str + i_byte, cbytes);
444 bytes = cbytes;
445 }
441 else 446 else
442 c = str[i_byte], bytes = 1; 447 c = str[i_byte], bytes = 1;
443 chars = 1; 448 chars = 1;
@@ -455,8 +460,14 @@ lisp_string_width (Lisp_Object string, int precision,
455 } 460 }
456 } 461 }
457 462
458 if (precision > 0 463 if (precision <= 0)
459 && (width + thiswidth > precision)) 464 {
465#ifdef emacs
466 if (INT_ADD_OVERFLOW (width, thiswidth))
467 string_overflow ();
468#endif
469 }
470 else if (precision - width < thiswidth)
460 { 471 {
461 *nchars = i; 472 *nchars = i;
462 *nbytes = i_byte; 473 *nbytes = i_byte;
@@ -465,7 +476,7 @@ lisp_string_width (Lisp_Object string, int precision,
465 i += chars; 476 i += chars;
466 i_byte += bytes; 477 i_byte += bytes;
467 width += thiswidth; 478 width += thiswidth;
468 } 479 }
469 480
470 if (precision > 0) 481 if (precision > 0)
471 { 482 {
@@ -672,7 +683,7 @@ parse_str_to_multibyte (const unsigned char *str, EMACS_INT len)
672} 683}
673 684
674 685
675/* Convert unibyte text at STR of NBYTES bytes to a multibyte text 686/* Convert unibyte text at STR of BYTES bytes to a multibyte text
676 that contains the same single-byte characters. It actually 687 that contains the same single-byte characters. It actually
677 converts all 8-bit characters to multibyte forms. It is assured 688 converts all 8-bit characters to multibyte forms. It is assured
678 that we can use LEN bytes at STR as a work area and that is 689 that we can use LEN bytes at STR as a work area and that is
@@ -823,7 +834,7 @@ string_escape_byte8 (Lisp_Object string)
823 { 834 {
824 if ((MOST_POSITIVE_FIXNUM - nchars) / 3 < byte8_count 835 if ((MOST_POSITIVE_FIXNUM - nchars) / 3 < byte8_count
825 || (MOST_POSITIVE_FIXNUM - nbytes) / 2 < byte8_count) 836 || (MOST_POSITIVE_FIXNUM - nbytes) / 2 < byte8_count)
826 error ("Maximum string size exceeded"); 837 string_overflow ();
827 838
828 /* Convert 2-byte sequence of byte8 chars to 4-byte octal. */ 839 /* Convert 2-byte sequence of byte8 chars to 4-byte octal. */
829 val = make_uninit_multibyte_string (nchars + byte8_count * 3, 840 val = make_uninit_multibyte_string (nchars + byte8_count * 3,
@@ -832,7 +843,8 @@ string_escape_byte8 (Lisp_Object string)
832 else 843 else
833 { 844 {
834 if ((MOST_POSITIVE_FIXNUM - nchars) / 3 < byte8_count) 845 if ((MOST_POSITIVE_FIXNUM - nchars) / 3 < byte8_count)
835 error ("Maximum string size exceeded"); 846 string_overflow ();
847
836 /* Convert 1-byte sequence of byte8 chars to 4-byte octal. */ 848 /* Convert 1-byte sequence of byte8 chars to 4-byte octal. */
837 val = make_uninit_string (nbytes + byte8_count * 3); 849 val = make_uninit_string (nbytes + byte8_count * 3);
838 } 850 }
diff --git a/src/character.h b/src/character.h
index 864882db7f6..5877d145d9e 100644
--- a/src/character.h
+++ b/src/character.h
@@ -612,7 +612,7 @@ extern EMACS_INT str_to_unibyte (const unsigned char *, unsigned char *,
612extern EMACS_INT strwidth (const char *, EMACS_INT); 612extern EMACS_INT strwidth (const char *, EMACS_INT);
613extern EMACS_INT c_string_width (const unsigned char *, EMACS_INT, int, 613extern EMACS_INT c_string_width (const unsigned char *, EMACS_INT, int,
614 EMACS_INT *, EMACS_INT *); 614 EMACS_INT *, EMACS_INT *);
615extern EMACS_INT lisp_string_width (Lisp_Object, int, 615extern EMACS_INT lisp_string_width (Lisp_Object, EMACS_INT,
616 EMACS_INT *, EMACS_INT *); 616 EMACS_INT *, EMACS_INT *);
617 617
618extern Lisp_Object Qcharacterp; 618extern Lisp_Object Qcharacterp;
diff --git a/src/dispextern.h b/src/dispextern.h
index 72e23e6642a..77c45cf2fc6 100644
--- a/src/dispextern.h
+++ b/src/dispextern.h
@@ -2709,7 +2709,7 @@ struct image
2709{ 2709{
2710 /* The time in seconds at which the image was last displayed. Set 2710 /* The time in seconds at which the image was last displayed. Set
2711 in prepare_image_for_display. */ 2711 in prepare_image_for_display. */
2712 unsigned long timestamp; 2712 time_t timestamp;
2713 2713
2714 /* Pixmaps of the image. */ 2714 /* Pixmaps of the image. */
2715 Pixmap pixmap, mask; 2715 Pixmap pixmap, mask;
diff --git a/src/fns.c b/src/fns.c
index 47ded456c6e..16dc0fe0de2 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -457,10 +457,10 @@ concat (size_t nargs, Lisp_Object *args,
457 Lisp_Object prev; 457 Lisp_Object prev;
458 int some_multibyte; 458 int some_multibyte;
459 /* When we make a multibyte string, we can't copy text properties 459 /* When we make a multibyte string, we can't copy text properties
460 while concatinating each string because the length of resulting 460 while concatenating each string because the length of resulting
461 string can't be decided until we finish the whole concatination. 461 string can't be decided until we finish the whole concatenation.
462 So, we record strings that have text properties to be copied 462 So, we record strings that have text properties to be copied
463 here, and copy the text properties after the concatination. */ 463 here, and copy the text properties after the concatenation. */
464 struct textprop_rec *textprops = NULL; 464 struct textprop_rec *textprops = NULL;
465 /* Number of elements in textprops. */ 465 /* Number of elements in textprops. */
466 int num_textprops = 0; 466 int num_textprops = 0;
@@ -704,7 +704,7 @@ concat (size_t nargs, Lisp_Object *args,
704 make_number (0), 704 make_number (0),
705 make_number (SCHARS (this)), 705 make_number (SCHARS (this)),
706 Qnil); 706 Qnil);
707 /* If successive arguments have properites, be sure that the 707 /* If successive arguments have properties, be sure that the
708 value of `composition' property be the copy. */ 708 value of `composition' property be the copy. */
709 if (last_to_end == textprops[argnum].to) 709 if (last_to_end == textprops[argnum].to)
710 make_composition_value_copy (props); 710 make_composition_value_copy (props);
@@ -2076,7 +2076,7 @@ internal_equal (register Lisp_Object o1, register Lisp_Object o2, int depth, int
2076 return compare_window_configurations (o1, o2, 0); 2076 return compare_window_configurations (o1, o2, 0);
2077 2077
2078 /* Aside from them, only true vectors, char-tables, compiled 2078 /* Aside from them, only true vectors, char-tables, compiled
2079 functions, and fonts (font-spec, font-entity, font-ojbect) 2079 functions, and fonts (font-spec, font-entity, font-object)
2080 are sensible to compare, so eliminate the others now. */ 2080 are sensible to compare, so eliminate the others now. */
2081 if (size & PSEUDOVECTOR_FLAG) 2081 if (size & PSEUDOVECTOR_FLAG)
2082 { 2082 {
@@ -2782,7 +2782,7 @@ ITEM should be one of the following:
2782`months', returning a 12-element vector of month names (locale items MON_n); 2782`months', returning a 12-element vector of month names (locale items MON_n);
2783 2783
2784`paper', returning a list (WIDTH HEIGHT) for the default paper size, 2784`paper', returning a list (WIDTH HEIGHT) for the default paper size,
2785 both measured in milimeters (locale items PAPER_WIDTH, PAPER_HEIGHT). 2785 both measured in millimeters (locale items PAPER_WIDTH, PAPER_HEIGHT).
2786 2786
2787If the system can't provide such information through a call to 2787If the system can't provide such information through a call to
2788`nl_langinfo', or if ITEM isn't from the list above, return nil. 2788`nl_langinfo', or if ITEM isn't from the list above, return nil.
diff --git a/src/frame.c b/src/frame.c
index b106c568e48..ce92a83b86c 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -1631,7 +1631,7 @@ and returns whatever that function returns. */)
1631 enum scroll_bar_part party_dummy; 1631 enum scroll_bar_part party_dummy;
1632 Lisp_Object x, y, retval; 1632 Lisp_Object x, y, retval;
1633 int col, row; 1633 int col, row;
1634 unsigned long long_dummy; 1634 Time long_dummy;
1635 struct gcpro gcpro1; 1635 struct gcpro gcpro1;
1636 1636
1637 f = SELECTED_FRAME (); 1637 f = SELECTED_FRAME ();
@@ -1676,7 +1676,7 @@ and nil for X and Y. */)
1676 Lisp_Object lispy_dummy; 1676 Lisp_Object lispy_dummy;
1677 enum scroll_bar_part party_dummy; 1677 enum scroll_bar_part party_dummy;
1678 Lisp_Object x, y; 1678 Lisp_Object x, y;
1679 unsigned long long_dummy; 1679 Time long_dummy;
1680 1680
1681 f = SELECTED_FRAME (); 1681 f = SELECTED_FRAME ();
1682 x = y = Qnil; 1682 x = y = Qnil;
diff --git a/src/frame.h b/src/frame.h
index e73370340f1..db57b1be980 100644
--- a/src/frame.h
+++ b/src/frame.h
@@ -192,7 +192,7 @@ struct frame
192 struct face_cache *face_cache; 192 struct face_cache *face_cache;
193 193
194 /* Number of elements in `menu_bar_vector' that have meaningful data. */ 194 /* Number of elements in `menu_bar_vector' that have meaningful data. */
195 EMACS_INT menu_bar_items_used; 195 int menu_bar_items_used;
196 196
197 /* A buffer to hold the frame's name. We can't use the Lisp 197 /* A buffer to hold the frame's name. We can't use the Lisp
198 string's pointer (`name', above) because it might get relocated. */ 198 string's pointer (`name', above) because it might get relocated. */
diff --git a/src/image.c b/src/image.c
index 23da03b6264..2562d79a782 100644
--- a/src/image.c
+++ b/src/image.c
@@ -1523,7 +1523,7 @@ clear_image_cache (struct frame *f, Lisp_Object filter)
1523 { 1523 {
1524 /* Free cache based on timestamp. */ 1524 /* Free cache based on timestamp. */
1525 EMACS_TIME t; 1525 EMACS_TIME t;
1526 unsigned long old; 1526 time_t old;
1527 int delay, nimages = 0; 1527 int delay, nimages = 0;
1528 1528
1529 for (i = 0; i < c->used; ++i) 1529 for (i = 0; i < c->used; ++i)
diff --git a/src/insdel.c b/src/insdel.c
index 2662858c2a1..de9e8aa570a 100644
--- a/src/insdel.c
+++ b/src/insdel.c
@@ -20,6 +20,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
20 20
21#include <config.h> 21#include <config.h>
22#include <setjmp.h> 22#include <setjmp.h>
23
24#include <intprops.h>
25
23#include "lisp.h" 26#include "lisp.h"
24#include "intervals.h" 27#include "intervals.h"
25#include "buffer.h" 28#include "buffer.h"
@@ -581,14 +584,19 @@ count_size_as_multibyte (const unsigned char *ptr, EMACS_INT nbytes)
581 for (i = 0; i < nbytes; i++) 584 for (i = 0; i < nbytes; i++)
582 { 585 {
583 unsigned int c = *ptr++; 586 unsigned int c = *ptr++;
587 int n;
584 588
585 if (ASCII_CHAR_P (c)) 589 if (ASCII_CHAR_P (c))
586 outgoing_nbytes++; 590 n = 1;
587 else 591 else
588 { 592 {
589 c = BYTE8_TO_CHAR (c); 593 c = BYTE8_TO_CHAR (c);
590 outgoing_nbytes += CHAR_BYTES (c); 594 n = CHAR_BYTES (c);
591 } 595 }
596
597 if (INT_ADD_OVERFLOW (outgoing_nbytes, n))
598 string_overflow ();
599 outgoing_nbytes += n;
592 } 600 }
593 601
594 return outgoing_nbytes; 602 return outgoing_nbytes;
diff --git a/src/keyboard.c b/src/keyboard.c
index a94456fce2e..c471a91ebfb 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -238,7 +238,7 @@ Lisp_Object internal_last_event_frame;
238 238
239/* The timestamp of the last input event we received from the X server. 239/* The timestamp of the last input event we received from the X server.
240 X Windows wants this for selection ownership. */ 240 X Windows wants this for selection ownership. */
241unsigned long last_event_timestamp; 241Time last_event_timestamp;
242 242
243static Lisp_Object Qx_set_selection, Qhandle_switch_frame; 243static Lisp_Object Qx_set_selection, Qhandle_switch_frame;
244Lisp_Object QPRIMARY; 244Lisp_Object QPRIMARY;
@@ -4085,7 +4085,7 @@ kbd_buffer_get_event (KBOARD **kbp,
4085 Lisp_Object bar_window; 4085 Lisp_Object bar_window;
4086 enum scroll_bar_part part; 4086 enum scroll_bar_part part;
4087 Lisp_Object x, y; 4087 Lisp_Object x, y;
4088 unsigned long t; 4088 Time t;
4089 4089
4090 *kbp = current_kboard; 4090 *kbp = current_kboard;
4091 /* Note that this uses F to determine which terminal to look at. 4091 /* Note that this uses F to determine which terminal to look at.
@@ -5088,7 +5088,7 @@ static Lisp_Object button_down_location;
5088static int last_mouse_button; 5088static int last_mouse_button;
5089static int last_mouse_x; 5089static int last_mouse_x;
5090static int last_mouse_y; 5090static int last_mouse_y;
5091static unsigned long button_down_time; 5091static Time button_down_time;
5092 5092
5093/* The number of clicks in this multiple-click. */ 5093/* The number of clicks in this multiple-click. */
5094 5094
@@ -5099,7 +5099,7 @@ static int double_click_count;
5099 5099
5100static Lisp_Object 5100static Lisp_Object
5101make_lispy_position (struct frame *f, Lisp_Object x, Lisp_Object y, 5101make_lispy_position (struct frame *f, Lisp_Object x, Lisp_Object y,
5102 unsigned long t) 5102 Time t)
5103{ 5103{
5104 enum window_part part; 5104 enum window_part part;
5105 Lisp_Object posn = Qnil; 5105 Lisp_Object posn = Qnil;
@@ -5556,9 +5556,9 @@ make_lispy_event (struct input_event *event)
5556 && (eabs (XINT (event->y) - last_mouse_y) <= fuzz) 5556 && (eabs (XINT (event->y) - last_mouse_y) <= fuzz)
5557 && button_down_time != 0 5557 && button_down_time != 0
5558 && (EQ (Vdouble_click_time, Qt) 5558 && (EQ (Vdouble_click_time, Qt)
5559 || (INTEGERP (Vdouble_click_time) 5559 || (NATNUMP (Vdouble_click_time)
5560 && ((int)(event->timestamp - button_down_time) 5560 && (event->timestamp - button_down_time
5561 < XINT (Vdouble_click_time))))); 5561 < XFASTINT (Vdouble_click_time)))));
5562 } 5562 }
5563 5563
5564 last_mouse_button = button; 5564 last_mouse_button = button;
@@ -5742,9 +5742,9 @@ make_lispy_event (struct input_event *event)
5742 && (eabs (XINT (event->y) - last_mouse_y) <= fuzz) 5742 && (eabs (XINT (event->y) - last_mouse_y) <= fuzz)
5743 && button_down_time != 0 5743 && button_down_time != 0
5744 && (EQ (Vdouble_click_time, Qt) 5744 && (EQ (Vdouble_click_time, Qt)
5745 || (INTEGERP (Vdouble_click_time) 5745 || (NATNUMP (Vdouble_click_time)
5746 && ((int)(event->timestamp - button_down_time) 5746 && (event->timestamp - button_down_time
5747 < XINT (Vdouble_click_time))))); 5747 < XFASTINT (Vdouble_click_time)))));
5748 if (is_double) 5748 if (is_double)
5749 { 5749 {
5750 double_click_count++; 5750 double_click_count++;
@@ -5987,7 +5987,7 @@ make_lispy_event (struct input_event *event)
5987 5987
5988static Lisp_Object 5988static Lisp_Object
5989make_lispy_movement (FRAME_PTR frame, Lisp_Object bar_window, enum scroll_bar_part part, 5989make_lispy_movement (FRAME_PTR frame, Lisp_Object bar_window, enum scroll_bar_part part,
5990 Lisp_Object x, Lisp_Object y, unsigned long t) 5990 Lisp_Object x, Lisp_Object y, Time t)
5991{ 5991{
5992 /* Is it a scroll bar movement? */ 5992 /* Is it a scroll bar movement? */
5993 if (frame && ! NILP (bar_window)) 5993 if (frame && ! NILP (bar_window))
diff --git a/src/keyboard.h b/src/keyboard.h
index 1f5cbd23639..802c99edb5e 100644
--- a/src/keyboard.h
+++ b/src/keyboard.h
@@ -16,7 +16,7 @@ GNU General Public License for more details.
16You should have received a copy of the GNU General Public License 16You should have received a copy of the GNU General Public License
17along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ 17along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
18 18
19#include "systime.h" /* for EMACS_TIME */ 19#include "systime.h" /* for EMACS_TIME, Time */
20#include "coding.h" /* for ENCODE_UTF_8 and ENCODE_SYSTEM */ 20#include "coding.h" /* for ENCODE_UTF_8 and ENCODE_SYSTEM */
21 21
22/* Lisp fields in struct keyboard are hidden from most code and accessed 22/* Lisp fields in struct keyboard are hidden from most code and accessed
@@ -459,7 +459,7 @@ extern Lisp_Object Qevent_symbol_element_mask;
459 459
460/* The timestamp of the last input event we received from the X server. 460/* The timestamp of the last input event we received from the X server.
461 X Windows wants this for selection ownership. */ 461 X Windows wants this for selection ownership. */
462extern unsigned long last_event_timestamp; 462extern Time last_event_timestamp;
463 463
464extern int quit_char; 464extern int quit_char;
465 465
diff --git a/src/lisp.h b/src/lisp.h
index 66f5c962be8..b6bf2bdb502 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -470,8 +470,8 @@ enum pvec_type
470 470
471#define XHASH(a) ((a).i) 471#define XHASH(a) ((a).i)
472#define XTYPE(a) ((enum Lisp_Type) (a).u.type) 472#define XTYPE(a) ((enum Lisp_Type) (a).u.type)
473#define XINT(a) ((a).s.val) 473#define XINT(a) ((EMACS_INT) (a).s.val)
474#define XUINT(a) ((a).u.val) 474#define XUINT(a) ((EMACS_UINT) (a).u.val)
475 475
476#ifdef USE_LSB_TAG 476#ifdef USE_LSB_TAG
477 477
@@ -2710,6 +2710,7 @@ EXFUN (Fmake_vector, 2);
2710EXFUN (Fvector, MANY); 2710EXFUN (Fvector, MANY);
2711EXFUN (Fmake_symbol, 1); 2711EXFUN (Fmake_symbol, 1);
2712EXFUN (Fmake_marker, 0); 2712EXFUN (Fmake_marker, 0);
2713extern void string_overflow (void) NO_RETURN;
2713EXFUN (Fmake_string, 2); 2714EXFUN (Fmake_string, 2);
2714extern Lisp_Object build_string (const char *); 2715extern Lisp_Object build_string (const char *);
2715extern Lisp_Object make_string (const char *, EMACS_INT); 2716extern Lisp_Object make_string (const char *, EMACS_INT);
diff --git a/src/makefile.w32-in b/src/makefile.w32-in
index e19a19645f9..71c4fa4c0ac 100644
--- a/src/makefile.w32-in
+++ b/src/makefile.w32-in
@@ -397,6 +397,7 @@ PROCESS_H = $(SRC)/process.h \
397$(BLD)/alloc.$(O) : \ 397$(BLD)/alloc.$(O) : \
398 $(SRC)/alloc.c \ 398 $(SRC)/alloc.c \
399 $(CONFIG_H) \ 399 $(CONFIG_H) \
400 $(EMACS_ROOT)/nt/inc/unistd.h \
400 $(EMACS_ROOT)/nt/inc/sys/time.h \ 401 $(EMACS_ROOT)/nt/inc/sys/time.h \
401 $(LISP_H) \ 402 $(LISP_H) \
402 $(PROCESS_H) \ 403 $(PROCESS_H) \
@@ -432,12 +433,14 @@ $(BLD)/atimer.$(O) : \
432$(BLD)/bidi.$(O) : \ 433$(BLD)/bidi.$(O) : \
433 $(SRC)/bidi.c \ 434 $(SRC)/bidi.c \
434 $(CONFIG_H) \ 435 $(CONFIG_H) \
436 $(EMACS_ROOT)/nt/inc/sys/time.h \
435 $(LISP_H) \ 437 $(LISP_H) \
436 $(SRC)/bidimirror.h \ 438 $(SRC)/bidimirror.h \
437 $(SRC)/biditype.h \ 439 $(SRC)/biditype.h \
438 $(SRC)/buffer.h \ 440 $(SRC)/buffer.h \
439 $(SRC)/character.h \ 441 $(SRC)/character.h \
440 $(SRC)/dispextern.h \ 442 $(SRC)/dispextern.h \
443 $(SRC)/systime.h \
441 $(SRC)/w32gui.h 444 $(SRC)/w32gui.h
442 445
443$(BLD)/buffer.$(O) : \ 446$(BLD)/buffer.$(O) : \
@@ -468,11 +471,13 @@ $(BLD)/buffer.$(O) : \
468$(BLD)/bytecode.$(O) : \ 471$(BLD)/bytecode.$(O) : \
469 $(SRC)/bytecode.c \ 472 $(SRC)/bytecode.c \
470 $(CONFIG_H) \ 473 $(CONFIG_H) \
474 $(EMACS_ROOT)/nt/inc/sys/time.h \
471 $(LISP_H) \ 475 $(LISP_H) \
472 $(SRC)/buffer.h \ 476 $(SRC)/buffer.h \
473 $(SRC)/character.h \ 477 $(SRC)/character.h \
474 $(SRC)/dispextern.h \ 478 $(SRC)/dispextern.h \
475 $(SRC)/syntax.h \ 479 $(SRC)/syntax.h \
480 $(SRC)/systime.h \
476 $(SRC)/w32gui.h \ 481 $(SRC)/w32gui.h \
477 $(SRC)/window.h 482 $(SRC)/window.h
478 483
@@ -496,6 +501,7 @@ $(BLD)/callint.$(O) : \
496$(BLD)/callproc.$(O) : \ 501$(BLD)/callproc.$(O) : \
497 $(SRC)/callproc.c \ 502 $(SRC)/callproc.c \
498 $(CONFIG_H) \ 503 $(CONFIG_H) \
504 $(EMACS_ROOT)/nt/inc/unistd.h \
499 $(EMACS_ROOT)/nt/inc/sys/file.h \ 505 $(EMACS_ROOT)/nt/inc/sys/file.h \
500 $(EMACS_ROOT)/nt/inc/sys/ioctl.h \ 506 $(EMACS_ROOT)/nt/inc/sys/ioctl.h \
501 $(EMACS_ROOT)/nt/inc/sys/time.h \ 507 $(EMACS_ROOT)/nt/inc/sys/time.h \
@@ -560,6 +566,7 @@ $(BLD)/ccl.$(O) : \
560$(BLD)/character.$(O) : \ 566$(BLD)/character.$(O) : \
561 $(SRC)/character.c \ 567 $(SRC)/character.c \
562 $(CONFIG_H) \ 568 $(CONFIG_H) \
569 $(EMACS_ROOT)/lib/intprops.h \
563 $(LISP_H) \ 570 $(LISP_H) \
564 $(SRC)/buffer.h \ 571 $(SRC)/buffer.h \
565 $(SRC)/character.h \ 572 $(SRC)/character.h \
@@ -609,6 +616,7 @@ $(BLD)/cmds.$(O) : \
609$(BLD)/coding.$(O) : \ 616$(BLD)/coding.$(O) : \
610 $(SRC)/coding.c \ 617 $(SRC)/coding.c \
611 $(CONFIG_H) \ 618 $(CONFIG_H) \
619 $(EMACS_ROOT)/nt/inc/sys/time.h \
612 $(LISP_H) \ 620 $(LISP_H) \
613 $(SRC)/buffer.h \ 621 $(SRC)/buffer.h \
614 $(SRC)/ccl.h \ 622 $(SRC)/ccl.h \
@@ -618,6 +626,7 @@ $(BLD)/coding.$(O) : \
618 $(SRC)/composite.h \ 626 $(SRC)/composite.h \
619 $(SRC)/dispextern.h \ 627 $(SRC)/dispextern.h \
620 $(SRC)/frame.h \ 628 $(SRC)/frame.h \
629 $(SRC)/systime.h \
621 $(SRC)/termhooks.h \ 630 $(SRC)/termhooks.h \
622 $(SRC)/w32gui.h \ 631 $(SRC)/w32gui.h \
623 $(SRC)/window.h 632 $(SRC)/window.h
@@ -625,6 +634,7 @@ $(BLD)/coding.$(O) : \
625$(BLD)/composite.$(O) : \ 634$(BLD)/composite.$(O) : \
626 $(SRC)/composite.c \ 635 $(SRC)/composite.c \
627 $(CONFIG_H) \ 636 $(CONFIG_H) \
637 $(EMACS_ROOT)/nt/inc/sys/time.h \
628 $(LISP_H) \ 638 $(LISP_H) \
629 $(SRC)/buffer.h \ 639 $(SRC)/buffer.h \
630 $(SRC)/ccl.h \ 640 $(SRC)/ccl.h \
@@ -635,6 +645,7 @@ $(BLD)/composite.$(O) : \
635 $(SRC)/font.h \ 645 $(SRC)/font.h \
636 $(SRC)/frame.h \ 646 $(SRC)/frame.h \
637 $(SRC)/intervals.h \ 647 $(SRC)/intervals.h \
648 $(SRC)/systime.h \
638 $(SRC)/termhooks.h \ 649 $(SRC)/termhooks.h \
639 $(SRC)/w32gui.h \ 650 $(SRC)/w32gui.h \
640 $(SRC)/window.h 651 $(SRC)/window.h
@@ -684,6 +695,7 @@ $(BLD)/dired.$(O) : \
684$(BLD)/dispnew.$(O) : \ 695$(BLD)/dispnew.$(O) : \
685 $(SRC)/dispnew.c \ 696 $(SRC)/dispnew.c \
686 $(CONFIG_H) \ 697 $(CONFIG_H) \
698 $(EMACS_ROOT)/nt/inc/unistd.h \
687 $(EMACS_ROOT)/nt/inc/sys/time.h \ 699 $(EMACS_ROOT)/nt/inc/sys/time.h \
688 $(LISP_H) \ 700 $(LISP_H) \
689 $(PROCESS_H) \ 701 $(PROCESS_H) \
@@ -758,6 +770,7 @@ $(BLD)/editfns.$(O) : \
758$(BLD)/emacs.$(O) : \ 770$(BLD)/emacs.$(O) : \
759 $(SRC)/emacs.c \ 771 $(SRC)/emacs.c \
760 $(CONFIG_H) \ 772 $(CONFIG_H) \
773 $(EMACS_ROOT)/nt/inc/unistd.h \
761 $(EMACS_ROOT)/nt/inc/sys/file.h \ 774 $(EMACS_ROOT)/nt/inc/sys/file.h \
762 $(EMACS_ROOT)/nt/inc/sys/ioctl.h \ 775 $(EMACS_ROOT)/nt/inc/sys/ioctl.h \
763 $(EMACS_ROOT)/nt/inc/sys/time.h \ 776 $(EMACS_ROOT)/nt/inc/sys/time.h \
@@ -873,6 +886,7 @@ $(BLD)/fns.$(O) : \
873$(BLD)/font.$(O) : \ 886$(BLD)/font.$(O) : \
874 $(SRC)/font.c \ 887 $(SRC)/font.c \
875 $(CONFIG_H) \ 888 $(CONFIG_H) \
889 $(EMACS_ROOT)/nt/inc/sys/time.h \
876 $(LISP_H) \ 890 $(LISP_H) \
877 $(SRC)/buffer.h \ 891 $(SRC)/buffer.h \
878 $(SRC)/ccl.h \ 892 $(SRC)/ccl.h \
@@ -883,6 +897,7 @@ $(BLD)/font.$(O) : \
883 $(SRC)/font.h \ 897 $(SRC)/font.h \
884 $(SRC)/fontset.h \ 898 $(SRC)/fontset.h \
885 $(SRC)/frame.h \ 899 $(SRC)/frame.h \
900 $(SRC)/systime.h \
886 $(SRC)/w32gui.h \ 901 $(SRC)/w32gui.h \
887 $(SRC)/w32term.h \ 902 $(SRC)/w32term.h \
888 $(SRC)/window.h 903 $(SRC)/window.h
@@ -961,6 +976,7 @@ $(BLD)/gmalloc.$(O) : \
961$(BLD)/gnutls.$(O) : \ 976$(BLD)/gnutls.$(O) : \
962 $(SRC)/gnutls.c \ 977 $(SRC)/gnutls.c \
963 $(CONFIG_H) \ 978 $(CONFIG_H) \
979 $(EMACS_ROOT)/nt/inc/unistd.h \
964 $(LISP_H) \ 980 $(LISP_H) \
965 $(PROCESS_H) \ 981 $(PROCESS_H) \
966 $(SRC)/w32.h 982 $(SRC)/w32.h
@@ -1015,6 +1031,7 @@ $(BLD)/insdel.$(O) : \
1015 $(SRC)/insdel.c \ 1031 $(SRC)/insdel.c \
1016 $(CONFIG_H) \ 1032 $(CONFIG_H) \
1017 $(EMACS_ROOT)/nt/inc/sys/time.h \ 1033 $(EMACS_ROOT)/nt/inc/sys/time.h \
1034 $(EMACS_ROOT)/lib/intprops.h \
1018 $(LISP_H) \ 1035 $(LISP_H) \
1019 $(SRC)/atimer.h \ 1036 $(SRC)/atimer.h \
1020 $(SRC)/blockinput.h \ 1037 $(SRC)/blockinput.h \
@@ -1048,6 +1065,7 @@ $(BLD)/intervals.$(O) : \
1048$(BLD)/keyboard.$(O) : \ 1065$(BLD)/keyboard.$(O) : \
1049 $(SRC)/keyboard.c \ 1066 $(SRC)/keyboard.c \
1050 $(CONFIG_H) \ 1067 $(CONFIG_H) \
1068 $(EMACS_ROOT)/nt/inc/unistd.h \
1051 $(EMACS_ROOT)/nt/inc/sys/ioctl.h \ 1069 $(EMACS_ROOT)/nt/inc/sys/ioctl.h \
1052 $(EMACS_ROOT)/nt/inc/sys/time.h \ 1070 $(EMACS_ROOT)/nt/inc/sys/time.h \
1053 $(LISP_H) \ 1071 $(LISP_H) \
@@ -1198,6 +1216,7 @@ $(BLD)/w32.$(O) : \
1198 $(CONFIG_H) \ 1216 $(CONFIG_H) \
1199 $(EMACS_ROOT)/nt/inc/grp.h \ 1217 $(EMACS_ROOT)/nt/inc/grp.h \
1200 $(EMACS_ROOT)/nt/inc/pwd.h \ 1218 $(EMACS_ROOT)/nt/inc/pwd.h \
1219 $(EMACS_ROOT)/nt/inc/unistd.h \
1201 $(EMACS_ROOT)/nt/inc/sys/file.h \ 1220 $(EMACS_ROOT)/nt/inc/sys/file.h \
1202 $(EMACS_ROOT)/nt/inc/sys/socket.h \ 1221 $(EMACS_ROOT)/nt/inc/sys/socket.h \
1203 $(EMACS_ROOT)/nt/inc/sys/time.h \ 1222 $(EMACS_ROOT)/nt/inc/sys/time.h \
@@ -1243,6 +1262,7 @@ $(BLD)/w32proc.$(O) : \
1243 $(CONFIG_H) \ 1262 $(CONFIG_H) \
1244 $(EMACS_ROOT)/nt/inc/langinfo.h \ 1263 $(EMACS_ROOT)/nt/inc/langinfo.h \
1245 $(EMACS_ROOT)/nt/inc/nl_types.h \ 1264 $(EMACS_ROOT)/nt/inc/nl_types.h \
1265 $(EMACS_ROOT)/nt/inc/unistd.h \
1246 $(EMACS_ROOT)/nt/inc/sys/file.h \ 1266 $(EMACS_ROOT)/nt/inc/sys/file.h \
1247 $(EMACS_ROOT)/nt/inc/sys/time.h \ 1267 $(EMACS_ROOT)/nt/inc/sys/time.h \
1248 $(LISP_H) \ 1268 $(LISP_H) \
@@ -1262,6 +1282,7 @@ $(BLD)/w32proc.$(O) : \
1262$(BLD)/w32console.$(O) : \ 1282$(BLD)/w32console.$(O) : \
1263 $(SRC)/w32console.c \ 1283 $(SRC)/w32console.c \
1264 $(CONFIG_H) \ 1284 $(CONFIG_H) \
1285 $(EMACS_ROOT)/nt/inc/sys/time.h \
1265 $(LISP_H) \ 1286 $(LISP_H) \
1266 $(SRC)/character.h \ 1287 $(SRC)/character.h \
1267 $(SRC)/coding.h \ 1288 $(SRC)/coding.h \
@@ -1269,6 +1290,7 @@ $(BLD)/w32console.$(O) : \
1269 $(SRC)/dispextern.h \ 1290 $(SRC)/dispextern.h \
1270 $(SRC)/disptab.h \ 1291 $(SRC)/disptab.h \
1271 $(SRC)/frame.h \ 1292 $(SRC)/frame.h \
1293 $(SRC)/systime.h \
1272 $(SRC)/termchar.h \ 1294 $(SRC)/termchar.h \
1273 $(SRC)/termhooks.h \ 1295 $(SRC)/termhooks.h \
1274 $(SRC)/w32gui.h \ 1296 $(SRC)/w32gui.h \
@@ -1277,6 +1299,7 @@ $(BLD)/w32console.$(O) : \
1277$(BLD)/print.$(O) : \ 1299$(BLD)/print.$(O) : \
1278 $(SRC)/print.c \ 1300 $(SRC)/print.c \
1279 $(CONFIG_H) \ 1301 $(CONFIG_H) \
1302 $(EMACS_ROOT)/nt/inc/unistd.h \
1280 $(EMACS_ROOT)/nt/inc/sys/time.h \ 1303 $(EMACS_ROOT)/nt/inc/sys/time.h \
1281 $(EMACS_ROOT)/lib/ftoastr.h \ 1304 $(EMACS_ROOT)/lib/ftoastr.h \
1282 $(EMACS_ROOT)/lib/intprops.h \ 1305 $(EMACS_ROOT)/lib/intprops.h \
@@ -1305,6 +1328,7 @@ $(BLD)/process.$(O) : \
1305 $(SRC)/process.c \ 1328 $(SRC)/process.c \
1306 $(CONFIG_H) \ 1329 $(CONFIG_H) \
1307 $(EMACS_ROOT)/nt/inc/netdb.h \ 1330 $(EMACS_ROOT)/nt/inc/netdb.h \
1331 $(EMACS_ROOT)/nt/inc/unistd.h \
1308 $(EMACS_ROOT)/nt/inc/arpa/inet.h \ 1332 $(EMACS_ROOT)/nt/inc/arpa/inet.h \
1309 $(EMACS_ROOT)/nt/inc/netinet/in.h \ 1333 $(EMACS_ROOT)/nt/inc/netinet/in.h \
1310 $(EMACS_ROOT)/nt/inc/sys/file.h \ 1334 $(EMACS_ROOT)/nt/inc/sys/file.h \
@@ -1414,6 +1438,7 @@ $(BLD)/sound.$(O) : \
1414$(BLD)/syntax.$(O) : \ 1438$(BLD)/syntax.$(O) : \
1415 $(SRC)/syntax.c \ 1439 $(SRC)/syntax.c \
1416 $(CONFIG_H) \ 1440 $(CONFIG_H) \
1441 $(EMACS_ROOT)/nt/inc/sys/time.h \
1417 $(LISP_H) \ 1442 $(LISP_H) \
1418 $(SRC)/buffer.h \ 1443 $(SRC)/buffer.h \
1419 $(SRC)/category.h \ 1444 $(SRC)/category.h \
@@ -1425,6 +1450,7 @@ $(BLD)/syntax.$(O) : \
1425 $(SRC)/keymap.h \ 1450 $(SRC)/keymap.h \
1426 $(SRC)/regex.h \ 1451 $(SRC)/regex.h \
1427 $(SRC)/syntax.h \ 1452 $(SRC)/syntax.h \
1453 $(SRC)/systime.h \
1428 $(SRC)/w32gui.h 1454 $(SRC)/w32gui.h
1429 1455
1430$(BLD)/sysdep.$(O) : \ 1456$(BLD)/sysdep.$(O) : \
@@ -1433,6 +1459,7 @@ $(BLD)/sysdep.$(O) : \
1433 $(EMACS_ROOT)/nt/inc/grp.h \ 1459 $(EMACS_ROOT)/nt/inc/grp.h \
1434 $(EMACS_ROOT)/nt/inc/netdb.h \ 1460 $(EMACS_ROOT)/nt/inc/netdb.h \
1435 $(EMACS_ROOT)/nt/inc/pwd.h \ 1461 $(EMACS_ROOT)/nt/inc/pwd.h \
1462 $(EMACS_ROOT)/nt/inc/unistd.h \
1436 $(EMACS_ROOT)/nt/inc/sys/file.h \ 1463 $(EMACS_ROOT)/nt/inc/sys/file.h \
1437 $(EMACS_ROOT)/nt/inc/sys/ioctl.h \ 1464 $(EMACS_ROOT)/nt/inc/sys/ioctl.h \
1438 $(EMACS_ROOT)/nt/inc/sys/socket.h \ 1465 $(EMACS_ROOT)/nt/inc/sys/socket.h \
@@ -1513,11 +1540,13 @@ $(BLD)/terminal.$(O) : \
1513$(BLD)/textprop.$(O) : \ 1540$(BLD)/textprop.$(O) : \
1514 $(SRC)/textprop.c \ 1541 $(SRC)/textprop.c \
1515 $(CONFIG_H) \ 1542 $(CONFIG_H) \
1543 $(EMACS_ROOT)/nt/inc/sys/time.h \
1516 $(LISP_H) \ 1544 $(LISP_H) \
1517 $(SRC)/buffer.h \ 1545 $(SRC)/buffer.h \
1518 $(SRC)/composite.h \ 1546 $(SRC)/composite.h \
1519 $(SRC)/dispextern.h \ 1547 $(SRC)/dispextern.h \
1520 $(SRC)/intervals.h \ 1548 $(SRC)/intervals.h \
1549 $(SRC)/systime.h \
1521 $(SRC)/w32gui.h \ 1550 $(SRC)/w32gui.h \
1522 $(SRC)/window.h 1551 $(SRC)/window.h
1523 1552
@@ -1530,10 +1559,12 @@ $(BLD)/tparam.$(O) : \
1530$(BLD)/undo.$(O) : \ 1559$(BLD)/undo.$(O) : \
1531 $(SRC)/undo.c \ 1560 $(SRC)/undo.c \
1532 $(CONFIG_H) \ 1561 $(CONFIG_H) \
1562 $(EMACS_ROOT)/nt/inc/sys/time.h \
1533 $(LISP_H) \ 1563 $(LISP_H) \
1534 $(SRC)/buffer.h \ 1564 $(SRC)/buffer.h \
1535 $(SRC)/commands.h \ 1565 $(SRC)/commands.h \
1536 $(SRC)/dispextern.h \ 1566 $(SRC)/dispextern.h \
1567 $(SRC)/systime.h \
1537 $(SRC)/w32gui.h \ 1568 $(SRC)/w32gui.h \
1538 $(SRC)/window.h 1569 $(SRC)/window.h
1539 1570
@@ -1577,6 +1608,7 @@ $(BLD)/window.$(O) : \
1577$(BLD)/xdisp.$(O) : \ 1608$(BLD)/xdisp.$(O) : \
1578 $(SRC)/xdisp.c \ 1609 $(SRC)/xdisp.c \
1579 $(CONFIG_H) \ 1610 $(CONFIG_H) \
1611 $(EMACS_ROOT)/nt/inc/unistd.h \
1580 $(EMACS_ROOT)/nt/inc/sys/time.h \ 1612 $(EMACS_ROOT)/nt/inc/sys/time.h \
1581 $(LISP_H) \ 1613 $(LISP_H) \
1582 $(PROCESS_H) \ 1614 $(PROCESS_H) \
@@ -1689,6 +1721,7 @@ $(BLD)/w32menu.$(O) : \
1689$(BLD)/w32term.$(O) : \ 1721$(BLD)/w32term.$(O) : \
1690 $(SRC)/w32term.c \ 1722 $(SRC)/w32term.c \
1691 $(CONFIG_H) \ 1723 $(CONFIG_H) \
1724 $(EMACS_ROOT)/nt/inc/unistd.h \
1692 $(EMACS_ROOT)/nt/inc/sys/ioctl.h \ 1725 $(EMACS_ROOT)/nt/inc/sys/ioctl.h \
1693 $(EMACS_ROOT)/nt/inc/sys/time.h \ 1726 $(EMACS_ROOT)/nt/inc/sys/time.h \
1694 $(LISP_H) \ 1727 $(LISP_H) \
@@ -1768,6 +1801,7 @@ $(BLD)/w32xfns.$(O) : \
1768$(BLD)/w32font.$(O) : \ 1801$(BLD)/w32font.$(O) : \
1769 $(SRC)/w32font.c \ 1802 $(SRC)/w32font.c \
1770 $(CONFIG_H) \ 1803 $(CONFIG_H) \
1804 $(EMACS_ROOT)/nt/inc/sys/time.h \
1771 $(LISP_H) \ 1805 $(LISP_H) \
1772 $(SRC)/ccl.h \ 1806 $(SRC)/ccl.h \
1773 $(SRC)/character.h \ 1807 $(SRC)/character.h \
@@ -1778,6 +1812,7 @@ $(BLD)/w32font.$(O) : \
1778 $(SRC)/font.h \ 1812 $(SRC)/font.h \
1779 $(SRC)/fontset.h \ 1813 $(SRC)/fontset.h \
1780 $(SRC)/frame.h \ 1814 $(SRC)/frame.h \
1815 $(SRC)/systime.h \
1781 $(SRC)/w32font.h \ 1816 $(SRC)/w32font.h \
1782 $(SRC)/w32gui.h \ 1817 $(SRC)/w32gui.h \
1783 $(SRC)/w32term.h 1818 $(SRC)/w32term.h
@@ -1785,6 +1820,7 @@ $(BLD)/w32font.$(O) : \
1785$(BLD)/w32uniscribe.$(O) : \ 1820$(BLD)/w32uniscribe.$(O) : \
1786 $(SRC)/w32uniscribe.c \ 1821 $(SRC)/w32uniscribe.c \
1787 $(CONFIG_H) \ 1822 $(CONFIG_H) \
1823 $(EMACS_ROOT)/nt/inc/sys/time.h \
1788 $(LISP_H) \ 1824 $(LISP_H) \
1789 $(SRC)/ccl.h \ 1825 $(SRC)/ccl.h \
1790 $(SRC)/character.h \ 1826 $(SRC)/character.h \
@@ -1794,6 +1830,7 @@ $(BLD)/w32uniscribe.$(O) : \
1794 $(SRC)/font.h \ 1830 $(SRC)/font.h \
1795 $(SRC)/fontset.h \ 1831 $(SRC)/fontset.h \
1796 $(SRC)/frame.h \ 1832 $(SRC)/frame.h \
1833 $(SRC)/systime.h \
1797 $(SRC)/w32font.h \ 1834 $(SRC)/w32font.h \
1798 $(SRC)/w32gui.h \ 1835 $(SRC)/w32gui.h \
1799 $(SRC)/w32term.h 1836 $(SRC)/w32term.h
diff --git a/src/menu.c b/src/menu.c
index 7a3edcb6f4f..e4338f349f6 100644
--- a/src/menu.c
+++ b/src/menu.c
@@ -21,6 +21,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
21#include <config.h> 21#include <config.h>
22#include <stdio.h> 22#include <stdio.h>
23#include <setjmp.h> 23#include <setjmp.h>
24#include <limits.h> /* for INT_MAX */
24 25
25#include "lisp.h" 26#include "lisp.h"
26#include "keyboard.h" 27#include "keyboard.h"
@@ -176,6 +177,8 @@ save_menu_items (void)
176static void 177static void
177grow_menu_items (void) 178grow_menu_items (void)
178{ 179{
180 if ((INT_MAX - MENU_ITEMS_PANE_LENGTH) / 2 < menu_items_allocated)
181 memory_full ();
179 menu_items_allocated *= 2; 182 menu_items_allocated *= 2;
180 menu_items = larger_vector (menu_items, menu_items_allocated, Qnil); 183 menu_items = larger_vector (menu_items, menu_items_allocated, Qnil);
181} 184}
@@ -1145,13 +1148,13 @@ no quit occurs and `x-popup-menu' returns nil. */)
1145#else /* not HAVE_X_WINDOWS */ 1148#else /* not HAVE_X_WINDOWS */
1146 Lisp_Object bar_window; 1149 Lisp_Object bar_window;
1147 enum scroll_bar_part part; 1150 enum scroll_bar_part part;
1148 unsigned long time; 1151 Time time;
1149 void (*mouse_position_hook) (struct frame **, int, 1152 void (*mouse_position_hook) (struct frame **, int,
1150 Lisp_Object *, 1153 Lisp_Object *,
1151 enum scroll_bar_part *, 1154 enum scroll_bar_part *,
1152 Lisp_Object *, 1155 Lisp_Object *,
1153 Lisp_Object *, 1156 Lisp_Object *,
1154 unsigned long *) = 1157 Time *) =
1155 FRAME_TERMINAL (new_f)->mouse_position_hook; 1158 FRAME_TERMINAL (new_f)->mouse_position_hook;
1156 1159
1157 if (mouse_position_hook) 1160 if (mouse_position_hook)
diff --git a/src/menu.h b/src/menu.h
index c3978dae8eb..451401b42d5 100644
--- a/src/menu.h
+++ b/src/menu.h
@@ -19,6 +19,8 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
19#ifndef MENU_H 19#ifndef MENU_H
20#define MENU_H 20#define MENU_H
21 21
22#include "systime.h" /* for Time */
23
22extern void x_set_menu_bar_lines (struct frame *f, 24extern void x_set_menu_bar_lines (struct frame *f,
23 Lisp_Object value, 25 Lisp_Object value,
24 Lisp_Object oldval); 26 Lisp_Object oldval);
@@ -48,6 +50,5 @@ extern Lisp_Object w32_menu_show (FRAME_PTR, int, int, int, int,
48extern Lisp_Object ns_menu_show (FRAME_PTR, int, int, int, int, 50extern Lisp_Object ns_menu_show (FRAME_PTR, int, int, int, int,
49 Lisp_Object, const char **); 51 Lisp_Object, const char **);
50extern Lisp_Object xmenu_show (FRAME_PTR, int, int, int, int, 52extern Lisp_Object xmenu_show (FRAME_PTR, int, int, int, int,
51 Lisp_Object, const char **, EMACS_UINT); 53 Lisp_Object, const char **, Time);
52#endif /* MENU_H */ 54#endif /* MENU_H */
53
diff --git a/src/msdos.c b/src/msdos.c
index 3dc586e42f5..73804df55cc 100644
--- a/src/msdos.c
+++ b/src/msdos.c
@@ -287,7 +287,7 @@ mouse_button_depressed (int b, int *xp, int *yp)
287void 287void
288mouse_get_pos (FRAME_PTR *f, int insist, Lisp_Object *bar_window, 288mouse_get_pos (FRAME_PTR *f, int insist, Lisp_Object *bar_window,
289 enum scroll_bar_part *part, Lisp_Object *x, Lisp_Object *y, 289 enum scroll_bar_part *part, Lisp_Object *x, Lisp_Object *y,
290 unsigned long *time) 290 Time *time)
291{ 291{
292 int ix, iy; 292 int ix, iy;
293 Lisp_Object frame, tail; 293 Lisp_Object frame, tail;
diff --git a/src/nsterm.m b/src/nsterm.m
index c4756dc83cd..ac9c44a57a9 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -158,7 +158,7 @@ long context_menu_value = 0;
158/* display update */ 158/* display update */
159NSPoint last_mouse_motion_position; 159NSPoint last_mouse_motion_position;
160static NSRect last_mouse_glyph; 160static NSRect last_mouse_glyph;
161static unsigned long last_mouse_movement_time = 0; 161static Time last_mouse_movement_time = 0;
162static Lisp_Object last_mouse_motion_frame; 162static Lisp_Object last_mouse_motion_frame;
163static EmacsScroller *last_mouse_scroll_bar = nil; 163static EmacsScroller *last_mouse_scroll_bar = nil;
164static struct frame *ns_updating_frame; 164static struct frame *ns_updating_frame;
@@ -1789,7 +1789,7 @@ note_mouse_movement (struct frame *frame, float x, float y)
1789static void 1789static void
1790ns_mouse_position (struct frame **fp, int insist, Lisp_Object *bar_window, 1790ns_mouse_position (struct frame **fp, int insist, Lisp_Object *bar_window,
1791 enum scroll_bar_part *part, Lisp_Object *x, Lisp_Object *y, 1791 enum scroll_bar_part *part, Lisp_Object *x, Lisp_Object *y,
1792 unsigned long *time) 1792 Time *time)
1793/* -------------------------------------------------------------------------- 1793/* --------------------------------------------------------------------------
1794 External (hook): inform emacs about mouse position and hit parts. 1794 External (hook): inform emacs about mouse position and hit parts.
1795 If a scrollbar is being dragged, set bar_window, part, x, y, time. 1795 If a scrollbar is being dragged, set bar_window, part, x, y, time.
@@ -6531,5 +6531,3 @@ baseline level. The default value is nil. */);
6531 /* Tell emacs about this window system. */ 6531 /* Tell emacs about this window system. */
6532 Fprovide (intern ("ns"), Qnil); 6532 Fprovide (intern ("ns"), Qnil);
6533} 6533}
6534
6535
diff --git a/src/systime.h b/src/systime.h
index cb1ea230f7d..db43b26dc5e 100644
--- a/src/systime.h
+++ b/src/systime.h
@@ -30,6 +30,12 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
30#endif 30#endif
31#endif 31#endif
32 32
33#ifdef HAVE_X_WINDOWS
34# include <X11/X.h>
35#else
36typedef unsigned long Time;
37#endif
38
33#ifdef HAVE_TZNAME 39#ifdef HAVE_TZNAME
34#ifndef tzname /* For SGI. */ 40#ifndef tzname /* For SGI. */
35extern char *tzname[]; /* RS6000 and others want it this way. */ 41extern char *tzname[]; /* RS6000 and others want it this way. */
diff --git a/src/term.c b/src/term.c
index c68228cc51a..9205719b5f4 100644
--- a/src/term.c
+++ b/src/term.c
@@ -2595,6 +2595,7 @@ frame's terminal). */)
2595 FRAME_SET_VISIBLE (XFRAME (t->display_info.tty->top_frame), 1); 2595 FRAME_SET_VISIBLE (XFRAME (t->display_info.tty->top_frame), 1);
2596 } 2596 }
2597 2597
2598 set_tty_hooks (t);
2598 init_sys_modes (t->display_info.tty); 2599 init_sys_modes (t->display_info.tty);
2599 2600
2600 { 2601 {
@@ -2698,9 +2699,10 @@ term_mouse_movement (FRAME_PTR frame, Gpm_Event *event)
2698static void 2699static void
2699term_mouse_position (FRAME_PTR *fp, int insist, Lisp_Object *bar_window, 2700term_mouse_position (FRAME_PTR *fp, int insist, Lisp_Object *bar_window,
2700 enum scroll_bar_part *part, Lisp_Object *x, 2701 enum scroll_bar_part *part, Lisp_Object *x,
2701 Lisp_Object *y, unsigned long *timeptr) 2702 Lisp_Object *y, Time *timeptr)
2702{ 2703{
2703 struct timeval now; 2704 struct timeval now;
2705 Time sec, usec;
2704 2706
2705 *fp = SELECTED_FRAME (); 2707 *fp = SELECTED_FRAME ();
2706 (*fp)->mouse_moved = 0; 2708 (*fp)->mouse_moved = 0;
@@ -2711,7 +2713,9 @@ term_mouse_position (FRAME_PTR *fp, int insist, Lisp_Object *bar_window,
2711 XSETINT (*x, last_mouse_x); 2713 XSETINT (*x, last_mouse_x);
2712 XSETINT (*y, last_mouse_y); 2714 XSETINT (*y, last_mouse_y);
2713 gettimeofday(&now, 0); 2715 gettimeofday(&now, 0);
2714 *timeptr = (now.tv_sec * 1000) + (now.tv_usec / 1000); 2716 sec = now.tv_sec;
2717 usec = now.tv_usec;
2718 *timeptr = (sec * 1000) + (usec / 1000);
2715} 2719}
2716 2720
2717/* Prepare a mouse-event in *RESULT for placement in the input queue. 2721/* Prepare a mouse-event in *RESULT for placement in the input queue.
diff --git a/src/termhooks.h b/src/termhooks.h
index 3a49b49aede..34e1364effd 100644
--- a/src/termhooks.h
+++ b/src/termhooks.h
@@ -20,6 +20,8 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
20 20
21/* Miscellanea. */ 21/* Miscellanea. */
22 22
23#include "systime.h" /* for Time */
24
23struct glyph; 25struct glyph;
24struct frame; 26struct frame;
25 27
@@ -233,7 +235,7 @@ struct input_event
233 int modifiers; /* See enum below for interpretation. */ 235 int modifiers; /* See enum below for interpretation. */
234 236
235 Lisp_Object x, y; 237 Lisp_Object x, y;
236 unsigned long timestamp; 238 Time timestamp;
237 239
238 /* This is padding just to put the frame_or_window field 240 /* This is padding just to put the frame_or_window field
239 past the size of struct selection_input_event. */ 241 past the size of struct selection_input_event. */
@@ -463,7 +465,7 @@ struct terminal
463 enum scroll_bar_part *part, 465 enum scroll_bar_part *part,
464 Lisp_Object *x, 466 Lisp_Object *x,
465 Lisp_Object *y, 467 Lisp_Object *y,
466 unsigned long *); 468 Time *);
467 469
468 /* The window system handling code should set this if the mouse has 470 /* The window system handling code should set this if the mouse has
469 moved since the last call to the mouse_position_hook. Calling that 471 moved since the last call to the mouse_position_hook. Calling that
diff --git a/src/w32gui.h b/src/w32gui.h
index 936709af181..2ba9cb53e22 100644
--- a/src/w32gui.h
+++ b/src/w32gui.h
@@ -20,6 +20,8 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
20#define EMACS_W32GUI_H 20#define EMACS_W32GUI_H
21#include <windows.h> 21#include <windows.h>
22 22
23#include "systime.h" /* for Time */
24
23/* Local memory management for menus. */ 25/* Local memory management for menus. */
24#define local_heap (GetProcessHeap ()) 26#define local_heap (GetProcessHeap ())
25#define local_alloc(n) (HeapAlloc (local_heap, HEAP_ZERO_MEMORY, (n))) 27#define local_alloc(n) (HeapAlloc (local_heap, HEAP_ZERO_MEMORY, (n)))
@@ -47,7 +49,6 @@ typedef char * XrmDatabase;
47 49
48typedef XGCValues * GC; 50typedef XGCValues * GC;
49typedef COLORREF Color; 51typedef COLORREF Color;
50typedef DWORD Time;
51typedef HWND Window; 52typedef HWND Window;
52typedef HDC Display; /* HDC so it doesn't conflict with xpm lib. */ 53typedef HDC Display; /* HDC so it doesn't conflict with xpm lib. */
53typedef HCURSOR Cursor; 54typedef HCURSOR Cursor;
@@ -147,4 +148,3 @@ typedef struct {
147 148
148 149
149#endif /* EMACS_W32GUI_H */ 150#endif /* EMACS_W32GUI_H */
150
diff --git a/src/w32inevt.c b/src/w32inevt.c
index 465f5ccb70f..fddde61663f 100644
--- a/src/w32inevt.c
+++ b/src/w32inevt.c
@@ -45,7 +45,7 @@ extern HANDLE keyboard_handle;
45 45
46/* Info for last mouse motion */ 46/* Info for last mouse motion */
47static COORD movement_pos; 47static COORD movement_pos;
48static DWORD movement_time; 48static Time movement_time;
49 49
50/* from w32fns.c */ 50/* from w32fns.c */
51extern unsigned int map_keypad_keys (unsigned int, unsigned int); 51extern unsigned int map_keypad_keys (unsigned int, unsigned int);
@@ -544,7 +544,7 @@ w32_console_mouse_position (FRAME_PTR *f,
544 enum scroll_bar_part *part, 544 enum scroll_bar_part *part,
545 Lisp_Object *x, 545 Lisp_Object *x,
546 Lisp_Object *y, 546 Lisp_Object *y,
547 unsigned long *time) 547 Time *time)
548{ 548{
549 BLOCK_INPUT; 549 BLOCK_INPUT;
550 550
@@ -756,4 +756,3 @@ w32_console_read_socket (struct terminal *terminal,
756 UNBLOCK_INPUT; 756 UNBLOCK_INPUT;
757 return ret; 757 return ret;
758} 758}
759
diff --git a/src/w32menu.c b/src/w32menu.c
index ca763b553cf..e2f6de7f0c8 100644
--- a/src/w32menu.c
+++ b/src/w32menu.c
@@ -146,7 +146,7 @@ otherwise it is "Question". */)
146 FRAME_PTR new_f = SELECTED_FRAME (); 146 FRAME_PTR new_f = SELECTED_FRAME ();
147 Lisp_Object bar_window; 147 Lisp_Object bar_window;
148 enum scroll_bar_part part; 148 enum scroll_bar_part part;
149 unsigned long time; 149 Time time;
150 Lisp_Object x, y; 150 Lisp_Object x, y;
151 151
152 (*mouse_position_hook) (&new_f, 1, &bar_window, &part, &x, &y, &time); 152 (*mouse_position_hook) (&new_f, 1, &bar_window, &part, &x, &y, &time);
diff --git a/src/window.c b/src/window.c
index 4dbee41c5f4..bc9f31e03e8 100644
--- a/src/window.c
+++ b/src/window.c
@@ -3094,11 +3094,14 @@ size_window (Lisp_Object window, int size, int width_p, int nodelete_p, int firs
3094 Lisp_Object last_child; 3094 Lisp_Object last_child;
3095 int child_size; 3095 int child_size;
3096 3096
3097 for (child = *forward; !NILP (child); child = c->next) 3097 child = *forward;
3098 do
3098 { 3099 {
3099 c = XWINDOW (child); 3100 c = XWINDOW (child);
3100 last_child = child; 3101 last_child = child;
3102 child = c->next;
3101 } 3103 }
3104 while (!NILP (child));
3102 3105
3103 child_size = WINDOW_TOTAL_SIZE (c, width_p); 3106 child_size = WINDOW_TOTAL_SIZE (c, width_p);
3104 size_window (last_child, size - old_size + child_size, 3107 size_window (last_child, size - old_size + child_size,
diff --git a/src/xmenu.c b/src/xmenu.c
index 2a4359fa84a..7d7515a8f25 100644
--- a/src/xmenu.c
+++ b/src/xmenu.c
@@ -240,7 +240,7 @@ for instance using the window manager, then this produces a quit and
240 FRAME_PTR new_f = SELECTED_FRAME (); 240 FRAME_PTR new_f = SELECTED_FRAME ();
241 Lisp_Object bar_window; 241 Lisp_Object bar_window;
242 enum scroll_bar_part part; 242 enum scroll_bar_part part;
243 unsigned long time; 243 Time time;
244 Lisp_Object x, y; 244 Lisp_Object x, y;
245 245
246 (*mouse_position_hook) (&new_f, 1, &bar_window, &part, &x, &y, &time); 246 (*mouse_position_hook) (&new_f, 1, &bar_window, &part, &x, &y, &time);
@@ -922,7 +922,7 @@ set_frame_menubar (FRAME_PTR f, int first_time, int deep_p)
922#endif 922#endif
923 Lisp_Object items; 923 Lisp_Object items;
924 widget_value *wv, *first_wv, *prev_wv = 0; 924 widget_value *wv, *first_wv, *prev_wv = 0;
925 EMACS_UINT i, last_i = 0; 925 int i;
926 int *submenu_start, *submenu_end; 926 int *submenu_start, *submenu_end;
927 int *submenu_top_level_items, *submenu_n_panes; 927 int *submenu_top_level_items, *submenu_n_panes;
928 928
@@ -966,7 +966,7 @@ set_frame_menubar (FRAME_PTR f, int first_time, int deep_p)
966 Lisp_Object *previous_items 966 Lisp_Object *previous_items
967 = (Lisp_Object *) alloca (previous_menu_items_used 967 = (Lisp_Object *) alloca (previous_menu_items_used
968 * sizeof (Lisp_Object)); 968 * sizeof (Lisp_Object));
969 EMACS_UINT subitems; 969 int subitems;
970 970
971 /* If we are making a new widget, its contents are empty, 971 /* If we are making a new widget, its contents are empty,
972 do always reinitialize them. */ 972 do always reinitialize them. */
@@ -1012,7 +1012,7 @@ set_frame_menubar (FRAME_PTR f, int first_time, int deep_p)
1012 menu_items = f->menu_bar_vector; 1012 menu_items = f->menu_bar_vector;
1013 menu_items_allocated = VECTORP (menu_items) ? ASIZE (menu_items) : 0; 1013 menu_items_allocated = VECTORP (menu_items) ? ASIZE (menu_items) : 0;
1014 subitems = ASIZE (items) / 4; 1014 subitems = ASIZE (items) / 4;
1015 submenu_start = (int *) alloca (subitems * sizeof (int)); 1015 submenu_start = (int *) alloca ((subitems + 1) * sizeof (int));
1016 submenu_end = (int *) alloca (subitems * sizeof (int)); 1016 submenu_end = (int *) alloca (subitems * sizeof (int));
1017 submenu_n_panes = (int *) alloca (subitems * sizeof (int)); 1017 submenu_n_panes = (int *) alloca (subitems * sizeof (int));
1018 submenu_top_level_items = (int *) alloca (subitems * sizeof (int)); 1018 submenu_top_level_items = (int *) alloca (subitems * sizeof (int));
@@ -1021,8 +1021,6 @@ set_frame_menubar (FRAME_PTR f, int first_time, int deep_p)
1021 { 1021 {
1022 Lisp_Object key, string, maps; 1022 Lisp_Object key, string, maps;
1023 1023
1024 last_i = i;
1025
1026 key = XVECTOR (items)->contents[4 * i]; 1024 key = XVECTOR (items)->contents[4 * i];
1027 string = XVECTOR (items)->contents[4 * i + 1]; 1025 string = XVECTOR (items)->contents[4 * i + 1];
1028 maps = XVECTOR (items)->contents[4 * i + 2]; 1026 maps = XVECTOR (items)->contents[4 * i + 2];
@@ -1039,6 +1037,7 @@ set_frame_menubar (FRAME_PTR f, int first_time, int deep_p)
1039 submenu_end[i] = menu_items_used; 1037 submenu_end[i] = menu_items_used;
1040 } 1038 }
1041 1039
1040 submenu_start[i] = -1;
1042 finish_menu_items (); 1041 finish_menu_items ();
1043 1042
1044 /* Convert menu_items into widget_value trees 1043 /* Convert menu_items into widget_value trees
@@ -1052,7 +1051,7 @@ set_frame_menubar (FRAME_PTR f, int first_time, int deep_p)
1052 wv->help = Qnil; 1051 wv->help = Qnil;
1053 first_wv = wv; 1052 first_wv = wv;
1054 1053
1055 for (i = 0; i < last_i; i++) 1054 for (i = 0; 0 <= submenu_start[i]; i++)
1056 { 1055 {
1057 menu_items_n_panes = submenu_n_panes[i]; 1056 menu_items_n_panes = submenu_n_panes[i];
1058 wv = digest_single_submenu (submenu_start[i], submenu_end[i], 1057 wv = digest_single_submenu (submenu_start[i], submenu_end[i],
@@ -1421,7 +1420,8 @@ pop_down_menu (Lisp_Object arg)
1421 menu pops down. 1420 menu pops down.
1422 menu_item_selection will be set to the selection. */ 1421 menu_item_selection will be set to the selection. */
1423static void 1422static void
1424create_and_show_popup_menu (FRAME_PTR f, widget_value *first_wv, int x, int y, int for_click, EMACS_UINT timestamp) 1423create_and_show_popup_menu (FRAME_PTR f, widget_value *first_wv, int x, int y,
1424 int for_click, Time timestamp)
1425{ 1425{
1426 int i; 1426 int i;
1427 GtkWidget *menu; 1427 GtkWidget *menu;
@@ -1465,7 +1465,7 @@ create_and_show_popup_menu (FRAME_PTR f, widget_value *first_wv, int x, int y, i
1465 gtk_widget_show_all (menu); 1465 gtk_widget_show_all (menu);
1466 1466
1467 gtk_menu_popup (GTK_MENU (menu), 0, 0, pos_func, &popup_x_y, i, 1467 gtk_menu_popup (GTK_MENU (menu), 0, 0, pos_func, &popup_x_y, i,
1468 timestamp > 0 ? timestamp : gtk_get_current_event_time()); 1468 timestamp ? timestamp : gtk_get_current_event_time ());
1469 1469
1470 record_unwind_protect (pop_down_menu, make_save_value (menu, 0)); 1470 record_unwind_protect (pop_down_menu, make_save_value (menu, 0));
1471 1471
@@ -1525,7 +1525,7 @@ pop_down_menu (Lisp_Object arg)
1525 menu_item_selection will be set to the selection. */ 1525 menu_item_selection will be set to the selection. */
1526static void 1526static void
1527create_and_show_popup_menu (FRAME_PTR f, widget_value *first_wv, 1527create_and_show_popup_menu (FRAME_PTR f, widget_value *first_wv,
1528 int x, int y, int for_click, EMACS_UINT timestamp) 1528 int x, int y, int for_click, Time timestamp)
1529{ 1529{
1530 int i; 1530 int i;
1531 Arg av[2]; 1531 Arg av[2];
@@ -1599,7 +1599,7 @@ create_and_show_popup_menu (FRAME_PTR f, widget_value *first_wv,
1599 1599
1600Lisp_Object 1600Lisp_Object
1601xmenu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps, 1601xmenu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps,
1602 Lisp_Object title, const char **error_name, EMACS_UINT timestamp) 1602 Lisp_Object title, const char **error_name, Time timestamp)
1603{ 1603{
1604 int i; 1604 int i;
1605 widget_value *wv, *save_wv = 0, *first_wv = 0, *prev_wv = 0; 1605 widget_value *wv, *save_wv = 0, *first_wv = 0, *prev_wv = 0;
@@ -2242,7 +2242,7 @@ pop_down_menu (Lisp_Object arg)
2242 2242
2243Lisp_Object 2243Lisp_Object
2244xmenu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps, 2244xmenu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps,
2245 Lisp_Object title, const char **error_name, EMACS_UINT timestamp) 2245 Lisp_Object title, const char **error_name, Time timestamp)
2246{ 2246{
2247 Window root; 2247 Window root;
2248 XMenu *menu; 2248 XMenu *menu;
diff --git a/src/xselect.c b/src/xselect.c
index f11fc40fce8..3ddd4c54b49 100644
--- a/src/xselect.c
+++ b/src/xselect.c
@@ -121,10 +121,6 @@ static Lisp_Object Qforeign_selection;
121 121
122#define SELECTION_QUANTUM(dpy) ((XMaxRequestSize(dpy) << 2) - 100) 122#define SELECTION_QUANTUM(dpy) ((XMaxRequestSize(dpy) << 2) - 100)
123 123
124/* The timestamp of the last input event Emacs received from the X server. */
125/* Defined in keyboard.c. */
126extern unsigned long last_event_timestamp;
127
128/* This is an association list whose elements are of the form 124/* This is an association list whose elements are of the form
129 ( SELECTION-NAME SELECTION-VALUE SELECTION-TIMESTAMP FRAME) 125 ( SELECTION-NAME SELECTION-VALUE SELECTION-TIMESTAMP FRAME)
130 SELECTION-NAME is a lisp symbol, whose name is the name of an X Atom. 126 SELECTION-NAME is a lisp symbol, whose name is the name of an X Atom.
@@ -356,7 +352,7 @@ x_own_selection (Lisp_Object selection_name, Lisp_Object selection_value)
356 Lisp_Object selection_data; 352 Lisp_Object selection_data;
357 Lisp_Object prev_value; 353 Lisp_Object prev_value;
358 354
359 selection_time = long_to_cons ((unsigned long) timestamp); 355 selection_time = long_to_cons (timestamp);
360 selection_data = list4 (selection_name, selection_value, 356 selection_data = list4 (selection_name, selection_value,
361 selection_time, selected_frame); 357 selection_time, selected_frame);
362 prev_value = assq_no_quit (selection_name, Vselection_alist); 358 prev_value = assq_no_quit (selection_name, Vselection_alist);
diff --git a/src/xterm.c b/src/xterm.c
index 2352f51cfb7..64030a3151d 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -342,7 +342,7 @@ static struct scroll_bar *x_window_to_scroll_bar (Display *, Window);
342static void x_scroll_bar_report_motion (struct frame **, Lisp_Object *, 342static void x_scroll_bar_report_motion (struct frame **, Lisp_Object *,
343 enum scroll_bar_part *, 343 enum scroll_bar_part *,
344 Lisp_Object *, Lisp_Object *, 344 Lisp_Object *, Lisp_Object *,
345 unsigned long *); 345 Time *);
346static void x_handle_net_wm_state (struct frame *, XPropertyEvent *); 346static void x_handle_net_wm_state (struct frame *, XPropertyEvent *);
347static void x_check_fullscreen (struct frame *); 347static void x_check_fullscreen (struct frame *);
348static void x_check_expected_move (struct frame *, int, int); 348static void x_check_expected_move (struct frame *, int, int);
@@ -3637,23 +3637,23 @@ x_find_modifier_meanings (struct x_display_info *dpyinfo)
3637/* Convert between the modifier bits X uses and the modifier bits 3637/* Convert between the modifier bits X uses and the modifier bits
3638 Emacs uses. */ 3638 Emacs uses. */
3639 3639
3640unsigned int 3640EMACS_INT
3641x_x_to_emacs_modifiers (struct x_display_info *dpyinfo, unsigned int state) 3641x_x_to_emacs_modifiers (struct x_display_info *dpyinfo, int state)
3642{ 3642{
3643 EMACS_UINT mod_meta = meta_modifier; 3643 EMACS_INT mod_meta = meta_modifier;
3644 EMACS_UINT mod_alt = alt_modifier; 3644 EMACS_INT mod_alt = alt_modifier;
3645 EMACS_UINT mod_hyper = hyper_modifier; 3645 EMACS_INT mod_hyper = hyper_modifier;
3646 EMACS_UINT mod_super = super_modifier; 3646 EMACS_INT mod_super = super_modifier;
3647 Lisp_Object tem; 3647 Lisp_Object tem;
3648 3648
3649 tem = Fget (Vx_alt_keysym, Qmodifier_value); 3649 tem = Fget (Vx_alt_keysym, Qmodifier_value);
3650 if (! EQ (tem, Qnil)) mod_alt = XUINT (tem); 3650 if (INTEGERP (tem)) mod_alt = XINT (tem);
3651 tem = Fget (Vx_meta_keysym, Qmodifier_value); 3651 tem = Fget (Vx_meta_keysym, Qmodifier_value);
3652 if (! EQ (tem, Qnil)) mod_meta = XUINT (tem); 3652 if (INTEGERP (tem)) mod_meta = XINT (tem);
3653 tem = Fget (Vx_hyper_keysym, Qmodifier_value); 3653 tem = Fget (Vx_hyper_keysym, Qmodifier_value);
3654 if (! EQ (tem, Qnil)) mod_hyper = XUINT (tem); 3654 if (INTEGERP (tem)) mod_hyper = XINT (tem);
3655 tem = Fget (Vx_super_keysym, Qmodifier_value); 3655 tem = Fget (Vx_super_keysym, Qmodifier_value);
3656 if (! EQ (tem, Qnil)) mod_super = XUINT (tem); 3656 if (INTEGERP (tem)) mod_super = XINT (tem);
3657 3657
3658 3658
3659 return ( ((state & (ShiftMask | dpyinfo->shift_lock_mask)) ? shift_modifier : 0) 3659 return ( ((state & (ShiftMask | dpyinfo->shift_lock_mask)) ? shift_modifier : 0)
@@ -3664,24 +3664,24 @@ x_x_to_emacs_modifiers (struct x_display_info *dpyinfo, unsigned int state)
3664 | ((state & dpyinfo->hyper_mod_mask) ? mod_hyper : 0)); 3664 | ((state & dpyinfo->hyper_mod_mask) ? mod_hyper : 0));
3665} 3665}
3666 3666
3667static unsigned int 3667static int
3668x_emacs_to_x_modifiers (struct x_display_info *dpyinfo, unsigned int state) 3668x_emacs_to_x_modifiers (struct x_display_info *dpyinfo, EMACS_INT state)
3669{ 3669{
3670 EMACS_UINT mod_meta = meta_modifier; 3670 int mod_meta = meta_modifier;
3671 EMACS_UINT mod_alt = alt_modifier; 3671 int mod_alt = alt_modifier;
3672 EMACS_UINT mod_hyper = hyper_modifier; 3672 int mod_hyper = hyper_modifier;
3673 EMACS_UINT mod_super = super_modifier; 3673 int mod_super = super_modifier;
3674 3674
3675 Lisp_Object tem; 3675 Lisp_Object tem;
3676 3676
3677 tem = Fget (Vx_alt_keysym, Qmodifier_value); 3677 tem = Fget (Vx_alt_keysym, Qmodifier_value);
3678 if (! EQ (tem, Qnil)) mod_alt = XUINT (tem); 3678 if (INTEGERP (tem)) mod_alt = XINT (tem);
3679 tem = Fget (Vx_meta_keysym, Qmodifier_value); 3679 tem = Fget (Vx_meta_keysym, Qmodifier_value);
3680 if (! EQ (tem, Qnil)) mod_meta = XUINT (tem); 3680 if (INTEGERP (tem)) mod_meta = XINT (tem);
3681 tem = Fget (Vx_hyper_keysym, Qmodifier_value); 3681 tem = Fget (Vx_hyper_keysym, Qmodifier_value);
3682 if (! EQ (tem, Qnil)) mod_hyper = XUINT (tem); 3682 if (INTEGERP (tem)) mod_hyper = XINT (tem);
3683 tem = Fget (Vx_super_keysym, Qmodifier_value); 3683 tem = Fget (Vx_super_keysym, Qmodifier_value);
3684 if (! EQ (tem, Qnil)) mod_super = XUINT (tem); 3684 if (INTEGERP (tem)) mod_super = XINT (tem);
3685 3685
3686 3686
3687 return ( ((state & mod_alt) ? dpyinfo->alt_mod_mask : 0) 3687 return ( ((state & mod_alt) ? dpyinfo->alt_mod_mask : 0)
@@ -3827,7 +3827,7 @@ redo_mouse_highlight (void)
3827static void 3827static void
3828XTmouse_position (FRAME_PTR *fp, int insist, Lisp_Object *bar_window, 3828XTmouse_position (FRAME_PTR *fp, int insist, Lisp_Object *bar_window,
3829 enum scroll_bar_part *part, Lisp_Object *x, Lisp_Object *y, 3829 enum scroll_bar_part *part, Lisp_Object *x, Lisp_Object *y,
3830 long unsigned int *timestamp) 3830 Time *timestamp)
3831{ 3831{
3832 FRAME_PTR f1; 3832 FRAME_PTR f1;
3833 3833
@@ -5562,7 +5562,7 @@ x_scroll_bar_note_movement (struct scroll_bar *bar, XEvent *event)
5562static void 5562static void
5563x_scroll_bar_report_motion (FRAME_PTR *fp, Lisp_Object *bar_window, 5563x_scroll_bar_report_motion (FRAME_PTR *fp, Lisp_Object *bar_window,
5564 enum scroll_bar_part *part, Lisp_Object *x, 5564 enum scroll_bar_part *part, Lisp_Object *x,
5565 Lisp_Object *y, long unsigned int *timestamp) 5565 Lisp_Object *y, Time *timestamp)
5566{ 5566{
5567 struct scroll_bar *bar = XSCROLL_BAR (last_mouse_scroll_bar); 5567 struct scroll_bar *bar = XSCROLL_BAR (last_mouse_scroll_bar);
5568 Window w = bar->x_window; 5568 Window w = bar->x_window;
diff --git a/src/xterm.h b/src/xterm.h
index fbd638fe73b..1b90b6d8ff4 100644
--- a/src/xterm.h
+++ b/src/xterm.h
@@ -989,8 +989,7 @@ extern void x_mouse_leave (struct x_display_info *);
989#ifdef USE_X_TOOLKIT 989#ifdef USE_X_TOOLKIT
990extern int x_dispatch_event (XEvent *, Display *); 990extern int x_dispatch_event (XEvent *, Display *);
991#endif 991#endif
992extern unsigned int x_x_to_emacs_modifiers (struct x_display_info *, 992extern EMACS_INT x_x_to_emacs_modifiers (struct x_display_info *, int);
993 unsigned);
994extern int x_display_pixel_height (struct x_display_info *); 993extern int x_display_pixel_height (struct x_display_info *);
995extern int x_display_pixel_width (struct x_display_info *); 994extern int x_display_pixel_width (struct x_display_info *);
996 995