Mercurial > emacs
comparison src/xterm.c @ 28321:fc0a61d81fc5
(x_display_and_set_cursor): Choose cursor depending
on buffer-local value of cursor_type.
(x_draw_bar_cursor): Add parameter WIDTH.
author | Gerd Moellmann <gerd@gnu.org> |
---|---|
date | Sun, 26 Mar 2000 16:24:24 +0000 |
parents | 1d4a11a5f39d |
children | c94ec7e56746 |
comparison
equal
deleted
inserted
replaced
28320:5e9613d20f46 | 28321:fc0a61d81fc5 |
---|---|
450 static void frame_unhighlight P_ ((struct frame *)); | 450 static void frame_unhighlight P_ ((struct frame *)); |
451 static void x_new_focus_frame P_ ((struct x_display_info *, struct frame *)); | 451 static void x_new_focus_frame P_ ((struct x_display_info *, struct frame *)); |
452 static void XTframe_rehighlight P_ ((struct frame *)); | 452 static void XTframe_rehighlight P_ ((struct frame *)); |
453 static void x_frame_rehighlight P_ ((struct x_display_info *)); | 453 static void x_frame_rehighlight P_ ((struct x_display_info *)); |
454 static void x_draw_hollow_cursor P_ ((struct window *, struct glyph_row *)); | 454 static void x_draw_hollow_cursor P_ ((struct window *, struct glyph_row *)); |
455 static void x_draw_bar_cursor P_ ((struct window *, struct glyph_row *)); | 455 static void x_draw_bar_cursor P_ ((struct window *, struct glyph_row *, int)); |
456 static int x_intersect_rectangles P_ ((XRectangle *, XRectangle *, | 456 static int x_intersect_rectangles P_ ((XRectangle *, XRectangle *, |
457 XRectangle *)); | 457 XRectangle *)); |
458 static void expose_frame P_ ((struct frame *, int, int, int, int)); | 458 static void expose_frame P_ ((struct frame *, int, int, int, int)); |
459 static void expose_window_tree P_ ((struct window *, XRectangle *)); | 459 static void expose_window_tree P_ ((struct window *, XRectangle *)); |
460 static void expose_window P_ ((struct window *, XRectangle *)); | 460 static void expose_window P_ ((struct window *, XRectangle *)); |
10051 angle equal to the one given by the font property XA_ITALIC_ANGLE. | 10051 angle equal to the one given by the font property XA_ITALIC_ANGLE. |
10052 Unfortunately, I didn't find a font yet that has this property set. | 10052 Unfortunately, I didn't find a font yet that has this property set. |
10053 --gerd. */ | 10053 --gerd. */ |
10054 | 10054 |
10055 static void | 10055 static void |
10056 x_draw_bar_cursor (w, row) | 10056 x_draw_bar_cursor (w, row, width) |
10057 struct window *w; | 10057 struct window *w; |
10058 struct glyph_row *row; | 10058 struct glyph_row *row; |
10059 int width; | |
10059 { | 10060 { |
10060 /* If cursor hpos is out of bounds, don't draw garbage. This can | 10061 /* If cursor hpos is out of bounds, don't draw garbage. This can |
10061 happen in mini-buffer windows when switching between echo area | 10062 happen in mini-buffer windows when switching between echo area |
10062 glyphs and mini-buffer. */ | 10063 glyphs and mini-buffer. */ |
10063 if (w->phys_cursor.hpos < row->used[TEXT_AREA]) | 10064 if (w->phys_cursor.hpos < row->used[TEXT_AREA]) |
10089 { | 10090 { |
10090 gc = XCreateGC (dpy, window, mask, &xgcv); | 10091 gc = XCreateGC (dpy, window, mask, &xgcv); |
10091 FRAME_X_DISPLAY_INFO (f)->scratch_cursor_gc = gc; | 10092 FRAME_X_DISPLAY_INFO (f)->scratch_cursor_gc = gc; |
10092 } | 10093 } |
10093 | 10094 |
10095 if (width < 0) | |
10096 width = f->output_data.x->cursor_width; | |
10097 | |
10094 x = WINDOW_TEXT_TO_FRAME_PIXEL_X (w, w->phys_cursor.x); | 10098 x = WINDOW_TEXT_TO_FRAME_PIXEL_X (w, w->phys_cursor.x); |
10095 x_clip_to_row (w, row, gc, 0); | 10099 x_clip_to_row (w, row, gc, 0); |
10096 XFillRectangle (dpy, window, gc, | 10100 XFillRectangle (dpy, window, gc, |
10097 x, | 10101 x, |
10098 WINDOW_TO_FRAME_PIXEL_Y (w, w->phys_cursor.y), | 10102 WINDOW_TO_FRAME_PIXEL_Y (w, w->phys_cursor.y), |
10099 min (cursor_glyph->pixel_width, | 10103 min (cursor_glyph->pixel_width, width), |
10100 f->output_data.x->cursor_width), | |
10101 row->height); | 10104 row->height); |
10102 XSetClipMask (dpy, gc, None); | 10105 XSetClipMask (dpy, gc, None); |
10103 } | 10106 } |
10104 } | 10107 } |
10105 | 10108 |
10252 struct window *w; | 10255 struct window *w; |
10253 int on, hpos, vpos, x, y; | 10256 int on, hpos, vpos, x, y; |
10254 { | 10257 { |
10255 struct frame *f = XFRAME (w->frame); | 10258 struct frame *f = XFRAME (w->frame); |
10256 int new_cursor_type; | 10259 int new_cursor_type; |
10260 int new_cursor_width; | |
10257 struct glyph_matrix *current_glyphs; | 10261 struct glyph_matrix *current_glyphs; |
10258 struct glyph_row *glyph_row; | 10262 struct glyph_row *glyph_row; |
10259 struct glyph *glyph; | 10263 struct glyph *glyph; |
10260 | 10264 |
10261 /* This is pointless on invisible frames, and dangerous on garbaged | 10265 /* This is pointless on invisible frames, and dangerous on garbaged |
10290 mini-buffer window, we want the cursor only to appear if we are | 10294 mini-buffer window, we want the cursor only to appear if we are |
10291 reading input from this window. For the selected window, we want | 10295 reading input from this window. For the selected window, we want |
10292 the cursor type given by the frame parameter. If explicitly | 10296 the cursor type given by the frame parameter. If explicitly |
10293 marked off, draw no cursor. In all other cases, we want a hollow | 10297 marked off, draw no cursor. In all other cases, we want a hollow |
10294 box cursor. */ | 10298 box cursor. */ |
10299 new_cursor_width = -1; | |
10295 if (cursor_in_echo_area | 10300 if (cursor_in_echo_area |
10296 && FRAME_HAS_MINIBUF_P (f) | 10301 && FRAME_HAS_MINIBUF_P (f) |
10297 && EQ (FRAME_MINIBUF_WINDOW (f), echo_area_window)) | 10302 && EQ (FRAME_MINIBUF_WINDOW (f), echo_area_window)) |
10298 { | 10303 { |
10299 if (w == XWINDOW (echo_area_window)) | 10304 if (w == XWINDOW (echo_area_window)) |
10314 new_cursor_type = HOLLOW_BOX_CURSOR; | 10319 new_cursor_type = HOLLOW_BOX_CURSOR; |
10315 } | 10320 } |
10316 else if (w->cursor_off_p) | 10321 else if (w->cursor_off_p) |
10317 new_cursor_type = NO_CURSOR; | 10322 new_cursor_type = NO_CURSOR; |
10318 else | 10323 else |
10319 new_cursor_type = FRAME_DESIRED_CURSOR (f); | 10324 { |
10325 struct buffer *b = XBUFFER (w->buffer); | |
10326 | |
10327 if (EQ (b->cursor_type, Qt)) | |
10328 new_cursor_type = FRAME_DESIRED_CURSOR (f); | |
10329 else | |
10330 new_cursor_type = x_specified_cursor_type (b->cursor_type, | |
10331 &new_cursor_width); | |
10332 } | |
10320 } | 10333 } |
10321 | 10334 |
10322 /* If cursor is currently being shown and we don't want it to be or | 10335 /* If cursor is currently being shown and we don't want it to be or |
10323 it is in the wrong place, or the cursor type is not what we want, | 10336 it is in the wrong place, or the cursor type is not what we want, |
10324 erase it. */ | 10337 erase it. */ |
10354 case FILLED_BOX_CURSOR: | 10367 case FILLED_BOX_CURSOR: |
10355 x_draw_phys_cursor_glyph (w, glyph_row, DRAW_CURSOR); | 10368 x_draw_phys_cursor_glyph (w, glyph_row, DRAW_CURSOR); |
10356 break; | 10369 break; |
10357 | 10370 |
10358 case BAR_CURSOR: | 10371 case BAR_CURSOR: |
10359 x_draw_bar_cursor (w, glyph_row); | 10372 x_draw_bar_cursor (w, glyph_row, new_cursor_width); |
10360 break; | 10373 break; |
10361 | 10374 |
10362 case NO_CURSOR: | 10375 case NO_CURSOR: |
10363 break; | 10376 break; |
10364 | 10377 |