summaryrefslogtreecommitdiff
path: root/libnautilus-private/nautilus-clipboard-monitor.c
diff options
context:
space:
mode:
authorAlexander Larsson <alexl@redhat.com>2004-11-22 15:24:38 +0000
committerAlexander Larsson <alexl@src.gnome.org>2004-11-22 15:24:38 +0000
commit67e2a42fea65f2685580b119b98a058c8e81ac4e (patch)
tree19bc7c578c9f1a47f299d012ac4775010e06661e /libnautilus-private/nautilus-clipboard-monitor.c
parent8dc115c33951754d75b57c67e4d918900a795468 (diff)
downloadnautilus-67e2a42fea65f2685580b119b98a058c8e81ac4e.tar.gz
Merge bonobo-slay-branch
2004-11-22 Alexander Larsson <alexl@redhat.com> * Merge bonobo-slay-branch
Diffstat (limited to 'libnautilus-private/nautilus-clipboard-monitor.c')
-rw-r--r--libnautilus-private/nautilus-clipboard-monitor.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/libnautilus-private/nautilus-clipboard-monitor.c b/libnautilus-private/nautilus-clipboard-monitor.c
index ffe02d93c..3fb40ac04 100644
--- a/libnautilus-private/nautilus-clipboard-monitor.c
+++ b/libnautilus-private/nautilus-clipboard-monitor.c
@@ -28,6 +28,8 @@
#include <eel/eel-debug.h>
#include <eel/eel-gtk-macros.h>
#include <eel/eel-glib-extensions.h>
+#include <eel/eel-glib-extensions.h>
+#include <gtk/gtkclipboard.h>
/* X11 has a weakness when it comes to clipboard handling,
* there is no way to get told when the owner of the clipboard
@@ -36,8 +38,12 @@
* internally in an app by telling the clipboard monitor when
* we changed the clipboard. Unfortunately this doesn't give
* us perfect results, we still don't catch changes made by
- * other clients. The solution to that is to use the XFIXES
- * extension, which isn't availible yet.
+ * other clients
+ *
+ * This is fixed with the XFIXES extensions, which recent versions
+ * of Gtk+ supports as the owner_change signal on GtkClipboard. We
+ * use this now, but keep the old code since not all X servers support
+ * XFIXES.
*/
enum {
@@ -68,9 +74,15 @@ destroy_clipboard_monitor (void)
NautilusClipboardMonitor *
nautilus_clipboard_monitor_get (void)
{
+ GtkClipboard *clipboard;
+
if (clipboard_monitor == NULL) {
clipboard_monitor = NAUTILUS_CLIPBOARD_MONITOR (g_object_new (NAUTILUS_TYPE_CLIPBOARD_MONITOR, NULL));
eel_debug_call_at_shutdown (destroy_clipboard_monitor);
+
+ clipboard = gtk_clipboard_get (GDK_SELECTION_CLIPBOARD);
+ g_signal_connect (clipboard, "owner_change",
+ G_CALLBACK (nautilus_clipboard_monitor_emit_changed), NULL);
}
return clipboard_monitor;
}