Display and control your Android device
Set computer clipboard only if necessary
Romain Vimont20d392509976
diff --git a/app/src/receiver.c b/app/src/receiver.cindex 5ecff3b7..307eb5d5 100644--- a/app/src/receiver.c+++ b/app/src/receiver.c@@ -25,10 +25,19 @@ receiver_destroy(struct receiver *receiver) {static voidprocess_msg(struct device_msg *msg) {switch (msg->type) {- case DEVICE_MSG_TYPE_CLIPBOARD:+ case DEVICE_MSG_TYPE_CLIPBOARD: {+ char *current = SDL_GetClipboardText();+ bool same = current && !strcmp(current, msg->clipboard.text);+ SDL_free(current);+ if (same) {+ LOGD("Computer clipboard unchanged");+ return;+ }+LOGI("Device clipboard copied");SDL_SetClipboardText(msg->clipboard.text);break;+ }}}