1 /*
2 * Copyright (c) 2010, 2015, 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
23 * questions.
24 */
25 package com.sun.glass.ui;
26
27 import com.sun.glass.events.MouseEvent;
28 import com.sun.glass.events.ViewEvent;
29
30 import java.lang.ref.WeakReference;
31 import java.security.AccessController;
32 import java.security.PrivilegedAction;
33 import java.util.Map;
34
35 public abstract class View {
36
37 public final static int GESTURE_NO_VALUE = Integer.MAX_VALUE;
38 public final static double GESTURE_NO_DOUBLE_VALUE = Double.NaN;
39
40 public final static byte IME_ATTR_INPUT = 0x00;
41 public final static byte IME_ATTR_TARGET_CONVERTED = 0x01;
42 public final static byte IME_ATTR_CONVERTED = 0x02;
43 public final static byte IME_ATTR_TARGET_NOTCONVERTED = 0x03;
44 public final static byte IME_ATTR_INPUT_ERROR = 0x04;
45
46 final static boolean accessible = AccessController.doPrivileged((PrivilegedAction<Boolean>) () -> {
47 String force = System.getProperty("glass.accessible.force");
48 if (force != null) return Boolean.parseBoolean(force);
49
50 /* By default accessibility is enabled for Mac 10.9 or greater and Windows 7 or greater. */
51 try {
52 String platform = Platform.determinePlatform();
53 String major = System.getProperty("os.version").replaceFirst("(\\d+)\\.\\d+.*", "$1");
54 String minor = System.getProperty("os.version").replaceFirst("\\d+\\.(\\d+).*", "$1");
55 int v = Integer.parseInt(major) * 100 + Integer.parseInt(minor);
56 return (platform.equals(Platform.MAC) && v >= 1009) ||
57 (platform.equals(Platform.WINDOWS) && v >= 601);
58 } catch (Exception e) {
59 return false;
60 }
61 });
62
63 public static class EventHandler {
64 public void handleViewEvent(View view, long time, int type) {
|
1 /*
2 * Copyright (c) 2010, 2016, 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
23 * questions.
24 */
25 package com.sun.glass.ui;
26
27 import com.sun.glass.events.MouseEvent;
28 import com.sun.glass.events.ViewEvent;
29
30 import java.lang.annotation.Native;
31 import java.lang.ref.WeakReference;
32 import java.security.AccessController;
33 import java.security.PrivilegedAction;
34 import java.util.Map;
35
36 public abstract class View {
37
38 @Native public final static int GESTURE_NO_VALUE = Integer.MAX_VALUE;
39 @Native public final static double GESTURE_NO_DOUBLE_VALUE = Double.NaN;
40
41 @Native public final static byte IME_ATTR_INPUT = 0x00;
42 @Native public final static byte IME_ATTR_TARGET_CONVERTED = 0x01;
43 @Native public final static byte IME_ATTR_CONVERTED = 0x02;
44 @Native public final static byte IME_ATTR_TARGET_NOTCONVERTED = 0x03;
45 @Native public final static byte IME_ATTR_INPUT_ERROR = 0x04;
46
47 final static boolean accessible = AccessController.doPrivileged((PrivilegedAction<Boolean>) () -> {
48 String force = System.getProperty("glass.accessible.force");
49 if (force != null) return Boolean.parseBoolean(force);
50
51 /* By default accessibility is enabled for Mac 10.9 or greater and Windows 7 or greater. */
52 try {
53 String platform = Platform.determinePlatform();
54 String major = System.getProperty("os.version").replaceFirst("(\\d+)\\.\\d+.*", "$1");
55 String minor = System.getProperty("os.version").replaceFirst("\\d+\\.(\\d+).*", "$1");
56 int v = Integer.parseInt(major) * 100 + Integer.parseInt(minor);
57 return (platform.equals(Platform.MAC) && v >= 1009) ||
58 (platform.equals(Platform.WINDOWS) && v >= 601);
59 } catch (Exception e) {
60 return false;
61 }
62 });
63
64 public static class EventHandler {
65 public void handleViewEvent(View view, long time, int type) {
|