From: Dmitry Antipov Date: Tue, 30 Jul 2013 05:56:18 +0000 (+0400) Subject: * fringe.c (draw_window_fringes, update_window_fringes) X-Git-Tag: emacs-24.3.90~173^2^2~42^2~45^2~387^2~1695 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=d7e6881a2ec341affe3a89b26cf2da6919772214;p=emacs.git * fringe.c (draw_window_fringes, update_window_fringes) (compute_fringe_widths): * w32term.c (x_draw_glyph_string): * window.c (candidate_window_p, Frecenter): * xfaces.c (realize_basic_faces, realize_default_face) (Fbitmap_space_p, Finternal_set_lisp_face_attribute) (x_update_menu_appearance, face_attr_equal_p, lface_equal_p): * xfns.c (x_set_cursor_color, xic_free_xfontset): * xmenu.c (Fx_menu_bar_open_internal): * xselect.c (x_reply_selection_request, Fx_get_atom_name): * xsettings.c (xft_settings_event): * xterm.c (x_draw_glyph_string, x_had_errors_p): Use bool for booleans. Adjust style and comments where appropriate. * dispextern.h (draw_window_fringes, update_window_fringes) (compute_fringe_widths): * xterm.h (x_had_errors_p): Adjust prototype. --- diff --git a/src/ChangeLog b/src/ChangeLog index 73525169bf9..79fce55c003 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,23 @@ +2013-07-30 Dmitry Antipov + + * fringe.c (draw_window_fringes, update_window_fringes) + (compute_fringe_widths): + * w32term.c (x_draw_glyph_string): + * window.c (candidate_window_p, Frecenter): + * xfaces.c (realize_basic_faces, realize_default_face) + (Fbitmap_space_p, Finternal_set_lisp_face_attribute) + (x_update_menu_appearance, face_attr_equal_p, lface_equal_p): + * xfns.c (x_set_cursor_color, xic_free_xfontset): + * xmenu.c (Fx_menu_bar_open_internal): + * xselect.c (x_reply_selection_request, Fx_get_atom_name): + * xsettings.c (xft_settings_event): + * xterm.c (x_draw_glyph_string, x_had_errors_p): + Use bool for booleans. Adjust style and comments where + appropriate. + * dispextern.h (draw_window_fringes, update_window_fringes) + (compute_fringe_widths): + * xterm.h (x_had_errors_p): Adjust prototype. + 2013-07-30 Dmitry Antipov * frame.c (Fmodify_frame_parameters): Always check 2nd arg with diff --git a/src/dispextern.h b/src/dispextern.h index e0d04231d3a..d747700fd66 100644 --- a/src/dispextern.h +++ b/src/dispextern.h @@ -3235,9 +3235,9 @@ extern void tty_draw_row_with_mouse_face (struct window *, struct glyph_row *, int lookup_fringe_bitmap (Lisp_Object); void draw_fringe_bitmap (struct window *, struct glyph_row *, int); void draw_row_fringe_bitmaps (struct window *, struct glyph_row *); -int draw_window_fringes (struct window *, int); -int update_window_fringes (struct window *, int); -void compute_fringe_widths (struct frame *, int); +bool draw_window_fringes (struct window *, bool); +bool update_window_fringes (struct window *, bool); +void compute_fringe_widths (struct frame *, bool); #ifdef HAVE_NTGUI void w32_init_fringe (struct redisplay_interface *); diff --git a/src/fringe.c b/src/fringe.c index f728cd6d5ff..1d05244e64e 100644 --- a/src/fringe.c +++ b/src/fringe.c @@ -890,31 +890,32 @@ draw_row_fringe_bitmaps (struct window *w, struct glyph_row *row) /* Draw the fringes of window W. Only fringes for rows marked for update in redraw_fringe_bitmaps_p are drawn. - Return >0 if left or right fringe was redrawn in any way. + Return nonzero if left or right fringe was redrawn in any way. - If NO_FRINGE is non-zero, also return >0 if either fringe has zero width. + If NO_FRINGE_P is non-zero, also return nonzero if either fringe + has zero width. - A return value >0 indicates that the vertical line between windows - needs update (as it may be drawn in the fringe). + A return nonzero value indicates that the vertical line between + windows needs update (as it may be drawn in the fringe). */ -int -draw_window_fringes (struct window *w, int no_fringe) +bool +draw_window_fringes (struct window *w, bool no_fringe_p) { struct glyph_row *row; int yb = window_text_bottom_y (w); int nrows = w->current_matrix->nrows; int y, rn; - int updated = 0; + bool updated_p = 0; if (w->pseudo_window_p) - return 0; + return updated_p; /* Must draw line if no fringe */ - if (no_fringe + if (no_fringe_p && (WINDOW_LEFT_FRINGE_WIDTH (w) == 0 || WINDOW_RIGHT_FRINGE_WIDTH (w) == 0)) - updated++; + updated_p = 1; for (y = w->vscroll, rn = 0, row = w->current_matrix->rows; y < yb && rn < nrows; @@ -924,10 +925,10 @@ draw_window_fringes (struct window *w, int no_fringe) continue; draw_row_fringe_bitmaps (w, row); row->redraw_fringe_bitmaps_p = 0; - updated++; + updated_p = 1; } - return updated; + return updated_p; } @@ -936,14 +937,14 @@ draw_window_fringes (struct window *w, int no_fringe) If KEEP_CURRENT_P is 0, update current_matrix too. */ -int -update_window_fringes (struct window *w, int keep_current_p) +bool +update_window_fringes (struct window *w, bool keep_current_p) { struct glyph_row *row, *cur = 0; int yb = window_text_bottom_y (w); int rn, nrows = w->current_matrix->nrows; int y; - int redraw_p = 0; + bool redraw_p = 0; Lisp_Object boundary_top = Qnil, boundary_bot = Qnil; Lisp_Object arrow_top = Qnil, arrow_bot = Qnil; Lisp_Object empty_pos; @@ -1169,7 +1170,7 @@ update_window_fringes (struct window *w, int keep_current_p) int left, right; unsigned left_face_id, right_face_id; int left_offset, right_offset; - int periodic_p; + bool periodic_p; row = w->desired_matrix->rows + rn; cur = w->current_matrix->rows + rn; @@ -1285,7 +1286,7 @@ update_window_fringes (struct window *w, int keep_current_p) || periodic_p != cur->fringe_bitmap_periodic_p || cur->redraw_fringe_bitmaps_p) { - redraw_p = row->redraw_fringe_bitmaps_p = 1; + redraw_p = 1, row->redraw_fringe_bitmaps_p = 1; if (!keep_current_p) { cur->redraw_fringe_bitmaps_p = 1; @@ -1304,7 +1305,7 @@ update_window_fringes (struct window *w, int keep_current_p) if (row->overlay_arrow_bitmap != cur->overlay_arrow_bitmap) { - redraw_p = row->redraw_fringe_bitmaps_p = 1; + redraw_p = 1, row->redraw_fringe_bitmaps_p = 1; if (!keep_current_p) { cur->redraw_fringe_bitmaps_p = 1; @@ -1339,7 +1340,7 @@ update_window_fringes (struct window *w, int keep_current_p) */ void -compute_fringe_widths (struct frame *f, int redraw) +compute_fringe_widths (struct frame *f, bool redraw_p) { int o_left = FRAME_LEFT_FRINGE_WIDTH (f); int o_right = FRAME_RIGHT_FRINGE_WIDTH (f); @@ -1410,7 +1411,7 @@ compute_fringe_widths (struct frame *f, int redraw) FRAME_FRINGE_COLS (f) = 0; } - if (redraw && FRAME_VISIBLE_P (f)) + if (redraw_p && FRAME_VISIBLE_P (f)) if (o_left != FRAME_LEFT_FRINGE_WIDTH (f) || o_right != FRAME_RIGHT_FRINGE_WIDTH (f) || o_cols != FRAME_FRINGE_COLS (f)) diff --git a/src/w32term.c b/src/w32term.c index a596a487f3d..b97632dabca 100644 --- a/src/w32term.c +++ b/src/w32term.c @@ -2360,7 +2360,7 @@ x_draw_stretch_glyph_string (struct glyph_string *s) static void x_draw_glyph_string (struct glyph_string *s) { - int relief_drawn_p = 0; + bool relief_drawn_p = 0; /* If S draws into the background of its successor, draw the background of the successor first so that S can draw into it. @@ -4629,7 +4629,7 @@ w32_read_socket (struct terminal *terminal, { /* If we decide we want to generate an event to be seen by the rest of Emacs, we put it here. */ - int tool_bar_p = 0; + bool tool_bar_p = 0; int button; int up; diff --git a/src/window.c b/src/window.c index 2ff149ed4fa..6fd6849c6c3 100644 --- a/src/window.c +++ b/src/window.c @@ -72,8 +72,6 @@ static void window_scroll_line_based (Lisp_Object, int, int, int); static int freeze_window_start (struct window *, void *); static Lisp_Object window_list (void); static int add_window_to_list (struct window *, void *); -static int candidate_window_p (Lisp_Object, Lisp_Object, Lisp_Object, - Lisp_Object); static Lisp_Object next_window (Lisp_Object, Lisp_Object, Lisp_Object, int); static void decode_next_window_args (Lisp_Object *, Lisp_Object *, @@ -2213,12 +2211,13 @@ window_list (void) a window means search the frame that window belongs to, a frame means consider windows on that frame, only. */ -static int -candidate_window_p (Lisp_Object window, Lisp_Object owindow, Lisp_Object minibuf, Lisp_Object all_frames) +static bool +candidate_window_p (Lisp_Object window, Lisp_Object owindow, + Lisp_Object minibuf, Lisp_Object all_frames) { struct window *w = XWINDOW (window); struct frame *f = XFRAME (w->frame); - int candidate_p = 1; + bool candidate_p = 1; if (!BUFFERP (w->contents)) candidate_p = 0; @@ -5172,7 +5171,7 @@ and redisplay normally--don't erase and redraw the frame. */) struct window *w = XWINDOW (selected_window); struct buffer *buf = XBUFFER (w->contents); struct buffer *obuf = current_buffer; - int center_p = 0; + bool center_p = 0; ptrdiff_t charpos, bytepos; EMACS_INT iarg IF_LINT (= 0); int this_scroll_margin; diff --git a/src/xfaces.c b/src/xfaces.c index f647ff2e209..7bf05fc85cd 100644 --- a/src/xfaces.c +++ b/src/xfaces.c @@ -448,8 +448,8 @@ static struct face *realize_non_ascii_face (struct frame *, Lisp_Object, struct face *); static struct face *realize_x_face (struct face_cache *, Lisp_Object *); static struct face *realize_tty_face (struct face_cache *, Lisp_Object *); -static int realize_basic_faces (struct frame *); -static int realize_default_face (struct frame *); +static bool realize_basic_faces (struct frame *); +static bool realize_default_face (struct frame *); static void realize_named_face (struct frame *, Lisp_Object, int); static struct face_cache *make_face_cache (struct frame *); static void clear_face_gcs (struct face_cache *); @@ -819,7 +819,7 @@ the pixmap. Bits are stored row by row, each row occupies \(WIDTH + 7)/8 bytes. */) (Lisp_Object object) { - int pixmap_p = 0; + bool pixmap_p = 0; if (STRINGP (object)) /* If OBJECT is a string, it's a file name. */ @@ -2854,7 +2854,7 @@ FRAME 0 means change the face on all frames, and change the default } else if (EQ (attr, QCunderline)) { - int valid_p = 0; + bool valid_p = 0; if (UNSPECIFIEDP (value) || IGNORE_DEFFACE_P (value)) valid_p = 1; @@ -2941,7 +2941,7 @@ FRAME 0 means change the face on all frames, and change the default } else if (EQ (attr, QCbox)) { - int valid_p; + bool valid_p; /* Allow t meaning a simple box of width 1 in foreground color of the face. */ @@ -3510,7 +3510,7 @@ x_update_menu_appearance (struct frame *f) Lisp_Object lface = lface_from_face_name (f, Qmenu, 1); struct face *face = FACE_FROM_ID (f, MENU_FACE_ID); const char *myname = SSDATA (Vx_resource_name); - int changed_p = 0; + bool changed_p = 0; #ifdef USE_MOTIF const char *popup_path = "popup_menu"; #else @@ -3858,7 +3858,7 @@ return the font name used for CHARACTER. */) all attributes are `equal'. Tries to be fast because this function is called quite often. */ -static int +static bool face_attr_equal_p (Lisp_Object v1, Lisp_Object v2) { /* Type can differ, e.g. when one attribute is unspecified, i.e. nil, @@ -3891,10 +3891,11 @@ face_attr_equal_p (Lisp_Object v1, Lisp_Object v2) all attributes are `equal'. Tries to be fast because this function is called quite often. */ -static int +static bool lface_equal_p (Lisp_Object *v1, Lisp_Object *v2) { - int i, equal_p = 1; + int i; + bool equal_p = 1; for (i = 1; i < LFACE_VECTOR_SIZE && equal_p; ++i) equal_p = face_attr_equal_p (v1[i], v2[i]); @@ -5201,10 +5202,10 @@ face_fontset (Lisp_Object attrs[LFACE_VECTOR_SIZE]) of F don't contain enough information needed to realize the default face. */ -static int +static bool realize_basic_faces (struct frame *f) { - int success_p = 0; + bool success_p = 0; ptrdiff_t count = SPECPDL_INDEX (); /* Block input here so that we won't be surprised by an X expose @@ -5249,7 +5250,7 @@ realize_basic_faces (struct frame *f) specified, make it fully-specified. Attributes of the default face that are not explicitly specified are taken from frame parameters. */ -static int +static bool realize_default_face (struct frame *f) { struct face_cache *c = FRAME_FACE_CACHE (f); diff --git a/src/xfns.c b/src/xfns.c index a3eff1a5cce..a4492a10fdb 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -942,7 +942,7 @@ static void x_set_cursor_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval) { unsigned long fore_pixel, pixel; - int fore_pixel_allocated_p = 0, pixel_allocated_p = 0; + bool fore_pixel_allocated_p = 0, pixel_allocated_p = 0; struct x_output *x = f->output_data.x; if (!NILP (Vx_cursor_fore_pixel)) @@ -2066,7 +2066,7 @@ void xic_free_xfontset (struct frame *f) { Lisp_Object rest, frame; - int shared_p = 0; + bool shared_p = 0; if (!FRAME_XIC_FONTSET (f)) return; diff --git a/src/xmenu.c b/src/xmenu.c index 6c0e3dd78a6..5cc37842da9 100644 --- a/src/xmenu.c +++ b/src/xmenu.c @@ -493,7 +493,7 @@ If FRAME is nil or not given, use the selected frame. */) if (menubar) { Window child; - int error_p = 0; + bool error_p = 0; x_catch_errors (FRAME_X_DISPLAY (f)); memset (&ev, 0, sizeof ev); diff --git a/src/xselect.c b/src/xselect.c index 6a80eddc82c..d9f7d9c29c7 100644 --- a/src/xselect.c +++ b/src/xselect.c @@ -654,7 +654,7 @@ x_reply_selection_request (struct input_event *event, if (cs->wait_object) { int format_bytes = cs->format / 8; - int had_errors = x_had_errors_p (display); + bool had_errors_p = x_had_errors_p (display); unblock_input (); bytes_remaining = cs->size; @@ -662,7 +662,7 @@ x_reply_selection_request (struct input_event *event, /* Wait for the requestor to ack by deleting the property. This can run Lisp code (process handlers) or signal. */ - if (! had_errors) + if (! had_errors_p) { TRACE1 ("Waiting for ACK (deletion of %s)", XGetAtomName (display, cs->property)); @@ -694,10 +694,10 @@ x_reply_selection_request (struct input_event *event, cs->data += i * ((cs->format == 32) ? sizeof (long) : format_bytes); XFlush (display); - had_errors = x_had_errors_p (display); + had_errors_p = x_had_errors_p (display); unblock_input (); - if (had_errors) break; + if (had_errors_p) break; /* Wait for the requestor to ack this chunk by deleting the property. This can run Lisp code or signal. */ @@ -2427,17 +2427,17 @@ If the value is 0 or the atom is not known, return the empty string. */) Lisp_Object ret = Qnil; Display *dpy = FRAME_X_DISPLAY (f); Atom atom; - int had_errors; + bool had_errors_p; CONS_TO_INTEGER (value, Atom, atom); block_input (); x_catch_errors (dpy); name = atom ? XGetAtomName (dpy, atom) : empty; - had_errors = x_had_errors_p (dpy); + had_errors_p = x_had_errors_p (dpy); x_uncatch_errors (); - if (!had_errors) + if (!had_errors_p) ret = build_string (name); if (atom && name) XFree (name); diff --git a/src/xsettings.c b/src/xsettings.c index 45f8435d9f4..b5d5f4db59b 100644 --- a/src/xsettings.c +++ b/src/xsettings.c @@ -756,8 +756,7 @@ read_and_apply_settings (struct x_display_info *dpyinfo, int send_event_p) void xft_settings_event (struct x_display_info *dpyinfo, XEvent *event) { - int check_window_p = 0; - int apply_settings = 0; + bool check_window_p = 0, apply_settings_p = 0; switch (event->type) { @@ -777,7 +776,7 @@ xft_settings_event (struct x_display_info *dpyinfo, XEvent *event) if (event->xproperty.window == dpyinfo->xsettings_window && event->xproperty.state == PropertyNewValue && event->xproperty.atom == dpyinfo->Xatom_xsettings_prop) - apply_settings = 1; + apply_settings_p = 1; break; } @@ -787,10 +786,10 @@ xft_settings_event (struct x_display_info *dpyinfo, XEvent *event) dpyinfo->xsettings_window = None; get_prop_window (dpyinfo); if (dpyinfo->xsettings_window != None) - apply_settings = 1; + apply_settings_p = 1; } - if (apply_settings) + if (apply_settings_p) read_and_apply_settings (dpyinfo, True); } diff --git a/src/xterm.c b/src/xterm.c index b3534871da9..a2306935e4e 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -2691,7 +2691,7 @@ x_draw_underwave (struct glyph_string *s) static void x_draw_glyph_string (struct glyph_string *s) { - int relief_drawn_p = 0; + bool relief_drawn_p = 0; /* If S draws into the background of its successors, draw the background of the successors first so that S can draw into it. @@ -6854,7 +6854,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr, { /* If we decide we want to generate an event to be seen by the rest of Emacs, we put it here. */ - int tool_bar_p = 0; + bool tool_bar_p = 0; memset (&compose_status, 0, sizeof (compose_status)); last_mouse_glyph_frame = 0; @@ -7663,7 +7663,7 @@ x_check_errors (Display *dpy, const char *format) /* Nonzero if we had any X protocol errors since we did x_catch_errors on DPY. */ -int +bool x_had_errors_p (Display *dpy) { /* Make sure to catch any errors incurred so far. */ diff --git a/src/xterm.h b/src/xterm.h index 5415a77cf58..6bdc708220b 100644 --- a/src/xterm.h +++ b/src/xterm.h @@ -947,7 +947,7 @@ extern int x_text_icon (struct frame *, const char *); extern void x_catch_errors (Display *); extern void x_check_errors (Display *, const char *) ATTRIBUTE_FORMAT_PRINTF (2, 0); -extern int x_had_errors_p (Display *); +extern bool x_had_errors_p (Display *); extern void x_uncatch_errors (void); extern void x_clear_errors (Display *); extern void x_set_window_size (struct frame *, int, int, int);