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.
master
Romain Vimont 6 years ago
parent 4bbabfb4ef
commit 274b591d18

@ -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;

@ -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!",
},
};

Loading…
Cancel
Save