aboutsummaryrefslogtreecommitdiffstats
path: root/src/xterm.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/xterm.c')
-rw-r--r--src/xterm.c64
1 files changed, 43 insertions, 21 deletions
diff --git a/src/xterm.c b/src/xterm.c
index 5df7896a2b3..466037c75a2 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -181,6 +181,10 @@ static Lisp_Object last_window;
181 181
182int x_use_underline_position_properties; 182int x_use_underline_position_properties;
183 183
184/* Non-zero means to draw the underline at the same place as the descent line. */
185
186int x_underline_at_descent_line;
187
184/* This is a chain of structures for all the X displays currently in 188/* This is a chain of structures for all the X displays currently in
185 use. */ 189 use. */
186 190
@@ -2601,7 +2605,9 @@ x_draw_stretch_glyph_string (s)
2601 int background_width = s->background_width; 2605 int background_width = s->background_width;
2602 int x = s->x, left_x = window_box_left_offset (s->w, TEXT_AREA); 2606 int x = s->x, left_x = window_box_left_offset (s->w, TEXT_AREA);
2603 2607
2604 if (x < left_x) 2608 /* Don't draw into left margin, fringe or scrollbar area
2609 except for header line and mode line. */
2610 if (x < left_x && !s->row->mode_line_p)
2605 { 2611 {
2606 background_width -= left_x - x; 2612 background_width -= left_x - x;
2607 x = left_x; 2613 x = left_x;
@@ -2695,32 +2701,35 @@ x_draw_glyph_string (s)
2695 if (!XGetFontProperty (s->font, XA_UNDERLINE_THICKNESS, &h)) 2701 if (!XGetFontProperty (s->font, XA_UNDERLINE_THICKNESS, &h))
2696 h = 1; 2702 h = 1;
2697 2703
2698 /* Get the underline position. This is the recommended 2704 if (x_underline_at_descent_line)
2699 vertical offset in pixels from the baseline to the top of
2700 the underline. This is a signed value according to the
2701 specs, and its default is
2702
2703 ROUND ((maximum descent) / 2), with
2704 ROUND(x) = floor (x + 0.5) */
2705
2706 if (x_use_underline_position_properties
2707 && XGetFontProperty (s->font, XA_UNDERLINE_POSITION, &tem))
2708 y = s->ybase + (long) tem;
2709 else if (s->face->font)
2710 y = s->ybase + (s->face->font->max_bounds.descent + 1) / 2;
2711 else
2712 y = s->y + s->height - h; 2705 y = s->y + s->height - h;
2706 else
2707 {
2708 /* Get the underline position. This is the recommended
2709 vertical offset in pixels from the baseline to the top of
2710 the underline. This is a signed value according to the
2711 specs, and its default is
2712
2713 ROUND ((maximum descent) / 2), with
2714 ROUND(x) = floor (x + 0.5) */
2715
2716 if (x_use_underline_position_properties
2717 && XGetFontProperty (s->font, XA_UNDERLINE_POSITION, &tem))
2718 y = s->ybase + (long) tem;
2719 else if (s->face->font)
2720 y = s->ybase + (s->face->font->max_bounds.descent + 1) / 2;
2721 }
2713 2722
2714 if (s->face->underline_defaulted_p) 2723 if (s->face->underline_defaulted_p)
2715 XFillRectangle (s->display, s->window, s->gc, 2724 XFillRectangle (s->display, s->window, s->gc,
2716 s->x, y, s->width, h); 2725 s->x, y, s->background_width, h);
2717 else 2726 else
2718 { 2727 {
2719 XGCValues xgcv; 2728 XGCValues xgcv;
2720 XGetGCValues (s->display, s->gc, GCForeground, &xgcv); 2729 XGetGCValues (s->display, s->gc, GCForeground, &xgcv);
2721 XSetForeground (s->display, s->gc, s->face->underline_color); 2730 XSetForeground (s->display, s->gc, s->face->underline_color);
2722 XFillRectangle (s->display, s->window, s->gc, 2731 XFillRectangle (s->display, s->window, s->gc,
2723 s->x, y, s->width, h); 2732 s->x, y, s->background_width, h);
2724 XSetForeground (s->display, s->gc, xgcv.foreground); 2733 XSetForeground (s->display, s->gc, xgcv.foreground);
2725 } 2734 }
2726 } 2735 }
@@ -2732,14 +2741,14 @@ x_draw_glyph_string (s)
2732 2741
2733 if (s->face->overline_color_defaulted_p) 2742 if (s->face->overline_color_defaulted_p)
2734 XFillRectangle (s->display, s->window, s->gc, s->x, s->y + dy, 2743 XFillRectangle (s->display, s->window, s->gc, s->x, s->y + dy,
2735 s->width, h); 2744 s->background_width, h);
2736 else 2745 else
2737 { 2746 {
2738 XGCValues xgcv; 2747 XGCValues xgcv;
2739 XGetGCValues (s->display, s->gc, GCForeground, &xgcv); 2748 XGetGCValues (s->display, s->gc, GCForeground, &xgcv);
2740 XSetForeground (s->display, s->gc, s->face->overline_color); 2749 XSetForeground (s->display, s->gc, s->face->overline_color);
2741 XFillRectangle (s->display, s->window, s->gc, s->x, s->y + dy, 2750 XFillRectangle (s->display, s->window, s->gc, s->x, s->y + dy,
2742 s->width, h); 2751 s->background_width, h);
2743 XSetForeground (s->display, s->gc, xgcv.foreground); 2752 XSetForeground (s->display, s->gc, xgcv.foreground);
2744 } 2753 }
2745 } 2754 }
@@ -10096,8 +10105,8 @@ x_query_font (f, fontname)
10096 10105
10097 for (i = 0; i < dpyinfo->n_fonts; i++) 10106 for (i = 0; i < dpyinfo->n_fonts; i++)
10098 if (dpyinfo->font_table[i].name 10107 if (dpyinfo->font_table[i].name
10099 && (!strcmp (dpyinfo->font_table[i].name, fontname) 10108 && (!strcasecmp (dpyinfo->font_table[i].name, fontname)
10100 || !strcmp (dpyinfo->font_table[i].full_name, fontname))) 10109 || !strcasecmp (dpyinfo->font_table[i].full_name, fontname)))
10101 return (dpyinfo->font_table + i); 10110 return (dpyinfo->font_table + i);
10102 return NULL; 10111 return NULL;
10103} 10112}
@@ -10644,6 +10653,11 @@ x_term_init (display_name, xrm_option, resource_name)
10644 10653
10645 dpyinfo->cut_buffers_initialized = 0; 10654 dpyinfo->cut_buffers_initialized = 0;
10646 10655
10656 dpyinfo->x_dnd_atoms_size = 8;
10657 dpyinfo->x_dnd_atoms_length = 0;
10658 dpyinfo->x_dnd_atoms = xmalloc (sizeof (*dpyinfo->x_dnd_atoms)
10659 * dpyinfo->x_dnd_atoms_size);
10660
10647 connection = ConnectionNumber (dpyinfo->display); 10661 connection = ConnectionNumber (dpyinfo->display);
10648 dpyinfo->connection = connection; 10662 dpyinfo->connection = connection;
10649 10663
@@ -11104,6 +11118,14 @@ UNDERLINE_POSITION font properties, for example 7x13 on XFree prior
11104to 4.1, set this to nil. */); 11118to 4.1, set this to nil. */);
11105 x_use_underline_position_properties = 1; 11119 x_use_underline_position_properties = 1;
11106 11120
11121 DEFVAR_BOOL ("x-underline-at-descent-line",
11122 &x_underline_at_descent_line,
11123 doc: /* *Non-nil means to draw the underline at the same place as the descent line.
11124nil means to draw the underline according to the value of the variable
11125`x-use-underline-position-properties', which is usually at the baseline
11126level. The default value is nil. */);
11127 x_underline_at_descent_line = 0;
11128
11107 DEFVAR_BOOL ("x-mouse-click-focus-ignore-position", 11129 DEFVAR_BOOL ("x-mouse-click-focus-ignore-position",
11108 &x_mouse_click_focus_ignore_position, 11130 &x_mouse_click_focus_ignore_position,
11109 doc: /* Non-nil means that a mouse click to focus a frame does not move point. 11131 doc: /* Non-nil means that a mouse click to focus a frame does not move point.