|
1 |
| -/* |
2 |
| - * Copyright (c) 2010, 2024, 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.events; |
26 |
| - |
27 |
| -import com.sun.glass.ui.Window; |
28 |
| -import com.sun.glass.ui.WindowControlsOverlay; |
29 |
| -import java.lang.annotation.Native; |
30 |
| - |
31 |
| -public class MouseEvent { |
32 |
| - @Native final static public int BUTTON_NONE = 211; |
33 |
| - @Native final static public int BUTTON_LEFT = 212; |
34 |
| - @Native final static public int BUTTON_RIGHT = 213; |
35 |
| - @Native final static public int BUTTON_OTHER = 214; |
36 |
| - @Native final static public int BUTTON_BACK = 215; |
37 |
| - @Native final static public int BUTTON_FORWARD = 216; |
38 |
| - |
39 |
| - @Native final static public int DOWN = 221; |
40 |
| - @Native final static public int UP = 222; |
41 |
| - @Native final static public int DRAG = 223; |
42 |
| - @Native final static public int MOVE = 224; |
43 |
| - @Native final static public int ENTER = 225; |
44 |
| - @Native final static public int EXIT = 226; |
45 |
| - @Native final static public int CLICK = 227; // synthetic |
46 |
| - |
47 |
| - /** |
48 |
| - * Artificial WHEEL event type. |
49 |
| - * This kind of mouse event is NEVER sent to an app. |
50 |
| - * The app must listen to Scroll events instead. |
51 |
| - * This identifier is required for internal purposes. |
52 |
| - */ |
53 |
| - @Native final static public int WHEEL = 228; |
54 |
| - |
55 |
| - /** |
56 |
| - * Non-client events are only natively produced on the Windows platform as a result of |
57 |
| - * handling the {@code WM_NCHITTEST} message for an {@link Window#EXTENDED} window. |
58 |
| - * <p> |
59 |
| - * They are never sent to applications, but are processed by {@link WindowControlsOverlay}. |
60 |
| - */ |
61 |
| - @Native final static public int NC_DOWN = 230; |
62 |
| - @Native final static public int NC_UP = 231; |
63 |
| - @Native final static public int NC_DRAG = 232; |
64 |
| - @Native final static public int NC_MOVE = 233; |
65 |
| - @Native final static public int NC_ENTER = 234; |
66 |
| - @Native final static public int NC_EXIT = 235; |
67 |
| - |
68 |
| - public static boolean isNonClientEvent(int event) { |
69 |
| - return event >= NC_DOWN && event <= NC_EXIT; |
70 |
| - } |
71 |
| - |
72 |
| - public static int toNonClientEvent(int event) { |
73 |
| - return switch (event) { |
74 |
| - case DOWN -> NC_DOWN; |
75 |
| - case UP -> NC_UP; |
76 |
| - case DRAG -> NC_DRAG; |
77 |
| - case MOVE -> NC_MOVE; |
78 |
| - case ENTER -> NC_ENTER; |
79 |
| - case EXIT -> NC_EXIT; |
80 |
| - default -> event; |
81 |
| - }; |
82 |
| - } |
83 |
| -} |
| 1 | +/* |
| 2 | + * Copyright (c) 2010, 2024, 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.events; |
| 26 | + |
| 27 | +import com.sun.glass.ui.Window; |
| 28 | +import com.sun.glass.ui.WindowControlsOverlay; |
| 29 | +import java.lang.annotation.Native; |
| 30 | + |
| 31 | +public class MouseEvent { |
| 32 | + @Native final static public int BUTTON_NONE = 211; |
| 33 | + @Native final static public int BUTTON_LEFT = 212; |
| 34 | + @Native final static public int BUTTON_RIGHT = 213; |
| 35 | + @Native final static public int BUTTON_OTHER = 214; |
| 36 | + @Native final static public int BUTTON_BACK = 215; |
| 37 | + @Native final static public int BUTTON_FORWARD = 216; |
| 38 | + |
| 39 | + @Native final static public int DOWN = 221; |
| 40 | + @Native final static public int UP = 222; |
| 41 | + @Native final static public int DRAG = 223; |
| 42 | + @Native final static public int MOVE = 224; |
| 43 | + @Native final static public int ENTER = 225; |
| 44 | + @Native final static public int EXIT = 226; |
| 45 | + @Native final static public int CLICK = 227; // synthetic |
| 46 | + |
| 47 | + /** |
| 48 | + * Artificial WHEEL event type. |
| 49 | + * This kind of mouse event is NEVER sent to an app. |
| 50 | + * The app must listen to Scroll events instead. |
| 51 | + * This identifier is required for internal purposes. |
| 52 | + */ |
| 53 | + @Native final static public int WHEEL = 228; |
| 54 | + |
| 55 | + /** |
| 56 | + * Non-client events are only natively produced on the Windows platform as a result of |
| 57 | + * handling the {@code WM_NCHITTEST} message for an {@link Window#EXTENDED} window. |
| 58 | + * <p> |
| 59 | + * They are never sent to applications, but are processed by {@link WindowControlsOverlay}. |
| 60 | + */ |
| 61 | + @Native final static public int NC_DOWN = 230; |
| 62 | + @Native final static public int NC_UP = 231; |
| 63 | + @Native final static public int NC_DRAG = 232; |
| 64 | + @Native final static public int NC_MOVE = 233; |
| 65 | + @Native final static public int NC_ENTER = 234; |
| 66 | + @Native final static public int NC_EXIT = 235; |
| 67 | + |
| 68 | + public static boolean isNonClientEvent(int event) { |
| 69 | + return event >= NC_DOWN && event <= NC_EXIT; |
| 70 | + } |
| 71 | + |
| 72 | + public static int toNonClientEvent(int event) { |
| 73 | + return switch (event) { |
| 74 | + case DOWN -> NC_DOWN; |
| 75 | + case UP -> NC_UP; |
| 76 | + case DRAG -> NC_DRAG; |
| 77 | + case MOVE -> NC_MOVE; |
| 78 | + case ENTER -> NC_ENTER; |
| 79 | + case EXIT -> NC_EXIT; |
| 80 | + default -> event; |
| 81 | + }; |
| 82 | + } |
| 83 | +} |
0 commit comments