/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* XDropTargetProtocol implementation for XDnD protocol.
*
* @since 1.5
*/
private boolean trackSourceActions = false;
// XEmbed stuff.
private boolean overXEmbedClient = false;
super(listener);
}
/**
* Creates an instance associated with the specified listener.
*
* @throws NullPointerException if listener is <code>null</code>.
*/
return new XDnDDropTargetProtocol(listener);
}
return XDragAndDropProtocols.XDnD;
}
assert XToolkit.isAWTLockHeldByCurrentThread();
try {
throw new XException("Cannot write XdndAware property");
}
} finally {
data = 0;
}
}
assert XToolkit.isAWTLockHeldByCurrentThread();
}
assert XToolkit.isAWTLockHeldByCurrentThread();
boolean overriden = false;
int version = 0;
long proxy = 0;
int status = 0;
false, XConstants.AnyPropertyType);
try {
overriden = true;
}
} finally {
}
/* XdndProxy is not supported for prior to XDnD version 4 */
try {
}
} finally {
}
if (proxy != 0) {
try {
proxy = 0;
} else {
0, 1, false,
try {
proxy = 0;
}
} finally {
}
}
} finally {
}
}
}
// Embedder already registered.
return;
}
try {
/* The proxy window must have the XdndAware set, as XDnD protocol
prescribes to check the proxy window for XdndAware. */
data, 1);
throw new XException("Cannot write XdndAware property");
}
/* The proxy window must have the XdndProxy set to point to itself.*/
data, 1);
throw new XException("Cannot write XdndProxy property");
}
data, 1);
throw new XException("Cannot write XdndAware property");
}
data, 1);
throw new XException("Cannot write XdndProxy property");
}
} finally {
data = 0;
}
}
assert XToolkit.isAWTLockHeldByCurrentThread();
return;
}
if (entry.isOverriden()) {
try {
data, 1);
throw new XException("Cannot write XdndAware property");
}
data, 1);
throw new XException("Cannot write XdndProxy property");
}
} finally {
data = 0;
}
} else {
}
}
/*
* Gets and stores in the registry the embedder's XDnD drop site info
* from the embedded.
*/
assert XToolkit.isAWTLockHeldByCurrentThread();
boolean overriden = false;
int version = 0;
long proxy = 0;
int status = 0;
false, XConstants.AnyPropertyType);
try {
overriden = true;
}
} finally {
}
/* XdndProxy is not supported for prior to XDnD version 4 */
try {
}
} finally {
}
if (proxy != 0) {
try {
proxy = 0;
} else {
0, 1, false,
try {
proxy = 0;
}
} finally {
}
}
} finally {
}
}
}
}
assert XToolkit.isAWTLockHeldByCurrentThread();
false, XConstants.AnyPropertyType);
try {
return true;
} else {
return false;
}
} finally {
}
}
long source_win = 0;
long source_win_mask = 0;
int protocol_version = 0;
boolean track = true;
if (getSourceWindow() != 0) {
return false;
}
return false;
}
return false;
}
/* XDnD compliance only requires supporting version 3 and up. */
return false;
}
/* Ignore the source if the protocol version is higher than we support. */
return false;
}
/* Extract the list of supported actions. */
if (protocol_version < 2) {
/* Prior to XDnD version 2 only COPY action was supported. */
} else {
0, 0xFFFF, false,
try {
actions |=
}
} else {
/*
* According to XDnD protocol, XdndActionList is optional.
* If XdndActionList is not set we try to guess which actions are
* supported.
*/
track = true;
}
} finally {
}
}
/* Extract the available data types. */
0, 0xFFFF, false,
try {
wpg.getNumberOfItems());
} else {
formats = new long[0];
}
} finally {
}
} else {
int countFormats = 0;
long[] formats3 = new long[3];
for (int i = 0; i < 3; i++) {
long j;
formats3[countFormats++] = j;
}
}
formats = new long[countFormats];
}
assert XToolkit.isAWTLockHeldByCurrentThread();
/*
* Select for StructureNotifyMask to receive DestroyNotify in case of source
* crash.
*/
try {
if ((status == 0) ||
throw new XException("XGetWindowAttributes failed");
}
} finally {
}
throw new XException("XSelectInput failed");
}
return true;
}
long xdnd_action = 0;
int x = 0;
int y = 0;
/* Ignore XDnD messages from all other windows. */
return false;
}
{
if (xbasewindow instanceof XWindow) {
}
}
long receiver =
xclient.get_window(), x, y);
if (receiver != 0) {
if (xbasewindow instanceof XWindow) {
}
}
}
/* Translate mouse position from root coordinates
to the target window coordinates. */
x = p.x;
y = p.y;
}
/* Time stamp - new in XDnD version 1. */
if (sourceProtocolVersion > 0) {
}
/* User action - new in XDnD version 2. */
if (sourceProtocolVersion > 1) {
} else {
/* The default action is XdndActionCopy */
}
if (trackSourceActions) {
}
if (targetXWindow != null) {
}
} else {
int java_event_id = 0;
if (targetXWindow == null) {
} else {
}
}
sourceX = x;
sourceY = y;
return true;
}
/* Ignore XDnD messages from all other windows. */
return false;
}
cleanup();
return true;
}
/* Ignore XDnD messages from all other windows. */
return false;
}
if (targetXWindow != null) {
}
return true;
}
return ENTER_MESSAGE;
return MOTION_MESSAGE;
return LEAVE_MESSAGE;
return DROP_MESSAGE;
} else {
return UNKNOWN_MESSAGE;
}
}
return processXdndEnter(xclient);
return processXdndPosition(xclient);
return processXdndLeave(xclient);
return processXdndDrop(xclient);
} else {
return false;
}
}
/* flags */
}
}
long sourceWindow,
try {
/* XID of the source window */
} finally {
}
}
}
long sourceWindow) {
try {
/* XID of the source window */
/* flags */
} finally {
}
}
if (xclient.get_message_type() !=
return false;
}
}
try {
/* target window */
/* flags */
long flags = 0;
}
/* specify an empty rectangle */
/* action accepted by the target */
try {
false, XConstants.NoEventMask,
} finally {
}
} finally {
}
return true;
}
throws IllegalArgumentException, IOException {
// NOTE: we assume that the source supports at least version 1, so we
// can use the time stamp
// X server time is an unsigned 32-bit number!
// X server time is an unsigned 32-bit number!
} else {
throw new IllegalArgumentException();
}
}
if (xclient.get_message_type() !=
return false;
}
/*
* The XDnD protocol recommends that the target requests the special
* target DELETE in case if the drop action is XdndActionMove.
*/
long xdndSelectionAtom =
try {
} finally {
}
}
try {
/* specify an empty rectangle */
if (sourceProtocolVersion >= 5) {
if (success) {
}
/* action performed by the target */
}
try {
false, XConstants.NoEventMask,
} finally {
}
} finally {
}
/*
* Flush the buffer to guarantee that the drop completion event is sent
* to the source before the method returns.
*/
try {
} finally {
}
/* Trick to prevent cleanup() from posting dragExit */
/* Cannot do cleanup before the drop finishes as we may need
source protocol version to send drop finished message. */
cleanup();
return true;
}
public final long getSourceWindow() {
return sourceWindow;
}
/**
* Reset the state of the object.
*/
public void cleanup() {
// Clear the reference to this protocol.
if (targetXWindow != null) {
}
if (sourceWindow != 0) {
try {
} finally {
}
}
sourceWindow = 0;
sourceWindowMask = 0;
trackSourceActions = false;
sourceX = 0;
sourceY = 0;
}
public boolean isDragOverComponent() {
return targetXWindow != null;
}
/* Adjust the event to match the XDnD protocol version. */
}
+ " entryVersion=" + version
+ " sourceProtocolVersion=" +
+ " sourceFormats.length=" +
}
}
}
int dropAction,
int eventID) {
long nativeCtxt = 0;
// Make a copy of the passed XClientMessageEvent structure, since
// the original structure can be freed before this
// SunDropTargetEvent is dispatched.
}
// Append information from the latest XdndEnter event.
}
eventID);
}
/*
* the toolkit thread.
* dispatch thread.
*/
int eventID) {
getMessageType(new
" prevCtxt=" + prevCtxt +
getMessageType(new
}
if ((ctxt == 0 ||
(prevCtxt == 0 ||
return false;
}
// The size of XClientMessageEvent structure.
if (ctxt != 0) {
if (!overXEmbedClient) {
+ " embedded=" + embedded
+ " data1=" + data1
+ " data2=" + data2
+ " data3=" + data3
+ " data4=" + data4);
}
// Copy XdndTypeList from source to proxy.
0, 0xFFFF, false,
try {
try {
wpg.getNumberOfItems());
}
}
} finally {
}
} else {
}
}
} finally {
}
}
overXEmbedClient = true;
}
+ " embedded=" + embedded
+ " xclient=" + xclient);
}
/* Make a copy of the original event, since we are going to modify the
event while it still can be referenced from other Java events. */
{
}
}
if (overXEmbedClient) {
// Last chance to send XdndLeave to the XEmbed client.
new XClientMessageEvent(ctxt) :
new XClientMessageEvent(prevCtxt);
}
overXEmbedClient = false;
// We have to clear the proxy mode source window here,
// when the drag exits the XEmbedCanvasPeer.
// NOTE: at this point the XEmbed client still might have some
// drag notifications to process and it will send responses to
// us. With the proxy mode source window cleared we won't be
// able to forward these responses to the actual source. This is
// not a problem if the drag operation was initiated in this
// JVM. However, if it was initiated in another processes the
// responses will be lost. We bear with it for now, as it seems
// there is no other reliable point to clear.
}
}
overXEmbedClient = false;
cleanup();
}
if (prevCtxt != 0) {
prevCtxt = 0;
}
}
return true;
}
public boolean isXEmbedSupported() {
return true;
}
}