/*
* 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.
*/
/**
* The class responsible for registration/deregistration of drop sites.
*
* @since 1.5
*/
final class XDropTargetRegistry {
new XDropTargetRegistry();
private XDropTargetRegistry() {}
return theInstance;
}
/**
* Returns the XID of the topmost window with WM_STATE set in the ancestor
* heirarchy of the specified window or 0 if none found.
*/
if (candWindow != null) {
}
}
/* Traverse the ancestor tree from window up to the root and find
the top-level client window nearest to the root. */
do {
return window;
}
} while (window != 0);
return window;
}
static final long getDnDProxyWindow() {
}
private static final class EmbeddedDropSiteEntry {
private final long root;
private final long event_mask;
if (supportedProtocols == null) {
throw new NullPointerException("Null supportedProtocols");
}
this.event_mask = event_mask;
this.supportedProtocols = supportedProtocols;
}
public long getRoot() {
return root;
}
public long getEventMask() {
return event_mask;
}
public boolean hasNonXEmbedClientSites() {
return !nonXEmbedClientSites.isEmpty();
}
}
if (!isXEmbedClient) {
}
}
}
}
return supportedProtocols;
}
public boolean hasSites() {
}
public long[] getSites() {
int index = 0;
}
return ret;
}
public long getSite(int x, int y) {
assert XToolkit.isAWTLockHeldByCurrentThread();
if (p == null) {
continue;
}
int dest_x = p.x;
int dest_y = p.y;
try {
if ((status == 0) ||
continue;
}
return window;
}
} finally {
}
}
}
return 0;
}
}
assert XToolkit.isAWTLockHeldByCurrentThread();
// The list of protocols supported by the embedder.
while (dropTargetProtocols.hasNext()) {
}
}
/* Grab server, since we are working with the window that belongs to
another client. */
try {
long root = 0;
long event_mask = 0;
try {
if ((status == 0) ||
throw new XException("XGetWindowAttributes failed");
}
} finally {
}
throw new XException("XSelectInput failed");
}
}
} finally {
}
}
private static final boolean XEMBED_PROTOCOLS = true;
private static final boolean NON_XEMBED_PROTOCOLS = false;
/*
* By default, we register a drop site that supports all dnd
* protocols. This approach is not appropriate in plugin
* scenario if the browser supports Motif DnD and doesn't support
* XDnD. If we forcibly set XdndAware on the browser toplevel, any drag
* source that supports both protocols and prefers XDnD will be unable
* to drop anything on the browser.
* The solution for this problem is not to register XDnD drop site
* if the browser supports only Motif DnD.
* In general, if the browser already supports some protocols, we
* register the embedded drop site only for those protocols. Otherwise
* we register the embedded drop site for all protocols.
*/
if (!supportedProtocols.isEmpty()) {
} else {
}
/* Grab server, since we are working with the window that belongs to
another client. */
try {
while (dropTargetProtocols.hasNext()) {
if ((protocols == XEMBED_PROTOCOLS) ==
}
}
} finally {
}
}
// No need to update our own drop sites.
if (xbaseWindow != null) {
return;
}
assert XToolkit.isAWTLockHeldByCurrentThread();
// The list of protocols supported by the embedder.
while (dropTargetProtocols.hasNext()) {
}
}
boolean isXEmbedServer = false;
synchronized (this) {
return;
}
}
/*
* By default, we register a drop site that supports all dnd
* protocols. This approach is not appropriate in plugin
* scenario if the browser supports Motif DnD and doesn't support
* XDnD. If we forcibly set XdndAware on the browser toplevel, any drag
* source that supports both protocols and prefers XDnD will be unable
* to drop anything on the browser.
* The solution for this problem is not to register XDnD drop site
* if the browser supports only Motif DnD.
* In general, if the browser already supports some protocols, we
* register the embedded drop site only for those protocols. Otherwise
* we register the embedded drop site for all protocols.
*/
if (!embedderProtocols.isEmpty()) {
} else {
}
/* Grab server, since we are working with the window that belongs to
another client. */
try {
while (dropTargetProtocols.hasNext()) {
}
}
} finally {
}
}
assert XToolkit.isAWTLockHeldByCurrentThread();
/* Grab server, since we are working with the window that belongs to
another client. */
try {
while (dropTargetProtocols.hasNext()) {
}
/* Restore the original event mask for the embedder. */
throw new XException("XSelectInput failed");
}
}
} finally {
}
}
boolean isXEmbedClient =
(xBaseWindow instanceof XEmbeddedFramePeer) &&
{
if (xbaseWindow != null) {
if (xbaseWindow instanceof XEmbedCanvasPeer) {
} else {
throw new UnsupportedOperationException();
}
}
}
synchronized (this) {
entry =
// Toplevel is an XEmbed server within this VM.
// Register an XEmbed drop site.
// Create a dummy entry to register the embedded site.
} else {
// Foreign toplevel.
// Select for PropertyNotify events on the toplevel, so that
// we can track changes of the properties relevant to DnD
// protocols.
// Register the toplevel with all DnD protocols that are not
// supported by XEmbed - actually setup a proxy, so that
// all DnD notifications sent to the toplevel are first
// routed to us.
}
}
}
synchronized (entry) {
// For a foreign toplevel.
if (!isXEmbedClient) {
// Since this is not an XEmbed client we can no longer rely
// on XEmbed to route DnD notifications even for DnD
// protocols that are supported by XEmbed.
// We rollback to the XEmbed-unfriendly solution - setup
// a proxy, so that all DnD notifications sent to the
// toplevel are first routed to us.
} else {
// Register the embedded window as a plain drop site with
// all DnD protocols that are supported by XEmbed.
while (dropTargetProtocols.hasNext()) {
if (dropTargetProtocol.isXEmbedSupported()) {
}
}
}
}
}
}
synchronized (this) {
entry =
return;
}
if (xbaseWindow != null) {
if (xbaseWindow instanceof XEmbedCanvasPeer) {
// Unregister an XEmbed drop site.
} else {
throw new UnsupportedOperationException();
}
} else {
}
}
}
}
/*
* Returns a drop site that is embedded in the specified embedder window and
* contains the point with the specified root coordinates.
*/
return 0;
}
}
/*
* Note: this method should be called under AWT lock.
*/
assert XToolkit.isAWTLockHeldByCurrentThread();
if (window == 0) {
throw new IllegalArgumentException();
}
/*
* No window with WM_STATE property is found.
* Since the window can be a plugin window reparented to the browser
* toplevel, we cannot determine which window will eventually have
* WM_STATE property set. So we schedule a timer callback that will
* periodically attempt to find an ancestor with WM_STATE and
* register the drop site appropriately.
*/
if (toplevel == 0) {
return;
}
while (dropTargetProtocols.hasNext()) {
}
} else {
}
}
/*
* Note: this method should be called under AWT lock.
*/
assert XToolkit.isAWTLockHeldByCurrentThread();
if (window == 0) {
throw new IllegalArgumentException();
}
while (dropProtocols.hasNext()) {
}
} else {
}
}
// If the client has an associated XDnD drop site, add a drop target
// to the XEmbedCanvasPeer's target to route drag notifications to the
// client.
}
while (dropTargetProtocols.hasNext()) {
}
}
}
}
}
while (dropTargetProtocols.hasNext()) {
}
}
}
/**************** Delayed drop site registration *******************************/
public void run() {
}
};
try {
} finally {
}
}
try {
}
} finally {
}
}
/*******************************************************************************/
}