comparison src/xterm.c @ 103023:30ed0fca4cdd

The following changes fix Bug#3005 for wide glyphs on each platform, without reintroducing Bug#1258 for stretch glyphs. * xterm.c (x_draw_bar_cursor): Limit cursor width differently for BAR_CURSOR and HBAR_CURSOR. Calculate width of HBAR_CURSOR using get_phys_cursor_geometry. * w32term.c (x_draw_bar_cursor): Limit cursor width differently for BAR_CURSOR and HBAR_CURSOR. Calculate width of HBAR_CURSOR using get_phys_cursor_geometry. * nsterm.m (ns_draw_window_cursor): HBAR_CURSOR width already correctly calculated.
author Jason Rumney <jasonr@gnu.org>
date Sun, 19 Apr 2009 15:09:25 +0000
parents 5f5d66aa8cda
children 5a5e07d71f3c
comparison
equal deleted inserted replaced
103022:15bf0d8a6099 103023:30ed0fca4cdd
7424 unsigned long mask = GCForeground | GCBackground | GCGraphicsExposures; 7424 unsigned long mask = GCForeground | GCBackground | GCGraphicsExposures;
7425 struct face *face = FACE_FROM_ID (f, cursor_glyph->face_id); 7425 struct face *face = FACE_FROM_ID (f, cursor_glyph->face_id);
7426 XGCValues xgcv; 7426 XGCValues xgcv;
7427 7427
7428 /* If the glyph's background equals the color we normally draw 7428 /* If the glyph's background equals the color we normally draw
7429 the bar cursor in, the bar cursor in its normal color is 7429 the bars cursor in, the bar cursor in its normal color is
7430 invisible. Use the glyph's foreground color instead in this 7430 invisible. Use the glyph's foreground color instead in this
7431 case, on the assumption that the glyph's colors are chosen so 7431 case, on the assumption that the glyph's colors are chosen so
7432 that the glyph is legible. */ 7432 that the glyph is legible. */
7433 if (face->background == f->output_data.x->cursor_pixel) 7433 if (face->background == f->output_data.x->cursor_pixel)
7434 xgcv.background = xgcv.foreground = face->foreground; 7434 xgcv.background = xgcv.foreground = face->foreground;
7442 { 7442 {
7443 gc = XCreateGC (dpy, window, mask, &xgcv); 7443 gc = XCreateGC (dpy, window, mask, &xgcv);
7444 FRAME_X_DISPLAY_INFO (f)->scratch_cursor_gc = gc; 7444 FRAME_X_DISPLAY_INFO (f)->scratch_cursor_gc = gc;
7445 } 7445 }
7446 7446
7447 if (width < 0)
7448 width = FRAME_CURSOR_WIDTH (f);
7449 width = min (cursor_glyph->pixel_width, width);
7450
7451 w->phys_cursor_width = width;
7452 x_clip_to_row (w, row, TEXT_AREA, gc); 7447 x_clip_to_row (w, row, TEXT_AREA, gc);
7453 7448
7454 if (kind == BAR_CURSOR) 7449 if (kind == BAR_CURSOR)
7450 {
7451 if (width < 0)
7452 width = FRAME_CURSOR_WIDTH (f);
7453 width = min (cursor_glyph->pixel_width, width);
7454
7455 w->phys_cursor_width = width;
7456
7455 XFillRectangle (dpy, window, gc, 7457 XFillRectangle (dpy, window, gc,
7456 WINDOW_TEXT_TO_FRAME_PIXEL_X (w, w->phys_cursor.x), 7458 WINDOW_TEXT_TO_FRAME_PIXEL_X (w, w->phys_cursor.x),
7457 WINDOW_TO_FRAME_PIXEL_Y (w, w->phys_cursor.y), 7459 WINDOW_TO_FRAME_PIXEL_Y (w, w->phys_cursor.y),
7458 width, row->height); 7460 width, row->height);
7461 }
7459 else 7462 else
7463 {
7464 int dummy_x, dummy_y, dummy_h;
7465
7466 if (width < 0)
7467 width = row->height;
7468
7469 width = min (row->height, width);
7470
7471 get_phys_cursor_geometry (w, row, cursor_glyph, &dummy_x,
7472 &dummy_y, &dummy_h);
7473
7460 XFillRectangle (dpy, window, gc, 7474 XFillRectangle (dpy, window, gc,
7461 WINDOW_TEXT_TO_FRAME_PIXEL_X (w, w->phys_cursor.x), 7475 WINDOW_TEXT_TO_FRAME_PIXEL_X (w, w->phys_cursor.x),
7462 WINDOW_TO_FRAME_PIXEL_Y (w, w->phys_cursor.y + 7476 WINDOW_TO_FRAME_PIXEL_Y (w, w->phys_cursor.y +
7463 row->height - width), 7477 row->height - width),
7464 min (FRAME_COLUMN_WIDTH (f), cursor_glyph->pixel_width), 7478 w->phys_cursor_width, width);
7465 width); 7479 }
7466 7480
7467 XSetClipMask (dpy, gc, None); 7481 XSetClipMask (dpy, gc, None);
7468 } 7482 }
7469 } 7483 }
7470 7484