aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert2014-12-21 19:35:30 -0800
committerPaul Eggert2014-12-21 19:36:28 -0800
commit455e54691f2e95ff1ec1e3e81f3e271775269af2 (patch)
tree25948f57dc47a4ca25c03e58d89a4c18930a646e /src
parentbe4304d8d824100b9c877988cd6c8df5e102c2ae (diff)
downloademacs-455e54691f2e95ff1ec1e3e81f3e271775269af2.tar.gz
emacs-455e54691f2e95ff1ec1e3e81f3e271775269af2.zip
Use bool for boolean in xterm.c
* frame.h, nsterm.m, w32term.c, w32term.h, xterm.c: (x_set_window_size, x_bitmap_icon): * nsterm.m (ns_frame_raise_lower, x_new_font): * termhooks.h (struct terminal.toggle_invisible_pointer_hook) (struct terminal.frame_raise_lower_hook): * w32term.c (w32_frame_raise_lower): * xterm.c, xterm.h (x_text_icon): * xterm.c (x_update_window_begin, x_update_window_end) (x_update_end, x_after_update_window_line) (x_set_glyph_string_gc, x_draw_glyph_string_background) (x_draw_glyph_string_foreground) (x_draw_composite_glyph_string_foreground) (x_alloc_lighter_color, x_draw_relief_rect) (x_draw_glyph_string_box, x_draw_image_relief) (x_draw_image_glyph_string, x_draw_stretch_glyph_string) (x_draw_underwave, x_draw_glyph_string, x_show_hourglass) (x_hide_hourglass): (XFillRectangle) [HAVE_GTK3]: (XTtoggle_invisible_pointer, frame_highlight, frame_unhighlight) (x_focus_changed, x_find_modifier_meanings, note_mouse_movement) (XTmouse_position, xt_action_hook, xt_horizontal_action_hook) (x_send_scroll_bar_event, xm_scroll_callback) (xg_scroll_callback, xaw_jump_callback, xaw_scroll_callback) (x_create_toolkit_scroll_bar) (x_create_horizontal_toolkit_scroll_bar) (x_set_toolkit_horizontal_scroll_bar_thumb, x_scroll_bar_create) (x_scroll_bar_set_handle, XTset_vertical_scroll_bar) (XTset_horizontal_scroll_bar, x_scroll_bar_expose) (x_scroll_bar_handle_click, x_scroll_bar_note_movement) (x_scroll_bar_report_motion) (x_horizontal_scroll_bar_report_motion, x_net_wm_state) (handle_one_xevent, XTread_socket, x_draw_bar_cursor) (x_draw_window_cursor, x_clear_errors) (x_trace_wire, x_new_font, x_set_offset, wm_supports) (set_wm_state, x_set_sticky, get_current_wm_state) (do_ewmh_fullscreen, x_handle_net_wm_state) (x_check_expected_move, x_sync_with_move, x_wait_for_event) (x_set_window_size_1, XTframe_raise_lower) (x_make_frame_visible, x_iconify_frame) (x_timeout_atimer_activated_flag, same_x_server, x_display_ok) (x_term_init, x_process_timeouts, x_activate_timeout_atimer) (x_delete_terminal, x_initialize, syms_of_xterm): Use bool for boolean.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog47
-rw-r--r--src/frame.h4
-rw-r--r--src/nsterm.m8
-rw-r--r--src/termhooks.h8
-rw-r--r--src/w32term.c11
-rw-r--r--src/w32term.h4
-rw-r--r--src/xterm.c529
-rw-r--r--src/xterm.h4
8 files changed, 345 insertions, 270 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 51ab3396ef3..c857430a8cf 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,50 @@
12014-12-22 Paul Eggert <eggert@cs.ucla.edu>
2
3 Use bool for boolean in xterm.c
4 * frame.h, nsterm.m, w32term.c, w32term.h, xterm.c:
5 (x_set_window_size, x_bitmap_icon):
6 * nsterm.m (ns_frame_raise_lower, x_new_font):
7 * termhooks.h (struct terminal.toggle_invisible_pointer_hook)
8 (struct terminal.frame_raise_lower_hook):
9 * w32term.c (w32_frame_raise_lower):
10 * xterm.c, xterm.h (x_text_icon):
11 * xterm.c (x_update_window_begin, x_update_window_end)
12 (x_update_end, x_after_update_window_line)
13 (x_set_glyph_string_gc, x_draw_glyph_string_background)
14 (x_draw_glyph_string_foreground)
15 (x_draw_composite_glyph_string_foreground)
16 (x_alloc_lighter_color, x_draw_relief_rect)
17 (x_draw_glyph_string_box, x_draw_image_relief)
18 (x_draw_image_glyph_string, x_draw_stretch_glyph_string)
19 (x_draw_underwave, x_draw_glyph_string, x_show_hourglass)
20 (x_hide_hourglass):
21 (XFillRectangle) [HAVE_GTK3]:
22 (XTtoggle_invisible_pointer, frame_highlight, frame_unhighlight)
23 (x_focus_changed, x_find_modifier_meanings, note_mouse_movement)
24 (XTmouse_position, xt_action_hook, xt_horizontal_action_hook)
25 (x_send_scroll_bar_event, xm_scroll_callback)
26 (xg_scroll_callback, xaw_jump_callback, xaw_scroll_callback)
27 (x_create_toolkit_scroll_bar)
28 (x_create_horizontal_toolkit_scroll_bar)
29 (x_set_toolkit_horizontal_scroll_bar_thumb, x_scroll_bar_create)
30 (x_scroll_bar_set_handle, XTset_vertical_scroll_bar)
31 (XTset_horizontal_scroll_bar, x_scroll_bar_expose)
32 (x_scroll_bar_handle_click, x_scroll_bar_note_movement)
33 (x_scroll_bar_report_motion)
34 (x_horizontal_scroll_bar_report_motion, x_net_wm_state)
35 (handle_one_xevent, XTread_socket, x_draw_bar_cursor)
36 (x_draw_window_cursor, x_clear_errors)
37 (x_trace_wire, x_new_font, x_set_offset, wm_supports)
38 (set_wm_state, x_set_sticky, get_current_wm_state)
39 (do_ewmh_fullscreen, x_handle_net_wm_state)
40 (x_check_expected_move, x_sync_with_move, x_wait_for_event)
41 (x_set_window_size_1, XTframe_raise_lower)
42 (x_make_frame_visible, x_iconify_frame)
43 (x_timeout_atimer_activated_flag, same_x_server, x_display_ok)
44 (x_term_init, x_process_timeouts, x_activate_timeout_atimer)
45 (x_delete_terminal, x_initialize, syms_of_xterm):
46 Use bool for boolean.
47
12014-12-20 Paul Eggert <eggert@cs.ucla.edu> 482014-12-20 Paul Eggert <eggert@cs.ucla.edu>
2 49
3 * composite.h (struct composition.width): Now int 50 * composite.h (struct composition.width): Now int
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/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/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..8cc6475de53 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);
@@ -8226,7 +8239,7 @@ x_bitmap_icon (struct frame *f, Lisp_Object file)
8226 || xg_set_icon_from_xpm_data (f, gnu_xpm_bits)) 8239 || xg_set_icon_from_xpm_data (f, gnu_xpm_bits))
8227 { 8240 {
8228 FRAME_DISPLAY_INFO (f)->icon_bitmap_id = -2; 8241 FRAME_DISPLAY_INFO (f)->icon_bitmap_id = -2;
8229 return 0; 8242 return false;
8230 } 8243 }
8231 8244
8232#elif defined (HAVE_XPM) && defined (HAVE_X_WINDOWS) 8245#elif defined (HAVE_XPM) && defined (HAVE_X_WINDOWS)
@@ -8243,7 +8256,7 @@ x_bitmap_icon (struct frame *f, Lisp_Object file)
8243 rc = x_create_bitmap_from_data (f, (char *) gnu_xbm_bits, 8256 rc = x_create_bitmap_from_data (f, (char *) gnu_xbm_bits,
8244 gnu_xbm_width, gnu_xbm_height); 8257 gnu_xbm_width, gnu_xbm_height);
8245 if (rc == -1) 8258 if (rc == -1)
8246 return 1; 8259 return true;
8247 8260
8248 FRAME_DISPLAY_INFO (f)->icon_bitmap_id = rc; 8261 FRAME_DISPLAY_INFO (f)->icon_bitmap_id = rc;
8249 x_create_bitmap_mask (f, FRAME_DISPLAY_INFO (f)->icon_bitmap_id); 8262 x_create_bitmap_mask (f, FRAME_DISPLAY_INFO (f)->icon_bitmap_id);
@@ -8262,18 +8275,18 @@ x_bitmap_icon (struct frame *f, Lisp_Object file)
8262 x_wm_set_icon_pixmap (f, bitmap_id); 8275 x_wm_set_icon_pixmap (f, bitmap_id);
8263 f->output_data.x->icon_bitmap = bitmap_id; 8276 f->output_data.x->icon_bitmap = bitmap_id;
8264 8277
8265 return 0; 8278 return false;
8266} 8279}
8267 8280
8268 8281
8269/* Make the x-window of frame F use a rectangle with text. 8282/* Make the x-window of frame F use a rectangle with text.
8270 Use ICON_NAME as the text. */ 8283 Use ICON_NAME as the text. */
8271 8284
8272int 8285bool
8273x_text_icon (struct frame *f, const char *icon_name) 8286x_text_icon (struct frame *f, const char *icon_name)
8274{ 8287{
8275 if (FRAME_X_WINDOW (f) == 0) 8288 if (FRAME_X_WINDOW (f) == 0)
8276 return 1; 8289 return true;
8277 8290
8278 { 8291 {
8279 XTextProperty text; 8292 XTextProperty text;
@@ -8289,7 +8302,7 @@ x_text_icon (struct frame *f, const char *icon_name)
8289 f->output_data.x->icon_bitmap = 0; 8302 f->output_data.x->icon_bitmap = 0;
8290 x_wm_set_icon_pixmap (f, 0); 8303 x_wm_set_icon_pixmap (f, 0);
8291 8304
8292 return 0; 8305 return false;
8293} 8306}
8294 8307
8295#define X_ERROR_MESSAGE_SIZE 200 8308#define X_ERROR_MESSAGE_SIZE 200
@@ -8407,7 +8420,8 @@ x_clear_errors (Display *dpy)
8407 x_error_message->string[0] = 0; 8420 x_error_message->string[0] = 0;
8408} 8421}
8409 8422
8410#if 0 /* See comment in unwind_to_catch why calling this is a bad 8423#if false
8424 /* See comment in unwind_to_catch why calling this is a bad
8411 * idea. --lorentey */ 8425 * idea. --lorentey */
8412/* Close off all unclosed x_catch_errors calls. */ 8426/* Close off all unclosed x_catch_errors calls. */
8413 8427
@@ -8419,13 +8433,13 @@ x_fully_uncatch_errors (void)
8419} 8433}
8420#endif 8434#endif
8421 8435
8422#if 0 8436#if false
8423static unsigned int x_wire_count; 8437static unsigned int x_wire_count;
8424x_trace_wire (void) 8438x_trace_wire (void)
8425{ 8439{
8426 fprintf (stderr, "Lib call: %d\n", ++x_wire_count); 8440 fprintf (stderr, "Lib call: %d\n", ++x_wire_count);
8427} 8441}
8428#endif /* ! 0 */ 8442#endif
8429 8443
8430 8444
8431/************************************************************************ 8445/************************************************************************
@@ -8664,7 +8678,7 @@ x_new_font (struct frame *f, Lisp_Object font_object, int fontset)
8664 if (NILP (tip_frame) || XFRAME (tip_frame) != f) 8678 if (NILP (tip_frame) || XFRAME (tip_frame) != f)
8665 adjust_frame_size (f, FRAME_COLS (f) * FRAME_COLUMN_WIDTH (f), 8679 adjust_frame_size (f, FRAME_COLS (f) * FRAME_COLUMN_WIDTH (f),
8666 FRAME_LINES (f) * FRAME_LINE_HEIGHT (f), 3, 8680 FRAME_LINES (f) * FRAME_LINE_HEIGHT (f), 3,
8667 0, Qfont); 8681 false, Qfont);
8668 } 8682 }
8669 8683
8670#ifdef HAVE_X_I18N 8684#ifdef HAVE_X_I18N
@@ -8954,7 +8968,7 @@ x_set_offset (struct frame *f, register int xoff, register int yoff, int change_
8954 x_calc_absolute_position (f); 8968 x_calc_absolute_position (f);
8955 8969
8956 block_input (); 8970 block_input ();
8957 x_wm_set_size_hint (f, 0, 0); 8971 x_wm_set_size_hint (f, 0, false);
8958 8972
8959 modified_left = f->left_pos; 8973 modified_left = f->left_pos;
8960 modified_top = f->top_pos; 8974 modified_top = f->top_pos;
@@ -8972,8 +8986,7 @@ x_set_offset (struct frame *f, register int xoff, register int yoff, int change_
8972 modified_left, modified_top); 8986 modified_left, modified_top);
8973 8987
8974 x_sync_with_move (f, f->left_pos, f->top_pos, 8988 x_sync_with_move (f, f->left_pos, f->top_pos,
8975 FRAME_DISPLAY_INFO (f)->wm_type == X_WMTYPE_UNKNOWN 8989 FRAME_DISPLAY_INFO (f)->wm_type == X_WMTYPE_UNKNOWN);
8976 ? 1 : 0);
8977 8990
8978 /* change_gravity is non-zero when this function is called from Lisp to 8991 /* change_gravity is non-zero when this function is called from Lisp to
8979 programmatically move a frame. In that case, we call 8992 programmatically move a frame. In that case, we call
@@ -8985,32 +8998,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 8998 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. */ 8999 need to compute the top/left offset adjustment for this frame. */
8987 9000
8988 if (change_gravity != 0 && 9001 if (change_gravity != 0
8989 (FRAME_DISPLAY_INFO (f)->wm_type == X_WMTYPE_UNKNOWN 9002 && (FRAME_DISPLAY_INFO (f)->wm_type == X_WMTYPE_UNKNOWN
8990 || (FRAME_DISPLAY_INFO (f)->wm_type == X_WMTYPE_A 9003 || (FRAME_DISPLAY_INFO (f)->wm_type == X_WMTYPE_A
8991 && (FRAME_X_OUTPUT (f)->move_offset_left == 0 9004 && (FRAME_X_OUTPUT (f)->move_offset_left == 0
8992 && FRAME_X_OUTPUT (f)->move_offset_top == 0)))) 9005 && FRAME_X_OUTPUT (f)->move_offset_top == 0))))
8993 x_check_expected_move (f, modified_left, modified_top); 9006 x_check_expected_move (f, modified_left, modified_top);
8994 9007
8995 unblock_input (); 9008 unblock_input ();
8996} 9009}
8997 9010
8998/* Return non-zero if _NET_SUPPORTING_WM_CHECK window exists and _NET_SUPPORTED 9011/* Return true if _NET_SUPPORTING_WM_CHECK window exists and _NET_SUPPORTED
8999 on the root window for frame F contains ATOMNAME. 9012 on the root window for frame F contains ATOMNAME.
9000 This is how a WM check shall be done according to the Window Manager 9013 This is how a WM check shall be done according to the Window Manager
9001 Specification/Extended Window Manager Hints at 9014 Specification/Extended Window Manager Hints at
9002 http://freedesktop.org/wiki/Specifications/wm-spec. */ 9015 http://freedesktop.org/wiki/Specifications/wm-spec. */
9003 9016
9004static int 9017static bool
9005wm_supports (struct frame *f, Atom want_atom) 9018wm_supports (struct frame *f, Atom want_atom)
9006{ 9019{
9007 Atom actual_type; 9020 Atom actual_type;
9008 unsigned long actual_size, bytes_remaining; 9021 unsigned long actual_size, bytes_remaining;
9009 int i, rc, actual_format; 9022 int i, rc, actual_format;
9023 bool ret;
9010 Window wmcheck_window; 9024 Window wmcheck_window;
9011 struct x_display_info *dpyinfo = FRAME_DISPLAY_INFO (f); 9025 struct x_display_info *dpyinfo = FRAME_DISPLAY_INFO (f);
9012 Window target_window = dpyinfo->root_window; 9026 Window target_window = dpyinfo->root_window;
9013 long max_len = 65536; 9027 int max_len = 65536;
9014 Display *dpy = FRAME_X_DISPLAY (f); 9028 Display *dpy = FRAME_X_DISPLAY (f);
9015 unsigned char *tmp_data = NULL; 9029 unsigned char *tmp_data = NULL;
9016 Atom target_type = XA_WINDOW; 9030 Atom target_type = XA_WINDOW;
@@ -9029,7 +9043,7 @@ wm_supports (struct frame *f, Atom want_atom)
9029 if (tmp_data) XFree (tmp_data); 9043 if (tmp_data) XFree (tmp_data);
9030 x_uncatch_errors (); 9044 x_uncatch_errors ();
9031 unblock_input (); 9045 unblock_input ();
9032 return 0; 9046 return false;
9033 } 9047 }
9034 9048
9035 wmcheck_window = *(Window *) tmp_data; 9049 wmcheck_window = *(Window *) tmp_data;
@@ -9042,7 +9056,7 @@ wm_supports (struct frame *f, Atom want_atom)
9042 { 9056 {
9043 x_uncatch_errors (); 9057 x_uncatch_errors ();
9044 unblock_input (); 9058 unblock_input ();
9045 return 0; 9059 return false;
9046 } 9060 }
9047 9061
9048 if (dpyinfo->net_supported_window != wmcheck_window) 9062 if (dpyinfo->net_supported_window != wmcheck_window)
@@ -9067,7 +9081,7 @@ wm_supports (struct frame *f, Atom want_atom)
9067 if (tmp_data) XFree (tmp_data); 9081 if (tmp_data) XFree (tmp_data);
9068 x_uncatch_errors (); 9082 x_uncatch_errors ();
9069 unblock_input (); 9083 unblock_input ();
9070 return 0; 9084 return false;
9071 } 9085 }
9072 9086
9073 dpyinfo->net_supported_atoms = (Atom *)tmp_data; 9087 dpyinfo->net_supported_atoms = (Atom *)tmp_data;
@@ -9075,19 +9089,19 @@ wm_supports (struct frame *f, Atom want_atom)
9075 dpyinfo->net_supported_window = wmcheck_window; 9089 dpyinfo->net_supported_window = wmcheck_window;
9076 } 9090 }
9077 9091
9078 rc = 0; 9092 ret = false;
9079 9093
9080 for (i = 0; rc == 0 && i < dpyinfo->nr_net_supported_atoms; ++i) 9094 for (i = 0; !ret && i < dpyinfo->nr_net_supported_atoms; ++i)
9081 rc = dpyinfo->net_supported_atoms[i] == want_atom; 9095 ret = dpyinfo->net_supported_atoms[i] == want_atom;
9082 9096
9083 x_uncatch_errors (); 9097 x_uncatch_errors ();
9084 unblock_input (); 9098 unblock_input ();
9085 9099
9086 return rc; 9100 return ret;
9087} 9101}
9088 9102
9089static void 9103static void
9090set_wm_state (Lisp_Object frame, int add, Atom atom, Atom value) 9104set_wm_state (Lisp_Object frame, bool add, Atom atom, Atom value)
9091{ 9105{
9092 struct x_display_info *dpyinfo = FRAME_DISPLAY_INFO (XFRAME (frame)); 9106 struct x_display_info *dpyinfo = FRAME_DISPLAY_INFO (XFRAME (frame));
9093 9107
@@ -9096,7 +9110,7 @@ set_wm_state (Lisp_Object frame, int add, Atom atom, Atom value)
9096 make_number (32), 9110 make_number (32),
9097 /* 1 = add, 0 = remove */ 9111 /* 1 = add, 0 = remove */
9098 Fcons 9112 Fcons
9099 (make_number (add ? 1 : 0), 9113 (make_number (add),
9100 Fcons 9114 Fcons
9101 (make_fixnum_or_float (atom), 9115 (make_fixnum_or_float (atom),
9102 (value != 0 9116 (value != 0
@@ -9112,32 +9126,33 @@ x_set_sticky (struct frame *f, Lisp_Object new_value, Lisp_Object old_value)
9112 9126
9113 XSETFRAME (frame, f); 9127 XSETFRAME (frame, f);
9114 9128
9115 set_wm_state (frame, NILP (new_value) ? 0 : 1, 9129 set_wm_state (frame, !NILP (new_value),
9116 dpyinfo->Xatom_net_wm_state_sticky, None); 9130 dpyinfo->Xatom_net_wm_state_sticky, None);
9117} 9131}
9118 9132
9119/* Return the current _NET_WM_STATE. 9133/* Return the current _NET_WM_STATE.
9120 SIZE_STATE is set to one of the FULLSCREEN_* values. 9134 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. 9135 Set *STICKY to the sticky state.
9122 9136
9123 Return non-zero if we are not hidden, zero if we are. */ 9137 Return true iff we are not hidden. */
9124 9138
9125static int 9139static bool
9126get_current_wm_state (struct frame *f, 9140get_current_wm_state (struct frame *f,
9127 Window window, 9141 Window window,
9128 int *size_state, 9142 int *size_state,
9129 int *sticky) 9143 bool *sticky)
9130{ 9144{
9131 Atom actual_type; 9145 Atom actual_type;
9132 unsigned long actual_size, bytes_remaining; 9146 unsigned long actual_size, bytes_remaining;
9133 int i, rc, actual_format, is_hidden = 0; 9147 int i, rc, actual_format;
9148 bool is_hidden = false;
9134 struct x_display_info *dpyinfo = FRAME_DISPLAY_INFO (f); 9149 struct x_display_info *dpyinfo = FRAME_DISPLAY_INFO (f);
9135 long max_len = 65536; 9150 long max_len = 65536;
9136 Display *dpy = FRAME_X_DISPLAY (f); 9151 Display *dpy = FRAME_X_DISPLAY (f);
9137 unsigned char *tmp_data = NULL; 9152 unsigned char *tmp_data = NULL;
9138 Atom target_type = XA_ATOM; 9153 Atom target_type = XA_ATOM;
9139 9154
9140 *sticky = 0; 9155 *sticky = false;
9141 *size_state = FULLSCREEN_NONE; 9156 *size_state = FULLSCREEN_NONE;
9142 9157
9143 block_input (); 9158 block_input ();
@@ -9161,9 +9176,7 @@ get_current_wm_state (struct frame *f,
9161 { 9176 {
9162 Atom a = ((Atom*)tmp_data)[i]; 9177 Atom a = ((Atom*)tmp_data)[i];
9163 if (a == dpyinfo->Xatom_net_wm_state_hidden) 9178 if (a == dpyinfo->Xatom_net_wm_state_hidden)
9164 { 9179 is_hidden = true;
9165 is_hidden = 1;
9166 }
9167 else if (a == dpyinfo->Xatom_net_wm_state_maximized_horz) 9180 else if (a == dpyinfo->Xatom_net_wm_state_maximized_horz)
9168 { 9181 {
9169 if (*size_state == FULLSCREEN_HEIGHT) 9182 if (*size_state == FULLSCREEN_HEIGHT)
@@ -9181,7 +9194,7 @@ get_current_wm_state (struct frame *f,
9181 else if (a == dpyinfo->Xatom_net_wm_state_fullscreen) 9194 else if (a == dpyinfo->Xatom_net_wm_state_fullscreen)
9182 *size_state = FULLSCREEN_BOTH; 9195 *size_state = FULLSCREEN_BOTH;
9183 else if (a == dpyinfo->Xatom_net_wm_state_sticky) 9196 else if (a == dpyinfo->Xatom_net_wm_state_sticky)
9184 *sticky = 1; 9197 *sticky = true;
9185 } 9198 }
9186 9199
9187 if (tmp_data) XFree (tmp_data); 9200 if (tmp_data) XFree (tmp_data);
@@ -9191,14 +9204,15 @@ get_current_wm_state (struct frame *f,
9191 9204
9192/* Do fullscreen as specified in extended window manager hints */ 9205/* Do fullscreen as specified in extended window manager hints */
9193 9206
9194static int 9207static bool
9195do_ewmh_fullscreen (struct frame *f) 9208do_ewmh_fullscreen (struct frame *f)
9196{ 9209{
9197 struct x_display_info *dpyinfo = FRAME_DISPLAY_INFO (f); 9210 struct x_display_info *dpyinfo = FRAME_DISPLAY_INFO (f);
9198 int have_net_atom = wm_supports (f, dpyinfo->Xatom_net_wm_state); 9211 bool have_net_atom = wm_supports (f, dpyinfo->Xatom_net_wm_state);
9199 int cur, dummy; 9212 int cur;
9213 bool dummy;
9200 9214
9201 (void)get_current_wm_state (f, FRAME_OUTER_WINDOW (f), &cur, &dummy); 9215 get_current_wm_state (f, FRAME_OUTER_WINDOW (f), &cur, &dummy);
9202 9216
9203 /* Some window managers don't say they support _NET_WM_STATE, but they do say 9217 /* 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. */ 9218 they support _NET_WM_STATE_FULLSCREEN. Try that also. */
@@ -9219,37 +9233,45 @@ do_ewmh_fullscreen (struct frame *f)
9219 case FULLSCREEN_BOTH: 9233 case FULLSCREEN_BOTH:
9220 if (cur == FULLSCREEN_WIDTH || cur == FULLSCREEN_MAXIMIZED 9234 if (cur == FULLSCREEN_WIDTH || cur == FULLSCREEN_MAXIMIZED
9221 || cur == FULLSCREEN_HEIGHT) 9235 || cur == FULLSCREEN_HEIGHT)
9222 set_wm_state (frame, 0, dpyinfo->Xatom_net_wm_state_maximized_horz, 9236 set_wm_state (frame, false,
9237 dpyinfo->Xatom_net_wm_state_maximized_horz,
9223 dpyinfo->Xatom_net_wm_state_maximized_vert); 9238 dpyinfo->Xatom_net_wm_state_maximized_vert);
9224 set_wm_state (frame, 1, dpyinfo->Xatom_net_wm_state_fullscreen, None); 9239 set_wm_state (frame, true,
9240 dpyinfo->Xatom_net_wm_state_fullscreen, None);
9225 break; 9241 break;
9226 case FULLSCREEN_WIDTH: 9242 case FULLSCREEN_WIDTH:
9227 if (cur == FULLSCREEN_BOTH || cur == FULLSCREEN_HEIGHT 9243 if (cur == FULLSCREEN_BOTH || cur == FULLSCREEN_HEIGHT
9228 || cur == FULLSCREEN_MAXIMIZED) 9244 || cur == FULLSCREEN_MAXIMIZED)
9229 set_wm_state (frame, 0, dpyinfo->Xatom_net_wm_state_fullscreen, 9245 set_wm_state (frame, false, dpyinfo->Xatom_net_wm_state_fullscreen,
9230 dpyinfo->Xatom_net_wm_state_maximized_vert); 9246 dpyinfo->Xatom_net_wm_state_maximized_vert);
9231 if (cur != FULLSCREEN_MAXIMIZED) 9247 if (cur != FULLSCREEN_MAXIMIZED)
9232 set_wm_state (frame, 1, dpyinfo->Xatom_net_wm_state_maximized_horz, None); 9248 set_wm_state (frame, true,
9249 dpyinfo->Xatom_net_wm_state_maximized_horz, None);
9233 break; 9250 break;
9234 case FULLSCREEN_HEIGHT: 9251 case FULLSCREEN_HEIGHT:
9235 if (cur == FULLSCREEN_BOTH || cur == FULLSCREEN_WIDTH 9252 if (cur == FULLSCREEN_BOTH || cur == FULLSCREEN_WIDTH
9236 || cur == FULLSCREEN_MAXIMIZED) 9253 || cur == FULLSCREEN_MAXIMIZED)
9237 set_wm_state (frame, 0, dpyinfo->Xatom_net_wm_state_fullscreen, 9254 set_wm_state (frame, false, dpyinfo->Xatom_net_wm_state_fullscreen,
9238 dpyinfo->Xatom_net_wm_state_maximized_horz); 9255 dpyinfo->Xatom_net_wm_state_maximized_horz);
9239 if (cur != FULLSCREEN_MAXIMIZED) 9256 if (cur != FULLSCREEN_MAXIMIZED)
9240 set_wm_state (frame, 1, dpyinfo->Xatom_net_wm_state_maximized_vert, None); 9257 set_wm_state (frame, true,
9258 dpyinfo->Xatom_net_wm_state_maximized_vert, None);
9241 break; 9259 break;
9242 case FULLSCREEN_MAXIMIZED: 9260 case FULLSCREEN_MAXIMIZED:
9243 if (cur == FULLSCREEN_BOTH) 9261 if (cur == FULLSCREEN_BOTH)
9244 set_wm_state (frame, 0, dpyinfo->Xatom_net_wm_state_fullscreen, None); 9262 set_wm_state (frame, false, dpyinfo->Xatom_net_wm_state_fullscreen,
9245 set_wm_state (frame, 1, dpyinfo->Xatom_net_wm_state_maximized_horz, 9263 None);
9264 set_wm_state (frame, true,
9265 dpyinfo->Xatom_net_wm_state_maximized_horz,
9246 dpyinfo->Xatom_net_wm_state_maximized_vert); 9266 dpyinfo->Xatom_net_wm_state_maximized_vert);
9247 break; 9267 break;
9248 case FULLSCREEN_NONE: 9268 case FULLSCREEN_NONE:
9249 if (cur == FULLSCREEN_BOTH) 9269 if (cur == FULLSCREEN_BOTH)
9250 set_wm_state (frame, 0, dpyinfo->Xatom_net_wm_state_fullscreen, None); 9270 set_wm_state (frame, false, dpyinfo->Xatom_net_wm_state_fullscreen,
9271 None);
9251 else 9272 else
9252 set_wm_state (frame, 0, dpyinfo->Xatom_net_wm_state_maximized_horz, 9273 set_wm_state (frame, false,
9274 dpyinfo->Xatom_net_wm_state_maximized_horz,
9253 dpyinfo->Xatom_net_wm_state_maximized_vert); 9275 dpyinfo->Xatom_net_wm_state_maximized_vert);
9254 } 9276 }
9255 9277
@@ -9273,13 +9295,13 @@ XTfullscreen_hook (struct frame *f)
9273} 9295}
9274 9296
9275 9297
9276static int 9298static bool
9277x_handle_net_wm_state (struct frame *f, const XPropertyEvent *event) 9299x_handle_net_wm_state (struct frame *f, const XPropertyEvent *event)
9278{ 9300{
9279 int value = FULLSCREEN_NONE; 9301 int value = FULLSCREEN_NONE;
9280 Lisp_Object lval; 9302 Lisp_Object lval;
9281 int sticky = 0; 9303 bool sticky = false;
9282 int not_hidden = get_current_wm_state (f, event->window, &value, &sticky); 9304 bool not_hidden = get_current_wm_state (f, event->window, &value, &sticky);
9283 9305
9284 lval = Qnil; 9306 lval = Qnil;
9285 switch (value) 9307 switch (value)
@@ -9381,7 +9403,7 @@ x_check_expected_move (struct frame *f, int expected_left, int expected_top)
9381 XMoveWindow (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f), 9403 XMoveWindow (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f),
9382 adjusted_left, adjusted_top); 9404 adjusted_left, adjusted_top);
9383 9405
9384 x_sync_with_move (f, expected_left, expected_top, 0); 9406 x_sync_with_move (f, expected_left, expected_top, false);
9385 } 9407 }
9386 else 9408 else
9387 /* It's a "Type B" window manager. We don't have to adjust the 9409 /* It's a "Type B" window manager. We don't have to adjust the
@@ -9398,7 +9420,7 @@ x_check_expected_move (struct frame *f, int expected_left, int expected_top)
9398 of an exact comparison. */ 9420 of an exact comparison. */
9399 9421
9400static void 9422static void
9401x_sync_with_move (struct frame *f, int left, int top, int fuzzy) 9423x_sync_with_move (struct frame *f, int left, int top, bool fuzzy)
9402{ 9424{
9403 int count = 0; 9425 int count = 0;
9404 9426
@@ -9429,7 +9451,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 9451 /* As a last resort, just wait 0.5 seconds and hope that XGetGeometry
9430 will then return up-to-date position info. */ 9452 will then return up-to-date position info. */
9431 9453
9432 wait_reading_process_output (0, 500000000, 0, 0, Qnil, NULL, 0); 9454 wait_reading_process_output (0, 500000000, 0, false, Qnil, NULL, 0);
9433} 9455}
9434 9456
9435 9457
@@ -9452,7 +9474,7 @@ x_wait_for_event (struct frame *f, int eventtype)
9452 9474
9453 while (f->wait_event_type) 9475 while (f->wait_event_type)
9454 { 9476 {
9455 pending_signals = 1; 9477 pending_signals = true;
9456 totally_unblock_input (); 9478 totally_unblock_input ();
9457 /* XTread_socket is called after unblock. */ 9479 /* XTread_socket is called after unblock. */
9458 block_input (); 9480 block_input ();
@@ -9475,12 +9497,13 @@ x_wait_for_event (struct frame *f, int eventtype)
9475 9497
9476 9498
9477/* Change the size of frame F's X window to WIDTH/HEIGHT in the case F 9499/* 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 9500 doesn't have a widget. If CHANGE_GRAVITY, change to
9479 top-left-corner window gravity for this size change and subsequent 9501 top-left-corner window gravity for this size change and subsequent
9480 size changes. Otherwise we leave the window gravity unchanged. */ 9502 size changes. Otherwise leave the window gravity unchanged. */
9481 9503
9482static void 9504static void
9483x_set_window_size_1 (struct frame *f, int change_gravity, int width, int height, bool pixelwise) 9505x_set_window_size_1 (struct frame *f, bool change_gravity,
9506 int width, int height, bool pixelwise)
9484{ 9507{
9485 int pixelwidth, pixelheight; 9508 int pixelwidth, pixelheight;
9486 9509
@@ -9492,7 +9515,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))); 9515 : FRAME_TEXT_LINES_TO_PIXEL_HEIGHT (f, height)));
9493 9516
9494 if (change_gravity) f->win_gravity = NorthWestGravity; 9517 if (change_gravity) f->win_gravity = NorthWestGravity;
9495 x_wm_set_size_hint (f, 0, 0); 9518 x_wm_set_size_hint (f, 0, false);
9496 XResizeWindow (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f), 9519 XResizeWindow (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f),
9497 pixelwidth, pixelheight + FRAME_MENUBAR_HEIGHT (f)); 9520 pixelwidth, pixelheight + FRAME_MENUBAR_HEIGHT (f));
9498 9521
@@ -9514,7 +9537,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 9537 wouldn't be reported in the frame parameters until some random
9515 point in the future when the ConfigureNotify event arrives. 9538 point in the future when the ConfigureNotify event arrives.
9516 9539
9517 We pass 1 for DELAY since we can't run Lisp code inside of 9540 Pass true for DELAY since we can't run Lisp code inside of
9518 a BLOCK_INPUT. */ 9541 a BLOCK_INPUT. */
9519 9542
9520 /* But the ConfigureNotify may in fact never arrive, and then this is 9543 /* But the ConfigureNotify may in fact never arrive, and then this is
@@ -9524,25 +9547,26 @@ x_set_window_size_1 (struct frame *f, int change_gravity, int width, int height,
9524 x_wait_for_event (f, ConfigureNotify); 9547 x_wait_for_event (f, ConfigureNotify);
9525 else 9548 else
9526 { 9549 {
9527 change_frame_size (f, pixelwidth, pixelheight, 0, 1, 0, 1); 9550 change_frame_size (f, pixelwidth, pixelheight, false, true, false, true);
9528 x_sync (f); 9551 x_sync (f);
9529 } 9552 }
9530} 9553}
9531 9554
9532 9555
9533/* Call this to change the size of frame F's x-window. 9556/* 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 9557 If CHANGE_GRAVITY, change to top-left-corner window gravity
9535 for this size change and subsequent size changes. 9558 for this size change and subsequent size changes.
9536 Otherwise we leave the window gravity unchanged. */ 9559 Otherwise we leave the window gravity unchanged. */
9537 9560
9538void 9561void
9539x_set_window_size (struct frame *f, int change_gravity, int width, int height, bool pixelwise) 9562x_set_window_size (struct frame *f, bool change_gravity,
9563 int width, int height, bool pixelwise)
9540{ 9564{
9541 block_input (); 9565 block_input ();
9542 9566
9543 /* The following breaks our calculations. If it's really needed, 9567 /* The following breaks our calculations. If it's really needed,
9544 think of something else. */ 9568 think of something else. */
9545#if 0 9569#if false
9546 if (NILP (tip_frame) || XFRAME (tip_frame) != f) 9570 if (NILP (tip_frame) || XFRAME (tip_frame) != f)
9547 { 9571 {
9548 int text_width, text_height; 9572 int text_width, text_height;
@@ -9563,7 +9587,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)); 9587 text_width = FRAME_PIXEL_TO_TEXT_WIDTH (f, FRAME_PIXEL_WIDTH (f));
9564 text_height = FRAME_PIXEL_TO_TEXT_HEIGHT (f, pixelh); 9588 text_height = FRAME_PIXEL_TO_TEXT_HEIGHT (f, pixelh);
9565 9589
9566 change_frame_size (f, text_width, text_height, 0, 1, 0, 1); 9590 change_frame_size (f, text_width, text_height, false, true, false, true);
9567 } 9591 }
9568#endif 9592#endif
9569 9593
@@ -9594,7 +9618,7 @@ x_set_window_size (struct frame *f, int change_gravity, int width, int height, b
9594 9618
9595 unblock_input (); 9619 unblock_input ();
9596 9620
9597 do_pending_window_change (0); 9621 do_pending_window_change (false);
9598} 9622}
9599 9623
9600/* Move the mouse to position pixel PIX_X, PIX_Y relative to frame F. */ 9624/* Move the mouse to position pixel PIX_X, PIX_Y relative to frame F. */
@@ -9669,7 +9693,7 @@ x_ewmh_activate_frame (struct frame *f)
9669} 9693}
9670 9694
9671static void 9695static void
9672XTframe_raise_lower (struct frame *f, int raise_flag) 9696XTframe_raise_lower (struct frame *f, bool raise_flag)
9673{ 9697{
9674 if (raise_flag) 9698 if (raise_flag)
9675 x_raise_frame (f); 9699 x_raise_frame (f);
@@ -9751,7 +9775,7 @@ x_make_frame_visible (struct frame *f)
9751 && ! f->output_data.x->asked_for_visible) 9775 && ! f->output_data.x->asked_for_visible)
9752 x_set_offset (f, f->left_pos, f->top_pos, 0); 9776 x_set_offset (f, f->left_pos, f->top_pos, 0);
9753 9777
9754 f->output_data.x->asked_for_visible = 1; 9778 f->output_data.x->asked_for_visible = true;
9755 9779
9756 if (! EQ (Vx_no_window_manager, Qt)) 9780 if (! EQ (Vx_no_window_manager, Qt))
9757 x_wm_set_window_state (f, NormalState); 9781 x_wm_set_window_state (f, NormalState);
@@ -9786,7 +9810,7 @@ x_make_frame_visible (struct frame *f)
9786 /* This must be before UNBLOCK_INPUT 9810 /* This must be before UNBLOCK_INPUT
9787 since events that arrive in response to the actions above 9811 since events that arrive in response to the actions above
9788 will set it when they are handled. */ 9812 will set it when they are handled. */
9789 int previously_visible = f->output_data.x->has_been_visible; 9813 bool previously_visible = f->output_data.x->has_been_visible;
9790 9814
9791 original_left = f->left_pos; 9815 original_left = f->left_pos;
9792 original_top = f->top_pos; 9816 original_top = f->top_pos;
@@ -9901,7 +9925,7 @@ x_make_frame_invisible (struct frame *f)
9901 program-specified, so that when the window is mapped again, it will be 9925 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 9926 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.) */ 9927 by hand again (they have already done that once for this window.) */
9904 x_wm_set_size_hint (f, 0, 1); 9928 x_wm_set_size_hint (f, 0, true);
9905 9929
9906#ifdef USE_GTK 9930#ifdef USE_GTK
9907 if (FRAME_GTK_OUTER_WIDGET (f)) 9931 if (FRAME_GTK_OUTER_WIDGET (f))
@@ -9928,7 +9952,7 @@ x_make_frame_invisible (struct frame *f)
9928 FRAME_SAMPLE_VISIBILITY set this. So do it by hand, 9952 FRAME_SAMPLE_VISIBILITY set this. So do it by hand,
9929 and synchronize with the server to make sure we agree. */ 9953 and synchronize with the server to make sure we agree. */
9930 SET_FRAME_VISIBLE (f, 0); 9954 SET_FRAME_VISIBLE (f, 0);
9931 SET_FRAME_ICONIFIED (f, 0); 9955 SET_FRAME_ICONIFIED (f, false);
9932 9956
9933 x_sync (f); 9957 x_sync (f);
9934 9958
@@ -9963,7 +9987,7 @@ x_iconify_frame (struct frame *f)
9963 9987
9964 gtk_window_iconify (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f))); 9988 gtk_window_iconify (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)));
9965 SET_FRAME_VISIBLE (f, 0); 9989 SET_FRAME_VISIBLE (f, 0);
9966 SET_FRAME_ICONIFIED (f, 1); 9990 SET_FRAME_ICONIFIED (f, true);
9967 unblock_input (); 9991 unblock_input ();
9968 return; 9992 return;
9969 } 9993 }
@@ -9981,7 +10005,7 @@ x_iconify_frame (struct frame *f)
9981 that an invisible frame was changed to an icon, 10005 that an invisible frame was changed to an icon,
9982 so we have to record it here. */ 10006 so we have to record it here. */
9983 SET_FRAME_VISIBLE (f, 0); 10007 SET_FRAME_VISIBLE (f, 0);
9984 SET_FRAME_ICONIFIED (f, 1); 10008 SET_FRAME_ICONIFIED (f, true);
9985 unblock_input (); 10009 unblock_input ();
9986 return; 10010 return;
9987 } 10011 }
@@ -9994,7 +10018,7 @@ x_iconify_frame (struct frame *f)
9994 if (!result) 10018 if (!result)
9995 error ("Can't notify window manager of iconification"); 10019 error ("Can't notify window manager of iconification");
9996 10020
9997 SET_FRAME_ICONIFIED (f, 1); 10021 SET_FRAME_ICONIFIED (f, true);
9998 SET_FRAME_VISIBLE (f, 0); 10022 SET_FRAME_VISIBLE (f, 0);
9999 10023
10000 block_input (); 10024 block_input ();
@@ -10044,7 +10068,7 @@ x_iconify_frame (struct frame *f)
10044 XMapRaised (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f)); 10068 XMapRaised (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f));
10045 } 10069 }
10046 10070
10047 SET_FRAME_ICONIFIED (f, 1); 10071 SET_FRAME_ICONIFIED (f, true);
10048 SET_FRAME_VISIBLE (f, 0); 10072 SET_FRAME_VISIBLE (f, 0);
10049 10073
10050 XFlush (FRAME_X_DISPLAY (f)); 10074 XFlush (FRAME_X_DISPLAY (f));
@@ -10466,7 +10490,7 @@ static XrmOptionDescRec emacs_options[] = {
10466 10490
10467/* Whether atimer for Xt timeouts is activated or not. */ 10491/* Whether atimer for Xt timeouts is activated or not. */
10468 10492
10469static int x_timeout_atimer_activated_flag; 10493static bool x_timeout_atimer_activated_flag;
10470 10494
10471#endif /* USE_X_TOOLKIT */ 10495#endif /* USE_X_TOOLKIT */
10472 10496
@@ -10474,10 +10498,10 @@ static int x_initialized;
10474 10498
10475/* Test whether two display-name strings agree up to the dot that separates 10499/* Test whether two display-name strings agree up to the dot that separates
10476 the screen number from the server number. */ 10500 the screen number from the server number. */
10477static int 10501static bool
10478same_x_server (const char *name1, const char *name2) 10502same_x_server (const char *name1, const char *name2)
10479{ 10503{
10480 int seen_colon = 0; 10504 bool seen_colon = false;
10481 const char *system_name = SSDATA (Vsystem_name); 10505 const char *system_name = SSDATA (Vsystem_name);
10482 ptrdiff_t system_name_length = SBYTES (Vsystem_name); 10506 ptrdiff_t system_name_length = SBYTES (Vsystem_name);
10483 ptrdiff_t length_until_period = 0; 10507 ptrdiff_t length_until_period = 0;
@@ -10509,9 +10533,9 @@ same_x_server (const char *name1, const char *name2)
10509 for (; *name1 != '\0' && *name1 == *name2; name1++, name2++) 10533 for (; *name1 != '\0' && *name1 == *name2; name1++, name2++)
10510 { 10534 {
10511 if (*name1 == ':') 10535 if (*name1 == ':')
10512 seen_colon = 1; 10536 seen_colon = true;
10513 if (seen_colon && *name1 == '.') 10537 if (seen_colon && *name1 == '.')
10514 return 1; 10538 return true;
10515 } 10539 }
10516 return (seen_colon 10540 return (seen_colon
10517 && (*name1 == '.' || *name1 == '\0') 10541 && (*name1 == '.' || *name1 == '\0')
@@ -10543,14 +10567,17 @@ get_bits_and_offset (unsigned long mask, int *bits, int *offset)
10543 *bits = nr; 10567 *bits = nr;
10544} 10568}
10545 10569
10546/* Return 1 if display DISPLAY is available for use, 0 otherwise. 10570/* Return true iff display DISPLAY is available for use.
10547 But don't permanently open it, just test its availability. */ 10571 But don't permanently open it, just test its availability. */
10548 10572
10549bool 10573bool
10550x_display_ok (const char *display) 10574x_display_ok (const char *display)
10551{ 10575{
10552 Display *dpy = XOpenDisplay (display); 10576 Display *dpy = XOpenDisplay (display);
10553 return dpy ? (XCloseDisplay (dpy), 1) : 0; 10577 if (!dpy)
10578 return false;
10579 XCloseDisplay (dpy);
10580 return true;
10554} 10581}
10555 10582
10556#ifdef USE_GTK 10583#ifdef USE_GTK
@@ -10775,12 +10802,12 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name)
10775 argv[argc++] = "-xrm"; 10802 argv[argc++] = "-xrm";
10776 argv[argc++] = xrm_option; 10803 argv[argc++] = xrm_option;
10777 } 10804 }
10778 turn_on_atimers (0); 10805 turn_on_atimers (false);
10779 dpy = XtOpenDisplay (Xt_app_con, SSDATA (display_name), 10806 dpy = XtOpenDisplay (Xt_app_con, SSDATA (display_name),
10780 resource_name, EMACS_CLASS, 10807 resource_name, EMACS_CLASS,
10781 emacs_options, XtNumber (emacs_options), 10808 emacs_options, XtNumber (emacs_options),
10782 &argc, argv); 10809 &argc, argv);
10783 turn_on_atimers (1); 10810 turn_on_atimers (true);
10784 10811
10785#ifdef HAVE_X11XTR6 10812#ifdef HAVE_X11XTR6
10786 /* I think this is to compensate for XtSetLanguageProc. */ 10813 /* I think this is to compensate for XtSetLanguageProc. */
@@ -10863,9 +10890,9 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name)
10863 /* Set the name of the terminal. */ 10890 /* Set the name of the terminal. */
10864 terminal->name = xlispstrdup (display_name); 10891 terminal->name = xlispstrdup (display_name);
10865 10892
10866#if 0 10893#if false
10867 XSetAfterFunction (x_current_display, x_trace_wire); 10894 XSetAfterFunction (x_current_display, x_trace_wire);
10868#endif /* ! 0 */ 10895#endif
10869 10896
10870 lim = min (PTRDIFF_MAX, SIZE_MAX) - sizeof "@"; 10897 lim = min (PTRDIFF_MAX, SIZE_MAX) - sizeof "@";
10871 if (lim - SBYTES (Vinvocation_name) < SBYTES (Vsystem_name)) 10898 if (lim - SBYTES (Vinvocation_name) < SBYTES (Vsystem_name))
@@ -11231,7 +11258,7 @@ static void
11231x_process_timeouts (struct atimer *timer) 11258x_process_timeouts (struct atimer *timer)
11232{ 11259{
11233 block_input (); 11260 block_input ();
11234 x_timeout_atimer_activated_flag = 0; 11261 x_timeout_atimer_activated_flag = false;
11235 if (toolkit_scroll_bar_interaction || popup_activated ()) 11262 if (toolkit_scroll_bar_interaction || popup_activated ())
11236 { 11263 {
11237 while (XtAppPending (Xt_app_con) & XtIMTimer) 11264 while (XtAppPending (Xt_app_con) & XtIMTimer)
@@ -11258,7 +11285,7 @@ x_activate_timeout_atimer (void)
11258 { 11285 {
11259 struct timespec interval = make_timespec (0, 100 * 1000 * 1000); 11286 struct timespec interval = make_timespec (0, 100 * 1000 * 1000);
11260 start_atimer (ATIMER_RELATIVE, interval, x_process_timeouts, 0); 11287 start_atimer (ATIMER_RELATIVE, interval, x_process_timeouts, 0);
11261 x_timeout_atimer_activated_flag = 1; 11288 x_timeout_atimer_activated_flag = true;
11262 } 11289 }
11263 unblock_input (); 11290 unblock_input ();
11264} 11291}
@@ -11338,7 +11365,7 @@ x_delete_terminal (struct terminal *terminal)
11338 don't destroy the database here in order to avoid the crash 11365 don't destroy the database here in order to avoid the crash
11339 in the above situations for now, though that may cause memory 11366 in the above situations for now, though that may cause memory
11340 leaks in other situations. */ 11367 leaks in other situations. */
11341#if 0 11368#if false
11342#ifdef HAVE_XRMSETDATABASE 11369#ifdef HAVE_XRMSETDATABASE
11343 XrmSetDatabase (dpyinfo->display, NULL); 11370 XrmSetDatabase (dpyinfo->display, NULL);
11344#else 11371#else
@@ -11430,7 +11457,7 @@ x_initialize (void)
11430 baud_rate = 19200; 11457 baud_rate = 19200;
11431 11458
11432 x_noop_count = 0; 11459 x_noop_count = 0;
11433 any_help_event_p = 0; 11460 any_help_event_p = false;
11434 ignore_next_mouse_click_timeout = 0; 11461 ignore_next_mouse_click_timeout = 0;
11435 11462
11436#ifdef USE_GTK 11463#ifdef USE_GTK
@@ -11502,7 +11529,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' 11529to 4.1, set this to nil. You can also use `underline-minimum-offset'
11503to override the font's UNDERLINE_POSITION for small font display 11530to override the font's UNDERLINE_POSITION for small font display
11504sizes. */); 11531sizes. */);
11505 x_use_underline_position_properties = 1; 11532 x_use_underline_position_properties = true;
11506 11533
11507 DEFVAR_BOOL ("x-underline-at-descent-line", 11534 DEFVAR_BOOL ("x-underline-at-descent-line",
11508 x_underline_at_descent_line, 11535 x_underline_at_descent_line,
@@ -11510,7 +11537,7 @@ sizes. */);
11510A value of nil means to draw the underline according to the value of the 11537A 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 11538variable `x-use-underline-position-properties', which is usually at the
11512baseline level. The default value is nil. */); 11539baseline level. The default value is nil. */);
11513 x_underline_at_descent_line = 0; 11540 x_underline_at_descent_line = false;
11514 11541
11515 DEFVAR_BOOL ("x-mouse-click-focus-ignore-position", 11542 DEFVAR_BOOL ("x-mouse-click-focus-ignore-position",
11516 x_mouse_click_focus_ignore_position, 11543 x_mouse_click_focus_ignore_position,
@@ -11520,7 +11547,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 11547of nil, means that the selected window and cursor position changes to
11521reflect the mouse click position, while a non-nil value means that the 11548reflect the mouse click position, while a non-nil value means that the
11522selected window or cursor position is preserved. */); 11549selected window or cursor position is preserved. */);
11523 x_mouse_click_focus_ignore_position = 0; 11550 x_mouse_click_focus_ignore_position = false;
11524 11551
11525 DEFVAR_LISP ("x-toolkit-scroll-bars", Vx_toolkit_scroll_bars, 11552 DEFVAR_LISP ("x-toolkit-scroll-bars", Vx_toolkit_scroll_bars,
11526 doc: /* Which toolkit scroll bars Emacs uses, if any. 11553 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);