1 /*
2 * Copyright (c) 2003, 2017, 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
924 if (!XToolkit.getSunAwtDisableGrab()) {
925 XlibWrapper.XUngrabPointer(XToolkit.getDisplay(), XConstants.CurrentTime);
926 XlibWrapper.XUngrabKeyboard(XToolkit.getDisplay(), XConstants.CurrentTime);
927 }
928 XAwtState.setGrabWindow(null);
929 // we need to call XFlush() here to force ungrab
930 // see 6384219 for details
931 XlibWrapper.XFlush(XToolkit.getDisplay());
932 }
933 } finally {
934 XToolkit.awtUnlock();
935 }
936 }
937
938 // called from ungrabInput, used in popup windows to hide theirselfs in ungrabbing
939 void ungrabInputImpl() {
940 }
941
942 static void checkSecurity() {
943 if (XToolkit.isSecurityWarningEnabled() && XToolkit.isToolkitThread()) {
944 StackTraceElement stack[] = (new Throwable()).getStackTrace();
945 log.warning(stack[1] + ": Security violation: calling user code on toolkit thread");
946 }
947 }
948
949 public Set<Long> getChildren() {
950 synchronized (getStateLock()) {
951 return new HashSet<Long>(children);
952 }
953 }
954
955 // -------------- Event handling ----------------
956 public void handleMapNotifyEvent(XEvent xev) {
957 mapped = true;
958 }
959 public void handleUnmapNotifyEvent(XEvent xev) {
960 mapped = false;
961 }
962 public void handleReparentNotifyEvent(XEvent xev) {
963 if (eventLog.isLoggable(PlatformLogger.Level.FINER)) {
964 XReparentEvent msg = xev.get_xreparent();
|
1 /*
2 * Copyright (c) 2003, 2018, 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
924 if (!XToolkit.getSunAwtDisableGrab()) {
925 XlibWrapper.XUngrabPointer(XToolkit.getDisplay(), XConstants.CurrentTime);
926 XlibWrapper.XUngrabKeyboard(XToolkit.getDisplay(), XConstants.CurrentTime);
927 }
928 XAwtState.setGrabWindow(null);
929 // we need to call XFlush() here to force ungrab
930 // see 6384219 for details
931 XlibWrapper.XFlush(XToolkit.getDisplay());
932 }
933 } finally {
934 XToolkit.awtUnlock();
935 }
936 }
937
938 // called from ungrabInput, used in popup windows to hide theirselfs in ungrabbing
939 void ungrabInputImpl() {
940 }
941
942 static void checkSecurity() {
943 if (XToolkit.isSecurityWarningEnabled() && XToolkit.isToolkitThread()) {
944 StackTraceElement[] stack = (new Throwable()).getStackTrace();
945 log.warning(stack[1] + ": Security violation: calling user code on toolkit thread");
946 }
947 }
948
949 public Set<Long> getChildren() {
950 synchronized (getStateLock()) {
951 return new HashSet<Long>(children);
952 }
953 }
954
955 // -------------- Event handling ----------------
956 public void handleMapNotifyEvent(XEvent xev) {
957 mapped = true;
958 }
959 public void handleUnmapNotifyEvent(XEvent xev) {
960 mapped = false;
961 }
962 public void handleReparentNotifyEvent(XEvent xev) {
963 if (eventLog.isLoggable(PlatformLogger.Level.FINER)) {
964 XReparentEvent msg = xev.get_xreparent();
|