tsm: screen: add screen-options helpers
Allow setting global options for screen objects. These are different from flags as the latter affects the state-machine but options affect global operation modes. Options should be set by the application while flags are set by the VTE handler. The latter might change often, while options should be set on startup and then remain mainly constant. Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
This commit is contained in:
parent
64635943d2
commit
0ee83010ff
@ -60,6 +60,7 @@ struct line {
|
||||
struct tsm_screen {
|
||||
size_t ref;
|
||||
llog_submit_t llog;
|
||||
unsigned int opts;
|
||||
unsigned int flags;
|
||||
struct shl_timer *timer;
|
||||
|
||||
@ -456,6 +457,30 @@ void tsm_screen_unref(struct tsm_screen *con)
|
||||
free(con);
|
||||
}
|
||||
|
||||
void tsm_screen_set_opts(struct tsm_screen *scr, unsigned int opts)
|
||||
{
|
||||
if (!scr || !opts)
|
||||
return;
|
||||
|
||||
scr->opts |= opts;
|
||||
}
|
||||
|
||||
void tsm_screen_reset_opts(struct tsm_screen *scr, unsigned int opts)
|
||||
{
|
||||
if (!scr || !opts)
|
||||
return;
|
||||
|
||||
scr->opts &= ~opts;
|
||||
}
|
||||
|
||||
unsigned int tsm_screen_get_opts(struct tsm_screen *scr)
|
||||
{
|
||||
if (!scr)
|
||||
return 0;
|
||||
|
||||
return scr->opts;
|
||||
}
|
||||
|
||||
unsigned int tsm_screen_get_width(struct tsm_screen *con)
|
||||
{
|
||||
if (!con)
|
||||
|
@ -103,6 +103,10 @@ int tsm_screen_new(struct tsm_screen **out, tsm_log_t log);
|
||||
void tsm_screen_ref(struct tsm_screen *con);
|
||||
void tsm_screen_unref(struct tsm_screen *con);
|
||||
|
||||
void tsm_screen_set_opts(struct tsm_screen *scr, unsigned int opts);
|
||||
void tsm_screen_reset_opts(struct tsm_screen *scr, unsigned int opts);
|
||||
unsigned int tsm_screen_get_opts(struct tsm_screen *scr);
|
||||
|
||||
unsigned int tsm_screen_get_width(struct tsm_screen *con);
|
||||
unsigned int tsm_screen_get_height(struct tsm_screen *con);
|
||||
int tsm_screen_resize(struct tsm_screen *con, unsigned int x,
|
||||
|
Loading…
x
Reference in New Issue
Block a user