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
26 package com.sun.javafx.tk.quantum;
27
28 import com.sun.glass.events.GestureEvent;
29 import com.sun.glass.events.KeyEvent;
30 import com.sun.glass.events.MouseEvent;
31 import com.sun.glass.events.ViewEvent;
32 import com.sun.glass.events.TouchEvent;
33 import com.sun.glass.events.SwipeGesture;
34 import com.sun.glass.ui.Accessible;
35 import com.sun.glass.ui.Clipboard;
36 import com.sun.glass.ui.ClipboardAssistance;
37 import com.sun.glass.ui.View;
38 import com.sun.glass.ui.Window;
39 import com.sun.javafx.PlatformUtil;
40 import com.sun.javafx.collections.TrackableObservableList;
41 import com.sun.javafx.logging.PulseLogger;
42 import static com.sun.javafx.logging.PulseLogger.PULSE_LOGGING_ENABLED;
43 import com.sun.javafx.scene.input.KeyCodeMap;
44
45 import javafx.collections.ListChangeListener;
46 import javafx.collections.ObservableList;
47
48 import javafx.event.EventType;
49 import javafx.geometry.Point2D;
50 import javafx.scene.input.InputMethodEvent;
51 import javafx.scene.input.InputMethodHighlight;
52 import javafx.scene.input.InputMethodTextRun;
53 import javafx.scene.input.KeyCode;
54 import javafx.scene.input.MouseButton;
55 import javafx.scene.input.RotateEvent;
56 import javafx.scene.input.ScrollEvent;
415 QuantumToolkit.runWithoutRenderLock(() -> {
416 return AccessController.doPrivileged(mouseNotification, scene.getAccessControlContext());
417 });
418 }
419
420 @Override public void handleMenuEvent(final View view,
421 final int x, final int y, final int xAbs, final int yAbs,
422 final boolean isKeyboardTrigger)
423 {
424 if (PULSE_LOGGING_ENABLED) {
425 PulseLogger.newInput("MENU_EVENT");
426 }
427 WindowStage stage = scene.getWindowStage();
428 try {
429 if (stage != null) {
430 stage.setInAllowedEventHandler(true);
431 }
432 QuantumToolkit.runWithoutRenderLock(() -> {
433 return AccessController.doPrivileged((PrivilegedAction<Void>) () -> {
434 if (scene.sceneListener != null) {
435 Window w = view.getWindow();
436 double pScale = (w == null) ? 1.0 : w.getPlatformScale();
437 scene.sceneListener.menuEvent(x / pScale, y / pScale,
438 xAbs / pScale, yAbs / pScale,
439 isKeyboardTrigger);
440 }
441 return null;
442 }, scene.getAccessControlContext());
443 });
444 } finally {
445 if (stage != null) {
446 stage.setInAllowedEventHandler(false);
447 }
448 if (PULSE_LOGGING_ENABLED) {
449 PulseLogger.newInput(null);
450 }
451 }
452 }
453
454 @Override public void handleScrollEvent(final View view, final long time,
455 final int x, final int y, final int xAbs, final int yAbs,
456 final double deltaX, final double deltaY, final int modifiers,
457 final int lines, final int chars,
458 final int defaultLines, final int defaultChars,
|
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
26 package com.sun.javafx.tk.quantum;
27
28 import com.sun.glass.events.GestureEvent;
29 import com.sun.glass.events.KeyEvent;
30 import com.sun.glass.events.MouseEvent;
31 import com.sun.glass.events.ViewEvent;
32 import com.sun.glass.events.TouchEvent;
33 import com.sun.glass.events.SwipeGesture;
34 import com.sun.glass.ui.Accessible;
35 import com.sun.glass.ui.Clipboard;
36 import com.sun.glass.ui.ClipboardAssistance;
37 import com.sun.glass.ui.Screen;
38 import com.sun.glass.ui.View;
39 import com.sun.glass.ui.Window;
40 import com.sun.javafx.PlatformUtil;
41 import com.sun.javafx.collections.TrackableObservableList;
42 import com.sun.javafx.logging.PulseLogger;
43 import static com.sun.javafx.logging.PulseLogger.PULSE_LOGGING_ENABLED;
44 import com.sun.javafx.scene.input.KeyCodeMap;
45
46 import javafx.collections.ListChangeListener;
47 import javafx.collections.ObservableList;
48
49 import javafx.event.EventType;
50 import javafx.geometry.Point2D;
51 import javafx.scene.input.InputMethodEvent;
52 import javafx.scene.input.InputMethodHighlight;
53 import javafx.scene.input.InputMethodTextRun;
54 import javafx.scene.input.KeyCode;
55 import javafx.scene.input.MouseButton;
56 import javafx.scene.input.RotateEvent;
57 import javafx.scene.input.ScrollEvent;
416 QuantumToolkit.runWithoutRenderLock(() -> {
417 return AccessController.doPrivileged(mouseNotification, scene.getAccessControlContext());
418 });
419 }
420
421 @Override public void handleMenuEvent(final View view,
422 final int x, final int y, final int xAbs, final int yAbs,
423 final boolean isKeyboardTrigger)
424 {
425 if (PULSE_LOGGING_ENABLED) {
426 PulseLogger.newInput("MENU_EVENT");
427 }
428 WindowStage stage = scene.getWindowStage();
429 try {
430 if (stage != null) {
431 stage.setInAllowedEventHandler(true);
432 }
433 QuantumToolkit.runWithoutRenderLock(() -> {
434 return AccessController.doPrivileged((PrivilegedAction<Void>) () -> {
435 if (scene.sceneListener != null) {
436 double pScale, sx, sy;
437 Window w = view.getWindow();
438 if (w != null) {
439 pScale = w.getPlatformScale();
440 Screen scr = w.getScreen();
441 if (scr != null) {
442 sx = scr.getX();
443 sy = scr.getY();
444 } else {
445 sx = sy = 0.0;
446 }
447 } else {
448 pScale = 1.0;
449 sx = sy = 0.0;
450 }
451 scene.sceneListener.menuEvent(x / pScale, y / pScale,
452 sx + (xAbs - sx) / pScale,
453 sy + (yAbs - sy) / pScale,
454 isKeyboardTrigger);
455 }
456 return null;
457 }, scene.getAccessControlContext());
458 });
459 } finally {
460 if (stage != null) {
461 stage.setInAllowedEventHandler(false);
462 }
463 if (PULSE_LOGGING_ENABLED) {
464 PulseLogger.newInput(null);
465 }
466 }
467 }
468
469 @Override public void handleScrollEvent(final View view, final long time,
470 final int x, final int y, final int xAbs, final int yAbs,
471 final double deltaX, final double deltaY, final int modifiers,
472 final int lines, final int chars,
473 final int defaultLines, final int defaultChars,
|