aboutsummaryrefslogtreecommitdiffstats
path: root/libterminput_marshal_keypress__.c
blob: 1ffba019b8f4ac74f4284214a307243897e09ef5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
/* See LICENSE file for copyright and license details. */
#include "common.h"


int
libterminput_marshal_keypress__(struct libterminput_marshaller *how, const struct libterminput_keypress *what)
{
	if (how->store(how, &what->key, sizeof(what->key)) ||
	    how->store(how, &what->times, sizeof(what->times)) ||
	    how->store(how, &what->mods, sizeof(what->mods)))
		return -1;
	if (what->key == LIBTERMINPUT_SYMBOL)
		return how->store(how, what->symbol, sizeof(what->symbol));
	else
		return 0;
}