aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert2011-04-16 16:11:35 -0700
committerPaul Eggert2011-04-16 16:11:35 -0700
commitfd35b6f96777be3305879a9ca60ab5befb254042 (patch)
treedb72c649acdc7f53d9672fba88b6a08b3601cdda /src
parentc4354cb4f4a3982331180439120ca72734d49cc5 (diff)
parent399c71d323b8beef139437311c78440d0033c652 (diff)
downloademacs-fd35b6f96777be3305879a9ca60ab5befb254042.tar.gz
emacs-fd35b6f96777be3305879a9ca60ab5befb254042.zip
Static checks with GCC 4.6.0 and non-default toolkits.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog104
-rw-r--r--src/alloc.c25
-rw-r--r--src/bitmaps/cntrpmsk.xbm8
-rw-r--r--src/bitmaps/cntrptr.xbm8
-rw-r--r--src/bitmaps/crosswv.xbm8
-rw-r--r--src/bitmaps/dimple1.xbm8
-rw-r--r--src/bitmaps/dimple3.xbm8
-rw-r--r--src/bitmaps/gray.xbm2
-rw-r--r--src/bitmaps/gray1.xbm4
-rw-r--r--src/bitmaps/gray3.xbm4
-rw-r--r--src/bitmaps/leftpmsk.xbm8
-rw-r--r--src/bitmaps/leftptr.xbm8
-rw-r--r--src/bitmaps/rtpmsk.xbm8
-rw-r--r--src/bitmaps/rtptr.xbm8
-rw-r--r--src/bitmaps/stipple.xbm4
-rw-r--r--src/data.c4
-rw-r--r--src/dispextern.h7
-rw-r--r--src/emacs.c14
-rw-r--r--src/eval.c1
-rw-r--r--src/fns.c5
-rw-r--r--src/frame.c25
-rw-r--r--src/frame.h4
-rw-r--r--src/insdel.c3
-rw-r--r--src/keyboard.c3
-rw-r--r--src/menu.c23
-rw-r--r--src/process.c11
-rw-r--r--src/s/sol2-6.h3
-rw-r--r--src/s/unixware.h2
-rw-r--r--src/s/usg5-4-common.h6
-rw-r--r--src/sysdep.c2
-rw-r--r--src/termhooks.h8
-rw-r--r--src/xdisp.c7
-rw-r--r--src/xfaces.c2
-rw-r--r--src/xfns.c44
-rw-r--r--src/xgselect.c5
-rw-r--r--src/xmenu.c52
-rw-r--r--src/xrdb.c2
-rw-r--r--src/xsmfns.c11
-rw-r--r--src/xterm.c50
-rw-r--r--src/xterm.h4
40 files changed, 336 insertions, 177 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index d9f764cde85..908f885cafd 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,107 @@
12011-04-16 Paul Eggert <eggert@cs.ucla.edu>
2
3 Static checks with GCC 4.6.0 and non-default toolkits.
4
5 * s/sol2-6.h, s/unixware.h (PTY_TTY_NAME_SPRINTF): Protoize decl.
6
7 * process.c (keyboard_bit_set): Define only if SIGIO.
8 (send_process_trap): Mark it with NO_RETURN if it doesn't return.
9 (send_process): Repair possible setjmp clobbering.
10
11 * s/usg5-4-common.h (SETUP_SLAVE_PTY): Don't pass extra arg to 'fatal'.
12
13 * eval.c: Include <stdio.h>, for vsnprintf on non-GNU/Linux hosts.
14
15 * data.c (arith_error): Mark with NO_RETURN if it doesn't return.
16
17 * alloc.c (bytes_used_when_full, SPARE_MEMORY, BYTES_USED):
18 Define only if needed.
19
20 * sysdep.c (_FILE_OFFSET_BITS): Make this hack even uglier
21 by pacifying GCC about it. Maybe it's time to retire it?
22 * xfaces.c (USG, __TIMEVAL__): Likewise.
23
24 * dispextern.h (struct redisplay_interface): Rename param
25 to avoid shadowing.
26 * termhooks.h (struct terminal): Likewise.
27 * xterm.c (xembed_send_message): Likewise.
28
29 * insdel.c (make_gap_smaller): Define only if
30 USE_MMAP_FOR_BUFFERS || REL_ALLOC || DOUG_LEA_MALLOC.
31
32 * keyboard.c (read_char): Make a var volatile so longjmp won't clobber
33 it.
34
35 * emacs.c (MAX_HEAP_BSS_DIFF, my_edata): Move to where they're used,
36 so that we aren't warned about unused symbols.
37
38 * xfns.c (Fx_file_dialog): Rename local to avoid shadowing.
39
40 * xdisp.c (x_produce_glyphs): Mark var as initialized (Bug#8512).
41
42 * xfns.c (x_real_positions): Mark locals as initialized.
43
44 * xmenu.c (xmenu_show): Don't use uninitialized vars.
45
46 * xterm.c: Fix problems found by static analysis with other toolkits.
47 (toolkit_scroll_bar_interaction): Define and use only if USE_X_TOOLKIT.
48 (x_dispatch_event): Declare static if USE_GTK, and
49 define if USE_GTK || USE_X_TOOLKIT.
50 (SET_SAVED_BUTTON_EVENT): Define only if USE_X_TOOLKIT || USE_GTK.
51 * xterm.h (x_dispatch_event): Extern only if USE_X_TOOLKIT.
52 * xterm.c, xterm.h (x_mouse_leave): Bring this function back, but only if
53 defined HAVE_MENUS && !defined USE_X_TOOLKIT && !defined USE_GTK.
54
55 * xmenu.c (menu_help_callback): Pointer type fixes.
56 Use const pointers when pointing at readonly data. Avoid pointer
57 signedness clashes.
58 (FALSE): Remove unused macro.
59 (update_frame_menubar): Remove unused decl.
60
61 * xfns.c (Fx_hide_tip): Move locals to avoid shadowing.
62
63 * menu.c (push_submenu_start, push_submenu_end): Do not define unless
64 USE_X_TOOLKIT || USE_GTK || HAVE_NS || defined HAVE_NTGUI.
65 (single_menu_item): Rename local to avoid shadowing.
66
67 * keyboard.c (make_lispy_event): Remove unused local var.
68
69 * frame.c, frame.h (x_get_resource_string): Bring this back, but
70 only if HAVE_X_WINDOWS && !USE_X_TOOLKIT.
71
72 * bitmaps: Change bitmaps from unsigned char back to the X11
73 compatible char. Avoid the old compiler warnings about
74 out-of-range initializers by using, for example, '\xab' rather
75 than 0xab.
76
77 * xgselect.c (xgselect_initialize): Check vs interface
78 even if ! (defined (USE_GTK) || defined (HAVE_GCONF)).
79
80 * xmenu.c (xmenu_show): Rename parm to avoid shadowing.
81
82 * xterm.c (x_create_toolkit_scroll_bar): Use const * for pointers
83 to read-only memory.
84
85 * fns.c (vector): Remove; this old hack is no longer needed.
86
87 * xsmfns.c (create_client_leader_window): Rename shadowing arg.
88 Remove unused var.
89 (gdk_x11_set_sm_client_id) [!USE_GTK]: Don't define.
90
91 * xrdb.c (x_load_resources): Omit unused local.
92
93 * xfns.c (free_frame_menubar, atof): Remove duplicate decls.
94 (x_window): Rename locals to avoid shadowing.
95 (USG): Use the kludged USG macro, to pacify gcc.
96
97 * xterm.c (x_alloc_nearest_color_for_widget): Remove; unused.
98 (x_term_init): Remove local to avoid shadowing.
99
100 * xfns.c, xterm.c (_XEditResCheckMessages): Protoize decl.
101
102 * xdisp.c, dispextern.h (set_vertical_scroll_bar): Now extern if
103 USE_TOOLKIT_SCROLL_BARS && !USE_GTK, as xterm.c needs it then.
104
12011-04-16 Eli Zaretskii <eliz@gnu.org> 1052011-04-16 Eli Zaretskii <eliz@gnu.org>
2 106
3 * gnutls.c (Fgnutls_boot): Don't pass Lisp_Object to `error'. 107 * gnutls.c (Fgnutls_boot): Don't pass Lisp_Object to `error'.
diff --git a/src/alloc.c b/src/alloc.c
index 16cd183aaa1..412527b41a0 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -139,10 +139,6 @@ static pthread_mutex_t alloc_mutex;
139#endif /* ! defined HAVE_GTK_AND_PTHREAD */ 139#endif /* ! defined HAVE_GTK_AND_PTHREAD */
140#endif /* ! defined SYSTEM_MALLOC && ! defined SYNC_INPUT */ 140#endif /* ! defined SYSTEM_MALLOC && ! defined SYNC_INPUT */
141 141
142/* Value of _bytes_used, when spare_memory was freed. */
143
144static __malloc_size_t bytes_used_when_full;
145
146/* Mark, unmark, query mark bit of a Lisp string. S must be a pointer 142/* Mark, unmark, query mark bit of a Lisp string. S must be a pointer
147 to a struct Lisp_String. */ 143 to a struct Lisp_String. */
148 144
@@ -198,9 +194,11 @@ static int total_free_floats, total_floats;
198 194
199static char *spare_memory[7]; 195static char *spare_memory[7];
200 196
197#ifndef SYSTEM_MALLOC
201/* Amount of spare memory to keep in large reserve block. */ 198/* Amount of spare memory to keep in large reserve block. */
202 199
203#define SPARE_MEMORY (1 << 14) 200#define SPARE_MEMORY (1 << 14)
201#endif
204 202
205/* Number of extra blocks malloc should get when it needs more core. */ 203/* Number of extra blocks malloc should get when it needs more core. */
206 204
@@ -469,13 +467,6 @@ display_malloc_warning (void)
469 intern ("emergency")); 467 intern ("emergency"));
470 pending_malloc_warning = 0; 468 pending_malloc_warning = 0;
471} 469}
472
473
474#ifdef DOUG_LEA_MALLOC
475# define BYTES_USED (mallinfo ().uordblks)
476#else
477# define BYTES_USED _bytes_used
478#endif
479 470
480/* Called if we can't allocate relocatable space for a buffer. */ 471/* Called if we can't allocate relocatable space for a buffer. */
481 472
@@ -1096,8 +1087,18 @@ static void * (*old_malloc_hook) (size_t, const void *);
1096static void * (*old_realloc_hook) (void *, size_t, const void*); 1087static void * (*old_realloc_hook) (void *, size_t, const void*);
1097static void (*old_free_hook) (void*, const void*); 1088static void (*old_free_hook) (void*, const void*);
1098 1089
1090#ifdef DOUG_LEA_MALLOC
1091# define BYTES_USED (mallinfo ().uordblks)
1092#else
1093# define BYTES_USED _bytes_used
1094#endif
1095
1099static __malloc_size_t bytes_used_when_reconsidered; 1096static __malloc_size_t bytes_used_when_reconsidered;
1100 1097
1098/* Value of _bytes_used, when spare_memory was freed. */
1099
1100static __malloc_size_t bytes_used_when_full;
1101
1101/* This function is used as the hook for free to call. */ 1102/* This function is used as the hook for free to call. */
1102 1103
1103static void 1104static void
@@ -3296,7 +3297,7 @@ memory_full (void)
3296 3297
3297 /* Record the space now used. When it decreases substantially, 3298 /* Record the space now used. When it decreases substantially,
3298 we can refill the memory reserve. */ 3299 we can refill the memory reserve. */
3299#ifndef SYSTEM_MALLOC 3300#if !defined SYSTEM_MALLOC && !defined SYNC_INPUT
3300 bytes_used_when_full = BYTES_USED; 3301 bytes_used_when_full = BYTES_USED;
3301#endif 3302#endif
3302 3303
diff --git a/src/bitmaps/cntrpmsk.xbm b/src/bitmaps/cntrpmsk.xbm
index 1eeebc4e896..828830fcde1 100644
--- a/src/bitmaps/cntrpmsk.xbm
+++ b/src/bitmaps/cntrpmsk.xbm
@@ -1,6 +1,6 @@
1#define cntr_ptrmsk_width 16 1#define cntr_ptrmsk_width 16
2#define cntr_ptrmsk_height 16 2#define cntr_ptrmsk_height 16
3static unsigned char cntr_ptrmsk_bits[] = { 3static char cntr_ptrmsk_bits[] = {
4 0xc0, 0x03, 0xc0, 0x03, 0xe0, 0x07, 0xe0, 0x07, 0xf0, 0x0f, 0xf0, 0x0f, 4 '\xc0','\x03','\xc0','\x03','\xe0','\x07','\xe0','\x07','\xf0','\x0f','\xf0','\x0f',
5 0xf8, 0x1f, 0xf8, 0x1f, 0xfc, 0x3f, 0xfc, 0x3f, 0xfc, 0x3f, 0xdc, 0x3b, 5 '\xf8','\x1f','\xf8','\x1f','\xfc','\x3f','\xfc','\x3f','\xfc','\x3f','\xdc','\x3b',
6 0xc0, 0x03, 0xc0, 0x03, 0xc0, 0x03, 0xc0, 0x03}; 6 '\xc0','\x03','\xc0','\x03','\xc0','\x03','\xc0','\x03'};
diff --git a/src/bitmaps/cntrptr.xbm b/src/bitmaps/cntrptr.xbm
index 545442cc4f4..ee3b606b3a5 100644
--- a/src/bitmaps/cntrptr.xbm
+++ b/src/bitmaps/cntrptr.xbm
@@ -2,7 +2,7 @@
2#define cntr_ptr_height 16 2#define cntr_ptr_height 16
3#define cntr_ptr_x_hot 7 3#define cntr_ptr_x_hot 7
4#define cntr_ptr_y_hot 1 4#define cntr_ptr_y_hot 1
5static unsigned char cntr_ptr_bits[] = { 5static char cntr_ptr_bits[] = {
6 0x00, 0x00, 0x80, 0x01, 0x80, 0x01, 0xc0, 0x03, 0xc0, 0x03, 0xe0, 0x07, 6 '\x00','\x00','\x80','\x01','\x80','\x01','\xc0','\x03','\xc0','\x03','\xe0','\x07',
7 0xe0, 0x07, 0xf0, 0x0f, 0xf0, 0x0f, 0x98, 0x19, 0x88, 0x11, 0x80, 0x01, 7 '\xe0','\x07','\xf0','\x0f','\xf0','\x0f','\x98','\x19','\x88','\x11','\x80','\x01',
8 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x00, 0x00}; 8 '\x80','\x01','\x80','\x01','\x80','\x01','\x00','\x00'};
diff --git a/src/bitmaps/crosswv.xbm b/src/bitmaps/crosswv.xbm
index 45ffbb48bda..ccf2d110887 100644
--- a/src/bitmaps/crosswv.xbm
+++ b/src/bitmaps/crosswv.xbm
@@ -1,6 +1,6 @@
1#define cross_weave_width 16 1#define cross_weave_width 16
2#define cross_weave_height 16 2#define cross_weave_height 16
3static unsigned char cross_weave_bits[] = { 3static char cross_weave_bits[] = {
4 0x55, 0x55, 0x88, 0x88, 0x55, 0x55, 0x22, 0x22, 0x55, 0x55, 0x88, 0x88, 4 '\x55','\x55','\x88','\x88','\x55','\x55','\x22','\x22','\x55','\x55','\x88','\x88',
5 0x55, 0x55, 0x22, 0x22, 0x55, 0x55, 0x88, 0x88, 0x55, 0x55, 0x22, 0x22, 5 '\x55','\x55','\x22','\x22','\x55','\x55','\x88','\x88','\x55','\x55','\x22','\x22',
6 0x55, 0x55, 0x88, 0x88, 0x55, 0x55, 0x22, 0x22}; 6 '\x55','\x55','\x88','\x88','\x55','\x55','\x22','\x22'};
diff --git a/src/bitmaps/dimple1.xbm b/src/bitmaps/dimple1.xbm
index c1a36e5c91b..6db190e431f 100644
--- a/src/bitmaps/dimple1.xbm
+++ b/src/bitmaps/dimple1.xbm
@@ -1,6 +1,6 @@
1#define dimple1_width 16 1#define dimple1_width 16
2#define dimple1_height 16 2#define dimple1_height 16
3static unsigned char dimple1_bits[] = { 3static char dimple1_bits[] = {
4 0x55, 0x55, 0x00, 0x00, 0x55, 0x55, 0x00, 0x00, 0x55, 0x55, 0x00, 0x00, 4 '\x55','\x55','\x00','\x00','\x55','\x55','\x00','\x00','\x55','\x55','\x00','\x00',
5 0x55, 0x55, 0x00, 0x00, 0x55, 0x55, 0x00, 0x00, 0x55, 0x55, 0x00, 0x00, 5 '\x55','\x55','\x00','\x00','\x55','\x55','\x00','\x00','\x55','\x55','\x00','\x00',
6 0x55, 0x55, 0x00, 0x00, 0x55, 0x55, 0x00, 0x00}; 6 '\x55','\x55','\x00','\x00','\x55','\x55','\x00','\x00'};
diff --git a/src/bitmaps/dimple3.xbm b/src/bitmaps/dimple3.xbm
index 25eb294beac..521ac8e5be2 100644
--- a/src/bitmaps/dimple3.xbm
+++ b/src/bitmaps/dimple3.xbm
@@ -1,6 +1,6 @@
1#define dimple3_width 16 1#define dimple3_width 16
2#define dimple3_height 16 2#define dimple3_height 16
3static unsigned char dimple3_bits[] = { 3static char dimple3_bits[] = {
4 0x11, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x11, 0x00, 0x00, 4 '\x11','\x11','\x00','\x00','\x00','\x00','\x00','\x00','\x11','\x11','\x00','\x00',
5 0x00, 0x00, 0x00, 0x00, 0x11, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 5 '\x00','\x00','\x00','\x00','\x11','\x11','\x00','\x00','\x00','\x00','\x00','\x00',
6 0x11, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; 6 '\x11','\x11','\x00','\x00','\x00','\x00','\x00','\x00'};
diff --git a/src/bitmaps/gray.xbm b/src/bitmaps/gray.xbm
index dc7327e5c1a..ec471219011 100644
--- a/src/bitmaps/gray.xbm
+++ b/src/bitmaps/gray.xbm
@@ -1,4 +1,4 @@
1#define gray_width 2 1#define gray_width 2
2#define gray_height 2 2#define gray_height 2
3static char gray_bits[] = { 3static char gray_bits[] = {
4 0x01, 0x02}; 4 '\x01','\x02'};
diff --git a/src/bitmaps/gray1.xbm b/src/bitmaps/gray1.xbm
index 186ea2233c6..19ee0e7b44a 100644
--- a/src/bitmaps/gray1.xbm
+++ b/src/bitmaps/gray1.xbm
@@ -1,4 +1,4 @@
1#define gray1_width 2 1#define gray1_width 2
2#define gray1_height 2 2#define gray1_height 2
3static unsigned char gray1_bits[] = { 3static char gray1_bits[] = {
4 0x01, 0x02}; 4 '\x01','\x02'};
diff --git a/src/bitmaps/gray3.xbm b/src/bitmaps/gray3.xbm
index 0356c8dab5c..3af2a9c58a0 100644
--- a/src/bitmaps/gray3.xbm
+++ b/src/bitmaps/gray3.xbm
@@ -1,4 +1,4 @@
1#define gray3_width 4 1#define gray3_width 4
2#define gray3_height 4 2#define gray3_height 4
3static unsigned char gray3_bits[] = { 3static char gray3_bits[] = {
4 0x01, 0x00, 0x04, 0x00}; 4 '\x01','\x00','\x04','\x00'};
diff --git a/src/bitmaps/leftpmsk.xbm b/src/bitmaps/leftpmsk.xbm
index 722abe63f15..f34c1edf7fd 100644
--- a/src/bitmaps/leftpmsk.xbm
+++ b/src/bitmaps/leftpmsk.xbm
@@ -1,6 +1,6 @@
1#define left_ptrmsk_width 16 1#define left_ptrmsk_width 16
2#define left_ptrmsk_height 16 2#define left_ptrmsk_height 16
3static unsigned char left_ptrmsk_bits[] = { 3static char left_ptrmsk_bits[] = {
4 0x0c, 0x00, 0x1c, 0x00, 0x3c, 0x00, 0x7c, 0x00, 0xfc, 0x00, 0xfc, 0x01, 4 '\x0c','\x00','\x1c','\x00','\x3c','\x00','\x7c','\x00','\xfc','\x00','\xfc','\x01',
5 0xfc, 0x03, 0xfc, 0x07, 0xfc, 0x0f, 0xfc, 0x0f, 0xfc, 0x01, 0xdc, 0x03, 5 '\xfc','\x03','\xfc','\x07','\xfc','\x0f','\xfc','\x0f','\xfc','\x01','\xdc','\x03',
6 0xcc, 0x03, 0x80, 0x07, 0x80, 0x07, 0x00, 0x03}; 6 '\xcc','\x03','\x80','\x07','\x80','\x07','\x00','\x03'};
diff --git a/src/bitmaps/leftptr.xbm b/src/bitmaps/leftptr.xbm
index 8a3e0d5aa4f..572f3acf578 100644
--- a/src/bitmaps/leftptr.xbm
+++ b/src/bitmaps/leftptr.xbm
@@ -2,7 +2,7 @@
2#define left_ptr_height 16 2#define left_ptr_height 16
3#define left_ptr_x_hot 3 3#define left_ptr_x_hot 3
4#define left_ptr_y_hot 1 4#define left_ptr_y_hot 1
5static unsigned char left_ptr_bits[] = { 5static char left_ptr_bits[] = {
6 0x00, 0x00, 0x08, 0x00, 0x18, 0x00, 0x38, 0x00, 0x78, 0x00, 0xf8, 0x00, 6 '\x00','\x00','\x08','\x00','\x18','\x00','\x38','\x00','\x78','\x00','\xf8','\x00',
7 0xf8, 0x01, 0xf8, 0x03, 0xf8, 0x07, 0xf8, 0x00, 0xd8, 0x00, 0x88, 0x01, 7 '\xf8','\x01','\xf8','\x03','\xf8','\x07','\xf8','\x00','\xd8','\x00','\x88','\x01',
8 0x80, 0x01, 0x00, 0x03, 0x00, 0x03, 0x00, 0x00}; 8 '\x80','\x01','\x00','\x03','\x00','\x03','\x00','\x00'};
diff --git a/src/bitmaps/rtpmsk.xbm b/src/bitmaps/rtpmsk.xbm
index 28e83f21430..ba4b399fda9 100644
--- a/src/bitmaps/rtpmsk.xbm
+++ b/src/bitmaps/rtpmsk.xbm
@@ -1,6 +1,6 @@
1#define right_ptrmsk_width 16 1#define right_ptrmsk_width 16
2#define right_ptrmsk_height 16 2#define right_ptrmsk_height 16
3static unsigned char right_ptrmsk_bits[] = { 3static char right_ptrmsk_bits[] = {
4 0x00, 0x30, 0x00, 0x38, 0x00, 0x3c, 0x00, 0x3e, 0x00, 0x3f, 0x80, 0x3f, 4 '\x00','\x30','\x00','\x38','\x00','\x3c','\x00','\x3e','\x00','\x3f','\x80','\x3f',
5 0xc0, 0x3f, 0xe0, 0x3f, 0xf0, 0x3f, 0xf0, 0x3f, 0x80, 0x3f, 0xc0, 0x3b, 5 '\xc0','\x3f','\xe0','\x3f','\xf0','\x3f','\xf0','\x3f','\x80','\x3f','\xc0','\x3b',
6 0xc0, 0x33, 0xe0, 0x01, 0xe0, 0x01, 0xc0, 0x00}; 6 '\xc0','\x33','\xe0','\x01','\xe0','\x01','\xc0','\x00'};
diff --git a/src/bitmaps/rtptr.xbm b/src/bitmaps/rtptr.xbm
index a8a63806d46..4e71cdf9993 100644
--- a/src/bitmaps/rtptr.xbm
+++ b/src/bitmaps/rtptr.xbm
@@ -2,7 +2,7 @@
2#define right_ptr_height 16 2#define right_ptr_height 16
3#define right_ptr_x_hot 12 3#define right_ptr_x_hot 12
4#define right_ptr_y_hot 1 4#define right_ptr_y_hot 1
5static unsigned char right_ptr_bits[] = { 5static char right_ptr_bits[] = {
6 0x00, 0x00, 0x00, 0x10, 0x00, 0x18, 0x00, 0x1c, 0x00, 0x1e, 0x00, 0x1f, 6 '\x00','\x00','\x00','\x10','\x00','\x18','\x00','\x1c','\x00','\x1e','\x00','\x1f',
7 0x80, 0x1f, 0xc0, 0x1f, 0xe0, 0x1f, 0x00, 0x1f, 0x00, 0x1b, 0x80, 0x11, 7 '\x80','\x1f','\xc0','\x1f','\xe0','\x1f','\x00','\x1f','\x00','\x1b','\x80','\x11',
8 0x80, 0x01, 0xc0, 0x00, 0xc0, 0x00, 0x00, 0x00}; 8 '\x80','\x01','\xc0','\x00','\xc0','\x00','\x00','\x00'};
diff --git a/src/bitmaps/stipple.xbm b/src/bitmaps/stipple.xbm
index 2e5b9411701..5a25ba29a67 100644
--- a/src/bitmaps/stipple.xbm
+++ b/src/bitmaps/stipple.xbm
@@ -1,4 +1,4 @@
1#define stipple_width 16 1#define stipple_width 16
2#define stipple_height 4 2#define stipple_height 4
3static unsigned char stipple_bits[] = { 3static char stipple_bits[] = {
4 0x55, 0x55, 0xee, 0xee, 0x55, 0x55, 0xba, 0xbb}; 4 '\x55','\x55','\xee','\xee','\x55','\x55','\xba','\xbb'};
diff --git a/src/data.c b/src/data.c
index 956ff3700f2..c9250a67bf0 100644
--- a/src/data.c
+++ b/src/data.c
@@ -3305,6 +3305,10 @@ syms_of_data (void)
3305 XSYMBOL (intern_c_string ("most-negative-fixnum"))->constant = 1; 3305 XSYMBOL (intern_c_string ("most-negative-fixnum"))->constant = 1;
3306} 3306}
3307 3307
3308#ifndef FORWARD_SIGNAL_TO_MAIN_THREAD
3309static void arith_error (int) NO_RETURN;
3310#endif
3311
3308static void 3312static void
3309arith_error (int signo) 3313arith_error (int signo)
3310{ 3314{
diff --git a/src/dispextern.h b/src/dispextern.h
index 840a27ebc62..d00eeae2b19 100644
--- a/src/dispextern.h
+++ b/src/dispextern.h
@@ -2650,9 +2650,9 @@ struct redisplay_interface
2650 int cursor_type, int cursor_width, 2650 int cursor_type, int cursor_width,
2651 int on_p, int active_p); 2651 int on_p, int active_p);
2652 2652
2653/* Draw vertical border for window W from (X,Y0) to (X,Y1). */ 2653/* Draw vertical border for window W from (X,Y_0) to (X,Y_1). */
2654 void (*draw_vertical_window_border) (struct window *w, 2654 void (*draw_vertical_window_border) (struct window *w,
2655 int x, int y0, int y1); 2655 int x, int y_0, int y_1);
2656 2656
2657/* Shift display of frame F to make room for inserted glyphs. 2657/* Shift display of frame F to make room for inserted glyphs.
2658 The area at pixel (X,Y) of width WIDTH and height HEIGHT is 2658 The area at pixel (X,Y) of width WIDTH and height HEIGHT is
@@ -2953,6 +2953,9 @@ int line_bottom_y (struct it *);
2953int display_prop_intangible_p (Lisp_Object); 2953int display_prop_intangible_p (Lisp_Object);
2954void resize_echo_area_exactly (void); 2954void resize_echo_area_exactly (void);
2955int resize_mini_window (struct window *, int); 2955int resize_mini_window (struct window *, int);
2956#if defined USE_TOOLKIT_SCROLL_BARS && !defined USE_GTK
2957void set_vertical_scroll_bar (struct window *);
2958#endif
2956int try_window (Lisp_Object, struct text_pos, int); 2959int try_window (Lisp_Object, struct text_pos, int);
2957void window_box (struct window *, int, int *, int *, int *, int *); 2960void window_box (struct window *, int, int *, int *, int *, int *);
2958int window_box_height (struct window *); 2961int window_box_height (struct window *);
diff --git a/src/emacs.c b/src/emacs.c
index cccd07417e1..0a132e156a0 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -164,10 +164,6 @@ static void *my_heap_start;
164/* The gap between BSS end and heap start as far as we can tell. */ 164/* The gap between BSS end and heap start as far as we can tell. */
165static unsigned long heap_bss_diff; 165static unsigned long heap_bss_diff;
166 166
167/* If the gap between BSS end and heap start is larger than this
168 output a warning in dump-emacs. */
169#define MAX_HEAP_BSS_DIFF (1024*1024)
170
171/* Nonzero means running Emacs without interactive terminal. */ 167/* Nonzero means running Emacs without interactive terminal. */
172int noninteractive; 168int noninteractive;
173 169
@@ -2100,7 +2096,6 @@ This is used in the file `loadup.el' when building Emacs.
2100You must run Emacs in batch mode in order to dump it. */) 2096You must run Emacs in batch mode in order to dump it. */)
2101 (Lisp_Object filename, Lisp_Object symfile) 2097 (Lisp_Object filename, Lisp_Object symfile)
2102{ 2098{
2103 extern char my_edata[];
2104 Lisp_Object tem; 2099 Lisp_Object tem;
2105 Lisp_Object symbol; 2100 Lisp_Object symbol;
2106 int count = SPECPDL_INDEX (); 2101 int count = SPECPDL_INDEX ();
@@ -2111,6 +2106,10 @@ You must run Emacs in batch mode in order to dump it. */)
2111 error ("Dumping Emacs works only in batch mode"); 2106 error ("Dumping Emacs works only in batch mode");
2112 2107
2113#ifdef GNU_LINUX 2108#ifdef GNU_LINUX
2109
2110 /* Warn if the gap between BSS end and heap start is larger than this. */
2111# define MAX_HEAP_BSS_DIFF (1024*1024)
2112
2114 if (heap_bss_diff > MAX_HEAP_BSS_DIFF) 2113 if (heap_bss_diff > MAX_HEAP_BSS_DIFF)
2115 { 2114 {
2116 fprintf (stderr, "**************************************************\n"); 2115 fprintf (stderr, "**************************************************\n");
@@ -2157,7 +2156,10 @@ You must run Emacs in batch mode in order to dump it. */)
2157#ifndef WINDOWSNT 2156#ifndef WINDOWSNT
2158 /* On Windows, this was done before dumping, and that once suffices. 2157 /* On Windows, this was done before dumping, and that once suffices.
2159 Meanwhile, my_edata is not valid on Windows. */ 2158 Meanwhile, my_edata is not valid on Windows. */
2160 memory_warnings (my_edata, malloc_warning); 2159 {
2160 extern char my_edata[];
2161 memory_warnings (my_edata, malloc_warning);
2162 }
2161#endif /* not WINDOWSNT */ 2163#endif /* not WINDOWSNT */
2162#if defined (HAVE_GTK_AND_PTHREAD) && !defined SYNC_INPUT 2164#if defined (HAVE_GTK_AND_PTHREAD) && !defined SYNC_INPUT
2163 /* Pthread may call malloc before main, and then we will get an endless 2165 /* Pthread may call malloc before main, and then we will get an endless
diff --git a/src/eval.c b/src/eval.c
index c068f5f3fbf..b843ca5b2ec 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -20,6 +20,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
20#include <config.h> 20#include <config.h>
21#include <limits.h> 21#include <limits.h>
22#include <setjmp.h> 22#include <setjmp.h>
23#include <stdio.h>
23#include "lisp.h" 24#include "lisp.h"
24#include "blockinput.h" 25#include "blockinput.h"
25#include "commands.h" 26#include "commands.h"
diff --git a/src/fns.c b/src/fns.c
index d3009775b81..c057f64469c 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -23,11 +23,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
23#include <time.h> 23#include <time.h>
24#include <setjmp.h> 24#include <setjmp.h>
25 25
26/* Note on some machines this defines `vector' as a typedef,
27 so make sure we don't use that name in this file. */
28#undef vector
29#define vector *****
30
31#include "lisp.h" 26#include "lisp.h"
32#include "commands.h" 27#include "commands.h"
33#include "character.h" 28#include "character.h"
diff --git a/src/frame.c b/src/frame.c
index cafcd149503..9024a2fb5e2 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -3845,6 +3845,31 @@ display_x_get_resource (Display_Info *dpyinfo, Lisp_Object attribute, Lisp_Objec
3845 attribute, class, component, subclass); 3845 attribute, class, component, subclass);
3846} 3846}
3847 3847
3848#if defined HAVE_X_WINDOWS && !defined USE_X_TOOLKIT
3849/* Used when C code wants a resource value. */
3850/* Called from oldXMenu/Create.c. */
3851char *
3852x_get_resource_string (const char *attribute, const char *class)
3853{
3854 char *name_key;
3855 char *class_key;
3856 struct frame *sf = SELECTED_FRAME ();
3857
3858 /* Allocate space for the components, the dots which separate them,
3859 and the final '\0'. */
3860 name_key = (char *) alloca (SBYTES (Vinvocation_name)
3861 + strlen (attribute) + 2);
3862 class_key = (char *) alloca ((sizeof (EMACS_CLASS) - 1)
3863 + strlen (class) + 2);
3864
3865 sprintf (name_key, "%s.%s", SSDATA (Vinvocation_name), attribute);
3866 sprintf (class_key, "%s.%s", EMACS_CLASS, class);
3867
3868 return x_get_string_resource (FRAME_X_DISPLAY_INFO (sf)->xrdb,
3869 name_key, class_key);
3870}
3871#endif
3872
3848/* Return the value of parameter PARAM. 3873/* Return the value of parameter PARAM.
3849 3874
3850 First search ALIST, then Vdefault_frame_alist, then the X defaults 3875 First search ALIST, then Vdefault_frame_alist, then the X defaults
diff --git a/src/frame.h b/src/frame.h
index 1f176f6f900..944a3270ae5 100644
--- a/src/frame.h
+++ b/src/frame.h
@@ -1133,6 +1133,10 @@ extern Lisp_Object display_x_get_resource (Display_Info *,
1133 Lisp_Object component, 1133 Lisp_Object component,
1134 Lisp_Object subclass); 1134 Lisp_Object subclass);
1135 1135
1136#if defined HAVE_X_WINDOWS && !defined USE_X_TOOLKIT
1137extern char *x_get_resource_string (const char *, const char *);
1138#endif
1139
1136/* In xmenu.c */ 1140/* In xmenu.c */
1137extern void set_frame_menubar (FRAME_PTR, int, int); 1141extern void set_frame_menubar (FRAME_PTR, int, int);
1138 1142
diff --git a/src/insdel.c b/src/insdel.c
index 82dce13af98..5ecb01c9538 100644
--- a/src/insdel.c
+++ b/src/insdel.c
@@ -442,6 +442,7 @@ make_gap_larger (EMACS_INT nbytes_added)
442 Vinhibit_quit = tem; 442 Vinhibit_quit = tem;
443} 443}
444 444
445#if defined USE_MMAP_FOR_BUFFERS || defined REL_ALLOC || defined DOUG_LEA_MALLOC
445 446
446/* Make the gap NBYTES_REMOVED bytes shorter. */ 447/* Make the gap NBYTES_REMOVED bytes shorter. */
447 448
@@ -501,6 +502,8 @@ make_gap_smaller (EMACS_INT nbytes_removed)
501 Vinhibit_quit = tem; 502 Vinhibit_quit = tem;
502} 503}
503 504
505#endif /* USE_MMAP_FOR_BUFFERS || REL_ALLOC || DOUG_LEA_MALLOC */
506
504void 507void
505make_gap (EMACS_INT nbytes_added) 508make_gap (EMACS_INT nbytes_added)
506{ 509{
diff --git a/src/keyboard.c b/src/keyboard.c
index c0c53c82714..c601649ebca 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -2259,7 +2259,7 @@ read_char (int commandflag, int nmaps, Lisp_Object *maps, Lisp_Object prev_event
2259 volatile Lisp_Object also_record; 2259 volatile Lisp_Object also_record;
2260 volatile int reread; 2260 volatile int reread;
2261 struct gcpro gcpro1, gcpro2; 2261 struct gcpro gcpro1, gcpro2;
2262 int polling_stopped_here = 0; 2262 int volatile polling_stopped_here = 0;
2263 struct kboard *orig_kboard = current_kboard; 2263 struct kboard *orig_kboard = current_kboard;
2264 2264
2265 also_record = Qnil; 2265 also_record = Qnil;
@@ -5455,7 +5455,6 @@ make_lispy_event (struct input_event *event)
5455 && (event->modifiers & down_modifier)) 5455 && (event->modifiers & down_modifier))
5456 { 5456 {
5457 Lisp_Object items, item; 5457 Lisp_Object items, item;
5458 int i;
5459 5458
5460 /* Find the menu bar item under `column'. */ 5459 /* Find the menu bar item under `column'. */
5461 item = Qnil; 5460 item = Qnil;
diff --git a/src/menu.c b/src/menu.c
index 3bfb74863ae..f637b92679a 100644
--- a/src/menu.c
+++ b/src/menu.c
@@ -180,6 +180,9 @@ grow_menu_items (void)
180 menu_items = larger_vector (menu_items, menu_items_allocated, Qnil); 180 menu_items = larger_vector (menu_items, menu_items_allocated, Qnil);
181} 181}
182 182
183#if (defined USE_X_TOOLKIT || defined USE_GTK || defined HAVE_NS \
184 || defined HAVE_NTGUI)
185
183/* Begin a submenu. */ 186/* Begin a submenu. */
184 187
185static void 188static void
@@ -204,6 +207,8 @@ push_submenu_end (void)
204 menu_items_submenu_depth--; 207 menu_items_submenu_depth--;
205} 208}
206 209
210#endif /* USE_X_TOOLKIT || USE_GTK || HAVE_NS || defined HAVE_NTGUI */
211
207/* Indicate boundary between left and right. */ 212/* Indicate boundary between left and right. */
208 213
209static void 214static void
@@ -368,34 +373,34 @@ single_menu_item (Lisp_Object key, Lisp_Object item, Lisp_Object dummy, void *sk
368 if (skp->notbuttons) 373 if (skp->notbuttons)
369 /* The first button. Line up previous items in this menu. */ 374 /* The first button. Line up previous items in this menu. */
370 { 375 {
371 int index = skp->notbuttons; /* Index for first item this menu. */ 376 int idx = skp->notbuttons; /* Index for first item this menu. */
372 int submenu = 0; 377 int submenu = 0;
373 Lisp_Object tem; 378 Lisp_Object tem;
374 while (index < menu_items_used) 379 while (idx < menu_items_used)
375 { 380 {
376 tem 381 tem
377 = XVECTOR (menu_items)->contents[index + MENU_ITEMS_ITEM_NAME]; 382 = XVECTOR (menu_items)->contents[idx + MENU_ITEMS_ITEM_NAME];
378 if (NILP (tem)) 383 if (NILP (tem))
379 { 384 {
380 index++; 385 idx++;
381 submenu++; /* Skip sub menu. */ 386 submenu++; /* Skip sub menu. */
382 } 387 }
383 else if (EQ (tem, Qlambda)) 388 else if (EQ (tem, Qlambda))
384 { 389 {
385 index++; 390 idx++;
386 submenu--; /* End sub menu. */ 391 submenu--; /* End sub menu. */
387 } 392 }
388 else if (EQ (tem, Qt)) 393 else if (EQ (tem, Qt))
389 index += 3; /* Skip new pane marker. */ 394 idx += 3; /* Skip new pane marker. */
390 else if (EQ (tem, Qquote)) 395 else if (EQ (tem, Qquote))
391 index++; /* Skip a left, right divider. */ 396 idx++; /* Skip a left, right divider. */
392 else 397 else
393 { 398 {
394 if (!submenu && SREF (tem, 0) != '\0' 399 if (!submenu && SREF (tem, 0) != '\0'
395 && SREF (tem, 0) != '-') 400 && SREF (tem, 0) != '-')
396 XVECTOR (menu_items)->contents[index + MENU_ITEMS_ITEM_NAME] 401 XVECTOR (menu_items)->contents[idx + MENU_ITEMS_ITEM_NAME]
397 = concat2 (build_string (" "), tem); 402 = concat2 (build_string (" "), tem);
398 index += MENU_ITEMS_ITEM_LENGTH; 403 idx += MENU_ITEMS_ITEM_LENGTH;
399 } 404 }
400 } 405 }
401 skp->notbuttons = 0; 406 skp->notbuttons = 0;
diff --git a/src/process.c b/src/process.c
index c9c6ab6d4b3..d8851c56cf0 100644
--- a/src/process.c
+++ b/src/process.c
@@ -237,7 +237,9 @@ static int process_output_skip;
237 237
238static Lisp_Object Fget_process (Lisp_Object); 238static Lisp_Object Fget_process (Lisp_Object);
239static void create_process (Lisp_Object, char **, Lisp_Object); 239static void create_process (Lisp_Object, char **, Lisp_Object);
240#ifdef SIGIO
240static int keyboard_bit_set (SELECT_TYPE *); 241static int keyboard_bit_set (SELECT_TYPE *);
242#endif
241static void deactivate_process (Lisp_Object); 243static void deactivate_process (Lisp_Object);
242static void status_notify (struct Lisp_Process *); 244static void status_notify (struct Lisp_Process *);
243static int read_process_output (Lisp_Object, int); 245static int read_process_output (Lisp_Object, int);
@@ -5220,6 +5222,10 @@ read_process_output (Lisp_Object proc, register int channel)
5220static jmp_buf send_process_frame; 5222static jmp_buf send_process_frame;
5221static Lisp_Object process_sent_to; 5223static Lisp_Object process_sent_to;
5222 5224
5225#ifndef FORWARD_SIGNAL_TO_MAIN_THREAD
5226static void send_process_trap (int) NO_RETURN;
5227#endif
5228
5223static void 5229static void
5224send_process_trap (int ignore) 5230send_process_trap (int ignore)
5225{ 5231{
@@ -5360,6 +5366,8 @@ send_process (volatile Lisp_Object proc, const char *volatile buf,
5360 when returning with longjmp despite being declared volatile. */ 5366 when returning with longjmp despite being declared volatile. */
5361 if (!setjmp (send_process_frame)) 5367 if (!setjmp (send_process_frame))
5362 { 5368 {
5369 p = XPROCESS (proc); /* Repair any setjmp clobbering. */
5370
5363 process_sent_to = proc; 5371 process_sent_to = proc;
5364 while (len > 0) 5372 while (len > 0)
5365 { 5373 {
@@ -6583,6 +6591,8 @@ delete_gpm_wait_descriptor (int desc)
6583 delete_keyboard_wait_descriptor (desc); 6591 delete_keyboard_wait_descriptor (desc);
6584} 6592}
6585 6593
6594# ifdef SIGIO
6595
6586/* Return nonzero if *MASK has a bit set 6596/* Return nonzero if *MASK has a bit set
6587 that corresponds to one of the keyboard input descriptors. */ 6597 that corresponds to one of the keyboard input descriptors. */
6588 6598
@@ -6598,6 +6608,7 @@ keyboard_bit_set (fd_set *mask)
6598 6608
6599 return 0; 6609 return 0;
6600} 6610}
6611# endif
6601 6612
6602#else /* not subprocesses */ 6613#else /* not subprocesses */
6603 6614
diff --git a/src/s/sol2-6.h b/src/s/sol2-6.h
index 4c6fd3e2f9b..3d9bd6ddafc 100644
--- a/src/s/sol2-6.h
+++ b/src/s/sol2-6.h
@@ -44,7 +44,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
44 44
45#define PTY_TTY_NAME_SPRINTF \ 45#define PTY_TTY_NAME_SPRINTF \
46 { \ 46 { \
47 char *ptsname (), *ptyname; \ 47 char *ptsname (int), *ptyname; \
48 \ 48 \
49 sigblock (sigmask (SIGCLD)); \ 49 sigblock (sigmask (SIGCLD)); \
50 if (grantpt (fd) == -1) \ 50 if (grantpt (fd) == -1) \
@@ -60,4 +60,3 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
60 60
61#define GC_SETJMP_WORKS 1 61#define GC_SETJMP_WORKS 1
62#define GC_MARK_STACK GC_MAKE_GCPROS_NOOPS 62#define GC_MARK_STACK GC_MAKE_GCPROS_NOOPS
63
diff --git a/src/s/unixware.h b/src/s/unixware.h
index 407282ff78c..8fe28625dd4 100644
--- a/src/s/unixware.h
+++ b/src/s/unixware.h
@@ -35,7 +35,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
35 within, it should be caught after sigrelse(2). */ 35 within, it should be caught after sigrelse(2). */
36#define PTY_TTY_NAME_SPRINTF \ 36#define PTY_TTY_NAME_SPRINTF \
37 { \ 37 { \
38 char *ptsname(), *ptyname; \ 38 char *ptsname (int), *ptyname; \
39 \ 39 \
40 sigblock(sigmask(SIGCLD)); \ 40 sigblock(sigmask(SIGCLD)); \
41 if (grantpt(fd) == -1) \ 41 if (grantpt(fd) == -1) \
diff --git a/src/s/usg5-4-common.h b/src/s/usg5-4-common.h
index 236f71e3007..e6d992d8f9c 100644
--- a/src/s/usg5-4-common.h
+++ b/src/s/usg5-4-common.h
@@ -88,11 +88,11 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
88/* Push various streams modules onto a PTY channel. */ 88/* Push various streams modules onto a PTY channel. */
89#define SETUP_SLAVE_PTY \ 89#define SETUP_SLAVE_PTY \
90 if (ioctl (xforkin, I_PUSH, "ptem") == -1) \ 90 if (ioctl (xforkin, I_PUSH, "ptem") == -1) \
91 fatal ("ioctl I_PUSH ptem", errno); \ 91 fatal ("ioctl I_PUSH ptem"); \
92 if (ioctl (xforkin, I_PUSH, "ldterm") == -1) \ 92 if (ioctl (xforkin, I_PUSH, "ldterm") == -1) \
93 fatal ("ioctl I_PUSH ldterm", errno); \ 93 fatal ("ioctl I_PUSH ldterm"); \
94 if (ioctl (xforkin, I_PUSH, "ttcompat") == -1) \ 94 if (ioctl (xforkin, I_PUSH, "ttcompat") == -1) \
95 fatal ("ioctl I_PUSH ttcompat", errno); 95 fatal ("ioctl I_PUSH ttcompat");
96 96
97/* This definition was suggested for next release. So give it a try. */ 97/* This definition was suggested for next release. So give it a try. */
98#define HAVE_SOCKETS 98#define HAVE_SOCKETS
diff --git a/src/sysdep.c b/src/sysdep.c
index e01bc4b1fbc..45e80ac0155 100644
--- a/src/sysdep.c
+++ b/src/sysdep.c
@@ -2966,6 +2966,8 @@ system_process_attributes (Lisp_Object pid)
2966 2966
2967#if PROCFS_FILE_OFFSET_BITS_HACK == 1 2967#if PROCFS_FILE_OFFSET_BITS_HACK == 1
2968#define _FILE_OFFSET_BITS 64 2968#define _FILE_OFFSET_BITS 64
2969#ifdef _FILE_OFFSET_BITS /* Avoid unused-macro warnings. */
2970#endif
2969#endif /* PROCFS_FILE_OFFSET_BITS_HACK == 1 */ 2971#endif /* PROCFS_FILE_OFFSET_BITS_HACK == 1 */
2970 2972
2971Lisp_Object 2973Lisp_Object
diff --git a/src/termhooks.h b/src/termhooks.h
index 2f509009bd9..468381b69aa 100644
--- a/src/termhooks.h
+++ b/src/termhooks.h
@@ -465,7 +465,7 @@ struct terminal
465 enum scroll_bar_part *part, 465 enum scroll_bar_part *part,
466 Lisp_Object *x, 466 Lisp_Object *x,
467 Lisp_Object *y, 467 Lisp_Object *y,
468 unsigned long *time); 468 unsigned long *);
469 469
470 /* 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
471 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
@@ -484,10 +484,10 @@ struct terminal
484 support overlapping frames, so there's no need to raise or lower 484 support overlapping frames, so there's no need to raise or lower
485 anything. 485 anything.
486 486
487 If RAISE is non-zero, F is brought to the front, before all other 487 If RAISE_FLAG is non-zero, F is brought to the front, before all other
488 windows. If RAISE is zero, F is sent to the back, behind all other 488 windows. If RAISE_FLAG is zero, F is sent to the back, behind all other
489 windows. */ 489 windows. */
490 void (*frame_raise_lower_hook) (struct frame *f, int raise); 490 void (*frame_raise_lower_hook) (struct frame *f, int raise_flag);
491 491
492 /* If the value of the frame parameter changed, whis hook is called. 492 /* If the value of the frame parameter changed, whis hook is called.
493 For example, if going from fullscreen to not fullscreen this hook 493 For example, if going from fullscreen to not fullscreen this hook
diff --git a/src/xdisp.c b/src/xdisp.c
index 4f1830f4c6c..3c75a63f4e0 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -13630,7 +13630,10 @@ try_cursor_movement (Lisp_Object window, struct text_pos startp, int *scroll_ste
13630 return rc; 13630 return rc;
13631} 13631}
13632 13632
13633static void 13633#if !defined USE_TOOLKIT_SCROLL_BARS || defined USE_GTK
13634static
13635#endif
13636void
13634set_vertical_scroll_bar (struct window *w) 13637set_vertical_scroll_bar (struct window *w)
13635{ 13638{
13636 EMACS_INT start, end, whole; 13639 EMACS_INT start, end, whole;
@@ -22709,7 +22712,7 @@ x_produce_glyphs (struct it *it)
22709 int lbearing, rbearing; 22712 int lbearing, rbearing;
22710 int i, width, ascent, descent; 22713 int i, width, ascent, descent;
22711 int left_padded = 0, right_padded = 0; 22714 int left_padded = 0, right_padded = 0;
22712 int c; 22715 int c IF_LINT (= 0); /* cmp->glyph_len can't be zero; see Bug#8512 */
22713 XChar2b char2b; 22716 XChar2b char2b;
22714 struct font_metrics *pcm; 22717 struct font_metrics *pcm;
22715 int font_not_found_p; 22718 int font_not_found_p;
diff --git a/src/xfaces.c b/src/xfaces.c
index 5cfe99d1285..fbed183522a 100644
--- a/src/xfaces.c
+++ b/src/xfaces.c
@@ -273,6 +273,8 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
273#include <X11/Xos.h> 273#include <X11/Xos.h>
274#define USG 274#define USG
275#define __TIMEVAL__ 275#define __TIMEVAL__
276#if defined USG || defined __TIMEVAL__ /* Don't warn about unused macros. */
277#endif
276#else /* not XOS_NEEDS_TIME_H */ 278#else /* not XOS_NEEDS_TIME_H */
277#include <X11/Xos.h> 279#include <X11/Xos.h>
278#endif /* not XOS_NEEDS_TIME_H */ 280#endif /* not XOS_NEEDS_TIME_H */
diff --git a/src/xfns.c b/src/xfns.c
index 290b6161215..51aca3e9670 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -83,6 +83,8 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
83#undef USG /* ####KLUDGE for Solaris 2.2 and up */ 83#undef USG /* ####KLUDGE for Solaris 2.2 and up */
84#include <X11/Xos.h> 84#include <X11/Xos.h>
85#define USG 85#define USG
86#ifdef USG /* Pacify gcc -Wunused-macros. */
87#endif
86#else 88#else
87#include <X11/Xos.h> 89#include <X11/Xos.h>
88#endif 90#endif
@@ -105,16 +107,13 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
105 107
106#if !defined(NO_EDITRES) 108#if !defined(NO_EDITRES)
107#define HACK_EDITRES 109#define HACK_EDITRES
108extern void _XEditResCheckMessages (); 110extern void _XEditResCheckMessages (Widget, XtPointer, XEvent *, Boolean *);
109#endif /* not defined NO_EDITRES */ 111#endif /* not defined NO_EDITRES */
110 112
111/* Unique id counter for widgets created by the Lucid Widget Library. */ 113/* Unique id counter for widgets created by the Lucid Widget Library. */
112 114
113extern LWLIB_ID widget_id_tick; 115extern LWLIB_ID widget_id_tick;
114 116
115extern void free_frame_menubar ();
116extern double atof ();
117
118#ifdef USE_MOTIF 117#ifdef USE_MOTIF
119 118
120#endif /* USE_MOTIF */ 119#endif /* USE_MOTIF */
@@ -428,7 +427,7 @@ x_top_window_to_frame (struct x_display_info *dpyinfo, int wdesc)
428void 427void
429x_real_positions (FRAME_PTR f, int *xptr, int *yptr) 428x_real_positions (FRAME_PTR f, int *xptr, int *yptr)
430{ 429{
431 int win_x, win_y, outer_x, outer_y; 430 int win_x, win_y, outer_x IF_LINT (= 0), outer_y IF_LINT (= 0);
432 int real_x = 0, real_y = 0; 431 int real_x = 0, real_y = 0;
433 int had_errors = 0; 432 int had_errors = 0;
434 Window win = f->output_data.x->parent_desc; 433 Window win = f->output_data.x->parent_desc;
@@ -2430,8 +2429,8 @@ x_window (struct frame *f, long window_prompting, int minibuffer_only)
2430 { 2429 {
2431 int len; 2430 int len;
2432 char *tem, shell_position[32]; 2431 char *tem, shell_position[32];
2433 Arg al[10]; 2432 Arg gal[10];
2434 int ac = 0; 2433 int gac = 0;
2435 int extra_borders = 0; 2434 int extra_borders = 0;
2436 int menubar_size 2435 int menubar_size
2437 = (f->output_data.x->menubar_widget 2436 = (f->output_data.x->menubar_widget
@@ -2492,8 +2491,8 @@ x_window (struct frame *f, long window_prompting, int minibuffer_only)
2492 If Emacs had just one program position, we could set it in 2491 If Emacs had just one program position, we could set it in
2493 fallback resources, but since each make-frame call can specify 2492 fallback resources, but since each make-frame call can specify
2494 different program positions, this is easier. */ 2493 different program positions, this is easier. */
2495 XtSetArg (al[ac], XtNx, left); ac++; 2494 XtSetArg (gal[gac], XtNx, left); gac++;
2496 XtSetArg (al[ac], XtNy, top); ac++; 2495 XtSetArg (gal[gac], XtNy, top); gac++;
2497 } 2496 }
2498 } 2497 }
2499 2498
@@ -2504,8 +2503,8 @@ x_window (struct frame *f, long window_prompting, int minibuffer_only)
2504 when the frame is deleted. */ 2503 when the frame is deleted. */
2505 tem = (char *) xmalloc (len); 2504 tem = (char *) xmalloc (len);
2506 strncpy (tem, shell_position, len); 2505 strncpy (tem, shell_position, len);
2507 XtSetArg (al[ac], XtNgeometry, tem); ac++; 2506 XtSetArg (gal[gac], XtNgeometry, tem); gac++;
2508 XtSetValues (shell_widget, al, ac); 2507 XtSetValues (shell_widget, gal, gac);
2509 } 2508 }
2510 2509
2511 XtManageChild (pane_widget); 2510 XtManageChild (pane_widget);
@@ -5206,7 +5205,6 @@ Value is t if tooltip was open, nil otherwise. */)
5206 int count; 5205 int count;
5207 Lisp_Object deleted, frame, timer; 5206 Lisp_Object deleted, frame, timer;
5208 struct gcpro gcpro1, gcpro2; 5207 struct gcpro gcpro1, gcpro2;
5209 struct frame *f;
5210 5208
5211 /* Return quickly if nothing to do. */ 5209 /* Return quickly if nothing to do. */
5212 if (NILP (tip_timer) && NILP (tip_frame)) 5210 if (NILP (tip_timer) && NILP (tip_frame))
@@ -5225,11 +5223,13 @@ Value is t if tooltip was open, nil otherwise. */)
5225 call1 (Qcancel_timer, timer); 5223 call1 (Qcancel_timer, timer);
5226 5224
5227#ifdef USE_GTK 5225#ifdef USE_GTK
5228 /* When using system tooltip, tip_frame is the Emacs frame on which 5226 {
5229 the tip is shown. */ 5227 /* When using system tooltip, tip_frame is the Emacs frame on which
5230 f = XFRAME (frame); 5228 the tip is shown. */
5231 if (FRAME_LIVE_P (f) && xg_hide_tooltip (f)) 5229 struct frame *f = XFRAME (frame);
5232 frame = Qnil; 5230 if (FRAME_LIVE_P (f) && xg_hide_tooltip (f))
5231 frame = Qnil;
5232 }
5233#endif 5233#endif
5234 5234
5235 if (FRAMEP (frame)) 5235 if (FRAMEP (frame))
@@ -5243,7 +5243,7 @@ Value is t if tooltip was open, nil otherwise. */)
5243 items is unmapped. Redisplay the menu manually... */ 5243 items is unmapped. Redisplay the menu manually... */
5244 { 5244 {
5245 Widget w; 5245 Widget w;
5246 f = SELECTED_FRAME (); 5246 struct frame *f = SELECTED_FRAME ();
5247 w = f->output_data.x->menubar_widget; 5247 w = f->output_data.x->menubar_widget;
5248 5248
5249 if (!DoesSaveUnders (FRAME_X_DISPLAY_INFO (f)->screen) 5249 if (!DoesSaveUnders (FRAME_X_DISPLAY_INFO (f)->screen)
@@ -5462,12 +5462,12 @@ Otherwise, if ONLY-DIR-P is non-nil, the user can only select directories. */)
5462 /* Get the result. */ 5462 /* Get the result. */
5463 if (result == XmCR_OK) 5463 if (result == XmCR_OK)
5464 { 5464 {
5465 XmString text; 5465 XmString text_string;
5466 String data; 5466 String data;
5467 5467
5468 XtVaGetValues (dialog, XmNtextString, &text, NULL); 5468 XtVaGetValues (dialog, XmNtextString, &text_string, NULL);
5469 XmStringGetLtoR (text, XmFONTLIST_DEFAULT_TAG, &data); 5469 XmStringGetLtoR (text_string, XmFONTLIST_DEFAULT_TAG, &data);
5470 XmStringFree (text); 5470 XmStringFree (text_string);
5471 file = build_string (data); 5471 file = build_string (data);
5472 XtFree (data); 5472 XtFree (data);
5473 } 5473 }
diff --git a/src/xgselect.c b/src/xgselect.c
index 96d763ff088..0d154f6496a 100644
--- a/src/xgselect.c
+++ b/src/xgselect.c
@@ -19,11 +19,14 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
19 19
20#include <config.h> 20#include <config.h>
21 21
22#include <setjmp.h>
23#include "xgselect.h"
24
22#if defined (USE_GTK) || defined (HAVE_GCONF) 25#if defined (USE_GTK) || defined (HAVE_GCONF)
26
23#include <glib.h> 27#include <glib.h>
24#include <errno.h> 28#include <errno.h>
25#include <setjmp.h> 29#include <setjmp.h>
26#include "xgselect.h"
27 30
28static GPollFD *gfds; 31static GPollFD *gfds;
29static int gfds_size; 32static int gfds_size;
diff --git a/src/xmenu.c b/src/xmenu.c
index 6e84b845a46..938e5696b21 100644
--- a/src/xmenu.c
+++ b/src/xmenu.c
@@ -108,7 +108,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
108 108
109#ifndef TRUE 109#ifndef TRUE
110#define TRUE 1 110#define TRUE 1
111#define FALSE 0
112#endif /* no TRUE */ 111#endif /* no TRUE */
113 112
114static Lisp_Object Qdebug_on_next_call; 113static Lisp_Object Qdebug_on_next_call;
@@ -117,8 +116,6 @@ static Lisp_Object Qdebug_on_next_call;
117static Lisp_Object xdialog_show (FRAME_PTR, int, Lisp_Object, Lisp_Object, 116static Lisp_Object xdialog_show (FRAME_PTR, int, Lisp_Object, Lisp_Object,
118 const char **); 117 const char **);
119#endif 118#endif
120
121static int update_frame_menubar (struct frame *);
122 119
123/* Flag which when set indicates a dialog or menu has been posted by 120/* Flag which when set indicates a dialog or menu has been posted by
124 Xt on behalf of one of the widget sets. */ 121 Xt on behalf of one of the widget sets. */
@@ -2185,7 +2182,7 @@ static struct frame *menu_help_frame;
2185 keyboard events. */ 2182 keyboard events. */
2186 2183
2187static void 2184static void
2188menu_help_callback (char *help_string, int pane, int item) 2185menu_help_callback (char const *help_string, int pane, int item)
2189{ 2186{
2190 Lisp_Object *first_item; 2187 Lisp_Object *first_item;
2191 Lisp_Object pane_name; 2188 Lisp_Object pane_name;
@@ -2245,7 +2242,7 @@ pop_down_menu (Lisp_Object arg)
2245 2242
2246Lisp_Object 2243Lisp_Object
2247xmenu_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,
2248 Lisp_Object title, const char **error, EMACS_UINT timestamp) 2245 Lisp_Object title, const char **error_name, EMACS_UINT timestamp)
2249{ 2246{
2250 Window root; 2247 Window root;
2251 XMenu *menu; 2248 XMenu *menu;
@@ -2263,13 +2260,13 @@ xmenu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps,
2263 if (! FRAME_X_P (f) && ! FRAME_MSDOS_P (f)) 2260 if (! FRAME_X_P (f) && ! FRAME_MSDOS_P (f))
2264 abort (); 2261 abort ();
2265 2262
2266 *error = 0; 2263 *error_name = 0;
2267 if (menu_items_n_panes == 0) 2264 if (menu_items_n_panes == 0)
2268 return Qnil; 2265 return Qnil;
2269 2266
2270 if (menu_items_used <= MENU_ITEMS_PANE_LENGTH) 2267 if (menu_items_used <= MENU_ITEMS_PANE_LENGTH)
2271 { 2268 {
2272 *error = "Empty menu"; 2269 *error_name = "Empty menu";
2273 return Qnil; 2270 return Qnil;
2274 } 2271 }
2275 2272
@@ -2282,7 +2279,7 @@ xmenu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps,
2282 menu = XMenuCreate (FRAME_X_DISPLAY (f), root, "emacs"); 2279 menu = XMenuCreate (FRAME_X_DISPLAY (f), root, "emacs");
2283 if (menu == NULL) 2280 if (menu == NULL)
2284 { 2281 {
2285 *error = "Can't create menu"; 2282 *error_name = "Can't create menu";
2286 return Qnil; 2283 return Qnil;
2287 } 2284 }
2288 2285
@@ -2302,7 +2299,8 @@ xmenu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps,
2302 y += f->top_pos; 2299 y += f->top_pos;
2303 2300
2304 /* Create all the necessary panes and their items. */ 2301 /* Create all the necessary panes and their items. */
2305 maxlines = lines = i = 0; 2302 maxwidth = maxlines = lines = i = 0;
2303 lpane = XM_FAILURE;
2306 while (i < menu_items_used) 2304 while (i < menu_items_used)
2307 { 2305 {
2308 if (EQ (XVECTOR (menu_items)->contents[i], Qt)) 2306 if (EQ (XVECTOR (menu_items)->contents[i], Qt))
@@ -2324,13 +2322,12 @@ xmenu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps,
2324 if (lpane == XM_FAILURE) 2322 if (lpane == XM_FAILURE)
2325 { 2323 {
2326 XMenuDestroy (FRAME_X_DISPLAY (f), menu); 2324 XMenuDestroy (FRAME_X_DISPLAY (f), menu);
2327 *error = "Can't create pane"; 2325 *error_name = "Can't create pane";
2328 return Qnil; 2326 return Qnil;
2329 } 2327 }
2330 i += MENU_ITEMS_PANE_LENGTH; 2328 i += MENU_ITEMS_PANE_LENGTH;
2331 2329
2332 /* Find the width of the widest item in this pane. */ 2330 /* Find the width of the widest item in this pane. */
2333 maxwidth = 0;
2334 j = i; 2331 j = i;
2335 while (j < menu_items_used) 2332 while (j < menu_items_used)
2336 { 2333 {
@@ -2358,40 +2355,38 @@ xmenu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps,
2358 { 2355 {
2359 /* Create a new item within current pane. */ 2356 /* Create a new item within current pane. */
2360 Lisp_Object item_name, enable, descrip, help; 2357 Lisp_Object item_name, enable, descrip, help;
2361 unsigned char *item_data; 2358 char *item_data;
2362 char *help_string; 2359 char const *help_string;
2363 2360
2364 item_name = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_NAME]; 2361 item_name = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_NAME];
2365 enable = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_ENABLE]; 2362 enable = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_ENABLE];
2366 descrip 2363 descrip
2367 = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_EQUIV_KEY]; 2364 = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_EQUIV_KEY];
2368 help = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_HELP]; 2365 help = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_HELP];
2369 help_string = STRINGP (help) ? SDATA (help) : NULL; 2366 help_string = STRINGP (help) ? SSDATA (help) : NULL;
2370 2367
2371 if (!NILP (descrip)) 2368 if (!NILP (descrip))
2372 { 2369 {
2373 int gap = maxwidth - SBYTES (item_name);
2374 /* if alloca is fast, use that to make the space, 2370 /* if alloca is fast, use that to make the space,
2375 to reduce gc needs. */ 2371 to reduce gc needs. */
2376 item_data 2372 item_data = (char *) alloca (maxwidth + SBYTES (descrip) + 1);
2377 = (unsigned char *) alloca (maxwidth 2373 memcpy (item_data, SSDATA (item_name), SBYTES (item_name));
2378 + SBYTES (descrip) + 1);
2379 memcpy (item_data, SDATA (item_name), SBYTES (item_name));
2380 for (j = SCHARS (item_name); j < maxwidth; j++) 2374 for (j = SCHARS (item_name); j < maxwidth; j++)
2381 item_data[j] = ' '; 2375 item_data[j] = ' ';
2382 memcpy (item_data + j, SDATA (descrip), SBYTES (descrip)); 2376 memcpy (item_data + j, SSDATA (descrip), SBYTES (descrip));
2383 item_data[j + SBYTES (descrip)] = 0; 2377 item_data[j + SBYTES (descrip)] = 0;
2384 } 2378 }
2385 else 2379 else
2386 item_data = SDATA (item_name); 2380 item_data = SSDATA (item_name);
2387 2381
2388 if (XMenuAddSelection (FRAME_X_DISPLAY (f), 2382 if (lpane == XM_FAILURE
2389 menu, lpane, 0, item_data, 2383 || (XMenuAddSelection (FRAME_X_DISPLAY (f),
2390 !NILP (enable), help_string) 2384 menu, lpane, 0, item_data,
2391 == XM_FAILURE) 2385 !NILP (enable), help_string)
2386 == XM_FAILURE))
2392 { 2387 {
2393 XMenuDestroy (FRAME_X_DISPLAY (f), menu); 2388 XMenuDestroy (FRAME_X_DISPLAY (f), menu);
2394 *error = "Can't add selection to menu"; 2389 *error_name = "Can't add selection to menu";
2395 return Qnil; 2390 return Qnil;
2396 } 2391 }
2397 i += MENU_ITEMS_ITEM_LENGTH; 2392 i += MENU_ITEMS_ITEM_LENGTH;
@@ -2468,6 +2463,7 @@ xmenu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps,
2468 status = XMenuActivate (FRAME_X_DISPLAY (f), menu, &pane, &selidx, 2463 status = XMenuActivate (FRAME_X_DISPLAY (f), menu, &pane, &selidx,
2469 x, y, ButtonReleaseMask, &datap, 2464 x, y, ButtonReleaseMask, &datap,
2470 menu_help_callback); 2465 menu_help_callback);
2466 entry = pane_prefix = Qnil;
2471 2467
2472 switch (status) 2468 switch (status)
2473 { 2469 {
@@ -2512,16 +2508,14 @@ xmenu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps,
2512 break; 2508 break;
2513 2509
2514 case XM_FAILURE: 2510 case XM_FAILURE:
2515 *error = "Can't activate menu"; 2511 *error_name = "Can't activate menu";
2516 case XM_IA_SELECT: 2512 case XM_IA_SELECT:
2517 entry = Qnil;
2518 break; 2513 break;
2519 case XM_NO_SELECT: 2514 case XM_NO_SELECT:
2520 /* Make "Cancel" equivalent to C-g unless FOR_CLICK (which means 2515 /* Make "Cancel" equivalent to C-g unless FOR_CLICK (which means
2521 the menu was invoked with a mouse event as POSITION). */ 2516 the menu was invoked with a mouse event as POSITION). */
2522 if (! for_click) 2517 if (! for_click)
2523 Fsignal (Qquit, Qnil); 2518 Fsignal (Qquit, Qnil);
2524 entry = Qnil;
2525 break; 2519 break;
2526 } 2520 }
2527 2521
diff --git a/src/xrdb.c b/src/xrdb.c
index d350f38a8c4..b01e344edf2 100644
--- a/src/xrdb.c
+++ b/src/xrdb.c
@@ -479,7 +479,9 @@ x_load_resources (Display *display, const char *xrm_string,
479 XrmDatabase db; 479 XrmDatabase db;
480 char line[256]; 480 char line[256];
481 481
482#if defined USE_MOTIF || !defined HAVE_XFT || !defined USE_LUCID
482 const char *helv = "-*-helvetica-medium-r-*--*-120-*-*-*-*-iso8859-1"; 483 const char *helv = "-*-helvetica-medium-r-*--*-120-*-*-*-*-iso8859-1";
484#endif
483 485
484#ifdef USE_MOTIF 486#ifdef USE_MOTIF
485 const char *courier = "-*-courier-medium-r-*-*-*-120-*-*-*-*-iso8859-1"; 487 const char *courier = "-*-courier-medium-r-*-*-*-120-*-*-*-*-iso8859-1";
diff --git a/src/xsmfns.c b/src/xsmfns.c
index f3879dbcec0..c199036587f 100644
--- a/src/xsmfns.c
+++ b/src/xsmfns.c
@@ -41,8 +41,8 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
41#include "process.h" 41#include "process.h"
42#include "keyboard.h" 42#include "keyboard.h"
43 43
44#ifndef HAVE_GTK3 44#if defined USE_GTK && !defined HAVE_GTK3
45#define gdk_x11_set_sm_client_id(w) gdk_set_sm_client_id (w) 45#define gdk_x11_set_sm_client_id(w) gdk_set_sm_client_id (w)
46#endif 46#endif
47 47
48/* This is the event used when SAVE_SESSION_EVENT occurs. */ 48/* This is the event used when SAVE_SESSION_EVENT occurs. */
@@ -250,7 +250,7 @@ smc_save_yourself_CB (SmcConn smcConn,
250 props[props_idx]->vals[vp_idx++].value = chdir_opt; 250 props[props_idx]->vals[vp_idx++].value = chdir_opt;
251 } 251 }
252 252
253 for (i = 1; i < initial_argc; ++i) 253 for (i = 1; i < initial_argc; ++i)
254 { 254 {
255 props[props_idx]->vals[vp_idx].length = strlen (initial_argv[i]); 255 props[props_idx]->vals[vp_idx].length = strlen (initial_argv[i]);
256 props[props_idx]->vals[vp_idx++].value = initial_argv[i]; 256 props[props_idx]->vals[vp_idx++].value = initial_argv[i];
@@ -365,11 +365,10 @@ ice_conn_watch_CB (IceConn iceConn, IcePointer clientData,
365 365
366#ifndef USE_GTK 366#ifndef USE_GTK
367static void 367static void
368create_client_leader_window (struct x_display_info *dpyinfo, char *client_id) 368create_client_leader_window (struct x_display_info *dpyinfo, char *client_ID)
369{ 369{
370 Window w; 370 Window w;
371 XClassHint class_hints; 371 XClassHint class_hints;
372 Atom sm_id;
373 372
374 w = XCreateSimpleWindow (dpyinfo->display, 373 w = XCreateSimpleWindow (dpyinfo->display,
375 dpyinfo->root_window, 374 dpyinfo->root_window,
@@ -383,7 +382,7 @@ create_client_leader_window (struct x_display_info *dpyinfo, char *client_id)
383 382
384 XChangeProperty (dpyinfo->display, w, dpyinfo->Xatom_SM_CLIENT_ID, 383 XChangeProperty (dpyinfo->display, w, dpyinfo->Xatom_SM_CLIENT_ID,
385 XA_STRING, 8, PropModeReplace, 384 XA_STRING, 8, PropModeReplace,
386 (unsigned char *)client_id, strlen (client_id)); 385 (unsigned char *) client_ID, strlen (client_ID));
387 386
388 dpyinfo->client_leader_window = w; 387 dpyinfo->client_leader_window = w;
389} 388}
diff --git a/src/xterm.c b/src/xterm.c
index bc847388756..a44313d0a56 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -102,7 +102,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
102#ifdef USE_X_TOOLKIT 102#ifdef USE_X_TOOLKIT
103#if !defined(NO_EDITRES) 103#if !defined(NO_EDITRES)
104#define HACK_EDITRES 104#define HACK_EDITRES
105extern void _XEditResCheckMessages (); 105extern void _XEditResCheckMessages (Widget, XtPointer, XEvent *, Boolean *);
106#endif /* not NO_EDITRES */ 106#endif /* not NO_EDITRES */
107 107
108/* Include toolkit specific headers for the scroll bar widget. */ 108/* Include toolkit specific headers for the scroll bar widget. */
@@ -187,11 +187,11 @@ static struct {
187/* The application context for Xt use. */ 187/* The application context for Xt use. */
188XtAppContext Xt_app_con; 188XtAppContext Xt_app_con;
189static String Xt_default_resources[] = {0}; 189static String Xt_default_resources[] = {0};
190#endif /* USE_X_TOOLKIT */
191 190
192/* Non-zero means user is interacting with a toolkit scroll bar. */ 191/* Non-zero means user is interacting with a toolkit scroll bar. */
193 192
194static int toolkit_scroll_bar_interaction; 193static int toolkit_scroll_bar_interaction;
194#endif /* USE_X_TOOLKIT */
195 195
196/* Non-zero timeout value means ignore next mouse click if it arrives 196/* Non-zero timeout value means ignore next mouse click if it arrives
197 before that timeout elapses (i.e. as part of the same sequence of 197 before that timeout elapses (i.e. as part of the same sequence of
@@ -349,7 +349,7 @@ static void x_check_expected_move (struct frame *, int, int);
349static void x_sync_with_move (struct frame *, int, int, int); 349static void x_sync_with_move (struct frame *, int, int, int);
350static int handle_one_xevent (struct x_display_info *, XEvent *, 350static int handle_one_xevent (struct x_display_info *, XEvent *,
351 int *, struct input_event *); 351 int *, struct input_event *);
352#if ! (defined USE_MOTIF || defined USE_X_TOOLKIT) 352#ifdef USE_GTK
353static int x_dispatch_event (XEvent *, Display *); 353static int x_dispatch_event (XEvent *, Display *);
354#endif 354#endif
355/* Don't declare this NO_RETURN because we want no 355/* Don't declare this NO_RETURN because we want no
@@ -1451,19 +1451,6 @@ x_frame_of_widget (Widget widget)
1451} 1451}
1452 1452
1453 1453
1454/* Allocate the color COLOR->pixel on the screen and display of
1455 widget WIDGET in colormap CMAP. If an exact match cannot be
1456 allocated, try the nearest color available. Value is non-zero
1457 if successful. This is called from lwlib. */
1458
1459int
1460x_alloc_nearest_color_for_widget (Widget widget, Colormap cmap, XColor *color)
1461{
1462 struct frame *f = x_frame_of_widget (widget);
1463 return x_alloc_nearest_color (f, cmap, color);
1464}
1465
1466
1467/* Allocate a color which is lighter or darker than *PIXEL by FACTOR 1454/* Allocate a color which is lighter or darker than *PIXEL by FACTOR
1468 or DELTA. Try a color with RGB values multiplied by FACTOR first. 1455 or DELTA. Try a color with RGB values multiplied by FACTOR first.
1469 If this produces the same color as PIXEL, try a color where all RGB 1456 If this produces the same color as PIXEL, try a color where all RGB
@@ -3459,6 +3446,16 @@ x_detect_focus_change (struct x_display_info *dpyinfo, XEvent *event, struct inp
3459} 3446}
3460 3447
3461 3448
3449#if defined HAVE_MENUS && !defined USE_X_TOOLKIT && !defined USE_GTK
3450/* Handle an event saying the mouse has moved out of an Emacs frame. */
3451
3452void
3453x_mouse_leave (struct x_display_info *dpyinfo)
3454{
3455 x_new_focus_frame (dpyinfo, dpyinfo->x_focus_event_frame);
3456}
3457#endif
3458
3462/* The focus has changed, or we have redirected a frame's focus to 3459/* The focus has changed, or we have redirected a frame's focus to
3463 another frame (this happens when a frame uses a surrogate 3460 another frame (this happens when a frame uses a surrogate
3464 mini-buffer frame). Shift the highlight as appropriate. 3461 mini-buffer frame). Shift the highlight as appropriate.
@@ -4221,8 +4218,8 @@ x_send_scroll_bar_event (Lisp_Object window, int part, int portion, int whole)
4221 ev->data.l[4] = (long) whole; 4218 ev->data.l[4] = (long) whole;
4222 4219
4223 /* Make Xt timeouts work while the scroll bar is active. */ 4220 /* Make Xt timeouts work while the scroll bar is active. */
4224 toolkit_scroll_bar_interaction = 1;
4225#ifdef USE_X_TOOLKIT 4221#ifdef USE_X_TOOLKIT
4222 toolkit_scroll_bar_interaction = 1;
4226 x_activate_timeout_atimer (); 4223 x_activate_timeout_atimer ();
4227#endif 4224#endif
4228 4225
@@ -4535,7 +4532,7 @@ x_create_toolkit_scroll_bar (struct frame *f, struct scroll_bar *bar)
4535 Widget widget; 4532 Widget widget;
4536 Arg av[20]; 4533 Arg av[20];
4537 int ac = 0; 4534 int ac = 0;
4538 char *scroll_bar_name = SCROLL_BAR_NAME; 4535 char const *scroll_bar_name = SCROLL_BAR_NAME;
4539 unsigned long pixel; 4536 unsigned long pixel;
4540 4537
4541 BLOCK_INPUT; 4538 BLOCK_INPUT;
@@ -4687,8 +4684,8 @@ x_create_toolkit_scroll_bar (struct frame *f, struct scroll_bar *bar)
4687 f->output_data.x->edit_widget, av, ac); 4684 f->output_data.x->edit_widget, av, ac);
4688 4685
4689 { 4686 {
4690 char *initial = ""; 4687 char const *initial = "";
4691 char *val = initial; 4688 char const *val = initial;
4692 XtVaGetValues (widget, XtNscrollVCursor, (XtPointer) &val, 4689 XtVaGetValues (widget, XtNscrollVCursor, (XtPointer) &val,
4693#ifdef XtNarrowScrollbars 4690#ifdef XtNarrowScrollbars
4694 XtNarrowScrollbars, (XtPointer) &xaw3d_arrow_scroll, 4691 XtNarrowScrollbars, (XtPointer) &xaw3d_arrow_scroll,
@@ -5668,6 +5665,7 @@ static struct x_display_info *XTread_socket_fake_io_error;
5668 5665
5669static struct x_display_info *next_noop_dpyinfo; 5666static struct x_display_info *next_noop_dpyinfo;
5670 5667
5668#if defined USE_X_TOOLKIT || defined USE_GTK
5671#define SET_SAVED_BUTTON_EVENT \ 5669#define SET_SAVED_BUTTON_EVENT \
5672 do \ 5670 do \
5673 { \ 5671 { \
@@ -5679,6 +5677,7 @@ static struct x_display_info *next_noop_dpyinfo;
5679 XSETFRAME (inev.ie.frame_or_window, f); \ 5677 XSETFRAME (inev.ie.frame_or_window, f); \
5680 } \ 5678 } \
5681 while (0) 5679 while (0)
5680#endif
5682 5681
5683enum 5682enum
5684{ 5683{
@@ -5764,8 +5763,8 @@ event_handler_gdk (GdkXEvent *gxev, GdkEvent *ev, gpointer data)
5764#endif /* USE_GTK */ 5763#endif /* USE_GTK */
5765 5764
5766 5765
5767static void xembed_send_message (struct frame *f, Time time, 5766static void xembed_send_message (struct frame *f, Time,
5768 enum xembed_message message, 5767 enum xembed_message,
5769 long detail, long data1, long data2); 5768 long detail, long data1, long data2);
5770 5769
5771/* Handles the XEvent EVENT on display DPYINFO. 5770/* Handles the XEvent EVENT on display DPYINFO.
@@ -6978,15 +6977,13 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr,
6978 return count; 6977 return count;
6979} 6978}
6980 6979
6980#if defined USE_GTK || defined USE_X_TOOLKIT
6981 6981
6982/* Handles the XEvent EVENT on display DISPLAY. 6982/* Handles the XEvent EVENT on display DISPLAY.
6983 This is used for event loops outside the normal event handling, 6983 This is used for event loops outside the normal event handling,
6984 i.e. looping while a popup menu or a dialog is posted. 6984 i.e. looping while a popup menu or a dialog is posted.
6985 6985
6986 Returns the value handle_one_xevent sets in the finish argument. */ 6986 Returns the value handle_one_xevent sets in the finish argument. */
6987#if ! (defined USE_MOTIF || defined USE_X_TOOLKIT)
6988static
6989#endif
6990int 6987int
6991x_dispatch_event (XEvent *event, Display *display) 6988x_dispatch_event (XEvent *event, Display *display)
6992{ 6989{
@@ -7000,6 +6997,7 @@ x_dispatch_event (XEvent *event, Display *display)
7000 6997
7001 return finish; 6998 return finish;
7002} 6999}
7000#endif
7003 7001
7004 7002
7005/* Read events coming from the X server. 7003/* Read events coming from the X server.
@@ -10273,10 +10271,10 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name)
10273 10271
10274#ifdef USE_LUCID 10272#ifdef USE_LUCID
10275 { 10273 {
10276 Display *dpy = dpyinfo->display;
10277 XrmValue d, fr, to; 10274 XrmValue d, fr, to;
10278 Font font; 10275 Font font;
10279 10276
10277 dpy = dpyinfo->display;
10280 d.addr = (XPointer)&dpy; 10278 d.addr = (XPointer)&dpy;
10281 d.size = sizeof (Display *); 10279 d.size = sizeof (Display *);
10282 fr.addr = XtDefaultFont; 10280 fr.addr = XtDefaultFont;
diff --git a/src/xterm.h b/src/xterm.h
index bd5cf2dbd31..fbd638fe73b 100644
--- a/src/xterm.h
+++ b/src/xterm.h
@@ -982,11 +982,11 @@ extern int x_alloc_nearest_color (struct frame *, Colormap, XColor *);
982extern void x_query_colors (struct frame *f, XColor *, int); 982extern void x_query_colors (struct frame *f, XColor *, int);
983extern void x_query_color (struct frame *f, XColor *); 983extern void x_query_color (struct frame *f, XColor *);
984extern void x_clear_area (Display *, Window, int, int, int, int, int); 984extern void x_clear_area (Display *, Window, int, int, int, int, int);
985#ifdef WINDOWSNT 985#if defined HAVE_MENUS && !defined USE_X_TOOLKIT && !defined USE_GTK
986extern void x_mouse_leave (struct x_display_info *); 986extern void x_mouse_leave (struct x_display_info *);
987#endif 987#endif
988 988
989#if defined USE_MOTIF || defined 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 unsigned int x_x_to_emacs_modifiers (struct x_display_info *,