aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKim F. Storm2003-11-27 21:17:23 +0000
committerKim F. Storm2003-11-27 21:17:23 +0000
commitf65536faefa52fcd0da5f9fb77e3bd31ce5cefc6 (patch)
tree6e2bccd4b8312bb9906c7527db1c6905ec8e6fde /src
parent1365f3435e9ccc3fb6fdd8050e3d411e008585ba (diff)
downloademacs-f65536faefa52fcd0da5f9fb77e3bd31ce5cefc6.tar.gz
emacs-f65536faefa52fcd0da5f9fb77e3bd31ce5cefc6.zip
(Vdisplay_pixels_per_inch): New variable.
(Vshow_text_cursor_in_void): New variable. (glyph_to_pixel_coords): Don't use negative hpos. (x_y_to_hpos_vpos): Fix for partially visible first glyph. (append_stretch_glyph): Change ascent arg to be actual value in pixels rather than ratio to height. Callers changed. (calc_pixel_width_or_height): New aux function, implementing pixel based artihmetic for glyph widths and heights. (produce_stretch_glyph): Use calc_pixel_width_or_height for :width, :height, :align-to, and :ascent, thus allowing these to be specified in pixels as well as multiples of characters. Don't produce stretch glyphs with zero width or height. (get_specified_cursor_type): Declare static. (get_window_cursor_type): Declare static. Add glyph arg to be able to know when cursor is on an image; always substitute hollow-box cursor for filled-box cursor on images, to avoid negative images and flicker when blinking the cursor. (display_and_set_cursor): Pass glyph to get_window_cursor_type. (note_mode_line_or_margin_highlight): Use non-text cursor rather than vertical scroll-bar cursor in display margins. (note_mouse_highlight): Use non-text cursor rather than text cursor in fringes and over images in the text area. Use non-text cursor when mouse pointer is outside editable text, i.e. in the void after end-of-line or end-of-buffer; this was already done for W32, but is now standard for all systems -- user can toggle show-text-cursor-in-void to get old behaviour. (syms_of_xdisp): DEFVAR_LISP Vshow_text_cursor_in_void and Vdisplay_pixels_per_inch.
Diffstat (limited to 'src')
-rw-r--r--src/xdisp.c361
1 files changed, 303 insertions, 58 deletions
diff --git a/src/xdisp.c b/src/xdisp.c
index 90fbead4d17..c2717552cc5 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -295,16 +295,24 @@ extern Lisp_Object Qface, Qinvisible, Qwidth;
295 295
296/* Symbols used in text property values. */ 296/* Symbols used in text property values. */
297 297
298Lisp_Object Vdisplay_pixels_per_inch;
298Lisp_Object Qspace, QCalign_to, QCrelative_width, QCrelative_height; 299Lisp_Object Qspace, QCalign_to, QCrelative_width, QCrelative_height;
299Lisp_Object Qleft_margin, Qright_margin, Qspace_width, Qraise; 300Lisp_Object Qleft_margin, Qright_margin, Qspace_width, Qraise;
300Lisp_Object Qmargin; 301Lisp_Object Qmargin;
301extern Lisp_Object Qheight; 302extern Lisp_Object Qheight;
302extern Lisp_Object QCwidth, QCheight, QCascent; 303extern Lisp_Object QCwidth, QCheight, QCascent;
304extern Lisp_Object Qscroll_bar;
303 305
304/* Non-nil means highlight trailing whitespace. */ 306/* Non-nil means highlight trailing whitespace. */
305 307
306Lisp_Object Vshow_trailing_whitespace; 308Lisp_Object Vshow_trailing_whitespace;
307 309
310/* Non-nil means show the text cursor in void text areas
311 i.e. in blank areas after eol and eob. This used to be
312 the default in 21.3. */
313
314Lisp_Object Vshow_text_cursor_in_void;
315
308/* Name of the face used to highlight trailing whitespace. */ 316/* Name of the face used to highlight trailing whitespace. */
309 317
310Lisp_Object Qtrailing_whitespace; 318Lisp_Object Qtrailing_whitespace;
@@ -1539,6 +1547,10 @@ glyph_to_pixel_coords (w, hpos, vpos, frame_x, frame_y)
1539 ++glyph; 1547 ++glyph;
1540 } 1548 }
1541 1549
1550 /* If first glyph is partially visible, its first visible position is still 0. */
1551 if (hpos < 0)
1552 hpos = 0;
1553
1542 success_p = 1; 1554 success_p = 1;
1543 } 1555 }
1544 else 1556 else
@@ -1613,7 +1625,7 @@ x_y_to_hpos_vpos (w, x, y, hpos, vpos, area, buffer_only_p)
1613 else if (x < window_box_right_offset (w, TEXT_AREA)) 1625 else if (x < window_box_right_offset (w, TEXT_AREA))
1614 { 1626 {
1615 *area = TEXT_AREA; 1627 *area = TEXT_AREA;
1616 x0 = window_box_left_offset (w, TEXT_AREA); 1628 x0 = window_box_left_offset (w, TEXT_AREA) + min (row->x, 0);
1617 } 1629 }
1618 else 1630 else
1619 { 1631 {
@@ -17818,20 +17830,19 @@ produce_image_glyph (it)
17818 17830
17819/* Append a stretch glyph to IT->glyph_row. OBJECT is the source 17831/* Append a stretch glyph to IT->glyph_row. OBJECT is the source
17820 of the glyph, WIDTH and HEIGHT are the width and height of the 17832 of the glyph, WIDTH and HEIGHT are the width and height of the
17821 stretch. ASCENT is the percentage/100 of HEIGHT to use for the 17833 stretch. ASCENT is the ascent of the glyph (0 <= ASCENT <= HEIGHT). */
17822 ascent of the glyph (0 <= ASCENT <= 1). */
17823 17834
17824static void 17835static void
17825append_stretch_glyph (it, object, width, height, ascent) 17836append_stretch_glyph (it, object, width, height, ascent)
17826 struct it *it; 17837 struct it *it;
17827 Lisp_Object object; 17838 Lisp_Object object;
17828 int width, height; 17839 int width, height;
17829 double ascent; 17840 int ascent;
17830{ 17841{
17831 struct glyph *glyph; 17842 struct glyph *glyph;
17832 enum glyph_row_area area = it->area; 17843 enum glyph_row_area area = it->area;
17833 17844
17834 xassert (ascent >= 0 && ascent <= 1); 17845 xassert (ascent >= 0 && ascent <= height);
17835 17846
17836 glyph = it->glyph_row->glyphs[area] + it->glyph_row->used[area]; 17847 glyph = it->glyph_row->glyphs[area] + it->glyph_row->used[area];
17837 if (glyph < it->glyph_row->glyphs[area + 1]) 17848 if (glyph < it->glyph_row->glyphs[area + 1])
@@ -17848,7 +17859,7 @@ append_stretch_glyph (it, object, width, height, ascent)
17848 glyph->padding_p = 0; 17859 glyph->padding_p = 0;
17849 glyph->glyph_not_available_p = 0; 17860 glyph->glyph_not_available_p = 0;
17850 glyph->face_id = it->face_id; 17861 glyph->face_id = it->face_id;
17851 glyph->u.stretch.ascent = height * ascent; 17862 glyph->u.stretch.ascent = ascent;
17852 glyph->u.stretch.height = height; 17863 glyph->u.stretch.height = height;
17853 glyph->font_type = FONT_TYPE_UNKNOWN; 17864 glyph->font_type = FONT_TYPE_UNKNOWN;
17854 ++it->glyph_row->used[area]; 17865 ++it->glyph_row->used[area];
@@ -17856,6 +17867,209 @@ append_stretch_glyph (it, object, width, height, ascent)
17856} 17867}
17857 17868
17858 17869
17870/* Calculate a width or height in pixels from a specification using
17871 the following elements:
17872
17873 SPEC ::=
17874 NUM - a (fractional) multiple of the default font width/height
17875 (NUM) - specifies exactly NUM pixels
17876 UNIT - a fixed number of pixels, see below.
17877 ELEMENT - size of a display element in pixels, see below.
17878 (NUM . SPEC) - equals NUM * SPEC
17879 (+ SPEC SPEC ...) - add pixel values
17880 (- SPEC SPEC ...) - subtract pixel values
17881 (- SPEC) - negate pixel value
17882
17883 NUM ::=
17884 INT or FLOAT - a number constant
17885 SYMBOL - use symbol's (buffer local) variable binding.
17886
17887 UNIT ::=
17888 in - pixels per inch *)
17889 mm - pixels per 1/1000 meter *)
17890 cm - pixels per 1/100 meter *)
17891 width - width of current font in pixels.
17892 height - height of current font in pixels.
17893
17894 *) using the ratio(s) defined in display-pixels-per-inch.
17895
17896 ELEMENT ::=
17897
17898 left-fringe - left fringe width in pixels
17899 (left-fringe . nil) - left fringe width if inside margins, else 0
17900 (left-fringe . t) - left fringe width if outside margins, else 0
17901
17902 right-fringe - right fringe width in pixels
17903 (right-fringe . nil) - right fringe width if inside margins, else 0
17904 (right-fringe . t) - right fringe width if outside margins, else 0
17905
17906 left-margin - left margin width in pixels
17907 right-margin - right margin width in pixels
17908
17909 scroll-bar - scroll-bar area width in pixels
17910 (scroll-bar . left) - scroll-bar width if on left, else 0
17911 (scroll-bar . right) - scroll-bar width if on right, else 0
17912
17913 Examples:
17914
17915 Pixels corresponding to 5 inches:
17916 (5 . in)
17917
17918 Total width of non-text areas on left side of window:
17919 (+ left-fringe left-margin (scroll-bar . left))
17920
17921 Total width of fringes if inside display margins:
17922 (+ (left-fringe) (right-fringe))
17923
17924 Width of left margin minus width of 1 character in the default font:
17925 (- left-margin 1)
17926
17927 Width of left margin minus width of 2 characters in the current font:
17928 (- left-margin (2 . width))
17929
17930 Width of left fringe plus left margin minus one pixel:
17931 (- (+ left-fringe left-margin) (1))
17932 (+ left-fringe left-margin (- (1)))
17933 (+ left-fringe left-margin (-1))
17934
17935*/
17936
17937#define NUMVAL(X) \
17938 ((INTEGERP (X) || FLOATP (X)) \
17939 ? XFLOATINT (X) \
17940 : - 1)
17941
17942static int
17943calc_pixel_width_or_height (res, it, prop, font, width_p)
17944 double *res;
17945 struct it *it;
17946 Lisp_Object prop;
17947 XFontStruct *font;
17948 int width_p;
17949{
17950 double pixels;
17951
17952#define OK_PIXELS(val) ((*res = (val)), 1)
17953
17954 if (SYMBOLP (prop))
17955 {
17956 if (SCHARS (SYMBOL_NAME (prop)) == 2)
17957 {
17958 char *unit = SDATA (SYMBOL_NAME (prop));
17959
17960 if (unit[0] == 'i' && unit[1] == 'n')
17961 pixels = 1.0;
17962 else if (unit[0] == 'm' && unit[1] == 'm')
17963 pixels = 25.4;
17964 else if (unit[0] == 'c' && unit[1] == 'm')
17965 pixels = 2.54;
17966 else
17967 pixels = 0;
17968 if (pixels > 0)
17969 {
17970 double ppi;
17971 if ((ppi = NUMVAL (Vdisplay_pixels_per_inch), ppi > 0)
17972 || (CONSP (Vdisplay_pixels_per_inch)
17973 && (ppi = (width_p
17974 ? NUMVAL (XCAR (Vdisplay_pixels_per_inch))
17975 : NUMVAL (XCDR (Vdisplay_pixels_per_inch))),
17976 ppi > 0)))
17977 return OK_PIXELS (ppi / pixels);
17978
17979 return 0;
17980 }
17981 }
17982
17983 if (EQ (prop, Qheight))
17984 return OK_PIXELS (font ? FONT_HEIGHT (font) : FRAME_LINE_HEIGHT (it->f));
17985 if (EQ (prop, Qwidth))
17986 return OK_PIXELS (font ? FONT_WIDTH (font) : FRAME_COLUMN_WIDTH (it->f));
17987 if (EQ (prop, Qleft_fringe))
17988 return OK_PIXELS (WINDOW_LEFT_FRINGE_WIDTH (it->w));
17989 if (EQ (prop, Qright_fringe))
17990 return OK_PIXELS (WINDOW_RIGHT_FRINGE_WIDTH (it->w));
17991 if (EQ (prop, Qleft_margin))
17992 return OK_PIXELS (WINDOW_LEFT_MARGIN_WIDTH (it->w));
17993 if (EQ (prop, Qright_margin))
17994 return OK_PIXELS (WINDOW_RIGHT_MARGIN_WIDTH (it->w));
17995 if (EQ (prop, Qscroll_bar))
17996 return OK_PIXELS (WINDOW_SCROLL_BAR_AREA_WIDTH (it->w));
17997
17998 prop = Fbuffer_local_value (prop, it->w->buffer);
17999 }
18000
18001 if (INTEGERP (prop) || FLOATP (prop))
18002 {
18003 int base_unit = (width_p
18004 ? FRAME_COLUMN_WIDTH (it->f)
18005 : FRAME_LINE_HEIGHT (it->f));
18006 return OK_PIXELS (XFLOATINT (prop) * base_unit);
18007 }
18008
18009 if (CONSP (prop))
18010 {
18011 Lisp_Object car = XCAR (prop);
18012 Lisp_Object cdr = XCDR (prop);
18013
18014 if (SYMBOLP (car))
18015 {
18016 if (EQ (car, Qplus) || EQ (car, Qminus))
18017 {
18018 int first = 1;
18019 double px;
18020
18021 pixels = 0;
18022 while (CONSP (cdr))
18023 {
18024 if (!calc_pixel_width_or_height (&px, it, XCAR (cdr), font, width_p))
18025 return 0;
18026 if (first)
18027 pixels = (EQ (car, Qplus) ? px : -px), first = 0;
18028 else
18029 pixels += px;
18030 cdr = XCDR (cdr);
18031 }
18032 if (EQ (car, Qminus))
18033 pixels = -pixels;
18034 return OK_PIXELS (pixels);
18035 }
18036
18037 if (EQ (car, Qleft_fringe))
18038 return OK_PIXELS ((WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (it->w)
18039 == !NILP (cdr))
18040 ? WINDOW_LEFT_FRINGE_WIDTH (it->w)
18041 : 0);
18042 if (EQ (car, Qright_fringe))
18043 return OK_PIXELS ((WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (it->w)
18044 == !NILP (cdr))
18045 ? WINDOW_RIGHT_FRINGE_WIDTH (it->w)
18046 : 0);
18047 if (EQ (car, Qscroll_bar))
18048 return OK_PIXELS ((WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_LEFT (it->w)
18049 == EQ (cdr, Qleft))
18050 ? WINDOW_SCROLL_BAR_AREA_WIDTH (it->w)
18051 : 0);
18052
18053 car = Fbuffer_local_value (car, it->w->buffer);
18054 }
18055
18056 if (INTEGERP (car) || FLOATP (car))
18057 {
18058 double fact;
18059 pixels = XFLOATINT (car);
18060 if (NILP (cdr))
18061 return OK_PIXELS (pixels);
18062 if (calc_pixel_width_or_height (&fact, it, cdr, font, width_p))
18063 return OK_PIXELS (pixels * fact);
18064 return 0;
18065 }
18066
18067 return 0;
18068 }
18069
18070 return 0;
18071}
18072
17859/* Produce a stretch glyph for iterator IT. IT->object is the value 18073/* Produce a stretch glyph for iterator IT. IT->object is the value
17860 of the glyph property displayed. The value must be a list 18074 of the glyph property displayed. The value must be a list
17861 `(space KEYWORD VALUE ...)' with the following KEYWORD/VALUE pairs 18075 `(space KEYWORD VALUE ...)' with the following KEYWORD/VALUE pairs
@@ -17887,20 +18101,16 @@ append_stretch_glyph (it, object, width, height, ascent)
17887 of the stretch should be used for the ascent of the stretch. 18101 of the stretch should be used for the ascent of the stretch.
17888 ASCENT must be in the range 0 <= ASCENT <= 100. */ 18102 ASCENT must be in the range 0 <= ASCENT <= 100. */
17889 18103
17890#define NUMVAL(X) \
17891 ((INTEGERP (X) || FLOATP (X)) \
17892 ? XFLOATINT (X) \
17893 : - 1)
17894
17895
17896static void 18104static void
17897produce_stretch_glyph (it) 18105produce_stretch_glyph (it)
17898 struct it *it; 18106 struct it *it;
17899{ 18107{
17900 /* (space :width WIDTH :height HEIGHT. */ 18108 /* (space :width WIDTH :height HEIGHT ...) */
17901 Lisp_Object prop, plist; 18109 Lisp_Object prop, plist;
17902 int width = 0, height = 0; 18110 int width = 0, height = 0;
17903 double ascent = 0; 18111 int zero_width_ok_p = 0, zero_height_ok_p = 0;
18112 int ascent = 0;
18113 double tem;
17904 struct face *face = FACE_FROM_ID (it->f, it->face_id); 18114 struct face *face = FACE_FROM_ID (it->f, it->face_id);
17905 XFontStruct *font = face->font ? face->font : FRAME_FONT (it->f); 18115 XFontStruct *font = face->font ? face->font : FRAME_FONT (it->f);
17906 18116
@@ -17911,10 +18121,13 @@ produce_stretch_glyph (it)
17911 plist = XCDR (it->object); 18121 plist = XCDR (it->object);
17912 18122
17913 /* Compute the width of the stretch. */ 18123 /* Compute the width of the stretch. */
17914 if (prop = Fplist_get (plist, QCwidth), 18124 if ((prop = Fplist_get (plist, QCwidth), !NILP (prop))
17915 NUMVAL (prop) > 0) 18125 && calc_pixel_width_or_height (&tem, it, prop, font, 1))
17916 /* Absolute width `:width WIDTH' specified and valid. */ 18126 {
17917 width = NUMVAL (prop) * FRAME_COLUMN_WIDTH (it->f); 18127 /* Absolute width `:width WIDTH' specified and valid. */
18128 zero_width_ok_p = 1;
18129 width = (int)tem;
18130 }
17918 else if (prop = Fplist_get (plist, QCrelative_width), 18131 else if (prop = Fplist_get (plist, QCrelative_width),
17919 NUMVAL (prop) > 0) 18132 NUMVAL (prop) > 0)
17920 { 18133 {
@@ -17939,38 +18152,48 @@ produce_stretch_glyph (it)
17939 x_produce_glyphs (&it2); 18152 x_produce_glyphs (&it2);
17940 width = NUMVAL (prop) * it2.pixel_width; 18153 width = NUMVAL (prop) * it2.pixel_width;
17941 } 18154 }
17942 else if (prop = Fplist_get (plist, QCalign_to), 18155 else if ((prop = Fplist_get (plist, QCalign_to), !NILP (prop))
17943 NUMVAL (prop) > 0) 18156 && calc_pixel_width_or_height (&tem, it, prop, font, 1))
17944 width = NUMVAL (prop) * FRAME_COLUMN_WIDTH (it->f) - it->current_x; 18157 {
18158 width = max (0, (int)tem - it->current_x);
18159 zero_width_ok_p = 1;
18160 }
17945 else 18161 else
17946 /* Nothing specified -> width defaults to canonical char width. */ 18162 /* Nothing specified -> width defaults to canonical char width. */
17947 width = FRAME_COLUMN_WIDTH (it->f); 18163 width = FRAME_COLUMN_WIDTH (it->f);
17948 18164
18165 if (width <= 0 && (width < 0 || !zero_width_ok_p))
18166 width = 1;
18167
17949 /* Compute height. */ 18168 /* Compute height. */
17950 if (prop = Fplist_get (plist, QCheight), 18169 if ((prop = Fplist_get (plist, QCheight), !NILP (prop))
17951 NUMVAL (prop) > 0) 18170 && calc_pixel_width_or_height (&tem, it, prop, font, 0))
17952 height = NUMVAL (prop) * FRAME_LINE_HEIGHT (it->f); 18171 {
18172 height = (int)tem;
18173 zero_height_ok_p = 1;
18174 }
17953 else if (prop = Fplist_get (plist, QCrelative_height), 18175 else if (prop = Fplist_get (plist, QCrelative_height),
17954 NUMVAL (prop) > 0) 18176 NUMVAL (prop) > 0)
17955 height = FONT_HEIGHT (font) * NUMVAL (prop); 18177 height = FONT_HEIGHT (font) * NUMVAL (prop);
17956 else 18178 else
17957 height = FONT_HEIGHT (font); 18179 height = FONT_HEIGHT (font);
17958 18180
18181 if (height <= 0 && (height < 0 || !zero_height_ok_p))
18182 height = 1;
18183
17959 /* Compute percentage of height used for ascent. If 18184 /* Compute percentage of height used for ascent. If
17960 `:ascent ASCENT' is present and valid, use that. Otherwise, 18185 `:ascent ASCENT' is present and valid, use that. Otherwise,
17961 derive the ascent from the font in use. */ 18186 derive the ascent from the font in use. */
17962 if (prop = Fplist_get (plist, QCascent), 18187 if (prop = Fplist_get (plist, QCascent),
17963 NUMVAL (prop) > 0 && NUMVAL (prop) <= 100) 18188 NUMVAL (prop) > 0 && NUMVAL (prop) <= 100)
17964 ascent = NUMVAL (prop) / 100.0; 18189 ascent = height * NUMVAL (prop) / 100.0;
18190 else if (!NILP (prop)
18191 && calc_pixel_width_or_height (&tem, it, prop, font, 0))
18192 ascent = min (max (0, (int)tem), height);
17965 else 18193 else
17966 ascent = (double) FONT_BASE (font) / FONT_HEIGHT (font); 18194 ascent = (height * FONT_BASE (font)) / FONT_HEIGHT (font);
17967
17968 if (width <= 0)
17969 width = 1;
17970 if (height <= 0)
17971 height = 1;
17972 18195
17973 if (it->glyph_row) 18196 if (width > 0 && height > 0 && it->glyph_row)
17974 { 18197 {
17975 Lisp_Object object = it->stack[it->sp - 1].string; 18198 Lisp_Object object = it->stack[it->sp - 1].string;
17976 if (!STRINGP (object)) 18199 if (!STRINGP (object))
@@ -17979,11 +18202,11 @@ produce_stretch_glyph (it)
17979 } 18202 }
17980 18203
17981 it->pixel_width = width; 18204 it->pixel_width = width;
17982 it->ascent = it->phys_ascent = height * ascent; 18205 it->ascent = it->phys_ascent = ascent;
17983 it->descent = it->phys_descent = height - it->ascent; 18206 it->descent = it->phys_descent = height - it->ascent;
17984 it->nglyphs = 1; 18207 it->nglyphs = width > 0 && height > 0 ? 1 : 0;
17985 18208
17986 if (face->box != FACE_NO_BOX) 18209 if (width > 0 && height > 0 && face->box != FACE_NO_BOX)
17987 { 18210 {
17988 if (face->box_line_width > 0) 18211 if (face->box_line_width > 0)
17989 { 18212 {
@@ -18144,8 +18367,8 @@ x_produce_glyphs (it)
18144 { 18367 {
18145 /* Translate a space with a `space-width' property 18368 /* Translate a space with a `space-width' property
18146 into a stretch glyph. */ 18369 into a stretch glyph. */
18147 double ascent = (double) FONT_BASE (font) 18370 int ascent = (((it->ascent + it->descent) * FONT_BASE (font))
18148 / FONT_HEIGHT (font); 18371 / FONT_HEIGHT (font));
18149 append_stretch_glyph (it, it->object, it->pixel_width, 18372 append_stretch_glyph (it, it->object, it->pixel_width,
18150 it->ascent + it->descent, ascent); 18373 it->ascent + it->descent, ascent);
18151 } 18374 }
@@ -18193,9 +18416,8 @@ x_produce_glyphs (it)
18193 18416
18194 if (it->glyph_row) 18417 if (it->glyph_row)
18195 { 18418 {
18196 double ascent = (double) it->ascent / (it->ascent + it->descent);
18197 append_stretch_glyph (it, it->object, it->pixel_width, 18419 append_stretch_glyph (it, it->object, it->pixel_width,
18198 it->ascent + it->descent, ascent); 18420 it->ascent + it->descent, it->ascent);
18199 } 18421 }
18200 } 18422 }
18201 else 18423 else
@@ -18738,7 +18960,7 @@ x_clear_end_of_line (to_x)
18738 ARG. If type is BAR_CURSOR, return in *WIDTH the specified width 18960 ARG. If type is BAR_CURSOR, return in *WIDTH the specified width
18739 of the bar cursor. */ 18961 of the bar cursor. */
18740 18962
18741enum text_cursor_kinds 18963static enum text_cursor_kinds
18742get_specified_cursor_type (arg, width) 18964get_specified_cursor_type (arg, width)
18743 Lisp_Object arg; 18965 Lisp_Object arg;
18744 int *width; 18966 int *width;
@@ -18829,9 +19051,10 @@ set_frame_cursor_types (f, arg)
18829 setting of cursor-type. If explicitly marked off, draw no cursor. 19051 setting of cursor-type. If explicitly marked off, draw no cursor.
18830 In all other cases, we want a hollow box cursor. */ 19052 In all other cases, we want a hollow box cursor. */
18831 19053
18832enum text_cursor_kinds 19054static enum text_cursor_kinds
18833get_window_cursor_type (w, width, active_cursor) 19055get_window_cursor_type (w, glyph, width, active_cursor)
18834 struct window *w; 19056 struct window *w;
19057 struct glyph *glyph;
18835 int *width; 19058 int *width;
18836 int *active_cursor; 19059 int *active_cursor;
18837{ 19060{
@@ -18895,7 +19118,13 @@ get_window_cursor_type (w, width, active_cursor)
18895 19118
18896 /* Use normal cursor if not blinked off. */ 19119 /* Use normal cursor if not blinked off. */
18897 if (!w->cursor_off_p) 19120 if (!w->cursor_off_p)
18898 return cursor_type; 19121 {
19122 if (glyph->type == IMAGE_GLYPH) {
19123 if (cursor_type == FILLED_BOX_CURSOR)
19124 cursor_type = HOLLOW_BOX_CURSOR;
19125 }
19126 return cursor_type;
19127 }
18899 19128
18900 /* Cursor is blinked off, so determine how to "toggle" it. */ 19129 /* Cursor is blinked off, so determine how to "toggle" it. */
18901 19130
@@ -19215,7 +19444,8 @@ display_and_set_cursor (w, on, hpos, vpos, x, y)
19215 xassert (interrupt_input_blocked); 19444 xassert (interrupt_input_blocked);
19216 19445
19217 /* Set new_cursor_type to the cursor we want to be displayed. */ 19446 /* Set new_cursor_type to the cursor we want to be displayed. */
19218 new_cursor_type = get_window_cursor_type (w, &new_cursor_width, &active_cursor); 19447 new_cursor_type = get_window_cursor_type (w, glyph,
19448 &new_cursor_width, &active_cursor);
19219 19449
19220 /* If cursor is currently being shown and we don't want it to be or 19450 /* If cursor is currently being shown and we don't want it to be or
19221 it is in the wrong place, or the cursor type is not what we want, 19451 it is in the wrong place, or the cursor type is not what we want,
@@ -19729,14 +19959,14 @@ note_mode_line_or_margin_highlight (w, x, y, area)
19729{ 19959{
19730 struct frame *f = XFRAME (w->frame); 19960 struct frame *f = XFRAME (w->frame);
19731 Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f); 19961 Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
19732 Cursor cursor = dpyinfo->vertical_scroll_bar_cursor; 19962 Cursor cursor = FRAME_X_OUTPUT (f)->nontext_cursor;
19733 int charpos; 19963 int charpos;
19734 Lisp_Object string, help, map, pos; 19964 Lisp_Object string, help, map, pos;
19735 19965
19736 if (area == ON_MODE_LINE || area == ON_HEADER_LINE) 19966 if (area == ON_MODE_LINE || area == ON_HEADER_LINE)
19737 string = mode_line_string (w, &x, &y, area, &charpos); 19967 string = mode_line_string (w, &x, &y, 0, 0, area, &charpos);
19738 else 19968 else
19739 string = marginal_area_string (w, &x, &y, area, &charpos); 19969 string = marginal_area_string (w, &x, &y, 0, 0, area, &charpos);
19740 19970
19741 if (STRINGP (string)) 19971 if (STRINGP (string))
19742 { 19972 {
@@ -19755,11 +19985,14 @@ note_mode_line_or_margin_highlight (w, x, y, area)
19755 } 19985 }
19756 19986
19757 /* Change the mouse pointer according to what is under X/Y. */ 19987 /* Change the mouse pointer according to what is under X/Y. */
19758 map = Fget_text_property (pos, Qlocal_map, string); 19988 if (area == ON_MODE_LINE)
19759 if (!KEYMAPP (map)) 19989 {
19760 map = Fget_text_property (pos, Qkeymap, string); 19990 map = Fget_text_property (pos, Qlocal_map, string);
19761 if (KEYMAPP (map)) 19991 if (!KEYMAPP (map))
19762 cursor = FRAME_X_OUTPUT (f)->nontext_cursor; 19992 map = Fget_text_property (pos, Qkeymap, string);
19993 if (!KEYMAPP (map))
19994 cursor = dpyinfo->vertical_scroll_bar_cursor;
19995 }
19763 } 19996 }
19764 19997
19765 rif->define_frame_cursor (f, cursor); 19998 rif->define_frame_cursor (f, cursor);
@@ -19844,6 +20077,8 @@ note_mouse_highlight (f, x, y)
19844 20077
19845 if (part == ON_VERTICAL_BORDER) 20078 if (part == ON_VERTICAL_BORDER)
19846 cursor = FRAME_X_OUTPUT (f)->horizontal_drag_cursor; 20079 cursor = FRAME_X_OUTPUT (f)->horizontal_drag_cursor;
20080 else if (part == ON_LEFT_FRINGE || part == ON_RIGHT_FRINGE)
20081 cursor = FRAME_X_OUTPUT (f)->nontext_cursor;
19847 else 20082 else
19848 cursor = FRAME_X_OUTPUT (f)->text_cursor; 20083 cursor = FRAME_X_OUTPUT (f)->text_cursor;
19849 20084
@@ -19872,14 +20107,10 @@ note_mouse_highlight (f, x, y)
19872 || area != TEXT_AREA 20107 || area != TEXT_AREA
19873 || !MATRIX_ROW (w->current_matrix, vpos)->displays_text_p) 20108 || !MATRIX_ROW (w->current_matrix, vpos)->displays_text_p)
19874 { 20109 {
19875#if defined (HAVE_NTGUI)
19876 /* ++KFS: Why is this necessary on W32 ? */
19877 clear_mouse_face (dpyinfo);
19878 cursor = FRAME_X_OUTPUT (f)->nontext_cursor;
19879#else
19880 if (clear_mouse_face (dpyinfo)) 20110 if (clear_mouse_face (dpyinfo))
19881 cursor = No_Cursor; 20111 cursor = No_Cursor;
19882#endif 20112 if (NILP (Vshow_text_cursor_in_void))
20113 cursor = FRAME_X_OUTPUT (f)->nontext_cursor;
19883 goto set_cursor; 20114 goto set_cursor;
19884 } 20115 }
19885 20116
@@ -19892,6 +20123,9 @@ note_mouse_highlight (f, x, y)
19892 if (BUFFERP (object) && pos > BUF_Z (b)) 20123 if (BUFFERP (object) && pos > BUF_Z (b))
19893 goto set_cursor; 20124 goto set_cursor;
19894 20125
20126 if (glyph->type == IMAGE_GLYPH)
20127 cursor = FRAME_X_OUTPUT (f)->nontext_cursor;
20128
19895 /* Make the window's buffer temporarily current for 20129 /* Make the window's buffer temporarily current for
19896 overlays_at and compute_char_face. */ 20130 overlays_at and compute_char_face. */
19897 obuf = current_buffer; 20131 obuf = current_buffer;
@@ -20947,6 +21181,11 @@ wide as that tab on the display. */);
20947The face used for trailing whitespace is `trailing-whitespace'. */); 21181The face used for trailing whitespace is `trailing-whitespace'. */);
20948 Vshow_trailing_whitespace = Qnil; 21182 Vshow_trailing_whitespace = Qnil;
20949 21183
21184 DEFVAR_LISP ("show-text-cursor-in-void", &Vshow_text_cursor_in_void,
21185 doc: /* Non-nil means show the text cursor in void text areas.
21186The default is to show the non-text (typically arrow) cursor. */);
21187 Vshow_text_cursor_in_void = Qnil;
21188
20950 DEFVAR_LISP ("inhibit-redisplay", &Vinhibit_redisplay, 21189 DEFVAR_LISP ("inhibit-redisplay", &Vinhibit_redisplay,
20951 doc: /* Non-nil means don't actually do any redisplay. 21190 doc: /* Non-nil means don't actually do any redisplay.
20952This is used for internal purposes. */); 21191This is used for internal purposes. */);
@@ -20985,6 +21224,11 @@ Recenter the window whenever point gets within this many lines
20985of the top or bottom of the window. */); 21224of the top or bottom of the window. */);
20986 scroll_margin = 0; 21225 scroll_margin = 0;
20987 21226
21227 DEFVAR_LISP ("display-pixels-per-inch", &Vdisplay_pixels_per_inch,
21228 doc: /* Pixels per inch on current display.
21229Value is a number or a cons (WIDTH-DPI . HEIGHT-DPI). */);
21230 Vdisplay_pixels_per_inch = make_float (72.0);
21231
20988#if GLYPH_DEBUG 21232#if GLYPH_DEBUG
20989 DEFVAR_INT ("debug-end-pos", &debug_end_pos, doc: /* Don't ask. */); 21233 DEFVAR_INT ("debug-end-pos", &debug_end_pos, doc: /* Don't ask. */);
20990#endif 21234#endif
@@ -21029,6 +21273,7 @@ This variable is not guaranteed to be accurate except while processing
21029This variable has the same structure as `mode-line-format' (which see), 21273This variable has the same structure as `mode-line-format' (which see),
21030and is used only on frames for which no explicit name has been set 21274and is used only on frames for which no explicit name has been set
21031\(see `modify-frame-parameters'). */); 21275\(see `modify-frame-parameters'). */);
21276
21032 DEFVAR_LISP ("icon-title-format", &Vicon_title_format, 21277 DEFVAR_LISP ("icon-title-format", &Vicon_title_format,
21033 doc: /* Template for displaying the title bar of an iconified frame. 21278 doc: /* Template for displaying the title bar of an iconified frame.
21034\(Assuming the window manager supports this feature.) 21279\(Assuming the window manager supports this feature.)