Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVeronika Irvine2002-04-12 12:14:01 +0000
committerVeronika Irvine2002-04-12 12:14:01 +0000
commit7089cb4c425e44be86fa09cc873ae3c18fc8ea30 (patch)
tree078a13b7477ec499ec49cd06de48f9b6ccce5a0f
parent57d94f8be5933a30e8b7973fe2401c127a47e161 (diff)
downloadeclipse.platform.swt-7089cb4c425e44be86fa09cc873ae3c18fc8ea30.tar.gz
eclipse.platform.swt-7089cb4c425e44be86fa09cc873ae3c18fc8ea30.tar.xz
eclipse.platform.swt-7089cb4c425e44be86fa09cc873ae3c18fc8ea30.zip
*** empty log message ***VI_GTK_DND
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/Clipboard.java28
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/DragSource.java533
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/DropTarget.java637
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/RTFTransfer.java4
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/structs.c60
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/structs.h2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/swt-gtkwidget.c162
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/swt-memmove.c33
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GdkDragContext.java38
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkSelectionData.java2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkTargetEntry.java3
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java47
12 files changed, 316 insertions, 1233 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/Clipboard.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/Clipboard.java
index 1e0406508c..4e2a55877c 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/Clipboard.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/Clipboard.java
@@ -20,10 +20,10 @@ public class Clipboard {
Display display;
Callback getFunc;
Callback clearFunc;
-
int pGtkClipboard;
- /* Hold the reference for the data and transfer to be used in the callback */
+ /* Data is not flushed to the clipboard immediately.
+ * This class will remember the data and provide it when requested. */
Object[] data;
Transfer[] dataTypes;
@@ -39,11 +39,8 @@ public Clipboard(Display display) {
SWT.error(SWT.ERROR_THREAD_INVALID_ACCESS);
}
this.display = display;
-
- //Setting callbacks
getFunc = new Callback( this, "getFunc", 4);
clearFunc = new Callback( this, "clearFunc", 2);
-
pGtkClipboard = OS.gtk_clipboard_get(OS.GDK_NONE);
}
@@ -72,7 +69,9 @@ public void dispose () {
if (clearFunc != null) clearFunc.dispose();
clearFunc = null;
}
+
public Object getContents(Transfer transfer) {
+ if (transfer == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
int selection_data = 0;
int[] typeIds = transfer.getTypeIds();
for (int i = 0; i < typeIds.length; i++) {
@@ -93,11 +92,8 @@ public Object getContents(Transfer transfer) {
}
/**
- * This function provides the data to the clipboard.
- * Because of the callback mechanism, the data in the clipboard
- * will not be available when this object is disposed
- * (just if the data was set in the clipboard by app who owns
- * this Clipboard object)
+ * This function provides the data to the clipboard on request.
+ * When this clipboard is disposed, the data will no longer be available.
*/
int getFunc( int clipboard, int selection_data, int info, int user_data_or_owner){
if (selection_data == 0) return 0;
@@ -140,7 +136,7 @@ public void setContents(Object[] data, Transfer[] dataTypes){
int pName = OS.g_malloc(buffer.length);
OS.memmove(pName, buffer, buffer.length);
entry.target = pName;
- GtkTargetEntry[] tmp = new GtkTargetEntry [entries.length + 1];
+ GtkTargetEntry[] tmp = new GtkTargetEntry [entries.length + 1];
System.arraycopy(entries, 0, tmp, 0, entries.length);
tmp[entries.length] = entry;
entries = tmp;
@@ -159,15 +155,13 @@ public void setContents(Object[] data, Transfer[] dataTypes){
boolean result = OS.gtk_clipboard_set_with_data(pGtkClipboard, pTargetsList, entries.length, getFunc.getAddress(), clearFunc.getAddress(), 0);
- if ( entries != null ) {
- for (int i = 0; i < entries.length; i++) {
- GtkTargetEntry entry = entries[i];
- if( entry.target != 0) OS.g_free(entry.target);
- }
+ for (int i = 0; i < entries.length; i++) {
+ GtkTargetEntry entry = entries[i];
+ if( entry.target != 0) OS.g_free(entry.target);
}
if (pTargetsList != 0) OS.g_free(pTargetsList);
- if (!result) DND.error(DND.ERROR_CANNOT_SET_CLIPBOARD);
+ if (!result) DND.error(DND.ERROR_CANNOT_SET_CLIPBOARD);
}
/*
* Note: getAvailableTypeNames is a tool for writing a Transfer sub-class only. It should
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/DragSource.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/DragSource.java
index ff3cff332a..b78e87ab86 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/DragSource.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/DragSource.java
@@ -1,392 +1,141 @@
-package org.eclipse.swt.dnd;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002.
- * All Rights Reserved
- */
-
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.gtk.*;
-
-/**
- *
- * Class <code>DragSource</code> defines the source object for a drag and drop transfer.
- *
- * IMPORTANT: This class is <em>not</em> intended to be subclassed.
- *
- * <p>This class defines the following items:<ul>
- * <li>the <code>Control</code> that the user clicks on to intiate a drag;
- * <li>the data that will be transferred on a successful drop;
- * <li>and the modes (move, copy, link) of transfer that are allowed.
- * </ul></p>
- *
- * <p>You may have several DragSources in an application but you can only have one DragSource
- * per Control. Data dragged from this DragSource can be dropped on a site within this application
- * but it can also be dropped on another application such as an external Text editor.</p>
- *
- * <p>The application supplies the content of the data being transferred by implementing the interface
- * <code>DragSourceListener</code> which uses the class <code>DragSourceEvent</code>.
- * The application is required to take the appropriate action to remove the data from the drag source
- * when a successful move operation occurs.</p>
- *
- * <code><pre>
- * // Enable a label as a Drag Source
- * Label label = new Label(shell, SWT.NONE);
- * // This example will allow text to be dragged
- * Transfer[] types = new Transfer[] {TextTransfer.getInstance()};
- * // This example will allow the text to be copied or moved to the drop target
- * int operations = DND.DROP_MOVE | DND.DROP_COPY;
- *
- * DragSource source = new DragSource (label, operations);
- * source.setTransfer(types);
- * source.addDragListener (new DragSourceListener() {
- * public void dragStart(DragSourceEvent e) {
- * // Only start the drag if there is actually text in the
- * // label - this text will be what is dropped on the target.
- * if (label.getText().length() == 0) {
- * event.doit = false;
- * }
- * };
- * public void dragSetData (DragSourceEvent event) {
- * // A drop has been performed, so provide the data of the
- * // requested type.
- * // (Checking the type of the requested data is only
- * // necessary if the drag source supports more than
- * // one data type but is shown here as an example).
- * if (TextTransfer.getInstance().isSupportedType(event.dataType)){
- * event.data = label.getText();
- * }
- * }
- * public void dragFinished(DragSourceEvent event) {
- * // A Move operation has been performed so remove the data
- * // from the source
- * if (event.detail == DND.DROP_MOVE)
- * label.setText("");
- * }
- * });
- * </pre></code>
- *
- *
- * <dl>
- * <dt><b>Styles</b> <dd>DND.DROP_NONE, DND.DROP_COPY, DND.DROP_MOVE, DND.DROP_LINK
- * <dt><b>Events</b> <dd>DND.DragEnd, DND.DragSetData
- * </dl>
- */
-public final class DragSource extends Widget {
- Control control;
- Transfer[] transfers;
- Callback dragBegin;
- Callback dragGetData;
- Callback dragEnd;
- int dragBeginAddress;
- int dragGetDataAddress;
- int dragEndAddress;
-
- GtkTargetEntry[] targets; //Data reference to be freed
- int targets_list; //Data reference to be freed
-
- final int buttonMask = OS.GDK_BUTTON1_MASK | OS.GDK_BUTTON3_MASK;
- int operations;
-
- Listener controlListener;
-
-/**
- * Creates a new <code>DragSource</code> to handle dragging from the specified <code>Control</code>.
- *
- * @param control the <code>Control</code> that the user clicks on to initiate the drag
- *
- * @param style the bitwise OR'ing of allowed operations; this may be a combination of any of
- * DND.DROP_NONE, DND.DROP_COPY, DND.DROP_MOVE, DND.DROP_LINK
- *
- */
-public DragSource(Control control, int style) {
- super (control, checkStyle(style));
- this.control = control;
-
- operations = 0;
- if ( (style & DND.DROP_MOVE) != 0) operations |= OS.GDK_ACTION_MOVE;
- if ( (style & DND.DROP_COPY) != 0) operations |= OS.GDK_ACTION_COPY;
- if ( (style & DND.DROP_LINK) != 0) operations |= OS.GDK_ACTION_LINK;
-
- // Drag Begin Callback
- dragBegin = new Callback(this, "dragBegin", 3);
- dragBeginAddress = dragBegin.getAddress();
- byte[] dragBeginB = Converter.wcsToMbcs(null, "drag_begin", true);
- OS.gtk_signal_connect(control.handle, dragBeginB, dragBeginAddress, 0);
-
- // Drag Get Data Callback
- dragGetData = new Callback(this, "dragGetData", 6);
- dragGetDataAddress = dragGetData.getAddress();
- byte[] dragGetDataB = Converter.wcsToMbcs(null, "drag_data_get", true);
- OS.gtk_signal_connect(control.handle, dragGetDataB, dragGetDataAddress, 0);
-
- // Drag End Callback
- dragEnd = new Callback(this, "dragEnd", 3);
- dragEndAddress = dragEnd.getAddress();
- byte[] dragEndB = Converter.wcsToMbcs(null, "drag_end", true);
- OS.gtk_signal_connect(control.handle, dragEndB, dragEndAddress, 0);
-
-
- controlListener = new Listener(){
- public void handleEvent(Event event){
- DragSource.this.dispose();
- }
- };
- control.addListener(SWT.Dispose, controlListener);
- this.addListener(SWT.Dispose, new Listener(){
- public void handleEvent(Event event){
- DragSource.this.onDispose();
- }
- });
-
-}
-
-/**
- * Adds the listener to receive events.
- *
- * @param listener the listener
- *
- * @exception SWTError
- * <ul><li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li>
- * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li>
- * <li>ERROR_NULL_ARGUMENT when listener is null</li></ul>
- */
-public void addDragListener(DragSourceListener listener) {
- if (listener == null) DND.error (SWT.ERROR_NULL_ARGUMENT);
- DNDListener typedListener = new DNDListener (listener);
- addListener (DND.DragStart, typedListener);
- addListener (DND.DragEnd, typedListener);
- addListener (DND.DragSetData, typedListener);
-}
-
-static int checkStyle (int style) {
- if (style == SWT.NONE) return DND.DROP_MOVE;
- return style;
-}
-
-
-int dragBegin(int widget, int context, int data){
-
- int time = 0;
- if(context != 0 ) {
- GdkDragContext gdkDragContext = new GdkDragContext(context);
- time = gdkDragContext.start_time; //BAD (ALWAYS ZERO)
- if (time == 0) time = OS.GDK_CURRENT_TIME(); //BAD (ALWAYS ZERO)
- }
- DNDEvent event = new DNDEvent();
- event.doit = true;
- event.widget = this;
- event.time = time;
- notifyListeners(DND.DragStart, event);
-
- if ( ! event.doit) {
- OS.gdk_drag_abort(context, event.time ); //BAD (NOT WORKING)
- }
-
- return 1;
-}
-
-int dragEnd(int widget, int context, int data){
- int op = DND.DROP_NONE;
- boolean doit = true;
- if (context != 0) {
- GdkDragContext dragContext = new GdkDragContext (context);
- switch (dragContext.action) {
- case OS.GDK_ACTION_MOVE:
- op = DND.DROP_MOVE;
- break;
- case OS.GDK_ACTION_COPY:
- op = DND.DROP_COPY;
- break;
- case OS.GDK_ACTION_LINK:
- op = DND.DROP_LINK;
- break;
- case 0: //Drag was cancel
- doit = false;
- break;
- }
- }
-
- DNDEvent event = new DNDEvent();
- event.widget = this;
- event.doit = doit;
- event.detail = op;
- notifyListeners(DND.DragEnd, event);
- return 1;
-}
-
-int dragGetData(int widget, int context, int selection_data, int info, int time, int data){
- DNDEvent event = new DNDEvent();
- event.widget = this;
- event.time = time;
- TransferData tdata = new TransferData ();
- tdata.type = info;
- event.dataType = tdata;
-
- notifyListeners(DND.DragSetData, event);
-
- if (event.data == null) return 0;
-
- Transfer transfer = null;
- for (int i = 0; i < transfers.length; i++) {
- transfer = transfers[i];
- if (transfer.isSupportedType(tdata)) break;
- }
- if (transfer == null) return 0;
-
- if (selection_data == 0) return 0;
- GtkSelectionData gtkSelectionData = new GtkSelectionData(selection_data);
- if (gtkSelectionData.target == 0) return 0;
-
- transfer.javaToNative(event.data, tdata);
-
- OS.gtk_selection_data_set(selection_data, gtkSelectionData.target, transfer.format, tdata.pValue , tdata.length);
-
- return 1;
-
-}
-
-public Display getDisplay () {
- if (control == null) DND.error(SWT.ERROR_WIDGET_DISPOSED);
- return control.getDisplay ();
-}
-
-/**
- * Returns the list of data types that can be transferred by this DragSource.
- *
- * @return the list of data types that can be transferred by this DragSource
- */
-public Transfer[] getTransfer(){
- return transfers;
-}
-
-private void onDispose(){
- if (dragBegin != null )
- dragBegin.dispose();
- dragBegin = null;
-
- if (dragGetData != null )
- dragGetData.dispose();
- dragGetData = null;
-
- if (dragEnd != null )
- dragEnd.dispose();
- dragEnd = null;
-
-
- if (control != null){
- OS.gtk_drag_source_unset(control.handle);
- if (controlListener != null)
- control.removeListener(SWT.Dispose, controlListener);
- }
-
- releaseTargets();
- control = null;
- controlListener = null;
-}
-
-
-private void releaseTargets(){
-
- if ( targets != null ) {
- for (int i = 0; i < targets.length; i++) {
- GtkTargetEntry entry = targets[i];
- if( entry.target != 0) OS.g_free(entry.target);
- }
- }
-
- if (targets_list != 0) {
- OS.g_free(targets_list);
- }
-
- targets_list = 0;
- targets = null;
-}
-
-/**
- * Removes the listener.
- *
- * @param listener the listener
- *
- * @exception SWTError
- * <ul><li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li>
- * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li>
- * <li>ERROR_NULL_ARGUMENT when listener is null</li></ul>
- */
-public void removeDragListener(DragSourceListener listener) {
- if (listener == null) DND.error (SWT.ERROR_NULL_ARGUMENT);
- removeListener (DND.DragStart, listener);
- removeListener (DND.DragEnd, listener);
- removeListener (DND.DragSetData, listener);
-}
-
-private void setTargetList(){
-
- if (transfers == null) return;
- if (control == null) return;
-
- releaseTargets();
-
- int n_entry = 0;
- GtkTargetEntry[] entrys = new GtkTargetEntry [n_entry];
-
-
- Transfer[] transferAgents = transfers;
- for (int i = 0; i < transferAgents.length; i++) {
- Transfer transfer = transferAgents[i];
- int[] types = transfer.getTypeIds();
- for (int j = 0; j < types.length; j++) {
- int type = types[j];
- String typename = transfer.getTypeNames()[j];
- byte[] buffer = Converter.wcsToMbcs(null, typename, true);
- int ptr = OS.g_malloc(buffer.length);
- OS.memmove(ptr, buffer, buffer.length);
-
- GtkTargetEntry entry = new GtkTargetEntry();
- entry.target = ptr;
- entry.info = type;
-
- GtkTargetEntry[] tmp = new GtkTargetEntry [n_entry + 1];
- System.arraycopy(entrys, 0, tmp, 0, n_entry);
- tmp[ n_entry ] = entry;
- entrys = tmp;
- n_entry++;
- }
- }
-
- byte[] buffer = new byte[ GtkTargetEntry.sizeof * n_entry ];
- byte[] tmp = new byte[ GtkTargetEntry.sizeof ];
- for (int i = 0; i < n_entry; i++) {
- OS.memmove(tmp, entrys[i], GtkTargetEntry.sizeof);
- System.arraycopy(tmp, 0, buffer, i * GtkTargetEntry.sizeof, tmp.length);
- }
-
- int ptr = OS.g_malloc(buffer.length);
- OS.memmove(ptr, buffer, buffer.length);
-
- if (targets_list != 0){
- OS.gtk_drag_source_unset(control.handle);
- }
-
- targets_list = ptr;
- targets = entrys;
-
- OS.gtk_drag_source_set(control.handle, buttonMask , targets_list, n_entry, operations );
-
-}
-
-/**
- * Specifies the list of data types that can be transferred by this DragSource.
- * The application must be able to provide data to match each of these types when
- * a successful drop has occurred.
- */
-public void setTransfer(Transfer[] transferAgents){
- if (transferAgents == null) DND.error(SWT.ERROR_NULL_ARGUMENT);
- this.transfers = transferAgents;
- setTargetList();
-}
-
-}
+package org.eclipse.swt.dnd;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+import org.eclipse.swt.*;
+import org.eclipse.swt.widgets.*;
+import org.eclipse.swt.internal.*;
+
+/**
+ *
+ * Class <code>DragSource</code> defines the source object for a drag and drop transfer.
+ *
+ * IMPORTANT: This class is <em>not</em> intended to be subclassed.
+ *
+ * <p>This class defines the following items:<ul>
+ * <li>the <code>Control</code> that the user clicks on to intiate a drag;
+ * <li>the data that will be transferred on a successful drop;
+ * <li>and the modes (move, copy, link) of transfer that are allowed.
+ * </ul></p>
+ *
+ * <p>You may have several DragSources in an application but you can only have one DragSource
+ * per Control. Data dragged from this DragSource can be dropped on a site within this application
+ * but it can also be dropped on another application such as an external Text editor.</p>
+ *
+ * <p>The application supplies the content of the data being transferred by implementing the interface
+ * <code>DragSourceListener</code> which uses the class <code>DragSourceEvent</code>.
+ * The application is required to take the appropriate action to remove the data from the drag source
+ * when a successful move operation occurs.</p>
+ *
+ * <code><pre>
+ * // Enable a label as a Drag Source
+ * Label label = new Label(shell, SWT.NONE);
+ * // This example will allow text to be dragged
+ * Transfer[] types = new Transfer[] {TextTransfer.getInstance()};
+ * // This example will allow the text to be copied or moved to the drop target
+ * int operations = DND.DROP_MOVE | DND.DROP_COPY;
+ *
+ * DragSource source = new DragSource (label, operations);
+ * source.setTransfer(types);
+ * source.addDragListener (new DragSourceListener() {
+ * public void dragStart(DragSourceEvent e) {
+ * // Only start the drag if there is actually text in the
+ * // label - this text will be what is dropped on the target.
+ * if (label.getText().length() == 0) {
+ * event.doit = false;
+ * }
+ * };
+ * public void dragSetData (DragSourceEvent event) {
+ * // A drop has been performed, so provide the data of the
+ * // requested type.
+ * // (Checking the type of the requested data is only
+ * // necessary if the drag source supports more than
+ * // one data type but is shown here as an example).
+ * if (TextTransfer.getInstance().isSupportedType(event.dataType)){
+ * event.data = label.getText();
+ * }
+ * }
+ * public void dragFinished(DragSourceEvent event) {
+ * // A Move operation has been performed so remove the data
+ * // from the source
+ * if (event.detail == DND.DROP_MOVE)
+ * label.setText("");
+ * }
+ * });
+ * </pre></code>
+ *
+ *
+ * <dl>
+ * <dt><b>Styles</b> <dd>DND.DROP_NONE, DND.DROP_COPY, DND.DROP_MOVE, DND.DROP_LINK
+ * <dt><b>Events</b> <dd>DND.DragEnd, DND.DragSetData
+ * </dl>
+ */
+public final class DragSource extends Widget {
+
+/**
+ * Creates a new <code>DragSource</code> to handle dragging from the specified <code>Control</code>.
+ *
+ * @param control the <code>Control</code> that the user clicks on to initiate the drag
+ *
+ * @param style the bitwise OR'ing of allowed operations; this may be a combination of any of
+ * DND.DROP_NONE, DND.DROP_COPY, DND.DROP_MOVE, DND.DROP_LINK
+ *
+ */
+public DragSource(Control control, int style) {
+ super (control, style);
+}
+/**
+ * Adds the listener to receive events.
+ *
+ * @param listener the listener
+ *
+ * @exception SWTError
+ * <ul><li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li>
+ * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li>
+ * <li>ERROR_NULL_ARGUMENT when listener is null</li></ul>
+ */
+public void addDragListener(DragSourceListener listener) {
+
+}
+
+public Display getDisplay () {
+ return null;
+}
+/**
+ * Returns the list of data types that can be transferred by this DragSource.
+ *
+ * @return the list of data types that can be transferred by this DragSource
+ */
+public Transfer[] getTransfer(){
+ return null;
+}
+
+/**
+ * Removes the listener.
+ *
+ * @param listener the listener
+ *
+ * @exception SWTError
+ * <ul><li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li>
+ * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li>
+ * <li>ERROR_NULL_ARGUMENT when listener is null</li></ul>
+ */
+public void removeDragListener(DragSourceListener listener) {
+}
+/**
+ * Specifies the list of data types that can be transferred by this DragSource.
+ * The application must be able to provide data to match each of these types when
+ * a successful drop has occurred.
+ */
+public void setTransfer(Transfer[] transferAgents){
+}
+/**
+ * @deprecated - use DragSourceListener.dragStart
+ */
+public void startDrag() {
+}
+
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/DropTarget.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/DropTarget.java
index 3cf19d4326..27d836cf1f 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/DropTarget.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/DropTarget.java
@@ -1,505 +1,132 @@
-package org.eclipse.swt.dnd;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.gtk.*;
-
-/**
- *
- * Class <code>DropTarget</code> defines the target object for a drag and drop transfer.
- *
- * IMPORTANT: This class is <em>not</em> intended to be subclassed.
- *
- * <p>This class identifies the <code>Control</code> over which the user must position the cursor
- * in order to drop the data being transferred. It also specifies what data types can be dropped on
- * this control and what operations can be performed. You may have several DropTragets in an
- * application but there can only be a one to one mapping between a <code>Control</code> and a <code>DropTarget</code>.
- * The DropTarget can receive data from within the same application or from other applications
- * (such as text dragged from a text editor like Word).</p>
- *
- * <code><pre>
- * int operations = DND.DROP_MOVE | DND.DROP_COPY | DND.DROP_LINK;
- * Transfer[] types = new Transfer[] {TextTransfer.getInstance()};
- * DropTarget target = new DropTarget(label, operations);
- * target.setTransfer(types);
- * </code></pre>
- *
- * <p>The application is notified of data being dragged over this control and of when a drop occurs by
- * implementing the interface <code>DropTargetListener</code> which uses the class
- * <code>DropTargetEvent</code>. The application can modify the type of drag being performed
- * on this Control at any stage of the drag by modifying the <code>event.detail</code> field or the
- * <code>event.currentDataType</code> field. When the data is dropped, it is the responsibility of
- * the application to copy this data for its own purposes.
- *
- * <code><pre>
- * target.addDropListener (new DropTargetListener() {
- * public void dragEnter(DropTargetEvent event) {};
- * public void dragOver(DropTargetEvent event) {};
- * public void dragLeave(DropTargetEvent event) {};
- * public void dragOperationChanged(DropTargetEvent event) {};
- * public void dropAccept(DropTargetEvent event) {}
- * public void drop(DropTargetEvent event) {
- * // A drop has occurred, copy over the data
- * if (event.data == null) { // no data to copy, indicate failure in event.detail
- * event.detail = DND.DROP_NONE;
- * return;
- * }
- * label.setText ((String) event.data); // data copied to label text
- * }
- * });
- * </pre></code>
- *
- * <dl>
- * <dt><b>Styles</b> <dd>DND.DROP_NONE, DND.DROP_COPY, DND.DROP_MOVE, DND.DROP_LINK
- * <dt><b>Events</b> <dd>DND.DragEnter, DND.DragLeave, DND.DragOver, DND.DragOperationChanged,
- * DND.Drop, DND.DropAccept
- * </dl>
- */
-public final class DropTarget extends Widget {
-
-/**
- * Creates a new <code>DropTarget</code> to handle dropping on the specified <code>Control</code>.
- *
- * @param control the <code>Control</code> over which the user positions the cursor to drop data
- *
- * @param style the bitwise OR'ing of allowed operations; this may be a combination of any of
- * DND.DROP_NONE, DND.DROP_COPY, DND.DROP_MOVE, DND.DROP_LINK
- *
- */
- Control control;
- boolean isEnter = true;
- Callback dragMotion;
- Callback dragLeave;
- Callback dragDataReceived;
-
- int dragMotionAddress;
- int dragLeaveAddress;
- int dragDataReceivedAddress;
-
- Transfer[] transfers;
- TransferData[] transferDatas;
-
- GtkTargetEntry[] targets; //Data reference to be freed
- int targets_list; //Data reference to be freed
-
- Listener controlListener;
-
- int lastOperation = -1; // To control operations changed events
- int lastX, lastY; // To be used in drag leave event (callback do not provided it)
-
- private DragUnderEffect effect;
-
-public DropTarget(Control control, int style) {
- super(control, checkStyle(style));
- this.control = control;
-
- // Drag Motion Callback
- dragMotion = new Callback(this, "dragMotion", 5);
- dragMotionAddress = dragMotion.getAddress();
- byte[] dragMotionB = Converter.wcsToMbcs(null, "drag_motion", true);
- OS.gtk_signal_connect(control.handle, dragMotionB, dragMotionAddress, 0);
-
- // Drag Leave Callback
- dragLeave = new Callback(this, "dragLeave", 3);
- dragLeaveAddress = dragLeave.getAddress();
- byte[] dragLeaveB = Converter.wcsToMbcs(null, "drag_leave", true);
- OS.gtk_signal_connect(control.handle, dragLeaveB, dragLeaveAddress, 0);
-
- // Drag Data Received Callback
- dragDataReceived = new Callback(this, "dragDataReceived", 7);
- dragDataReceivedAddress = dragDataReceived.getAddress();
- byte[] DataReceivedB = Converter.wcsToMbcs(null, "drag_data_received", true);
- OS.gtk_signal_connect(control.handle, DataReceivedB, dragDataReceivedAddress, 0);
-
- // Dispose listeners
- controlListener = new Listener(){
- public void handleEvent(Event event){
- DropTarget.this.dispose();
- }
- };
- control.addListener(SWT.Dispose, controlListener);
- this.addListener(SWT.Dispose, new Listener(){
- public void handleEvent(Event event){
- DropTarget.this.onDispose();
- }
- });
-
- // Drag under effect
- if (control instanceof Tree) {
- effect = new TreeDragUnderEffect((Tree)control);
- } else if (control instanceof Table) {
- effect = new TableDragUnderEffect((Table)control);
- } else {
- effect = new NoDragUnderEffect(control);
- }
-}
-
-/**
- * Adds the listener to receive events.
- *
- * @param listener the listener
- *
- * @exception SWTError
- * <ul><li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li>
- * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li>
- * <li>ERROR_NULL_ARGUMENT when listener is null</li></ul>
- */
-public void addDropListener(DropTargetListener listener) {
- if (listener == null) DND.error (SWT.ERROR_NULL_ARGUMENT);
- DNDListener typedListener = new DNDListener (listener);
- addListener (DND.DragEnter, typedListener);
- addListener (DND.DragLeave, typedListener);
- addListener (DND.DragOver, typedListener);
- addListener (DND.DragOperationChanged, typedListener);
- addListener (DND.Drop, typedListener);
- addListener (DND.DropAccept, typedListener);
-}
-
-static int checkStyle (int style) {
- if (style == SWT.NONE) return DND.DROP_MOVE;
- return style;
-}
-
-int dragDataReceived ( int widget, int context, int x, int y, int data, int info, int time){
- if (data == 0) return 0;
- GtkSelectionData gtkSelectionData = new GtkSelectionData( data );
- if (context == 0) return 0;
- GdkDragContext dragContext = new GdkDragContext( context );
-
- if (gtkSelectionData.data == 0) return 0;
-
- TransferData tdata = new TransferData ();
- tdata.type = info;
- tdata.length = gtkSelectionData.length;
- tdata.pValue = gtkSelectionData.data;
-
- Point coordinates = new Point( x, y );
- coordinates = control.toDisplay( coordinates );
-
- int[] act = getCurrentOperation(context);
-
- DNDEvent event = new DNDEvent();
- event.widget = this;
- event.x = coordinates.x;
- event.y = coordinates.y;
- event.time = time;
- event.detail = act[0];
- event.operations = act[1];
- event.dataType = tdata;
- event.dataTypes = new TransferData[] { tdata }; //looks bad, but the dataType cann't be changed at this step anyway
- notifyListeners(DND.DropAccept, event);
-
- /* NOTE: GTK do not provided a way to choose the typedata just before the drop */
-
-
- if (event.detail == DND.DROP_NONE) {
- OS.gtk_drag_finish(context, false, false, time); // It's Useless
-// OS.gdk_drag_abort(context, time); // can not be used in this callback (GP)
- return 0;
- }
-
- Transfer transfer = null;
- for (int i = 0; i < transfers.length; i++) {
- transfer = transfers[i];
- if (transfer.isSupportedType(tdata)) break;
- }
- if (transfer == null) return 0;
-
- Object value = transfer.nativeToJava(tdata);
-
- event = new DNDEvent();
- event.widget = this;
- event.x = coordinates.x;
- event.y = coordinates.y;
- event.detail = act[0];
- event.operations = act[1];
- event.time = time;
- event.dataType = tdata;
- event.data = value;
- this.notifyListener(DND.Drop, event);
-
- OS.gtk_drag_finish(context, true, dragContext.action == OS.GDK_ACTION_MOVE, time);
- return 1;
-}
-
-int dragLeave ( int widget, int context, int time){
- int[] act = getCurrentOperation(context);
- DNDEvent event = new DNDEvent();
- event.widget = this;
- event.time = time;
- event.x = lastX;
- event.y = lastY;
- event.dataType = getTransferData(context);
- event.dataTypes = new TransferData[] { event.dataType }; //BAD
- event.detail = act[0];
- event.operations = act[1];
- notifyListeners(DND.DragLeave, event);
- isEnter = true;
- return 1;
-}
-
-int dragMotion ( int widget, int context, int x, int y, int time){
- DNDEvent event = new DNDEvent();
- int[] act = getCurrentOperation(context);
- Point coordinates = control.toDisplay( new Point( x, y) );
- event.widget = this;
- event.x = coordinates.x;
- event.y = coordinates.y;
- event.dataType = getTransferData(context);
- event.dataTypes = new TransferData[] { event.dataType }; //BAD
- event.detail = act[0];
- event.operations = act[1];
- event.time = time;
- event.feedback = DND.FEEDBACK_NONE;
-
- // to be used in dragleave
- lastX = event.x;
- lastY = event.y;
-
- int type = DND.DragOver;
- if(isEnter){
- type = DND.DragEnter;
- isEnter = false;
- } else {
- if ( lastOperation != -1 && event.detail != lastOperation ) {
- type = DND.DragOperationChanged;
- }
- }
- lastOperation = event.detail;
-
- notifyListeners(type, event);
-
- effect.show( event.feedback, coordinates.x, coordinates.y);
-
- if (event.detail == DND.DROP_NONE) {
- // Does not work properly, do not send drag_end signal for the source side
- OS.gdk_drag_abort(context, time);
- return 0;
- }
-
- return 1;
-}
-
-private int getActions(){
- int style = getStyle();
- int operationsDnd = 0;
- if ( (style & DND.DROP_MOVE) != 0) operationsDnd |= OS.GDK_ACTION_MOVE;
- if ( (style & DND.DROP_COPY) != 0) operationsDnd |= OS.GDK_ACTION_COPY;
- if ( (style & DND.DROP_LINK) != 0) operationsDnd |= OS.GDK_ACTION_LINK;
- return operationsDnd;
-}
-
-/**
- * Returns the Control which is registered for this DropTarget. This is the control over which the
- * user positions the cursor to drop the data.
- *
- * @return the Control which is registered for this DropTarget
- *
- */
-public Control getControl () {
- return control;
-}
-
-/**
- * @return int[] length equals 2,
- * index 0 holds the currentAction
- * index 1 holds a bitwise of all possible actions
- *
- */
-private int[] getCurrentOperation(int context){
- if(context == 0) return new int[]{ DND.DROP_MOVE, DND.DROP_MOVE};
- GdkDragContext dragContext = new GdkDragContext(context);
-
- int action = DND.DROP_MOVE;
- if(dragContext.action == OS.GDK_ACTION_COPY) action = DND.DROP_COPY;
- if(dragContext.action == OS.GDK_ACTION_LINK) action = DND.DROP_LINK;
-
- int actions = 0;
- if((dragContext.actions & OS.GDK_ACTION_MOVE) != 0) actions |= DND.DROP_MOVE;
- if((dragContext.actions & OS.GDK_ACTION_COPY) != 0) actions |= DND.DROP_COPY;
- if((dragContext.actions & OS.GDK_ACTION_LINK) != 0) actions |= DND.DROP_LINK;
-
- return new int[] {action, actions};
-}
-
-public Display getDisplay () {
- if (control == null) DND.error(SWT.ERROR_WIDGET_DISPOSED);
- return control.getDisplay ();
-}
-
-/**
- * Returns the list of data types that can be transferred to this DropTarget.
- *
- * @return the list of data types that can be transferred to this DropTarget
- *
- */
-public Transfer[] getTransfer() {
- return transfers;
-}
-
-private TransferData getTransferData(int context){
- TransferData tdata = new TransferData();
- if ( context == 0) return tdata;
- GdkDragContext dragContext = new GdkDragContext(context);
- int atom = OS.gtk_drag_dest_find_target(control.handle, context, 0);
- int ptr = OS.gdk_atom_name(atom);
- int len = OS.strlen(ptr);
- byte[] buffer = new byte [ len ];
- OS.memmove(buffer, ptr, len);
- String formatname = new String ( Converter.mbcsToWcs(null, buffer) );
- tdata.type = Transfer.registerType(formatname); // Lazy way
- return tdata;
-}
-
-public void notifyListener (int eventType, Event event) {
- Point coordinates = new Point(event.x, event.y);
- coordinates = control.toControl(coordinates);
- if (this.control instanceof Tree) {
- event.item = ((Tree)control).getItem(coordinates);
- }
- if (this.control instanceof Table) {
- event.item = ((Table)control).getItem(coordinates);
- }
- super.notifyListeners(eventType, event);
-}
-
-private void onDispose(){
- if (dragMotion != null )
- dragMotion.dispose();
- dragMotion = null;
-
- if (dragDataReceived != null )
- dragDataReceived.dispose();
- dragDataReceived = null;
-
- if (dragLeave!= null )
- dragLeave.dispose();
- dragLeave = null;
-
- if (control != null){
- OS.gtk_drag_dest_unset(control.handle);
- if (controlListener != null)
- control.removeListener(SWT.Dispose, controlListener);
- }
-
- releaseTargets();
- control = null;
- controlListener = null;
-}
-
-private void releaseTargets(){
-
- if ( targets != null ) {
- for (int i = 0; i < targets.length; i++) {
- GtkTargetEntry entry = targets[i];
- if( entry.target != 0) OS.g_free(entry.target);
- }
- }
-
- if (targets_list != 0) {
- OS.g_free(targets_list);
- }
-
- targets_list = 0;
- targets = null;
-}
-
-/**
- * Removes the listener.
- *
- * @param listener the listener
- *
- * @exception SWTError
- * <ul><li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li>
- * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li>
- * <li>ERROR_NULL_ARGUMENT when listener is null</li></ul>
- */
-public void removeDropListener(DropTargetListener listener) {
- if (listener == null) DND.error (SWT.ERROR_NULL_ARGUMENT);
- removeListener (DND.DragEnter, listener);
- removeListener (DND.DragLeave, listener);
- removeListener (DND.DragOver, listener);
- removeListener (DND.DragOperationChanged, listener);
- removeListener (DND.Drop, listener);
- removeListener (DND.DropAccept, listener);
-}
-
-private void setTargetList(){
-
- if (transfers == null) return;
- if (control == null) return;
-
- //Release previous allocates data (remember)
-
- int n_entry = 0;
- GtkTargetEntry[] entrys = new GtkTargetEntry [n_entry];
-
-
- Transfer[] transferAgents = transfers;
- for (int i = 0; i < transferAgents.length; i++) {
- Transfer transfer = transferAgents[i];
- int[] types = transfer.getTypeIds();
- for (int j = 0; j < types.length; j++) {
- int type = types[j];
- String typename = transfer.getTypeNames()[j];
- byte[] buffer = Converter.wcsToMbcs(null, typename, true);
- int ptr = OS.g_malloc(buffer.length);
- OS.memmove(ptr, buffer, buffer.length);
-
- GtkTargetEntry entry = new GtkTargetEntry();
- entry.target = ptr;
- entry.info = type;
-
- GtkTargetEntry[] tmp = new GtkTargetEntry [n_entry + 1];
- System.arraycopy(entrys, 0, tmp, 0, n_entry);
- tmp[ n_entry ] = entry;
- entrys = tmp;
- n_entry++;
- }
- }
-
- byte[] buffer = new byte[ GtkTargetEntry.sizeof * n_entry ];
- byte[] tmp = new byte[ GtkTargetEntry.sizeof ];
- for (int i = 0; i < n_entry; i++) {
- OS.memmove(tmp, entrys[i], GtkTargetEntry.sizeof);
- System.arraycopy(tmp, 0, buffer, i * GtkTargetEntry.sizeof, tmp.length);
- }
-
- transferDatas = new TransferData[entrys.length];
- for (int i = 0; i < transferDatas.length; i++) {
- TransferData td = new TransferData();
- td.type = entrys[i].target;
- transferDatas[i] = td;
- }
-
- if (targets_list != 0){
- OS.gtk_drag_dest_unset(control.handle);
- }
-
- targets_list = OS.g_malloc(buffer.length);
- OS.memmove(targets_list, buffer, buffer.length);
- targets = entrys;
-
- OS.gtk_drag_dest_set(control.handle, OS.GTK_DEST_DEFAULT_ALL, targets_list, n_entry, getActions());
-
-}
-
-/**
- * Specifies the list of data types that can be transferred to this DropTarget.
- *
- * @param transferAgents a list of Transfer objects which define the types of data that can be
- * dropped on this target
- */
-public void setTransfer(Transfer[] transferAgents){
- if (transferAgents == null) DND.error(SWT.ERROR_NULL_ARGUMENT);
- this.transfers = transferAgents;
- setTargetList();
-}
-}
+package org.eclipse.swt.dnd;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+import org.eclipse.swt.*;
+import org.eclipse.swt.graphics.*;
+import org.eclipse.swt.widgets.*;
+import org.eclipse.swt.internal.*;
+
+/**
+ *
+ * Class <code>DropTarget</code> defines the target object for a drag and drop transfer.
+ *
+ * IMPORTANT: This class is <em>not</em> intended to be subclassed.
+ *
+ * <p>This class identifies the <code>Control</code> over which the user must position the cursor
+ * in order to drop the data being transferred. It also specifies what data types can be dropped on
+ * this control and what operations can be performed. You may have several DropTragets in an
+ * application but there can only be a one to one mapping between a <code>Control</code> and a <code>DropTarget</code>.
+ * The DropTarget can receive data from within the same application or from other applications
+ * (such as text dragged from a text editor like Word).</p>
+ *
+ * <code><pre>
+ * int operations = DND.DROP_MOVE | DND.DROP_COPY | DND.DROP_LINK;
+ * Transfer[] types = new Transfer[] {TextTransfer.getInstance()};
+ * DropTarget target = new DropTarget(label, operations);
+ * target.setTransfer(types);
+ * </code></pre>
+ *
+ * <p>The application is notified of data being dragged over this control and of when a drop occurs by
+ * implementing the interface <code>DropTargetListener</code> which uses the class
+ * <code>DropTargetEvent</code>. The application can modify the type of drag being performed
+ * on this Control at any stage of the drag by modifying the <code>event.detail</code> field or the
+ * <code>event.currentDataType</code> field. When the data is dropped, it is the responsibility of
+ * the application to copy this data for its own purposes.
+ *
+ * <code><pre>
+ * target.addDropListener (new DropTargetListener() {
+ * public void dragEnter(DropTargetEvent event) {};
+ * public void dragOver(DropTargetEvent event) {};
+ * public void dragLeave(DropTargetEvent event) {};
+ * public void dragOperationChanged(DropTargetEvent event) {};
+ * public void dropAccept(DropTargetEvent event) {}
+ * public void drop(DropTargetEvent event) {
+ * // A drop has occurred, copy over the data
+ * if (event.data == null) { // no data to copy, indicate failure in event.detail
+ * event.detail = DND.DROP_NONE;
+ * return;
+ * }
+ * label.setText ((String) event.data); // data copied to label text
+ * }
+ * });
+ * </pre></code>
+ *
+ * <dl>
+ * <dt><b>Styles</b> <dd>DND.DROP_NONE, DND.DROP_COPY, DND.DROP_MOVE, DND.DROP_LINK
+ * <dt><b>Events</b> <dd>DND.DragEnter, DND.DragLeave, DND.DragOver, DND.DragOperationChanged,
+ * DND.Drop, DND.DropAccept
+ * </dl>
+ */
+public final class DropTarget extends Widget {
+
+/**
+ * Creates a new <code>DropTarget</code> to handle dropping on the specified <code>Control</code>.
+ *
+ * @param control the <code>Control</code> over which the user positions the cursor to drop data
+ *
+ * @param style the bitwise OR'ing of allowed operations; this may be a combination of any of
+ * DND.DROP_NONE, DND.DROP_COPY, DND.DROP_MOVE, DND.DROP_LINK
+ *
+ */
+public DropTarget(Control control, int style) {
+ super(control, style);
+}
+
+/**
+ * Adds the listener to receive events.
+ *
+ * @param listener the listener
+ *
+ * @exception SWTError
+ * <ul><li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li>
+ * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li>
+ * <li>ERROR_NULL_ARGUMENT when listener is null</li></ul>
+ */
+public void addDropListener(DropTargetListener listener) {
+}
+
+/**
+ * Returns the Control which is registered for this DropTarget. This is the control over which the
+ * user positions the cursor to drop the data.
+ *
+ * @return the Control which is registered for this DropTarget
+ *
+ */
+public Control getControl () {
+ return null;
+}
+public Display getDisplay () {
+ return null;
+}
+/**
+ * Returns the list of data types that can be transferred to this DropTarget.
+ *
+ * @return the list of data types that can be transferred to this DropTarget
+ *
+ */
+public Transfer[] getTransfer() { return null; }
+public void notifyListener (int eventType, Event event) {}
+/**
+ * Removes the listener.
+ *
+ * @param listener the listener
+ *
+ * @exception SWTError
+ * <ul><li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li>
+ * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li>
+ * <li>ERROR_NULL_ARGUMENT when listener is null</li></ul>
+ */
+public void removeDropListener(DropTargetListener listener) {}
+/**
+ * Specifies the list of data types that can be transferred to this DropTarget.
+ *
+ * @param transferAgents a list of Transfer objects which define the types of data that can be
+ * dropped on this target
+ */
+public void setTransfer(Transfer[] transferAgents){}
+
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/RTFTransfer.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/RTFTransfer.java
index 8baed209f4..de8c2e5c36 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/RTFTransfer.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/RTFTransfer.java
@@ -53,7 +53,7 @@ public static RTFTransfer getInstance () {
*/
public void javaToNative (Object object, TransferData transferData){
if (object == null || !(object instanceof String)) return;
- byte [] buffer = Converter.wcsToMbcs (null, (String)object, true);
+ byte [] buffer = Converter.wcsToMbcs(null, (String)object, true);
super.javaToNative(buffer, transferData);
}
/**
@@ -68,7 +68,7 @@ public Object nativeToJava(TransferData transferData){
if (transferData.length <=0) transferData.length = OS.strlen(transferData.pValue);
byte[] buffer = (byte[]) super.nativeToJava(transferData);
if (buffer == null) return null;
- char [] unicode = Converter.mbcsToWcs (null, buffer);
+ char [] unicode = Converter.mbcsToWcs(null, buffer);
return new String (unicode);
}
protected String[] getTypeNames(){
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/structs.c b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/structs.c
index ecc42734a4..898be11d7e 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/structs.c
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/structs.c
@@ -19,7 +19,6 @@
#include "structs.h"
/* Globals */
-GdkDragContext_FID_CACHE GdkDragContextFc;
GtkTargetEntry_FID_CACHE GtkTargetEntryFc;
GtkSelectionData_FID_CACHE GtkSelectionDataFc;
GdkColor_FID_CACHE GdkColorFc;
@@ -1568,62 +1567,3 @@ void setGtkTargetEntryFields(JNIEnv *env, jobject lpObject, GtkTargetEntry *lpSt
(*env)->SetIntField(env, lpObject, lpCache->flags, (jint)lpStruct->flags);
(*env)->SetIntField(env, lpObject, lpCache->info, (jint)lpStruct->info);
}
-
-void cacheGdkDragContextFids(JNIEnv *env, jobject lpObject, PGdkDragContext_FID_CACHE lpCache)
-{
- if (lpCache->cached) return;
- lpCache->clazz = (*env)->GetObjectClass(env, lpObject);
- lpCache->parent_instance$g_type_instance$g_class = (*env)->GetFieldID(env, lpCache->clazz, "parent_instance$g_type_instance$g_class", "I");
- lpCache->parent_instance$ref_count = (*env)->GetFieldID(env, lpCache->clazz, "parent_instance$ref_count", "I");
- lpCache->parent_instance$qdata = (*env)->GetFieldID(env, lpCache->clazz, "parent_instance$qdata", "I");
- lpCache->protocol = (*env)->GetFieldID(env, lpCache->clazz, "protocol", "I");
- lpCache->is_source = (*env)->GetFieldID(env, lpCache->clazz, "is_source", "Z");
- lpCache->source_window = (*env)->GetFieldID(env, lpCache->clazz, "source_window", "I");
- lpCache->dest_window = (*env)->GetFieldID(env, lpCache->clazz, "dest_window", "I");
- lpCache->targets = (*env)->GetFieldID(env, lpCache->clazz, "targets", "I");
- lpCache->actions = (*env)->GetFieldID(env, lpCache->clazz, "actions", "I");
- lpCache->suggested_action = (*env)->GetFieldID(env, lpCache->clazz, "suggested_action", "I");
- lpCache->action = (*env)->GetFieldID(env, lpCache->clazz, "action", "I");
- lpCache->start_time = (*env)->GetFieldID(env, lpCache->clazz, "start_time", "I");
- lpCache->windowing_data = (*env)->GetFieldID(env, lpCache->clazz, "windowing_data", "I");
- lpCache->cached = 1;
-}
-
-GdkDragContext* getGdkDragContextFields(JNIEnv *env, jobject lpObject, GdkDragContext *lpStruct, PGdkDragContext_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheGdkDragContextFids(env, lpObject, lpCache);
- lpStruct->parent_instance.g_type_instance.g_class = (GTypeClass*)(*env)->GetIntField(env, lpObject, lpCache->parent_instance$g_type_instance$g_class);
- lpStruct->parent_instance.ref_count = (*env)->GetIntField(env, lpObject, lpCache->parent_instance$ref_count);
- lpStruct->parent_instance.qdata = (GData*)(*env)->GetIntField(env, lpObject, lpCache->parent_instance$qdata);
- lpStruct->protocol = (*env)->GetIntField(env, lpObject, lpCache->protocol);
- lpStruct->is_source = (*env)->GetBooleanField(env, lpObject, lpCache->is_source);
- lpStruct->source_window = (GdkWindow*)(*env)->GetIntField(env, lpObject, lpCache->source_window);
- lpStruct->dest_window = (GdkWindow*)(*env)->GetIntField(env, lpObject, lpCache->dest_window);
- lpStruct->targets = (GList*)(*env)->GetIntField(env, lpObject, lpCache->targets);
- lpStruct->actions = (*env)->GetIntField(env, lpObject, lpCache->actions);
- lpStruct->suggested_action = (*env)->GetIntField(env, lpObject, lpCache->suggested_action);
- lpStruct->action = (*env)->GetIntField(env, lpObject, lpCache->action);
- lpStruct->start_time = (*env)->GetIntField(env, lpObject, lpCache->start_time);
- lpStruct->windowing_data = (gpointer)(*env)->GetIntField(env, lpObject, lpCache->windowing_data);
- return lpStruct;
-}
-
-void setGdkDragContextFields(JNIEnv *env, jobject lpObject, GdkDragContext *lpStruct, PGdkDragContext_FID_CACHE lpCache)
-{
- if (!lpCache->cached) cacheGdkDragContextFids(env, lpObject, lpCache);
- (*env)->SetIntField(env, lpObject, lpCache->parent_instance$g_type_instance$g_class,(jint) lpStruct->parent_instance.g_type_instance.g_class);
- (*env)->SetIntField(env, lpObject, lpCache->parent_instance$ref_count, lpStruct->parent_instance.ref_count);
- (*env)->SetIntField(env, lpObject, lpCache->parent_instance$qdata, (jint) lpStruct->parent_instance.qdata);
- (*env)->SetIntField(env, lpObject, lpCache->protocol, (jint) lpStruct->protocol);
- (*env)->SetBooleanField(env, lpObject, lpCache->is_source, (jboolean) lpStruct->is_source);
- (*env)->SetIntField(env, lpObject, lpCache->source_window, (jint) lpStruct->source_window);
- (*env)->SetIntField(env, lpObject, lpCache->dest_window, (jint) lpStruct->dest_window);
- (*env)->SetIntField(env, lpObject, lpCache->targets, (jint) lpStruct->targets);
- (*env)->SetIntField(env, lpObject, lpCache->actions, (jint) lpStruct->actions);
- (*env)->SetIntField(env, lpObject, lpCache->suggested_action, (jint) lpStruct->suggested_action);
- (*env)->SetIntField(env, lpObject, lpCache->action, (jint) lpStruct->action);
- (*env)->SetIntField(env, lpObject, lpCache->start_time, lpStruct->start_time);
- (*env)->SetIntField(env, lpObject, lpCache->windowing_data, (jint) lpStruct->windowing_data);
-}
-
-
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/structs.h b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/structs.h
index b5a9ea71d2..dd8864a731 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/structs.h
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/structs.h
@@ -372,7 +372,5 @@ extern GtkStyle_FID_CACHE GtkStyleFc;
extern GtkStyleClass_FID_CACHE GtkStyleClassFc;
extern GtkSelectionData_FID_CACHE GtkSelectionDataFc;
extern GtkTargetEntry_FID_CACHE GtkTargetEntryFc;
-extern GdkDragContext_FID_CACHE GdkDragContextFc;
-
#endif // INC_structs_H
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/swt-gtkwidget.c b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/swt-gtkwidget.c
index 33f2fb1474..78831b3408 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/swt-gtkwidget.c
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/swt-gtkwidget.c
@@ -635,125 +635,18 @@ JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1widget_1send_1e
/*
* Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_drag_source_set
- * Signature: (IIIII)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1drag_1source_1set
- (JNIEnv *env, jclass that, jint widget, jint start_button_mask, jint targets, jint n_targets, jint actions)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_drag_source_set");
-#endif
- gtk_drag_source_set( (GtkWidget*)widget, (GdkModifierType) start_button_mask, (const GtkTargetEntry*) targets,
- n_targets, (GdkDragAction) actions );
-
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_drag_source_unset
- * Signature: (I)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1drag_1source_1unset
- (JNIEnv *env, jclass that, jint widget)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_drag_source_unset");
-#endif
- gtk_drag_source_unset( (GtkWidget*)widget);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_selection_data_set
- * Signature: (IIIII)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1selection_1data_1set
- (JNIEnv *env, jclass that, jint selection_data, jint type, jint format, jint data, jint length)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_selection_data_set");
-#endif
- gtk_selection_data_set( (GtkSelectionData*) selection_data, (GdkAtom) type, format,
- (guchar*) data, length);
-
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_drag_dest_set
- * Signature: (IIIII)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1drag_1dest_1set
- (JNIEnv *env, jclass that, jint widget, jint flags, jint targets, jint n_targets, jint actions)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_drag_dest_set");
-#endif
- gtk_drag_dest_set( (GtkWidget*)widget, (GtkDestDefaults) flags, (const GtkTargetEntry*) targets,
- n_targets, (GdkDragAction) actions );
-
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_drag_dest_unset
+ * Method: gtk_clipboard_clear
* Signature: (I)V
*/
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1drag_1dest_1unset
- (JNIEnv *env, jclass that, jint widget)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_drag_dest_unset");
-#endif
- gtk_drag_dest_unset( (GtkWidget*)widget );
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_drag_dest_find_target
- * Signature: (III)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1drag_1dest_1find_1target
- (JNIEnv *env, jclass that, jint widget, jint context, jint target_list)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_drag_dest_find_target");
-#endif
- return (jint)gtk_drag_dest_find_target( (GtkWidget*)widget , (GdkDragContext*)context, (GtkTargetList*)target_list);
-}
-
-
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_drag_abort
- * Signature: (II)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1drag_1abort
- (JNIEnv *env, jclass that, jint context, jint time)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_drag_abort");
-#endif
- gdk_drag_abort( (GdkDragContext *) context, time);
-}
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_drag_finish
- * Signature: (IBBI)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1drag_1finish
- (JNIEnv *env, jclass that, jint context, jboolean sucess, jboolean del, jint time)
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1clipboard_1clear
+ (JNIEnv *env, jclass that, jint clipboard)
{
#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_drag_finish");
+ fprintf(stderr, "gtk_clipboard_clear");
#endif
- gtk_drag_finish( (GdkDragContext *) context, sucess, del, time);
+ gtk_clipboard_clear((GtkClipboard*)clipboard);
}
-
/*
* Class: org_eclipse_swt_internal_gtk_OS
* Method: gtk_clipboard_get
@@ -765,13 +658,13 @@ JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1clipboard_1get
#ifdef DEBUG_CALL_PRINTS
fprintf(stderr, "gtk_clipboard_get");
#endif
- return (jint) gtk_clipboard_get ( (GdkAtom) selection );
+ return (jint) gtk_clipboard_get((GdkAtom)selection );
}
/*
* Class: org_eclipse_swt_internal_gtk_OS
* Method: gtk_clipboard_set_with_data
- * Signature: (I)I
+ * Signature: (IIIIII)B
*/
JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1clipboard_1set_1with_1data
(JNIEnv *env, jclass that, jint clipboard, jint targets, jint n_targets, jint get_func, jint clear_func, jint user_data)
@@ -779,9 +672,7 @@ JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1clipboard_1
#ifdef DEBUG_CALL_PRINTS
fprintf(stderr, "gtk_clipboard_set_with_data");
#endif
- return gtk_clipboard_set_with_data ( (GtkClipboard*) clipboard, (GtkTargetEntry*) targets,
- n_targets, (GtkClipboardGetFunc) get_func,
- (GtkClipboardClearFunc) clear_func, (gpointer) user_data);
+ return gtk_clipboard_set_with_data((GtkClipboard*)clipboard, (GtkTargetEntry*)targets, n_targets, (GtkClipboardGetFunc)get_func, (GtkClipboardClearFunc)clear_func, (gpointer)user_data);
}
/*
@@ -795,22 +686,7 @@ JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1clipboard_1wait
#ifdef DEBUG_CALL_PRINTS
fprintf(stderr, "gtk_clipboard_wait_for_contents");
#endif
- return (jint) gtk_clipboard_wait_for_contents( (GtkClipboard*) clipboard,(GdkAtom) target);
-}
-
-
-/*
- * Class: org_eclipse_swt_internal_gtk_OS
- * Method: gdk_atom_name
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1atom_1name
- (JNIEnv *env, jclass that, jint atom)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gdk_atom_name");
-#endif
- return (jint) gdk_atom_name( (GdkAtom) atom );
+ return (jint)gtk_clipboard_wait_for_contents((GtkClipboard*)clipboard,(GdkAtom)target);
}
/*
@@ -824,25 +700,21 @@ JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1selection_1data
#ifdef DEBUG_CALL_PRINTS
fprintf(stderr, "gtk_selection_data_free");
#endif
- gtk_selection_data_free( (GtkSelectionData*) data);
+ gtk_selection_data_free((GtkSelectionData*)data);
}
/*
* Class: org_eclipse_swt_internal_gtk_OS
- * Method: gtk_clipboard_clear
- * Signature: (I)V
+ * Method: gtk_selection_data_set
+ * Signature: (IIIII)V
*/
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1clipboard_1clear
- (JNIEnv *env, jclass that, jint clipboard)
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1selection_1data_1set
+ (JNIEnv *env, jclass that, jint selection_data, jint type, jint format, jint data, jint length)
{
#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "gtk_clipboard_clear");
+ fprintf(stderr, "gtk_selection_data_set");
#endif
- gtk_clipboard_clear( (GtkClipboard*) clipboard);
+ gtk_selection_data_set((GtkSelectionData*)selection_data, (GdkAtom)type, format, (guchar*)data, length);
}
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_GDK_1POINTER_1TO_1ATOM
- (JNIEnv *env, jclass that, jint ptr)
-{
- return (jint) GDK_POINTER_TO_ATOM((GdkAtom)ptr);
-}
+
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/swt-memmove.c b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/swt-memmove.c
index ac88d7caf5..fe66082cfb 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/swt-memmove.c
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/swt-memmove.c
@@ -270,8 +270,7 @@ JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove___3I_3BI
}
}
-/* Drag and Drop adds */
-
+/* Clipboard */
JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GtkSelectionData_2I
(JNIEnv *env, jclass that, jobject dest, jint src)
{
@@ -282,26 +281,6 @@ JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclips
}
}
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GdkDragContext_2I
- (JNIEnv *env, jclass that, jobject dest, jint src)
-{
- DECL_GLOB(pGlob)
- if (dest) {
- cacheGdkDragContextFids(env, dest, &PGLOB(GdkDragContextFc));
- setGdkDragContextFields(env, dest, (GdkDragContext *)src, &PGLOB(GdkDragContextFc));
- }
-}
-
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GdkDragContext_2
- (JNIEnv *env, jclass that, jint dest, jobject src)
-{
- DECL_GLOB(pGlob)
- if (src) {
- cacheGdkDragContextFids(env, src, &PGLOB(GdkDragContextFc));
- getGdkDragContextFields(env, src, (GdkDragContext *)dest, &PGLOB(GdkDragContextFc));
- }
-}
-
JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GtkTargetEntry_2
(JNIEnv *env, jclass that, jint dest, jobject src)
{
@@ -311,13 +290,3 @@ JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclip
getGtkTargetEntryFields(env, src, (GtkTargetEntry *)dest, &PGLOB(GtkTargetEntryFc));
}
}
-
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GtkTargetEntry_2I
- (JNIEnv *env, jclass that, jobject dest, jint src)
-{
- DECL_GLOB(pGlob)
- if (dest) {
- cacheGtkTargetEntryFids(env, dest, &PGLOB(GtkTargetEntryFc));
- setGtkTargetEntryFields(env, dest, (GtkTargetEntry *)src, &PGLOB(GtkTargetEntryFc));
- }
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GdkDragContext.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GdkDragContext.java
deleted file mode 100644
index 21f3e145db..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GdkDragContext.java
+++ /dev/null
@@ -1,38 +0,0 @@
-package org.eclipse.swt.internal.gtk;
-
-/*
- * Copyright (c) IBM Corp. 2000, 2002. All rights reserved.
- *
- * The contents of this file are made available under the terms
- * of the GNU Lesser General Public License (LGPL) Version 2.1 that
- * accompanies this distribution (lgpl-v21.txt). The LGPL is also
- * available at http://www.gnu.org/licenses/lgpl.html. If the version
- * of the LGPL at http://www.gnu.org is different to the version of
- * the LGPL accompanying this distribution and there is any conflict
- * between the two license versions, the terms of the LGPL accompanying
- * this distribution shall govern.
- */
-
-public class GdkDragContext {
-
- public int parent_instance$g_type_instance$g_class;
- public int parent_instance$ref_count;
- public int parent_instance$qdata;
- public int protocol;
- public boolean is_source;
- public int source_window;
- public int dest_window;
- public int targets;
- public int actions;
- public int suggested_action;
- public int action;
- public int start_time;
- public int windowing_data; //guint32
-
- public GdkDragContext(){
- }
- public GdkDragContext(int ptr){
- OS.memmove(this, ptr);
- }
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkSelectionData.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkSelectionData.java
index eac3f84eb9..f68c374458 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkSelectionData.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkSelectionData.java
@@ -21,7 +21,7 @@ public class GtkSelectionData {
public int data;
public int length;
- public GtkSelectionData(){
+ private GtkSelectionData(){
}
public GtkSelectionData(int ptr){
OS.memmove(this, ptr);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkTargetEntry.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkTargetEntry.java
index a06015048b..5e43746c0d 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkTargetEntry.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkTargetEntry.java
@@ -21,7 +21,4 @@ public class GtkTargetEntry {
public GtkTargetEntry(){
}
- public GtkTargetEntry(int ptr){
- OS.memmove(this, ptr);
- }
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java
index 1fb4b2a2ed..62246ff4c3 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java
@@ -18,42 +18,7 @@ import org.eclipse.swt.internal.Library;
public class OS {
static {
Library.loadLibrary("swt-pi");
- }
-
- /* DRAG DROP SUPPORT - MOVE TO APPROPRIATE PLACE LATER */
-// public static final native void gtk_drag_source_set(int widget, int start_button_mask, int targets, int n_targets, int actions);
-// public static final native void gtk_drag_source_unset(int widget);
-// public static final native void gtk_drag_dest_set(int widget, int flags, int targets, int n_targets, int actions);
-// public static final native void gtk_drag_dest_unset(int widget);
-// public static final native void gdk_drag_abort(int context, int time);
-// public static final native void gtk_drag_finish(int context, boolean sucess, boolean del, int time);
-// public static final native int gtk_drag_dest_find_target(int widget, int context, int target_list);
-// static final native void memmove(GdkDragContext dest, int src);
-// public static final native void memmove(int dest, GdkDragContext src);
-// public static final int GDK_ACTION_DEFAULT = 1 << 0;
-// public static final int GDK_ACTION_COPY = 1 << 1;
-// public static final int GDK_ACTION_MOVE = 1 << 2;
-// public static final int GDK_ACTION_LINK = 1 << 3;
-// public static final int GDK_ACTION_PRIVATE = 1 << 4;
-// public static final int GDK_ACTION_ASK = 1 << 5;
-// public static final int GTK_DEST_DEFAULT_MOTION = 1 << 0; /* respond to "drag_motion" */
-// public static final int GTK_DEST_DEFAULT_HIGHLIGHT = 1 << 1; /* auto-highlight */
-// public static final int GTK_DEST_DEFAULT_DROP = 1 << 2; /* respond to "drag_drop" */
-// public static final int GTK_DEST_DEFAULT_ALL = 0x07;
-
-
- /* CLIPBOARD SUPPORT - MOVE TO APPROPRIATE PLACE LATER */
- public static final native int gtk_clipboard_get( int selection );
- public static final native boolean gtk_clipboard_set_with_data (int clipboard, int targets, int n_targets, int get_func, int clear_func, int user_data);
- public static final native int gtk_clipboard_wait_for_contents (int clipboard, int target);
- public static final native void gtk_selection_data_set(int selection_data, int type, int format, int data, int length);
-
- public static final native int gtk_clipboard_clear( int clipboard );
- public static final native int gtk_selection_data_free( int selection_data );
- public static final native void memmove(int dest, GtkTargetEntry src);
- public static final native void memmove(GtkTargetEntry dest, int src);
- public static final native void memmove(GtkSelectionData dest, int src);
- public static final native int GDK_POINTER_TO_ATOM(int ptr);
+ }
public static final int GDK_NONE = 0;
@@ -973,4 +938,14 @@ public static final native void gtk_clist_set_row_height(int clist, int height);
public static final native boolean gdk_event_focus_get_in(int event);
public static final native void gdk_window_set_back_pixmap(int window, int pixmap, boolean parent_relative);
public static final native void gdk_window_set_override_redirect(int window, boolean override_redirect);
+
+/* Clipoard */
+public static final native int gtk_clipboard_clear( int clipboard );
+public static final native int gtk_clipboard_get( int selection );
+public static final native boolean gtk_clipboard_set_with_data (int clipboard, int targets, int n_targets, int get_func, int clear_func, int user_data);
+public static final native int gtk_clipboard_wait_for_contents (int clipboard, int target);
+public static final native int gtk_selection_data_free( int selection_data );
+public static final native void gtk_selection_data_set(int selection_data, int type, int format, int data, int length);
+public static final native void memmove(int dest, GtkTargetEntry src);
+public static final native void memmove(GtkSelectionData dest, int src);
} \ No newline at end of file

Back to the top