1 /*
2 * Copyright (c) 2003, 2006, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
58 XlibWrapper.larg3, // xr_return
59 XlibWrapper.larg4, // yr_return
60 XlibWrapper.larg5, // xw_return
61 XlibWrapper.larg6, // yw_return
62 XlibWrapper.larg7); // mask_return
63 if (pointerFound) {
64 point.x = Native.getInt(XlibWrapper.larg3);
65 point.y = Native.getInt(XlibWrapper.larg4);
66 return i;
67 }
68 }
69 } finally {
70 XToolkit.awtUnlock();
71 }
72
73 // this should never happen
74 assert false : "No pointer found in the system.";
75 return 0;
76 }
77
78 public boolean isWindowUnderMouse(Window w) {
79
80 long display = XToolkit.getDisplay();
81
82 // java.awt.Component.findUnderMouseInWindow checks that
83 // the peer is non-null by checking that the component
84 // is showing.
85
86 long contentWindow = ((XWindow)w.getPeer()).getContentWindow();
87 long parent = XlibUtil.getParentWindow(contentWindow);
88
89 XToolkit.awtLock();
90 try
91 {
92 boolean windowOnTheSameScreen = XlibWrapper.XQueryPointer(display, parent,
93 XlibWrapper.larg1, // root_return
94 XlibWrapper.larg8, // child_return
95 XlibWrapper.larg3, // root_x_return
96 XlibWrapper.larg4, // root_y_return
97 XlibWrapper.larg5, // win_x_return
|
1 /*
2 * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
58 XlibWrapper.larg3, // xr_return
59 XlibWrapper.larg4, // yr_return
60 XlibWrapper.larg5, // xw_return
61 XlibWrapper.larg6, // yw_return
62 XlibWrapper.larg7); // mask_return
63 if (pointerFound) {
64 point.x = Native.getInt(XlibWrapper.larg3);
65 point.y = Native.getInt(XlibWrapper.larg4);
66 return i;
67 }
68 }
69 } finally {
70 XToolkit.awtUnlock();
71 }
72
73 // this should never happen
74 assert false : "No pointer found in the system.";
75 return 0;
76 }
77
78 @SuppressWarnings("deprecation")
79 public boolean isWindowUnderMouse(Window w) {
80
81 long display = XToolkit.getDisplay();
82
83 // java.awt.Component.findUnderMouseInWindow checks that
84 // the peer is non-null by checking that the component
85 // is showing.
86
87 long contentWindow = ((XWindow)w.getPeer()).getContentWindow();
88 long parent = XlibUtil.getParentWindow(contentWindow);
89
90 XToolkit.awtLock();
91 try
92 {
93 boolean windowOnTheSameScreen = XlibWrapper.XQueryPointer(display, parent,
94 XlibWrapper.larg1, // root_return
95 XlibWrapper.larg8, // child_return
96 XlibWrapper.larg3, // root_x_return
97 XlibWrapper.larg4, // root_y_return
98 XlibWrapper.larg5, // win_x_return
|