Window win = FRAME_OUTER_WINDOW (f);
double alpha = 1.0;
double alpha_min = 1.0;
- unsigned int opac;
-
+ unsigned long opac;
+
if (FRAME_X_DISPLAY_INFO (f)->root_window != FRAME_X_OUTPUT (f)->parent_desc)
/* Since the WM decoration lies under the FRAME_OUTER_WINDOW,
we must treat the former instead of the latter. */
else if (0.0 <= alpha && alpha < alpha_min && alpha_min <= 1.0)
alpha = alpha_min;
- opac = (unsigned int)(alpha * OPAQUE);
+ opac = alpha * OPAQUE;
/* return unless necessary */
{
XGetWindowProperty(dpy, win, XInternAtom(dpy, OPACITY, False),
0L, 1L, False, XA_CARDINAL, &actual, &format, &n, &left,
- (unsigned char **) &data);
- if (data != None)
- if (*(unsigned int *)data == opac)
+ &data);
+ if (actual != None)
+ if (*(unsigned long *)data == opac)
{
XFree ((void *) data);
return;
x_set_glyph_string_clipping (s);
relief_drawn_p = 1;
}
- else if ((s->prev && s->prev->hl != s->hl && s->left_overhang)
- || (s->next && s->next->hl != s->hl && s->right_overhang))
+ else if (!s->clip_head /* draw_glyphs didn't specify a clip mask. */
+ && !s->clip_tail
+ && ((s->prev && s->prev->hl != s->hl && s->left_overhang)
+ || (s->next && s->next->hl != s->hl && s->right_overhang)))
/* We must clip just this glyph. left_overhang part has already
drawn when s->prev was drawn, and right_overhang part will be
drawn later when s->next is drawn. */
else
thickness = 1;
if (x_underline_at_descent_line)
- position = (s->height - thickness) - s->ybase;
+ position = (s->height - thickness) - (s->ybase - s->y);
else
{
/* Get the underline position. This is the recommended
else if (s->font)
position = (s->font->descent + 1) / 2;
}
- s->underline_thickness = thickness;
- s->underline_position = position;
+ position = max (position, underline_minimum_offset);
}
+ /* Check the sanity of thickness and position. We should
+ avoid drawing underline out of the current line area. */
+ if (s->y + s->height <= s->ybase + position)
+ position = (s->height - 1) - (s->ybase - s->y);
+ if (s->y + s->height < s->ybase + position + thickness)
+ thickness = (s->y + s->height) - (s->ybase + position);
+ s->underline_thickness = thickness;
+ s->underline_position = position;
y = s->ybase + position;
if (s->face->underline_defaulted_p)
XFillRectangle (s->display, s->window, s->gc,
XFlush (FRAME_X_DISPLAY (f));
}
- if (f->output_data.x->saved_menu_event)
- xfree (f->output_data.x->saved_menu_event);
-
+ xfree (f->output_data.x->saved_menu_event);
xfree (f->output_data.x);
f->output_data.x = NULL;
xim_close_dpy (dpyinfo);
#endif
- if (dpyinfo->x_id_name)
- xfree (dpyinfo->x_id_name);
- if (dpyinfo->color_cells)
- xfree (dpyinfo->color_cells);
+ xfree (dpyinfo->x_id_name);
+ xfree (dpyinfo->color_cells);
xfree (dpyinfo);
}
doc: /* *Non-nil means make use of UNDERLINE_POSITION font properties.
A value of nil means ignore them. If you encounter fonts with bogus
UNDERLINE_POSITION font properties, for example 7x13 on XFree prior
-to 4.1, set this to nil. */);
+to 4.1, set this to nil. You can also use `underline-minimum-offset'
+to override the font's UNDERLINE_POSITION for small font display
+sizes. */);
x_use_underline_position_properties = 1;
DEFVAR_BOOL ("x-underline-at-descent-line",