Blame SOURCES/0008-Reply-to-TIMESTAMP-requests.patch

a547b4
From ad6ddbe2857cfc7e7c8657b1eefb91f305012ef5 Mon Sep 17 00:00:00 2001
a547b4
From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= <marcandre.lureau@redhat.com>
a547b4
Date: Tue, 15 Jul 2014 13:17:09 +0200
a547b4
Subject: [PATCH] Reply to TIMESTAMP requests
a547b4
a547b4
Add TIMESTAMP handling,
a547b4
This is to please vncviewer.
a547b4
a547b4
https://bugzilla.redhat.com/show_bug.cgi?id=1117764
a547b4
(cherry picked from commit b87fab52eb825429e5393ac4c2c073c918d8ed8f)
a547b4
---
a547b4
 src/vdagent-x11-priv.h |  1 +
a547b4
 src/vdagent-x11.c      | 15 +++++++++++++++
a547b4
 2 files changed, 16 insertions(+)
a547b4
a547b4
diff --git a/src/vdagent-x11-priv.h b/src/vdagent-x11-priv.h
a547b4
index c607850..4a5729b 100644
a547b4
--- a/src/vdagent-x11-priv.h
a547b4
+++ b/src/vdagent-x11-priv.h
a547b4
@@ -83,6 +83,7 @@ struct vdagent_x11 {
a547b4
     Atom targets_atom;
a547b4
     Atom incr_atom;
a547b4
     Atom multiple_atom;
a547b4
+    Atom timestamp_atom;
a547b4
     Window root_window[MAX_SCREENS];
a547b4
     Window selection_window;
a547b4
     struct udscs_connection *vdagentd;
a547b4
diff --git a/src/vdagent-x11.c b/src/vdagent-x11.c
a547b4
index 8781d5e..5ac2cf7 100644
a547b4
--- a/src/vdagent-x11.c
a547b4
+++ b/src/vdagent-x11.c
a547b4
@@ -218,6 +218,7 @@ struct vdagent_x11 *vdagent_x11_create(struct udscs_connection *vdagentd,
a547b4
     x11->targets_atom = XInternAtom(x11->display, "TARGETS", False);
a547b4
     x11->incr_atom = XInternAtom(x11->display, "INCR", False);
a547b4
     x11->multiple_atom = XInternAtom(x11->display, "MULTIPLE", False);
a547b4
+    x11->timestamp_atom = XInternAtom(x11->display, "TIMESTAMP", False);
a547b4
     for(i = 0; i < clipboard_format_count; i++) {
a547b4
         x11->clipboard_formats[i].type = clipboard_format_templates[i].type;
a547b4
         for(j = 0; clipboard_format_templates[i].atom_names[j]; j++) {
a547b4
@@ -1033,6 +1034,20 @@ static void vdagent_x11_handle_selection_request(struct vdagent_x11 *x11)
a547b4
         return;
a547b4
     }
a547b4
 
a547b4
+    if (event->xselectionrequest.target == x11->timestamp_atom) {
a547b4
+        /* TODO: use more accurate selection time */
a547b4
+        guint32 timestamp = event->xselectionrequest.time;
a547b4
+
a547b4
+        XChangeProperty(x11->display, event->xselectionrequest.requestor,
a547b4
+                       event->xselectionrequest.property,
a547b4
+                        event->xselectionrequest.target, 32, PropModeReplace,
a547b4
+                        (guint8*)&timestamp, 1);
a547b4
+        vdagent_x11_send_selection_notify(x11,
a547b4
+                       event->xselectionrequest.property, NULL);
a547b4
+       return;
a547b4
+    }
a547b4
+
a547b4
+
a547b4
     if (event->xselectionrequest.target == x11->targets_atom) {
a547b4
         vdagent_x11_send_targets(x11, selection, event);
a547b4
         return;