diff options
author | Bogdan Gheorghe <gheorghe> | 2009-11-16 20:27:30 +0000 |
---|---|---|
committer | Bogdan Gheorghe <gheorghe> | 2009-11-16 20:27:30 +0000 |
commit | 62b017130fe8f33aca4d9e0e198193b3e6f15f0a (patch) | |
tree | 8e2890fbc8afb9ab2a468b74b0af96d4403fcc25 /bundles/org.eclipse.swt/Eclipse SWT Drag and Drop | |
parent | 0edaa156d7779c77c3eb098c1e4b0c67cdbdcf8d (diff) | |
download | eclipse.platform.swt-62b017130fe8f33aca4d9e0e198193b3e6f15f0a.tar.gz eclipse.platform.swt-62b017130fe8f33aca4d9e0e198193b3e6f15f0a.tar.xz eclipse.platform.swt-62b017130fe8f33aca4d9e0e198193b3e6f15f0a.zip |
Roll back 153809
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT Drag and Drop')
-rw-r--r-- | bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/ClipboardProxy.java | 34 |
1 files changed, 6 insertions, 28 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/ClipboardProxy.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/ClipboardProxy.java index 8b35e56630..6e122cc0ed 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/ClipboardProxy.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/ClipboardProxy.java @@ -37,7 +37,6 @@ class ClipboardProxy { Callback clearFunc; static String ID = "CLIPBOARD PROXY OBJECT"; //$NON-NLS-1$ - static int /*long*/ clipboardOwner = OS.g_object_new (OS.G_TYPE_INT(), 0); static ClipboardProxy _getInstance(final Display display) { ClipboardProxy proxy = (ClipboardProxy) display.getData(ID); @@ -99,7 +98,6 @@ void dispose () { clipboardDataTypes = null; primaryClipboardData = null; primaryClipboardDataTypes = null; - clipboardOwner = 0; } /** @@ -160,44 +158,24 @@ boolean setData(Clipboard owner, Object[] data, Transfer[] dataTypes, int clipbo offset += GtkTargetEntry.sizeof; } if ((clipboards & DND.CLIPBOARD) != 0) { + if (activeClipboard != null) OS.gtk_clipboard_clear(Clipboard.GTKCLIPBOARD); clipboardData = data; clipboardDataTypes = dataTypes; int /*long*/ getFuncProc = getFunc.getAddress(); int /*long*/ clearFuncProc = clearFunc.getAddress(); - if (activeClipboard != null) { - /* - * Feature in GTK. When the contents are set again, clipboard_set_with_data() - * invokes clearFunc and then, getFunc is not sequentially called. - * If we clear the content before calling set_with_data(), then there is a fair - * chance for other apps like Klipper to claim the ownership of the clipboard. - * The fix is to make sure that the content is not cleared before the data is - * set again. GTK does not invoke clearFunc for clipboard_set_with_owner() - * though we set the data again. So, this API has to be used whenever we - * are setting the contents again. - */ - if (!OS.gtk_clipboard_set_with_owner(Clipboard.GTKCLIPBOARD, pTargetsList, entries.length, getFuncProc, clearFuncProc, clipboardOwner)) { - return false; - } - } else { - if (!OS.gtk_clipboard_set_with_data(Clipboard.GTKCLIPBOARD, pTargetsList, entries.length, getFuncProc, clearFuncProc, 0)) { - return false; - } + if (!OS.gtk_clipboard_set_with_data(Clipboard.GTKCLIPBOARD, pTargetsList, entries.length, getFuncProc, clearFuncProc, 0)) { + return false; } activeClipboard = owner; } if ((clipboards & DND.SELECTION_CLIPBOARD) != 0) { + if (activePrimaryClipboard != null) OS.gtk_clipboard_clear(Clipboard.GTKPRIMARYCLIPBOARD); primaryClipboardData = data; primaryClipboardDataTypes = dataTypes; int /*long*/ getFuncProc = getFunc.getAddress(); int /*long*/ clearFuncProc = clearFunc.getAddress(); - if (activePrimaryClipboard != null) { - if (!OS.gtk_clipboard_set_with_owner(Clipboard.GTKPRIMARYCLIPBOARD, pTargetsList, entries.length, getFuncProc, clearFuncProc, clipboardOwner)) { - return false; - } - } else { - if (!OS.gtk_clipboard_set_with_data(Clipboard.GTKPRIMARYCLIPBOARD, pTargetsList, entries.length, getFuncProc, clearFuncProc, 0)) { - return false; - } + if (!OS.gtk_clipboard_set_with_data(Clipboard.GTKPRIMARYCLIPBOARD, pTargetsList, entries.length, getFuncProc, clearFuncProc, 0)) { + return false; } activePrimaryClipboard = owner; } |