6447N/A * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. 0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/A * This code is free software; you can redistribute it and/or modify it 0N/A * under the terms of the GNU General Public License version 2 only, as 2362N/A * published by the Free Software Foundation. Oracle designates this 0N/A * particular file as subject to the "Classpath" exception as provided 2362N/A * by Oracle in the LICENSE file that accompanied this code. 0N/A * This code is distributed in the hope that it will be useful, but WITHOUT 0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/A * version 2 for more details (a copy is included in the LICENSE file that 0N/A * accompanied this code). 0N/A * You should have received a copy of the GNU General Public License version 0N/A * 2 along with this work; if not, write to the Free Software Foundation, 0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 2362N/A * or visit www.oracle.com if you need additional information or have any 0N/A * Returns the XID of the topmost window with WM_STATE set in the ancestor 0N/A * heirarchy of the specified window or 0 if none found. 0N/A /* Traverse the ancestor tree from window up to the root and find 0N/A the top-level client window nearest to the root. */ 0N/A // The list of protocols supported by the embedder. 0N/A /* Grab server, since we are working with the window that belongs to 0N/A * By default, we register a drop site that supports all dnd 0N/A * protocols. This approach is not appropriate in plugin 0N/A * scenario if the browser supports Motif DnD and doesn't support 0N/A * XDnD. If we forcibly set XdndAware on the browser toplevel, any drag 0N/A * source that supports both protocols and prefers XDnD will be unable 0N/A * to drop anything on the browser. 0N/A * The solution for this problem is not to register XDnD drop site 0N/A * if the browser supports only Motif DnD. 0N/A * In general, if the browser already supports some protocols, we 0N/A * register the embedded drop site only for those protocols. Otherwise 0N/A * we register the embedded drop site for all protocols. 0N/A /* Grab server, since we are working with the window that belongs to 0N/A // No need to update our own drop sites. 0N/A // The list of protocols supported by the embedder. 0N/A synchronized (
this) {
0N/A * By default, we register a drop site that supports all dnd 0N/A * protocols. This approach is not appropriate in plugin 0N/A * scenario if the browser supports Motif DnD and doesn't support 0N/A * XDnD. If we forcibly set XdndAware on the browser toplevel, any drag 0N/A * source that supports both protocols and prefers XDnD will be unable 0N/A * to drop anything on the browser. 0N/A * The solution for this problem is not to register XDnD drop site 0N/A * if the browser supports only Motif DnD. 0N/A * In general, if the browser already supports some protocols, we 0N/A * register the embedded drop site only for those protocols. Otherwise 0N/A * we register the embedded drop site for all protocols. 0N/A /* Grab server, since we are working with the window that belongs to 0N/A /* Grab server, since we are working with the window that belongs to 0N/A /* Restore the original event mask for the embedder. */ 0N/A synchronized (
this) {
0N/A // Toplevel is an XEmbed server within this VM. 0N/A // Register an XEmbed drop site. 0N/A // Create a dummy entry to register the embedded site. 0N/A // Foreign toplevel. 0N/A // Select for PropertyNotify events on the toplevel, so that 0N/A // we can track changes of the properties relevant to DnD 0N/A // Register the toplevel with all DnD protocols that are not 0N/A // supported by XEmbed - actually setup a proxy, so that 0N/A // all DnD notifications sent to the toplevel are first 0N/A // For a foreign toplevel. 0N/A // Since this is not an XEmbed client we can no longer rely 0N/A // on XEmbed to route DnD notifications even for DnD 0N/A // protocols that are supported by XEmbed. 0N/A // We rollback to the XEmbed-unfriendly solution - setup 0N/A // a proxy, so that all DnD notifications sent to the 0N/A // toplevel are first routed to us. 0N/A // Register the embedded window as a plain drop site with 0N/A // all DnD protocols that are supported by XEmbed. 0N/A synchronized (
this) {
0N/A // Unregister an XEmbed drop site. 0N/A * Returns a drop site that is embedded in the specified embedder window and 0N/A * contains the point with the specified root coordinates. 1888N/A * Note: this method should be called under AWT lock. 1888N/A * No window with WM_STATE property is found. 1888N/A * Since the window can be a plugin window reparented to the browser 1888N/A * toplevel, we cannot determine which window will eventually have 1888N/A * WM_STATE property set. So we schedule a timer callback that will 1888N/A * periodically attempt to find an ancestor with WM_STATE and 1888N/A * register the drop site appropriately. 1888N/A * Note: this method should be called under AWT lock. 0N/A // If the client has an associated XDnD drop site, add a drop target 0N/A // to the XEmbedCanvasPeer's target to route drag notifications to the 0N/A /**************** Delayed drop site registration *******************************/ 0N/A /*******************************************************************************/