Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/tsm/libtsm-int.h
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ struct tsm_screen {
unsigned int cursor_y; /* current cursor y-pos */

enum tsm_screen_cursor_style cstyle; /* cursor shape */
uint32_t blinking_rate_ms; /* cursor blinking rate */

/* tab ruler */
bool *tab_ruler; /* tab-flag for all cells of one row */
Expand Down
3 changes: 3 additions & 0 deletions src/tsm/libtsm.h
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,9 @@ const struct tsm_screen_cell *tsm_screen_draw2(struct tsm_screen *con);
enum tsm_screen_cursor_style tsm_screen_get_cursor_style(struct tsm_screen *con);
void tsm_screen_set_cursor_style(struct tsm_screen *con, enum tsm_screen_cursor_style type);

uint32_t tsm_screen_get_cursor_blinking_rate_ms(struct tsm_screen *con);
void tsm_screen_set_cursor_blinking_rate_ms(struct tsm_screen *con, uint32_t ms);

/** @} */

/**
Expand Down
6 changes: 6 additions & 0 deletions src/tsm/libtsm.sym
Original file line number Diff line number Diff line change
Expand Up @@ -159,3 +159,9 @@ global:
tsm_screen_get_cursor_style;
tsm_screen_set_cursor_style;
} LIBTSM_4_6;

LIBTSM_4_8 {
global:
tsm_screen_get_cursor_blinking_rate_ms;
tsm_screen_set_cursor_blinking_rate_ms;
} LIBTSM_4_7;
24 changes: 24 additions & 0 deletions src/tsm/tsm-screen.c
Original file line number Diff line number Diff line change
Expand Up @@ -483,6 +483,7 @@ int tsm_screen_new(struct tsm_screen **out, tsm_log_t log, void *log_data)
con->def_attr.fr = 255;
con->def_attr.fg = 255;
con->def_attr.fb = 255;
con->blinking_rate_ms = 500;
shl_dlist_init(&con->sb.list);

ret = tsm_symbol_table_new(&con->sym_table);
Expand Down Expand Up @@ -1690,3 +1691,26 @@ void tsm_screen_set_cursor_style(struct tsm_screen *con, enum tsm_screen_cursor_

con->cstyle = type;
}

SHL_EXPORT
uint32_t tsm_screen_get_cursor_blinking_rate_ms(struct tsm_screen *con)
{
if (!con)
return 0;

return con->blinking_rate_ms;
}

SHL_EXPORT
void tsm_screen_set_cursor_blinking_rate_ms(struct tsm_screen *con, uint32_t ms)
{
if (!con)
return;

if (ms < 50)
ms = 50;
if (ms > 5000)
ms = 5000;

con->blinking_rate_ms = ms;
}
5 changes: 5 additions & 0 deletions src/tsm/tsm-vte.c
Original file line number Diff line number Diff line change
Expand Up @@ -2171,6 +2171,11 @@ static void do_csi(struct tsm_vte *vte, uint32_t data)
vte->led_cb(vte, vte->led_state, vte->led_data);
}
break;
case ']': /* Cursor blinking rate */
/* This behavior is similar to agetty */
if (vte->csi_argv[0] == 16 && vte->csi_argc >= 2)
tsm_screen_set_cursor_blinking_rate_ms(vte->con, vte->csi_argv[1]);
break;
default:
llog_debug(vte, "unhandled CSI sequence %c", data);
}
Expand Down
Loading