aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorStephen Leake2014-12-24 07:42:40 -0600
committerStephen Leake2014-12-24 07:42:40 -0600
commitf3be0025481f15717198befe557208614e513e92 (patch)
treec514ddea4da4b688c92d12f557f471c4edd1e990 /src
parentb4161ac70e4206cc00263e0c1f765b4cf95dfd33 (diff)
parent882370eaa4f7ad6a88396dfdc64f896c727f87f4 (diff)
downloademacs-f3be0025481f15717198befe557208614e513e92.tar.gz
emacs-f3be0025481f15717198befe557208614e513e92.zip
resolve ChangeLog merge conflict
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog78
-rw-r--r--src/buffer.c5
-rw-r--r--src/charset.c7
-rw-r--r--src/charset.h3
-rw-r--r--src/composite.h2
-rw-r--r--src/conf_post.h4
-rw-r--r--src/fontset.c7
-rw-r--r--src/frame.h4
-rw-r--r--src/nsselect.m3
-rw-r--r--src/nsterm.m8
-rw-r--r--src/termhooks.h8
-rw-r--r--src/unexaix.c27
-rw-r--r--src/unexcoff.c27
-rw-r--r--src/unexelf.c12
-rw-r--r--src/unexmacosx.c2
-rw-r--r--src/w32term.c11
-rw-r--r--src/w32term.h4
-rw-r--r--src/xterm.c532
-rw-r--r--src/xterm.h4
19 files changed, 394 insertions, 354 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 5bab023fd86..b90471e8dea 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,80 @@
12014-12-23 Didier Verna <didier@didierverna.net> (tiny change).
2
3 * nsselect.m (Fns_selection_owner_p): Return a Lisp boolean, not a
4 C one (Bug#19396).
5
62014-12-22 Jan Djärv <jan.h.d@swipnet.se>
7
8 * xterm.c (x_bitmap_icon): Partly revert change from 2014-03-21 which
9 breaks icon setting for Gtk+ except for initial frame (Bug#19403).
10
112014-12-22 Paul Eggert <eggert@cs.ucla.edu>
12
13 Use bool for boolean in xterm.c
14 * frame.h, nsterm.m, w32term.c, w32term.h, xterm.c:
15 (x_set_window_size, x_bitmap_icon):
16 * nsterm.m (ns_frame_raise_lower, x_new_font):
17 * termhooks.h (struct terminal.toggle_invisible_pointer_hook)
18 (struct terminal.frame_raise_lower_hook):
19 * w32term.c (w32_frame_raise_lower):
20 * xterm.c, xterm.h (x_text_icon):
21 * xterm.c (x_update_window_begin, x_update_window_end)
22 (x_update_end, x_after_update_window_line)
23 (x_set_glyph_string_gc, x_draw_glyph_string_background)
24 (x_draw_glyph_string_foreground)
25 (x_draw_composite_glyph_string_foreground)
26 (x_alloc_lighter_color, x_draw_relief_rect)
27 (x_draw_glyph_string_box, x_draw_image_relief)
28 (x_draw_image_glyph_string, x_draw_stretch_glyph_string)
29 (x_draw_underwave, x_draw_glyph_string, x_show_hourglass)
30 (x_hide_hourglass):
31 (XFillRectangle) [HAVE_GTK3]:
32 (XTtoggle_invisible_pointer, frame_highlight, frame_unhighlight)
33 (x_focus_changed, x_find_modifier_meanings, note_mouse_movement)
34 (XTmouse_position, xt_action_hook, xt_horizontal_action_hook)
35 (x_send_scroll_bar_event, xm_scroll_callback)
36 (xg_scroll_callback, xaw_jump_callback, xaw_scroll_callback)
37 (x_create_toolkit_scroll_bar)
38 (x_create_horizontal_toolkit_scroll_bar)
39 (x_set_toolkit_horizontal_scroll_bar_thumb, x_scroll_bar_create)
40 (x_scroll_bar_set_handle, XTset_vertical_scroll_bar)
41 (XTset_horizontal_scroll_bar, x_scroll_bar_expose)
42 (x_scroll_bar_handle_click, x_scroll_bar_note_movement)
43 (x_scroll_bar_report_motion)
44 (x_horizontal_scroll_bar_report_motion, x_net_wm_state)
45 (handle_one_xevent, XTread_socket, x_draw_bar_cursor)
46 (x_draw_window_cursor, x_clear_errors)
47 (x_trace_wire, x_new_font, x_set_offset, wm_supports)
48 (set_wm_state, x_set_sticky, get_current_wm_state)
49 (do_ewmh_fullscreen, x_handle_net_wm_state)
50 (x_check_expected_move, x_sync_with_move, x_wait_for_event)
51 (x_set_window_size_1, XTframe_raise_lower)
52 (x_make_frame_visible, x_iconify_frame)
53 (x_timeout_atimer_activated_flag, same_x_server, x_display_ok)
54 (x_term_init, x_process_timeouts, x_activate_timeout_atimer)
55 (x_delete_terminal, x_initialize, syms_of_xterm):
56 Use bool for boolean.
57
582014-12-20 Paul Eggert <eggert@cs.ucla.edu>
59
60 * composite.h (struct composition.width): Now int
61 instead of unsigned short, as we prefer signed integers.
62
63 Let charset tick grow past USHRT_MAX
64 * charset.c, charset.h (charset_ordered_list_tick):
65 Now EMACS_UINT, not unsigned short.
66 * fontset.c (reorder_font_vector): Allow the tick to grow to the
67 maximum representable Emacs integer value before wrapping it around.
68
69 Simplify unexec file mode setting
70 * unexaix.c, unexcoff.c, unexelf.c, unexmacosx.c:
71 Don't include <sys/stat.h> when no longer needed.
72 (unexec): Create file with correct mode in the first place,
73 rather than overwriting the mode later and fiddling with the
74 global umask in the mean time. Avoid bogus usage like
75 'umask (777)', which should have been 'umask (0777)'.
76 (mark_x): Remove. All callers removed.
77
12014-12-19 Paul Eggert <eggert@cs.ucla.edu> 782014-12-19 Paul Eggert <eggert@cs.ucla.edu>
2 79
3 Minor cleanups for Lisp objects and symbols 80 Minor cleanups for Lisp objects and symbols
@@ -14,6 +91,7 @@
14 * nsmenu.m (syms_of_nsmenu): 91 * nsmenu.m (syms_of_nsmenu):
15 * nsselect.m (syms_of_nsselect): 92 * nsselect.m (syms_of_nsselect):
16 Prefer DEFSYM to defining by hand. 93 Prefer DEFSYM to defining by hand.
94 * buffer.c (syms_of_buffer): Omit unneeded staticpros.
17 * data.c: Fix too-long line. 95 * data.c: Fix too-long line.
18 * lisp.h (DECLARE_GDB_SYM): New macro. 96 * lisp.h (DECLARE_GDB_SYM): New macro.
19 (DEFINE_GDB_SYMBOL_BEGIN): Use it. 97 (DEFINE_GDB_SYMBOL_BEGIN): Use it.
diff --git a/src/buffer.c b/src/buffer.c
index ba3245fa5ad..b57d968e73a 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -5395,13 +5395,8 @@ syms_of_buffer (void)
5395 last_overlay_modification_hooks 5395 last_overlay_modification_hooks
5396 = Fmake_vector (make_number (10), Qnil); 5396 = Fmake_vector (make_number (10), Qnil);
5397 5397
5398 staticpro (&Qfundamental_mode);
5399 staticpro (&Qmode_class);
5400 staticpro (&QSFundamental); 5398 staticpro (&QSFundamental);
5401 staticpro (&Vbuffer_alist); 5399 staticpro (&Vbuffer_alist);
5402 staticpro (&Qprotected_field);
5403 staticpro (&Qpermanent_local);
5404 staticpro (&Qkill_buffer_hook);
5405 5400
5406 DEFSYM (Qchoice, "choice"); 5401 DEFSYM (Qchoice, "choice");
5407 DEFSYM (Qleft, "left"); 5402 DEFSYM (Qleft, "left");
diff --git a/src/charset.c b/src/charset.c
index 171a00f23d1..7fcb1534bc2 100644
--- a/src/charset.c
+++ b/src/charset.c
@@ -101,10 +101,9 @@ Lisp_Object Vcharset_ordered_list;
101 charsets. */ 101 charsets. */
102Lisp_Object Vcharset_non_preferred_head; 102Lisp_Object Vcharset_non_preferred_head;
103 103
104/* Incremented everytime we change Vcharset_ordered_list. This is 104/* Incremented every time we change the priority of charsets.
105 unsigned short so that it fits in Lisp_Int and never matches 105 Wraps around. */
106 -1. */ 106EMACS_UINT charset_ordered_list_tick;
107unsigned short charset_ordered_list_tick;
108 107
109/* List of iso-2022 charsets. */ 108/* List of iso-2022 charsets. */
110Lisp_Object Viso_2022_charset_list; 109Lisp_Object Viso_2022_charset_list;
diff --git a/src/charset.h b/src/charset.h
index 4176ce5ecc6..6c6c3e6479f 100644
--- a/src/charset.h
+++ b/src/charset.h
@@ -253,8 +253,7 @@ extern struct charset *charset_table;
253extern Lisp_Object Vcharset_ordered_list; 253extern Lisp_Object Vcharset_ordered_list;
254extern Lisp_Object Vcharset_non_preferred_head; 254extern Lisp_Object Vcharset_non_preferred_head;
255 255
256/* Incremented everytime we change the priority of charsets. */ 256extern EMACS_UINT charset_ordered_list_tick;
257extern unsigned short charset_ordered_list_tick;
258 257
259extern Lisp_Object Viso_2022_charset_list; 258extern Lisp_Object Viso_2022_charset_list;
260extern Lisp_Object Vemacs_mule_charset_list; 259extern Lisp_Object Vemacs_mule_charset_list;
diff --git a/src/composite.h b/src/composite.h
index f01ae323c0d..1080eb0960c 100644
--- a/src/composite.h
+++ b/src/composite.h
@@ -156,7 +156,7 @@ struct composition {
156 /* How many columns the overall glyphs occupy on the screen. This 156 /* How many columns the overall glyphs occupy on the screen. This
157 gives an approximate value for column calculation in 157 gives an approximate value for column calculation in
158 Fcurrent_column, and etc. */ 158 Fcurrent_column, and etc. */
159 unsigned short width; 159 int width;
160 160
161 /* Method of the composition. */ 161 /* Method of the composition. */
162 enum composition_method method; 162 enum composition_method method;
diff --git a/src/conf_post.h b/src/conf_post.h
index 8667e2554cd..90f4c6e8382 100644
--- a/src/conf_post.h
+++ b/src/conf_post.h
@@ -309,8 +309,8 @@ extern void _DebPrint (const char *fmt, ...);
309 Other .c files should not define INLINE. 309 Other .c files should not define INLINE.
310 310
311 C99 compilers compile functions like 'incr' as C99-style extern 311 C99 compilers compile functions like 'incr' as C99-style extern
312 inline functions. Pre-C99 GCCs do something similar with 312 inline functions. Buggy GCC implementations do something similar with
313 GNU-specific keywords. Pre-C99 non-GCC compilers use static 313 GNU-specific keywords. Buggy non-GCC compilers use static
314 functions, which bloats the code but is good enough. */ 314 functions, which bloats the code but is good enough. */
315 315
316#ifndef INLINE 316#ifndef INLINE
diff --git a/src/fontset.c b/src/fontset.c
index d08d68fa28d..ac50be1c925 100644
--- a/src/fontset.c
+++ b/src/fontset.c
@@ -389,7 +389,7 @@ reorder_font_vector (Lisp_Object font_group, struct font *font)
389 Lisp_Object vec, font_object; 389 Lisp_Object vec, font_object;
390 int size; 390 int size;
391 int i; 391 int i;
392 bool score_changed = 0; 392 bool score_changed = false;
393 393
394 if (font) 394 if (font)
395 XSETFONT (font_object, font); 395 XSETFONT (font_object, font);
@@ -444,14 +444,15 @@ reorder_font_vector (Lisp_Object font_group, struct font *font)
444 if (RFONT_DEF_SCORE (rfont_def) != score) 444 if (RFONT_DEF_SCORE (rfont_def) != score)
445 { 445 {
446 RFONT_DEF_SET_SCORE (rfont_def, score); 446 RFONT_DEF_SET_SCORE (rfont_def, score);
447 score_changed = 1; 447 score_changed = true;
448 } 448 }
449 } 449 }
450 450
451 if (score_changed) 451 if (score_changed)
452 qsort (XVECTOR (vec)->contents, size, word_size, 452 qsort (XVECTOR (vec)->contents, size, word_size,
453 fontset_compare_rfontdef); 453 fontset_compare_rfontdef);
454 XSETCAR (font_group, make_number (charset_ordered_list_tick)); 454 EMACS_INT low_tick_bits = charset_ordered_list_tick & MOST_POSITIVE_FIXNUM;
455 XSETCAR (font_group, make_number (low_tick_bits));
455} 456}
456 457
457/* Return a font-group (actually a cons (-1 . FONT-GROUP-VECTOR)) for 458/* Return a font-group (actually a cons (-1 . FONT-GROUP-VECTOR)) for
diff --git a/src/frame.h b/src/frame.h
index 3fd1a6abc20..1aa88042ad3 100644
--- a/src/frame.h
+++ b/src/frame.h
@@ -1435,7 +1435,7 @@ extern Lisp_Object display_x_get_resource (Display_Info *,
1435 Lisp_Object subclass); 1435 Lisp_Object subclass);
1436 1436
1437extern void set_frame_menubar (struct frame *f, bool first_time, bool deep_p); 1437extern void set_frame_menubar (struct frame *f, bool first_time, bool deep_p);
1438extern void x_set_window_size (struct frame *f, int change_grav, 1438extern void x_set_window_size (struct frame *f, bool change_gravity,
1439 int width, int height, bool pixelwise); 1439 int width, int height, bool pixelwise);
1440extern Lisp_Object x_get_focus_frame (struct frame *); 1440extern Lisp_Object x_get_focus_frame (struct frame *);
1441extern void frame_set_mouse_pixel_position (struct frame *f, int pix_x, int pix_y); 1441extern void frame_set_mouse_pixel_position (struct frame *f, int pix_x, int pix_y);
@@ -1462,7 +1462,7 @@ extern void x_focus_frame (struct frame *);
1462 1462
1463#ifndef HAVE_NS 1463#ifndef HAVE_NS
1464 1464
1465extern int x_bitmap_icon (struct frame *, Lisp_Object); 1465extern bool x_bitmap_icon (struct frame *, Lisp_Object);
1466 1466
1467/* Set F's bitmap icon, if specified among F's parameters. */ 1467/* Set F's bitmap icon, if specified among F's parameters. */
1468 1468
diff --git a/src/nsselect.m b/src/nsselect.m
index 3b33a97ca73..8863bd27f16 100644
--- a/src/nsselect.m
+++ b/src/nsselect.m
@@ -438,7 +438,8 @@ On Nextstep, TERMINAL is unused. */)
438 if (EQ (selection, Qnil)) selection = QPRIMARY; 438 if (EQ (selection, Qnil)) selection = QPRIMARY;
439 if (EQ (selection, Qt)) selection = QSECONDARY; 439 if (EQ (selection, Qt)) selection = QSECONDARY;
440 return ns_get_pb_change_count (selection) 440 return ns_get_pb_change_count (selection)
441 == ns_get_our_change_count_for (selection); 441 == ns_get_our_change_count_for (selection)
442 ? Qt : Qnil;
442} 443}
443 444
444 445
diff --git a/src/nsterm.m b/src/nsterm.m
index f012528b40d..7f4b8b2608a 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -1082,7 +1082,7 @@ ns_lower_frame (struct frame *f)
1082 1082
1083 1083
1084static void 1084static void
1085ns_frame_raise_lower (struct frame *f, int raise) 1085ns_frame_raise_lower (struct frame *f, bool raise)
1086/* -------------------------------------------------------------------------- 1086/* --------------------------------------------------------------------------
1087 External (hook) 1087 External (hook)
1088 -------------------------------------------------------------------------- */ 1088 -------------------------------------------------------------------------- */
@@ -1322,7 +1322,7 @@ x_set_offset (struct frame *f, int xoff, int yoff, int change_grav)
1322 1322
1323void 1323void
1324x_set_window_size (struct frame *f, 1324x_set_window_size (struct frame *f,
1325 int change_grav, 1325 bool change_gravity,
1326 int width, 1326 int width,
1327 int height, 1327 int height,
1328 bool pixelwise) 1328 bool pixelwise)
@@ -7622,8 +7622,8 @@ x_new_font (struct frame *f, Lisp_Object font_object, int fontset)
7622 7622
7623 /* Now make the frame display the given font. */ 7623 /* Now make the frame display the given font. */
7624 if (FRAME_NS_WINDOW (f) != 0 && ! [view isFullscreen]) 7624 if (FRAME_NS_WINDOW (f) != 0 && ! [view isFullscreen])
7625 x_set_window_size (f, 0, FRAME_COLS (f) * FRAME_COLUMN_WIDTH (f), 7625 x_set_window_size (f, false, FRAME_COLS (f) * FRAME_COLUMN_WIDTH (f),
7626 FRAME_LINES (f) * FRAME_LINE_HEIGHT (f), 1); 7626 FRAME_LINES (f) * FRAME_LINE_HEIGHT (f), true);
7627 7627
7628 return font_object; 7628 return font_object;
7629} 7629}
diff --git a/src/termhooks.h b/src/termhooks.h
index 9cab853ed3d..137e77ac2ef 100644
--- a/src/termhooks.h
+++ b/src/termhooks.h
@@ -451,7 +451,7 @@ struct terminal
451 void (*delete_glyphs_hook) (struct frame *, int); 451 void (*delete_glyphs_hook) (struct frame *, int);
452 452
453 void (*ring_bell_hook) (struct frame *f); 453 void (*ring_bell_hook) (struct frame *f);
454 void (*toggle_invisible_pointer_hook) (struct frame *f, int invisible); 454 void (*toggle_invisible_pointer_hook) (struct frame *f, bool invisible);
455 455
456 void (*reset_terminal_modes_hook) (struct terminal *); 456 void (*reset_terminal_modes_hook) (struct terminal *);
457 void (*set_terminal_modes_hook) (struct terminal *); 457 void (*set_terminal_modes_hook) (struct terminal *);
@@ -496,10 +496,10 @@ struct terminal
496 support overlapping frames, so there's no need to raise or lower 496 support overlapping frames, so there's no need to raise or lower
497 anything. 497 anything.
498 498
499 If RAISE_FLAG is non-zero, F is brought to the front, before all other 499 If RAISE_FLAG, F is brought to the front, before all other
500 windows. If RAISE_FLAG is zero, F is sent to the back, behind all other 500 windows. If !RAISE_FLAG, F is sent to the back, behind all other
501 windows. */ 501 windows. */
502 void (*frame_raise_lower_hook) (struct frame *f, int raise_flag); 502 void (*frame_raise_lower_hook) (struct frame *f, bool raise_flag);
503 503
504 /* If the value of the frame parameter changed, this hook is called. 504 /* If the value of the frame parameter changed, this hook is called.
505 For example, if going from fullscreen to not fullscreen this hook 505 For example, if going from fullscreen to not fullscreen this hook
diff --git a/src/unexaix.c b/src/unexaix.c
index c97d5cae2a8..fd36e4a73a6 100644
--- a/src/unexaix.c
+++ b/src/unexaix.c
@@ -55,7 +55,6 @@ what you give them. Help stamp out software-hoarding! */
55#include <inttypes.h> 55#include <inttypes.h>
56#include <stdarg.h> 56#include <stdarg.h>
57#include <stdio.h> 57#include <stdio.h>
58#include <sys/stat.h>
59#include <errno.h> 58#include <errno.h>
60#include <unistd.h> 59#include <unistd.h>
61#include <fcntl.h> 60#include <fcntl.h>
@@ -134,7 +133,7 @@ unexec (const char *new_name, const char *a_name)
134 { 133 {
135 PERROR (a_name); 134 PERROR (a_name);
136 } 135 }
137 if ((new = emacs_open (new_name, O_WRONLY | O_CREAT | O_TRUNC, 0666)) < 0) 136 if ((new = emacs_open (new_name, O_WRONLY | O_CREAT | O_TRUNC, 0777)) < 0)
138 { 137 {
139 PERROR (new_name); 138 PERROR (new_name);
140 } 139 }
@@ -152,7 +151,6 @@ unexec (const char *new_name, const char *a_name)
152 emacs_close (new); 151 emacs_close (new);
153 if (a_out >= 0) 152 if (a_out >= 0)
154 emacs_close (a_out); 153 emacs_close (a_out);
155 mark_x (new_name);
156} 154}
157 155
158/* **************************************************************** 156/* ****************************************************************
@@ -466,29 +464,6 @@ copy_sym (int new, int a_out, const char *a_name, const char *new_name)
466 return 0; 464 return 0;
467} 465}
468 466
469/* ****************************************************************
470 * mark_x
471 *
472 * After successfully building the new a.out, mark it executable
473 */
474static void
475mark_x (const char *name)
476{
477 struct stat sbuf;
478 int um;
479 int new = 0; /* for PERROR */
480
481 um = umask (777);
482 umask (um);
483 if (stat (name, &sbuf) == -1)
484 {
485 PERROR (name);
486 }
487 sbuf.st_mode |= 0111 & ~um;
488 if (chmod (name, sbuf.st_mode) == -1)
489 PERROR (name);
490}
491
492static int 467static int
493adjust_lnnoptrs (int writedesc, int readdesc, const char *new_name) 468adjust_lnnoptrs (int writedesc, int readdesc, const char *new_name)
494{ 469{
diff --git a/src/unexcoff.c b/src/unexcoff.c
index 0e47bdd8656..292c38f7ff7 100644
--- a/src/unexcoff.c
+++ b/src/unexcoff.c
@@ -97,7 +97,6 @@ struct aouthdr
97#include <sys/types.h> 97#include <sys/types.h>
98#endif /* makedev */ 98#endif /* makedev */
99#include <stdio.h> 99#include <stdio.h>
100#include <sys/stat.h>
101#include <errno.h> 100#include <errno.h>
102 101
103#include <sys/file.h> 102#include <sys/file.h>
@@ -439,29 +438,6 @@ copy_sym (int new, int a_out, const char *a_name, const char *new_name)
439 return 0; 438 return 0;
440} 439}
441 440
442/* ****************************************************************
443 * mark_x
444 *
445 * After successfully building the new a.out, mark it executable
446 */
447static void
448mark_x (const char *name)
449{
450 struct stat sbuf;
451 int um;
452 int new = 0; /* for PERROR */
453
454 um = umask (777);
455 umask (um);
456 if (stat (name, &sbuf) == -1)
457 {
458 PERROR (name);
459 }
460 sbuf.st_mode |= 0111 & ~um;
461 if (chmod (name, sbuf.st_mode) == -1)
462 PERROR (name);
463}
464
465 441
466/* 442/*
467 * If the COFF file contains a symbol table and a line number section, 443 * If the COFF file contains a symbol table and a line number section,
@@ -542,7 +518,7 @@ unexec (const char *new_name, const char *a_name)
542 { 518 {
543 PERROR (a_name); 519 PERROR (a_name);
544 } 520 }
545 if ((new = emacs_open (new_name, O_WRONLY | O_CREAT | O_TRUNC, 0666)) < 0) 521 if ((new = emacs_open (new_name, O_WRONLY | O_CREAT | O_TRUNC, 0777)) < 0)
546 { 522 {
547 PERROR (new_name); 523 PERROR (new_name);
548 } 524 }
@@ -560,7 +536,6 @@ unexec (const char *new_name, const char *a_name)
560 emacs_close (new); 536 emacs_close (new);
561 if (a_out >= 0) 537 if (a_out >= 0)
562 emacs_close (a_out); 538 emacs_close (a_out);
563 mark_x (new_name);
564} 539}
565 540
566#endif /* not CANNOT_DUMP */ 541#endif /* not CANNOT_DUMP */
diff --git a/src/unexelf.c b/src/unexelf.c
index 0983f8f23ab..34478e0edb7 100644
--- a/src/unexelf.c
+++ b/src/unexelf.c
@@ -665,7 +665,6 @@ unexec (const char *new_name, const char *old_name)
665#endif 665#endif
666 struct stat stat_buf; 666 struct stat stat_buf;
667 off_t old_file_size; 667 off_t old_file_size;
668 int mask;
669 668
670 /* Open the old file, allocate a buffer of the right size, and read 669 /* Open the old file, allocate a buffer of the right size, and read
671 in the file contents. */ 670 in the file contents. */
@@ -799,7 +798,7 @@ unexec (const char *new_name, const char *old_name)
799 the image of the new file. Set pointers to various interesting 798 the image of the new file. Set pointers to various interesting
800 objects. */ 799 objects. */
801 800
802 new_file = emacs_open (new_name, O_RDWR | O_CREAT, 0666); 801 new_file = emacs_open (new_name, O_RDWR | O_CREAT, 0777);
803 if (new_file < 0) 802 if (new_file < 0)
804 fatal ("Can't creat (%s): %s", new_name, strerror (errno)); 803 fatal ("Can't creat (%s): %s", new_name, strerror (errno));
805 804
@@ -1319,13 +1318,4 @@ temacs:
1319 1318
1320 if (emacs_close (new_file) != 0) 1319 if (emacs_close (new_file) != 0)
1321 fatal ("Can't close (%s): %s", new_name, strerror (errno)); 1320 fatal ("Can't close (%s): %s", new_name, strerror (errno));
1322
1323 if (stat (new_name, &stat_buf) != 0)
1324 fatal ("Can't stat (%s): %s", new_name, strerror (errno));
1325
1326 mask = umask (777);
1327 umask (mask);
1328 stat_buf.st_mode |= 0111 & ~mask;
1329 if (chmod (new_name, stat_buf.st_mode) != 0)
1330 fatal ("Can't chmod (%s): %s", new_name, strerror (errno));
1331} 1321}
diff --git a/src/unexmacosx.c b/src/unexmacosx.c
index 2e1ac880d2a..89971bb8a77 100644
--- a/src/unexmacosx.c
+++ b/src/unexmacosx.c
@@ -1267,7 +1267,7 @@ unexec (const char *outfile, const char *infile)
1267 unexec_error ("cannot open input file `%s'", infile); 1267 unexec_error ("cannot open input file `%s'", infile);
1268 } 1268 }
1269 1269
1270 outfd = emacs_open (outfile, O_WRONLY | O_TRUNC | O_CREAT, 0755); 1270 outfd = emacs_open (outfile, O_WRONLY | O_TRUNC | O_CREAT, 0777);
1271 if (outfd < 0) 1271 if (outfd < 0)
1272 { 1272 {
1273 emacs_close (infd); 1273 emacs_close (infd);
diff --git a/src/w32term.c b/src/w32term.c
index 94b332b929f..fb8648ca4f9 100644
--- a/src/w32term.c
+++ b/src/w32term.c
@@ -185,7 +185,7 @@ void x_lower_frame (struct frame *);
185void x_scroll_bar_clear (struct frame *); 185void x_scroll_bar_clear (struct frame *);
186void x_wm_set_size_hint (struct frame *, long, bool); 186void x_wm_set_size_hint (struct frame *, long, bool);
187void x_raise_frame (struct frame *); 187void x_raise_frame (struct frame *);
188void x_set_window_size (struct frame *, int, int, int, bool); 188void x_set_window_size (struct frame *, bool, int, int, bool);
189void x_wm_set_window_state (struct frame *, int); 189void x_wm_set_window_state (struct frame *, int);
190void x_wm_set_icon_pixmap (struct frame *, int); 190void x_wm_set_icon_pixmap (struct frame *, int);
191static void w32_initialize (void); 191static void w32_initialize (void);
@@ -5716,7 +5716,7 @@ w32_draw_window_cursor (struct window *w, struct glyph_row *glyph_row,
5716 5716
5717/* Icons. */ 5717/* Icons. */
5718 5718
5719int 5719bool
5720x_bitmap_icon (struct frame *f, Lisp_Object icon) 5720x_bitmap_icon (struct frame *f, Lisp_Object icon)
5721{ 5721{
5722 HANDLE main_icon; 5722 HANDLE main_icon;
@@ -6096,12 +6096,13 @@ w32fullscreen_hook (struct frame *f)
6096} 6096}
6097 6097
6098/* Call this to change the size of frame F's x-window. 6098/* Call this to change the size of frame F's x-window.
6099 If CHANGE_GRAVITY is 1, we change to top-left-corner window gravity 6099 If CHANGE_GRAVITY, change to top-left-corner window gravity
6100 for this size change and subsequent size changes. 6100 for this size change and subsequent size changes.
6101 Otherwise we leave the window gravity unchanged. */ 6101 Otherwise we leave the window gravity unchanged. */
6102 6102
6103void 6103void
6104x_set_window_size (struct frame *f, int change_gravity, int width, int height, bool pixelwise) 6104x_set_window_size (struct frame *f, bool change_gravity,
6105 int width, int height, bool pixelwise)
6105{ 6106{
6106 int pixelwidth, pixelheight; 6107 int pixelwidth, pixelheight;
6107 RECT rect; 6108 RECT rect;
@@ -6331,7 +6332,7 @@ x_lower_frame (struct frame *f)
6331} 6332}
6332 6333
6333static void 6334static void
6334w32_frame_raise_lower (struct frame *f, int raise_flag) 6335w32_frame_raise_lower (struct frame *f, bool raise_flag)
6335{ 6336{
6336 if (! FRAME_W32_P (f)) 6337 if (! FRAME_W32_P (f))
6337 return; 6338 return;
diff --git a/src/w32term.h b/src/w32term.h
index fb37550100e..f02d7ce0a68 100644
--- a/src/w32term.h
+++ b/src/w32term.h
@@ -240,7 +240,7 @@ extern struct w32_display_info *w32_term_init (Lisp_Object,
240 char *, char *); 240 char *, char *);
241extern int w32_defined_color (struct frame *f, const char *color, 241extern int w32_defined_color (struct frame *f, const char *color,
242 XColor *color_def, int alloc); 242 XColor *color_def, int alloc);
243extern void x_set_window_size (struct frame *f, int change_grav, 243extern void x_set_window_size (struct frame *f, bool change_gravity,
244 int width, int height, bool pixelwise); 244 int width, int height, bool pixelwise);
245extern int x_display_pixel_height (struct w32_display_info *); 245extern int x_display_pixel_height (struct w32_display_info *);
246extern int x_display_pixel_width (struct w32_display_info *); 246extern int x_display_pixel_width (struct w32_display_info *);
@@ -257,7 +257,7 @@ extern void x_set_internal_border_width (struct frame *f,
257 Lisp_Object value, 257 Lisp_Object value,
258 Lisp_Object oldval); 258 Lisp_Object oldval);
259extern void x_activate_menubar (struct frame *); 259extern void x_activate_menubar (struct frame *);
260extern int x_bitmap_icon (struct frame *, Lisp_Object); 260extern bool x_bitmap_icon (struct frame *, Lisp_Object);
261extern void initialize_frame_menubar (struct frame *); 261extern void initialize_frame_menubar (struct frame *);
262extern void x_free_frame_resources (struct frame *); 262extern void x_free_frame_resources (struct frame *);
263extern void x_real_positions (struct frame *, int *, int *); 263extern void x_real_positions (struct frame *, int *, int *);
diff --git a/src/xterm.c b/src/xterm.c
index 1ccc38ca313..0640208ca14 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -220,7 +220,7 @@ enum xembed_message
220 }; 220 };
221 221
222static bool x_alloc_nearest_color_1 (Display *, Colormap, XColor *); 222static bool x_alloc_nearest_color_1 (Display *, Colormap, XColor *);
223static void x_set_window_size_1 (struct frame *, int, int, int, bool); 223static void x_set_window_size_1 (struct frame *, bool, int, int, bool);
224static void x_raise_frame (struct frame *); 224static void x_raise_frame (struct frame *);
225static void x_lower_frame (struct frame *); 225static void x_lower_frame (struct frame *);
226static const XColor *x_color_cells (Display *, int *); 226static const XColor *x_color_cells (Display *, int *);
@@ -255,10 +255,10 @@ static void x_horizontal_scroll_bar_report_motion (struct frame **, Lisp_Object
255 enum scroll_bar_part *, 255 enum scroll_bar_part *,
256 Lisp_Object *, Lisp_Object *, 256 Lisp_Object *, Lisp_Object *,
257 Time *); 257 Time *);
258static int x_handle_net_wm_state (struct frame *, const XPropertyEvent *); 258static bool x_handle_net_wm_state (struct frame *, const XPropertyEvent *);
259static void x_check_fullscreen (struct frame *); 259static void x_check_fullscreen (struct frame *);
260static void x_check_expected_move (struct frame *, int, int); 260static void x_check_expected_move (struct frame *, int, int);
261static void x_sync_with_move (struct frame *, int, int, int); 261static void x_sync_with_move (struct frame *, int, int, bool);
262static int handle_one_xevent (struct x_display_info *, 262static int handle_one_xevent (struct x_display_info *,
263 const XEvent *, int *, 263 const XEvent *, int *,
264 struct input_event *); 264 struct input_event *);
@@ -272,7 +272,7 @@ static void x_wm_set_window_state (struct frame *, int);
272static void x_wm_set_icon_pixmap (struct frame *, ptrdiff_t); 272static void x_wm_set_icon_pixmap (struct frame *, ptrdiff_t);
273static void x_initialize (void); 273static void x_initialize (void);
274 274
275static int get_current_wm_state (struct frame *, Window, int *, int *); 275static bool get_current_wm_state (struct frame *, Window, int *, bool *);
276 276
277/* Flush display of frame F. */ 277/* Flush display of frame F. */
278 278
@@ -305,7 +305,7 @@ x_flush (struct frame *f)
305 Debugging 305 Debugging
306 ***********************************************************************/ 306 ***********************************************************************/
307 307
308#if 0 308#if false
309 309
310/* This is a function useful for recording debugging information about 310/* This is a function useful for recording debugging information about
311 the sequence of occurrences in this file. */ 311 the sequence of occurrences in this file. */
@@ -331,7 +331,7 @@ record_event (char *locus, int type)
331 event_record_index++; 331 event_record_index++;
332} 332}
333 333
334#endif /* 0 */ 334#endif
335 335
336 336
337 337
@@ -479,7 +479,7 @@ x_update_window_begin (struct window *w)
479 if (f == hlinfo->mouse_face_mouse_frame) 479 if (f == hlinfo->mouse_face_mouse_frame)
480 { 480 {
481 /* Don't do highlighting for mouse motion during the update. */ 481 /* Don't do highlighting for mouse motion during the update. */
482 hlinfo->mouse_face_defer = 1; 482 hlinfo->mouse_face_defer = true;
483 483
484 /* If F needs to be redrawn, simply forget about any prior mouse 484 /* If F needs to be redrawn, simply forget about any prior mouse
485 highlighting. */ 485 highlighting. */
@@ -583,11 +583,11 @@ x_update_window_end (struct window *w, bool cursor_on_p,
583 block_input (); 583 block_input ();
584 584
585 if (cursor_on_p) 585 if (cursor_on_p)
586 display_and_set_cursor (w, 1, 586 display_and_set_cursor (w, true,
587 w->output_cursor.hpos, w->output_cursor.vpos, 587 w->output_cursor.hpos, w->output_cursor.vpos,
588 w->output_cursor.x, w->output_cursor.y); 588 w->output_cursor.x, w->output_cursor.y);
589 589
590 if (draw_window_fringes (w, 1)) 590 if (draw_window_fringes (w, true))
591 { 591 {
592 if (WINDOW_RIGHT_DIVIDER_WIDTH (w)) 592 if (WINDOW_RIGHT_DIVIDER_WIDTH (w))
593 x_draw_right_divider (w); 593 x_draw_right_divider (w);
@@ -618,7 +618,7 @@ static void
618x_update_end (struct frame *f) 618x_update_end (struct frame *f)
619{ 619{
620 /* Mouse highlight may be displayed again. */ 620 /* Mouse highlight may be displayed again. */
621 MOUSE_HL_INFO (f)->mouse_face_defer = 0; 621 MOUSE_HL_INFO (f)->mouse_face_defer = false;
622 622
623#ifndef XFlush 623#ifndef XFlush
624 block_input (); 624 block_input ();
@@ -675,7 +675,7 @@ x_after_update_window_line (struct window *w, struct glyph_row *desired_row)
675 eassert (w); 675 eassert (w);
676 676
677 if (!desired_row->mode_line_p && !w->pseudo_window_p) 677 if (!desired_row->mode_line_p && !w->pseudo_window_p)
678 desired_row->redraw_fringe_bitmaps_p = 1; 678 desired_row->redraw_fringe_bitmaps_p = true;
679 679
680#ifdef USE_X_TOOLKIT 680#ifdef USE_X_TOOLKIT
681 /* When a window has disappeared, make sure that no rest of 681 /* When a window has disappeared, make sure that no rest of
@@ -817,10 +817,10 @@ static void x_draw_image_foreground_1 (struct glyph_string *, Pixmap);
817static void x_clear_glyph_string_rect (struct glyph_string *, int, 817static void x_clear_glyph_string_rect (struct glyph_string *, int,
818 int, int, int); 818 int, int, int);
819static void x_draw_relief_rect (struct frame *, int, int, int, int, 819static void x_draw_relief_rect (struct frame *, int, int, int, int,
820 int, int, int, int, int, int, 820 int, bool, bool, bool, bool, bool,
821 XRectangle *); 821 XRectangle *);
822static void x_draw_box_rect (struct glyph_string *, int, int, int, int, 822static void x_draw_box_rect (struct glyph_string *, int, int, int, int,
823 int, int, int, XRectangle *); 823 int, bool, bool, XRectangle *);
824static void x_scroll_bar_clear (struct frame *); 824static void x_scroll_bar_clear (struct frame *);
825 825
826#ifdef GLYPH_DEBUG 826#ifdef GLYPH_DEBUG
@@ -962,7 +962,7 @@ x_set_glyph_string_gc (struct glyph_string *s)
962 else if (s->hl == DRAW_CURSOR) 962 else if (s->hl == DRAW_CURSOR)
963 { 963 {
964 x_set_cursor_gc (s); 964 x_set_cursor_gc (s);
965 s->stippled_p = 0; 965 s->stippled_p = false;
966 } 966 }
967 else if (s->hl == DRAW_MOUSE_FACE) 967 else if (s->hl == DRAW_MOUSE_FACE)
968 { 968 {
@@ -1094,7 +1094,7 @@ x_draw_glyph_string_background (struct glyph_string *s, bool force_p)
1094 s->background_width, 1094 s->background_width,
1095 s->height - 2 * box_line_width); 1095 s->height - 2 * box_line_width);
1096 XSetFillStyle (s->display, s->gc, FillSolid); 1096 XSetFillStyle (s->display, s->gc, FillSolid);
1097 s->background_filled_p = 1; 1097 s->background_filled_p = true;
1098 } 1098 }
1099 else if (FONT_HEIGHT (s->font) < s->height - 2 * box_line_width 1099 else if (FONT_HEIGHT (s->font) < s->height - 2 * box_line_width
1100 || s->font_not_found_p 1100 || s->font_not_found_p
@@ -1104,7 +1104,7 @@ x_draw_glyph_string_background (struct glyph_string *s, bool force_p)
1104 x_clear_glyph_string_rect (s, s->x, s->y + box_line_width, 1104 x_clear_glyph_string_rect (s, s->x, s->y + box_line_width,
1105 s->background_width, 1105 s->background_width,
1106 s->height - 2 * box_line_width); 1106 s->height - 2 * box_line_width);
1107 s->background_filled_p = 1; 1107 s->background_filled_p = true;
1108 } 1108 }
1109 } 1109 }
1110} 1110}
@@ -1150,11 +1150,11 @@ x_draw_glyph_string_foreground (struct glyph_string *s)
1150 y = s->ybase - boff; 1150 y = s->ybase - boff;
1151 if (s->for_overlaps 1151 if (s->for_overlaps
1152 || (s->background_filled_p && s->hl != DRAW_CURSOR)) 1152 || (s->background_filled_p && s->hl != DRAW_CURSOR))
1153 font->driver->draw (s, 0, s->nchars, x, y, 0); 1153 font->driver->draw (s, 0, s->nchars, x, y, false);
1154 else 1154 else
1155 font->driver->draw (s, 0, s->nchars, x, y, 1); 1155 font->driver->draw (s, 0, s->nchars, x, y, true);
1156 if (s->face->overstrike) 1156 if (s->face->overstrike)
1157 font->driver->draw (s, 0, s->nchars, x + 1, y, 0); 1157 font->driver->draw (s, 0, s->nchars, x + 1, y, false);
1158 } 1158 }
1159} 1159}
1160 1160
@@ -1199,9 +1199,9 @@ x_draw_composite_glyph_string_foreground (struct glyph_string *s)
1199 int xx = x + s->cmp->offsets[j * 2]; 1199 int xx = x + s->cmp->offsets[j * 2];
1200 int yy = y - s->cmp->offsets[j * 2 + 1]; 1200 int yy = y - s->cmp->offsets[j * 2 + 1];
1201 1201
1202 font->driver->draw (s, j, j + 1, xx, yy, 0); 1202 font->driver->draw (s, j, j + 1, xx, yy, false);
1203 if (s->face->overstrike) 1203 if (s->face->overstrike)
1204 font->driver->draw (s, j, j + 1, xx + 1, yy, 0); 1204 font->driver->draw (s, j, j + 1, xx + 1, yy, false);
1205 } 1205 }
1206 } 1206 }
1207 else 1207 else
@@ -1222,17 +1222,18 @@ x_draw_composite_glyph_string_foreground (struct glyph_string *s)
1222 1222
1223 if (j < i) 1223 if (j < i)
1224 { 1224 {
1225 font->driver->draw (s, j, i, x, y, 0); 1225 font->driver->draw (s, j, i, x, y, false);
1226 if (s->face->overstrike) 1226 if (s->face->overstrike)
1227 font->driver->draw (s, j, i, x + 1, y, 0); 1227 font->driver->draw (s, j, i, x + 1, y, false);
1228 x += width; 1228 x += width;
1229 } 1229 }
1230 xoff = LGLYPH_XOFF (glyph); 1230 xoff = LGLYPH_XOFF (glyph);
1231 yoff = LGLYPH_YOFF (glyph); 1231 yoff = LGLYPH_YOFF (glyph);
1232 wadjust = LGLYPH_WADJUST (glyph); 1232 wadjust = LGLYPH_WADJUST (glyph);
1233 font->driver->draw (s, i, i + 1, x + xoff, y + yoff, 0); 1233 font->driver->draw (s, i, i + 1, x + xoff, y + yoff, false);
1234 if (s->face->overstrike) 1234 if (s->face->overstrike)
1235 font->driver->draw (s, i, i + 1, x + xoff + 1, y + yoff, 0); 1235 font->driver->draw (s, i, i + 1, x + xoff + 1, y + yoff,
1236 false);
1236 x += wadjust; 1237 x += wadjust;
1237 j = i + 1; 1238 j = i + 1;
1238 width = 0; 1239 width = 0;
@@ -1240,9 +1241,9 @@ x_draw_composite_glyph_string_foreground (struct glyph_string *s)
1240 } 1241 }
1241 if (j < i) 1242 if (j < i)
1242 { 1243 {
1243 font->driver->draw (s, j, i, x, y, 0); 1244 font->driver->draw (s, j, i, x, y, false);
1244 if (s->face->overstrike) 1245 if (s->face->overstrike)
1245 font->driver->draw (s, j, i, x + 1, y, 0); 1246 font->driver->draw (s, j, i, x + 1, y, false);
1246 } 1247 }
1247 } 1248 }
1248} 1249}
@@ -1310,11 +1311,11 @@ x_draw_glyphless_glyph_string_foreground (struct glyph_string *s)
1310 s->font->driver->draw (s, 0, upper_len, 1311 s->font->driver->draw (s, 0, upper_len,
1311 x + glyph->slice.glyphless.upper_xoff, 1312 x + glyph->slice.glyphless.upper_xoff,
1312 s->ybase + glyph->slice.glyphless.upper_yoff, 1313 s->ybase + glyph->slice.glyphless.upper_yoff,
1313 0); 1314 false);
1314 s->font->driver->draw (s, upper_len, len, 1315 s->font->driver->draw (s, upper_len, len,
1315 x + glyph->slice.glyphless.lower_xoff, 1316 x + glyph->slice.glyphless.lower_xoff,
1316 s->ybase + glyph->slice.glyphless.lower_yoff, 1317 s->ybase + glyph->slice.glyphless.lower_yoff,
1317 0); 1318 false);
1318 } 1319 }
1319 if (glyph->u.glyphless.method != GLYPHLESS_DISPLAY_THIN_SPACE) 1320 if (glyph->u.glyphless.method != GLYPHLESS_DISPLAY_THIN_SPACE)
1320 XDrawRectangle (s->display, s->window, s->gc, 1321 XDrawRectangle (s->display, s->window, s->gc,
@@ -1781,7 +1782,7 @@ x_alloc_lighter_color (struct frame *f, Display *display, Colormap cmap,
1781 success_p = x_alloc_nearest_color (f, cmap, &new); 1782 success_p = x_alloc_nearest_color (f, cmap, &new);
1782 } 1783 }
1783 else 1784 else
1784 success_p = 1; 1785 success_p = true;
1785 *pixel = new.pixel; 1786 *pixel = new.pixel;
1786 } 1787 }
1787 1788
@@ -1876,16 +1877,17 @@ x_setup_relief_colors (struct glyph_string *s)
1876 1877
1877/* Draw a relief on frame F inside the rectangle given by LEFT_X, 1878/* Draw a relief on frame F inside the rectangle given by LEFT_X,
1878 TOP_Y, RIGHT_X, and BOTTOM_Y. WIDTH is the thickness of the relief 1879 TOP_Y, RIGHT_X, and BOTTOM_Y. WIDTH is the thickness of the relief
1879 to draw, it must be >= 0. RAISED_P non-zero means draw a raised 1880 to draw, it must be >= 0. RAISED_P means draw a raised
1880 relief. LEFT_P non-zero means draw a relief on the left side of 1881 relief. LEFT_P means draw a relief on the left side of
1881 the rectangle. RIGHT_P non-zero means draw a relief on the right 1882 the rectangle. RIGHT_P means draw a relief on the right
1882 side of the rectangle. CLIP_RECT is the clipping rectangle to use 1883 side of the rectangle. CLIP_RECT is the clipping rectangle to use
1883 when drawing. */ 1884 when drawing. */
1884 1885
1885static void 1886static void
1886x_draw_relief_rect (struct frame *f, 1887x_draw_relief_rect (struct frame *f,
1887 int left_x, int top_y, int right_x, int bottom_y, int width, 1888 int left_x, int top_y, int right_x, int bottom_y,
1888 int raised_p, int top_p, int bot_p, int left_p, int right_p, 1889 int width, bool raised_p, bool top_p, bool bot_p,
1890 bool left_p, bool right_p,
1889 XRectangle *clip_rect) 1891 XRectangle *clip_rect)
1890{ 1892{
1891 Display *dpy = FRAME_X_DISPLAY (f); 1893 Display *dpy = FRAME_X_DISPLAY (f);
@@ -1909,8 +1911,8 @@ x_draw_relief_rect (struct frame *f,
1909 { 1911 {
1910 if (width == 1) 1912 if (width == 1)
1911 XDrawLine (dpy, window, gc, 1913 XDrawLine (dpy, window, gc,
1912 left_x + (left_p ? 1 : 0), top_y, 1914 left_x + left_p, top_y,
1913 right_x + (right_p ? 0 : 1), top_y); 1915 right_x + !right_p, top_y);
1914 1916
1915 for (i = 1; i < width; ++i) 1917 for (i = 1; i < width; ++i)
1916 XDrawLine (dpy, window, gc, 1918 XDrawLine (dpy, window, gc,
@@ -1945,8 +1947,8 @@ x_draw_relief_rect (struct frame *f,
1945 /* Outermost top line. */ 1947 /* Outermost top line. */
1946 if (top_p) 1948 if (top_p)
1947 XDrawLine (dpy, window, gc, 1949 XDrawLine (dpy, window, gc,
1948 left_x + (left_p ? 1 : 0), top_y, 1950 left_x + left_p, top_y,
1949 right_x + (right_p ? 0 : 1), top_y); 1951 right_x + !right_p, top_y);
1950 1952
1951 /* Outermost left line. */ 1953 /* Outermost left line. */
1952 if (left_p) 1954 if (left_p)
@@ -1957,8 +1959,8 @@ x_draw_relief_rect (struct frame *f,
1957 if (bot_p) 1959 if (bot_p)
1958 { 1960 {
1959 XDrawLine (dpy, window, gc, 1961 XDrawLine (dpy, window, gc,
1960 left_x + (left_p ? 1 : 0), bottom_y, 1962 left_x + left_p, bottom_y,
1961 right_x + (right_p ? 0 : 1), bottom_y); 1963 right_x + !right_p, bottom_y);
1962 for (i = 1; i < width; ++i) 1964 for (i = 1; i < width; ++i)
1963 XDrawLine (dpy, window, gc, 1965 XDrawLine (dpy, window, gc,
1964 left_x + i * left_p, bottom_y - i, 1966 left_x + i * left_p, bottom_y - i,
@@ -1982,15 +1984,15 @@ x_draw_relief_rect (struct frame *f,
1982 1984
1983/* Draw a box on frame F inside the rectangle given by LEFT_X, TOP_Y, 1985/* Draw a box on frame F inside the rectangle given by LEFT_X, TOP_Y,
1984 RIGHT_X, and BOTTOM_Y. WIDTH is the thickness of the lines to 1986 RIGHT_X, and BOTTOM_Y. WIDTH is the thickness of the lines to
1985 draw, it must be >= 0. LEFT_P non-zero means draw a line on the 1987 draw, it must be >= 0. LEFT_P means draw a line on the
1986 left side of the rectangle. RIGHT_P non-zero means draw a line 1988 left side of the rectangle. RIGHT_P means draw a line
1987 on the right side of the rectangle. CLIP_RECT is the clipping 1989 on the right side of the rectangle. CLIP_RECT is the clipping
1988 rectangle to use when drawing. */ 1990 rectangle to use when drawing. */
1989 1991
1990static void 1992static void
1991x_draw_box_rect (struct glyph_string *s, 1993x_draw_box_rect (struct glyph_string *s,
1992 int left_x, int top_y, int right_x, int bottom_y, int width, 1994 int left_x, int top_y, int right_x, int bottom_y, int width,
1993 int left_p, int right_p, XRectangle *clip_rect) 1995 bool left_p, bool right_p, XRectangle *clip_rect)
1994{ 1996{
1995 XGCValues xgcv; 1997 XGCValues xgcv;
1996 1998
@@ -2026,8 +2028,8 @@ x_draw_box_rect (struct glyph_string *s,
2026static void 2028static void
2027x_draw_glyph_string_box (struct glyph_string *s) 2029x_draw_glyph_string_box (struct glyph_string *s)
2028{ 2030{
2029 int width, left_x, right_x, top_y, bottom_y, last_x, raised_p; 2031 int width, left_x, right_x, top_y, bottom_y, last_x;
2030 int left_p, right_p; 2032 bool raised_p, left_p, right_p;
2031 struct glyph *last_glyph; 2033 struct glyph *last_glyph;
2032 XRectangle clip_rect; 2034 XRectangle clip_rect;
2033 2035
@@ -2067,7 +2069,8 @@ x_draw_glyph_string_box (struct glyph_string *s)
2067 { 2069 {
2068 x_setup_relief_colors (s); 2070 x_setup_relief_colors (s);
2069 x_draw_relief_rect (s->f, left_x, top_y, right_x, bottom_y, 2071 x_draw_relief_rect (s->f, left_x, top_y, right_x, bottom_y,
2070 width, raised_p, 1, 1, left_p, right_p, &clip_rect); 2072 width, raised_p, true, true, left_p, right_p,
2073 &clip_rect);
2071 } 2074 }
2072} 2075}
2073 2076
@@ -2166,7 +2169,8 @@ x_draw_image_foreground (struct glyph_string *s)
2166static void 2169static void
2167x_draw_image_relief (struct glyph_string *s) 2170x_draw_image_relief (struct glyph_string *s)
2168{ 2171{
2169 int x1, y1, thick, raised_p, top_p, bot_p, left_p, right_p; 2172 int x1, y1, thick;
2173 bool raised_p, top_p, bot_p, left_p, right_p;
2170 int extra_x, extra_y; 2174 int extra_x, extra_y;
2171 XRectangle r; 2175 XRectangle r;
2172 int x = s->x; 2176 int x = s->x;
@@ -2215,16 +2219,16 @@ x_draw_image_relief (struct glyph_string *s)
2215 extra_x = extra_y = XINT (Vtool_bar_button_margin); 2219 extra_x = extra_y = XINT (Vtool_bar_button_margin);
2216 } 2220 }
2217 2221
2218 top_p = bot_p = left_p = right_p = 0; 2222 top_p = bot_p = left_p = right_p = false;
2219 2223
2220 if (s->slice.x == 0) 2224 if (s->slice.x == 0)
2221 x -= thick + extra_x, left_p = 1; 2225 x -= thick + extra_x, left_p = true;
2222 if (s->slice.y == 0) 2226 if (s->slice.y == 0)
2223 y -= thick + extra_y, top_p = 1; 2227 y -= thick + extra_y, top_p = true;
2224 if (s->slice.x + s->slice.width == s->img->width) 2228 if (s->slice.x + s->slice.width == s->img->width)
2225 x1 += thick + extra_x, right_p = 1; 2229 x1 += thick + extra_x, right_p = true;
2226 if (s->slice.y + s->slice.height == s->img->height) 2230 if (s->slice.y + s->slice.height == s->img->height)
2227 y1 += thick + extra_y, bot_p = 1; 2231 y1 += thick + extra_y, bot_p = true;
2228 2232
2229 x_setup_relief_colors (s); 2233 x_setup_relief_colors (s);
2230 get_glyph_string_clip_rect (s, &r); 2234 get_glyph_string_clip_rect (s, &r);
@@ -2422,7 +2426,7 @@ x_draw_image_glyph_string (struct glyph_string *s)
2422 x_draw_glyph_string_bg_rect (s, x, y, width, height); 2426 x_draw_glyph_string_bg_rect (s, x, y, width, height);
2423 } 2427 }
2424 2428
2425 s->background_filled_p = 1; 2429 s->background_filled_p = true;
2426 } 2430 }
2427 2431
2428 /* Draw the foreground. */ 2432 /* Draw the foreground. */
@@ -2546,7 +2550,7 @@ x_draw_stretch_glyph_string (struct glyph_string *s)
2546 x_draw_glyph_string_bg_rect (s, x, s->y, background_width, s->height); 2550 x_draw_glyph_string_bg_rect (s, x, s->y, background_width, s->height);
2547 } 2551 }
2548 2552
2549 s->background_filled_p = 1; 2553 s->background_filled_p = true;
2550} 2554}
2551 2555
2552/* 2556/*
@@ -2564,7 +2568,8 @@ static void
2564x_draw_underwave (struct glyph_string *s) 2568x_draw_underwave (struct glyph_string *s)
2565{ 2569{
2566 int wave_height = 3, wave_length = 2; 2570 int wave_height = 3, wave_length = 2;
2567 int dx, dy, x0, y0, width, x1, y1, x2, y2, odd, xmax; 2571 int dx, dy, x0, y0, width, x1, y1, x2, y2, xmax;
2572 bool odd;
2568 XRectangle wave_clip, string_clip, final_clip; 2573 XRectangle wave_clip, string_clip, final_clip;
2569 2574
2570 dx = wave_length; 2575 dx = wave_length;
@@ -2591,7 +2596,7 @@ x_draw_underwave (struct glyph_string *s)
2591 2596
2592 x1 = x0 - (x0 % dx); 2597 x1 = x0 - (x0 % dx);
2593 x2 = x1 + dx; 2598 x2 = x1 + dx;
2594 odd = (x1/dx) % 2; 2599 odd = (x1 / dx) & 1;
2595 y1 = y2 = y0; 2600 y1 = y2 = y0;
2596 2601
2597 if (odd) 2602 if (odd)
@@ -2620,7 +2625,7 @@ x_draw_underwave (struct glyph_string *s)
2620static void 2625static void
2621x_draw_glyph_string (struct glyph_string *s) 2626x_draw_glyph_string (struct glyph_string *s)
2622{ 2627{
2623 bool relief_drawn_p = 0; 2628 bool relief_drawn_p = false;
2624 2629
2625 /* If S draws into the background of its successors, draw the 2630 /* If S draws into the background of its successors, draw the
2626 background of the successors first so that S can draw into it. 2631 background of the successors first so that S can draw into it.
@@ -2640,7 +2645,7 @@ x_draw_glyph_string (struct glyph_string *s)
2640 if (next->first_glyph->type == STRETCH_GLYPH) 2645 if (next->first_glyph->type == STRETCH_GLYPH)
2641 x_draw_stretch_glyph_string (next); 2646 x_draw_stretch_glyph_string (next);
2642 else 2647 else
2643 x_draw_glyph_string_background (next, 1); 2648 x_draw_glyph_string_background (next, true);
2644 next->num_clips = 0; 2649 next->num_clips = 0;
2645 } 2650 }
2646 } 2651 }
@@ -2657,10 +2662,10 @@ x_draw_glyph_string (struct glyph_string *s)
2657 2662
2658 { 2663 {
2659 x_set_glyph_string_clipping (s); 2664 x_set_glyph_string_clipping (s);
2660 x_draw_glyph_string_background (s, 1); 2665 x_draw_glyph_string_background (s, true);
2661 x_draw_glyph_string_box (s); 2666 x_draw_glyph_string_box (s);
2662 x_set_glyph_string_clipping (s); 2667 x_set_glyph_string_clipping (s);
2663 relief_drawn_p = 1; 2668 relief_drawn_p = true;
2664 } 2669 }
2665 else if (!s->clip_head /* draw_glyphs didn't specify a clip mask. */ 2670 else if (!s->clip_head /* draw_glyphs didn't specify a clip mask. */
2666 && !s->clip_tail 2671 && !s->clip_tail
@@ -2685,26 +2690,26 @@ x_draw_glyph_string (struct glyph_string *s)
2685 2690
2686 case CHAR_GLYPH: 2691 case CHAR_GLYPH:
2687 if (s->for_overlaps) 2692 if (s->for_overlaps)
2688 s->background_filled_p = 1; 2693 s->background_filled_p = true;
2689 else 2694 else
2690 x_draw_glyph_string_background (s, 0); 2695 x_draw_glyph_string_background (s, false);
2691 x_draw_glyph_string_foreground (s); 2696 x_draw_glyph_string_foreground (s);
2692 break; 2697 break;
2693 2698
2694 case COMPOSITE_GLYPH: 2699 case COMPOSITE_GLYPH:
2695 if (s->for_overlaps || (s->cmp_from > 0 2700 if (s->for_overlaps || (s->cmp_from > 0
2696 && ! s->first_glyph->u.cmp.automatic)) 2701 && ! s->first_glyph->u.cmp.automatic))
2697 s->background_filled_p = 1; 2702 s->background_filled_p = true;
2698 else 2703 else
2699 x_draw_glyph_string_background (s, 1); 2704 x_draw_glyph_string_background (s, true);
2700 x_draw_composite_glyph_string_foreground (s); 2705 x_draw_composite_glyph_string_foreground (s);
2701 break; 2706 break;
2702 2707
2703 case GLYPHLESS_GLYPH: 2708 case GLYPHLESS_GLYPH:
2704 if (s->for_overlaps) 2709 if (s->for_overlaps)
2705 s->background_filled_p = 1; 2710 s->background_filled_p = true;
2706 else 2711 else
2707 x_draw_glyph_string_background (s, 1); 2712 x_draw_glyph_string_background (s, true);
2708 x_draw_glyphless_glyph_string_foreground (s); 2713 x_draw_glyphless_glyph_string_foreground (s);
2709 break; 2714 break;
2710 2715
@@ -2971,7 +2976,7 @@ x_show_hourglass (struct frame *f)
2971 if (FRAME_OUTER_WINDOW (f)) 2976 if (FRAME_OUTER_WINDOW (f))
2972#endif 2977#endif
2973 { 2978 {
2974 x->hourglass_p = 1; 2979 x->hourglass_p = true;
2975 2980
2976 if (!x->hourglass_window) 2981 if (!x->hourglass_window)
2977 { 2982 {
@@ -3009,7 +3014,7 @@ x_hide_hourglass (struct frame *f)
3009 /* Sync here because XTread_socket looks at the 3014 /* Sync here because XTread_socket looks at the
3010 hourglass_p flag that is reset to zero below. */ 3015 hourglass_p flag that is reset to zero below. */
3011 XSync (FRAME_X_DISPLAY (f), False); 3016 XSync (FRAME_X_DISPLAY (f), False);
3012 x->hourglass_p = 0; 3017 x->hourglass_p = false;
3013 } 3018 }
3014} 3019}
3015 3020
@@ -3034,7 +3039,7 @@ XTflash (struct frame *f)
3034 cairo_rectangle (cr, x, y, w, h); \ 3039 cairo_rectangle (cr, x, y, w, h); \
3035 cairo_fill (cr); \ 3040 cairo_fill (cr); \
3036 } \ 3041 } \
3037 while (0) 3042 while (false)
3038#else /* ! HAVE_GTK3 */ 3043#else /* ! HAVE_GTK3 */
3039 GdkGCValues vals; 3044 GdkGCValues vals;
3040 GdkGC *gc; 3045 GdkGC *gc;
@@ -3157,7 +3162,7 @@ XTflash (struct frame *f)
3157 3162
3158 3163
3159static void 3164static void
3160XTtoggle_invisible_pointer (struct frame *f, int invisible) 3165XTtoggle_invisible_pointer (struct frame *f, bool invisible)
3161{ 3166{
3162 block_input (); 3167 block_input ();
3163 FRAME_DISPLAY_INFO (f)->toggle_visible_pointer (f, invisible); 3168 FRAME_DISPLAY_INFO (f)->toggle_visible_pointer (f, invisible);
@@ -3277,7 +3282,7 @@ frame_highlight (struct frame *f)
3277 f->output_data.x->border_pixel); 3282 f->output_data.x->border_pixel);
3278 x_uncatch_errors (); 3283 x_uncatch_errors ();
3279 unblock_input (); 3284 unblock_input ();
3280 x_update_cursor (f, 1); 3285 x_update_cursor (f, true);
3281 x_set_frame_alpha (f); 3286 x_set_frame_alpha (f);
3282} 3287}
3283 3288
@@ -3295,7 +3300,7 @@ frame_unhighlight (struct frame *f)
3295 f->output_data.x->border_tile); 3300 f->output_data.x->border_tile);
3296 x_uncatch_errors (); 3301 x_uncatch_errors ();
3297 unblock_input (); 3302 unblock_input ();
3298 x_update_cursor (f, 1); 3303 x_update_cursor (f, true);
3299 x_set_frame_alpha (f); 3304 x_set_frame_alpha (f);
3300} 3305}
3301 3306
@@ -3380,7 +3385,7 @@ x_focus_changed (int type, int state, struct x_display_info *dpyinfo, struct fra
3380 XUnsetICFocus (FRAME_XIC (frame)); 3385 XUnsetICFocus (FRAME_XIC (frame));
3381#endif 3386#endif
3382 if (frame->pointer_invisible) 3387 if (frame->pointer_invisible)
3383 XTtoggle_invisible_pointer (frame, 0); 3388 XTtoggle_invisible_pointer (frame, false);
3384 } 3389 }
3385} 3390}
3386 3391
@@ -3693,11 +3698,11 @@ x_find_modifier_meanings (struct x_display_info *dpyinfo)
3693 Alt keysyms are on. */ 3698 Alt keysyms are on. */
3694 { 3699 {
3695 int row, col; /* The row and column in the modifier table. */ 3700 int row, col; /* The row and column in the modifier table. */
3696 int found_alt_or_meta; 3701 bool found_alt_or_meta;
3697 3702
3698 for (row = 3; row < 8; row++) 3703 for (row = 3; row < 8; row++)
3699 { 3704 {
3700 found_alt_or_meta = 0; 3705 found_alt_or_meta = false;
3701 for (col = 0; col < mods->max_keypermod; col++) 3706 for (col = 0; col < mods->max_keypermod; col++)
3702 { 3707 {
3703 KeyCode code = mods->modifiermap[(row * mods->max_keypermod) + col]; 3708 KeyCode code = mods->modifiermap[(row * mods->max_keypermod) + col];
@@ -3718,13 +3723,13 @@ x_find_modifier_meanings (struct x_display_info *dpyinfo)
3718 { 3723 {
3719 case XK_Meta_L: 3724 case XK_Meta_L:
3720 case XK_Meta_R: 3725 case XK_Meta_R:
3721 found_alt_or_meta = 1; 3726 found_alt_or_meta = true;
3722 dpyinfo->meta_mod_mask |= (1 << row); 3727 dpyinfo->meta_mod_mask |= (1 << row);
3723 break; 3728 break;
3724 3729
3725 case XK_Alt_L: 3730 case XK_Alt_L:
3726 case XK_Alt_R: 3731 case XK_Alt_R:
3727 found_alt_or_meta = 1; 3732 found_alt_or_meta = true;
3728 dpyinfo->alt_mod_mask |= (1 << row); 3733 dpyinfo->alt_mod_mask |= (1 << row);
3729 break; 3734 break;
3730 3735
@@ -3903,14 +3908,14 @@ construct_mouse_click (struct input_event *result,
3903 the mainstream emacs code by setting mouse_moved. If not, ask for 3908 the mainstream emacs code by setting mouse_moved. If not, ask for
3904 another motion event, so we can check again the next time it moves. */ 3909 another motion event, so we can check again the next time it moves. */
3905 3910
3906static int 3911static bool
3907note_mouse_movement (struct frame *frame, const XMotionEvent *event) 3912note_mouse_movement (struct frame *frame, const XMotionEvent *event)
3908{ 3913{
3909 XRectangle *r; 3914 XRectangle *r;
3910 struct x_display_info *dpyinfo; 3915 struct x_display_info *dpyinfo;
3911 3916
3912 if (!FRAME_X_OUTPUT (frame)) 3917 if (!FRAME_X_OUTPUT (frame))
3913 return 0; 3918 return false;
3914 3919
3915 dpyinfo = FRAME_DISPLAY_INFO (frame); 3920 dpyinfo = FRAME_DISPLAY_INFO (frame);
3916 dpyinfo->last_mouse_movement_time = event->time; 3921 dpyinfo->last_mouse_movement_time = event->time;
@@ -3920,11 +3925,11 @@ note_mouse_movement (struct frame *frame, const XMotionEvent *event)
3920 3925
3921 if (event->window != FRAME_X_WINDOW (frame)) 3926 if (event->window != FRAME_X_WINDOW (frame))
3922 { 3927 {
3923 frame->mouse_moved = 1; 3928 frame->mouse_moved = true;
3924 dpyinfo->last_mouse_scroll_bar = NULL; 3929 dpyinfo->last_mouse_scroll_bar = NULL;
3925 note_mouse_highlight (frame, -1, -1); 3930 note_mouse_highlight (frame, -1, -1);
3926 dpyinfo->last_mouse_glyph_frame = NULL; 3931 dpyinfo->last_mouse_glyph_frame = NULL;
3927 return 1; 3932 return true;
3928 } 3933 }
3929 3934
3930 3935
@@ -3934,16 +3939,16 @@ note_mouse_movement (struct frame *frame, const XMotionEvent *event)
3934 || event->x < r->x || event->x >= r->x + r->width 3939 || event->x < r->x || event->x >= r->x + r->width
3935 || event->y < r->y || event->y >= r->y + r->height) 3940 || event->y < r->y || event->y >= r->y + r->height)
3936 { 3941 {
3937 frame->mouse_moved = 1; 3942 frame->mouse_moved = true;
3938 dpyinfo->last_mouse_scroll_bar = NULL; 3943 dpyinfo->last_mouse_scroll_bar = NULL;
3939 note_mouse_highlight (frame, event->x, event->y); 3944 note_mouse_highlight (frame, event->x, event->y);
3940 /* Remember which glyph we're now on. */ 3945 /* Remember which glyph we're now on. */
3941 remember_mouse_glyph (frame, event->x, event->y, r); 3946 remember_mouse_glyph (frame, event->x, event->y, r);
3942 dpyinfo->last_mouse_glyph_frame = frame; 3947 dpyinfo->last_mouse_glyph_frame = frame;
3943 return 1; 3948 return true;
3944 } 3949 }
3945 3950
3946 return 0; 3951 return false;
3947} 3952}
3948 3953
3949/* Return the current position of the mouse. 3954/* Return the current position of the mouse.
@@ -3999,7 +4004,7 @@ XTmouse_position (struct frame **fp, int insist, Lisp_Object *bar_window,
3999 FOR_EACH_FRAME (tail, frame) 4004 FOR_EACH_FRAME (tail, frame)
4000 if (FRAME_X_P (XFRAME (frame)) 4005 if (FRAME_X_P (XFRAME (frame))
4001 && FRAME_X_DISPLAY (XFRAME (frame)) == FRAME_X_DISPLAY (*fp)) 4006 && FRAME_X_DISPLAY (XFRAME (frame)) == FRAME_X_DISPLAY (*fp))
4002 XFRAME (frame)->mouse_moved = 0; 4007 XFRAME (frame)->mouse_moved = false;
4003 4008
4004 dpyinfo->last_mouse_scroll_bar = NULL; 4009 dpyinfo->last_mouse_scroll_bar = NULL;
4005 4010
@@ -4060,7 +4065,7 @@ XTmouse_position (struct frame **fp, int insist, Lisp_Object *bar_window,
4060 } 4065 }
4061 else 4066 else
4062 { 4067 {
4063 while (1) 4068 while (true)
4064 { 4069 {
4065 XTranslateCoordinates (FRAME_X_DISPLAY (*fp), 4070 XTranslateCoordinates (FRAME_X_DISPLAY (*fp),
4066 4071
@@ -4284,7 +4289,7 @@ static void
4284xt_action_hook (Widget widget, XtPointer client_data, String action_name, 4289xt_action_hook (Widget widget, XtPointer client_data, String action_name,
4285 XEvent *event, String *params, Cardinal *num_params) 4290 XEvent *event, String *params, Cardinal *num_params)
4286{ 4291{
4287 int scroll_bar_p; 4292 bool scroll_bar_p;
4288 const char *end_action; 4293 const char *end_action;
4289 4294
4290#ifdef USE_MOTIF 4295#ifdef USE_MOTIF
@@ -4303,7 +4308,7 @@ xt_action_hook (Widget widget, XtPointer client_data, String action_name,
4303 struct scroll_bar *bar; 4308 struct scroll_bar *bar;
4304 4309
4305 x_send_scroll_bar_event (window_being_scrolled, 4310 x_send_scroll_bar_event (window_being_scrolled,
4306 scroll_bar_end_scroll, 0, 0, 0); 4311 scroll_bar_end_scroll, 0, 0, false);
4307 w = XWINDOW (window_being_scrolled); 4312 w = XWINDOW (window_being_scrolled);
4308 bar = XSCROLL_BAR (w->vertical_scroll_bar); 4313 bar = XSCROLL_BAR (w->vertical_scroll_bar);
4309 4314
@@ -4318,7 +4323,7 @@ xt_action_hook (Widget widget, XtPointer client_data, String action_name,
4318 bar->last_seen_part = scroll_bar_nowhere; 4323 bar->last_seen_part = scroll_bar_nowhere;
4319#endif 4324#endif
4320 /* Xt timeouts no longer needed. */ 4325 /* Xt timeouts no longer needed. */
4321 toolkit_scroll_bar_interaction = 0; 4326 toolkit_scroll_bar_interaction = false;
4322 } 4327 }
4323} 4328}
4324 4329
@@ -4327,7 +4332,7 @@ static void
4327xt_horizontal_action_hook (Widget widget, XtPointer client_data, String action_name, 4332xt_horizontal_action_hook (Widget widget, XtPointer client_data, String action_name,
4328 XEvent *event, String *params, Cardinal *num_params) 4333 XEvent *event, String *params, Cardinal *num_params)
4329{ 4334{
4330 int scroll_bar_p; 4335 bool scroll_bar_p;
4331 const char *end_action; 4336 const char *end_action;
4332 4337
4333#ifdef USE_MOTIF 4338#ifdef USE_MOTIF
@@ -4346,7 +4351,7 @@ xt_horizontal_action_hook (Widget widget, XtPointer client_data, String action_n
4346 struct scroll_bar *bar; 4351 struct scroll_bar *bar;
4347 4352
4348 x_send_scroll_bar_event (window_being_scrolled, 4353 x_send_scroll_bar_event (window_being_scrolled,
4349 scroll_bar_end_scroll, 0, 0, 1); 4354 scroll_bar_end_scroll, 0, 0, true);
4350 w = XWINDOW (window_being_scrolled); 4355 w = XWINDOW (window_being_scrolled);
4351 bar = XSCROLL_BAR (w->horizontal_scroll_bar); 4356 bar = XSCROLL_BAR (w->horizontal_scroll_bar);
4352 4357
@@ -4361,7 +4366,7 @@ xt_horizontal_action_hook (Widget widget, XtPointer client_data, String action_n
4361 bar->last_seen_part = scroll_bar_nowhere; 4366 bar->last_seen_part = scroll_bar_nowhere;
4362#endif 4367#endif
4363 /* Xt timeouts no longer needed. */ 4368 /* Xt timeouts no longer needed. */
4364 toolkit_scroll_bar_interaction = 0; 4369 toolkit_scroll_bar_interaction = false;
4365 } 4370 }
4366} 4371}
4367#endif /* not USE_GTK */ 4372#endif /* not USE_GTK */
@@ -4408,7 +4413,7 @@ x_send_scroll_bar_event (Lisp_Object window, enum scroll_bar_part part,
4408 4413
4409 /* Make Xt timeouts work while the scroll bar is active. */ 4414 /* Make Xt timeouts work while the scroll bar is active. */
4410#ifdef USE_X_TOOLKIT 4415#ifdef USE_X_TOOLKIT
4411 toolkit_scroll_bar_interaction = 1; 4416 toolkit_scroll_bar_interaction = true;
4412 x_activate_timeout_atimer (); 4417 x_activate_timeout_atimer ();
4413#endif 4418#endif
4414 4419
@@ -4507,7 +4512,8 @@ xm_scroll_callback (Widget widget, XtPointer client_data, XtPointer call_data)
4507 struct scroll_bar *bar = client_data; 4512 struct scroll_bar *bar = client_data;
4508 XmScrollBarCallbackStruct *cs = call_data; 4513 XmScrollBarCallbackStruct *cs = call_data;
4509 enum scroll_bar_part part = scroll_bar_nowhere; 4514 enum scroll_bar_part part = scroll_bar_nowhere;
4510 int horizontal = bar->horizontal, whole = 0, portion = 0; 4515 bool horizontal = bar->horizontal;
4516 int whole = 0, portion = 0;
4511 4517
4512 switch (cs->reason) 4518 switch (cs->reason)
4513 { 4519 {
@@ -4574,7 +4580,8 @@ xm_scroll_callback (Widget widget, XtPointer client_data, XtPointer call_data)
4574 if (part != scroll_bar_nowhere) 4580 if (part != scroll_bar_nowhere)
4575 { 4581 {
4576 window_being_scrolled = bar->window; 4582 window_being_scrolled = bar->window;
4577 x_send_scroll_bar_event (bar->window, part, portion, whole, bar->horizontal); 4583 x_send_scroll_bar_event (bar->window, part, portion, whole,
4584 bar->horizontal);
4578 } 4585 }
4579} 4586}
4580 4587
@@ -4647,7 +4654,8 @@ xg_scroll_callback (GtkRange *range,
4647 if (part != scroll_bar_nowhere) 4654 if (part != scroll_bar_nowhere)
4648 { 4655 {
4649 window_being_scrolled = bar->window; 4656 window_being_scrolled = bar->window;
4650 x_send_scroll_bar_event (bar->window, part, portion, whole, bar->horizontal); 4657 x_send_scroll_bar_event (bar->window, part, portion, whole,
4658 bar->horizontal);
4651 } 4659 }
4652 4660
4653 return FALSE; 4661 return FALSE;
@@ -4689,7 +4697,7 @@ xaw_jump_callback (Widget widget, XtPointer client_data, XtPointer call_data)
4689 float shown; 4697 float shown;
4690 int whole, portion, height, width; 4698 int whole, portion, height, width;
4691 enum scroll_bar_part part; 4699 enum scroll_bar_part part;
4692 int horizontal = bar->horizontal; 4700 bool horizontal = bar->horizontal;
4693 4701
4694 4702
4695 if (horizontal) 4703 if (horizontal)
@@ -4777,7 +4785,8 @@ xaw_scroll_callback (Widget widget, XtPointer client_data, XtPointer call_data)
4777 window_being_scrolled = bar->window; 4785 window_being_scrolled = bar->window;
4778 bar->dragging = -1; 4786 bar->dragging = -1;
4779 bar->last_seen_part = part; 4787 bar->last_seen_part = part;
4780 x_send_scroll_bar_event (bar->window, part, position, width, bar->horizontal); 4788 x_send_scroll_bar_event (bar->window, part, position, width,
4789 bar->horizontal);
4781 } 4790 }
4782 else 4791 else
4783 { 4792 {
@@ -4800,7 +4809,8 @@ xaw_scroll_callback (Widget widget, XtPointer client_data, XtPointer call_data)
4800 window_being_scrolled = bar->window; 4809 window_being_scrolled = bar->window;
4801 bar->dragging = -1; 4810 bar->dragging = -1;
4802 bar->last_seen_part = part; 4811 bar->last_seen_part = part;
4803 x_send_scroll_bar_event (bar->window, part, position, height, bar->horizontal); 4812 x_send_scroll_bar_event (bar->window, part, position, height,
4813 bar->horizontal);
4804 } 4814 }
4805} 4815}
4806 4816
@@ -5033,7 +5043,7 @@ x_create_toolkit_scroll_bar (struct frame *f, struct scroll_bar *bar)
5033 xwindow = XtWindow (widget); 5043 xwindow = XtWindow (widget);
5034 bar->x_window = xwindow; 5044 bar->x_window = xwindow;
5035 bar->whole = 1; 5045 bar->whole = 1;
5036 bar->horizontal = 0; 5046 bar->horizontal = false;
5037 5047
5038 unblock_input (); 5048 unblock_input ();
5039} 5049}
@@ -5233,7 +5243,7 @@ x_create_horizontal_toolkit_scroll_bar (struct frame *f, struct scroll_bar *bar)
5233 xwindow = XtWindow (widget); 5243 xwindow = XtWindow (widget);
5234 bar->x_window = xwindow; 5244 bar->x_window = xwindow;
5235 bar->whole = 1; 5245 bar->whole = 1;
5236 bar->horizontal = 1; 5246 bar->horizontal = true;
5237 5247
5238 unblock_input (); 5248 unblock_input ();
5239} 5249}
@@ -5408,7 +5418,7 @@ x_set_toolkit_horizontal_scroll_bar_thumb (struct scroll_bar *bar, int portion,
5408 XtNheight, &height, 5418 XtNheight, &height,
5409 NULL); 5419 NULL);
5410 5420
5411#if 0 5421#if false
5412 /* Massage the top+shown values. */ 5422 /* Massage the top+shown values. */
5413 if (bar->dragging == -1 || bar->last_seen_part == scroll_bar_down_arrow) 5423 if (bar->dragging == -1 || bar->last_seen_part == scroll_bar_down_arrow)
5414 top = max (0, min (1, top)); 5424 top = max (0, min (1, top));
@@ -5431,7 +5441,7 @@ x_set_toolkit_horizontal_scroll_bar_thumb (struct scroll_bar *bar, int portion,
5431 work, check that 'NARROWPROTO' is defined in src/config.h. 5441 work, check that 'NARROWPROTO' is defined in src/config.h.
5432 If this is not so, most likely you need to fix configure. */ 5442 If this is not so, most likely you need to fix configure. */
5433 XawScrollbarSetThumb (widget, top, shown); 5443 XawScrollbarSetThumb (widget, top, shown);
5434#if 0 5444#if false
5435 if (top != old_top || shown != old_shown) 5445 if (top != old_top || shown != old_shown)
5436 { 5446 {
5437 if (bar->dragging == -1) 5447 if (bar->dragging == -1)
@@ -5467,7 +5477,8 @@ x_set_toolkit_horizontal_scroll_bar_thumb (struct scroll_bar *bar, int portion,
5467 scroll bar. */ 5477 scroll bar. */
5468 5478
5469static struct scroll_bar * 5479static struct scroll_bar *
5470x_scroll_bar_create (struct window *w, int top, int left, int width, int height, bool horizontal) 5480x_scroll_bar_create (struct window *w, int top, int left,
5481 int width, int height, bool horizontal)
5471{ 5482{
5472 struct frame *f = XFRAME (w->frame); 5483 struct frame *f = XFRAME (w->frame);
5473 struct scroll_bar *bar 5484 struct scroll_bar *bar
@@ -5570,7 +5581,7 @@ x_scroll_bar_create (struct window *w, int top, int left, int width, int height,
5570/* Draw BAR's handle in the proper position. 5581/* Draw BAR's handle in the proper position.
5571 5582
5572 If the handle is already drawn from START to END, don't bother 5583 If the handle is already drawn from START to END, don't bother
5573 redrawing it, unless REBUILD is non-zero; in that case, always 5584 redrawing it, unless REBUILD; in that case, always
5574 redraw it. (REBUILD is handy for drawing the handle after expose 5585 redraw it. (REBUILD is handy for drawing the handle after expose
5575 events.) 5586 events.)
5576 5587
@@ -5581,7 +5592,8 @@ x_scroll_bar_create (struct window *w, int top, int left, int width, int height,
5581 to move to the very end of the buffer. */ 5592 to move to the very end of the buffer. */
5582 5593
5583static void 5594static void
5584x_scroll_bar_set_handle (struct scroll_bar *bar, int start, int end, int rebuild) 5595x_scroll_bar_set_handle (struct scroll_bar *bar, int start, int end,
5596 bool rebuild)
5585{ 5597{
5586 bool dragging = bar->dragging != -1; 5598 bool dragging = bar->dragging != -1;
5587 Window w = bar->x_window; 5599 Window w = bar->x_window;
@@ -5731,7 +5743,7 @@ XTset_vertical_scroll_bar (struct window *w, int portion, int whole, int positio
5731 unblock_input (); 5743 unblock_input ();
5732 } 5744 }
5733 5745
5734 bar = x_scroll_bar_create (w, top, left, width, max (height, 1), 0); 5746 bar = x_scroll_bar_create (w, top, left, width, max (height, 1), false);
5735 } 5747 }
5736 else 5748 else
5737 { 5749 {
@@ -5805,12 +5817,12 @@ XTset_vertical_scroll_bar (struct window *w, int portion, int whole, int positio
5805 int top_range = VERTICAL_SCROLL_BAR_TOP_RANGE (f, height); 5817 int top_range = VERTICAL_SCROLL_BAR_TOP_RANGE (f, height);
5806 5818
5807 if (whole == 0) 5819 if (whole == 0)
5808 x_scroll_bar_set_handle (bar, 0, top_range, 0); 5820 x_scroll_bar_set_handle (bar, 0, top_range, false);
5809 else 5821 else
5810 { 5822 {
5811 int start = ((double) position * top_range) / whole; 5823 int start = ((double) position * top_range) / whole;
5812 int end = ((double) (position + portion) * top_range) / whole; 5824 int end = ((double) (position + portion) * top_range) / whole;
5813 x_scroll_bar_set_handle (bar, start, end, 0); 5825 x_scroll_bar_set_handle (bar, start, end, false);
5814 } 5826 }
5815 } 5827 }
5816#endif /* not USE_TOOLKIT_SCROLL_BARS */ 5828#endif /* not USE_TOOLKIT_SCROLL_BARS */
@@ -5851,7 +5863,7 @@ XTset_horizontal_scroll_bar (struct window *w, int portion, int whole, int posit
5851 unblock_input (); 5863 unblock_input ();
5852 } 5864 }
5853 5865
5854 bar = x_scroll_bar_create (w, top, left, width, height, 1); 5866 bar = x_scroll_bar_create (w, top, left, width, height, true);
5855 } 5867 }
5856 else 5868 else
5857 { 5869 {
@@ -5937,12 +5949,12 @@ XTset_horizontal_scroll_bar (struct window *w, int portion, int whole, int posit
5937 int left_range = HORIZONTAL_SCROLL_BAR_LEFT_RANGE (f, width); 5949 int left_range = HORIZONTAL_SCROLL_BAR_LEFT_RANGE (f, width);
5938 5950
5939 if (whole == 0) 5951 if (whole == 0)
5940 x_scroll_bar_set_handle (bar, 0, left_range, 0); 5952 x_scroll_bar_set_handle (bar, 0, left_range, false);
5941 else 5953 else
5942 { 5954 {
5943 int start = ((double) position * left_range) / whole; 5955 int start = ((double) position * left_range) / whole;
5944 int end = ((double) (position + portion) * left_range) / whole; 5956 int end = ((double) (position + portion) * left_range) / whole;
5945 x_scroll_bar_set_handle (bar, start, end, 0); 5957 x_scroll_bar_set_handle (bar, start, end, false);
5946 } 5958 }
5947 } 5959 }
5948#endif /* not USE_TOOLKIT_SCROLL_BARS */ 5960#endif /* not USE_TOOLKIT_SCROLL_BARS */
@@ -6116,7 +6128,7 @@ x_scroll_bar_expose (struct scroll_bar *bar, const XEvent *event)
6116 6128
6117 block_input (); 6129 block_input ();
6118 6130
6119 x_scroll_bar_set_handle (bar, bar->start, bar->end, 1); 6131 x_scroll_bar_set_handle (bar, bar->start, bar->end, true);
6120 6132
6121 /* Switch to scroll bar foreground color. */ 6133 /* Switch to scroll bar foreground color. */
6122 if (f->output_data.x->scroll_bar_foreground_pixel != -1) 6134 if (f->output_data.x->scroll_bar_foreground_pixel != -1)
@@ -6190,7 +6202,7 @@ x_scroll_bar_handle_click (struct scroll_bar *bar,
6190 int new_start = - bar->dragging; 6202 int new_start = - bar->dragging;
6191 int new_end = new_start + bar->end - bar->start; 6203 int new_end = new_start + bar->end - bar->start;
6192 6204
6193 x_scroll_bar_set_handle (bar, new_start, new_end, 0); 6205 x_scroll_bar_set_handle (bar, new_start, new_end, false);
6194 bar->dragging = -1; 6206 bar->dragging = -1;
6195 } 6207 }
6196#endif 6208#endif
@@ -6221,7 +6233,7 @@ x_scroll_bar_handle_click (struct scroll_bar *bar,
6221 int new_start = y - bar->dragging; 6233 int new_start = y - bar->dragging;
6222 int new_end = new_start + bar->end - bar->start; 6234 int new_end = new_start + bar->end - bar->start;
6223 6235
6224 x_scroll_bar_set_handle (bar, new_start, new_end, 0); 6236 x_scroll_bar_set_handle (bar, new_start, new_end, false);
6225 bar->dragging = -1; 6237 bar->dragging = -1;
6226 } 6238 }
6227#endif 6239#endif
@@ -6247,7 +6259,7 @@ x_scroll_bar_note_movement (struct scroll_bar *bar,
6247 6259
6248 dpyinfo->last_mouse_movement_time = event->time; 6260 dpyinfo->last_mouse_movement_time = event->time;
6249 dpyinfo->last_mouse_scroll_bar = bar; 6261 dpyinfo->last_mouse_scroll_bar = bar;
6250 f->mouse_moved = 1; 6262 f->mouse_moved = true;
6251 6263
6252 /* If we're dragging the bar, display it. */ 6264 /* If we're dragging the bar, display it. */
6253 if (bar->dragging != -1) 6265 if (bar->dragging != -1)
@@ -6259,7 +6271,7 @@ x_scroll_bar_note_movement (struct scroll_bar *bar,
6259 { 6271 {
6260 int new_end = new_start + bar->end - bar->start; 6272 int new_end = new_start + bar->end - bar->start;
6261 6273
6262 x_scroll_bar_set_handle (bar, new_start, new_end, 0); 6274 x_scroll_bar_set_handle (bar, new_start, new_end, false);
6263 } 6275 }
6264 } 6276 }
6265} 6277}
@@ -6326,7 +6338,7 @@ x_scroll_bar_report_motion (struct frame **fp, Lisp_Object *bar_window,
6326 XSETINT (*x, win_y); 6338 XSETINT (*x, win_y);
6327 XSETINT (*y, top_range); 6339 XSETINT (*y, top_range);
6328 6340
6329 f->mouse_moved = 0; 6341 f->mouse_moved = false;
6330 dpyinfo->last_mouse_scroll_bar = NULL; 6342 dpyinfo->last_mouse_scroll_bar = NULL;
6331 *timestamp = dpyinfo->last_mouse_movement_time; 6343 *timestamp = dpyinfo->last_mouse_movement_time;
6332 } 6344 }
@@ -6395,7 +6407,7 @@ x_horizontal_scroll_bar_report_motion (struct frame **fp, Lisp_Object *bar_windo
6395 XSETINT (*y, win_x); 6407 XSETINT (*y, win_x);
6396 XSETINT (*x, left_range); 6408 XSETINT (*x, left_range);
6397 6409
6398 f->mouse_moved = 0; 6410 f->mouse_moved = false;
6399 dpyinfo->last_mouse_scroll_bar = NULL; 6411 dpyinfo->last_mouse_scroll_bar = NULL;
6400 *timestamp = dpyinfo->last_mouse_movement_time; 6412 *timestamp = dpyinfo->last_mouse_movement_time;
6401 } 6413 }
@@ -6551,9 +6563,9 @@ x_net_wm_state (struct frame *f, Window window)
6551{ 6563{
6552 int value = FULLSCREEN_NONE; 6564 int value = FULLSCREEN_NONE;
6553 Lisp_Object lval = Qnil; 6565 Lisp_Object lval = Qnil;
6554 int sticky = 0; 6566 bool sticky = false;
6555 6567
6556 (void)get_current_wm_state (f, window, &value, &sticky); 6568 get_current_wm_state (f, window, &value, &sticky);
6557 6569
6558 switch (value) 6570 switch (value)
6559 { 6571 {
@@ -6636,7 +6648,8 @@ handle_one_xevent (struct x_display_info *dpyinfo,
6636 if (f && FRAME_XIC (f)) 6648 if (f && FRAME_XIC (f))
6637 XSetICFocus (FRAME_XIC (f)); 6649 XSetICFocus (FRAME_XIC (f));
6638#endif 6650#endif
6639#if 0 /* Emacs sets WM hints whose `input' field is `true'. This 6651#if false
6652 /* Emacs sets WM hints whose `input' field is `true'. This
6640 instructs the WM to set the input focus automatically for 6653 instructs the WM to set the input focus automatically for
6641 Emacs with a call to XSetInputFocus. Setting WM_TAKE_FOCUS 6654 Emacs with a call to XSetInputFocus. Setting WM_TAKE_FOCUS
6642 tells the WM to send us a ClientMessage WM_TAKE_FOCUS after 6655 tells the WM to send us a ClientMessage WM_TAKE_FOCUS after
@@ -6669,7 +6682,7 @@ handle_one_xevent (struct x_display_info *dpyinfo,
6669 x_uncatch_errors (); 6682 x_uncatch_errors ();
6670 } 6683 }
6671 /* Not certain about handling scroll bars here */ 6684 /* Not certain about handling scroll bars here */
6672#endif /* 0 */ 6685#endif
6673 goto done; 6686 goto done;
6674 } 6687 }
6675 6688
@@ -6850,22 +6863,22 @@ handle_one_xevent (struct x_display_info *dpyinfo,
6850 f = x_top_window_to_frame (dpyinfo, event->xproperty.window); 6863 f = x_top_window_to_frame (dpyinfo, event->xproperty.window);
6851 if (f && event->xproperty.atom == dpyinfo->Xatom_net_wm_state) 6864 if (f && event->xproperty.atom == dpyinfo->Xatom_net_wm_state)
6852 { 6865 {
6853 int not_hidden = x_handle_net_wm_state (f, &event->xproperty); 6866 bool not_hidden = x_handle_net_wm_state (f, &event->xproperty);
6854 if (not_hidden && FRAME_ICONIFIED_P (f)) 6867 if (not_hidden && FRAME_ICONIFIED_P (f))
6855 { 6868 {
6856 /* Gnome shell does not iconify us when C-z is pressed. 6869 /* Gnome shell does not iconify us when C-z is pressed.
6857 It hides the frame. So if our state says we aren't 6870 It hides the frame. So if our state says we aren't
6858 hidden anymore, treat it as deiconified. */ 6871 hidden anymore, treat it as deiconified. */
6859 SET_FRAME_VISIBLE (f, 1); 6872 SET_FRAME_VISIBLE (f, 1);
6860 SET_FRAME_ICONIFIED (f, 0); 6873 SET_FRAME_ICONIFIED (f, false);
6861 f->output_data.x->has_been_visible = 1; 6874 f->output_data.x->has_been_visible = true;
6862 inev.ie.kind = DEICONIFY_EVENT; 6875 inev.ie.kind = DEICONIFY_EVENT;
6863 XSETFRAME (inev.ie.frame_or_window, f); 6876 XSETFRAME (inev.ie.frame_or_window, f);
6864 } 6877 }
6865 else if (! not_hidden && ! FRAME_ICONIFIED_P (f)) 6878 else if (! not_hidden && ! FRAME_ICONIFIED_P (f))
6866 { 6879 {
6867 SET_FRAME_VISIBLE (f, 0); 6880 SET_FRAME_VISIBLE (f, 0);
6868 SET_FRAME_ICONIFIED (f, 1); 6881 SET_FRAME_ICONIFIED (f, true);
6869 inev.ie.kind = ICONIFY_EVENT; 6882 inev.ie.kind = ICONIFY_EVENT;
6870 XSETFRAME (inev.ie.frame_or_window, f); 6883 XSETFRAME (inev.ie.frame_or_window, f);
6871 } 6884 }
@@ -6897,8 +6910,8 @@ handle_one_xevent (struct x_display_info *dpyinfo,
6897 if (!FRAME_VISIBLE_P (f)) 6910 if (!FRAME_VISIBLE_P (f))
6898 { 6911 {
6899 SET_FRAME_VISIBLE (f, 1); 6912 SET_FRAME_VISIBLE (f, 1);
6900 SET_FRAME_ICONIFIED (f, 0); 6913 SET_FRAME_ICONIFIED (f, false);
6901 f->output_data.x->has_been_visible = 1; 6914 f->output_data.x->has_been_visible = true;
6902 SET_FRAME_GARBAGED (f); 6915 SET_FRAME_GARBAGED (f);
6903 } 6916 }
6904 else 6917 else
@@ -6993,7 +7006,7 @@ handle_one_xevent (struct x_display_info *dpyinfo,
6993 and that way, we know the window is not iconified now. */ 7006 and that way, we know the window is not iconified now. */
6994 if (visible || FRAME_ICONIFIED_P (f)) 7007 if (visible || FRAME_ICONIFIED_P (f))
6995 { 7008 {
6996 SET_FRAME_ICONIFIED (f, 1); 7009 SET_FRAME_ICONIFIED (f, true);
6997 inev.ie.kind = ICONIFY_EVENT; 7010 inev.ie.kind = ICONIFY_EVENT;
6998 XSETFRAME (inev.ie.frame_or_window, f); 7011 XSETFRAME (inev.ie.frame_or_window, f);
6999 } 7012 }
@@ -7020,8 +7033,8 @@ handle_one_xevent (struct x_display_info *dpyinfo,
7020 x_check_fullscreen (f); 7033 x_check_fullscreen (f);
7021 7034
7022 SET_FRAME_VISIBLE (f, 1); 7035 SET_FRAME_VISIBLE (f, 1);
7023 SET_FRAME_ICONIFIED (f, 0); 7036 SET_FRAME_ICONIFIED (f, false);
7024 f->output_data.x->has_been_visible = 1; 7037 f->output_data.x->has_been_visible = true;
7025 7038
7026 if (iconified) 7039 if (iconified)
7027 { 7040 {
@@ -7060,7 +7073,7 @@ handle_one_xevent (struct x_display_info *dpyinfo,
7060 || !EQ (f->tool_bar_window, hlinfo->mouse_face_window))) 7073 || !EQ (f->tool_bar_window, hlinfo->mouse_face_window)))
7061 { 7074 {
7062 clear_mouse_face (hlinfo); 7075 clear_mouse_face (hlinfo);
7063 hlinfo->mouse_face_hidden = 1; 7076 hlinfo->mouse_face_hidden = true;
7064 } 7077 }
7065#endif 7078#endif
7066 7079
@@ -7321,8 +7334,8 @@ handle_one_xevent (struct x_display_info *dpyinfo,
7321 which depends on which X*LookupString function 7334 which depends on which X*LookupString function
7322 we used just above and the locale. */ 7335 we used just above and the locale. */
7323 setup_coding_system (coding_system, &coding); 7336 setup_coding_system (coding_system, &coding);
7324 coding.src_multibyte = 0; 7337 coding.src_multibyte = false;
7325 coding.dst_multibyte = 1; 7338 coding.dst_multibyte = true;
7326 /* The input is converted to events, thus we can't 7339 /* The input is converted to events, thus we can't
7327 handle composition. Anyway, there's no XIM that 7340 handle composition. Anyway, there's no XIM that
7328 gives us composition information. */ 7341 gives us composition information. */
@@ -7454,7 +7467,7 @@ handle_one_xevent (struct x_display_info *dpyinfo,
7454 7467
7455 if (hlinfo->mouse_face_hidden) 7468 if (hlinfo->mouse_face_hidden)
7456 { 7469 {
7457 hlinfo->mouse_face_hidden = 0; 7470 hlinfo->mouse_face_hidden = false;
7458 clear_mouse_face (hlinfo); 7471 clear_mouse_face (hlinfo);
7459 } 7472 }
7460 7473
@@ -7471,7 +7484,7 @@ handle_one_xevent (struct x_display_info *dpyinfo,
7471 { 7484 {
7472 static Lisp_Object last_mouse_window; 7485 static Lisp_Object last_mouse_window;
7473 Lisp_Object window = window_from_coordinates 7486 Lisp_Object window = window_from_coordinates
7474 (f, event->xmotion.x, event->xmotion.y, 0, 0); 7487 (f, event->xmotion.x, event->xmotion.y, 0, false);
7475 7488
7476 /* Window will be selected only when it is not selected now and 7489 /* Window will be selected only when it is not selected now and
7477 last mouse movement event was not in it. Minibuffer window 7490 last mouse movement event was not in it. Minibuffer window
@@ -7552,7 +7565,7 @@ handle_one_xevent (struct x_display_info *dpyinfo,
7552 || event->xconfigure.width != FRAME_PIXEL_WIDTH (f) 7565 || event->xconfigure.width != FRAME_PIXEL_WIDTH (f)
7553 || event->xconfigure.height != FRAME_PIXEL_HEIGHT (f)) 7566 || event->xconfigure.height != FRAME_PIXEL_HEIGHT (f))
7554 { 7567 {
7555 change_frame_size (f, width, height, 0, 1, 0, 1); 7568 change_frame_size (f, width, height, false, true, false, true);
7556 x_clear_under_internal_border (f); 7569 x_clear_under_internal_border (f);
7557 SET_FRAME_GARBAGED (f); 7570 SET_FRAME_GARBAGED (f);
7558 cancel_mouse_face (f); 7571 cancel_mouse_face (f);
@@ -7581,7 +7594,7 @@ handle_one_xevent (struct x_display_info *dpyinfo,
7581 { 7594 {
7582 /* If we decide we want to generate an event to be seen 7595 /* If we decide we want to generate an event to be seen
7583 by the rest of Emacs, we put it here. */ 7596 by the rest of Emacs, we put it here. */
7584 bool tool_bar_p = 0; 7597 bool tool_bar_p = false;
7585 7598
7586 memset (&compose_status, 0, sizeof (compose_status)); 7599 memset (&compose_status, 0, sizeof (compose_status));
7587 dpyinfo->last_mouse_glyph_frame = NULL; 7600 dpyinfo->last_mouse_glyph_frame = NULL;
@@ -7605,7 +7618,7 @@ handle_one_xevent (struct x_display_info *dpyinfo,
7605 int x = event->xbutton.x; 7618 int x = event->xbutton.x;
7606 int y = event->xbutton.y; 7619 int y = event->xbutton.y;
7607 7620
7608 window = window_from_coordinates (f, x, y, 0, 1); 7621 window = window_from_coordinates (f, x, y, 0, true);
7609 tool_bar_p = EQ (window, f->tool_bar_window); 7622 tool_bar_p = EQ (window, f->tool_bar_window);
7610 7623
7611 if (tool_bar_p && event->xbutton.button < 4) 7624 if (tool_bar_p && event->xbutton.button < 4)
@@ -7674,7 +7687,7 @@ handle_one_xevent (struct x_display_info *dpyinfo,
7674 any subsequent mouse-movement Emacs events should reflect 7687 any subsequent mouse-movement Emacs events should reflect
7675 only motion after the ButtonPress/Release. */ 7688 only motion after the ButtonPress/Release. */
7676 if (f != 0) 7689 if (f != 0)
7677 f->mouse_moved = 0; 7690 f->mouse_moved = false;
7678 7691
7679#if defined (USE_X_TOOLKIT) || defined (USE_GTK) 7692#if defined (USE_X_TOOLKIT) || defined (USE_GTK)
7680 f = x_menubar_window_to_frame (dpyinfo, event); 7693 f = x_menubar_window_to_frame (dpyinfo, event);
@@ -7766,7 +7779,7 @@ handle_one_xevent (struct x_display_info *dpyinfo,
7766 7779
7767 if (do_help > 0) 7780 if (do_help > 0)
7768 { 7781 {
7769 any_help_event_p = 1; 7782 any_help_event_p = true;
7770 gen_help_event (help_echo_string, frame, help_echo_window, 7783 gen_help_event (help_echo_string, frame, help_echo_window,
7771 help_echo_object, help_echo_pos); 7784 help_echo_object, help_echo_pos);
7772 } 7785 }
@@ -7813,7 +7826,7 @@ static int
7813XTread_socket (struct terminal *terminal, struct input_event *hold_quit) 7826XTread_socket (struct terminal *terminal, struct input_event *hold_quit)
7814{ 7827{
7815 int count = 0; 7828 int count = 0;
7816 int event_found = 0; 7829 bool event_found = false;
7817 struct x_display_info *dpyinfo = terminal->display_info.x; 7830 struct x_display_info *dpyinfo = terminal->display_info.x;
7818 7831
7819 block_input (); 7832 block_input ();
@@ -7838,7 +7851,7 @@ XTread_socket (struct terminal *terminal, struct input_event *hold_quit)
7838 if (x_filter_event (dpyinfo, &event)) 7851 if (x_filter_event (dpyinfo, &event))
7839 continue; 7852 continue;
7840#endif 7853#endif
7841 event_found = 1; 7854 event_found = true;
7842 7855
7843 count += handle_one_xevent (dpyinfo, &event, &finish, hold_quit); 7856 count += handle_one_xevent (dpyinfo, &event, &finish, hold_quit);
7844 7857
@@ -8038,7 +8051,7 @@ x_draw_bar_cursor (struct window *w, struct glyph_row *row, int width, enum text
8038 xgcv.background = xgcv.foreground = face->foreground; 8051 xgcv.background = xgcv.foreground = face->foreground;
8039 else 8052 else
8040 xgcv.background = xgcv.foreground = f->output_data.x->cursor_pixel; 8053 xgcv.background = xgcv.foreground = f->output_data.x->cursor_pixel;
8041 xgcv.graphics_exposures = 0; 8054 xgcv.graphics_exposures = False;
8042 8055
8043 if (gc) 8056 if (gc)
8044 XChangeGC (dpy, gc, mask, &xgcv); 8057 XChangeGC (dpy, gc, mask, &xgcv);
@@ -8134,14 +8147,14 @@ x_draw_window_cursor (struct window *w, struct glyph_row *glyph_row, int x,
8134 if (on_p) 8147 if (on_p)
8135 { 8148 {
8136 w->phys_cursor_type = cursor_type; 8149 w->phys_cursor_type = cursor_type;
8137 w->phys_cursor_on_p = 1; 8150 w->phys_cursor_on_p = true;
8138 8151
8139 if (glyph_row->exact_window_width_line_p 8152 if (glyph_row->exact_window_width_line_p
8140 && (glyph_row->reversed_p 8153 && (glyph_row->reversed_p
8141 ? (w->phys_cursor.hpos < 0) 8154 ? (w->phys_cursor.hpos < 0)
8142 : (w->phys_cursor.hpos >= glyph_row->used[TEXT_AREA]))) 8155 : (w->phys_cursor.hpos >= glyph_row->used[TEXT_AREA])))
8143 { 8156 {
8144 glyph_row->cursor_in_fringe_p = 1; 8157 glyph_row->cursor_in_fringe_p = true;
8145 draw_fringe_bitmap (w, glyph_row, glyph_row->reversed_p); 8158 draw_fringe_bitmap (w, glyph_row, glyph_row->reversed_p);
8146 } 8159 }
8147 else 8160 else
@@ -8188,13 +8201,13 @@ x_draw_window_cursor (struct window *w, struct glyph_row *glyph_row, int x,
8188 8201
8189/* Make the x-window of frame F use the gnu icon bitmap. */ 8202/* Make the x-window of frame F use the gnu icon bitmap. */
8190 8203
8191int 8204bool
8192x_bitmap_icon (struct frame *f, Lisp_Object file) 8205x_bitmap_icon (struct frame *f, Lisp_Object file)
8193{ 8206{
8194 ptrdiff_t bitmap_id; 8207 ptrdiff_t bitmap_id;
8195 8208
8196 if (FRAME_X_WINDOW (f) == 0) 8209 if (FRAME_X_WINDOW (f) == 0)
8197 return 1; 8210 return true;
8198 8211
8199 /* Free up our existing icon bitmap and mask if any. */ 8212 /* Free up our existing icon bitmap and mask if any. */
8200 if (f->output_data.x->icon_bitmap > 0) 8213 if (f->output_data.x->icon_bitmap > 0)
@@ -8207,7 +8220,7 @@ x_bitmap_icon (struct frame *f, Lisp_Object file)
8207 /* Use gtk_window_set_icon_from_file () if available, 8220 /* Use gtk_window_set_icon_from_file () if available,
8208 It's not restricted to bitmaps */ 8221 It's not restricted to bitmaps */
8209 if (xg_set_icon (f, file)) 8222 if (xg_set_icon (f, file))
8210 return 0; 8223 return false;
8211#endif /* USE_GTK */ 8224#endif /* USE_GTK */
8212 bitmap_id = x_create_bitmap_from_file (f, file); 8225 bitmap_id = x_create_bitmap_from_file (f, file);
8213 x_create_bitmap_mask (f, bitmap_id); 8226 x_create_bitmap_mask (f, bitmap_id);
@@ -8221,12 +8234,11 @@ x_bitmap_icon (struct frame *f, Lisp_Object file)
8221 8234
8222#ifdef USE_GTK 8235#ifdef USE_GTK
8223 8236
8224 if (FRAME_DISPLAY_INFO (f)->icon_bitmap_id == -2 8237 if (xg_set_icon (f, xg_default_icon_file)
8225 || xg_set_icon (f, xg_default_icon_file)
8226 || xg_set_icon_from_xpm_data (f, gnu_xpm_bits)) 8238 || xg_set_icon_from_xpm_data (f, gnu_xpm_bits))
8227 { 8239 {
8228 FRAME_DISPLAY_INFO (f)->icon_bitmap_id = -2; 8240 FRAME_DISPLAY_INFO (f)->icon_bitmap_id = -2;
8229 return 0; 8241 return false;
8230 } 8242 }
8231 8243
8232#elif defined (HAVE_XPM) && defined (HAVE_X_WINDOWS) 8244#elif defined (HAVE_XPM) && defined (HAVE_X_WINDOWS)
@@ -8243,7 +8255,7 @@ x_bitmap_icon (struct frame *f, Lisp_Object file)
8243 rc = x_create_bitmap_from_data (f, (char *) gnu_xbm_bits, 8255 rc = x_create_bitmap_from_data (f, (char *) gnu_xbm_bits,
8244 gnu_xbm_width, gnu_xbm_height); 8256 gnu_xbm_width, gnu_xbm_height);
8245 if (rc == -1) 8257 if (rc == -1)
8246 return 1; 8258 return true;
8247 8259
8248 FRAME_DISPLAY_INFO (f)->icon_bitmap_id = rc; 8260 FRAME_DISPLAY_INFO (f)->icon_bitmap_id = rc;
8249 x_create_bitmap_mask (f, FRAME_DISPLAY_INFO (f)->icon_bitmap_id); 8261 x_create_bitmap_mask (f, FRAME_DISPLAY_INFO (f)->icon_bitmap_id);
@@ -8262,18 +8274,18 @@ x_bitmap_icon (struct frame *f, Lisp_Object file)
8262 x_wm_set_icon_pixmap (f, bitmap_id); 8274 x_wm_set_icon_pixmap (f, bitmap_id);
8263 f->output_data.x->icon_bitmap = bitmap_id; 8275 f->output_data.x->icon_bitmap = bitmap_id;
8264 8276
8265 return 0; 8277 return false;
8266} 8278}
8267 8279
8268 8280
8269/* Make the x-window of frame F use a rectangle with text. 8281/* Make the x-window of frame F use a rectangle with text.
8270 Use ICON_NAME as the text. */ 8282 Use ICON_NAME as the text. */
8271 8283
8272int 8284bool
8273x_text_icon (struct frame *f, const char *icon_name) 8285x_text_icon (struct frame *f, const char *icon_name)
8274{ 8286{
8275 if (FRAME_X_WINDOW (f) == 0) 8287 if (FRAME_X_WINDOW (f) == 0)
8276 return 1; 8288 return true;
8277 8289
8278 { 8290 {
8279 XTextProperty text; 8291 XTextProperty text;
@@ -8289,7 +8301,7 @@ x_text_icon (struct frame *f, const char *icon_name)
8289 f->output_data.x->icon_bitmap = 0; 8301 f->output_data.x->icon_bitmap = 0;
8290 x_wm_set_icon_pixmap (f, 0); 8302 x_wm_set_icon_pixmap (f, 0);
8291 8303
8292 return 0; 8304 return false;
8293} 8305}
8294 8306
8295#define X_ERROR_MESSAGE_SIZE 200 8307#define X_ERROR_MESSAGE_SIZE 200
@@ -8407,7 +8419,8 @@ x_clear_errors (Display *dpy)
8407 x_error_message->string[0] = 0; 8419 x_error_message->string[0] = 0;
8408} 8420}
8409 8421
8410#if 0 /* See comment in unwind_to_catch why calling this is a bad 8422#if false
8423 /* See comment in unwind_to_catch why calling this is a bad
8411 * idea. --lorentey */ 8424 * idea. --lorentey */
8412/* Close off all unclosed x_catch_errors calls. */ 8425/* Close off all unclosed x_catch_errors calls. */
8413 8426
@@ -8419,13 +8432,13 @@ x_fully_uncatch_errors (void)
8419} 8432}
8420#endif 8433#endif
8421 8434
8422#if 0 8435#if false
8423static unsigned int x_wire_count; 8436static unsigned int x_wire_count;
8424x_trace_wire (void) 8437x_trace_wire (void)
8425{ 8438{
8426 fprintf (stderr, "Lib call: %d\n", ++x_wire_count); 8439 fprintf (stderr, "Lib call: %d\n", ++x_wire_count);
8427} 8440}
8428#endif /* ! 0 */ 8441#endif
8429 8442
8430 8443
8431/************************************************************************ 8444/************************************************************************
@@ -8664,7 +8677,7 @@ x_new_font (struct frame *f, Lisp_Object font_object, int fontset)
8664 if (NILP (tip_frame) || XFRAME (tip_frame) != f) 8677 if (NILP (tip_frame) || XFRAME (tip_frame) != f)
8665 adjust_frame_size (f, FRAME_COLS (f) * FRAME_COLUMN_WIDTH (f), 8678 adjust_frame_size (f, FRAME_COLS (f) * FRAME_COLUMN_WIDTH (f),
8666 FRAME_LINES (f) * FRAME_LINE_HEIGHT (f), 3, 8679 FRAME_LINES (f) * FRAME_LINE_HEIGHT (f), 3,
8667 0, Qfont); 8680 false, Qfont);
8668 } 8681 }
8669 8682
8670#ifdef HAVE_X_I18N 8683#ifdef HAVE_X_I18N
@@ -8954,7 +8967,7 @@ x_set_offset (struct frame *f, register int xoff, register int yoff, int change_
8954 x_calc_absolute_position (f); 8967 x_calc_absolute_position (f);
8955 8968
8956 block_input (); 8969 block_input ();
8957 x_wm_set_size_hint (f, 0, 0); 8970 x_wm_set_size_hint (f, 0, false);
8958 8971
8959 modified_left = f->left_pos; 8972 modified_left = f->left_pos;
8960 modified_top = f->top_pos; 8973 modified_top = f->top_pos;
@@ -8972,8 +8985,7 @@ x_set_offset (struct frame *f, register int xoff, register int yoff, int change_
8972 modified_left, modified_top); 8985 modified_left, modified_top);
8973 8986
8974 x_sync_with_move (f, f->left_pos, f->top_pos, 8987 x_sync_with_move (f, f->left_pos, f->top_pos,
8975 FRAME_DISPLAY_INFO (f)->wm_type == X_WMTYPE_UNKNOWN 8988 FRAME_DISPLAY_INFO (f)->wm_type == X_WMTYPE_UNKNOWN);
8976 ? 1 : 0);
8977 8989
8978 /* change_gravity is non-zero when this function is called from Lisp to 8990 /* change_gravity is non-zero when this function is called from Lisp to
8979 programmatically move a frame. In that case, we call 8991 programmatically move a frame. In that case, we call
@@ -8985,32 +8997,33 @@ x_set_offset (struct frame *f, register int xoff, register int yoff, int change_
8985 either the window manager type (A/B) is unknown or it is Type A but we 8997 either the window manager type (A/B) is unknown or it is Type A but we
8986 need to compute the top/left offset adjustment for this frame. */ 8998 need to compute the top/left offset adjustment for this frame. */
8987 8999
8988 if (change_gravity != 0 && 9000 if (change_gravity != 0
8989 (FRAME_DISPLAY_INFO (f)->wm_type == X_WMTYPE_UNKNOWN 9001 && (FRAME_DISPLAY_INFO (f)->wm_type == X_WMTYPE_UNKNOWN
8990 || (FRAME_DISPLAY_INFO (f)->wm_type == X_WMTYPE_A 9002 || (FRAME_DISPLAY_INFO (f)->wm_type == X_WMTYPE_A
8991 && (FRAME_X_OUTPUT (f)->move_offset_left == 0 9003 && (FRAME_X_OUTPUT (f)->move_offset_left == 0
8992 && FRAME_X_OUTPUT (f)->move_offset_top == 0)))) 9004 && FRAME_X_OUTPUT (f)->move_offset_top == 0))))
8993 x_check_expected_move (f, modified_left, modified_top); 9005 x_check_expected_move (f, modified_left, modified_top);
8994 9006
8995 unblock_input (); 9007 unblock_input ();
8996} 9008}
8997 9009
8998/* Return non-zero if _NET_SUPPORTING_WM_CHECK window exists and _NET_SUPPORTED 9010/* Return true if _NET_SUPPORTING_WM_CHECK window exists and _NET_SUPPORTED
8999 on the root window for frame F contains ATOMNAME. 9011 on the root window for frame F contains ATOMNAME.
9000 This is how a WM check shall be done according to the Window Manager 9012 This is how a WM check shall be done according to the Window Manager
9001 Specification/Extended Window Manager Hints at 9013 Specification/Extended Window Manager Hints at
9002 http://freedesktop.org/wiki/Specifications/wm-spec. */ 9014 http://freedesktop.org/wiki/Specifications/wm-spec. */
9003 9015
9004static int 9016static bool
9005wm_supports (struct frame *f, Atom want_atom) 9017wm_supports (struct frame *f, Atom want_atom)
9006{ 9018{
9007 Atom actual_type; 9019 Atom actual_type;
9008 unsigned long actual_size, bytes_remaining; 9020 unsigned long actual_size, bytes_remaining;
9009 int i, rc, actual_format; 9021 int i, rc, actual_format;
9022 bool ret;
9010 Window wmcheck_window; 9023 Window wmcheck_window;
9011 struct x_display_info *dpyinfo = FRAME_DISPLAY_INFO (f); 9024 struct x_display_info *dpyinfo = FRAME_DISPLAY_INFO (f);
9012 Window target_window = dpyinfo->root_window; 9025 Window target_window = dpyinfo->root_window;
9013 long max_len = 65536; 9026 int max_len = 65536;
9014 Display *dpy = FRAME_X_DISPLAY (f); 9027 Display *dpy = FRAME_X_DISPLAY (f);
9015 unsigned char *tmp_data = NULL; 9028 unsigned char *tmp_data = NULL;
9016 Atom target_type = XA_WINDOW; 9029 Atom target_type = XA_WINDOW;
@@ -9029,7 +9042,7 @@ wm_supports (struct frame *f, Atom want_atom)
9029 if (tmp_data) XFree (tmp_data); 9042 if (tmp_data) XFree (tmp_data);
9030 x_uncatch_errors (); 9043 x_uncatch_errors ();
9031 unblock_input (); 9044 unblock_input ();
9032 return 0; 9045 return false;
9033 } 9046 }
9034 9047
9035 wmcheck_window = *(Window *) tmp_data; 9048 wmcheck_window = *(Window *) tmp_data;
@@ -9042,7 +9055,7 @@ wm_supports (struct frame *f, Atom want_atom)
9042 { 9055 {
9043 x_uncatch_errors (); 9056 x_uncatch_errors ();
9044 unblock_input (); 9057 unblock_input ();
9045 return 0; 9058 return false;
9046 } 9059 }
9047 9060
9048 if (dpyinfo->net_supported_window != wmcheck_window) 9061 if (dpyinfo->net_supported_window != wmcheck_window)
@@ -9067,7 +9080,7 @@ wm_supports (struct frame *f, Atom want_atom)
9067 if (tmp_data) XFree (tmp_data); 9080 if (tmp_data) XFree (tmp_data);
9068 x_uncatch_errors (); 9081 x_uncatch_errors ();
9069 unblock_input (); 9082 unblock_input ();
9070 return 0; 9083 return false;
9071 } 9084 }
9072 9085
9073 dpyinfo->net_supported_atoms = (Atom *)tmp_data; 9086 dpyinfo->net_supported_atoms = (Atom *)tmp_data;
@@ -9075,19 +9088,19 @@ wm_supports (struct frame *f, Atom want_atom)
9075 dpyinfo->net_supported_window = wmcheck_window; 9088 dpyinfo->net_supported_window = wmcheck_window;
9076 } 9089 }
9077 9090
9078 rc = 0; 9091 ret = false;
9079 9092
9080 for (i = 0; rc == 0 && i < dpyinfo->nr_net_supported_atoms; ++i) 9093 for (i = 0; !ret && i < dpyinfo->nr_net_supported_atoms; ++i)
9081 rc = dpyinfo->net_supported_atoms[i] == want_atom; 9094 ret = dpyinfo->net_supported_atoms[i] == want_atom;
9082 9095
9083 x_uncatch_errors (); 9096 x_uncatch_errors ();
9084 unblock_input (); 9097 unblock_input ();
9085 9098
9086 return rc; 9099 return ret;
9087} 9100}
9088 9101
9089static void 9102static void
9090set_wm_state (Lisp_Object frame, int add, Atom atom, Atom value) 9103set_wm_state (Lisp_Object frame, bool add, Atom atom, Atom value)
9091{ 9104{
9092 struct x_display_info *dpyinfo = FRAME_DISPLAY_INFO (XFRAME (frame)); 9105 struct x_display_info *dpyinfo = FRAME_DISPLAY_INFO (XFRAME (frame));
9093 9106
@@ -9096,7 +9109,7 @@ set_wm_state (Lisp_Object frame, int add, Atom atom, Atom value)
9096 make_number (32), 9109 make_number (32),
9097 /* 1 = add, 0 = remove */ 9110 /* 1 = add, 0 = remove */
9098 Fcons 9111 Fcons
9099 (make_number (add ? 1 : 0), 9112 (make_number (add),
9100 Fcons 9113 Fcons
9101 (make_fixnum_or_float (atom), 9114 (make_fixnum_or_float (atom),
9102 (value != 0 9115 (value != 0
@@ -9112,32 +9125,33 @@ x_set_sticky (struct frame *f, Lisp_Object new_value, Lisp_Object old_value)
9112 9125
9113 XSETFRAME (frame, f); 9126 XSETFRAME (frame, f);
9114 9127
9115 set_wm_state (frame, NILP (new_value) ? 0 : 1, 9128 set_wm_state (frame, !NILP (new_value),
9116 dpyinfo->Xatom_net_wm_state_sticky, None); 9129 dpyinfo->Xatom_net_wm_state_sticky, None);
9117} 9130}
9118 9131
9119/* Return the current _NET_WM_STATE. 9132/* Return the current _NET_WM_STATE.
9120 SIZE_STATE is set to one of the FULLSCREEN_* values. 9133 SIZE_STATE is set to one of the FULLSCREEN_* values.
9121 STICKY is set to 1 if the sticky state is set, 0 if not. 9134 Set *STICKY to the sticky state.
9122 9135
9123 Return non-zero if we are not hidden, zero if we are. */ 9136 Return true iff we are not hidden. */
9124 9137
9125static int 9138static bool
9126get_current_wm_state (struct frame *f, 9139get_current_wm_state (struct frame *f,
9127 Window window, 9140 Window window,
9128 int *size_state, 9141 int *size_state,
9129 int *sticky) 9142 bool *sticky)
9130{ 9143{
9131 Atom actual_type; 9144 Atom actual_type;
9132 unsigned long actual_size, bytes_remaining; 9145 unsigned long actual_size, bytes_remaining;
9133 int i, rc, actual_format, is_hidden = 0; 9146 int i, rc, actual_format;
9147 bool is_hidden = false;
9134 struct x_display_info *dpyinfo = FRAME_DISPLAY_INFO (f); 9148 struct x_display_info *dpyinfo = FRAME_DISPLAY_INFO (f);
9135 long max_len = 65536; 9149 long max_len = 65536;
9136 Display *dpy = FRAME_X_DISPLAY (f); 9150 Display *dpy = FRAME_X_DISPLAY (f);
9137 unsigned char *tmp_data = NULL; 9151 unsigned char *tmp_data = NULL;
9138 Atom target_type = XA_ATOM; 9152 Atom target_type = XA_ATOM;
9139 9153
9140 *sticky = 0; 9154 *sticky = false;
9141 *size_state = FULLSCREEN_NONE; 9155 *size_state = FULLSCREEN_NONE;
9142 9156
9143 block_input (); 9157 block_input ();
@@ -9161,9 +9175,7 @@ get_current_wm_state (struct frame *f,
9161 { 9175 {
9162 Atom a = ((Atom*)tmp_data)[i]; 9176 Atom a = ((Atom*)tmp_data)[i];
9163 if (a == dpyinfo->Xatom_net_wm_state_hidden) 9177 if (a == dpyinfo->Xatom_net_wm_state_hidden)
9164 { 9178 is_hidden = true;
9165 is_hidden = 1;
9166 }
9167 else if (a == dpyinfo->Xatom_net_wm_state_maximized_horz) 9179 else if (a == dpyinfo->Xatom_net_wm_state_maximized_horz)
9168 { 9180 {
9169 if (*size_state == FULLSCREEN_HEIGHT) 9181 if (*size_state == FULLSCREEN_HEIGHT)
@@ -9181,7 +9193,7 @@ get_current_wm_state (struct frame *f,
9181 else if (a == dpyinfo->Xatom_net_wm_state_fullscreen) 9193 else if (a == dpyinfo->Xatom_net_wm_state_fullscreen)
9182 *size_state = FULLSCREEN_BOTH; 9194 *size_state = FULLSCREEN_BOTH;
9183 else if (a == dpyinfo->Xatom_net_wm_state_sticky) 9195 else if (a == dpyinfo->Xatom_net_wm_state_sticky)
9184 *sticky = 1; 9196 *sticky = true;
9185 } 9197 }
9186 9198
9187 if (tmp_data) XFree (tmp_data); 9199 if (tmp_data) XFree (tmp_data);
@@ -9191,14 +9203,15 @@ get_current_wm_state (struct frame *f,
9191 9203
9192/* Do fullscreen as specified in extended window manager hints */ 9204/* Do fullscreen as specified in extended window manager hints */
9193 9205
9194static int 9206static bool
9195do_ewmh_fullscreen (struct frame *f) 9207do_ewmh_fullscreen (struct frame *f)
9196{ 9208{
9197 struct x_display_info *dpyinfo = FRAME_DISPLAY_INFO (f); 9209 struct x_display_info *dpyinfo = FRAME_DISPLAY_INFO (f);
9198 int have_net_atom = wm_supports (f, dpyinfo->Xatom_net_wm_state); 9210 bool have_net_atom = wm_supports (f, dpyinfo->Xatom_net_wm_state);
9199 int cur, dummy; 9211 int cur;
9212 bool dummy;
9200 9213
9201 (void)get_current_wm_state (f, FRAME_OUTER_WINDOW (f), &cur, &dummy); 9214 get_current_wm_state (f, FRAME_OUTER_WINDOW (f), &cur, &dummy);
9202 9215
9203 /* Some window managers don't say they support _NET_WM_STATE, but they do say 9216 /* Some window managers don't say they support _NET_WM_STATE, but they do say
9204 they support _NET_WM_STATE_FULLSCREEN. Try that also. */ 9217 they support _NET_WM_STATE_FULLSCREEN. Try that also. */
@@ -9219,37 +9232,45 @@ do_ewmh_fullscreen (struct frame *f)
9219 case FULLSCREEN_BOTH: 9232 case FULLSCREEN_BOTH:
9220 if (cur == FULLSCREEN_WIDTH || cur == FULLSCREEN_MAXIMIZED 9233 if (cur == FULLSCREEN_WIDTH || cur == FULLSCREEN_MAXIMIZED
9221 || cur == FULLSCREEN_HEIGHT) 9234 || cur == FULLSCREEN_HEIGHT)
9222 set_wm_state (frame, 0, dpyinfo->Xatom_net_wm_state_maximized_horz, 9235 set_wm_state (frame, false,
9236 dpyinfo->Xatom_net_wm_state_maximized_horz,
9223 dpyinfo->Xatom_net_wm_state_maximized_vert); 9237 dpyinfo->Xatom_net_wm_state_maximized_vert);
9224 set_wm_state (frame, 1, dpyinfo->Xatom_net_wm_state_fullscreen, None); 9238 set_wm_state (frame, true,
9239 dpyinfo->Xatom_net_wm_state_fullscreen, None);
9225 break; 9240 break;
9226 case FULLSCREEN_WIDTH: 9241 case FULLSCREEN_WIDTH:
9227 if (cur == FULLSCREEN_BOTH || cur == FULLSCREEN_HEIGHT 9242 if (cur == FULLSCREEN_BOTH || cur == FULLSCREEN_HEIGHT
9228 || cur == FULLSCREEN_MAXIMIZED) 9243 || cur == FULLSCREEN_MAXIMIZED)
9229 set_wm_state (frame, 0, dpyinfo->Xatom_net_wm_state_fullscreen, 9244 set_wm_state (frame, false, dpyinfo->Xatom_net_wm_state_fullscreen,
9230 dpyinfo->Xatom_net_wm_state_maximized_vert); 9245 dpyinfo->Xatom_net_wm_state_maximized_vert);
9231 if (cur != FULLSCREEN_MAXIMIZED) 9246 if (cur != FULLSCREEN_MAXIMIZED)
9232 set_wm_state (frame, 1, dpyinfo->Xatom_net_wm_state_maximized_horz, None); 9247 set_wm_state (frame, true,
9248 dpyinfo->Xatom_net_wm_state_maximized_horz, None);
9233 break; 9249 break;
9234 case FULLSCREEN_HEIGHT: 9250 case FULLSCREEN_HEIGHT:
9235 if (cur == FULLSCREEN_BOTH || cur == FULLSCREEN_WIDTH 9251 if (cur == FULLSCREEN_BOTH || cur == FULLSCREEN_WIDTH
9236 || cur == FULLSCREEN_MAXIMIZED) 9252 || cur == FULLSCREEN_MAXIMIZED)
9237 set_wm_state (frame, 0, dpyinfo->Xatom_net_wm_state_fullscreen, 9253 set_wm_state (frame, false, dpyinfo->Xatom_net_wm_state_fullscreen,
9238 dpyinfo->Xatom_net_wm_state_maximized_horz); 9254 dpyinfo->Xatom_net_wm_state_maximized_horz);
9239 if (cur != FULLSCREEN_MAXIMIZED) 9255 if (cur != FULLSCREEN_MAXIMIZED)
9240 set_wm_state (frame, 1, dpyinfo->Xatom_net_wm_state_maximized_vert, None); 9256 set_wm_state (frame, true,
9257 dpyinfo->Xatom_net_wm_state_maximized_vert, None);
9241 break; 9258 break;
9242 case FULLSCREEN_MAXIMIZED: 9259 case FULLSCREEN_MAXIMIZED:
9243 if (cur == FULLSCREEN_BOTH) 9260 if (cur == FULLSCREEN_BOTH)
9244 set_wm_state (frame, 0, dpyinfo->Xatom_net_wm_state_fullscreen, None); 9261 set_wm_state (frame, false, dpyinfo->Xatom_net_wm_state_fullscreen,
9245 set_wm_state (frame, 1, dpyinfo->Xatom_net_wm_state_maximized_horz, 9262 None);
9263 set_wm_state (frame, true,
9264 dpyinfo->Xatom_net_wm_state_maximized_horz,
9246 dpyinfo->Xatom_net_wm_state_maximized_vert); 9265 dpyinfo->Xatom_net_wm_state_maximized_vert);
9247 break; 9266 break;
9248 case FULLSCREEN_NONE: 9267 case FULLSCREEN_NONE:
9249 if (cur == FULLSCREEN_BOTH) 9268 if (cur == FULLSCREEN_BOTH)
9250 set_wm_state (frame, 0, dpyinfo->Xatom_net_wm_state_fullscreen, None); 9269 set_wm_state (frame, false, dpyinfo->Xatom_net_wm_state_fullscreen,
9270 None);
9251 else 9271 else
9252 set_wm_state (frame, 0, dpyinfo->Xatom_net_wm_state_maximized_horz, 9272 set_wm_state (frame, false,
9273 dpyinfo->Xatom_net_wm_state_maximized_horz,
9253 dpyinfo->Xatom_net_wm_state_maximized_vert); 9274 dpyinfo->Xatom_net_wm_state_maximized_vert);
9254 } 9275 }
9255 9276
@@ -9273,13 +9294,13 @@ XTfullscreen_hook (struct frame *f)
9273} 9294}
9274 9295
9275 9296
9276static int 9297static bool
9277x_handle_net_wm_state (struct frame *f, const XPropertyEvent *event) 9298x_handle_net_wm_state (struct frame *f, const XPropertyEvent *event)
9278{ 9299{
9279 int value = FULLSCREEN_NONE; 9300 int value = FULLSCREEN_NONE;
9280 Lisp_Object lval; 9301 Lisp_Object lval;
9281 int sticky = 0; 9302 bool sticky = false;
9282 int not_hidden = get_current_wm_state (f, event->window, &value, &sticky); 9303 bool not_hidden = get_current_wm_state (f, event->window, &value, &sticky);
9283 9304
9284 lval = Qnil; 9305 lval = Qnil;
9285 switch (value) 9306 switch (value)
@@ -9381,7 +9402,7 @@ x_check_expected_move (struct frame *f, int expected_left, int expected_top)
9381 XMoveWindow (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f), 9402 XMoveWindow (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f),
9382 adjusted_left, adjusted_top); 9403 adjusted_left, adjusted_top);
9383 9404
9384 x_sync_with_move (f, expected_left, expected_top, 0); 9405 x_sync_with_move (f, expected_left, expected_top, false);
9385 } 9406 }
9386 else 9407 else
9387 /* It's a "Type B" window manager. We don't have to adjust the 9408 /* It's a "Type B" window manager. We don't have to adjust the
@@ -9398,7 +9419,7 @@ x_check_expected_move (struct frame *f, int expected_left, int expected_top)
9398 of an exact comparison. */ 9419 of an exact comparison. */
9399 9420
9400static void 9421static void
9401x_sync_with_move (struct frame *f, int left, int top, int fuzzy) 9422x_sync_with_move (struct frame *f, int left, int top, bool fuzzy)
9402{ 9423{
9403 int count = 0; 9424 int count = 0;
9404 9425
@@ -9429,7 +9450,7 @@ x_sync_with_move (struct frame *f, int left, int top, int fuzzy)
9429 /* As a last resort, just wait 0.5 seconds and hope that XGetGeometry 9450 /* As a last resort, just wait 0.5 seconds and hope that XGetGeometry
9430 will then return up-to-date position info. */ 9451 will then return up-to-date position info. */
9431 9452
9432 wait_reading_process_output (0, 500000000, 0, 0, Qnil, NULL, 0); 9453 wait_reading_process_output (0, 500000000, 0, false, Qnil, NULL, 0);
9433} 9454}
9434 9455
9435 9456
@@ -9452,7 +9473,7 @@ x_wait_for_event (struct frame *f, int eventtype)
9452 9473
9453 while (f->wait_event_type) 9474 while (f->wait_event_type)
9454 { 9475 {
9455 pending_signals = 1; 9476 pending_signals = true;
9456 totally_unblock_input (); 9477 totally_unblock_input ();
9457 /* XTread_socket is called after unblock. */ 9478 /* XTread_socket is called after unblock. */
9458 block_input (); 9479 block_input ();
@@ -9475,12 +9496,13 @@ x_wait_for_event (struct frame *f, int eventtype)
9475 9496
9476 9497
9477/* Change the size of frame F's X window to WIDTH/HEIGHT in the case F 9498/* Change the size of frame F's X window to WIDTH/HEIGHT in the case F
9478 doesn't have a widget. If CHANGE_GRAVITY is 1, we change to 9499 doesn't have a widget. If CHANGE_GRAVITY, change to
9479 top-left-corner window gravity for this size change and subsequent 9500 top-left-corner window gravity for this size change and subsequent
9480 size changes. Otherwise we leave the window gravity unchanged. */ 9501 size changes. Otherwise leave the window gravity unchanged. */
9481 9502
9482static void 9503static void
9483x_set_window_size_1 (struct frame *f, int change_gravity, int width, int height, bool pixelwise) 9504x_set_window_size_1 (struct frame *f, bool change_gravity,
9505 int width, int height, bool pixelwise)
9484{ 9506{
9485 int pixelwidth, pixelheight; 9507 int pixelwidth, pixelheight;
9486 9508
@@ -9492,7 +9514,7 @@ x_set_window_size_1 (struct frame *f, int change_gravity, int width, int height,
9492 : FRAME_TEXT_LINES_TO_PIXEL_HEIGHT (f, height))); 9514 : FRAME_TEXT_LINES_TO_PIXEL_HEIGHT (f, height)));
9493 9515
9494 if (change_gravity) f->win_gravity = NorthWestGravity; 9516 if (change_gravity) f->win_gravity = NorthWestGravity;
9495 x_wm_set_size_hint (f, 0, 0); 9517 x_wm_set_size_hint (f, 0, false);
9496 XResizeWindow (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f), 9518 XResizeWindow (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f),
9497 pixelwidth, pixelheight + FRAME_MENUBAR_HEIGHT (f)); 9519 pixelwidth, pixelheight + FRAME_MENUBAR_HEIGHT (f));
9498 9520
@@ -9514,7 +9536,7 @@ x_set_window_size_1 (struct frame *f, int change_gravity, int width, int height,
9514 wouldn't be reported in the frame parameters until some random 9536 wouldn't be reported in the frame parameters until some random
9515 point in the future when the ConfigureNotify event arrives. 9537 point in the future when the ConfigureNotify event arrives.
9516 9538
9517 We pass 1 for DELAY since we can't run Lisp code inside of 9539 Pass true for DELAY since we can't run Lisp code inside of
9518 a BLOCK_INPUT. */ 9540 a BLOCK_INPUT. */
9519 9541
9520 /* But the ConfigureNotify may in fact never arrive, and then this is 9542 /* But the ConfigureNotify may in fact never arrive, and then this is
@@ -9524,25 +9546,26 @@ x_set_window_size_1 (struct frame *f, int change_gravity, int width, int height,
9524 x_wait_for_event (f, ConfigureNotify); 9546 x_wait_for_event (f, ConfigureNotify);
9525 else 9547 else
9526 { 9548 {
9527 change_frame_size (f, pixelwidth, pixelheight, 0, 1, 0, 1); 9549 change_frame_size (f, pixelwidth, pixelheight, false, true, false, true);
9528 x_sync (f); 9550 x_sync (f);
9529 } 9551 }
9530} 9552}
9531 9553
9532 9554
9533/* Call this to change the size of frame F's x-window. 9555/* Call this to change the size of frame F's x-window.
9534 If CHANGE_GRAVITY is 1, we change to top-left-corner window gravity 9556 If CHANGE_GRAVITY, change to top-left-corner window gravity
9535 for this size change and subsequent size changes. 9557 for this size change and subsequent size changes.
9536 Otherwise we leave the window gravity unchanged. */ 9558 Otherwise we leave the window gravity unchanged. */
9537 9559
9538void 9560void
9539x_set_window_size (struct frame *f, int change_gravity, int width, int height, bool pixelwise) 9561x_set_window_size (struct frame *f, bool change_gravity,
9562 int width, int height, bool pixelwise)
9540{ 9563{
9541 block_input (); 9564 block_input ();
9542 9565
9543 /* The following breaks our calculations. If it's really needed, 9566 /* The following breaks our calculations. If it's really needed,
9544 think of something else. */ 9567 think of something else. */
9545#if 0 9568#if false
9546 if (NILP (tip_frame) || XFRAME (tip_frame) != f) 9569 if (NILP (tip_frame) || XFRAME (tip_frame) != f)
9547 { 9570 {
9548 int text_width, text_height; 9571 int text_width, text_height;
@@ -9563,7 +9586,7 @@ x_set_window_size (struct frame *f, int change_gravity, int width, int height, b
9563 text_width = FRAME_PIXEL_TO_TEXT_WIDTH (f, FRAME_PIXEL_WIDTH (f)); 9586 text_width = FRAME_PIXEL_TO_TEXT_WIDTH (f, FRAME_PIXEL_WIDTH (f));
9564 text_height = FRAME_PIXEL_TO_TEXT_HEIGHT (f, pixelh); 9587 text_height = FRAME_PIXEL_TO_TEXT_HEIGHT (f, pixelh);
9565 9588
9566 change_frame_size (f, text_width, text_height, 0, 1, 0, 1); 9589 change_frame_size (f, text_width, text_height, false, true, false, true);
9567 } 9590 }
9568#endif 9591#endif
9569 9592
@@ -9594,7 +9617,7 @@ x_set_window_size (struct frame *f, int change_gravity, int width, int height, b
9594 9617
9595 unblock_input (); 9618 unblock_input ();
9596 9619
9597 do_pending_window_change (0); 9620 do_pending_window_change (false);
9598} 9621}
9599 9622
9600/* Move the mouse to position pixel PIX_X, PIX_Y relative to frame F. */ 9623/* Move the mouse to position pixel PIX_X, PIX_Y relative to frame F. */
@@ -9669,7 +9692,7 @@ x_ewmh_activate_frame (struct frame *f)
9669} 9692}
9670 9693
9671static void 9694static void
9672XTframe_raise_lower (struct frame *f, int raise_flag) 9695XTframe_raise_lower (struct frame *f, bool raise_flag)
9673{ 9696{
9674 if (raise_flag) 9697 if (raise_flag)
9675 x_raise_frame (f); 9698 x_raise_frame (f);
@@ -9751,7 +9774,7 @@ x_make_frame_visible (struct frame *f)
9751 && ! f->output_data.x->asked_for_visible) 9774 && ! f->output_data.x->asked_for_visible)
9752 x_set_offset (f, f->left_pos, f->top_pos, 0); 9775 x_set_offset (f, f->left_pos, f->top_pos, 0);
9753 9776
9754 f->output_data.x->asked_for_visible = 1; 9777 f->output_data.x->asked_for_visible = true;
9755 9778
9756 if (! EQ (Vx_no_window_manager, Qt)) 9779 if (! EQ (Vx_no_window_manager, Qt))
9757 x_wm_set_window_state (f, NormalState); 9780 x_wm_set_window_state (f, NormalState);
@@ -9786,7 +9809,7 @@ x_make_frame_visible (struct frame *f)
9786 /* This must be before UNBLOCK_INPUT 9809 /* This must be before UNBLOCK_INPUT
9787 since events that arrive in response to the actions above 9810 since events that arrive in response to the actions above
9788 will set it when they are handled. */ 9811 will set it when they are handled. */
9789 int previously_visible = f->output_data.x->has_been_visible; 9812 bool previously_visible = f->output_data.x->has_been_visible;
9790 9813
9791 original_left = f->left_pos; 9814 original_left = f->left_pos;
9792 original_top = f->top_pos; 9815 original_top = f->top_pos;
@@ -9901,7 +9924,7 @@ x_make_frame_invisible (struct frame *f)
9901 program-specified, so that when the window is mapped again, it will be 9924 program-specified, so that when the window is mapped again, it will be
9902 placed at the same location, without forcing the user to position it 9925 placed at the same location, without forcing the user to position it
9903 by hand again (they have already done that once for this window.) */ 9926 by hand again (they have already done that once for this window.) */
9904 x_wm_set_size_hint (f, 0, 1); 9927 x_wm_set_size_hint (f, 0, true);
9905 9928
9906#ifdef USE_GTK 9929#ifdef USE_GTK
9907 if (FRAME_GTK_OUTER_WIDGET (f)) 9930 if (FRAME_GTK_OUTER_WIDGET (f))
@@ -9928,7 +9951,7 @@ x_make_frame_invisible (struct frame *f)
9928 FRAME_SAMPLE_VISIBILITY set this. So do it by hand, 9951 FRAME_SAMPLE_VISIBILITY set this. So do it by hand,
9929 and synchronize with the server to make sure we agree. */ 9952 and synchronize with the server to make sure we agree. */
9930 SET_FRAME_VISIBLE (f, 0); 9953 SET_FRAME_VISIBLE (f, 0);
9931 SET_FRAME_ICONIFIED (f, 0); 9954 SET_FRAME_ICONIFIED (f, false);
9932 9955
9933 x_sync (f); 9956 x_sync (f);
9934 9957
@@ -9963,7 +9986,7 @@ x_iconify_frame (struct frame *f)
9963 9986
9964 gtk_window_iconify (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f))); 9987 gtk_window_iconify (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)));
9965 SET_FRAME_VISIBLE (f, 0); 9988 SET_FRAME_VISIBLE (f, 0);
9966 SET_FRAME_ICONIFIED (f, 1); 9989 SET_FRAME_ICONIFIED (f, true);
9967 unblock_input (); 9990 unblock_input ();
9968 return; 9991 return;
9969 } 9992 }
@@ -9981,7 +10004,7 @@ x_iconify_frame (struct frame *f)
9981 that an invisible frame was changed to an icon, 10004 that an invisible frame was changed to an icon,
9982 so we have to record it here. */ 10005 so we have to record it here. */
9983 SET_FRAME_VISIBLE (f, 0); 10006 SET_FRAME_VISIBLE (f, 0);
9984 SET_FRAME_ICONIFIED (f, 1); 10007 SET_FRAME_ICONIFIED (f, true);
9985 unblock_input (); 10008 unblock_input ();
9986 return; 10009 return;
9987 } 10010 }
@@ -9994,7 +10017,7 @@ x_iconify_frame (struct frame *f)
9994 if (!result) 10017 if (!result)
9995 error ("Can't notify window manager of iconification"); 10018 error ("Can't notify window manager of iconification");
9996 10019
9997 SET_FRAME_ICONIFIED (f, 1); 10020 SET_FRAME_ICONIFIED (f, true);
9998 SET_FRAME_VISIBLE (f, 0); 10021 SET_FRAME_VISIBLE (f, 0);
9999 10022
10000 block_input (); 10023 block_input ();
@@ -10044,7 +10067,7 @@ x_iconify_frame (struct frame *f)
10044 XMapRaised (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f)); 10067 XMapRaised (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f));
10045 } 10068 }
10046 10069
10047 SET_FRAME_ICONIFIED (f, 1); 10070 SET_FRAME_ICONIFIED (f, true);
10048 SET_FRAME_VISIBLE (f, 0); 10071 SET_FRAME_VISIBLE (f, 0);
10049 10072
10050 XFlush (FRAME_X_DISPLAY (f)); 10073 XFlush (FRAME_X_DISPLAY (f));
@@ -10466,7 +10489,7 @@ static XrmOptionDescRec emacs_options[] = {
10466 10489
10467/* Whether atimer for Xt timeouts is activated or not. */ 10490/* Whether atimer for Xt timeouts is activated or not. */
10468 10491
10469static int x_timeout_atimer_activated_flag; 10492static bool x_timeout_atimer_activated_flag;
10470 10493
10471#endif /* USE_X_TOOLKIT */ 10494#endif /* USE_X_TOOLKIT */
10472 10495
@@ -10474,10 +10497,10 @@ static int x_initialized;
10474 10497
10475/* Test whether two display-name strings agree up to the dot that separates 10498/* Test whether two display-name strings agree up to the dot that separates
10476 the screen number from the server number. */ 10499 the screen number from the server number. */
10477static int 10500static bool
10478same_x_server (const char *name1, const char *name2) 10501same_x_server (const char *name1, const char *name2)
10479{ 10502{
10480 int seen_colon = 0; 10503 bool seen_colon = false;
10481 const char *system_name = SSDATA (Vsystem_name); 10504 const char *system_name = SSDATA (Vsystem_name);
10482 ptrdiff_t system_name_length = SBYTES (Vsystem_name); 10505 ptrdiff_t system_name_length = SBYTES (Vsystem_name);
10483 ptrdiff_t length_until_period = 0; 10506 ptrdiff_t length_until_period = 0;
@@ -10509,9 +10532,9 @@ same_x_server (const char *name1, const char *name2)
10509 for (; *name1 != '\0' && *name1 == *name2; name1++, name2++) 10532 for (; *name1 != '\0' && *name1 == *name2; name1++, name2++)
10510 { 10533 {
10511 if (*name1 == ':') 10534 if (*name1 == ':')
10512 seen_colon = 1; 10535 seen_colon = true;
10513 if (seen_colon && *name1 == '.') 10536 if (seen_colon && *name1 == '.')
10514 return 1; 10537 return true;
10515 } 10538 }
10516 return (seen_colon 10539 return (seen_colon
10517 && (*name1 == '.' || *name1 == '\0') 10540 && (*name1 == '.' || *name1 == '\0')
@@ -10543,14 +10566,17 @@ get_bits_and_offset (unsigned long mask, int *bits, int *offset)
10543 *bits = nr; 10566 *bits = nr;
10544} 10567}
10545 10568
10546/* Return 1 if display DISPLAY is available for use, 0 otherwise. 10569/* Return true iff display DISPLAY is available for use.
10547 But don't permanently open it, just test its availability. */ 10570 But don't permanently open it, just test its availability. */
10548 10571
10549bool 10572bool
10550x_display_ok (const char *display) 10573x_display_ok (const char *display)
10551{ 10574{
10552 Display *dpy = XOpenDisplay (display); 10575 Display *dpy = XOpenDisplay (display);
10553 return dpy ? (XCloseDisplay (dpy), 1) : 0; 10576 if (!dpy)
10577 return false;
10578 XCloseDisplay (dpy);
10579 return true;
10554} 10580}
10555 10581
10556#ifdef USE_GTK 10582#ifdef USE_GTK
@@ -10775,12 +10801,12 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name)
10775 argv[argc++] = "-xrm"; 10801 argv[argc++] = "-xrm";
10776 argv[argc++] = xrm_option; 10802 argv[argc++] = xrm_option;
10777 } 10803 }
10778 turn_on_atimers (0); 10804 turn_on_atimers (false);
10779 dpy = XtOpenDisplay (Xt_app_con, SSDATA (display_name), 10805 dpy = XtOpenDisplay (Xt_app_con, SSDATA (display_name),
10780 resource_name, EMACS_CLASS, 10806 resource_name, EMACS_CLASS,
10781 emacs_options, XtNumber (emacs_options), 10807 emacs_options, XtNumber (emacs_options),
10782 &argc, argv); 10808 &argc, argv);
10783 turn_on_atimers (1); 10809 turn_on_atimers (true);
10784 10810
10785#ifdef HAVE_X11XTR6 10811#ifdef HAVE_X11XTR6
10786 /* I think this is to compensate for XtSetLanguageProc. */ 10812 /* I think this is to compensate for XtSetLanguageProc. */
@@ -10863,9 +10889,9 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name)
10863 /* Set the name of the terminal. */ 10889 /* Set the name of the terminal. */
10864 terminal->name = xlispstrdup (display_name); 10890 terminal->name = xlispstrdup (display_name);
10865 10891
10866#if 0 10892#if false
10867 XSetAfterFunction (x_current_display, x_trace_wire); 10893 XSetAfterFunction (x_current_display, x_trace_wire);
10868#endif /* ! 0 */ 10894#endif
10869 10895
10870 lim = min (PTRDIFF_MAX, SIZE_MAX) - sizeof "@"; 10896 lim = min (PTRDIFF_MAX, SIZE_MAX) - sizeof "@";
10871 if (lim - SBYTES (Vinvocation_name) < SBYTES (Vsystem_name)) 10897 if (lim - SBYTES (Vinvocation_name) < SBYTES (Vsystem_name))
@@ -11231,7 +11257,7 @@ static void
11231x_process_timeouts (struct atimer *timer) 11257x_process_timeouts (struct atimer *timer)
11232{ 11258{
11233 block_input (); 11259 block_input ();
11234 x_timeout_atimer_activated_flag = 0; 11260 x_timeout_atimer_activated_flag = false;
11235 if (toolkit_scroll_bar_interaction || popup_activated ()) 11261 if (toolkit_scroll_bar_interaction || popup_activated ())
11236 { 11262 {
11237 while (XtAppPending (Xt_app_con) & XtIMTimer) 11263 while (XtAppPending (Xt_app_con) & XtIMTimer)
@@ -11258,7 +11284,7 @@ x_activate_timeout_atimer (void)
11258 { 11284 {
11259 struct timespec interval = make_timespec (0, 100 * 1000 * 1000); 11285 struct timespec interval = make_timespec (0, 100 * 1000 * 1000);
11260 start_atimer (ATIMER_RELATIVE, interval, x_process_timeouts, 0); 11286 start_atimer (ATIMER_RELATIVE, interval, x_process_timeouts, 0);
11261 x_timeout_atimer_activated_flag = 1; 11287 x_timeout_atimer_activated_flag = true;
11262 } 11288 }
11263 unblock_input (); 11289 unblock_input ();
11264} 11290}
@@ -11338,7 +11364,7 @@ x_delete_terminal (struct terminal *terminal)
11338 don't destroy the database here in order to avoid the crash 11364 don't destroy the database here in order to avoid the crash
11339 in the above situations for now, though that may cause memory 11365 in the above situations for now, though that may cause memory
11340 leaks in other situations. */ 11366 leaks in other situations. */
11341#if 0 11367#if false
11342#ifdef HAVE_XRMSETDATABASE 11368#ifdef HAVE_XRMSETDATABASE
11343 XrmSetDatabase (dpyinfo->display, NULL); 11369 XrmSetDatabase (dpyinfo->display, NULL);
11344#else 11370#else
@@ -11430,7 +11456,7 @@ x_initialize (void)
11430 baud_rate = 19200; 11456 baud_rate = 19200;
11431 11457
11432 x_noop_count = 0; 11458 x_noop_count = 0;
11433 any_help_event_p = 0; 11459 any_help_event_p = false;
11434 ignore_next_mouse_click_timeout = 0; 11460 ignore_next_mouse_click_timeout = 0;
11435 11461
11436#ifdef USE_GTK 11462#ifdef USE_GTK
@@ -11502,7 +11528,7 @@ UNDERLINE_POSITION font properties, for example 7x13 on XFree prior
11502to 4.1, set this to nil. You can also use `underline-minimum-offset' 11528to 4.1, set this to nil. You can also use `underline-minimum-offset'
11503to override the font's UNDERLINE_POSITION for small font display 11529to override the font's UNDERLINE_POSITION for small font display
11504sizes. */); 11530sizes. */);
11505 x_use_underline_position_properties = 1; 11531 x_use_underline_position_properties = true;
11506 11532
11507 DEFVAR_BOOL ("x-underline-at-descent-line", 11533 DEFVAR_BOOL ("x-underline-at-descent-line",
11508 x_underline_at_descent_line, 11534 x_underline_at_descent_line,
@@ -11510,7 +11536,7 @@ sizes. */);
11510A value of nil means to draw the underline according to the value of the 11536A value of nil means to draw the underline according to the value of the
11511variable `x-use-underline-position-properties', which is usually at the 11537variable `x-use-underline-position-properties', which is usually at the
11512baseline level. The default value is nil. */); 11538baseline level. The default value is nil. */);
11513 x_underline_at_descent_line = 0; 11539 x_underline_at_descent_line = false;
11514 11540
11515 DEFVAR_BOOL ("x-mouse-click-focus-ignore-position", 11541 DEFVAR_BOOL ("x-mouse-click-focus-ignore-position",
11516 x_mouse_click_focus_ignore_position, 11542 x_mouse_click_focus_ignore_position,
@@ -11520,7 +11546,7 @@ click on a frame to select it (give it focus). In that case, a value
11520of nil, means that the selected window and cursor position changes to 11546of nil, means that the selected window and cursor position changes to
11521reflect the mouse click position, while a non-nil value means that the 11547reflect the mouse click position, while a non-nil value means that the
11522selected window or cursor position is preserved. */); 11548selected window or cursor position is preserved. */);
11523 x_mouse_click_focus_ignore_position = 0; 11549 x_mouse_click_focus_ignore_position = false;
11524 11550
11525 DEFVAR_LISP ("x-toolkit-scroll-bars", Vx_toolkit_scroll_bars, 11551 DEFVAR_LISP ("x-toolkit-scroll-bars", Vx_toolkit_scroll_bars,
11526 doc: /* Which toolkit scroll bars Emacs uses, if any. 11552 doc: /* Which toolkit scroll bars Emacs uses, if any.
diff --git a/src/xterm.h b/src/xterm.h
index 23dd43678d6..31c3261e3b9 100644
--- a/src/xterm.h
+++ b/src/xterm.h
@@ -834,7 +834,7 @@ struct scroll_bar
834 int whole; 834 int whole;
835#endif 835#endif
836 836
837 /* 1 if the scroll bar is horizontal. */ 837 /* True if the scroll bar is horizontal. */
838 bool horizontal; 838 bool horizontal;
839}; 839};
840 840
@@ -979,7 +979,7 @@ XrmDatabase x_load_resources (Display *, const char *, const char *,
979 979
980/* Defined in xterm.c */ 980/* Defined in xterm.c */
981 981
982extern int x_text_icon (struct frame *, const char *); 982extern bool x_text_icon (struct frame *, const char *);
983extern void x_catch_errors (Display *); 983extern void x_catch_errors (Display *);
984extern void x_check_errors (Display *, const char *) 984extern void x_check_errors (Display *, const char *)
985 ATTRIBUTE_FORMAT_PRINTF (2, 0); 985 ATTRIBUTE_FORMAT_PRINTF (2, 0);