selection: add selection_<type>_has_data()

Returns true when there is data available for paste in the
clipboard/primary selection.
This commit is contained in:
Daniel Eklöf 2020-09-09 18:45:10 +02:00
parent c3cacb4704
commit dec6f963cb
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
2 changed files with 15 additions and 0 deletions

View file

@ -661,6 +661,18 @@ selection_cancel(struct terminal *term)
term->selection.ongoing = false;
}
bool
selection_clipboard_has_data(const struct seat *seat)
{
return seat->clipboard.data_offer != NULL;
}
bool
selection_primary_has_data(const struct seat *seat)
{
return seat->primary.data_offer != NULL;
}
void
selection_clipboard_unset(struct seat *seat)
{

View file

@ -33,6 +33,9 @@ void selection_mark_row(
void selection_clipboard_unset(struct seat *seat);
void selection_primary_unset(struct seat *seat);
bool selection_clipboard_has_data(const struct seat *seat);
bool selection_primary_has_data(const struct seat *seat);
char *selection_to_text(const struct terminal *term);
void selection_to_clipboard(
struct seat *seat, struct terminal *term, uint32_t serial);