+2013-07-30 Dmitry Antipov <dmantipov@yandex.ru>
+
+ * 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 <dmantipov@yandex.ru>
* frame.c (Fmodify_frame_parameters): Always check 2nd arg with
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 *);
/* 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;
continue;
draw_row_fringe_bitmaps (w, row);
row->redraw_fringe_bitmaps_p = 0;
- updated++;
+ updated_p = 1;
}
- return updated;
+ return updated_p;
}
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;
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;
|| 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;
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;
*/
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);
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))
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.
{
/* 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;
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 *,
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;
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;
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 *);
\(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. */
}
else if (EQ (attr, QCunderline))
{
- int valid_p = 0;
+ bool valid_p = 0;
if (UNSPECIFIEDP (value) || IGNORE_DEFFACE_P (value))
valid_p = 1;
}
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. */
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
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,
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]);
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
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);
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))
xic_free_xfontset (struct frame *f)
{
Lisp_Object rest, frame;
- int shared_p = 0;
+ bool shared_p = 0;
if (!FRAME_XIC_FONTSET (f))
return;
if (menubar)
{
Window child;
- int error_p = 0;
+ bool error_p = 0;
x_catch_errors (FRAME_X_DISPLAY (f));
memset (&ev, 0, sizeof ev);
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;
/* 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));
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. */
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);
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)
{
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;
}
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);
}
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.
{
/* 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;
/* 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. */
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);