aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Eggert2011-04-16 16:11:35 -0700
committerPaul Eggert2011-04-16 16:11:35 -0700
commitfd35b6f96777be3305879a9ca60ab5befb254042 (patch)
treedb72c649acdc7f53d9672fba88b6a08b3601cdda
parentc4354cb4f4a3982331180439120ca72734d49cc5 (diff)
parent399c71d323b8beef139437311c78440d0033c652 (diff)
downloademacs-fd35b6f96777be3305879a9ca60ab5befb254042.tar.gz
emacs-fd35b6f96777be3305879a9ca60ab5befb254042.zip
Static checks with GCC 4.6.0 and non-default toolkits.
-rw-r--r--lib-src/ChangeLog15
-rw-r--r--lib-src/emacsclient.c6
-rw-r--r--lib-src/fakemail.c18
-rw-r--r--lib-src/movemail.c20
-rw-r--r--lwlib/ChangeLog16
-rw-r--r--lwlib/lwlib-Xm.c12
-rw-r--r--lwlib/lwlib-utils.c28
-rw-r--r--lwlib/lwlib-utils.h3
-rw-r--r--lwlib/lwlib.c9
-rw-r--r--lwlib/xlwmenu.c38
-rw-r--r--oldXMenu/Activate.c2
-rw-r--r--oldXMenu/AddPane.c23
-rw-r--r--oldXMenu/AddSel.c35
-rw-r--r--oldXMenu/ChangeLog40
-rw-r--r--oldXMenu/Create.c45
-rw-r--r--oldXMenu/Destroy.c4
-rw-r--r--oldXMenu/Error.c3
-rw-r--r--oldXMenu/EvHand.c2
-rw-r--r--oldXMenu/FindPane.c2
-rw-r--r--oldXMenu/FindSel.c2
-rw-r--r--oldXMenu/InsPane.c19
-rw-r--r--oldXMenu/InsSel.c31
-rw-r--r--oldXMenu/Internal.c97
-rw-r--r--oldXMenu/SetAEQ.c2
-rw-r--r--oldXMenu/SetFrz.c2
-rw-r--r--oldXMenu/X10.h3
-rw-r--r--oldXMenu/XDelAssoc.c11
-rw-r--r--oldXMenu/XDestAssoc.c6
-rw-r--r--oldXMenu/XMakeAssoc.c13
-rw-r--r--oldXMenu/XMenu.h50
-rw-r--r--oldXMenu/XMenuInt.h30
-rw-r--r--oldXMenu/insque.c10
-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
72 files changed, 639 insertions, 471 deletions
diff --git a/lib-src/ChangeLog b/lib-src/ChangeLog
index e3d7edf94bd..c45da107a8c 100644
--- a/lib-src/ChangeLog
+++ b/lib-src/ChangeLog
@@ -1,3 +1,18 @@
12011-04-16 Paul Eggert <eggert@cs.ucla.edu>
2
3 Static checks with GCC 4.6.0 and non-default toolkits.
4
5 * movemail.c (mail_spool_name): Protoize.
6 (main): Remove unused var. Mark var as initialized.
7 Move locals to avoid shadowing, and use time_t for times.
8
9 * fakemail.c (xmalloc, xreallc): Use standard C prototypes
10 with void *. This avoids warnings about pointer casts.
11
12 * emacsclient.c (main): Don't use uninitialized var.
13 (IS_ANY_SEP): Remove; unused.
14 (get_current_dir_name): Add an extern decl.
15
12011-04-06 Paul Eggert <eggert@cs.ucla.edu> 162011-04-06 Paul Eggert <eggert@cs.ucla.edu>
2 17
3 Fix more problems found by GCC 4.6.0's static checks. 18 Fix more problems found by GCC 4.6.0's static checks.
diff --git a/lib-src/emacsclient.c b/lib-src/emacsclient.c
index c5231fb9989..2aabc52e828 100644
--- a/lib-src/emacsclient.c
+++ b/lib-src/emacsclient.c
@@ -218,10 +218,8 @@ xmalloc (unsigned int size)
218#define IS_DEVICE_SEP(_c_) ((_c_) == DEVICE_SEP) 218#define IS_DEVICE_SEP(_c_) ((_c_) == DEVICE_SEP)
219#endif 219#endif
220#endif 220#endif
221#ifndef IS_ANY_SEP
222#define IS_ANY_SEP(_c_) (IS_DIRECTORY_SEP (_c_))
223#endif
224 221
222char *get_current_dir_name (void);
225 223
226/* Return the current working directory. Returns NULL on errors. 224/* Return the current working directory. Returns NULL on errors.
227 Any other returned value must be freed with free. This is used 225 Any other returned value must be freed with free. This is used
@@ -1524,7 +1522,7 @@ start_daemon_and_retry_set_socket (void)
1524int 1522int
1525main (int argc, char **argv) 1523main (int argc, char **argv)
1526{ 1524{
1527 int rl, needlf = 0; 1525 int rl = 0, needlf = 0;
1528 char *cwd, *str; 1526 char *cwd, *str;
1529 char string[BUFSIZ+1]; 1527 char string[BUFSIZ+1];
1530 int null_socket_name IF_LINT ( = 0); 1528 int null_socket_name IF_LINT ( = 0);
diff --git a/lib-src/fakemail.c b/lib-src/fakemail.c
index 940d6219425..435512125ff 100644
--- a/lib-src/fakemail.c
+++ b/lib-src/fakemail.c
@@ -178,20 +178,20 @@ fatal (const char *s1)
178 178
179/* Like malloc but get fatal error if memory is exhausted. */ 179/* Like malloc but get fatal error if memory is exhausted. */
180 180
181static long * 181static void *
182xmalloc (int size) 182xmalloc (size_t size)
183{ 183{
184 long *result = (long *) malloc (((unsigned) size)); 184 void *result = malloc (size);
185 if (result == ((long *) NULL)) 185 if (! result)
186 fatal ("virtual memory exhausted"); 186 fatal ("virtual memory exhausted");
187 return result; 187 return result;
188} 188}
189 189
190static long * 190static void *
191xrealloc (long int *ptr, int size) 191xrealloc (void *ptr, size_t size)
192{ 192{
193 long *result = (long *) realloc (ptr, ((unsigned) size)); 193 void *result = realloc (ptr, size);
194 if (result == ((long *) NULL)) 194 if (! result)
195 fatal ("virtual memory exhausted"); 195 fatal ("virtual memory exhausted");
196 return result; 196 return result;
197} 197}
@@ -221,7 +221,7 @@ readline (struct linebuffer *linebuffer, FILE *stream)
221 if (p == end) 221 if (p == end)
222 { 222 {
223 linebuffer->size *= 2; 223 linebuffer->size *= 2;
224 buffer = ((char *) xrealloc ((long *)buffer, linebuffer->size)); 224 buffer = (char *) xrealloc (buffer, linebuffer->size);
225 p = buffer + (p - linebuffer->buffer); 225 p = buffer + (p - linebuffer->buffer);
226 end = buffer + linebuffer->size; 226 end = buffer + linebuffer->size;
227 linebuffer->buffer = buffer; 227 linebuffer->buffer = buffer;
diff --git a/lib-src/movemail.c b/lib-src/movemail.c
index 4a894c1cba1..4cf97cbac18 100644
--- a/lib-src/movemail.c
+++ b/lib-src/movemail.c
@@ -131,7 +131,7 @@ extern int lk_open (), lk_close ();
131 files appear in. */ 131 files appear in. */
132#ifdef MAILDIR 132#ifdef MAILDIR
133#define MAIL_USE_MAILLOCK 133#define MAIL_USE_MAILLOCK
134static char *mail_spool_name (); 134static char *mail_spool_name (char *);
135#endif 135#endif
136#endif 136#endif
137 137
@@ -167,7 +167,6 @@ main (int argc, char **argv)
167 167
168#ifndef MAIL_USE_SYSTEM_LOCK 168#ifndef MAIL_USE_SYSTEM_LOCK
169 struct stat st; 169 struct stat st;
170 long now;
171 int tem; 170 int tem;
172 char *lockname, *p; 171 char *lockname, *p;
173 char *tempname; 172 char *tempname;
@@ -259,7 +258,13 @@ main (int argc, char **argv)
259#ifndef MAIL_USE_SYSTEM_LOCK 258#ifndef MAIL_USE_SYSTEM_LOCK
260#ifdef MAIL_USE_MAILLOCK 259#ifdef MAIL_USE_MAILLOCK
261 spool_name = mail_spool_name (inname); 260 spool_name = mail_spool_name (inname);
262 if (! spool_name) 261 if (spool_name)
262 {
263#ifdef lint
264 lockname = 0;
265#endif
266 }
267 else
263#endif 268#endif
264 { 269 {
265 #ifndef DIRECTORY_SEP 270 #ifndef DIRECTORY_SEP
@@ -336,7 +341,7 @@ main (int argc, char **argv)
336 by time differences between machines. */ 341 by time differences between machines. */
337 if (stat (lockname, &st) >= 0) 342 if (stat (lockname, &st) >= 0)
338 { 343 {
339 now = time (0); 344 time_t now = time (0);
340 if (st.st_ctime < now - 300) 345 if (st.st_ctime < now - 300)
341 unlink (lockname); 346 unlink (lockname);
342 } 347 }
@@ -352,7 +357,10 @@ main (int argc, char **argv)
352 int lockcount = 0; 357 int lockcount = 0;
353 int status = 0; 358 int status = 0;
354#if defined (MAIL_USE_MAILLOCK) && defined (HAVE_TOUCHLOCK) 359#if defined (MAIL_USE_MAILLOCK) && defined (HAVE_TOUCHLOCK)
355 time_t touched_lock, now; 360 time_t touched_lock;
361# ifdef lint
362 touched_lock = 0;
363# endif
356#endif 364#endif
357 365
358 if (setuid (getuid ()) < 0 || setregid (-1, real_gid) < 0) 366 if (setuid (getuid ()) < 0 || setregid (-1, real_gid) < 0)
@@ -462,7 +470,7 @@ main (int argc, char **argv)
462#if defined (MAIL_USE_MAILLOCK) && defined (HAVE_TOUCHLOCK) 470#if defined (MAIL_USE_MAILLOCK) && defined (HAVE_TOUCHLOCK)
463 if (spool_name) 471 if (spool_name)
464 { 472 {
465 now = time (0); 473 time_t now = time (0);
466 if (now - touched_lock > 60) 474 if (now - touched_lock > 60)
467 { 475 {
468 touchlock (); 476 touchlock ();
diff --git a/lwlib/ChangeLog b/lwlib/ChangeLog
index 64ae2fe085d..e98526f2546 100644
--- a/lwlib/ChangeLog
+++ b/lwlib/ChangeLog
@@ -1,3 +1,19 @@
12011-04-16 Paul Eggert <eggert@cs.ucla.edu>
2
3 Static checks with GCC 4.6.0 and non-default toolkits.
4
5 * lwlib-Xm.c (make_dialog): Rename local to avoid shadowing.
6 (make_menu_in_widget): Add cast to avoid warning.
7 * lwlib-utils.c (XtCompositeChildren): Likewise.
8
9 * lwlib.c (EXPLAIN, destroy_one_instance): Avoid "else;".
10 (first_child) [USE_MOTIF]: Protoize.
11
12 * lwlib-utils.h, lwlib-utils.c (XtSafelyDestroyWidget): Remove; unused.
13
14 * xlwmenu.c (XlwMenuSetValues): Rename/ move locals to avoid shadowing.
15 (MINL): Define only if not emacs.
16
12011-03-07 Chong Yidong <cyd@stupidchicken.com> 172011-03-07 Chong Yidong <cyd@stupidchicken.com>
2 18
3 * Version 23.3 released. 19 * Version 23.3 released.
diff --git a/lwlib/lwlib-Xm.c b/lwlib/lwlib-Xm.c
index 55b27b9dab0..2b7677a02f5 100644
--- a/lwlib/lwlib-Xm.c
+++ b/lwlib/lwlib-Xm.c
@@ -511,7 +511,7 @@ make_menu_in_widget (widget_instance* instance,
511 /* Allocate the children array */ 511 /* Allocate the children array */
512 for (num_children = 0, cur = val; cur; num_children++, cur = cur->next) 512 for (num_children = 0, cur = val; cur; num_children++, cur = cur->next)
513 ; 513 ;
514 children = (Widget*)XtMalloc (num_children * sizeof (Widget)); 514 children = (Widget*)(void*)XtMalloc (num_children * sizeof (Widget));
515 515
516 /* WIDGET should be a RowColumn. */ 516 /* WIDGET should be a RowColumn. */
517 if (!XmIsRowColumn (widget)) 517 if (!XmIsRowColumn (widget))
@@ -1020,10 +1020,10 @@ dialog_key_cb (Widget widget,
1020{ 1020{
1021 KeySym sym = 0; 1021 KeySym sym = 0;
1022 Modifiers modif_ret; 1022 Modifiers modif_ret;
1023 1023
1024 XtTranslateKeycode (event->xkey.display, event->xkey.keycode, 0, 1024 XtTranslateKeycode (event->xkey.display, event->xkey.keycode, 0,
1025 &modif_ret, &sym); 1025 &modif_ret, &sym);
1026 1026
1027 if (sym == osfXK_Cancel) 1027 if (sym == osfXK_Cancel)
1028 { 1028 {
1029 Widget w = *((Widget *) closure); 1029 Widget w = *((Widget *) closure);
@@ -1055,7 +1055,7 @@ make_dialog (char* name,
1055 Widget row; 1055 Widget row;
1056 Widget icon; 1056 Widget icon;
1057 Widget icon_separator; 1057 Widget icon_separator;
1058 Widget message; 1058 Widget message_label;
1059 Widget value = 0; 1059 Widget value = 0;
1060 Widget separator; 1060 Widget separator;
1061 Widget button = 0; 1061 Widget button = 0;
@@ -1269,7 +1269,7 @@ make_dialog (char* name,
1269 XtSetArg(al[ac], XmNleftWidget, icon); ac++; 1269 XtSetArg(al[ac], XmNleftWidget, icon); ac++;
1270 XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM); ac++; 1270 XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM); ac++;
1271 XtSetArg(al[ac], XmNrightOffset, 13); ac++; 1271 XtSetArg(al[ac], XmNrightOffset, 13); ac++;
1272 message = XmCreateLabel (form, "message", al, ac); 1272 message_label = XmCreateLabel (form, "message", al, ac);
1273 1273
1274 if (list) 1274 if (list)
1275 XtManageChild (value); 1275 XtManageChild (value);
@@ -1281,7 +1281,7 @@ make_dialog (char* name,
1281 { 1281 {
1282 children [i] = value; i++; 1282 children [i] = value; i++;
1283 } 1283 }
1284 children [i] = message; i++; 1284 children [i] = message_label; i++;
1285 children [i] = icon; i++; 1285 children [i] = icon; i++;
1286 children [i] = icon_separator; i++; 1286 children [i] = icon_separator; i++;
1287 XtManageChildren (children, i); 1287 XtManageChildren (children, i);
diff --git a/lwlib/lwlib-utils.c b/lwlib/lwlib-utils.c
index a3e1cb3b432..7a0dd1b264a 100644
--- a/lwlib/lwlib-utils.c
+++ b/lwlib/lwlib-utils.c
@@ -129,7 +129,7 @@ XtCompositeChildren (Widget widget, unsigned int *number)
129 return NULL; 129 return NULL;
130 } 130 }
131 n = cw->composite.num_children; 131 n = cw->composite.num_children;
132 result = (Widget*)XtMalloc (n * sizeof (Widget)); 132 result = (Widget*)(void*)XtMalloc (n * sizeof (Widget));
133 *number = n; 133 *number = n;
134 for (i = 0; i < n; i++) 134 for (i = 0; i < n; i++)
135 result [i] = cw->composite.children [i]; 135 result [i] = cw->composite.children [i];
@@ -141,29 +141,3 @@ XtWidgetBeingDestroyedP (Widget widget)
141{ 141{
142 return widget->core.being_destroyed; 142 return widget->core.being_destroyed;
143} 143}
144
145void
146XtSafelyDestroyWidget (Widget widget)
147{
148#if 0
149
150 /* this requires IntrinsicI.h (actually, InitialI.h) */
151
152 XtAppContext app = XtWidgetToApplicationContext(widget);
153
154 if (app->dispatch_level == 0)
155 {
156 app->dispatch_level = 1;
157 XtDestroyWidget (widget);
158 /* generates an event so that the event loop will be called */
159 XChangeProperty (XtDisplay (widget), XtWindow (widget),
160 XA_STRING, XA_STRING, 32, PropModeAppend, NULL, 0);
161 app->dispatch_level = 0;
162 }
163 else
164 XtDestroyWidget (widget);
165
166#else
167 abort ();
168#endif
169}
diff --git a/lwlib/lwlib-utils.h b/lwlib/lwlib-utils.h
index b988374288a..ec3daab94ef 100644
--- a/lwlib/lwlib-utils.h
+++ b/lwlib/lwlib-utils.h
@@ -15,7 +15,4 @@ Widget *XtCompositeChildren (Widget, unsigned int *);
15Boolean 15Boolean
16XtWidgetBeingDestroyedP (Widget widget); 16XtWidgetBeingDestroyedP (Widget widget);
17 17
18void XtSafelyDestroyWidget (Widget);
19
20#endif /* _LWLIB_UTILS_H_ */ 18#endif /* _LWLIB_UTILS_H_ */
21
diff --git a/lwlib/lwlib.c b/lwlib/lwlib.c
index 290ce091301..9d8ec3330d3 100644
--- a/lwlib/lwlib.c
+++ b/lwlib/lwlib.c
@@ -422,7 +422,7 @@ safe_strcmp (const char *s1, const char *s2)
422 (nc == STRUCTURAL_CHANGE ? "structural" : "???")))), \ 422 (nc == STRUCTURAL_CHANGE ? "structural" : "???")))), \
423 nc, desc, a1, a2) 423 nc, desc, a1, a2)
424#else 424#else
425# define EXPLAIN(name, oc, nc, desc, a1, a2) 425# define EXPLAIN(name, oc, nc, desc, a1, a2) ((void) 0)
426#endif 426#endif
427 427
428 428
@@ -912,8 +912,9 @@ destroy_one_instance (widget_instance *instance)
912 xaw_destroy_instance (instance); 912 xaw_destroy_instance (instance);
913 else 913 else
914#endif 914#endif
915 /* do not remove the empty statement */ 915 {
916 ; 916 /* Empty compound statement to terminate if-then-else chain. */
917 }
917 } 918 }
918 919
919 free_widget_instance (instance); 920 free_widget_instance (instance);
@@ -978,7 +979,7 @@ lw_destroy_all_pop_ups (void)
978} 979}
979 980
980#ifdef USE_MOTIF 981#ifdef USE_MOTIF
981extern Widget first_child (/* Widget */); /* garbage */ 982extern Widget first_child (Widget); /* garbage */
982#endif 983#endif
983 984
984Widget 985Widget
diff --git a/lwlib/xlwmenu.c b/lwlib/xlwmenu.c
index 5b97f2bf999..e9ec604ae7f 100644
--- a/lwlib/xlwmenu.c
+++ b/lwlib/xlwmenu.c
@@ -1220,9 +1220,9 @@ display_menu (XlwMenuWidget mw,
1220 { 1220 {
1221 if (val->enabled) 1221 if (val->enabled)
1222 *hit_return = val; 1222 *hit_return = val;
1223 else 1223 else
1224 no_return = 1; 1224 no_return = 1;
1225 if (mw->menu.inside_entry != val) 1225 if (mw->menu.inside_entry != val)
1226 { 1226 {
1227 if (mw->menu.inside_entry) 1227 if (mw->menu.inside_entry)
1228 XtCallCallbackList ((Widget)mw, mw->menu.leave, 1228 XtCallCallbackList ((Widget)mw, mw->menu.leave,
@@ -1426,7 +1426,7 @@ fit_to_screen (XlwMenuWidget mw,
1426static void 1426static void
1427create_pixmap_for_menu (window_state* ws, XlwMenuWidget mw) 1427create_pixmap_for_menu (window_state* ws, XlwMenuWidget mw)
1428{ 1428{
1429 if (ws->pixmap != None) 1429 if (ws->pixmap != None)
1430 { 1430 {
1431 XFreePixmap (XtDisplay (ws->w), ws->pixmap); 1431 XFreePixmap (XtDisplay (ws->w), ws->pixmap);
1432 ws->pixmap = None; 1432 ws->pixmap = None;
@@ -1592,9 +1592,9 @@ map_event_to_widget_value (XlwMenuWidget mw,
1592 } 1592 }
1593 } 1593 }
1594 1594
1595 if (!inside) 1595 if (!inside)
1596 { 1596 {
1597 if (mw->menu.inside_entry != NULL) 1597 if (mw->menu.inside_entry != NULL)
1598 XtCallCallbackList ((Widget)mw, mw->menu.leave, 1598 XtCallCallbackList ((Widget)mw, mw->menu.leave,
1599 (XtPointer) mw->menu.inside_entry); 1599 (XtPointer) mw->menu.inside_entry);
1600 mw->menu.inside_entry = NULL; 1600 mw->menu.inside_entry = NULL;
@@ -1693,8 +1693,10 @@ release_drawing_gcs (XlwMenuWidget mw)
1693 mw->menu.background_gc = (GC) -1; 1693 mw->menu.background_gc = (GC) -1;
1694} 1694}
1695 1695
1696#ifndef emacs
1696#define MINL(x,y) ((((unsigned long) (x)) < ((unsigned long) (y))) \ 1697#define MINL(x,y) ((((unsigned long) (x)) < ((unsigned long) (y))) \
1697 ? ((unsigned long) (x)) : ((unsigned long) (y))) 1698 ? ((unsigned long) (x)) : ((unsigned long) (y)))
1699#endif
1698 1700
1699static void 1701static void
1700make_shadow_gcs (XlwMenuWidget mw) 1702make_shadow_gcs (XlwMenuWidget mw)
@@ -1881,7 +1883,7 @@ openXftFont (XlwMenuWidget mw)
1881 if (!mw->menu.font) 1883 if (!mw->menu.font)
1882 { 1884 {
1883 mw->menu.xft_font = XftFontOpenName (XtDisplay (mw), screen, fname); 1885 mw->menu.xft_font = XftFontOpenName (XtDisplay (mw), screen, fname);
1884 if (!mw->menu.xft_font) 1886 if (!mw->menu.xft_font)
1885 { 1887 {
1886 fprintf (stderr, "Can't find font '%s'\n", fname); 1888 fprintf (stderr, "Can't find font '%s'\n", fname);
1887 mw->menu.xft_font = getDefaultXftFont (mw); 1889 mw->menu.xft_font = getDefaultXftFont (mw);
@@ -1930,19 +1932,19 @@ XlwMenuInitialize (Widget request, Widget w, ArgList args, Cardinal *num_args)
1930 if (!mw->menu.font) 1932 if (!mw->menu.font)
1931 { 1933 {
1932 mw->menu.font = XLoadQueryFont (display, "fixed"); 1934 mw->menu.font = XLoadQueryFont (display, "fixed");
1933 if (!mw->menu.font) 1935 if (!mw->menu.font)
1934 { 1936 {
1935 fprintf (stderr, "Menu font fixed not found, can't continue.\n"); 1937 fprintf (stderr, "Menu font fixed not found, can't continue.\n");
1936 abort (); 1938 abort ();
1937 } 1939 }
1938 } 1940 }
1939 } 1941 }
1940 1942
1941#ifdef HAVE_X_I18N 1943#ifdef HAVE_X_I18N
1942 if (mw->menu.fontSet) 1944 if (mw->menu.fontSet)
1943 mw->menu.font_extents = XExtentsOfFontSet (mw->menu.fontSet); 1945 mw->menu.font_extents = XExtentsOfFontSet (mw->menu.fontSet);
1944#endif 1946#endif
1945 1947
1946 make_drawing_gcs (mw); 1948 make_drawing_gcs (mw);
1947 make_shadow_gcs (mw); 1949 make_shadow_gcs (mw);
1948 1950
@@ -2118,12 +2120,12 @@ XlwMenuDestroy (Widget w)
2118 XftFontClose (XtDisplay (mw), mw->menu.xft_font); 2120 XftFontClose (XtDisplay (mw), mw->menu.xft_font);
2119#endif 2121#endif
2120 2122
2121 if (mw->menu.windows [0].pixmap != None) 2123 if (mw->menu.windows [0].pixmap != None)
2122 XFreePixmap (XtDisplay (mw), mw->menu.windows [0].pixmap); 2124 XFreePixmap (XtDisplay (mw), mw->menu.windows [0].pixmap);
2123 /* start from 1 because the one in slot 0 is w->core.window */ 2125 /* start from 1 because the one in slot 0 is w->core.window */
2124 for (i = 1; i < mw->menu.windows_length; i++) 2126 for (i = 1; i < mw->menu.windows_length; i++)
2125 { 2127 {
2126 if (mw->menu.windows [i].pixmap != None) 2128 if (mw->menu.windows [i].pixmap != None)
2127 XFreePixmap (XtDisplay (mw), mw->menu.windows [i].pixmap); 2129 XFreePixmap (XtDisplay (mw), mw->menu.windows [i].pixmap);
2128#ifdef HAVE_XFT 2130#ifdef HAVE_XFT
2129 if (mw->menu.windows [i].xft_draw) 2131 if (mw->menu.windows [i].xft_draw)
@@ -2153,18 +2155,17 @@ XlwMenuSetValues (Widget current, Widget request, Widget new,
2153{ 2155{
2154 XlwMenuWidget oldmw = (XlwMenuWidget)current; 2156 XlwMenuWidget oldmw = (XlwMenuWidget)current;
2155 XlwMenuWidget newmw = (XlwMenuWidget)new; 2157 XlwMenuWidget newmw = (XlwMenuWidget)new;
2156 Boolean redisplay = False; 2158 Boolean do_redisplay = False;
2157 int i;
2158 2159
2159 if (newmw->menu.contents 2160 if (newmw->menu.contents
2160 && newmw->menu.contents->contents 2161 && newmw->menu.contents->contents
2161 && newmw->menu.contents->contents->change >= VISIBLE_CHANGE) 2162 && newmw->menu.contents->contents->change >= VISIBLE_CHANGE)
2162 redisplay = True; 2163 do_redisplay = True;
2163 /* Do redisplay if the contents are entirely eliminated. */ 2164 /* Do redisplay if the contents are entirely eliminated. */
2164 if (newmw->menu.contents 2165 if (newmw->menu.contents
2165 && newmw->menu.contents->contents == 0 2166 && newmw->menu.contents->contents == 0
2166 && newmw->menu.contents->change >= VISIBLE_CHANGE) 2167 && newmw->menu.contents->change >= VISIBLE_CHANGE)
2167 redisplay = True; 2168 do_redisplay = True;
2168 2169
2169 if (newmw->core.background_pixel != oldmw->core.background_pixel 2170 if (newmw->core.background_pixel != oldmw->core.background_pixel
2170 || newmw->menu.foreground != oldmw->menu.foreground 2171 || newmw->menu.foreground != oldmw->menu.foreground
@@ -2179,6 +2180,7 @@ XlwMenuSetValues (Widget current, Widget request, Widget new,
2179#endif 2180#endif
2180 ) 2181 )
2181 { 2182 {
2183 int i;
2182 release_drawing_gcs (newmw); 2184 release_drawing_gcs (newmw);
2183 make_drawing_gcs (newmw); 2185 make_drawing_gcs (newmw);
2184 2186
@@ -2188,7 +2190,7 @@ XlwMenuSetValues (Widget current, Widget request, Widget new,
2188 newmw->menu.bottom_shadow_color = -1; 2190 newmw->menu.bottom_shadow_color = -1;
2189 make_shadow_gcs (newmw); 2191 make_shadow_gcs (newmw);
2190 2192
2191 redisplay = True; 2193 do_redisplay = True;
2192 2194
2193 if (XtIsRealized (current)) 2195 if (XtIsRealized (current))
2194 /* If the menu is currently displayed, change the display. */ 2196 /* If the menu is currently displayed, change the display. */
@@ -2229,12 +2231,12 @@ XlwMenuSetValues (Widget current, Widget request, Widget new,
2229#ifdef HAVE_X_I18N 2231#ifdef HAVE_X_I18N
2230 if (newmw->menu.fontSet != oldmw->menu.fontSet && newmw->menu.fontSet != NULL) 2232 if (newmw->menu.fontSet != oldmw->menu.fontSet && newmw->menu.fontSet != NULL)
2231 { 2233 {
2232 redisplay = True; 2234 do_redisplay = True;
2233 newmw->menu.font_extents = XExtentsOfFontSet (newmw->menu.fontSet); 2235 newmw->menu.font_extents = XExtentsOfFontSet (newmw->menu.fontSet);
2234 } 2236 }
2235#endif 2237#endif
2236 2238
2237 return redisplay; 2239 return do_redisplay;
2238} 2240}
2239 2241
2240static void 2242static void
diff --git a/oldXMenu/Activate.c b/oldXMenu/Activate.c
index 42eb33d208a..fef8a3b6b25 100644
--- a/oldXMenu/Activate.c
+++ b/oldXMenu/Activate.c
@@ -122,7 +122,7 @@ XMenuActivate(
122 int y_pos, /* Y coordinate of menu position. */ 122 int y_pos, /* Y coordinate of menu position. */
123 unsigned int event_mask, /* Mouse button event mask. */ 123 unsigned int event_mask, /* Mouse button event mask. */
124 char **data, /* Pointer to return data value. */ 124 char **data, /* Pointer to return data value. */
125 void (* help_callback) (char *, int, int)) /* Help callback. */ 125 void (*help_callback) (char const *, int, int)) /* Help callback. */
126{ 126{
127 int status; /* X routine call status. */ 127 int status; /* X routine call status. */
128 int orig_x; /* Upper left menu origin X coord. */ 128 int orig_x; /* Upper left menu origin X coord. */
diff --git a/oldXMenu/AddPane.c b/oldXMenu/AddPane.c
index 67900a6bc76..36b57fe8da6 100644
--- a/oldXMenu/AddPane.c
+++ b/oldXMenu/AddPane.c
@@ -16,14 +16,14 @@
16#include "XMenuInt.h" 16#include "XMenuInt.h"
17 17
18int 18int
19XMenuAddPane(Display *display, register XMenu *menu, register char *label, int active) 19XMenuAddPane(Display *display, register XMenu *menu, register char const *label, int active)
20 20
21 /* Menu object to be modified. */ 21 /* Menu object to be modified. */
22 /* Selection label. */ 22 /* Selection label. */
23 /* Make selection active? */ 23 /* Make selection active? */
24{ 24{
25 register XMPane *pane; /* Newly created pane. */ 25 register XMPane *pane; /* Newly created pane. */
26 register XMSelect *select; /* Initial selection for the new pane. */ 26 register XMSelect *sel; /* Initial selection for the new pane. */
27 27
28 int label_length; /* Label length in characters. */ 28 int label_length; /* Label length in characters. */
29 int label_width; /* Label width in pixels. */ 29 int label_width; /* Label width in pixels. */
@@ -44,8 +44,8 @@ XMenuAddPane(Display *display, register XMenu *menu, register char *label, int a
44 _XMErrorCode = XME_CALLOC; 44 _XMErrorCode = XME_CALLOC;
45 return(XM_FAILURE); 45 return(XM_FAILURE);
46 } 46 }
47 select = (XMSelect *)calloc(1, sizeof(XMSelect)); 47 sel = (XMSelect *)calloc(1, sizeof(XMSelect));
48 if (select == NULL) { 48 if (sel == NULL) {
49 _XMErrorCode = XME_CALLOC; 49 _XMErrorCode = XME_CALLOC;
50 return(XM_FAILURE); 50 return(XM_FAILURE);
51 } 51 }
@@ -62,11 +62,11 @@ XMenuAddPane(Display *display, register XMenu *menu, register char *label, int a
62 * Set up the initial selection. 62 * Set up the initial selection.
63 * Values not explicitly set are zeroed by calloc. 63 * Values not explicitly set are zeroed by calloc.
64 */ 64 */
65 select->next = select; 65 sel->next = sel;
66 select->prev = select; 66 sel->prev = sel;
67 select->type = SL_HEADER; 67 sel->type = SL_HEADER;
68 select->serial = -1; 68 sel->serial = -1;
69 select->parent_p = pane; 69 sel->parent_p = pane;
70 70
71 /* 71 /*
72 * Fill the XMPane structure. 72 * Fill the XMPane structure.
@@ -78,7 +78,7 @@ XMenuAddPane(Display *display, register XMenu *menu, register char *label, int a
78 pane->label = label; 78 pane->label = label;
79 pane->label_width = label_width; 79 pane->label_width = label_width;
80 pane->label_length = label_length; 80 pane->label_length = label_length;
81 pane->s_list = select; 81 pane->s_list = sel;
82 82
83 /* 83 /*
84 * Insert the pane at the end of the pane list. 84 * Insert the pane at the end of the pane list.
@@ -101,4 +101,3 @@ XMenuAddPane(Display *display, register XMenu *menu, register char *label, int a
101 _XMErrorCode = XME_NO_ERROR; 101 _XMErrorCode = XME_NO_ERROR;
102 return((menu->p_count - 1)); 102 return((menu->p_count - 1));
103} 103}
104
diff --git a/oldXMenu/AddSel.c b/oldXMenu/AddSel.c
index 9183aba7e8e..9bbcf71cd3c 100644
--- a/oldXMenu/AddSel.c
+++ b/oldXMenu/AddSel.c
@@ -17,8 +17,8 @@
17#include "XMenuInt.h" 17#include "XMenuInt.h"
18 18
19int 19int
20XMenuAddSelection(Display *display, register XMenu *menu, register int p_num, char *data, char *label, int active, char *help) 20XMenuAddSelection(Display *display, register XMenu *menu, register int p_num, char *data, char *label, int active, char const *help)
21 21
22 /* Menu object to be modified. */ 22 /* Menu object to be modified. */
23 /* Pane number to be modified. */ 23 /* Pane number to be modified. */
24 /* Data value. */ 24 /* Data value. */
@@ -27,7 +27,7 @@ XMenuAddSelection(Display *display, register XMenu *menu, register int p_num, ch
27 /* Help string */ 27 /* Help string */
28{ 28{
29 register XMPane *pane; /* Pane containing the new selection. */ 29 register XMPane *pane; /* Pane containing the new selection. */
30 register XMSelect *select; /* Newly created selection. */ 30 register XMSelect *sel; /* Newly created selection. */
31 31
32 32
33 int label_length; /* Label lenght in characters. */ 33 int label_length; /* Label lenght in characters. */
@@ -49,8 +49,8 @@ XMenuAddSelection(Display *display, register XMenu *menu, register int p_num, ch
49 /* 49 /*
50 * Calloc the XMSelect structure. 50 * Calloc the XMSelect structure.
51 */ 51 */
52 select = (XMSelect *)calloc(1, sizeof(XMSelect)); 52 sel = (XMSelect *)calloc(1, sizeof(XMSelect));
53 if (select == NULL) { 53 if (sel == NULL) {
54 _XMErrorCode = XME_CALLOC; 54 _XMErrorCode = XME_CALLOC;
55 return(XM_FAILURE); 55 return(XM_FAILURE);
56 } 56 }
@@ -65,27 +65,27 @@ XMenuAddSelection(Display *display, register XMenu *menu, register int p_num, ch
65 */ 65 */
66 if (!strcmp (label, "--") || !strcmp (label, "---")) 66 if (!strcmp (label, "--") || !strcmp (label, "---"))
67 { 67 {
68 select->type = SEPARATOR; 68 sel->type = SEPARATOR;
69 select->active = 0; 69 sel->active = 0;
70 } 70 }
71 else 71 else
72 { 72 {
73 select->type = SELECTION; 73 sel->type = SELECTION;
74 select->active = active; 74 sel->active = active;
75 } 75 }
76 76
77 select->serial = -1; 77 sel->serial = -1;
78 select->label = label; 78 sel->label = label;
79 select->label_width = label_width; 79 sel->label_width = label_width;
80 select->label_length = label_length; 80 sel->label_length = label_length;
81 select->data = data; 81 sel->data = data;
82 select->parent_p = pane; 82 sel->parent_p = pane;
83 select->help_string = help; 83 sel->help_string = help;
84 84
85 /* 85 /*
86 * Insert the selection at the end of the selection list. 86 * Insert the selection at the end of the selection list.
87 */ 87 */
88 emacs_insque(select, pane->s_list->prev); 88 emacs_insque(sel, pane->s_list->prev);
89 89
90 /* 90 /*
91 * Update the selection count. 91 * Update the selection count.
@@ -103,4 +103,3 @@ XMenuAddSelection(Display *display, register XMenu *menu, register int p_num, ch
103 _XMErrorCode = XME_NO_ERROR; 103 _XMErrorCode = XME_NO_ERROR;
104 return((pane->s_count - 1)); 104 return((pane->s_count - 1));
105} 105}
106
diff --git a/oldXMenu/ChangeLog b/oldXMenu/ChangeLog
index f0e650ab4b3..b40b5ca7084 100644
--- a/oldXMenu/ChangeLog
+++ b/oldXMenu/ChangeLog
@@ -1,3 +1,43 @@
12011-04-16 Paul Eggert <eggert@cs.ucla.edu>
2
3 Static checks with GCC 4.6.0 and non-default toolkits.
4
5 Modernize to C89, for better static checking.
6 * Activate.c (XMenuActivate): Callback's first arg is readonly.
7 * AddPane.c (XMenuAddPane): Label is readonly. Rename local
8 to avoid shadowing.
9 * AddSel.c (XMenuAddSelection): Help arg is readonly. Rename local.
10 * Create.c (atoi, atof): Remove decls; include <stdlib.h>.
11 (MAX_INACT_PNUM, TILE_BUF_SIZE): Remove; unused.
12 (x_get_resource_string): Args are readonly.
13 (XAllocDisplayColor): colorName is readonly.
14 (XMenuCreate): def_env is readonly. Remove unused locals. Avoid
15 "else;".
16 * Destroy.c (XMenuDestroy): Return void.
17 * Error.c (XMenuError): Remove const pointer.
18 * EvHand.c (XMenuEventHandler): Return void.
19 * FindPane.c, FindSel.c: Include <string.h>.
20 * InsPane.c (XMenuInsertPane): Rename local to avoid shadowing.
21 * InsSel.c (XMenuInsertSelection): Likewise.
22 * Internal.c (toggle_color, BUFFER_SIZE): Remove; unused.
23 (_XMErrorList): Now const.
24 (_XMWinQueInit, _XMRecomputeGlobals, _XMTransToOrigin, _XMRefreshPane):
25 (_XMRefreshSelection): Return void.
26 (_XMWinQueFlush, _XMRefreshSelection): Rename locals to avoid
27 shadowing.
28 (_XMWinQueFlush): Use stack, not heap. Don't use uninitialized var.
29 * SetAEQ.c (XMenuSetAEQ): Now returns void.
30 * SetFrz.c (XMenuSetFreeze): Likewise.
31 * X10.h (XAssoc): Use void * for generic pointer.
32 * XDelAssoc.c: Include XMenuInt.h rather than duplicating part of it.
33 * XDestAssoc.c, XMakeAssoc.c: Likewise.
34 * XDestAssoc.c (XDestroyAssocTable): Return void.
35 * XMakeAssoc.c (XMakeAssoc): Use void * for generic pointer.
36 * XMenu.h, XMenuInt.h: Adjust to signature changes. Use const
37 for pointers to readonly storage.
38 * insque.c: Include XMenuInt.h, to check our own signature.
39 (emacs_insque, emacs_remque): Use void * for generic pointers.
40
12011-03-07 Chong Yidong <cyd@stupidchicken.com> 412011-03-07 Chong Yidong <cyd@stupidchicken.com>
2 42
3 * Version 23.3 released. 43 * Version 23.3 released.
diff --git a/oldXMenu/Create.c b/oldXMenu/Create.c
index 8354208773f..25f1f1c3381 100644
--- a/oldXMenu/Create.c
+++ b/oldXMenu/Create.c
@@ -31,7 +31,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
31 31
32#include <config.h> 32#include <config.h>
33#include "XMenuInt.h" 33#include "XMenuInt.h"
34 34#include <stdlib.h>
35 35
36#ifdef EMACS_BITMAP_FILES 36#ifdef EMACS_BITMAP_FILES
37#include "../src/bitmaps/dimple1.xbm" 37#include "../src/bitmaps/dimple1.xbm"
@@ -71,7 +71,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
71#define DEF_MENU_STYLE LEFT 71#define DEF_MENU_STYLE LEFT
72#define DEF_MENU_MODE BOX 72#define DEF_MENU_MODE BOX
73#define DEF_INACT_PNUM 3 73#define DEF_INACT_PNUM 3
74#define MAX_INACT_PNUM 4
75 74
76#define DEF_P_STYLE CENTER 75#define DEF_P_STYLE CENTER
77 76
@@ -88,16 +87,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
88 87
89#define XASSOC_TABLE_SIZE 64 88#define XASSOC_TABLE_SIZE 64
90 89
91#define TILE_BUF_SIZE 5 90char *x_get_resource_string (char const *, char const *);
92
93int atoi(const char *);
94double atof(const char *);
95char *x_get_resource_string (char *attribute, char *class);
96 91
97 92
98 93
99static Status 94static Status
100XAllocDisplayColor(Display *display, Colormap map, char *colorName, XColor *color, XColor *junk) 95XAllocDisplayColor(Display *display, Colormap map, char const *colorName,
96 XColor *color, XColor *junk)
101{ 97{
102 return (colorName!=0 && 98 return (colorName!=0 &&
103 XParseColor(display, map, colorName, color) && 99 XParseColor(display, map, colorName, color) &&
@@ -106,13 +102,11 @@ XAllocDisplayColor(Display *display, Colormap map, char *colorName, XColor *colo
106 102
107 103
108XMenu * 104XMenu *
109XMenuCreate(Display *display, Window parent, register char *def_env) 105XMenuCreate(Display *display, Window parent, register char const *def_env)
110 /* ID of previously opened display */ 106 /* ID of previously opened display */
111 /* Window ID of the menu's parent window. */ 107 /* Window ID of the menu's parent window. */
112 /* X Defaults program environment name. */ 108 /* X Defaults program environment name. */
113{ 109{
114 register int i; /* Loop counter. */
115 register int j; /* Loop counter. */
116 register char *def_val; /* X Default value temp variable. */ 110 register char *def_val; /* X Default value temp variable. */
117 111
118 register XMenu *menu; /* Pointer to the new menu. */ 112 register XMenu *menu; /* Pointer to the new menu. */
@@ -125,7 +119,7 @@ XMenuCreate(Display *display, Window parent, register char *def_env)
125 int reverse; /* Reverse video mode. */ 119 int reverse; /* Reverse video mode. */
126 120
127 XMStyle p_style; /* Pane display style. */ 121 XMStyle p_style; /* Pane display style. */
128 char *p_fnt_name; /* Flag font name. */ 122 char const *p_fnt_name; /* Flag font name. */
129 XFontStruct *p_fnt_info; /* Flag font structure */ 123 XFontStruct *p_fnt_info; /* Flag font structure */
130 int p_fnt_pad; /* Flag font padding in pixels. */ 124 int p_fnt_pad; /* Flag font padding in pixels. */
131 double p_spread; /* Pane spread in flag height fractions. */ 125 double p_spread; /* Pane spread in flag height fractions. */
@@ -138,7 +132,7 @@ XMenuCreate(Display *display, Window parent, register char *def_env)
138 GC pane_GC; /* Pane graphics context. */ 132 GC pane_GC; /* Pane graphics context. */
139 133
140 XMStyle s_style; /* Selection display style. */ 134 XMStyle s_style; /* Selection display style. */
141 char *s_fnt_name; /* Selection font name. */ 135 char const *s_fnt_name; /* Selection font name. */
142 XFontStruct *s_fnt_info; /* Selection font structure. */ 136 XFontStruct *s_fnt_info; /* Selection font structure. */
143 int s_fnt_pad; /* Selection font padding in pixels. */ 137 int s_fnt_pad; /* Selection font padding in pixels. */
144 int s_fnt_height; /* Selection font character height */ 138 int s_fnt_height; /* Selection font character height */
@@ -151,10 +145,8 @@ XMenuCreate(Display *display, Window parent, register char *def_env)
151 GC inverse_select_GC; /* GC used for inverse video selection. */ 145 GC inverse_select_GC; /* GC used for inverse video selection. */
152 GC inact_GC; /* GC for inactive pane header and */ 146 GC inact_GC; /* GC for inactive pane header and */
153 /* selections. */ 147 /* selections. */
154 GC inact_GC_noexpose;
155 148
156 XColor color_def; /* Temp color definition holder. */ 149 XColor color_def; /* Temp color definition holder. */
157 XColor screen_def; /* Temp screen color definition holder */
158 XColor p_bdr_color; /* Color of border. */ 150 XColor p_bdr_color; /* Color of border. */
159 XColor s_bdr_color; /* Color of highlight. */ 151 XColor s_bdr_color; /* Color of highlight. */
160 XColor p_frg_color; /* Color of pane foreground color. */ 152 XColor p_frg_color; /* Color of pane foreground color. */
@@ -166,17 +158,6 @@ XMenuCreate(Display *display, Window parent, register char *def_env)
166 158
167 int inact_pnum; /* Inactive background pattern number. */ 159 int inact_pnum; /* Inactive background pattern number. */
168 160
169 Pixel p_bdr_pixel; /* Pane border pixel. */
170 Pixel s_bdr_pixel; /* Selection border pixel. */
171 Pixel p_frg_pixel; /* Pane foreground pixel. */
172 Pixel s_frg_pixel; /* Selection foreground pixel. */
173 Pixel bkgnd_pixel; /* Menu background pixel. */
174
175 int *width, *height;
176 Pixmap *bitmap;
177 int *x_hot, *y_hot;
178 int status; /* Return code from XReadBitmapFile. */
179
180 Pixmap cursor; /* Cursor pixmap holder. */ 161 Pixmap cursor; /* Cursor pixmap holder. */
181 Pixmap cursor_mask; /* Cursor mask pixmap holder. */ 162 Pixmap cursor_mask; /* Cursor mask pixmap holder. */
182 Pixmap stipple_pixmap; /* Stipple mask for half-tone text. */ 163 Pixmap stipple_pixmap; /* Stipple mask for half-tone text. */
@@ -282,7 +263,7 @@ XMenuCreate(Display *display, Window parent, register char *def_env)
282 &mouse_color, &color_def) 263 &mouse_color, &color_def)
283 ); 264 );
284 265
285 else ; 266 else {}
286 267
287 def_val = x_get_resource_string ("menuBackground", "MenuBackground"); 268 def_val = x_get_resource_string ("menuBackground", "MenuBackground");
288 if ( 269 if (
@@ -304,7 +285,7 @@ XMenuCreate(Display *display, Window parent, register char *def_env)
304 "white", 285 "white",
305 &bkgnd_color, &color_def) 286 &bkgnd_color, &color_def)
306 ); 287 );
307 else; 288 else {}
308 289
309 def_val = x_get_resource_string ("menuInactivePattern", "MenuInactivePattern"); 290 def_val = x_get_resource_string ("menuInactivePattern", "MenuInactivePattern");
310 if (def_val != NULL) { 291 if (def_val != NULL) {
@@ -401,7 +382,7 @@ XMenuCreate(Display *display, Window parent, register char *def_env)
401 "black", 382 "black",
402 &s_frg_color, &color_def) 383 &s_frg_color, &color_def)
403 ) ; 384 ) ;
404 else ; 385 else {}
405 386
406 387
407 def_val = x_get_resource_string ("selectionBorder", "SelectionBorder"); 388 def_val = x_get_resource_string ("selectionBorder", "SelectionBorder");
@@ -424,7 +405,7 @@ XMenuCreate(Display *display, Window parent, register char *def_env)
424 "black", 405 "black",
425 &s_bdr_color, &color_def) 406 &s_bdr_color, &color_def)
426 ) ; 407 ) ;
427 else ; 408 else {}
428 409
429 def_val = x_get_resource_string ("selectionBorderWidth", "SelectionBorderWidth"); 410 def_val = x_get_resource_string ("selectionBorderWidth", "SelectionBorderWidth");
430 if (def_val != NULL) s_bdr_width = atoi(def_val); 411 if (def_val != NULL) s_bdr_width = atoi(def_val);
@@ -681,9 +662,6 @@ XMenuCreate(Display *display, Window parent, register char *def_env)
681 662
682 valuemask |= (GCGraphicsExposures); 663 valuemask |= (GCGraphicsExposures);
683 values->graphics_exposures = False; 664 values->graphics_exposures = False;
684 inact_GC_noexpose = XCreateGC (display,
685 root,
686 valuemask, values);
687 665
688 666
689 /* 667 /*
@@ -752,4 +730,3 @@ XMenuCreate(Display *display, Window parent, register char *def_env)
752 _XMErrorCode = XME_NO_ERROR; 730 _XMErrorCode = XME_NO_ERROR;
753 return(menu); 731 return(menu);
754} 732}
755
diff --git a/oldXMenu/Destroy.c b/oldXMenu/Destroy.c
index 6a379609ad0..7f0f6146316 100644
--- a/oldXMenu/Destroy.c
+++ b/oldXMenu/Destroy.c
@@ -15,8 +15,9 @@
15 15
16#include "XMenuInt.h" 16#include "XMenuInt.h"
17 17
18void
18XMenuDestroy(Display *display, register XMenu *menu) 19XMenuDestroy(Display *display, register XMenu *menu)
19 20
20 /* Menu object to destroy. */ 21 /* Menu object to destroy. */
21{ 22{
22 register XMPane *p_ptr; /* Pointer to the current pane. */ 23 register XMPane *p_ptr; /* Pointer to the current pane. */
@@ -114,4 +115,3 @@ XMenuDestroy(Display *display, register XMenu *menu)
114 */ 115 */
115 free(menu); 116 free(menu);
116} 117}
117
diff --git a/oldXMenu/Error.c b/oldXMenu/Error.c
index 99f5eb6500d..01738458b6a 100644
--- a/oldXMenu/Error.c
+++ b/oldXMenu/Error.c
@@ -16,7 +16,7 @@
16 16
17#include "XMenuInt.h" 17#include "XMenuInt.h"
18 18
19char * 19char const *
20XMenuError(void) 20XMenuError(void)
21{ 21{
22 static char message[128]; /* Error message buffer. */ 22 static char message[128]; /* Error message buffer. */
@@ -27,4 +27,3 @@ XMenuError(void)
27 sprintf(message, "Unknown _XMErrorCode: %d", _XMErrorCode); 27 sprintf(message, "Unknown _XMErrorCode: %d", _XMErrorCode);
28 return(message); 28 return(message);
29} 29}
30
diff --git a/oldXMenu/EvHand.c b/oldXMenu/EvHand.c
index 5ee6877374b..bd15359d919 100644
--- a/oldXMenu/EvHand.c
+++ b/oldXMenu/EvHand.c
@@ -15,6 +15,7 @@
15 15
16#include "XMenuInt.h" 16#include "XMenuInt.h"
17 17
18void
18XMenuEventHandler(int (*handler) (XEvent*)) 19XMenuEventHandler(int (*handler) (XEvent*))
19{ 20{
20 /* 21 /*
@@ -22,4 +23,3 @@ XMenuEventHandler(int (*handler) (XEvent*))
22 */ 23 */
23 _XMEventHandler = handler; 24 _XMEventHandler = handler;
24} 25}
25
diff --git a/oldXMenu/FindPane.c b/oldXMenu/FindPane.c
index 022e7619034..8101d009a2f 100644
--- a/oldXMenu/FindPane.c
+++ b/oldXMenu/FindPane.c
@@ -15,6 +15,7 @@
15 */ 15 */
16 16
17#include "XMenuInt.h" 17#include "XMenuInt.h"
18#include <string.h>
18 19
19int 20int
20XMenuFindPane(register XMenu *menu, register char *label) 21XMenuFindPane(register XMenu *menu, register char *label)
@@ -60,4 +61,3 @@ XMenuFindPane(register XMenu *menu, register char *label)
60 _XMErrorCode = XME_P_NOT_FOUND; 61 _XMErrorCode = XME_P_NOT_FOUND;
61 return (XM_FAILURE); 62 return (XM_FAILURE);
62} 63}
63
diff --git a/oldXMenu/FindSel.c b/oldXMenu/FindSel.c
index 72ee142dc80..fbf235c463d 100644
--- a/oldXMenu/FindSel.c
+++ b/oldXMenu/FindSel.c
@@ -31,6 +31,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
31 */ 31 */
32 32
33#include "XMenuInt.h" 33#include "XMenuInt.h"
34#include <string.h>
34 35
35int 36int
36XMenuFindSelection(register XMenu *menu, int p_num, register char *label) 37XMenuFindSelection(register XMenu *menu, int p_num, register char *label)
@@ -83,4 +84,3 @@ XMenuFindSelection(register XMenu *menu, int p_num, register char *label)
83 _XMErrorCode = XME_S_NOT_FOUND; 84 _XMErrorCode = XME_S_NOT_FOUND;
84 return (XM_FAILURE); 85 return (XM_FAILURE);
85} 86}
86
diff --git a/oldXMenu/InsPane.c b/oldXMenu/InsPane.c
index c1993f5bfda..bdbadbf1226 100644
--- a/oldXMenu/InsPane.c
+++ b/oldXMenu/InsPane.c
@@ -26,7 +26,7 @@ XMenuInsertPane(register XMenu *menu, register int p_num, char *label, int activ
26{ 26{
27 register XMPane *p_ptr; /* XMPane pointer. */ 27 register XMPane *p_ptr; /* XMPane pointer. */
28 register XMPane *pane; /* Newly created pane. */ 28 register XMPane *pane; /* Newly created pane. */
29 register XMSelect *select; /* Initial selection for the new pane. */ 29 register XMSelect *sel; /* Initial selection for the new pane. */
30 30
31 int label_length; /* Label length in characters. */ 31 int label_length; /* Label length in characters. */
32 int label_width; /* Label width in pixels. */ 32 int label_width; /* Label width in pixels. */
@@ -54,8 +54,8 @@ XMenuInsertPane(register XMenu *menu, register int p_num, char *label, int activ
54 _XMErrorCode = XME_CALLOC; 54 _XMErrorCode = XME_CALLOC;
55 return(XM_FAILURE); 55 return(XM_FAILURE);
56 } 56 }
57 select = (XMSelect *)calloc(1, sizeof(XMSelect)); 57 sel = (XMSelect *)calloc(1, sizeof(XMSelect));
58 if (select == NULL) { 58 if (sel == NULL) {
59 _XMErrorCode = XME_CALLOC; 59 _XMErrorCode = XME_CALLOC;
60 return(XM_FAILURE); 60 return(XM_FAILURE);
61 } 61 }
@@ -70,11 +70,11 @@ XMenuInsertPane(register XMenu *menu, register int p_num, char *label, int activ
70 * Set up the initial selection. 70 * Set up the initial selection.
71 * Values not explicitly set are zeroed by calloc. 71 * Values not explicitly set are zeroed by calloc.
72 */ 72 */
73 select->next = select; 73 sel->next = sel;
74 select->prev = select; 74 sel->prev = sel;
75 select->type = SL_HEADER; 75 sel->type = SL_HEADER;
76 select->serial = -1; 76 sel->serial = -1;
77 select->parent_p = pane; 77 sel->parent_p = pane;
78 78
79 /* 79 /*
80 * Fill the XMPane structure. 80 * Fill the XMPane structure.
@@ -85,7 +85,7 @@ XMenuInsertPane(register XMenu *menu, register int p_num, char *label, int activ
85 pane->label = label; 85 pane->label = label;
86 pane->label_width = label_width; 86 pane->label_width = label_width;
87 pane->label_length = label_length; 87 pane->label_length = label_length;
88 pane->s_list = select; 88 pane->s_list = sel;
89 89
90 /* 90 /*
91 * Insert the pane after the pane with the pane 91 * Insert the pane after the pane with the pane
@@ -110,4 +110,3 @@ XMenuInsertPane(register XMenu *menu, register int p_num, char *label, int activ
110 _XMErrorCode = XME_NO_ERROR; 110 _XMErrorCode = XME_NO_ERROR;
111 return(p_num); 111 return(p_num);
112} 112}
113
diff --git a/oldXMenu/InsSel.c b/oldXMenu/InsSel.c
index be0e43e0cb9..5db285f6408 100644
--- a/oldXMenu/InsSel.c
+++ b/oldXMenu/InsSel.c
@@ -28,7 +28,7 @@ XMenuInsertSelection(register XMenu *menu, register int p_num, register int s_nu
28 register XMPane *p_ptr; /* XMPane pointer. */ 28 register XMPane *p_ptr; /* XMPane pointer. */
29 register XMSelect *s_ptr; /* XMSelect pointer. */ 29 register XMSelect *s_ptr; /* XMSelect pointer. */
30 30
31 XMSelect *select; /* Newly created selection. */ 31 XMSelect *sel; /* Newly created selection. */
32 32
33 int label_length; /* Label length in characters. */ 33 int label_length; /* Label length in characters. */
34 int label_width; /* Label width in pixels. */ 34 int label_width; /* Label width in pixels. */
@@ -57,8 +57,8 @@ XMenuInsertSelection(register XMenu *menu, register int p_num, register int s_nu
57 /* 57 /*
58 * Calloc the XMSelect structure. 58 * Calloc the XMSelect structure.
59 */ 59 */
60 select = (XMSelect *)calloc(1, sizeof(XMSelect)); 60 sel = (XMSelect *)calloc(1, sizeof(XMSelect));
61 if (select == NULL) { 61 if (sel == NULL) {
62 _XMErrorCode = XME_CALLOC; 62 _XMErrorCode = XME_CALLOC;
63 return(XM_FAILURE); 63 return(XM_FAILURE);
64 } 64 }
@@ -75,28 +75,28 @@ XMenuInsertSelection(register XMenu *menu, register int p_num, register int s_nu
75 */ 75 */
76 if (!strcmp (label, "--") || !strcmp (label, "---")) 76 if (!strcmp (label, "--") || !strcmp (label, "---"))
77 { 77 {
78 select->type = SEPARATOR; 78 sel->type = SEPARATOR;
79 select->active = 0; 79 sel->active = 0;
80 } 80 }
81 else 81 else
82 { 82 {
83 select->type = SELECTION; 83 sel->type = SELECTION;
84 select->active = active; 84 sel->active = active;
85 } 85 }
86 86
87 select->active = active; 87 sel->active = active;
88 select->serial = -1; 88 sel->serial = -1;
89 select->label = label; 89 sel->label = label;
90 select->label_width = label_width; 90 sel->label_width = label_width;
91 select->label_length = label_length; 91 sel->label_length = label_length;
92 select->data = data; 92 sel->data = data;
93 select->parent_p = p_ptr; 93 sel->parent_p = p_ptr;
94 94
95 /* 95 /*
96 * Insert the selection after the selection with the selection 96 * Insert the selection after the selection with the selection
97 * number one less than the desired number for the new selection. 97 * number one less than the desired number for the new selection.
98 */ 98 */
99 emacs_insque(select, s_ptr); 99 emacs_insque(sel, s_ptr);
100 100
101 /* 101 /*
102 * Update the selection count. 102 * Update the selection count.
@@ -114,4 +114,3 @@ XMenuInsertSelection(register XMenu *menu, register int p_num, register int s_nu
114 _XMErrorCode = XME_NO_ERROR; 114 _XMErrorCode = XME_NO_ERROR;
115 return(s_num); 115 return(s_num);
116} 116}
117
diff --git a/oldXMenu/Internal.c b/oldXMenu/Internal.c
index 23b54493e23..102de9d7a56 100644
--- a/oldXMenu/Internal.c
+++ b/oldXMenu/Internal.c
@@ -33,17 +33,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
33#include "XMenuInt.h" 33#include "XMenuInt.h"
34 34
35/* 35/*
36 * Toggle color macro.
37 */
38#define toggle_color(x) \
39 ((x) == menu->bkgnd_color ? menu->s_frg_color : menu->bkgnd_color)
40
41/*
42 * Internal Window creation queue sizes. 36 * Internal Window creation queue sizes.
43 */ 37 */
44#define S_QUE_SIZE 300 38#define S_QUE_SIZE 300
45#define P_QUE_SIZE 20 39#define P_QUE_SIZE 20
46#define BUFFER_SIZE (S_QUE_SIZE >= P_QUE_SIZE ? S_QUE_SIZE : P_QUE_SIZE)
47 40
48 41
49/* 42/*
@@ -71,7 +64,7 @@ int _XMErrorCode = XME_NO_ERROR;
71/* 64/*
72 * _XMErrorList - Global XMenu error code description strings. 65 * _XMErrorList - Global XMenu error code description strings.
73 */ 66 */
74char * 67char const *const
75_XMErrorList[XME_CODE_COUNT] = { 68_XMErrorList[XME_CODE_COUNT] = {
76 "No error", /* XME_NO_ERROR */ 69 "No error", /* XME_NO_ERROR */
77 "Menu not initialized", /* XME_NOT_INIT */ 70 "Menu not initialized", /* XME_NOT_INIT */
@@ -103,6 +96,7 @@ int (*_XMEventHandler)(XEvent*) = NULL;
103 * _XMWinQueInit - Internal routine to initialize the window 96 * _XMWinQueInit - Internal routine to initialize the window
104 * queue. 97 * queue.
105 */ 98 */
99void
106_XMWinQueInit(void) 100_XMWinQueInit(void)
107{ 101{
108 /* 102 /*
@@ -138,7 +132,7 @@ _XMWinQueInit(void)
138 */ 132 */
139int 133int
140_XMWinQueAddPane(register Display *display, register XMenu *menu, register XMPane *p_ptr) 134_XMWinQueAddPane(register Display *display, register XMenu *menu, register XMPane *p_ptr)
141 135
142 /* Menu being manipulated. */ 136 /* Menu being manipulated. */
143 /* XMPane being queued. */ 137 /* XMPane being queued. */
144{ 138{
@@ -172,7 +166,7 @@ _XMWinQueAddPane(register Display *display, register XMenu *menu, register XMPan
172 */ 166 */
173int 167int
174_XMWinQueAddSelection(register Display *display, register XMenu *menu, register XMSelect *s_ptr) 168_XMWinQueAddSelection(register Display *display, register XMenu *menu, register XMSelect *s_ptr)
175 169
176 /* Menu being manipulated. */ 170 /* Menu being manipulated. */
177 /* XMSelection being queued. */ 171 /* XMSelection being queued. */
178{ 172{
@@ -205,8 +199,8 @@ _XMWinQueAddSelection(register Display *display, register XMenu *menu, register
205 * selection window queues. 199 * selection window queues.
206 */ 200 */
207int 201int
208_XMWinQueFlush(register Display *display, register XMenu *menu, register XMPane *pane, XMSelect *select) 202_XMWinQueFlush(register Display *display, register XMenu *menu, register XMPane *pane, XMSelect *sel)
209 203
210 /* Menu being manipulated. */ 204 /* Menu being manipulated. */
211 /* Current pane. */ 205 /* Current pane. */
212{ 206{
@@ -215,7 +209,8 @@ _XMWinQueFlush(register Display *display, register XMenu *menu, register XMPane
215 register XMPane *p_ptr; /* XMPane pointer. */ 209 register XMPane *p_ptr; /* XMPane pointer. */
216 register XMSelect *s_ptr; /* XMSelect pointer. */ 210 register XMSelect *s_ptr; /* XMSelect pointer. */
217 unsigned long valuemask; /* Which attributes to set. */ 211 unsigned long valuemask; /* Which attributes to set. */
218 XSetWindowAttributes *attributes; /* Attributes to be set. */ 212 XSetWindowAttributes attributes_buf; /* Attributes to be set. */
213 XSetWindowAttributes *attributes = &attributes_buf;
219 214
220 /* 215 /*
221 * If the pane window queue is not empty... 216 * If the pane window queue is not empty...
@@ -226,7 +221,6 @@ _XMWinQueFlush(register Display *display, register XMenu *menu, register XMPane
226 * set up attributes for pane window to be created. 221 * set up attributes for pane window to be created.
227 */ 222 */
228 valuemask = (CWBackPixmap | CWBorderPixel | CWOverrideRedirect); 223 valuemask = (CWBackPixmap | CWBorderPixel | CWOverrideRedirect);
229 attributes = (XSetWindowAttributes *)malloc(sizeof(XSetWindowAttributes));
230 attributes->border_pixel = menu->p_bdr_color; 224 attributes->border_pixel = menu->p_bdr_color;
231 attributes->background_pixmap = menu->inact_pixmap; 225 attributes->background_pixmap = menu->inact_pixmap;
232 attributes->override_redirect = True; 226 attributes->override_redirect = True;
@@ -415,6 +409,7 @@ _XMGetSelectionPtr(register XMPane *p_ptr, register int s_num)
415 * _XMRecomputeGlobals - Internal subroutine to recompute menu wide 409 * _XMRecomputeGlobals - Internal subroutine to recompute menu wide
416 * global values. 410 * global values.
417 */ 411 */
412void
418_XMRecomputeGlobals(register Display *display, register XMenu *menu) 413_XMRecomputeGlobals(register Display *display, register XMenu *menu)
419 /*X11 display variable. */ 414 /*X11 display variable. */
420 /* Menu object to compute from. */ 415 /* Menu object to compute from. */
@@ -681,7 +676,7 @@ _XMRecomputePane(register Display *display, register XMenu *menu, register XMPan
681 */ 676 */
682int 677int
683_XMRecomputeSelection(register Display *display, register XMenu *menu, register XMSelect *s_ptr, register int s_num) 678_XMRecomputeSelection(register Display *display, register XMenu *menu, register XMSelect *s_ptr, register int s_num)
684 679
685 /* Menu object being recomputed. */ 680 /* Menu object being recomputed. */
686 /* Selection pointer. */ 681 /* Selection pointer. */
687 /* Selection sequence number. */ 682 /* Selection sequence number. */
@@ -810,6 +805,7 @@ _XMRecomputeSelection(register Display *display, register XMenu *menu, register
810 * recomputed before calling this routine or 805 * recomputed before calling this routine or
811 * unpredictable results will follow. 806 * unpredictable results will follow.
812 */ 807 */
808void
813_XMTransToOrigin(Display *display, register XMenu *menu, register XMPane *p_ptr, register XMSelect *s_ptr, int x_pos, int y_pos, int *orig_x, int *orig_y) 809_XMTransToOrigin(Display *display, register XMenu *menu, register XMPane *p_ptr, register XMSelect *s_ptr, int x_pos, int y_pos, int *orig_x, int *orig_y)
814 /* Not used. Included for consistency. */ 810 /* Not used. Included for consistency. */
815 /* Menu being computed against. */ 811 /* Menu being computed against. */
@@ -870,6 +866,7 @@ _XMTransToOrigin(Display *display, register XMenu *menu, register XMPane *p_ptr,
870 * _XMRefreshPane - Internal subroutine to completely refresh 866 * _XMRefreshPane - Internal subroutine to completely refresh
871 * the contents of a pane. 867 * the contents of a pane.
872 */ 868 */
869void
873_XMRefreshPane(register Display *display, register XMenu *menu, register XMPane *pane) 870_XMRefreshPane(register Display *display, register XMenu *menu, register XMPane *pane)
874{ 871{
875 register XMSelect *s_list = pane->s_list; 872 register XMSelect *s_list = pane->s_list;
@@ -937,34 +934,35 @@ _XMRefreshPane(register Display *display, register XMenu *menu, register XMPane
937 * _XMRefreshSelection - Internal subroutine that refreshes 934 * _XMRefreshSelection - Internal subroutine that refreshes
938 * a single selection window. 935 * a single selection window.
939 */ 936 */
940_XMRefreshSelection(register Display *display, register XMenu *menu, register XMSelect *select) 937void
938_XMRefreshSelection(register Display *display, register XMenu *menu, register XMSelect *sel)
941{ 939{
942 register int width = select->window_w; 940 register int width = sel->window_w;
943 register int height = select->window_h; 941 register int height = sel->window_h;
944 register int bdr_width = menu->s_bdr_width; 942 register int bdr_width = menu->s_bdr_width;
945 943
946 if (select->type == SEPARATOR) { 944 if (sel->type == SEPARATOR) {
947 XDrawLine(display, 945 XDrawLine(display,
948 select->parent_p->window, 946 sel->parent_p->window,
949 menu->normal_select_GC, 947 menu->normal_select_GC,
950 select->window_x, 948 sel->window_x,
951 select->window_y + height / 2, 949 sel->window_y + height / 2,
952 select->window_x + width, 950 sel->window_x + width,
953 select->window_y + height / 2); 951 sel->window_y + height / 2);
954 } 952 }
955 else if (select->activated) { 953 else if (sel->activated) {
956 if (menu->menu_mode == INVERT) { 954 if (menu->menu_mode == INVERT) {
957 XFillRectangle(display, 955 XFillRectangle(display,
958 select->parent_p->window, 956 sel->parent_p->window,
959 menu->normal_select_GC, 957 menu->normal_select_GC,
960 select->window_x, select->window_y, 958 sel->window_x, sel->window_y,
961 width, height); 959 width, height);
962 XDrawString(display, 960 XDrawString(display,
963 select->parent_p->window, 961 sel->parent_p->window,
964 menu->inverse_select_GC, 962 menu->inverse_select_GC,
965 select->label_x, 963 sel->label_x,
966 select->label_y, 964 sel->label_y,
967 select->label, select->label_length); 965 sel->label, sel->label_length);
968 } 966 }
969 else { 967 else {
970 /* 968 /*
@@ -975,42 +973,41 @@ _XMRefreshSelection(register Display *display, register XMenu *menu, register XM
975 */ 973 */
976 974
977 XDrawRectangle(display, 975 XDrawRectangle(display,
978 select->parent_p->window, 976 sel->parent_p->window,
979 menu->normal_select_GC, 977 menu->normal_select_GC,
980 select->window_x + (bdr_width >> 1), 978 sel->window_x + (bdr_width >> 1),
981 select->window_y + (bdr_width >> 1 ), 979 sel->window_y + (bdr_width >> 1 ),
982 width - bdr_width, 980 width - bdr_width,
983 height - bdr_width); 981 height - bdr_width);
984 XDrawString(display, 982 XDrawString(display,
985 select->parent_p->window, 983 sel->parent_p->window,
986 menu->normal_select_GC, 984 menu->normal_select_GC,
987 select->label_x, 985 sel->label_x,
988 select->label_y, 986 sel->label_y,
989 select->label, select->label_length); 987 sel->label, sel->label_length);
990 } 988 }
991 } 989 }
992 else { 990 else {
993 XClearArea(display, 991 XClearArea(display,
994 select->parent_p->window, 992 sel->parent_p->window,
995 select->window_x, select->window_y, 993 sel->window_x, sel->window_y,
996 width, height, 994 width, height,
997 False); 995 False);
998 if (select->active) { 996 if (sel->active) {
999 XDrawString(display, 997 XDrawString(display,
1000 select->parent_p->window, 998 sel->parent_p->window,
1001 menu->normal_select_GC, 999 menu->normal_select_GC,
1002 select->label_x, 1000 sel->label_x,
1003 select->label_y, 1001 sel->label_y,
1004 select->label, select->label_length); 1002 sel->label, sel->label_length);
1005 } 1003 }
1006 else { 1004 else {
1007 XDrawString(display, 1005 XDrawString(display,
1008 select->parent_p->window, 1006 sel->parent_p->window,
1009 menu->inact_GC, 1007 menu->inact_GC,
1010 select->label_x, 1008 sel->label_x,
1011 select->label_y, 1009 sel->label_y,
1012 select->label, select->label_length); 1010 sel->label, sel->label_length);
1013 } 1011 }
1014 } 1012 }
1015} 1013}
1016
diff --git a/oldXMenu/SetAEQ.c b/oldXMenu/SetAEQ.c
index f4d51d24bec..ee2d64b8806 100644
--- a/oldXMenu/SetAEQ.c
+++ b/oldXMenu/SetAEQ.c
@@ -18,6 +18,7 @@
18 18
19#include "XMenuInt.h" 19#include "XMenuInt.h"
20 20
21void
21XMenuSetAEQ(register XMenu *menu, register int aeq) 22XMenuSetAEQ(register XMenu *menu, register int aeq)
22 /* Menu object to be modified. */ 23 /* Menu object to be modified. */
23 /* AEQ mode? */ 24 /* AEQ mode? */
@@ -27,4 +28,3 @@ XMenuSetAEQ(register XMenu *menu, register int aeq)
27 */ 28 */
28 menu->aeq = aeq; 29 menu->aeq = aeq;
29} 30}
30
diff --git a/oldXMenu/SetFrz.c b/oldXMenu/SetFrz.c
index b16c659ed57..c8998eeb66b 100644
--- a/oldXMenu/SetFrz.c
+++ b/oldXMenu/SetFrz.c
@@ -17,6 +17,7 @@
17 17
18#include "XMenuInt.h" 18#include "XMenuInt.h"
19 19
20void
20XMenuSetFreeze(register XMenu *menu, register int freeze) 21XMenuSetFreeze(register XMenu *menu, register int freeze)
21 /* Menu object to be modified. */ 22 /* Menu object to be modified. */
22 /* Freeze mode? */ 23 /* Freeze mode? */
@@ -26,4 +27,3 @@ XMenuSetFreeze(register XMenu *menu, register int freeze)
26 */ 27 */
27 menu->freeze = freeze; 28 menu->freeze = freeze;
28} 29}
29
diff --git a/oldXMenu/X10.h b/oldXMenu/X10.h
index 6b0626f212c..c30632b9d68 100644
--- a/oldXMenu/X10.h
+++ b/oldXMenu/X10.h
@@ -54,7 +54,7 @@ typedef struct _XAssoc {
54 struct _XAssoc *prev; /* Previous obejct in this bucket. */ 54 struct _XAssoc *prev; /* Previous obejct in this bucket. */
55 Display *display; /* Display which owns the id. */ 55 Display *display; /* Display which owns the id. */
56 XID x_id; /* X Window System id. */ 56 XID x_id; /* X Window System id. */
57 char *data; /* Pointer to untyped memory. */ 57 void *data; /* Pointer to untyped memory. */
58} XAssoc; 58} XAssoc;
59 59
60/* 60/*
@@ -75,4 +75,3 @@ XAssocTable *XCreateAssocTable(int size);
75char *XLookUpAssoc(Display *dpy, XAssocTable *table, XID x_id); 75char *XLookUpAssoc(Display *dpy, XAssocTable *table, XID x_id);
76 76
77#endif /* _X10_H_ */ 77#endif /* _X10_H_ */
78
diff --git a/oldXMenu/XDelAssoc.c b/oldXMenu/XDelAssoc.c
index 018c71c3a3e..ec1d09d46ec 100644
--- a/oldXMenu/XDelAssoc.c
+++ b/oldXMenu/XDelAssoc.c
@@ -2,15 +2,7 @@
2 2
3#include "copyright.h" 3#include "copyright.h"
4 4
5 5#include "XMenuInt.h"
6#include <X11/Xlib.h>
7#include "X10.h"
8struct qelem {
9 struct qelem *q_forw;
10 struct qelem *q_back;
11 char q_data[1];
12};
13void emacs_remque(struct qelem*);
14 6
15/* 7/*
16 * XDeleteAssoc - Delete an association in an XAssocTable keyed on 8 * XDeleteAssoc - Delete an association in an XAssocTable keyed on
@@ -56,4 +48,3 @@ XDeleteAssoc(register Display *dpy, register XAssocTable *table, register XID x_
56 /* It is apparently not in the table. */ 48 /* It is apparently not in the table. */
57 return; 49 return;
58} 50}
59
diff --git a/oldXMenu/XDestAssoc.c b/oldXMenu/XDestAssoc.c
index 135b0c2cdaf..94c0454756a 100644
--- a/oldXMenu/XDestAssoc.c
+++ b/oldXMenu/XDestAssoc.c
@@ -2,14 +2,13 @@
2 2
3#include "copyright.h" 3#include "copyright.h"
4 4
5 5#include "XMenuInt.h"
6#include <X11/Xlib.h>
7#include "X10.h"
8 6
9/* 7/*
10 * XDestroyAssocTable - Destroy (free the memory associated with) 8 * XDestroyAssocTable - Destroy (free the memory associated with)
11 * an XAssocTable. 9 * an XAssocTable.
12 */ 10 */
11void
13XDestroyAssocTable(register XAssocTable *table) 12XDestroyAssocTable(register XAssocTable *table)
14{ 13{
15 register int i; 14 register int i;
@@ -35,4 +34,3 @@ XDestroyAssocTable(register XAssocTable *table)
35 /* Free the table. */ 34 /* Free the table. */
36 free((char *)table); 35 free((char *)table);
37} 36}
38
diff --git a/oldXMenu/XMakeAssoc.c b/oldXMenu/XMakeAssoc.c
index 3626eb01f52..143b2641112 100644
--- a/oldXMenu/XMakeAssoc.c
+++ b/oldXMenu/XMakeAssoc.c
@@ -4,22 +4,14 @@
4 4
5 5
6#include <config.h> 6#include <config.h>
7#include <X11/Xlib.h> 7#include "XMenuInt.h"
8#include <X11/Xresource.h> 8#include <X11/Xresource.h>
9#include "X10.h"
10#include <errno.h> 9#include <errno.h>
11 10
12#ifndef NULL 11#ifndef NULL
13#define NULL 0 12#define NULL 0
14#endif 13#endif
15 14
16struct qelem {
17 struct qelem *q_forw;
18 struct qelem *q_back;
19 char q_data[1];
20};
21void emacs_insque (struct qelem *elem, struct qelem *prev);
22
23/* 15/*
24 * XMakeAssoc - Insert data into an XAssocTable keyed on an XId. 16 * XMakeAssoc - Insert data into an XAssocTable keyed on an XId.
25 * Data is inserted into the table only once. Redundant inserts are 17 * Data is inserted into the table only once. Redundant inserts are
@@ -27,7 +19,7 @@ void emacs_insque (struct qelem *elem, struct qelem *prev);
27 * bucket is sorted (lowest XId to highest XId). 19 * bucket is sorted (lowest XId to highest XId).
28 */ 20 */
29void 21void
30XMakeAssoc(register Display *dpy, register XAssocTable *table, register XID x_id, register caddr_t data) 22XMakeAssoc(register Display *dpy, register XAssocTable *table, register XID x_id, register void *data)
31{ 23{
32 int hash; 24 int hash;
33 register XAssoc *bucket; 25 register XAssoc *bucket;
@@ -85,4 +77,3 @@ XMakeAssoc(register Display *dpy, register XAssocTable *table, register XID x_id
85 /* Insert the new entry. */ 77 /* Insert the new entry. */
86 emacs_insque((struct qelem *)new_entry, (struct qelem *)Entry->prev); 78 emacs_insque((struct qelem *)new_entry, (struct qelem *)Entry->prev);
87} 79}
88
diff --git a/oldXMenu/XMenu.h b/oldXMenu/XMenu.h
index b94c6c3cede..bf1e77b5ff7 100644
--- a/oldXMenu/XMenu.h
+++ b/oldXMenu/XMenu.h
@@ -54,7 +54,7 @@
54 * XMenu error code and error list definitions. 54 * XMenu error code and error list definitions.
55 */ 55 */
56extern int _XMErrorCode; 56extern int _XMErrorCode;
57extern char *_XMErrorList[]; 57extern char const *const _XMErrorList[];
58 58
59/* 59/*
60 * Define the XMWindow datatypes. 60 * Define the XMWindow datatypes.
@@ -106,7 +106,7 @@ typedef struct _xmpane {
106 int active; /* Window active? */ 106 int active; /* Window active? */
107 int activated; /* Window activated? */ 107 int activated; /* Window activated? */
108 int serial; /* -- Pane serial number. */ 108 int serial; /* -- Pane serial number. */
109 char *label; /* -- Pane label. */ 109 char const *label; /* -- Pane label. */
110 int label_width; /* -- Pane label width in pixels. */ 110 int label_width; /* -- Pane label width in pixels. */
111 int label_length; /* -- Pane label length in chars. */ 111 int label_length; /* -- Pane label length in chars. */
112 int label_x; /* -- Pane label X offset. */ 112 int label_x; /* -- Pane label X offset. */
@@ -141,7 +141,7 @@ typedef struct _xmselect {
141 struct _xmwindow *pad_l9; /* ---- */ 141 struct _xmwindow *pad_l9; /* ---- */
142 char *data; /* -- Selection data pointer. */ 142 char *data; /* -- Selection data pointer. */
143 struct _xmpane *parent_p; /* -- Selection parent pane structure. */ 143 struct _xmpane *parent_p; /* -- Selection parent pane structure. */
144 char *help_string; /* Help string or null. */ 144 char const *help_string; /* Help string or null. */
145} XMSelect; 145} XMSelect;
146 146
147 147
@@ -240,29 +240,29 @@ typedef void (*Wait_func)(void*);
240/* 240/*
241 * XMenu library routine declarations. 241 * XMenu library routine declarations.
242 */ 242 */
243XMenu *XMenuCreate(Display *display, Window parent, register char *def_env); 243XMenu *XMenuCreate(Display *display, Window parent, char const *def_env);
244int XMenuAddPane(Display *display, register XMenu *menu, register char *label, int active); 244int XMenuAddPane(Display *display, XMenu *menu, char const *label, int active);
245int XMenuAddSelection(Display *display, register XMenu *menu, register int p_num, char *data, char *label, int active, char *help); 245int XMenuAddSelection(Display *display, XMenu *menu, int p_num, char *data, char *label, int active, char const *help);
246int XMenuInsertPane(register XMenu *menu, register int p_num, char *label, int active); 246int XMenuInsertPane(XMenu *menu, int p_num, char *label, int active);
247int XMenuInsertSelection(register XMenu *menu, register int p_num, register int s_num, char *data, char *label, int active); 247int XMenuInsertSelection(XMenu *menu, int p_num, int s_num, char *data, char *label, int active);
248int XMenuFindPane(register XMenu *menu, register char *label); 248int XMenuFindPane(XMenu *menu, char *label);
249int XMenuFindSelection(register XMenu *menu, int p_num, register char *label); 249int XMenuFindSelection(XMenu *menu, int p_num, char *label);
250int XMenuChangePane(register XMenu *menu, register int p_num, char *label); 250int XMenuChangePane(XMenu *menu, int p_num, char *label);
251int XMenuChangeSelection(Display *display, register XMenu *menu, register int p_num, register int s_num, char *data, int data_sw, char *label, int label_sw); 251int XMenuChangeSelection(Display *display, XMenu *menu, int p_num, int s_num, char *data, int data_sw, char *label, int label_sw);
252int XMenuSetPane(register XMenu *menu, register int p_num, register int active); 252int XMenuSetPane(XMenu *menu, int p_num, int active);
253int XMenuSetSelection(register XMenu *menu, register int p_num, register int s_num, int active); 253int XMenuSetSelection(XMenu *menu, int p_num, int s_num, int active);
254int XMenuRecompute(Display *display, register XMenu *menu); 254int XMenuRecompute(Display *display, XMenu *menu);
255int XMenuEventHandler(int (*handler) (XEvent *)); /* No value actually returned. */ 255void XMenuEventHandler(int (*handler) (XEvent *));
256int XMenuLocate(register Display *display, register XMenu *menu, int p_num, int s_num, int x_pos, int y_pos, int *ul_x, int *ul_y, int *width, int *height); 256int XMenuLocate(Display *display, XMenu *menu, int p_num, int s_num, int x_pos, int y_pos, int *ul_x, int *ul_y, int *width, int *height);
257int XMenuSetFreeze(register XMenu *menu, register int freeze); /* No value actually returned. */ 257void XMenuSetFreeze(XMenu *menu, int freeze);
258void XMenuActivateSetWaitFunction(Wait_func func, void *data); 258void XMenuActivateSetWaitFunction(Wait_func func, void *data);
259int XMenuActivate(Display *display, XMenu *menu, int *p_num, int *s_num, int x_pos, int y_pos, unsigned int event_mask, char **data, void (*help_callback) (char *, int, int)); 259int XMenuActivate(Display *display, XMenu *menu, int *p_num, int *s_num, int x_pos, int y_pos, unsigned int event_mask, char **data, void (*help_callback) (char const *, int, int));
260char *XMenuPost(register Display *display, register XMenu *menu, register int *p_num, register int *s_num, register int x_pos, register int y_pos, int event_mask); 260char *XMenuPost(Display *display, XMenu *menu, int *p_num, int *s_num, int x_pos, int y_pos, int event_mask);
261int XMenuDeletePane(register Display *display, register XMenu *menu, register int p_num); 261int XMenuDeletePane(Display *display, XMenu *menu, int p_num);
262int XMenuDeleteSelection(register Display *display, register XMenu *menu, register int p_num, register int s_num); 262int XMenuDeleteSelection(Display *display, XMenu *menu, int p_num, int s_num);
263int XMenuDestroy(Display *display, register XMenu *menu); /* No value actually returned. */ 263void XMenuDestroy(Display *display, XMenu *menu);
264char *XMenuError(void); 264char const *XMenuError(void);
265void XMenuSetAEQ(XMenu *menu, int aeq);
265 266
266#endif 267#endif
267/* Don't add after this point. */ 268/* Don't add after this point. */
268
diff --git a/oldXMenu/XMenuInt.h b/oldXMenu/XMenuInt.h
index c9373460216..721652c9539 100644
--- a/oldXMenu/XMenuInt.h
+++ b/oldXMenu/XMenuInt.h
@@ -46,18 +46,24 @@ extern int (*_XMEventHandler)(XEvent*);
46/* 46/*
47 * Internal routine declarations. 47 * Internal routine declarations.
48 */ 48 */
49int _XMWinQueInit(void); /* No value actually returned. */ 49void _XMWinQueInit(void);
50int _XMWinQueAddPane(register Display *display, register XMenu *menu, register XMPane *p_ptr); 50int _XMWinQueAddPane(Display *display, XMenu *menu, XMPane *p_ptr);
51int _XMWinQueAddSelection(register Display *display, register XMenu *menu, register XMSelect *s_ptr); 51int _XMWinQueAddSelection(Display *display, XMenu *menu, XMSelect *s_ptr);
52int _XMWinQueFlush(register Display *display, register XMenu *menu, register XMPane *pane, XMSelect *select); 52int _XMWinQueFlush(Display *display, XMenu *menu, XMPane *pane, XMSelect *select);
53XMPane *_XMGetPanePtr(register XMenu *menu, register int p_num); 53XMPane *_XMGetPanePtr(XMenu *menu, int p_num);
54XMSelect *_XMGetSelectionPtr(register XMPane *p_ptr, register int s_num); 54XMSelect *_XMGetSelectionPtr(XMPane *p_ptr, int s_num);
55int _XMRecomputeGlobals(register Display *display, register XMenu *menu); /* No value actually returned. */ 55void _XMRecomputeGlobals(Display *display, XMenu *menu);
56int _XMRecomputePane(register Display *display, register XMenu *menu, register XMPane *p_ptr, register int p_num); 56int _XMRecomputePane(Display *display, XMenu *menu, XMPane *p_ptr, int p_num);
57int _XMRecomputeSelection(register Display *display, register XMenu *menu, register XMSelect *s_ptr, register int s_num); 57int _XMRecomputeSelection(Display *display, XMenu *menu, XMSelect *s_ptr, int s_num);
58int _XMTransToOrigin(Display *display, register XMenu *menu, register XMPane *p_ptr, register XMSelect *s_ptr, int x_pos, int y_pos, int *orig_x, int *orig_y); /* No value actually returned. */ 58void _XMTransToOrigin(Display *display, XMenu *menu, XMPane *p_ptr, XMSelect *s_ptr, int x_pos, int y_pos, int *orig_x, int *orig_y);
59int _XMRefreshPane(register Display *display, register XMenu *menu, register XMPane *pane); /* No value actually returned. */ 59void _XMRefreshPane(Display *display, XMenu *menu, XMPane *pane);
60void _XMRefreshSelection(Display *display, XMenu *menu, XMSelect *select);
61void emacs_insque (void *elem, void *prev);
62void emacs_remque (void *elem);
63void XDeleteAssoc(Display *dpy, XAssocTable *table, XID x_id);
64void XDestroyAssocTable(XAssocTable *table);
65void XMakeAssoc(Display *dpy, XAssocTable *table, XID x_id, void *data);
66void XDeleteAssoc(Display *dpy, XAssocTable *table, XID x_id);
60 67
61#endif 68#endif
62/* Don't add stuff after this #endif */ 69/* Don't add stuff after this #endif */
63
diff --git a/oldXMenu/insque.c b/oldXMenu/insque.c
index b324ade1d55..90a8eec4e71 100644
--- a/oldXMenu/insque.c
+++ b/oldXMenu/insque.c
@@ -19,6 +19,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
19 their callers have been renamed to emacs_mumble to allow us to 19 their callers have been renamed to emacs_mumble to allow us to
20 include this file in the menu library on all systems. */ 20 include this file in the menu library on all systems. */
21 21
22#include "XMenuInt.h"
22 23
23struct qelem { 24struct qelem {
24 struct qelem *q_forw; 25 struct qelem *q_forw;
@@ -29,8 +30,10 @@ struct qelem {
29/* Insert ELEM into a doubly-linked list, after PREV. */ 30/* Insert ELEM into a doubly-linked list, after PREV. */
30 31
31void 32void
32emacs_insque (struct qelem *elem, struct qelem *prev) 33emacs_insque (void *velem, void *vprev)
33{ 34{
35 struct qelem *elem = velem;
36 struct qelem *prev = vprev;
34 struct qelem *next = prev->q_forw; 37 struct qelem *next = prev->q_forw;
35 prev->q_forw = elem; 38 prev->q_forw = elem;
36 if (next) 39 if (next)
@@ -41,8 +44,10 @@ emacs_insque (struct qelem *elem, struct qelem *prev)
41 44
42/* Unlink ELEM from the doubly-linked list that it is in. */ 45/* Unlink ELEM from the doubly-linked list that it is in. */
43 46
44emacs_remque (struct qelem *elem) 47void
48emacs_remque (void *velem)
45{ 49{
50 struct qelem *elem = velem;
46 struct qelem *next = elem->q_forw; 51 struct qelem *next = elem->q_forw;
47 struct qelem *prev = elem->q_back; 52 struct qelem *prev = elem->q_back;
48 if (next) 53 if (next)
@@ -50,4 +55,3 @@ emacs_remque (struct qelem *elem)
50 if (prev) 55 if (prev)
51 prev->q_forw = next; 56 prev->q_forw = next;
52} 57}
53
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 *,