Fix union typo

The "set clipboard" event used the wrong union type to store its text.

In practice, it worked because both are at the same offset.
This commit is contained in:
Romain Vimont 2020-05-25 18:41:05 +02:00
parent 4bbabfb4ef
commit 274b591d18
2 changed files with 2 additions and 2 deletions

View file

@ -67,7 +67,7 @@ control_msg_serialize(const struct control_msg *msg, unsigned char *buf) {
(uint32_t) msg->inject_scroll_event.vscroll);
return 21;
case CONTROL_MSG_TYPE_SET_CLIPBOARD: {
size_t len = write_string(msg->inject_text.text,
size_t len = write_string(msg->set_clipboard.text,
CONTROL_MSG_CLIPBOARD_TEXT_MAX_LENGTH,
&buf[1]);
return 1 + len;

View file

@ -200,7 +200,7 @@ static void test_serialize_get_clipboard(void) {
static void test_serialize_set_clipboard(void) {
struct control_msg msg = {
.type = CONTROL_MSG_TYPE_SET_CLIPBOARD,
.inject_text = {
.set_clipboard = {
.text = "hello, world!",
},
};