mirror of
https://github.com/limine-bootloader/limine
synced 2024-12-11 17:24:08 +03:00
term: Reverse video should not make the cursor invisible
This commit is contained in:
parent
31f52c2b30
commit
a5def082c3
@ -29,8 +29,6 @@ static struct context {
|
|||||||
#define cursor_status context.cursor_status
|
#define cursor_status context.cursor_status
|
||||||
uint8_t text_palette;
|
uint8_t text_palette;
|
||||||
#define text_palette context.text_palette
|
#define text_palette context.text_palette
|
||||||
uint8_t cursor_palette;
|
|
||||||
#define cursor_palette context.cursor_palette
|
|
||||||
bool scroll_enabled;
|
bool scroll_enabled;
|
||||||
#define scroll_enabled context.scroll_enabled
|
#define scroll_enabled context.scroll_enabled
|
||||||
} context;
|
} context;
|
||||||
@ -43,7 +41,8 @@ static void clear_cursor(void) {
|
|||||||
|
|
||||||
static void draw_cursor(void) {
|
static void draw_cursor(void) {
|
||||||
if (cursor_status) {
|
if (cursor_status) {
|
||||||
video_mem[cursor_offset + 1] = cursor_palette;
|
uint16_t c = current_buffer[cursor_offset + 1];
|
||||||
|
video_mem[cursor_offset + 1] = (c << 4) | (c >> 4);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -165,7 +164,6 @@ void init_vga_textmode(size_t *_rows, size_t *_cols, bool managed) {
|
|||||||
cursor_offset = 0;
|
cursor_offset = 0;
|
||||||
cursor_status = true;
|
cursor_status = true;
|
||||||
text_palette = 0x07;
|
text_palette = 0x07;
|
||||||
cursor_palette = 0x70;
|
|
||||||
scroll_enabled = true;
|
scroll_enabled = true;
|
||||||
|
|
||||||
text_clear(false);
|
text_clear(false);
|
||||||
|
@ -86,11 +86,16 @@ void gterm_swap_palette(void) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#define A(rgb) (uint8_t)(rgb >> 24)
|
#define A(rgb) ((uint8_t)((rgb) >> 24))
|
||||||
#define R(rgb) (uint8_t)(rgb >> 16)
|
#define R(rgb) ((uint8_t)((rgb) >> 16))
|
||||||
#define G(rgb) (uint8_t)(rgb >> 8)
|
#define G(rgb) ((uint8_t)((rgb) >> 8))
|
||||||
#define B(rgb) (uint8_t)(rgb)
|
#define B(rgb) ((uint8_t)((rgb) >> 0))
|
||||||
#define ARGB(a, r, g, b) (a << 24) | ((r & 0xFF) << 16) | ((g & 0xFF) << 8) | (b & 0xFF)
|
#define ARGB(a, r, g, b) ( \
|
||||||
|
((uint32_t)((a) & 0xFF) << 24) \
|
||||||
|
| ((uint32_t)((r) & 0xFF) << 16) \
|
||||||
|
| ((uint32_t)((g) & 0xFF) << 8) \
|
||||||
|
| ((uint32_t)((b) & 0xFF) << 0) \
|
||||||
|
)
|
||||||
|
|
||||||
static inline uint32_t colour_blend(uint32_t fg, uint32_t bg) {
|
static inline uint32_t colour_blend(uint32_t fg, uint32_t bg) {
|
||||||
unsigned alpha = 255 - A(fg);
|
unsigned alpha = 255 - A(fg);
|
||||||
@ -337,8 +342,16 @@ static void clear_cursor(void) {
|
|||||||
static void draw_cursor(void) {
|
static void draw_cursor(void) {
|
||||||
if (cursor_status) {
|
if (cursor_status) {
|
||||||
struct gterm_char c = grid[cursor_x + cursor_y * cols];
|
struct gterm_char c = grid[cursor_x + cursor_y * cols];
|
||||||
c.fg = 0;
|
uint32_t tmp = c.fg;
|
||||||
c.bg = 0xcccccc;
|
if (c.bg == 0xffffffff) {
|
||||||
|
c.fg = ARGB(A(tmp),
|
||||||
|
R(tmp) < 128 ? 255 : 0,
|
||||||
|
G(tmp) < 128 ? 255 : 0,
|
||||||
|
B(tmp) < 128 ? 255 : 0);
|
||||||
|
} else {
|
||||||
|
c.fg = c.bg;
|
||||||
|
}
|
||||||
|
c.bg = tmp;
|
||||||
plot_char_grid_force(&c, cursor_x, cursor_y);
|
plot_char_grid_force(&c, cursor_x, cursor_y);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user