aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert2015-01-13 21:19:40 -0800
committerPaul Eggert2015-01-13 21:20:31 -0800
commit3ef29501b029567156440d257c758b99099213fe (patch)
tree32b48cd3c2b4d2e704c23e1e1690ed598b19fb31 /src
parent785adfcc8dee02ac544f80e4f7f8d3d5b2965981 (diff)
downloademacs-3ef29501b029567156440d257c758b99099213fe.tar.gz
emacs-3ef29501b029567156440d257c758b99099213fe.zip
Use bool for boolean in xmenu.c, xml.c
* xmenu.c (x_menu_set_in_use, popup_get_selection) (Fx_menu_bar_open_internal, popup_widget_loop) (x_activate_menubar, xg_crazy_callback_abort) (update_frame_menubar, set_frame_menubar) (initialize_frame_menubar, free_frame_menubar) (create_and_show_popup_menu, x_menu_show) (create_and_show_dialog, x_dialog_show): * xml.c (libxml2_loaded_p, init_libxml2_functions, parse_region) (Flibxml_parse_html_region, Flibxml_parse_xml_region): * xrdb.c (main) [TESTRM]: * xsettings.c (init_gsettings): * xterm.c (XFillRectangle, xg_scroll_callback) (xg_end_scroll_callback): * xterm.h (x_menu_set_in_use) [USE_GTK || USE_MOTIF]: Use bool for boolean. * xmenu.c (TRUE): Remove; no longer used. (show_help_event): Remove long-unused code. (set_frame_menubar): Remove "#if 1" and corresponding "#endif" lines.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog22
-rw-r--r--src/xmenu.c120
-rw-r--r--src/xml.c29
-rw-r--r--src/xrdb.c2
-rw-r--r--src/xsettings.c2
-rw-r--r--src/xterm.c8
-rw-r--r--src/xterm.h2
7 files changed, 92 insertions, 93 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 8d05ec13295..67f48660b1a 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,25 @@
12015-01-14 Paul Eggert <eggert@cs.ucla.edu>
2
3 Use bool for boolean in xmenu.c, xml.c
4 * xmenu.c (x_menu_set_in_use, popup_get_selection)
5 (Fx_menu_bar_open_internal, popup_widget_loop)
6 (x_activate_menubar, xg_crazy_callback_abort)
7 (update_frame_menubar, set_frame_menubar)
8 (initialize_frame_menubar, free_frame_menubar)
9 (create_and_show_popup_menu, x_menu_show)
10 (create_and_show_dialog, x_dialog_show):
11 * xml.c (libxml2_loaded_p, init_libxml2_functions, parse_region)
12 (Flibxml_parse_html_region, Flibxml_parse_xml_region):
13 * xrdb.c (main) [TESTRM]:
14 * xsettings.c (init_gsettings):
15 * xterm.c (XFillRectangle, xg_scroll_callback)
16 (xg_end_scroll_callback):
17 * xterm.h (x_menu_set_in_use) [USE_GTK || USE_MOTIF]:
18 Use bool for boolean.
19 * xmenu.c (TRUE): Remove; no longer used.
20 (show_help_event): Remove long-unused code.
21 (set_frame_menubar): Remove "#if 1" and corresponding "#endif" lines.
22
12015-01-13 Paul Eggert <eggert@cs.ucla.edu> 232015-01-13 Paul Eggert <eggert@cs.ucla.edu>
2 24
3 Don't say Fnext_read_file_uses_dialog_p is const 25 Don't say Fnext_read_file_uses_dialog_p is const
diff --git a/src/xmenu.c b/src/xmenu.c
index fd667a84343..77f0ce5c5c1 100644
--- a/src/xmenu.c
+++ b/src/xmenu.c
@@ -104,10 +104,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
104 104
105#include "menu.h" 105#include "menu.h"
106 106
107#ifndef TRUE
108#define TRUE 1
109#endif /* no TRUE */
110
111 107
112/* Flag which when set indicates a dialog or menu has been posted by 108/* Flag which when set indicates a dialog or menu has been posted by
113 Xt on behalf of one of the widget sets. */ 109 Xt on behalf of one of the widget sets. */
@@ -146,7 +142,7 @@ menubar_id_to_frame (LWLIB_ID id)
146/* Set menu_items_inuse so no other popup menu or dialog is created. */ 142/* Set menu_items_inuse so no other popup menu or dialog is created. */
147 143
148void 144void
149x_menu_set_in_use (int in_use) 145x_menu_set_in_use (bool in_use)
150{ 146{
151 menu_items_inuse = in_use ? Qt : Qnil; 147 menu_items_inuse = in_use ? Qt : Qnil;
152 popup_activated_flag = in_use; 148 popup_activated_flag = in_use;
@@ -222,7 +218,8 @@ x_menu_wait_for_event (void *data)
222 with BLOCK_INPUT, UNBLOCK_INPUT wrappers. */ 218 with BLOCK_INPUT, UNBLOCK_INPUT wrappers. */
223 219
224static void 220static void
225popup_get_selection (XEvent *initial_event, struct x_display_info *dpyinfo, LWLIB_ID id, int do_timers) 221popup_get_selection (XEvent *initial_event, struct x_display_info *dpyinfo,
222 LWLIB_ID id, bool do_timers)
226{ 223{
227 XEvent event; 224 XEvent event;
228 225
@@ -287,13 +284,13 @@ If FRAME is nil or not given, use the selected frame. */)
287 block_input (); 284 block_input ();
288 285
289 if (FRAME_EXTERNAL_MENU_BAR (f)) 286 if (FRAME_EXTERNAL_MENU_BAR (f))
290 set_frame_menubar (f, 0, 1); 287 set_frame_menubar (f, false, true);
291 288
292 menubar = FRAME_X_OUTPUT (f)->menubar_widget; 289 menubar = FRAME_X_OUTPUT (f)->menubar_widget;
293 if (menubar) 290 if (menubar)
294 { 291 {
295 Window child; 292 Window child;
296 bool error_p = 0; 293 bool error_p = false;
297 294
298 x_catch_errors (FRAME_X_DISPLAY (f)); 295 x_catch_errors (FRAME_X_DISPLAY (f));
299 memset (&ev, 0, sizeof ev); 296 memset (&ev, 0, sizeof ev);
@@ -366,7 +363,7 @@ If FRAME is nil or not given, use the selected frame. */)
366 f = decode_window_system_frame (frame); 363 f = decode_window_system_frame (frame);
367 364
368 if (FRAME_EXTERNAL_MENU_BAR (f)) 365 if (FRAME_EXTERNAL_MENU_BAR (f))
369 set_frame_menubar (f, 0, 1); 366 set_frame_menubar (f, false, true);
370 367
371 menubar = FRAME_X_OUTPUT (f)->menubar_widget; 368 menubar = FRAME_X_OUTPUT (f)->menubar_widget;
372 if (menubar) 369 if (menubar)
@@ -390,7 +387,7 @@ If FRAME is nil or not given, use the selected frame. */)
390 Used for popup menus and dialogs. */ 387 Used for popup menus and dialogs. */
391 388
392static void 389static void
393popup_widget_loop (int do_timers, GtkWidget *widget) 390popup_widget_loop (bool do_timers, GtkWidget *widget)
394{ 391{
395 ++popup_activated_flag; 392 ++popup_activated_flag;
396 393
@@ -431,7 +428,7 @@ x_activate_menubar (struct frame *f)
431 return; 428 return;
432#endif 429#endif
433 430
434 set_frame_menubar (f, 0, 1); 431 set_frame_menubar (f, false, true);
435 block_input (); 432 block_input ();
436 popup_activated_flag = 1; 433 popup_activated_flag = 1;
437#ifdef USE_GTK 434#ifdef USE_GTK
@@ -488,24 +485,7 @@ show_help_event (struct frame *f, xt_or_gtk_widget widget, Lisp_Object help)
488 kbd_buffer_store_help_event (frame, help); 485 kbd_buffer_store_help_event (frame, help);
489 } 486 }
490 else 487 else
491 { 488 show_help_echo (help, Qnil, Qnil, Qnil);
492#if 0 /* This code doesn't do anything useful. ++kfs */
493 /* WIDGET is the popup menu. It's parent is the frame's
494 widget. See which frame that is. */
495 xt_or_gtk_widget frame_widget = XtParent (widget);
496 Lisp_Object tail;
497
498 for (tail = Vframe_list; CONSP (tail); tail = XCDR (tail))
499 {
500 frame = XCAR (tail);
501 if (FRAMEP (frame)
502 && (f = XFRAME (frame),
503 FRAME_X_P (f) && f->output_data.x->widget == frame_widget))
504 break;
505 }
506#endif
507 show_help_echo (help, Qnil, Qnil, Qnil);
508 }
509} 489}
510 490
511/* Callback called when menu items are highlighted/unhighlighted 491/* Callback called when menu items are highlighted/unhighlighted
@@ -554,7 +534,7 @@ menu_highlight_callback (Widget widget, LWLIB_ID id, void *call_data)
554 selected in a radio group. If this variable is set to a non-zero 534 selected in a radio group. If this variable is set to a non-zero
555 value, we are creating menus and don't want callbacks right now. 535 value, we are creating menus and don't want callbacks right now.
556*/ 536*/
557static int xg_crazy_callback_abort; 537static bool xg_crazy_callback_abort;
558 538
559/* This callback is called from the menu bar pulldown menu 539/* This callback is called from the menu bar pulldown menu
560 when the user makes a selection. 540 when the user makes a selection.
@@ -656,13 +636,14 @@ update_frame_menubar (struct frame *f)
656 lw_refigure_widget (x->column_widget, True); 636 lw_refigure_widget (x->column_widget, True);
657 637
658 /* Force the pane widget to resize itself. */ 638 /* Force the pane widget to resize itself. */
639 int new_height = -1;
659#ifdef USE_LUCID 640#ifdef USE_LUCID
660 /* For reasons I don't know Lucid wants to add one pixel to the frame 641 /* For reasons I don't know Lucid wants to add one pixel to the frame
661 height when adding the menu bar. Compensate that here. */ 642 height when adding the menu bar. Compensate that here. */
662 adjust_frame_size (f, -1, FRAME_TEXT_HEIGHT (f) - 1, 2, 0, Qmenu_bar_lines); 643 new_height = FRAME_TEXT_HEIGHT (f) - 1;
663#else 644s);
664 adjust_frame_size (f, -1, -1, 2, 0, Qmenu_bar_lines);
665#endif /* USE_LUCID */ 645#endif /* USE_LUCID */
646 adjust_frame_size (f, -1, new_height, 2, false, Qmenu_bar_lines);
666 unblock_input (); 647 unblock_input ();
667#endif /* USE_GTK */ 648#endif /* USE_GTK */
668} 649}
@@ -729,11 +710,11 @@ set_frame_menubar (struct frame *f, bool first_time, bool deep_p)
729#endif 710#endif
730 711
731 if (! menubar_widget) 712 if (! menubar_widget)
732 deep_p = 1; 713 deep_p = true;
733 /* Make the first call for any given frame always go deep. */ 714 /* Make the first call for any given frame always go deep. */
734 else if (!f->output_data.x->saved_menu_event && !deep_p) 715 else if (!f->output_data.x->saved_menu_event && !deep_p)
735 { 716 {
736 deep_p = 1; 717 deep_p = true;
737 f->output_data.x->saved_menu_event = xmalloc (sizeof (XEvent)); 718 f->output_data.x->saved_menu_event = xmalloc (sizeof (XEvent));
738 f->output_data.x->saved_menu_event->type = 0; 719 f->output_data.x->saved_menu_event->type = 0;
739 } 720 }
@@ -840,7 +821,7 @@ set_frame_menubar (struct frame *f, bool first_time, bool deep_p)
840 else 821 else
841 first_wv->contents = wv; 822 first_wv->contents = wv;
842 /* Don't set wv->name here; GC during the loop might relocate it. */ 823 /* Don't set wv->name here; GC during the loop might relocate it. */
843 wv->enabled = 1; 824 wv->enabled = true;
844 wv->button_type = BUTTON_TYPE_NONE; 825 wv->button_type = BUTTON_TYPE_NONE;
845 prev_wv = wv; 826 prev_wv = wv;
846 } 827 }
@@ -931,7 +912,7 @@ set_frame_menubar (struct frame *f, bool first_time, bool deep_p)
931 block_input (); 912 block_input ();
932 913
933#ifdef USE_GTK 914#ifdef USE_GTK
934 xg_crazy_callback_abort = 1; 915 xg_crazy_callback_abort = true;
935 if (menubar_widget) 916 if (menubar_widget)
936 { 917 {
937 /* The fourth arg is DEEP_P, which says to consider the entire 918 /* The fourth arg is DEEP_P, which says to consider the entire
@@ -980,7 +961,7 @@ set_frame_menubar (struct frame *f, bool first_time, bool deep_p)
980 menubar_widget = lw_create_widget ("menubar", "menubar", id, 961 menubar_widget = lw_create_widget ("menubar", "menubar", id,
981 first_wv, 962 first_wv,
982 f->output_data.x->column_widget, 963 f->output_data.x->column_widget,
983 0, 964 false,
984 popup_activate_callback, 965 popup_activate_callback,
985 menubar_selection_callback, 966 menubar_selection_callback,
986 popup_deactivate_callback, 967 popup_deactivate_callback,
@@ -1002,11 +983,11 @@ set_frame_menubar (struct frame *f, bool first_time, bool deep_p)
1002 + f->output_data.x->menubar_widget->core.border_width) 983 + f->output_data.x->menubar_widget->core.border_width)
1003 : 0); 984 : 0);
1004 985
1005#if 1 /* Experimentally, we now get the right results 986#ifdef USE_LUCID
987 /* Experimentally, we now get the right results
1006 for -geometry -0-0 without this. 24 Aug 96, rms. 988 for -geometry -0-0 without this. 24 Aug 96, rms.
1007 Maybe so, but the menu bar size is missing the pixels so the 989 Maybe so, but the menu bar size is missing the pixels so the
1008 WM size hints are off by these pixels. Jan D, oct 2009. */ 990 WM size hints are off by these pixels. Jan D, oct 2009. */
1009#ifdef USE_LUCID
1010 if (FRAME_EXTERNAL_MENU_BAR (f)) 991 if (FRAME_EXTERNAL_MENU_BAR (f))
1011 { 992 {
1012 Dimension ibw = 0; 993 Dimension ibw = 0;
@@ -1015,7 +996,6 @@ set_frame_menubar (struct frame *f, bool first_time, bool deep_p)
1015 menubar_size += ibw; 996 menubar_size += ibw;
1016 } 997 }
1017#endif /* USE_LUCID */ 998#endif /* USE_LUCID */
1018#endif /* 1 */
1019 999
1020 FRAME_MENUBAR_HEIGHT (f) = menubar_size; 1000 FRAME_MENUBAR_HEIGHT (f) = menubar_size;
1021 } 1001 }
@@ -1025,7 +1005,7 @@ set_frame_menubar (struct frame *f, bool first_time, bool deep_p)
1025 update_frame_menubar (f); 1005 update_frame_menubar (f);
1026 1006
1027#ifdef USE_GTK 1007#ifdef USE_GTK
1028 xg_crazy_callback_abort = 0; 1008 xg_crazy_callback_abort = false;
1029#endif 1009#endif
1030 1010
1031 unblock_input (); 1011 unblock_input ();
@@ -1042,7 +1022,7 @@ initialize_frame_menubar (struct frame *f)
1042 /* This function is called before the first chance to redisplay 1022 /* This function is called before the first chance to redisplay
1043 the frame. It has to be, so the frame will have the right size. */ 1023 the frame. It has to be, so the frame will have the right size. */
1044 fset_menu_bar_items (f, menu_bar_items (FRAME_MENU_BAR_ITEMS (f))); 1024 fset_menu_bar_items (f, menu_bar_items (FRAME_MENU_BAR_ITEMS (f)));
1045 set_frame_menubar (f, 1, 1); 1025 set_frame_menubar (f, true, true);
1046} 1026}
1047 1027
1048 1028
@@ -1094,21 +1074,21 @@ free_frame_menubar (struct frame *f)
1094 1074
1095 if (f->output_data.x->widget) 1075 if (f->output_data.x->widget)
1096 { 1076 {
1077 int new_height = -1;
1097#ifdef USE_MOTIF 1078#ifdef USE_MOTIF
1098 XtVaGetValues (f->output_data.x->widget, XtNx, &x1, XtNy, &y1, NULL); 1079 XtVaGetValues (f->output_data.x->widget, XtNx, &x1, XtNy, &y1, NULL);
1099 if (x1 == 0 && y1 == 0) 1080 if (x1 == 0 && y1 == 0)
1100 XtVaSetValues (f->output_data.x->widget, XtNx, x0, XtNy, y0, NULL); 1081 XtVaSetValues (f->output_data.x->widget, XtNx, x0, XtNy, y0, NULL);
1101 if (frame_inhibit_resize (f, 0, Qmenu_bar_lines)) 1082 if (frame_inhibit_resize (f, false, Qmenu_bar_lines))
1102 adjust_frame_size (f, -1, old_height, 1, 0, Qmenu_bar_lines); 1083 new_height = old_height;
1103 else
1104#endif /* USE_MOTIF */ 1084#endif /* USE_MOTIF */
1105 adjust_frame_size (f, -1, -1, 2, 0, Qmenu_bar_lines); 1085 adjust_frame_size (f, -1, new_height, 2, false, Qmenu_bar_lines);
1106 } 1086 }
1107 else 1087 else
1108 { 1088 {
1109#ifdef USE_MOTIF 1089#ifdef USE_MOTIF
1110 if (frame_inhibit_resize (f, 0, Qmenu_bar_lines)) 1090 if (frame_inhibit_resize (f, false, Qmenu_bar_lines))
1111 adjust_frame_size (f, -1, old_height, 1, 0, Qmenu_bar_lines); 1091 adjust_frame_size (f, -1, old_height, 1, false, Qmenu_bar_lines);
1112#endif 1092#endif
1113 } 1093 }
1114 1094
@@ -1218,17 +1198,17 @@ create_and_show_popup_menu (struct frame *f, widget_value *first_wv,
1218#ifdef HAVE_GTK3 1198#ifdef HAVE_GTK3
1219 /* Always use position function for Gtk3. Otherwise menus may become 1199 /* Always use position function for Gtk3. Otherwise menus may become
1220 too small to show anything. */ 1200 too small to show anything. */
1221 use_pos_func = 1; 1201 use_pos_func = true;
1222#endif 1202#endif
1223 1203
1224 eassert (FRAME_X_P (f)); 1204 eassert (FRAME_X_P (f));
1225 1205
1226 xg_crazy_callback_abort = 1; 1206 xg_crazy_callback_abort = true;
1227 menu = xg_create_widget ("popup", first_wv->name, f, first_wv, 1207 menu = xg_create_widget ("popup", first_wv->name, f, first_wv,
1228 G_CALLBACK (popup_selection_callback), 1208 G_CALLBACK (popup_selection_callback),
1229 G_CALLBACK (popup_deactivate_callback), 1209 G_CALLBACK (popup_deactivate_callback),
1230 G_CALLBACK (menu_highlight_callback)); 1210 G_CALLBACK (menu_highlight_callback));
1231 xg_crazy_callback_abort = 0; 1211 xg_crazy_callback_abort = false;
1232 1212
1233 if (use_pos_func) 1213 if (use_pos_func)
1234 { 1214 {
@@ -1269,7 +1249,7 @@ create_and_show_popup_menu (struct frame *f, widget_value *first_wv,
1269 two. show_help_echo uses this to detect popup menus. */ 1249 two. show_help_echo uses this to detect popup menus. */
1270 popup_activated_flag = 1; 1250 popup_activated_flag = 1;
1271 /* Process events that apply to the menu. */ 1251 /* Process events that apply to the menu. */
1272 popup_widget_loop (1, menu); 1252 popup_widget_loop (true, menu);
1273 } 1253 }
1274 1254
1275 unbind_to (specpdl_count, Qnil); 1255 unbind_to (specpdl_count, Qnil);
@@ -1331,14 +1311,14 @@ create_and_show_popup_menu (struct frame *f, widget_value *first_wv,
1331 1311
1332 menu_id = widget_id_tick++; 1312 menu_id = widget_id_tick++;
1333 menu = lw_create_widget ("popup", first_wv->name, menu_id, first_wv, 1313 menu = lw_create_widget ("popup", first_wv->name, menu_id, first_wv,
1334 f->output_data.x->widget, 1, 0, 1314 f->output_data.x->widget, true, 0,
1335 popup_selection_callback, 1315 popup_selection_callback,
1336 popup_deactivate_callback, 1316 popup_deactivate_callback,
1337 menu_highlight_callback); 1317 menu_highlight_callback);
1338 1318
1339 event->type = ButtonPress; 1319 event->type = ButtonPress;
1340 event->serial = 0; 1320 event->serial = 0;
1341 event->send_event = 0; 1321 event->send_event = false;
1342 event->display = FRAME_X_DISPLAY (f); 1322 event->display = FRAME_X_DISPLAY (f);
1343 event->time = CurrentTime; 1323 event->time = CurrentTime;
1344 event->root = FRAME_DISPLAY_INFO (f)->root_window; 1324 event->root = FRAME_DISPLAY_INFO (f)->root_window;
@@ -1374,7 +1354,7 @@ create_and_show_popup_menu (struct frame *f, widget_value *first_wv,
1374 record_unwind_protect_int (pop_down_menu, (int) menu_id); 1354 record_unwind_protect_int (pop_down_menu, (int) menu_id);
1375 1355
1376 /* Process events that apply to the menu. */ 1356 /* Process events that apply to the menu. */
1377 popup_get_selection (0, FRAME_DISPLAY_INFO (f), menu_id, 1); 1357 popup_get_selection (0, FRAME_DISPLAY_INFO (f), menu_id, true);
1378 1358
1379 unbind_to (specpdl_count, Qnil); 1359 unbind_to (specpdl_count, Qnil);
1380 } 1360 }
@@ -1400,8 +1380,6 @@ x_menu_show (struct frame *f, int x, int y, int menuflags,
1400 = alloca (menu_items_used * sizeof *subprefix_stack); 1380 = alloca (menu_items_used * sizeof *subprefix_stack);
1401 int submenu_depth = 0; 1381 int submenu_depth = 0;
1402 1382
1403 int first_pane;
1404
1405 ptrdiff_t specpdl_count = SPECPDL_INDEX (); 1383 ptrdiff_t specpdl_count = SPECPDL_INDEX ();
1406 1384
1407 eassert (FRAME_X_P (f)); 1385 eassert (FRAME_X_P (f));
@@ -1421,7 +1399,7 @@ x_menu_show (struct frame *f, int x, int y, int menuflags,
1421 wv = make_widget_value ("menu", NULL, true, Qnil); 1399 wv = make_widget_value ("menu", NULL, true, Qnil);
1422 wv->button_type = BUTTON_TYPE_NONE; 1400 wv->button_type = BUTTON_TYPE_NONE;
1423 first_wv = wv; 1401 first_wv = wv;
1424 first_pane = 1; 1402 bool first_pane = true;
1425 1403
1426 /* Loop over all panes and items, filling in the tree. */ 1404 /* Loop over all panes and items, filling in the tree. */
1427 i = 0; 1405 i = 0;
@@ -1432,14 +1410,14 @@ x_menu_show (struct frame *f, int x, int y, int menuflags,
1432 submenu_stack[submenu_depth++] = save_wv; 1410 submenu_stack[submenu_depth++] = save_wv;
1433 save_wv = prev_wv; 1411 save_wv = prev_wv;
1434 prev_wv = 0; 1412 prev_wv = 0;
1435 first_pane = 1; 1413 first_pane = true;
1436 i++; 1414 i++;
1437 } 1415 }
1438 else if (EQ (AREF (menu_items, i), Qlambda)) 1416 else if (EQ (AREF (menu_items, i), Qlambda))
1439 { 1417 {
1440 prev_wv = save_wv; 1418 prev_wv = save_wv;
1441 save_wv = submenu_stack[--submenu_depth]; 1419 save_wv = submenu_stack[--submenu_depth];
1442 first_pane = 0; 1420 first_pane = false;
1443 i++; 1421 i++;
1444 } 1422 }
1445 else if (EQ (AREF (menu_items, i), Qt) 1423 else if (EQ (AREF (menu_items, i), Qt)
@@ -1493,7 +1471,7 @@ x_menu_show (struct frame *f, int x, int y, int menuflags,
1493 save_wv = wv; 1471 save_wv = wv;
1494 prev_wv = 0; 1472 prev_wv = 0;
1495 } 1473 }
1496 first_pane = 0; 1474 first_pane = false;
1497 i += MENU_ITEMS_PANE_LENGTH; 1475 i += MENU_ITEMS_PANE_LENGTH;
1498 } 1476 }
1499 else 1477 else
@@ -1688,7 +1666,7 @@ create_and_show_dialog (struct frame *f, widget_value *first_wv)
1688 gtk_widget_show_all (menu); 1666 gtk_widget_show_all (menu);
1689 1667
1690 /* Process events that apply to the menu. */ 1668 /* Process events that apply to the menu. */
1691 popup_widget_loop (1, menu); 1669 popup_widget_loop (true, menu);
1692 1670
1693 unbind_to (specpdl_count, Qnil); 1671 unbind_to (specpdl_count, Qnil);
1694 } 1672 }
@@ -1725,7 +1703,7 @@ create_and_show_dialog (struct frame *f, widget_value *first_wv)
1725 apply_systemfont_to_dialog (f->output_data.x->widget); 1703 apply_systemfont_to_dialog (f->output_data.x->widget);
1726#endif 1704#endif
1727 lw_create_widget (first_wv->name, "dialog", dialog_id, first_wv, 1705 lw_create_widget (first_wv->name, "dialog", dialog_id, first_wv,
1728 f->output_data.x->widget, 1, 0, 1706 f->output_data.x->widget, true, 0,
1729 dialog_selection_callback, 0, 0); 1707 dialog_selection_callback, 0, 0);
1730 lw_modify_all_widgets (dialog_id, first_wv->contents, True); 1708 lw_modify_all_widgets (dialog_id, first_wv->contents, True);
1731 /* Display the dialog box. */ 1709 /* Display the dialog box. */
@@ -1742,7 +1720,7 @@ create_and_show_dialog (struct frame *f, widget_value *first_wv)
1742 1720
1743 record_unwind_protect_int (pop_down_menu, (int) dialog_id); 1721 record_unwind_protect_int (pop_down_menu, (int) dialog_id);
1744 1722
1745 popup_get_selection (0, FRAME_DISPLAY_INFO (f), dialog_id, 1); 1723 popup_get_selection (0, FRAME_DISPLAY_INFO (f), dialog_id, true);
1746 1724
1747 unbind_to (count, Qnil); 1725 unbind_to (count, Qnil);
1748 } 1726 }
@@ -1765,8 +1743,8 @@ x_dialog_show (struct frame *f, Lisp_Object title,
1765 1743
1766 /* Number of elements seen so far, before boundary. */ 1744 /* Number of elements seen so far, before boundary. */
1767 int left_count = 0; 1745 int left_count = 0;
1768 /* 1 means we've seen the boundary between left-hand elts and right-hand. */ 1746 /* Whether we've seen the boundary between left-hand elts and right-hand. */
1769 int boundary_seen = 0; 1747 bool boundary_seen = false;
1770 1748
1771 ptrdiff_t specpdl_count = SPECPDL_INDEX (); 1749 ptrdiff_t specpdl_count = SPECPDL_INDEX ();
1772 1750
@@ -1813,7 +1791,7 @@ x_dialog_show (struct frame *f, Lisp_Object title,
1813 { 1791 {
1814 /* This is the boundary between left-side elts 1792 /* This is the boundary between left-side elts
1815 and right-side elts. Stop incrementing right_count. */ 1793 and right-side elts. Stop incrementing right_count. */
1816 boundary_seen = 1; 1794 boundary_seen = true;
1817 i++; 1795 i++;
1818 continue; 1796 continue;
1819 } 1797 }
@@ -2099,7 +2077,7 @@ x_menu_show (struct frame *f, int x, int y, int menuflags,
2099 if ((menuflags & MENU_KEYMAPS) && !NILP (prefix)) 2077 if ((menuflags & MENU_KEYMAPS) && !NILP (prefix))
2100 pane_string++; 2078 pane_string++;
2101 2079
2102 lpane = XMenuAddPane (FRAME_X_DISPLAY (f), menu, pane_string, TRUE); 2080 lpane = XMenuAddPane (FRAME_X_DISPLAY (f), menu, pane_string, true);
2103 if (lpane == XM_FAILURE) 2081 if (lpane == XM_FAILURE)
2104 { 2082 {
2105 XMenuDestroy (FRAME_X_DISPLAY (f), menu); 2083 XMenuDestroy (FRAME_X_DISPLAY (f), menu);
@@ -2224,8 +2202,8 @@ x_menu_show (struct frame *f, int x, int y, int menuflags,
2224 y += 1.5*height/(maxlines+2); 2202 y += 1.5*height/(maxlines+2);
2225 } 2203 }
2226 2204
2227 XMenuSetAEQ (menu, TRUE); 2205 XMenuSetAEQ (menu, true);
2228 XMenuSetFreeze (menu, TRUE); 2206 XMenuSetFreeze (menu, true);
2229 pane = selidx = 0; 2207 pane = selidx = 0;
2230 2208
2231#ifndef MSDOS 2209#ifndef MSDOS
diff --git a/src/xml.c b/src/xml.c
index 3e64788f822..e32417724ce 100644
--- a/src/xml.c
+++ b/src/xml.c
@@ -43,14 +43,12 @@ DEF_DLL_FN (void, xmlFreeDoc, (xmlDocPtr));
43DEF_DLL_FN (void, xmlCleanupParser, (void)); 43DEF_DLL_FN (void, xmlCleanupParser, (void));
44DEF_DLL_FN (void, xmlCheckVersion, (int)); 44DEF_DLL_FN (void, xmlCheckVersion, (int));
45 45
46static int 46static bool
47libxml2_loaded_p (void) 47libxml2_loaded_p (void)
48{ 48{
49 Lisp_Object found = Fassq (Qlibxml2_dll, Vlibrary_cache); 49 Lisp_Object found = Fassq (Qlibxml2_dll, Vlibrary_cache);
50 50
51 if (CONSP (found)) 51 return CONSP (found) && EQ (XCDR (found), Qt);
52 return EQ (XCDR (found), Qt) ? 1 : 0;
53 return 0;
54} 52}
55 53
56# undef htmlReadMemory 54# undef htmlReadMemory
@@ -81,20 +79,20 @@ load_dll_functions (HMODULE library)
81 79
82#else /* !WINDOWSNT */ 80#else /* !WINDOWSNT */
83 81
84static int 82static bool
85libxml2_loaded_p (void) 83libxml2_loaded_p (void)
86{ 84{
87 return 1; 85 return true;
88} 86}
89 87
90#endif /* !WINDOWSNT */ 88#endif /* !WINDOWSNT */
91 89
92static int 90static bool
93init_libxml2_functions (void) 91init_libxml2_functions (void)
94{ 92{
95#ifdef WINDOWSNT 93#ifdef WINDOWSNT
96 if (libxml2_loaded_p ()) 94 if (libxml2_loaded_p ())
97 return 1; 95 return true;
98 else 96 else
99 { 97 {
100 HMODULE library; 98 HMODULE library;
@@ -102,22 +100,22 @@ init_libxml2_functions (void)
102 if (!(library = w32_delayed_load (Qlibxml2_dll))) 100 if (!(library = w32_delayed_load (Qlibxml2_dll)))
103 { 101 {
104 message1 ("libxml2 library not found"); 102 message1 ("libxml2 library not found");
105 return 0; 103 return false;
106 } 104 }
107 105
108 if (! load_dll_functions (library)) 106 if (! load_dll_functions (library))
109 goto bad_library; 107 goto bad_library;
110 108
111 Vlibrary_cache = Fcons (Fcons (Qlibxml2_dll, Qt), Vlibrary_cache); 109 Vlibrary_cache = Fcons (Fcons (Qlibxml2_dll, Qt), Vlibrary_cache);
112 return 1; 110 return true;
113 } 111 }
114 112
115 bad_library: 113 bad_library:
116 Vlibrary_cache = Fcons (Fcons (Qlibxml2_dll, Qnil), Vlibrary_cache); 114 Vlibrary_cache = Fcons (Fcons (Qlibxml2_dll, Qnil), Vlibrary_cache);
117 115
118 return 0; 116 return false;
119#else /* !WINDOWSNT */ 117#else /* !WINDOWSNT */
120 return 1; 118 return true;
121#endif /* !WINDOWSNT */ 119#endif /* !WINDOWSNT */
122} 120}
123 121
@@ -177,7 +175,8 @@ make_dom (xmlNode *node)
177} 175}
178 176
179static Lisp_Object 177static Lisp_Object
180parse_region (Lisp_Object start, Lisp_Object end, Lisp_Object base_url, Lisp_Object discard_comments, int htmlp) 178parse_region (Lisp_Object start, Lisp_Object end, Lisp_Object base_url,
179 Lisp_Object discard_comments, bool htmlp)
181{ 180{
182 xmlDoc *doc; 181 xmlDoc *doc;
183 Lisp_Object result = Qnil; 182 Lisp_Object result = Qnil;
@@ -263,7 +262,7 @@ If DISCARD-COMMENTS is non-nil, all HTML comments are discarded. */)
263 (Lisp_Object start, Lisp_Object end, Lisp_Object base_url, Lisp_Object discard_comments) 262 (Lisp_Object start, Lisp_Object end, Lisp_Object base_url, Lisp_Object discard_comments)
264{ 263{
265 if (init_libxml2_functions ()) 264 if (init_libxml2_functions ())
266 return parse_region (start, end, base_url, discard_comments, 1); 265 return parse_region (start, end, base_url, discard_comments, true);
267 return Qnil; 266 return Qnil;
268} 267}
269 268
@@ -276,7 +275,7 @@ If DISCARD-COMMENTS is non-nil, all HTML comments are discarded. */)
276 (Lisp_Object start, Lisp_Object end, Lisp_Object base_url, Lisp_Object discard_comments) 275 (Lisp_Object start, Lisp_Object end, Lisp_Object base_url, Lisp_Object discard_comments)
277{ 276{
278 if (init_libxml2_functions ()) 277 if (init_libxml2_functions ())
279 return parse_region (start, end, base_url, discard_comments, 0); 278 return parse_region (start, end, base_url, discard_comments, false);
280 return Qnil; 279 return Qnil;
281} 280}
282 281
diff --git a/src/xrdb.c b/src/xrdb.c
index f1176daa5ee..9e85e5a6277 100644
--- a/src/xrdb.c
+++ b/src/xrdb.c
@@ -667,7 +667,7 @@ main (int argc, char **argv)
667 /* In a real program, you'd want to also do this: */ 667 /* In a real program, you'd want to also do this: */
668 display->db = xdb; 668 display->db = xdb;
669 669
670 while (1) 670 while (true)
671 { 671 {
672 char query_name[90]; 672 char query_name[90];
673 char query_class[90]; 673 char query_class[90];
diff --git a/src/xsettings.c b/src/xsettings.c
index 8dbc7d990fe..028487b91ee 100644
--- a/src/xsettings.c
+++ b/src/xsettings.c
@@ -804,7 +804,7 @@ init_gsettings (void)
804 GSettingsSchema *sc = g_settings_schema_source_lookup 804 GSettingsSchema *sc = g_settings_schema_source_lookup
805 (g_settings_schema_source_get_default (), 805 (g_settings_schema_source_get_default (),
806 GSETTINGS_SCHEMA, 806 GSETTINGS_SCHEMA,
807 TRUE); 807 true);
808 schema_found = sc != NULL; 808 schema_found = sc != NULL;
809 if (sc) g_settings_schema_unref (sc); 809 if (sc) g_settings_schema_unref (sc);
810 } 810 }
diff --git a/src/xterm.c b/src/xterm.c
index 05d04c8cc65..3955d027a52 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -3041,7 +3041,7 @@ XTflash (struct frame *f)
3041 gc = gdk_gc_new_with_values (window, 3041 gc = gdk_gc_new_with_values (window,
3042 &vals, GDK_GC_FUNCTION | GDK_GC_FOREGROUND); 3042 &vals, GDK_GC_FUNCTION | GDK_GC_FOREGROUND);
3043#define XFillRectangle(d, win, gc, x, y, w, h) \ 3043#define XFillRectangle(d, win, gc, x, y, w, h) \
3044 gdk_draw_rectangle (window, gc, TRUE, x, y, w, h) 3044 gdk_draw_rectangle (window, gc, true, x, y, w, h)
3045#endif /* ! HAVE_GTK3 */ 3045#endif /* ! HAVE_GTK3 */
3046#else /* ! USE_GTK */ 3046#else /* ! USE_GTK */
3047 GC gc; 3047 GC gc;
@@ -4594,7 +4594,7 @@ xg_scroll_callback (GtkRange *range,
4594 GtkAdjustment *adj = GTK_ADJUSTMENT (gtk_range_get_adjustment (range)); 4594 GtkAdjustment *adj = GTK_ADJUSTMENT (gtk_range_get_adjustment (range));
4595 struct frame *f = g_object_get_data (G_OBJECT (range), XG_FRAME_DATA); 4595 struct frame *f = g_object_get_data (G_OBJECT (range), XG_FRAME_DATA);
4596 4596
4597 if (xg_ignore_gtk_scrollbar) return FALSE; 4597 if (xg_ignore_gtk_scrollbar) return false;
4598 4598
4599 switch (scroll) 4599 switch (scroll)
4600 { 4600 {
@@ -4650,7 +4650,7 @@ xg_scroll_callback (GtkRange *range,
4650 bar->horizontal); 4650 bar->horizontal);
4651 } 4651 }
4652 4652
4653 return FALSE; 4653 return false;
4654} 4654}
4655 4655
4656/* Callback for button release. Sets dragging to -1 when dragging is done. */ 4656/* Callback for button release. Sets dragging to -1 when dragging is done. */
@@ -4669,7 +4669,7 @@ xg_end_scroll_callback (GtkWidget *widget,
4669 window_being_scrolled = Qnil; 4669 window_being_scrolled = Qnil;
4670 } 4670 }
4671 4671
4672 return FALSE; 4672 return false;
4673} 4673}
4674 4674
4675 4675
diff --git a/src/xterm.h b/src/xterm.h
index f2aff72e3ac..123f31cda7b 100644
--- a/src/xterm.h
+++ b/src/xterm.h
@@ -1099,7 +1099,7 @@ extern Lisp_Object xw_popup_dialog (struct frame *, Lisp_Object, Lisp_Object);
1099#endif 1099#endif
1100 1100
1101#if defined USE_GTK || defined USE_MOTIF 1101#if defined USE_GTK || defined USE_MOTIF
1102extern void x_menu_set_in_use (int); 1102extern void x_menu_set_in_use (bool);
1103#endif 1103#endif
1104extern void x_menu_wait_for_event (void *data); 1104extern void x_menu_wait_for_event (void *data);
1105extern void initialize_frame_menubar (struct frame *); 1105extern void initialize_frame_menubar (struct frame *);