2009-03-12 Colin D Bennett <colin@gibibit.com>
* term/gfxterm.c (draw_cursor): Ensure character is redrawn. (grub_gfxterm_putchar): Extract pairs of identical calls to draw_cursor out of conditional blocks.
This commit is contained in:
parent
5415144ac8
commit
c58bc32a67
2 changed files with 38 additions and 42 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
2009-03-12 Colin D Bennett <colin@gibibit.com>
|
||||||
|
|
||||||
|
* term/gfxterm.c (draw_cursor): Ensure character is redrawn.
|
||||||
|
(grub_gfxterm_putchar): Extract pairs of identical calls to
|
||||||
|
draw_cursor out of conditional blocks.
|
||||||
|
|
||||||
2009-03-11 Pavel Roskin <proski@gnu.org>
|
2009-03-11 Pavel Roskin <proski@gnu.org>
|
||||||
|
|
||||||
* fs/hfs.c (grub_hfs_strncasecmp): New function.
|
* fs/hfs.c (grub_hfs_strncasecmp): New function.
|
||||||
|
|
|
@ -717,38 +717,34 @@ write_char (void)
|
||||||
static void
|
static void
|
||||||
draw_cursor (int show)
|
draw_cursor (int show)
|
||||||
{
|
{
|
||||||
unsigned int x;
|
write_char ();
|
||||||
unsigned int y;
|
|
||||||
unsigned int width;
|
|
||||||
unsigned int height;
|
|
||||||
grub_video_color_t color;
|
|
||||||
|
|
||||||
/* Determine cursor properties and position on text layer. */
|
|
||||||
x = virtual_screen.cursor_x * virtual_screen.normal_char_width;
|
|
||||||
y = (virtual_screen.cursor_y * virtual_screen.normal_char_height
|
|
||||||
+ grub_font_get_ascent (virtual_screen.font));
|
|
||||||
width = virtual_screen.normal_char_width;
|
|
||||||
height = 2;
|
|
||||||
|
|
||||||
if (show)
|
if (show)
|
||||||
{
|
{
|
||||||
|
unsigned int x;
|
||||||
|
unsigned int y;
|
||||||
|
unsigned int width;
|
||||||
|
unsigned int height;
|
||||||
|
grub_video_color_t color;
|
||||||
|
|
||||||
|
/* Determine cursor properties and position on text layer. */
|
||||||
|
x = virtual_screen.cursor_x * virtual_screen.normal_char_width;
|
||||||
|
width = virtual_screen.normal_char_width;
|
||||||
color = virtual_screen.fg_color;
|
color = virtual_screen.fg_color;
|
||||||
}
|
y = (virtual_screen.cursor_y * virtual_screen.normal_char_height
|
||||||
else
|
+ grub_font_get_ascent (virtual_screen.font));
|
||||||
{
|
height = 2;
|
||||||
color = virtual_screen.bg_color;
|
|
||||||
y = virtual_screen.cursor_y * virtual_screen.normal_char_height;
|
|
||||||
height = virtual_screen.normal_char_height;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Render cursor to text layer. */
|
/* Render cursor to text layer. */
|
||||||
grub_video_set_active_render_target (text_layer);
|
grub_video_set_active_render_target (text_layer);
|
||||||
grub_video_fill_rect (color, x, y, width, height);
|
grub_video_fill_rect (color, x, y, width, height);
|
||||||
grub_video_set_active_render_target (GRUB_VIDEO_RENDER_TARGET_DISPLAY);
|
grub_video_set_active_render_target (GRUB_VIDEO_RENDER_TARGET_DISPLAY);
|
||||||
|
|
||||||
/* Mark cursor to be redrawn. */
|
/* Mark cursor to be redrawn. */
|
||||||
dirty_region_add (virtual_screen.offset_x + x, virtual_screen.offset_y + y,
|
dirty_region_add (virtual_screen.offset_x + x,
|
||||||
width, height);
|
virtual_screen.offset_y + y,
|
||||||
|
width, height);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -821,12 +817,12 @@ grub_gfxterm_putchar (grub_uint32_t c)
|
||||||
/* FIXME */
|
/* FIXME */
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
/* Erase current cursor, if any. */
|
||||||
|
if (virtual_screen.cursor_state)
|
||||||
|
draw_cursor (0);
|
||||||
|
|
||||||
if (c == '\b' || c == '\n' || c == '\r')
|
if (c == '\b' || c == '\n' || c == '\r')
|
||||||
{
|
{
|
||||||
/* Erase current cursor, if any. */
|
|
||||||
if (virtual_screen.cursor_state)
|
|
||||||
draw_cursor (0);
|
|
||||||
|
|
||||||
switch (c)
|
switch (c)
|
||||||
{
|
{
|
||||||
case '\b':
|
case '\b':
|
||||||
|
@ -845,10 +841,6 @@ grub_gfxterm_putchar (grub_uint32_t c)
|
||||||
virtual_screen.cursor_x = 0;
|
virtual_screen.cursor_x = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Redraw cursor if visible. */
|
|
||||||
if (virtual_screen.cursor_state)
|
|
||||||
draw_cursor (1);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -856,10 +848,6 @@ grub_gfxterm_putchar (grub_uint32_t c)
|
||||||
struct grub_colored_char *p;
|
struct grub_colored_char *p;
|
||||||
unsigned char char_width;
|
unsigned char char_width;
|
||||||
|
|
||||||
/* Erase current cursor, if any. */
|
|
||||||
if (virtual_screen.cursor_state)
|
|
||||||
draw_cursor (0);
|
|
||||||
|
|
||||||
/* Get properties of the character. */
|
/* Get properties of the character. */
|
||||||
glyph = grub_font_get_glyph (virtual_screen.font, c);
|
glyph = grub_font_get_glyph (virtual_screen.font, c);
|
||||||
|
|
||||||
|
@ -908,11 +896,13 @@ grub_gfxterm_putchar (grub_uint32_t c)
|
||||||
else
|
else
|
||||||
virtual_screen.cursor_y++;
|
virtual_screen.cursor_y++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Draw cursor if visible. */
|
|
||||||
if (virtual_screen.cursor_state)
|
|
||||||
draw_cursor (1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Redraw cursor if it should be visible. */
|
||||||
|
/* Note: This will redraw the character as well, which means that the
|
||||||
|
above call to write_char is redundant when the cursor is showing. */
|
||||||
|
if (virtual_screen.cursor_state)
|
||||||
|
draw_cursor (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Use ASCII characters to determine normal character width. */
|
/* Use ASCII characters to determine normal character width. */
|
||||||
|
|
Loading…
Add table
Reference in a new issue