|
|
46eaa5 |
From 19f3f91c041ebc4e52e8d287ba6d9c66a85af0d0 Mon Sep 17 00:00:00 2001
|
|
|
46eaa5 |
From: Hans de Goede <hdegoede@redhat.com>
|
|
|
46eaa5 |
Date: Mon, 9 Sep 2013 15:50:39 +0200
|
|
|
46eaa5 |
Subject: [PATCH] vdagent-x11: Release clipboard on client disconnect if owned
|
|
|
46eaa5 |
by client
|
|
|
46eaa5 |
|
|
|
46eaa5 |
https://bugzilla.redhat.com/show_bug.cgi?id=1003977
|
|
|
46eaa5 |
|
|
|
46eaa5 |
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
|
|
46eaa5 |
---
|
|
|
46eaa5 |
src/vdagent-x11.c | 10 ++++++++++
|
|
|
46eaa5 |
src/vdagent-x11.h | 2 ++
|
|
|
46eaa5 |
src/vdagent.c | 1 +
|
|
|
46eaa5 |
3 files changed, 13 insertions(+)
|
|
|
46eaa5 |
|
|
|
46eaa5 |
diff --git a/src/vdagent-x11.c b/src/vdagent-x11.c
|
|
|
46eaa5 |
index 6a58532..8287421 100644
|
|
|
46eaa5 |
--- a/src/vdagent-x11.c
|
|
|
46eaa5 |
+++ b/src/vdagent-x11.c
|
|
|
46eaa5 |
@@ -1301,6 +1301,16 @@ void vdagent_x11_clipboard_release(struct vdagent_x11 *x11, uint8_t selection)
|
|
|
46eaa5 |
vdagent_x11_do_read(x11);
|
|
|
46eaa5 |
}
|
|
|
46eaa5 |
|
|
|
46eaa5 |
+void vdagent_x11_client_disconnected(struct vdagent_x11 *x11)
|
|
|
46eaa5 |
+{
|
|
|
46eaa5 |
+ int sel;
|
|
|
46eaa5 |
+
|
|
|
46eaa5 |
+ for (sel = 0; sel < VD_AGENT_CLIPBOARD_SELECTION_SECONDARY; sel++) {
|
|
|
46eaa5 |
+ if (x11->clipboard_owner[sel] == owner_client)
|
|
|
46eaa5 |
+ vdagent_x11_clipboard_release(x11, sel);
|
|
|
46eaa5 |
+ }
|
|
|
46eaa5 |
+}
|
|
|
46eaa5 |
+
|
|
|
46eaa5 |
/* Function used to determine the default location to save file-xfers,
|
|
|
46eaa5 |
xdg desktop dir or xdg download dir. We error on the save side and use a
|
|
|
46eaa5 |
whitelist approach, so any unknown desktops will end up with saving
|
|
|
46eaa5 |
diff --git a/src/vdagent-x11.h b/src/vdagent-x11.h
|
|
|
46eaa5 |
index baa4ce8..5d949f6 100644
|
|
|
46eaa5 |
--- a/src/vdagent-x11.h
|
|
|
46eaa5 |
+++ b/src/vdagent-x11.h
|
|
|
46eaa5 |
@@ -46,6 +46,8 @@ void vdagent_x11_clipboard_data(struct vdagent_x11 *x11, uint8_t selection,
|
|
|
46eaa5 |
uint32_t type, uint8_t *data, uint32_t size);
|
|
|
46eaa5 |
void vdagent_x11_clipboard_release(struct vdagent_x11 *x11, uint8_t selection);
|
|
|
46eaa5 |
|
|
|
46eaa5 |
+void vdagent_x11_client_disconnected(struct vdagent_x11 *x11);
|
|
|
46eaa5 |
+
|
|
|
46eaa5 |
int vdagent_x11_has_icons_on_desktop(struct vdagent_x11 *x11);
|
|
|
46eaa5 |
|
|
|
46eaa5 |
#endif
|
|
|
46eaa5 |
diff --git a/src/vdagent.c b/src/vdagent.c
|
|
|
46eaa5 |
index 10ebf6e..c5e09ff 100644
|
|
|
46eaa5 |
--- a/src/vdagent.c
|
|
|
46eaa5 |
+++ b/src/vdagent.c
|
|
|
46eaa5 |
@@ -103,6 +103,7 @@ void daemon_read_complete(struct udscs_connection **connp,
|
|
|
46eaa5 |
free(data);
|
|
|
46eaa5 |
break;
|
|
|
46eaa5 |
case VDAGENTD_CLIENT_DISCONNECTED:
|
|
|
46eaa5 |
+ vdagent_x11_client_disconnected(x11);
|
|
|
46eaa5 |
vdagent_file_xfers_destroy(vdagent_file_xfers);
|
|
|
46eaa5 |
vdagent_file_xfers = vdagent_file_xfers_create(client, fx_dir,
|
|
|
46eaa5 |
fx_open_dir, debug);
|