mirror of
https://github.com/JetBrains/JetBrainsRuntime.git
synced 2025-12-14 05:19:45 +01:00
Compare commits
2 Commits
ui-touch-t
...
562
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b701666a12 | ||
|
|
ba5fd36259 |
28
README.md
28
README.md
@@ -26,10 +26,6 @@ git clone git@github.com:JetBrains/JetBrainsRuntime.git
|
||||
```
|
||||
|
||||
# Configure Local Build Environment
|
||||
[OpenJDK build docs](http://hg.openjdk.java.net/jdk/jdk11/raw-file/tip/doc/building.html)
|
||||
Tip for all platforms: run ./configure and check output.
|
||||
Usually, it has meaningful advice how to solve your problem.
|
||||
|
||||
## Linux (docker)
|
||||
```
|
||||
$ cd jb/project/docker
|
||||
@@ -55,29 +51,7 @@ $ make images
|
||||
```
|
||||
|
||||
## Windows
|
||||
Install:
|
||||
|
||||
* [Cygwin x64](http://www.cygwin.com/)
|
||||
Required packages: autoconf, binutils, cpio, diffutils, file, gawk, gcc-core, make, m4, unzip, zip.
|
||||
**Install them while installing cygwin**.
|
||||
* Visual Studio compiler toolset [Download](https://visualstudio.microsoft.com/downloads/)
|
||||
Visual Studio 2015 has support by default.
|
||||
**Install with desktop development kit, it includes Windows SDK and compilers**.
|
||||
* [Java 11](http://www.oracle.com/technetwork/java/javase/downloads/index.html)
|
||||
If you have problems while configuring [read java tips on cygwin](http://horstmann.com/articles/cygwin-tips.html)
|
||||
|
||||
From command line
|
||||
```
|
||||
"c:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64
|
||||
"c:\Program_Files\cygwin64\bin\mintty.exe" /bin/bash -l
|
||||
```
|
||||
First command will set env vars, the second will run cygwin shell with proper environment.
|
||||
In cygwin shell
|
||||
```
|
||||
cd JetBrainsRuntime
|
||||
./configure --disable-warnings-as-errors
|
||||
make images
|
||||
```
|
||||
#### TBD
|
||||
|
||||
## OSX
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
# generate these charsets into sun.nio.cs
|
||||
#
|
||||
GBK
|
||||
GB18030
|
||||
Johab
|
||||
MS1255
|
||||
MS1256
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#
|
||||
#
|
||||
# Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
# Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
#
|
||||
# This code is free software; you can redistribute it and/or modify it
|
||||
@@ -38,11 +38,10 @@ allfonts.chinese-hkscs=MingLiU_HKSCS
|
||||
allfonts.chinese-ms950-extb=MingLiU-ExtB
|
||||
allfonts.devanagari=Mangal
|
||||
allfonts.kannada=Tunga
|
||||
allfonts.myanmar=Myanmar Text
|
||||
allfonts.dingbats=Wingdings
|
||||
allfonts.symbol=Symbol
|
||||
allfonts.symbols=Segoe UI Symbol
|
||||
allfonts.thai=Tahoma
|
||||
allfonts.thai=DokChampa
|
||||
allfonts.georgian=Sylfaen
|
||||
|
||||
serif.plain.alphabetic=Times New Roman
|
||||
@@ -50,140 +49,140 @@ serif.plain.chinese-ms950=MingLiU
|
||||
serif.plain.chinese-ms950-extb=MingLiU-ExtB
|
||||
serif.plain.hebrew=David
|
||||
serif.plain.japanese=MS Mincho
|
||||
serif.plain.korean=Malgun Gothic
|
||||
serif.plain.korean=Batang
|
||||
|
||||
serif.bold.alphabetic=Times New Roman Bold
|
||||
serif.bold.chinese-ms950=PMingLiU
|
||||
serif.bold.chinese-ms950-extb=PMingLiU-ExtB
|
||||
serif.bold.hebrew=David Bold
|
||||
serif.bold.japanese=MS Mincho
|
||||
serif.bold.korean=Malgun Gothic
|
||||
serif.bold.korean=Batang
|
||||
|
||||
serif.italic.alphabetic=Times New Roman Italic
|
||||
serif.italic.chinese-ms950=PMingLiU
|
||||
serif.italic.chinese-ms950-extb=PMingLiU-ExtB
|
||||
serif.italic.hebrew=David
|
||||
serif.italic.japanese=MS Mincho
|
||||
serif.italic.korean=Malgun Gothic
|
||||
serif.italic.korean=Batang
|
||||
|
||||
serif.bolditalic.alphabetic=Times New Roman Bold Italic
|
||||
serif.bolditalic.chinese-ms950=PMingLiU
|
||||
serif.bolditalic.chinese-ms950-extb=PMingLiU-ExtB
|
||||
serif.bolditalic.hebrew=David Bold
|
||||
serif.bolditalic.japanese=MS Mincho
|
||||
serif.bolditalic.korean=Malgun Gothic
|
||||
serif.bolditalic.korean=Batang
|
||||
|
||||
sansserif.plain.alphabetic=Arial
|
||||
sansserif.plain.chinese-ms950=MingLiU
|
||||
sansserif.plain.chinese-ms950-extb=MingLiU-ExtB
|
||||
sansserif.plain.hebrew=David
|
||||
sansserif.plain.japanese=MS Gothic
|
||||
sansserif.plain.korean=Malgun Gothic
|
||||
sansserif.plain.korean=Gulim
|
||||
|
||||
sansserif.bold.alphabetic=Arial Bold
|
||||
sansserif.bold.chinese-ms950=PMingLiU
|
||||
sansserif.bold.chinese-ms950-extb=PMingLiU-ExtB
|
||||
sansserif.bold.hebrew=David Bold
|
||||
sansserif.bold.japanese=MS Gothic
|
||||
sansserif.bold.korean=Malgun Gothic
|
||||
sansserif.bold.korean=Gulim
|
||||
|
||||
sansserif.italic.alphabetic=Arial Italic
|
||||
sansserif.italic.chinese-ms950=PMingLiU
|
||||
sansserif.italic.chinese-ms950-extb=PMingLiU-ExtB
|
||||
sansserif.italic.hebrew=David
|
||||
sansserif.italic.japanese=MS Gothic
|
||||
sansserif.italic.korean=Malgun Gothic
|
||||
sansserif.italic.korean=Gulim
|
||||
|
||||
sansserif.bolditalic.alphabetic=Arial Bold Italic
|
||||
sansserif.bolditalic.chinese-ms950=PMingLiU
|
||||
sansserif.bolditalic.chinese-ms950-extb=PMingLiU-ExtB
|
||||
sansserif.bolditalic.hebrew=David Bold
|
||||
sansserif.bolditalic.japanese=MS Gothic
|
||||
sansserif.bolditalic.korean=Malgun Gothic
|
||||
sansserif.bolditalic.korean=Gulim
|
||||
|
||||
monospaced.plain.alphabetic=Courier New
|
||||
monospaced.plain.chinese-ms950=MingLiU
|
||||
monospaced.plain.chinese-ms950-extb=MingLiU-ExtB
|
||||
monospaced.plain.hebrew=Courier New
|
||||
monospaced.plain.japanese=MS Gothic
|
||||
monospaced.plain.korean=Malgun Gothic
|
||||
monospaced.plain.korean=GulimChe
|
||||
|
||||
monospaced.bold.alphabetic=Courier New Bold
|
||||
monospaced.bold.chinese-ms950=PMingLiU
|
||||
monospaced.bold.chinese-ms950-extb=PMingLiU-ExtB
|
||||
monospaced.bold.hebrew=Courier New Bold
|
||||
monospaced.bold.japanese=MS Gothic
|
||||
monospaced.bold.korean=Malgun Gothic
|
||||
monospaced.bold.korean=GulimChe
|
||||
|
||||
monospaced.italic.alphabetic=Courier New Italic
|
||||
monospaced.italic.chinese-ms950=PMingLiU
|
||||
monospaced.italic.chinese-ms950-extb=PMingLiU-ExtB
|
||||
monospaced.italic.hebrew=Courier New
|
||||
monospaced.italic.japanese=MS Gothic
|
||||
monospaced.italic.korean=Malgun Gothic
|
||||
monospaced.italic.korean=GulimChe
|
||||
|
||||
monospaced.bolditalic.alphabetic=Courier New Bold Italic
|
||||
monospaced.bolditalic.chinese-ms950=PMingLiU
|
||||
monospaced.bolditalic.chinese-ms950-extb=PMingLiU-ExtB
|
||||
monospaced.bolditalic.hebrew=Courier New Bold
|
||||
monospaced.bolditalic.japanese=MS Gothic
|
||||
monospaced.bolditalic.korean=Malgun Gothic
|
||||
monospaced.bolditalic.korean=GulimChe
|
||||
|
||||
dialog.plain.alphabetic=Arial
|
||||
dialog.plain.chinese-ms950=MingLiU
|
||||
dialog.plain.chinese-ms950-extb=MingLiU-ExtB
|
||||
dialog.plain.hebrew=David
|
||||
dialog.plain.japanese=MS Gothic
|
||||
dialog.plain.korean=Malgun Gothic
|
||||
dialog.plain.korean=Gulim
|
||||
|
||||
dialog.bold.alphabetic=Arial Bold
|
||||
dialog.bold.chinese-ms950=PMingLiU
|
||||
dialog.bold.chinese-ms950-extb=PMingLiU-ExtB
|
||||
dialog.bold.hebrew=David Bold
|
||||
dialog.bold.japanese=MS Gothic
|
||||
dialog.bold.korean=Malgun Gothic
|
||||
dialog.bold.korean=Gulim
|
||||
|
||||
dialog.italic.alphabetic=Arial Italic
|
||||
dialog.italic.chinese-ms950=PMingLiU
|
||||
dialog.italic.chinese-ms950-extb=PMingLiU-ExtB
|
||||
dialog.italic.hebrew=David
|
||||
dialog.italic.japanese=MS Gothic
|
||||
dialog.italic.korean=Malgun Gothic
|
||||
dialog.italic.korean=Gulim
|
||||
|
||||
dialog.bolditalic.alphabetic=Arial Bold Italic
|
||||
dialog.bolditalic.chinese-ms950=PMingLiU
|
||||
dialog.bolditalic.chinese-ms950-extb=PMingLiU-ExtB
|
||||
dialog.bolditalic.hebrew=David Bold
|
||||
dialog.bolditalic.japanese=MS Gothic
|
||||
dialog.bolditalic.korean=Malgun Gothic
|
||||
dialog.bolditalic.korean=Gulim
|
||||
|
||||
dialoginput.plain.alphabetic=Courier New
|
||||
dialoginput.plain.chinese-ms950=MingLiU
|
||||
dialoginput.plain.chinese-ms950-extb=MingLiU-ExtB
|
||||
dialoginput.plain.hebrew=David
|
||||
dialoginput.plain.japanese=MS Gothic
|
||||
dialoginput.plain.korean=Malgun Gothic
|
||||
dialoginput.plain.korean=Gulim
|
||||
|
||||
dialoginput.bold.alphabetic=Courier New Bold
|
||||
dialoginput.bold.chinese-ms950=PMingLiU
|
||||
dialoginput.bold.chinese-ms950-extb=PMingLiU-ExtB
|
||||
dialoginput.bold.hebrew=David Bold
|
||||
dialoginput.bold.japanese=MS Gothic
|
||||
dialoginput.bold.korean=Malgun Gothic
|
||||
dialoginput.bold.korean=Gulim
|
||||
|
||||
dialoginput.italic.alphabetic=Courier New Italic
|
||||
dialoginput.italic.chinese-ms950=PMingLiU
|
||||
dialoginput.italic.chinese-ms950-extb=PMingLiU-ExtB
|
||||
dialoginput.italic.hebrew=David
|
||||
dialoginput.italic.japanese=MS Gothic
|
||||
dialoginput.italic.korean=Malgun Gothic
|
||||
dialoginput.italic.korean=Gulim
|
||||
|
||||
dialoginput.bolditalic.alphabetic=Courier New Bold Italic
|
||||
dialoginput.bolditalic.chinese-ms950=PMingLiU
|
||||
dialoginput.bolditalic.chinese-ms950-extb=PMingLiU-ExtB
|
||||
dialoginput.bolditalic.hebrew=David Bold
|
||||
dialoginput.bolditalic.japanese=MS Gothic
|
||||
dialoginput.bolditalic.korean=Malgun Gothic
|
||||
dialoginput.bolditalic.korean=Gulim
|
||||
|
||||
# Search Sequences
|
||||
|
||||
@@ -240,8 +239,7 @@ sequence.allfonts.x-windows-874=alphabetic,thai,dingbats,symbol
|
||||
|
||||
sequence.fallback=symbols,\
|
||||
chinese-ms950,chinese-hkscs,chinese-ms936,chinese-gb18030,\
|
||||
japanese,korean,chinese-ms950-extb,chinese-ms936-extb,\
|
||||
georgian,kannada,thai,myanmar
|
||||
japanese,korean,chinese-ms950-extb,chinese-ms936-extb,georgian,kannada
|
||||
|
||||
# Exclusion Ranges
|
||||
|
||||
@@ -291,11 +289,13 @@ filename.MS_PMincho=MSMINCHO.TTC
|
||||
filename.MS_Gothic=MSGOTHIC.TTC
|
||||
filename.MS_PGothic=MSGOTHIC.TTC
|
||||
|
||||
filename.Malgun_Gothic=malgun.ttf
|
||||
filename.Tahoma=tahoma.ttf
|
||||
filename.Gulim=gulim.TTC
|
||||
filename.Batang=batang.TTC
|
||||
filename.GulimChe=gulim.TTC
|
||||
|
||||
filename.DokChampa=dokchamp.ttf
|
||||
filename.Mangal=MANGAL.TTF
|
||||
filename.Tunga=TUNGA.TTF
|
||||
filename.Myanmar_Text=mmrtext.ttf
|
||||
filename.Symbol=SYMBOL.TTF
|
||||
filename.Wingdings=WINGDING.TTF
|
||||
|
||||
|
||||
@@ -272,14 +272,12 @@ XEvent.xclient 0
|
||||
XEvent.xcolormap 0
|
||||
XEvent.xconfigure 0
|
||||
XEvent.xconfigurerequest 0
|
||||
XEvent.xcookie 0
|
||||
XEvent.xcreatewindow 0
|
||||
XEvent.xcrossing 0
|
||||
XEvent.xdestroywindow 0
|
||||
XEvent.xerror 0
|
||||
XEvent.xexpose 0
|
||||
XEvent.xfocus 0
|
||||
XEvent.xgeneric 0
|
||||
XEvent.xgraphicsexpose 0
|
||||
XEvent.xgravity 0
|
||||
XEvent.xkey 0
|
||||
@@ -372,22 +370,6 @@ XGCValues.subwindow_mode 96
|
||||
XGCValues.tile 64
|
||||
XGCValues.ts_x_origin 80
|
||||
XGCValues.ts_y_origin 84
|
||||
XGenericEvent 40
|
||||
XGenericEventCookie 56
|
||||
XGenericEventCookie.cookie 40
|
||||
XGenericEventCookie.data 48
|
||||
XGenericEventCookie.display 24
|
||||
XGenericEventCookie.evtype 36
|
||||
XGenericEventCookie.extension 32
|
||||
XGenericEventCookie.send_event 16
|
||||
XGenericEventCookie.serial 8
|
||||
XGenericEventCookie.type 0
|
||||
XGenericEvent.display 24
|
||||
XGenericEvent.evtype 36
|
||||
XGenericEvent.extension 32
|
||||
XGenericEvent.send_event 16
|
||||
XGenericEvent.serial 8
|
||||
XGenericEvent.type 0
|
||||
XGraphicsExposeEvent 72
|
||||
XGraphicsExposeEvent.count 56
|
||||
XGraphicsExposeEvent.display 24
|
||||
@@ -414,9 +396,6 @@ XHostAddress 16
|
||||
XHostAddress.address 8
|
||||
XHostAddress.family 0
|
||||
XHostAddress.length 4
|
||||
XIButtonState 16
|
||||
XIButtonState.mask 8
|
||||
XIButtonState.mask_len 0
|
||||
XIconSize 24
|
||||
XIconSize.height_inc 20
|
||||
XIconSize.max_height 12
|
||||
@@ -424,29 +403,6 @@ XIconSize.max_width 8
|
||||
XIconSize.min_height 4
|
||||
XIconSize.min_width 0
|
||||
XIconSize.width_inc 16
|
||||
XIDeviceEvent 200
|
||||
XIDeviceEvent.buttons 128
|
||||
XIDeviceEvent.child 80
|
||||
XIDeviceEvent.detail 56
|
||||
XIDeviceEvent.deviceid 48
|
||||
XIDeviceEvent.display 24
|
||||
XIDeviceEvent.event 72
|
||||
XIDeviceEvent.event_x 104
|
||||
XIDeviceEvent.event_y 112
|
||||
XIDeviceEvent.evtype 36
|
||||
XIDeviceEvent.extension 32
|
||||
XIDeviceEvent.flags 120
|
||||
XIDeviceEvent.group 184
|
||||
XIDeviceEvent.mods 168
|
||||
XIDeviceEvent.root 64
|
||||
XIDeviceEvent.root_x 88
|
||||
XIDeviceEvent.root_y 96
|
||||
XIDeviceEvent.send_event 16
|
||||
XIDeviceEvent.serial 8
|
||||
XIDeviceEvent.sourceid 52
|
||||
XIDeviceEvent.time 40
|
||||
XIDeviceEvent.type 0
|
||||
XIDeviceEvent.valuators 144
|
||||
XImage 136
|
||||
XImage.bitmap_bit_order 32
|
||||
XImage.bitmap_pad 36
|
||||
@@ -480,11 +436,6 @@ XIMHotKeyTrigger.modifier_mask 12
|
||||
XIMHotKeyTriggers 16
|
||||
XIMHotKeyTriggers.key 8
|
||||
XIMHotKeyTriggers.num_hot_key 0
|
||||
XIModifierState 16
|
||||
XIModifierState.base 0
|
||||
XIModifierState.effective 12
|
||||
XIModifierState.latched 4
|
||||
XIModifierState.locked 8
|
||||
XIMPreeditCaretCallbackStruct 12
|
||||
XIMPreeditCaretCallbackStruct.direction 4
|
||||
XIMPreeditCaretCallbackStruct.position 0
|
||||
@@ -521,10 +472,6 @@ XIMText.string 24
|
||||
XIMValuesList 16
|
||||
XIMValuesList.count_values 0
|
||||
XIMValuesList.supported_values 8
|
||||
XIValuatorState 24
|
||||
XIValuatorState.mask 8
|
||||
XIValuatorState.mask_len 0
|
||||
XIValuatorState.values 16
|
||||
XkbAccessXNotifyEvent 64
|
||||
XkbAccessXNotifyEvent.debounce_delay 60
|
||||
XkbAccessXNotifyEvent.detail 48
|
||||
|
||||
@@ -127,22 +127,6 @@ XKeymapEvent
|
||||
display long
|
||||
window long
|
||||
key_vector array byte 32
|
||||
XGenericEvent
|
||||
type int
|
||||
serial long
|
||||
send_event Bool
|
||||
display long
|
||||
extension int
|
||||
evtype int
|
||||
XGenericEventCookie
|
||||
type int
|
||||
serial long
|
||||
send_event Bool
|
||||
display long
|
||||
extension int
|
||||
evtype int
|
||||
cookie int
|
||||
data pointer
|
||||
XDestroyWindowEvent
|
||||
type int
|
||||
serial long
|
||||
@@ -830,8 +814,6 @@ XEvent
|
||||
xmapping struct XMappingEvent
|
||||
xerror struct XErrorEvent
|
||||
xkeymap struct XKeymapEvent
|
||||
xgeneric struct XGenericEvent
|
||||
xcookie struct XGenericEventCookie
|
||||
pad array long 24
|
||||
|
||||
XkbAnyEvent
|
||||
@@ -1057,42 +1039,3 @@ XkbEvent
|
||||
accessx struct XkbAccessXNotifyEvent
|
||||
device struct XkbExtensionDeviceNotifyEvent
|
||||
core struct XEvent
|
||||
|
||||
XIButtonState
|
||||
mask_len int
|
||||
mask pointer byte
|
||||
|
||||
XIValuatorState
|
||||
mask_len int
|
||||
mask pointer byte
|
||||
values pointer double
|
||||
|
||||
XIModifierState
|
||||
base int
|
||||
latched int
|
||||
locked int
|
||||
effective int
|
||||
|
||||
XIDeviceEvent
|
||||
type int
|
||||
serial long
|
||||
send_event Bool
|
||||
display long
|
||||
extension int
|
||||
evtype int
|
||||
time ulong
|
||||
deviceid int
|
||||
sourceid int
|
||||
detail int
|
||||
root long
|
||||
event long
|
||||
child long
|
||||
root_x double
|
||||
root_y double
|
||||
event_x double
|
||||
event_y double
|
||||
flags int
|
||||
buttons struct XIButtonState
|
||||
valuators struct XIValuatorState
|
||||
mods struct XIModifierState
|
||||
group struct XIModifierState
|
||||
|
||||
@@ -1142,8 +1142,6 @@ public class WrapperGenerator {
|
||||
pw.println("/* This file is an automatically generated file, please do not edit this file, modify the XlibParser.java file instead !*/\n" );
|
||||
pw.println("#include <X11/Xlib.h>\n#include <X11/Xutil.h>\n#include <X11/Xos.h>\n#include <X11/Xatom.h>\n#include <stdio.h>\n");
|
||||
pw.println("#include <X11/extensions/Xdbe.h>");
|
||||
pw.println("#include <X11/extensions/XI2.h>");
|
||||
pw.println("#include <X11/extensions/XInput2.h>");
|
||||
pw.println("#include <X11/XKBlib.h>");
|
||||
pw.println("#include \"awt_p.h\"");
|
||||
pw.println("#include \"color.h\"");
|
||||
|
||||
@@ -28,7 +28,6 @@ package com.apple.eawt;
|
||||
import java.awt.*;
|
||||
import java.awt.peer.*;
|
||||
import java.beans.Beans;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import javax.swing.JMenuBar;
|
||||
|
||||
@@ -396,23 +395,11 @@ public class Application {
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
public void requestToggleFullScreen(final Window window) {
|
||||
invokeOnPlatformWindow(window, pw -> pw.toggleFullScreen());
|
||||
}
|
||||
|
||||
public void requestEnterFullScreen(final Window window) {
|
||||
invokeOnPlatformWindow(window, pw -> pw.enterFullScreen());
|
||||
}
|
||||
|
||||
public void requestLeaveFullScreen(final Window window) {
|
||||
invokeOnPlatformWindow(window, pw -> pw.leaveFullScreen());
|
||||
}
|
||||
|
||||
private void invokeOnPlatformWindow (final Window window, Consumer<CPlatformWindow> consumer) {
|
||||
final Object peer = AWTAccessor.getComponentAccessor().getPeer(window);
|
||||
if (!(peer instanceof LWWindowPeer)) return;
|
||||
Object platformWindow = ((LWWindowPeer) peer).getPlatformWindow();
|
||||
if (!(platformWindow instanceof CPlatformWindow)) return;
|
||||
consumer.accept((CPlatformWindow)platformWindow);
|
||||
((CPlatformWindow)platformWindow).toggleFullScreen();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -233,6 +233,7 @@ public class LWWindowPeer
|
||||
|
||||
setOpaque(getTarget().isOpaque());
|
||||
|
||||
updateInsets(platformWindow.getInsets());
|
||||
if (getSurfaceData() == null) {
|
||||
replaceSurfaceData(false);
|
||||
}
|
||||
@@ -309,7 +310,6 @@ public class LWWindowPeer
|
||||
}
|
||||
}
|
||||
}
|
||||
updateInsets(platformWindow.getInsets());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -534,21 +534,11 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
|
||||
}
|
||||
|
||||
private native void _toggleFullScreenMode(final long model);
|
||||
private native void _enterFullScreen(final long model);
|
||||
private native void _leaveFullScreen(final long model);
|
||||
|
||||
public void toggleFullScreen() {
|
||||
execute(this::_toggleFullScreenMode);
|
||||
}
|
||||
|
||||
public void enterFullScreen() {
|
||||
execute(this::_enterFullScreen);
|
||||
}
|
||||
|
||||
public void leaveFullScreen() {
|
||||
execute(this::_leaveFullScreen);
|
||||
}
|
||||
|
||||
@Override // PlatformWindow
|
||||
public void setMenuBar(MenuBar mb) {
|
||||
CMenuBar mbPeer = (CMenuBar)LWToolkit.targetToPeer(mb);
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
#import <JavaRuntimeSupport/JavaRuntimeSupport.h>
|
||||
#import <Carbon/Carbon.h>
|
||||
|
||||
#import "jni_util.h"
|
||||
#import "ThreadUtilities.h"
|
||||
#import "AWTView.h"
|
||||
#import "AWTWindow.h"
|
||||
@@ -443,6 +444,28 @@ extern bool isSystemShortcut_NextWindowInApplication(NSUInteger modifiersMask, N
|
||||
[AWTToolkit scrollStateWithEvent: event]);
|
||||
CHECK_NULL(jEvent);
|
||||
|
||||
AWTWindow *awtWindow = (AWTWindow*)[event window];
|
||||
|
||||
if (![AWTWindow isAWTWindow: awtWindow]) {
|
||||
NSLog(@"awt Window is not an AWTWindow instance");
|
||||
return;
|
||||
}
|
||||
|
||||
AWTWindow* aDelegate = (AWTWindow*)[awtWindow delegate];
|
||||
|
||||
jobject platformWindow = [aDelegate.javaPlatformWindow jObjectWithEnv:env];
|
||||
|
||||
if (platformWindow == nil) {
|
||||
NSLog(@"Platform window is nil");
|
||||
return;
|
||||
}
|
||||
|
||||
static JNF_CLASS_CACHE(jc_PlatformWindow, "sun/lwawt/macosx/CPlatformWindow");
|
||||
|
||||
if (!JNFIsInstanceOf(env, platformWindow, &jc_PlatformWindow)) {
|
||||
NSLog(@"Platform window is not an instance of CPlatformWindow");
|
||||
}
|
||||
|
||||
static JNF_CLASS_CACHE(jc_PlatformView, "sun/lwawt/macosx/CPlatformView");
|
||||
static JNF_MEMBER_CACHE(jm_deliverMouseEvent, jc_PlatformView, "deliverMouseEvent", "(Lsun/lwawt/macosx/NSEvent;)V");
|
||||
jobject jlocal = (*env)->NewLocalRef(env, m_cPlatformView);
|
||||
|
||||
@@ -1490,55 +1490,7 @@ JNF_COCOA_ENTER(env);
|
||||
if (![nsWindow respondsToSelector:toggleFullScreenSelector]) return;
|
||||
|
||||
[ThreadUtilities performOnMainThreadWaiting:NO block:^(){
|
||||
if ((([nsWindow styleMask] & NSFullScreenWindowMask) != NSFullScreenWindowMask)) {
|
||||
[nsWindow performSelector:toggleFullScreenSelector withObject:nil];
|
||||
}
|
||||
}];
|
||||
|
||||
JNF_COCOA_EXIT(env);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: sun_lwawt_macosx_CPlatformWindow
|
||||
* Method: _toggleFullScreenMode
|
||||
* Signature: (J)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_sun_lwawt_macosx_CPlatformWindow__1enterFullScreen
|
||||
(JNIEnv *env, jobject peer, jlong windowPtr)
|
||||
{
|
||||
JNF_COCOA_ENTER(env);
|
||||
|
||||
NSWindow *nsWindow = OBJC(windowPtr);
|
||||
SEL toggleFullScreenSelector = @selector(toggleFullScreen:);
|
||||
if (![nsWindow respondsToSelector:toggleFullScreenSelector]) return;
|
||||
|
||||
[ThreadUtilities performOnMainThreadWaiting:NO block:^(){
|
||||
if ((([nsWindow styleMask] & NSFullScreenWindowMask) != NSFullScreenWindowMask)) {
|
||||
[nsWindow performSelector:toggleFullScreenSelector withObject:nil];
|
||||
}
|
||||
}];
|
||||
|
||||
JNF_COCOA_EXIT(env);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: sun_lwawt_macosx_CPlatformWindow
|
||||
* Method: _toggleFullScreenMode
|
||||
* Signature: (J)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_sun_lwawt_macosx_CPlatformWindow__1leaveFullScreen
|
||||
(JNIEnv *env, jobject peer, jlong windowPtr)
|
||||
{
|
||||
JNF_COCOA_ENTER(env);
|
||||
|
||||
NSWindow *nsWindow = OBJC(windowPtr);
|
||||
SEL toggleFullScreenSelector = @selector(toggleFullScreen:);
|
||||
if (![nsWindow respondsToSelector:toggleFullScreenSelector]) return;
|
||||
|
||||
[ThreadUtilities performOnMainThreadWaiting:NO block:^(){
|
||||
if ((([nsWindow styleMask] & NSFullScreenWindowMask) == NSFullScreenWindowMask)) {
|
||||
[nsWindow performSelector:toggleFullScreenSelector withObject:nil];
|
||||
}
|
||||
[nsWindow performSelector:toggleFullScreenSelector withObject:nil];
|
||||
}];
|
||||
|
||||
JNF_COCOA_EXIT(env);
|
||||
|
||||
@@ -40,8 +40,6 @@ extern int gNumberOfButtons;
|
||||
// InputEvent mask array
|
||||
extern jint* gButtonDownMasks;
|
||||
|
||||
extern int lcdSubPixelPosSupported;
|
||||
|
||||
@interface AWTToolkit : NSObject { }
|
||||
+ (long) getEventCount;
|
||||
+ (void) eventCountPlusPlus;
|
||||
@@ -61,17 +59,8 @@ extern int lcdSubPixelPosSupported;
|
||||
#define kCFCoreFoundationVersionNumber10_13_Max 1499
|
||||
#endif
|
||||
|
||||
#ifndef kCFCoreFoundationVersionNumber10_14_Max
|
||||
#define kCFCoreFoundationVersionNumber10_14_Max 1599
|
||||
#endif
|
||||
|
||||
#ifndef IS_OSX_GT10_13
|
||||
#define IS_OSX_GT10_13 (floor(kCFCoreFoundationVersionNumber) > \
|
||||
kCFCoreFoundationVersionNumber10_13_Max)
|
||||
#endif
|
||||
|
||||
#ifndef IS_OSX_GT10_14
|
||||
#define IS_OSX_GT10_14 (floor(kCFCoreFoundationVersionNumber) > \
|
||||
kCFCoreFoundationVersionNumber10_14_Max)
|
||||
#endif
|
||||
|
||||
|
||||
@@ -52,7 +52,6 @@
|
||||
|
||||
int gNumberOfButtons;
|
||||
jint* gButtonDownMasks;
|
||||
int lcdSubPixelPosSupported;
|
||||
|
||||
// Indicates that the app has been started with -XstartOnFirstThread
|
||||
// (directly or via WebStart settings), and AWT should not run its
|
||||
|
||||
@@ -31,7 +31,6 @@
|
||||
#import "CGGlyphOutlines.h"
|
||||
#import "CoreTextSupport.h"
|
||||
#include "fontscalerdefs.h"
|
||||
#import "LWCToolkit.h"
|
||||
|
||||
/* Use THIS_FILE when it is available. */
|
||||
#ifndef THIS_FILE
|
||||
@@ -162,7 +161,7 @@ JNF_COCOA_ENTER(env);
|
||||
CGGlyph glyph;
|
||||
const CTFontRef fallback = CTS_CopyCTFallbackFontAndGlyphForJavaGlyphCode(awtFont, glyphCode, &glyph);
|
||||
const CGFontRef cgFallback = CTFontCopyGraphicsFont(fallback, NULL);
|
||||
if (IS_OSX_GT10_14 || CGGI_IsColorFont(cgFallback)) {
|
||||
if (CGGI_IsColorFont(cgFallback)) {
|
||||
CGAffineTransform matrix = awtStrike->fAltTx;
|
||||
CGFloat fontSize = sqrt(fabs(matrix.a * matrix.d - matrix.b * matrix.c));
|
||||
CTFontRef font = CTFontCreateWithGraphicsFont(cgFallback, fontSize, NULL, NULL);
|
||||
|
||||
@@ -31,7 +31,6 @@
|
||||
#import "fontscalerdefs.h" // contains the definition of GlyphInfo struct
|
||||
|
||||
#import "sun_awt_SunHints.h"
|
||||
#import "LWCToolkit.h"
|
||||
|
||||
//#define USE_IMAGE_ALIGNED_MEMORY 1
|
||||
//#define CGGI_DEBUG 1
|
||||
@@ -629,8 +628,7 @@ CGGI_CreateNewGlyphInfoFrom(CGSize advance, CGRect bbox,
|
||||
static inline void
|
||||
CGGI_CreateImageForGlyph
|
||||
(CGFontRef cgFont, CGGI_GlyphCanvas *canvas, const CGGlyph glyph,
|
||||
GlyphInfo *info, const CGGI_GlyphInfoDescriptor *glyphDescriptor, const AWTStrike *strike,
|
||||
const bool isCatalinaOrAbove)
|
||||
GlyphInfo *info, const CGGI_GlyphInfoDescriptor *glyphDescriptor, const AWTStrike *strike)
|
||||
{
|
||||
if (isnan(info->topLeftX) || isnan(info->topLeftY)) {
|
||||
// Explicitly set glyphInfo width/height to be 0 to ensure
|
||||
@@ -650,7 +648,7 @@ CGGI_CreateImageForGlyph
|
||||
CGFloat x = -info->topLeftX;
|
||||
CGFloat y = canvas->image->height + info->topLeftY;
|
||||
|
||||
if (isCatalinaOrAbove || glyphDescriptor == &argb) {
|
||||
if (glyphDescriptor == &argb) {
|
||||
CGAffineTransform matrix = CGContextGetTextMatrix(canvas->context);
|
||||
CGFloat fontSize = sqrt(fabs(matrix.a * matrix.d - matrix.b * matrix.c));
|
||||
CTFontRef font = CTFontCreateWithGraphicsFont(cgFont, fontSize, NULL, NULL);
|
||||
@@ -694,8 +692,7 @@ CGGI_CreateImageForGlyph
|
||||
static inline GlyphInfo *
|
||||
CGGI_CreateImageForUnicode
|
||||
(CGGI_GlyphCanvas *canvas, const AWTStrike *strike,
|
||||
const CGGI_RenderingMode *mode, const UnicodeScalarValue uniChar,
|
||||
const bool isCatalinaOrAbove)
|
||||
const CGGI_RenderingMode *mode, const UnicodeScalarValue uniChar)
|
||||
{
|
||||
// save the state of the world
|
||||
CGContextSaveGState(canvas->context);
|
||||
@@ -740,7 +737,7 @@ CGGI_CreateImageForUnicode
|
||||
CFRelease(cgFallback);
|
||||
|
||||
// clean the canvas - align, strike, and copy the glyph from the canvas into the info
|
||||
CGGI_CreateImageForGlyph(cgFallback, canvas, glyph, info, glyphDescriptor, strike, isCatalinaOrAbove);
|
||||
CGGI_CreateImageForGlyph(cgFallback, canvas, glyph, info, glyphDescriptor, strike);
|
||||
|
||||
// restore the state of the world
|
||||
CGContextRestoreGState(canvas->context);
|
||||
@@ -785,15 +782,14 @@ CGGI_FillImagesForGlyphsWithSizedCanvas(CGGI_GlyphCanvas *canvas,
|
||||
|
||||
CGGI_GlyphInfoDescriptor* mainFontDescriptor = CGGI_GetGlyphInfoDescriptor(mode, strike->fAWTFont->fNativeCGFont);
|
||||
|
||||
const bool isCatalinaOrAbove = IS_OSX_GT10_14;
|
||||
CFIndex i;
|
||||
for (i = 0; i < len; i++) {
|
||||
GlyphInfo *info = (GlyphInfo *)jlong_to_ptr(glyphInfos[i]);
|
||||
if (info != NULL) {
|
||||
CGGI_CreateImageForGlyph(strike->fAWTFont->fNativeCGFont,
|
||||
canvas, glyphs[i], info, mainFontDescriptor, strike, isCatalinaOrAbove);
|
||||
canvas, glyphs[i], info, mainFontDescriptor, strike);
|
||||
} else {
|
||||
info = CGGI_CreateImageForUnicode(canvas, strike, mode, uniChars[i], isCatalinaOrAbove);
|
||||
info = CGGI_CreateImageForUnicode(canvas, strike, mode, uniChars[i]);
|
||||
glyphInfos[i] = ptr_to_jlong(info);
|
||||
}
|
||||
#ifdef CGGI_DEBUG
|
||||
|
||||
@@ -337,7 +337,7 @@ Java_sun_java2d_opengl_CGLGraphicsConfig_getCGLConfigInfo
|
||||
CFPreferencesGetAppBooleanValue(
|
||||
CFSTR("CGFontRenderingFontSmoothingDisabled"),
|
||||
kCFPreferencesCurrentApplication, &status);
|
||||
lcdSubPixelPosSupported = YES;
|
||||
|
||||
if (status) {
|
||||
if (fontSmoothingDisabled) {
|
||||
J2dRlsTraceLn(J2D_TRACE_INFO,
|
||||
@@ -355,7 +355,7 @@ Java_sun_java2d_opengl_CGLGraphicsConfig_getCGLConfigInfo
|
||||
if (!status) {
|
||||
smoothFonts = YES;
|
||||
}
|
||||
lcdSubPixelPosSupported = !smoothFonts;
|
||||
|
||||
if (!smoothFonts) {
|
||||
J2dRlsTraceLn(J2D_TRACE_INFO,
|
||||
"LCD_SHADER: disabled on macOS 10.14+ by default");
|
||||
|
||||
@@ -7214,13 +7214,6 @@ public abstract class Component implements ImageObserver, MenuContainer,
|
||||
: 0));
|
||||
dispatchEvent(e);
|
||||
}
|
||||
|
||||
Window window = getContainingWindow();
|
||||
// window is supposed to be not a null value (addNotify)
|
||||
Component mostRecentFocusOwner = KeyboardFocusManager.getMostRecentFocusOwner(window);
|
||||
if (mostRecentFocusOwner != this) {
|
||||
requestFocusInWindow();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2008, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2008, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@@ -269,10 +269,9 @@ public final class FontUtilities {
|
||||
else if (code < 0x0f00) {
|
||||
return false;
|
||||
}
|
||||
else if (code <= 0x0fff) { // U+0F00 - U+0FFF Tibetan
|
||||
return true;
|
||||
}
|
||||
else if (code < 0x10A0) { // U+1000 - U+109F Myanmar
|
||||
else if (code <= 0x109f) {
|
||||
// U+0F00 - U+0FFF Tibetan
|
||||
// U+1000 - U+109F Myanmar
|
||||
return true;
|
||||
}
|
||||
else if (code < 0x1100) {
|
||||
|
||||
@@ -51,25 +51,17 @@ class FreetypeFontScaler extends FontScaler {
|
||||
and therefore no need to load it explicitly here */
|
||||
FontManagerNativeLibrary.load();
|
||||
|
||||
String fontConfName = java.security.AccessController.doPrivileged(
|
||||
(PrivilegedAction<String>) () -> {
|
||||
if ("true".equals(System.getProperty(
|
||||
"java2d.font.loadFontConf", ""))) {
|
||||
File f = new File(System.getProperty("user.home", "") +
|
||||
File.separator + ".fonts.conf");
|
||||
|
||||
if (!f.exists()) {
|
||||
f = new File(System.getProperty("java.home", "") +
|
||||
File.separator + "lib" + File.separator +
|
||||
"fonts" + File.separator + "font.conf");
|
||||
}
|
||||
return f.getAbsolutePath();
|
||||
}
|
||||
return null;
|
||||
});
|
||||
String jreFontConfName = java.security.AccessController.doPrivileged(
|
||||
(PrivilegedAction<String>) () ->
|
||||
"true".equals(System.getProperty(
|
||||
"java2d.font.loadFontConf", "")) ?
|
||||
System.getProperty("java.home", "") +
|
||||
File.separator + "lib" + File.separator +
|
||||
"fonts" + File.separator + "font.conf" :
|
||||
null);
|
||||
|
||||
initIDs(FreetypeFontScaler.class, Toolkit.class, PhysicalFont.class,
|
||||
fontConfName);
|
||||
jreFontConfName);
|
||||
}
|
||||
|
||||
private static native void initIDs(Class<?> FFS, Class<?> toolkitClass, Class<?> pfClass,
|
||||
|
||||
@@ -1252,7 +1252,8 @@ public class SwingUtilities2 {
|
||||
|
||||
GraphicsConfiguration gc = c.getGraphicsConfiguration();
|
||||
AffineTransform tx = (gc == null) ? null : gc.getDefaultTransform();
|
||||
if (tx == null && !GraphicsEnvironment.isHeadless()) {
|
||||
// [tav] workaround deadlock on MacOSX until fixed, JRE-226
|
||||
if (!FontUtilities.isMacOSX && tx == null && !GraphicsEnvironment.isHeadless()) {
|
||||
tx = GraphicsEnvironment
|
||||
.getLocalGraphicsEnvironment()
|
||||
.getDefaultScreenDevice()
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1027,10 +1027,6 @@ OGLTR_DrawColorGlyphNoCache(OGLContext *oglc, GlyphInfo *ginfo, jint x, jint y)
|
||||
return JNI_TRUE;
|
||||
}
|
||||
|
||||
// Control subpixel positioning for macOS 13+ grayscale glyphs
|
||||
#ifdef MACOSX
|
||||
extern int lcdSubPixelPosSupported;
|
||||
#endif
|
||||
|
||||
// see DrawGlyphList.c for more on this macro...
|
||||
#define FLOOR_ASSIGN(l, r) \
|
||||
@@ -1083,8 +1079,6 @@ OGLTR_DrawGlyphList(JNIEnv *env, OGLContext *oglc, OGLSDOps *dstOps,
|
||||
{
|
||||
dstTextureID = dstOps->textureID;
|
||||
}
|
||||
|
||||
subPixPos = lcdSubPixelPosSupported ? subPixPos : 0;
|
||||
#endif
|
||||
|
||||
for (glyphCounter = 0; glyphCounter < totalGlyphs; glyphCounter++) {
|
||||
|
||||
@@ -260,7 +260,7 @@ Java_sun_font_FreetypeFontScaler_initIDs(
|
||||
fcConfig = (*FcInitLoadConfigAndFontsPtr)();
|
||||
if (fcConfig != NULL && fontConf != NULL) {
|
||||
result = (*FcConfigParseAndLoadPtr)(fcConfig, (const FcChar8 *) fontConf, FcFalse);
|
||||
if (logFC) fprintf(stderr, "FC_LOG: FcConfigParseAndLoad(\"%s\") %d \n", fontConf, result);
|
||||
if (logFC) fprintf(stderr, "FC_LOG: FcConfigParseAndLoad %d \n", result);
|
||||
result = (*FcConfigSetCurrentPtr)(fcConfig);
|
||||
if (logFC) fprintf(stderr, "FC_LOG: FcConfigSetCurrent %d \n", result);
|
||||
}
|
||||
|
||||
@@ -374,20 +374,6 @@ class Native {
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* Access to C double data(eight bytes)
|
||||
*/
|
||||
static final int DOUBLE_SIZE = 8;
|
||||
static double getDouble(long ptr) { return unsafe.getDouble(ptr); }
|
||||
static double getDouble(long ptr, int index) { return getDouble(ptr + DOUBLE_SIZE * index); }
|
||||
/**
|
||||
* Stores to C double data(eight bytes)
|
||||
*/
|
||||
static void putDouble(long ptr, double data) { unsafe.putDouble(ptr, data); }
|
||||
static void putDouble(long ptr, int index, double data) {
|
||||
putDouble(ptr + index * DOUBLE_SIZE, data);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Access to C "unsigned long" date type, which is XID in X
|
||||
|
||||
@@ -55,9 +55,7 @@ public class XBaseWindow {
|
||||
VISIBLE = "visible", // whether it is visible by default
|
||||
SAVE_UNDER = "save under", // save content under this window
|
||||
BACKING_STORE = "backing store", // enables double buffering
|
||||
BIT_GRAVITY = "bit gravity", // copy old content on geometry change
|
||||
XI_EVENT_MASK = "xi event mask", // xi event mask, Long
|
||||
XI_DEVICE_ID = "xi device id"; // xi device id, Integer
|
||||
BIT_GRAVITY = "bit gravity"; // copy old content on geometry change
|
||||
private XCreateWindowParams delayedParams;
|
||||
|
||||
Set<Long> children = new HashSet<Long>();
|
||||
@@ -396,19 +394,6 @@ public class XBaseWindow {
|
||||
throw new IllegalStateException("Couldn't create window because of wrong parameters. Run with NOISY_AWT to see details");
|
||||
}
|
||||
XToolkit.addToWinMap(window, this);
|
||||
|
||||
Long xiEventMask = (Long) params.get(XI_EVENT_MASK);
|
||||
if (xiEventMask != null && XToolkit.isXInputEnabled()) {
|
||||
Integer xiDeviceId = (Integer) params.get(XI_DEVICE_ID);
|
||||
if (xiDeviceId == null) {
|
||||
xiDeviceId = XConstants.XIAllDevices;
|
||||
}
|
||||
|
||||
int status = XToolkit.XISelectEvents(XToolkit.getDisplay(), window, xiEventMask, xiDeviceId);
|
||||
if (status != XConstants.Success) {
|
||||
throw new IllegalStateException("Couldn't select XI events. Status: " + status);
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
xattr.dispose();
|
||||
}
|
||||
@@ -1080,10 +1065,6 @@ public class XBaseWindow {
|
||||
width = scaleDown(xe.get_width());
|
||||
height = scaleDown(xe.get_height());
|
||||
}
|
||||
|
||||
public void handleTouchEvent(XEvent xev) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks ButtonRelease released all Mouse buttons
|
||||
*/
|
||||
@@ -1123,12 +1104,6 @@ public class XBaseWindow {
|
||||
if (target == null || !isGrabbedEvent(ev, target)) {
|
||||
target = XToolkit.windowToXWindow(ev.get_xany().get_window());
|
||||
}
|
||||
|
||||
if (target == null && ev.get_type() == XConstants.GenericEvent &&
|
||||
XlibWrapper.XGetEventData(ev.get_xgeneric().get_display(), ev.pData)) {
|
||||
target = XToolkit.windowToXWindow(XToolkit.GetXIDeviceEvent(ev.get_xcookie()).get_event());
|
||||
}
|
||||
|
||||
if (target != null && target.checkInitialised()) {
|
||||
target.dispatchEvent(ev);
|
||||
}
|
||||
@@ -1195,17 +1170,6 @@ public class XBaseWindow {
|
||||
case XConstants.CreateNotify:
|
||||
handleCreateNotify(xev);
|
||||
break;
|
||||
case XConstants.GenericEvent:
|
||||
switch (xev.get_xgeneric().get_evtype()) {
|
||||
case XConstants.XI_TouchBegin:
|
||||
case XConstants.XI_TouchUpdate:
|
||||
case XConstants.XI_TouchEnd:
|
||||
handleTouchEvent(xev);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
protected boolean isEventDisabled(XEvent e) {
|
||||
|
||||
@@ -170,8 +170,7 @@ public final class XConstants {
|
||||
public static final int ColormapNotify = 32 ;
|
||||
public static final int ClientMessage = 33 ;
|
||||
public static final int MappingNotify = 34 ;
|
||||
public static final int GenericEvent = 35 ;
|
||||
public static final int LASTEvent = 36 ; /* must be bigger than any event # */
|
||||
public static final int LASTEvent = 35 ; /* must be bigger than any event # */
|
||||
|
||||
|
||||
/* Key masks. Used as modifiers to GrabButton and GrabKey, results of QueryPointer,
|
||||
@@ -675,70 +674,4 @@ public final class XConstants {
|
||||
public static final long XkbModifierMapMask = (1L<<2);
|
||||
public static final long XkbVirtualModsMask = (1L<<6); //server map
|
||||
|
||||
/* Fake device ID's for event selection */
|
||||
public static final int XIAllDevices = 0;
|
||||
public static final int XIAllMasterDevices = 1;
|
||||
|
||||
/* XI Event types */
|
||||
public static final int XI_DeviceChanged = 1;
|
||||
public static final int XI_KeyPress = 2;
|
||||
public static final int XI_KeyRelease = 3;
|
||||
public static final int XI_ButtonPress = 4;
|
||||
public static final int XI_ButtonRelease = 5;
|
||||
public static final int XI_Motion = 6;
|
||||
public static final int XI_Enter = 7;
|
||||
public static final int XI_Leave = 8;
|
||||
public static final int XI_FocusIn = 9;
|
||||
public static final int XI_FocusOut = 10;
|
||||
public static final int XI_HierarchyChanged = 11;
|
||||
public static final int XI_PropertyEvent = 12;
|
||||
public static final int XI_RawKeyPress = 13;
|
||||
public static final int XI_RawKeyRelease = 14;
|
||||
public static final int XI_RawButtonPress = 15;
|
||||
public static final int XI_RawButtonRelease = 16;
|
||||
public static final int XI_RawMotion = 17;
|
||||
public static final int XI_TouchBegin = 18;/* XI 2.2 */
|
||||
public static final int XI_TouchUpdate = 19;
|
||||
public static final int XI_TouchEnd = 20;
|
||||
public static final int XI_TouchOwnership = 21;
|
||||
public static final int XI_RawTouchBegin = 22;
|
||||
public static final int XI_RawTouchUpdate = 23;
|
||||
public static final int XI_RawTouchEnd = 24;
|
||||
public static final int XI_BarrierHit = 25;/* XI 2.3 */
|
||||
public static final int XI_BarrierLeave = 26;
|
||||
public static final int XI_LASTEVENT = XI_BarrierLeave;
|
||||
/* NOTE: XI2LASTEVENT in xserver/include/inputstr.h must be the same value
|
||||
* as XI_LASTEVENT if the server is supposed to handle masks etc. for this
|
||||
* type of event. */
|
||||
|
||||
/* Event masks.
|
||||
* Note: the protocol spec defines a mask to be of (1 << type). Clients are
|
||||
* free to create masks by bitshifting instead of using these defines.
|
||||
*/
|
||||
public static final long XI_DeviceChangedMask = 1L << XI_DeviceChanged;
|
||||
public static final long XI_KeyPressMask = 1L << XI_KeyPress;
|
||||
public static final long XI_KeyReleaseMask = 1L << XI_KeyRelease;
|
||||
public static final long XI_ButtonPressMask = 1L << XI_ButtonPress;
|
||||
public static final long XI_ButtonReleaseMask = 1L << XI_ButtonRelease;
|
||||
public static final long XI_MotionMask = 1L << XI_Motion;
|
||||
public static final long XI_EnterMask = 1L << XI_Enter;
|
||||
public static final long XI_LeaveMask = 1L << XI_Leave;
|
||||
public static final long XI_FocusInMask = 1L << XI_FocusIn;
|
||||
public static final long XI_FocusOutMask = 1L << XI_FocusOut;
|
||||
public static final long XI_HierarchyChangedMask = 1L << XI_HierarchyChanged;
|
||||
public static final long XI_PropertyEventMask = 1L << XI_PropertyEvent;
|
||||
public static final long XI_RawKeyPressMask = 1L << XI_RawKeyPress;
|
||||
public static final long XI_RawKeyReleaseMask = 1L << XI_RawKeyRelease;
|
||||
public static final long XI_RawButtonPressMask = 1L << XI_RawButtonPress;
|
||||
public static final long XI_RawButtonReleaseMask = 1L << XI_RawButtonRelease;
|
||||
public static final long XI_RawMotionMask = 1L << XI_RawMotion;
|
||||
public static final long XI_TouchBeginMask = 1L << XI_TouchBegin;
|
||||
public static final long XI_TouchEndMask = 1L << XI_TouchEnd;
|
||||
public static final long XI_TouchOwnershipChangedMask = 1L << XI_TouchOwnership;
|
||||
public static final long XI_TouchUpdateMask = 1L << XI_TouchUpdate;
|
||||
public static final long XI_RawTouchBeginMask = 1L << XI_RawTouchBegin;
|
||||
public static final long XI_RawTouchEndMask = 1L << XI_RawTouchEnd;
|
||||
public static final long XI_RawTouchUpdateMask = 1L << XI_RawTouchUpdate;
|
||||
public static final long XI_BarrierHitMask = 1L << XI_BarrierHit;
|
||||
public static final long XI_BarrierLeaveMask = 1L << XI_BarrierLeave;
|
||||
}
|
||||
|
||||
@@ -340,7 +340,6 @@ public final class XToolkit extends UNIXToolkit implements Runnable {
|
||||
log.finer("X locale modifiers are not supported, using default");
|
||||
}
|
||||
tryXKB();
|
||||
checkXInput();
|
||||
|
||||
AwtScreenData defaultScreen = new AwtScreenData(XToolkit.getDefaultScreenData());
|
||||
awt_defaultFg = defaultScreen.get_blackpixel();
|
||||
@@ -742,8 +741,6 @@ public final class XToolkit extends UNIXToolkit implements Runnable {
|
||||
XBaseWindow.ungrabInput();
|
||||
processException(thr);
|
||||
} finally {
|
||||
// free event data if XGetEventData was called
|
||||
XlibWrapper.XFreeEventData(getDisplay(), ev.pData);
|
||||
awtUnlock();
|
||||
}
|
||||
}
|
||||
@@ -2576,58 +2573,6 @@ public final class XToolkit extends UNIXToolkit implements Runnable {
|
||||
}
|
||||
}
|
||||
|
||||
private static volatile boolean hasXInputExtension = false;
|
||||
|
||||
public static boolean isXInputEnabled() {
|
||||
return hasXInputExtension;
|
||||
}
|
||||
|
||||
public static void checkXInput() {
|
||||
awtLock();
|
||||
try {
|
||||
String extensionName = "XInputExtension";
|
||||
boolean hasExtension = XlibWrapper.XQueryExtension(XToolkit.getDisplay(), extensionName,
|
||||
XlibWrapper.iarg1, XlibWrapper.iarg2, XlibWrapper.iarg3);
|
||||
if (!hasExtension) {
|
||||
log.warning("X Input extension isn't available, error: {0}", Native.getInt(XlibWrapper.iarg1));
|
||||
return;
|
||||
}
|
||||
|
||||
final int requiredMajor = 2;
|
||||
final int requiredMinor = 2;
|
||||
Native.putInt(XlibWrapper.iarg1, requiredMajor);
|
||||
Native.putInt(XlibWrapper.iarg2, requiredMinor);
|
||||
int status = XlibWrapper.XIQueryVersion(XToolkit.getDisplay(), XlibWrapper.iarg1, XlibWrapper.iarg2);
|
||||
if (status == XConstants.BadRequest) {
|
||||
log.warning("X Input2 not supported in the server");
|
||||
return;
|
||||
}
|
||||
|
||||
int major = Native.getInt(XlibWrapper.iarg1);
|
||||
int minor = Native.getInt(XlibWrapper.iarg2);
|
||||
if (major >= requiredMajor && minor >= requiredMinor) {
|
||||
hasXInputExtension = true;
|
||||
} else {
|
||||
log.warning("Desired version is 2.2, server version is {0}.{1}", major, minor);
|
||||
}
|
||||
} finally {
|
||||
awtUnlock();
|
||||
}
|
||||
}
|
||||
|
||||
public static XIDeviceEvent GetXIDeviceEvent(XGenericEventCookie cookie) {
|
||||
return new XIDeviceEvent(cookie.get_data());
|
||||
}
|
||||
|
||||
public static int XISelectEvents(long display, long window, long mask, int deviceid) {
|
||||
if (isXInputEnabled()) {
|
||||
return XlibWrapper.XISelectEvents(display, window, mask, deviceid);
|
||||
} else {
|
||||
log.warning("Attempting to select xi events while xinput isn't available");
|
||||
return XConstants.BadRequest;
|
||||
}
|
||||
}
|
||||
|
||||
private static long eventNumber;
|
||||
public static long getEventNumber() {
|
||||
awtLock();
|
||||
|
||||
@@ -37,6 +37,8 @@ import sun.util.logging.PlatformLogger;
|
||||
|
||||
import sun.awt.*;
|
||||
|
||||
import sun.awt.image.PixelConverter;
|
||||
|
||||
import sun.java2d.SunGraphics2D;
|
||||
import sun.java2d.SurfaceData;
|
||||
|
||||
@@ -57,14 +59,6 @@ class XWindow extends XBaseWindow implements X11ComponentPeer {
|
||||
static long lastButton = 0;
|
||||
static WeakReference<XWindow> lastWindowRef = null;
|
||||
static int clickCount = 0;
|
||||
private static int touchBeginX = 0, touchBeginY = 0;
|
||||
private static int trackingId = 0;
|
||||
private static boolean isTouchScroll = false;
|
||||
private static final int TOUCH_CLICK_RADIUS = 3;
|
||||
// all touch scrolls are measured in pixels
|
||||
private static final int TOUCH_BEGIN = 2;
|
||||
private static final int TOUCH_UPDATE = 3;
|
||||
private static final int TOUCH_END = 4;
|
||||
|
||||
// used to check if we need to re-create surfaceData.
|
||||
int oldWidth = -1;
|
||||
@@ -229,11 +223,6 @@ class XWindow extends XBaseWindow implements X11ComponentPeer {
|
||||
|
||||
params.putIfNull(BACKING_STORE, XToolkit.getBackingStoreType());
|
||||
|
||||
params.putIfNull(XI_EVENT_MASK, XConstants.XI_TouchBeginMask |
|
||||
XConstants.XI_TouchUpdateMask |
|
||||
XConstants.XI_TouchEndMask);
|
||||
params.putIfNull(XI_DEVICE_ID, XConstants.XIAllMasterDevices);
|
||||
|
||||
XToolkit.awtLock();
|
||||
try {
|
||||
if (wm_protocols == null) {
|
||||
@@ -780,112 +769,6 @@ class XWindow extends XBaseWindow implements X11ComponentPeer {
|
||||
}
|
||||
}
|
||||
|
||||
public void handleTouchEvent(XEvent xev) {
|
||||
super.handleTouchEvent(xev);
|
||||
|
||||
XIDeviceEvent dev = XToolkit.GetXIDeviceEvent(xev.get_xcookie());
|
||||
// TODO remove this after TouchEvents support
|
||||
// own touch processing by tracking id
|
||||
if (isTouchReleased()) {
|
||||
trackingId = dev.get_detail();
|
||||
} else if (!isOwningTouch(dev.get_detail())) {
|
||||
return;
|
||||
}
|
||||
|
||||
int x = scaleDown((int) dev.get_event_x());
|
||||
int y = scaleDown((int) dev.get_event_y());
|
||||
|
||||
if (dev.get_event() != window) {
|
||||
Point localXY = toLocal(x, y);
|
||||
x = localXY.x;
|
||||
y = localXY.y;
|
||||
}
|
||||
|
||||
int button = XConstants.buttons[0];
|
||||
int modifiers = getModifiers(dev.get_mods().get_effective(), button, 0);
|
||||
// turning off shift modifier
|
||||
modifiers &= ~InputEvent.SHIFT_DOWN_MASK;
|
||||
|
||||
long jWhen = XToolkit.nowMillisUTC_offset(dev.get_time());
|
||||
|
||||
switch (dev.get_evtype()) {
|
||||
case XConstants.XI_TouchBegin:
|
||||
isTouchScroll = false;
|
||||
touchBeginX = x;
|
||||
touchBeginY = y;
|
||||
break;
|
||||
case XConstants.XI_TouchUpdate:
|
||||
if (isInsideTouchClickBoundaries(x, y)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!isTouchScroll) {
|
||||
sendWheelEventFromTouch(dev, jWhen, modifiers, touchBeginX, touchBeginY, TOUCH_BEGIN, 1);
|
||||
isTouchScroll = true;
|
||||
}
|
||||
|
||||
if (lastY - y != 0) {
|
||||
sendWheelEventFromTouch(dev, jWhen, modifiers, x, y, TOUCH_UPDATE, lastY - y);
|
||||
}
|
||||
// horizontal scroll
|
||||
if (lastX - x != 0) {
|
||||
modifiers |= InputEvent.SHIFT_DOWN_MASK;
|
||||
sendWheelEventFromTouch(dev, jWhen, modifiers, x, y, TOUCH_UPDATE, lastX - x);
|
||||
}
|
||||
break;
|
||||
case XConstants.XI_TouchEnd:
|
||||
if (isTouchScroll) {
|
||||
sendWheelEventFromTouch(dev, jWhen, modifiers, x, y, TOUCH_END, 1);
|
||||
} else {
|
||||
sendMouseEventFromTouch(dev, MouseEvent.MOUSE_PRESSED, jWhen, modifiers, touchBeginX, touchBeginY, button);
|
||||
sendMouseEventFromTouch(dev, MouseEvent.MOUSE_RELEASED, jWhen, modifiers, touchBeginX, touchBeginY, button);
|
||||
sendMouseEventFromTouch(dev, MouseEvent.MOUSE_CLICKED, jWhen, modifiers, touchBeginX, touchBeginY, button);
|
||||
}
|
||||
|
||||
// release touch processing
|
||||
trackingId = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
lastX = x;
|
||||
lastY = y;
|
||||
}
|
||||
|
||||
private boolean isInsideTouchClickBoundaries(int x, int y) {
|
||||
return Math.abs(touchBeginX - x) <= TOUCH_CLICK_RADIUS &&
|
||||
Math.abs(touchBeginY - y) <= TOUCH_CLICK_RADIUS;
|
||||
}
|
||||
|
||||
private static boolean isOwningTouch(int fingerId) {
|
||||
return trackingId == fingerId;
|
||||
}
|
||||
|
||||
private static boolean isTouchReleased() {
|
||||
return trackingId == 0;
|
||||
}
|
||||
|
||||
private void sendWheelEventFromTouch(XIDeviceEvent dev, long jWhen, int modifiers, int x, int y, int type, int delta) {
|
||||
postEventToEventQueue(
|
||||
new MouseWheelEvent(getEventSource(), MouseEvent.MOUSE_WHEEL, jWhen,
|
||||
modifiers,
|
||||
x, y,
|
||||
scaleDown((int) dev.get_root_x()),
|
||||
scaleDown((int) dev.get_root_y()),
|
||||
0, false, type,
|
||||
1, delta));
|
||||
}
|
||||
|
||||
private void sendMouseEventFromTouch(XIDeviceEvent dev, int type, long jWhen, int modifiers, int x, int y, int button) {
|
||||
postEventToEventQueue(
|
||||
new MouseEvent(getEventSource(), type, jWhen,
|
||||
modifiers,
|
||||
x, y,
|
||||
scaleDown((int) dev.get_root_x()),
|
||||
scaleDown((int) dev.get_root_y()),
|
||||
1,
|
||||
false, button));
|
||||
}
|
||||
|
||||
public void handleMotionNotify(XEvent xev) {
|
||||
super.handleMotionNotify(xev);
|
||||
XMotionEvent xme = xev.get_xmotion();
|
||||
|
||||
@@ -564,12 +564,6 @@ static native String XSetLocaleModifiers(String modifier_list);
|
||||
|
||||
static native void SetZOrder(long display, long window, long above);
|
||||
|
||||
static native int XIQueryVersion(long display, long major_version_iptr, long minor_version_iptr);
|
||||
static native int XISelectEvents(long display, long window, long mask, int deviceid);
|
||||
|
||||
static native boolean XGetEventData(long display, long ptr);
|
||||
static native void XFreeEventData(long display, long ptr);
|
||||
|
||||
/* Global memory area used for X lib parameter passing */
|
||||
|
||||
static final long lbuffer = unsafe.allocateMemory(64); // array to hold 8 longs
|
||||
|
||||
@@ -37,8 +37,6 @@
|
||||
#include <string.h>
|
||||
#include <X11/extensions/Xdbe.h>
|
||||
#include <X11/extensions/shape.h>
|
||||
#include <X11/extensions/XI2.h>
|
||||
#include <X11/extensions/XInput2.h>
|
||||
#include <X11/keysym.h>
|
||||
#include <X11/Sunkeysym.h>
|
||||
#include <X11/Xlib.h>
|
||||
@@ -2319,63 +2317,6 @@ Java_sun_awt_X11_XlibWrapper_SetZOrder
|
||||
value_mask, &wc );
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: XlibWrapper
|
||||
* Method: XIQueryVersion
|
||||
*/
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_sun_awt_X11_XlibWrapper_XIQueryVersion
|
||||
(JNIEnv *env, jclass clazz, jlong display, jlong major_version_iptr, jlong minor_version_iptr)
|
||||
{
|
||||
return XIQueryVersion((Display *)jlong_to_ptr(display),
|
||||
jlong_to_ptr(major_version_iptr), jlong_to_ptr(minor_version_iptr));
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: XlibWrapper
|
||||
* Method: XISelectEvents
|
||||
*/
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_sun_awt_X11_XlibWrapper_XISelectEvents
|
||||
(JNIEnv *env, jclass clazz, jlong display, jlong window, jlong mask, jint deviceid)
|
||||
{
|
||||
XIEventMask evmask;
|
||||
evmask.deviceid = (int)deviceid;
|
||||
evmask.mask_len = XIMaskLen(XI_LASTEVENT);
|
||||
union jlong_to_char_ptr
|
||||
{
|
||||
jlong value;
|
||||
unsigned char mask[8];
|
||||
} converter;
|
||||
converter.value = mask;
|
||||
evmask.mask = &converter.mask;
|
||||
return XISelectEvents((Display *)jlong_to_ptr(display), (Window)jlong_to_ptr(window),
|
||||
&evmask, /*num masks*/ 1);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: XlibWrapper
|
||||
* Method: XGetEventData
|
||||
*/
|
||||
JNIEXPORT jboolean JNICALL
|
||||
Java_sun_awt_X11_XlibWrapper_XGetEventData
|
||||
(JNIEnv *env, jclass clazz, jlong display, jlong ptr)
|
||||
{
|
||||
return XGetEventData((Display *)jlong_to_ptr(display),
|
||||
(XGenericEventCookie *)ptr_to_jlong(ptr)) ? JNI_TRUE : JNI_FALSE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: XlibWrapper
|
||||
* Method: XFreeEventData
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_sun_awt_X11_XlibWrapper_XFreeEventData
|
||||
(JNIEnv *env, jclass clazz, jlong display, jlong ptr)
|
||||
{
|
||||
return XFreeEventData((Display *)jlong_to_ptr(display), (XGenericEventCookie *)ptr_to_jlong(ptr));
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: XlibWrapper
|
||||
* Method: SetBitmapShape
|
||||
|
||||
@@ -224,11 +224,10 @@ BOOL windowMoveLockHeld = FALSE;
|
||||
AwtComponent::AwtComponent()
|
||||
{
|
||||
m_mouseButtonClickAllowed = 0;
|
||||
|
||||
m_isTouchScroll = FALSE;
|
||||
m_touchDownPoint = {0, 0};
|
||||
m_lastTouchPoint = {0, 0};
|
||||
|
||||
m_touchDownOccurred = FALSE;
|
||||
m_touchUpOccurred = FALSE;
|
||||
m_touchDownPoint.x = m_touchDownPoint.y = 0;
|
||||
m_touchUpPoint.x = m_touchUpPoint.y = 0;
|
||||
m_callbacksEnabled = FALSE;
|
||||
m_hwnd = NULL;
|
||||
|
||||
@@ -1395,10 +1394,6 @@ void SpyWinMessage(HWND hwnd, UINT message, LPCTSTR szComment) {
|
||||
|
||||
#endif /* SPY_MESSAGES */
|
||||
|
||||
static BOOL IsMouseEventFromTouch()
|
||||
{
|
||||
return (::GetMessageExtraInfo() & MOUSEEVENTF_FROMTOUCH) == MOUSEEVENTF_FROMTOUCH;
|
||||
}
|
||||
/*
|
||||
* Dispatch messages for this window class--general component
|
||||
*/
|
||||
@@ -1715,9 +1710,6 @@ LRESULT AwtComponent::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
|
||||
case WM_MOUSEHWHEEL:
|
||||
case WM_AWT_MOUSEENTER:
|
||||
case WM_AWT_MOUSEEXIT:
|
||||
if (IsMouseEventFromTouch()) {
|
||||
break;
|
||||
}
|
||||
curPos = ::GetMessagePos();
|
||||
POINT myPos;
|
||||
myPos.x = GET_X_LPARAM(curPos);
|
||||
@@ -2393,90 +2385,27 @@ void AwtComponent::WmTouch(WPARAM wParam, LPARAM lParam) {
|
||||
|
||||
UINT inputsCount = LOWORD(wParam);
|
||||
TOUCHINPUT* pInputs = new TOUCHINPUT[inputsCount];
|
||||
if (tk.TIGetTouchInputInfo((HTOUCHINPUT)lParam, inputsCount, pInputs,
|
||||
sizeof(TOUCHINPUT)) != 0) {
|
||||
for (UINT i = 0; i < inputsCount; i++) {
|
||||
WmTouchHandler(pInputs[i]);
|
||||
}
|
||||
}
|
||||
delete[] pInputs;
|
||||
}
|
||||
|
||||
BOOL AwtComponent::IsInsideTouchClickBoundaries(POINT p)
|
||||
{
|
||||
return abs(p.x - m_touchDownPoint.x) <= TOUCH_MOUSE_COORDS_DELTA &&
|
||||
abs(p.y - m_touchDownPoint.y) <= TOUCH_MOUSE_COORDS_DELTA;
|
||||
}
|
||||
|
||||
POINT AwtComponent::TouchCoordsToLocal(LONG x, LONG y)
|
||||
{
|
||||
POINT p{TOUCH_COORD_TO_PIXEL(x), TOUCH_COORD_TO_PIXEL(y)};
|
||||
::ScreenToClient(GetHWnd(), &p);
|
||||
return p;
|
||||
}
|
||||
|
||||
void AwtComponent::SendMouseWheelEventFromTouch(POINT p, jint modifiers, jint scrollType, jint pixels)
|
||||
{
|
||||
SendMouseWheelEvent(java_awt_event_MouseEvent_MOUSE_WHEEL, ::JVM_CurrentTimeMillis(NULL, 0),
|
||||
p.x, p.y, modifiers, 0, 0, scrollType,
|
||||
/*scrollAmount*/ 1, pixels,
|
||||
static_cast<double>(pixels), /*msg*/ nullptr);
|
||||
}
|
||||
|
||||
void AwtComponent::SendMouseEventFromTouch(jint id, POINT p, jint modifiers)
|
||||
{
|
||||
SendMouseEvent(id, ::JVM_CurrentTimeMillis(NULL, 0), p.x, p.y,
|
||||
modifiers, /*clickCount*/ 1, JNI_FALSE,
|
||||
java_awt_event_MouseEvent_BUTTON1,
|
||||
/*msg*/ nullptr, /*causedByTouchEvent*/ TRUE);
|
||||
}
|
||||
|
||||
void AwtComponent::WmTouchHandler(const TOUCHINPUT& touchInput)
|
||||
{
|
||||
// skip multitouch, remove after gesture support
|
||||
if (!(touchInput.dwFlags & TOUCHEVENTF_PRIMARY)) {
|
||||
return;
|
||||
}
|
||||
|
||||
jint modifiers = GetJavaModifiers();
|
||||
// turn off horizontal
|
||||
modifiers &= ~java_awt_event_InputEvent_SHIFT_DOWN_MASK;
|
||||
const POINT p = TouchCoordsToLocal(touchInput.x, touchInput.y);
|
||||
|
||||
if (touchInput.dwFlags & TOUCHEVENTF_DOWN) {
|
||||
m_touchDownPoint = p;
|
||||
m_lastTouchPoint = p;
|
||||
m_isTouchScroll = FALSE;
|
||||
} else if (touchInput.dwFlags & TOUCHEVENTF_MOVE) {
|
||||
if (IsInsideTouchClickBoundaries(p)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!m_isTouchScroll) {
|
||||
SendMouseWheelEventFromTouch(p, modifiers, TOUCH_BEGIN, 1);
|
||||
m_isTouchScroll = TRUE;
|
||||
}
|
||||
|
||||
const int deltaY = ScaleDownY(static_cast<int>(m_lastTouchPoint.y - p.y));
|
||||
if (abs(deltaY) != 0) {
|
||||
SendMouseWheelEventFromTouch(p, modifiers, TOUCH_UPDATE, deltaY);
|
||||
}
|
||||
|
||||
const int deltaX = ScaleDownX(static_cast<int>(m_lastTouchPoint.x - p.x));
|
||||
if (abs(deltaX) != 0) {
|
||||
modifiers |= java_awt_event_InputEvent_SHIFT_DOWN_MASK;
|
||||
SendMouseWheelEventFromTouch(p, modifiers, TOUCH_UPDATE, deltaX);
|
||||
}
|
||||
|
||||
m_lastTouchPoint = p;
|
||||
} else if (touchInput.dwFlags & TOUCHEVENTF_UP) {
|
||||
if (m_isTouchScroll) {
|
||||
SendMouseWheelEventFromTouch(p, modifiers, TOUCH_END, 1);
|
||||
} else {
|
||||
SendMouseEventFromTouch(java_awt_event_MouseEvent_MOUSE_PRESSED, p, modifiers);
|
||||
SendMouseEventFromTouch(java_awt_event_MouseEvent_MOUSE_RELEASED, p, modifiers);
|
||||
SendMouseEventFromTouch(java_awt_event_MouseEvent_MOUSE_CLICKED, p, modifiers);
|
||||
if (pInputs != NULL) {
|
||||
if (tk.TIGetTouchInputInfo((HTOUCHINPUT)lParam, inputsCount, pInputs,
|
||||
sizeof(TOUCHINPUT)) != 0) {
|
||||
for (UINT i = 0; i < inputsCount; i++) {
|
||||
TOUCHINPUT ti = pInputs[i];
|
||||
if (ti.dwFlags & TOUCHEVENTF_PRIMARY) {
|
||||
if (ti.dwFlags & TOUCHEVENTF_DOWN) {
|
||||
m_touchDownPoint.x = ti.x / 100;
|
||||
m_touchDownPoint.y = ti.y / 100;
|
||||
::ScreenToClient(GetHWnd(), &m_touchDownPoint);
|
||||
m_touchDownOccurred = TRUE;
|
||||
} else if (ti.dwFlags & TOUCHEVENTF_UP) {
|
||||
m_touchUpPoint.x = ti.x / 100;
|
||||
m_touchUpPoint.y = ti.y / 100;
|
||||
::ScreenToClient(GetHWnd(), &m_touchUpPoint);
|
||||
m_touchUpOccurred = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
delete[] pInputs;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2522,6 +2451,14 @@ MsgRouting AwtComponent::WmMouseDown(UINT flags, int x, int y, int button)
|
||||
m_mouseButtonClickAllowed |= GetButtonMK(button);
|
||||
lastTime = now;
|
||||
|
||||
BOOL causedByTouchEvent = FALSE;
|
||||
if (m_touchDownOccurred &&
|
||||
(abs(m_touchDownPoint.x - x) <= TOUCH_MOUSE_COORDS_DELTA) &&
|
||||
(abs(m_touchDownPoint.y - y) <= TOUCH_MOUSE_COORDS_DELTA)) {
|
||||
causedByTouchEvent = TRUE;
|
||||
m_touchDownOccurred = FALSE;
|
||||
}
|
||||
|
||||
MSG msg;
|
||||
InitMessage(&msg, lastMessage, flags, MAKELPARAM(x, y), x, y);
|
||||
|
||||
@@ -2540,7 +2477,7 @@ MsgRouting AwtComponent::WmMouseDown(UINT flags, int x, int y, int button)
|
||||
|
||||
SendMouseEvent(java_awt_event_MouseEvent_MOUSE_PRESSED, now, x, y,
|
||||
GetJavaModifiers(), clickCount, JNI_FALSE,
|
||||
GetButton(button), &msg, /*causedByTouchEvent*/ FALSE);
|
||||
GetButton(button), &msg, causedByTouchEvent);
|
||||
/*
|
||||
* NOTE: this call is intentionally placed after all other code,
|
||||
* since AwtComponent::WmMouseDown() assumes that the cached id of the
|
||||
@@ -2562,13 +2499,21 @@ MsgRouting AwtComponent::WmMouseDown(UINT flags, int x, int y, int button)
|
||||
|
||||
MsgRouting AwtComponent::WmMouseUp(UINT flags, int x, int y, int button)
|
||||
{
|
||||
BOOL causedByTouchEvent = FALSE;
|
||||
if (m_touchUpOccurred &&
|
||||
(abs(m_touchUpPoint.x - x) <= TOUCH_MOUSE_COORDS_DELTA) &&
|
||||
(abs(m_touchUpPoint.y - y) <= TOUCH_MOUSE_COORDS_DELTA)) {
|
||||
causedByTouchEvent = TRUE;
|
||||
m_touchUpOccurred = FALSE;
|
||||
}
|
||||
|
||||
MSG msg;
|
||||
InitMessage(&msg, lastMessage, flags, MAKELPARAM(x, y), x, y);
|
||||
|
||||
SendMouseEvent(java_awt_event_MouseEvent_MOUSE_RELEASED, ::JVM_CurrentTimeMillis(NULL, 0),
|
||||
x, y, GetJavaModifiers(), clickCount,
|
||||
(GetButton(button) == java_awt_event_MouseEvent_BUTTON3 ?
|
||||
TRUE : FALSE), GetButton(button), &msg, /*causedByTouchEvent*/ FALSE);
|
||||
TRUE : FALSE), GetButton(button), &msg, causedByTouchEvent);
|
||||
/*
|
||||
* If no movement, then report a click following the button release.
|
||||
* When WM_MOUSEUP comes to a window without previous WM_MOUSEDOWN,
|
||||
|
||||
@@ -71,9 +71,6 @@ const int X_BUTTONS = MK_XBUTTON1|MK_XBUTTON2;
|
||||
// corresponding WM_LBUTTONDOWN/WM_LBUTTONUP event letting to associate these
|
||||
// events, when their coordinates are slightly different.
|
||||
const int TOUCH_MOUSE_COORDS_DELTA = 10;
|
||||
const int TOUCH_BEGIN = 2;
|
||||
const int TOUCH_UPDATE = 3;
|
||||
const int TOUCH_END = 4;
|
||||
|
||||
// Whether to check for embedded frame and adjust location
|
||||
#define CHECK_EMBEDDED 0
|
||||
@@ -535,11 +532,6 @@ public:
|
||||
virtual MsgRouting WmWindowPosChanging(LPARAM windowPos);
|
||||
virtual MsgRouting WmWindowPosChanged(LPARAM windowPos);
|
||||
virtual void WmTouch(WPARAM wParam, LPARAM lParam);
|
||||
void WmTouchHandler(const TOUCHINPUT& touchInput);
|
||||
BOOL IsInsideTouchClickBoundaries(POINT p);
|
||||
POINT TouchCoordsToLocal(LONG x, LONG y);
|
||||
void SendMouseWheelEventFromTouch(POINT p, jint modifiers, jint scrollType, jint pixels);
|
||||
void SendMouseEventFromTouch(jint id, POINT p, jint modifiers);
|
||||
|
||||
// NB: 64-bit: vkey is wParam of the message, but other API's take
|
||||
// vkey parameters of type UINT, so we do the cast before dispatching.
|
||||
@@ -789,9 +781,10 @@ private:
|
||||
*/
|
||||
UINT m_mouseButtonClickAllowed;
|
||||
|
||||
BOOL m_isTouchScroll;
|
||||
BOOL m_touchDownOccurred;
|
||||
BOOL m_touchUpOccurred;
|
||||
POINT m_touchDownPoint;
|
||||
POINT m_lastTouchPoint;
|
||||
POINT m_touchUpPoint;
|
||||
|
||||
BOOL m_bSubclassed;
|
||||
BOOL m_bPauseDestroy;
|
||||
|
||||
@@ -198,13 +198,6 @@ class CriticalSection {
|
||||
#define TOUCHEVENTF_NOCOALESCE 0x0020
|
||||
#define TOUCHEVENTF_PEN 0x0040
|
||||
#define TOUCHEVENTF_PALM 0x0080
|
||||
|
||||
#define MOUSEEVENTF_FROMTOUCH 0xFF515700
|
||||
|
||||
/*
|
||||
* Conversion of touch input coordinates to pixels
|
||||
*/
|
||||
#define TOUCH_COORD_TO_PIXEL(l) ((l) / 100)
|
||||
#endif
|
||||
|
||||
/************************************************************************
|
||||
|
||||
@@ -1179,9 +1179,6 @@ AwtWindow* AwtWindow::Create(jobject self, jobject parent)
|
||||
if (env->ExceptionCheck()) goto done;
|
||||
DWORD style = WS_CLIPCHILDREN | WS_POPUP;
|
||||
DWORD exStyle = WS_EX_NOACTIVATE;
|
||||
if (JNU_CallMethodByName(env, NULL, target, "isIgnoreMouseEvents", "()Z").z) {
|
||||
exStyle |= WS_EX_LAYERED | WS_EX_TRANSPARENT;
|
||||
}
|
||||
if (GetRTL()) {
|
||||
exStyle |= WS_EX_RIGHT | WS_EX_LEFTSCROLLBAR;
|
||||
if (GetRTLReadingOrder())
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
#
|
||||
#############################################################################
|
||||
|
||||
applications/jcstress/acqrel/Test.java - generic-all
|
||||
applications/jcstress/acqrel/Test.java generic-all
|
||||
|
||||
# :hotspot_compiler
|
||||
|
||||
@@ -47,7 +47,6 @@ compiler/codecache/stress/OverloadCompileQueueTest.java
|
||||
compiler/codegen/Test6896617.java 8193479 generic-all
|
||||
compiler/codegen/aes/TestCipherBlockChainingEncrypt.java 8219513 generic-all
|
||||
compiler/compilercontrol/jcmd/ClearDirectivesFileStackTest.java 8140405 generic-all
|
||||
compiler/intrinsics/sha/sanity/TestSHA512MultiBlockIntrinsics.java 8209459 linux-aarch64
|
||||
compiler/jsr292/ContinuousCallSiteTargetChange.java 8222030 generic-all
|
||||
compiler/jvmci/compilerToVM/GetFlagValueTest.java 8204459 generic-all
|
||||
compiler/jvmci/compilerToVM/GetResolvedJavaTypeTest.java 8158860 generic-all
|
||||
@@ -57,7 +56,6 @@ compiler/types/correctness/CorrectnessTest.java
|
||||
compiler/types/correctness/OffTest.java 8066173 generic-all
|
||||
|
||||
compiler/c2/Test6852078.java 8194310 generic-all
|
||||
compiler/c2/Test6857159.java 8234290 generic-all
|
||||
|
||||
applications/ctw/modules/java_desktop.java 8189604 windows-all
|
||||
applications/ctw/modules/java_desktop_2.java 8189604,8204842 generic-all
|
||||
@@ -91,15 +89,11 @@ runtime/SelectionResolution/InvokeVirtualSuccessTest.java
|
||||
runtime/SharedArchiveFile/SASymbolTableTest.java 8193639 solaris-all
|
||||
vmTestbase/nsk/jdi/BScenarios/hotswap/tc10x001/TestDescription.java 8013728 generic-all
|
||||
runtime/memory/ReadFromNoaccessArea.java nobug generic-all crash is the expected behaviour
|
||||
runtime/modules/ModuleStress/ExportModuleStressTest.java 8230055 windows-all
|
||||
runtime/modules/ModuleStress/ModuleStressGC.java 8230055 windows-all
|
||||
|
||||
#############################################################################
|
||||
|
||||
# :hotspot_serviceability
|
||||
|
||||
serviceability/logging/TestQuotedLogOutputs.java 8224505 windows-all
|
||||
|
||||
serviceability/sa/ClhsdbAttach.java 8193639 solaris-all
|
||||
serviceability/sa/ClhsdbCDSCore.java 8207832 linux-all,generic-all crash is the expected behaviour
|
||||
serviceability/sa/ClhsdbCDSJstackPrintAll.java 8193639 solaris-all
|
||||
@@ -211,33 +205,29 @@ vmTestbase/nsk/jvmti/IterateThroughHeap/filter-untagged/TestDescription.java
|
||||
|
||||
vmTestbase/nsk/sysdict/vm/stress/chain/chain007/chain007.java JRE-1282 macosx-10.13
|
||||
|
||||
vmTestbase/gc/lock/jni/jnilock002/TestDescription.java 8208243,8192647 generic-all
|
||||
vmTestbase/gc/lock/jni/jnilock002/TestDescription.java 8208243,8192647 generic-all
|
||||
|
||||
vmTestbase/jit/escape/LockCoarsening/LockCoarsening001/TestDescription.java 8148743 generic-all
|
||||
vmTestbase/jit/escape/LockCoarsening/LockCoarsening002/TestDescription.java 8208259 generic-all
|
||||
vmTestbase/jit/escape/LockCoarsening/LockCoarsening001/TestDescription.java 8148743 generic-all
|
||||
vmTestbase/jit/escape/LockCoarsening/LockCoarsening002/TestDescription.java 8208259 generic-all
|
||||
|
||||
vmTestbase/vm/mlvm/indy/func/jvmti/redefineClassInBootstrap/TestDescription.java 8013267 generic-all
|
||||
vmTestbase/vm/mlvm/indy/stress/java/relinkMutableCallSite/Test.java 8079664 generic-all
|
||||
vmTestbase/vm/mlvm/indy/stress/java/relinkVolatileCallSite/Test.java 8079664 generic-all
|
||||
vmTestbase/vm/mlvm/cp/stress/classfmt/correctBootstrap/TestDescription.java 8231169 linux-aarch64
|
||||
vmTestbase/vm/mlvm/cp/stress/classfmt/mh/TestDescription.java 8231169 linux-aarch64
|
||||
vmTestbase/vm/mlvm/meth/stress/gc/createLotsOfMHConsts/Test.java 8231169 linux-aarch64
|
||||
vmTestbase/vm/mlvm/meth/func/java/throwException/Test.java 8208255 generic-all
|
||||
vmTestbase/vm/mlvm/meth/func/jdi/breakpointOtherStratum/Test.java 8208257,8208255 generic-all
|
||||
vmTestbase/vm/mlvm/meth/stress/compiler/deoptimize/Test.java 8079642,8208255 generic-all
|
||||
vmTestbase/vm/mlvm/meth/stress/compiler/i2c_c2i/Test.java 8208255 generic-all
|
||||
vmTestbase/vm/mlvm/meth/stress/compiler/sequences/Test.java 8208255 generic-all
|
||||
vmTestbase/vm/mlvm/meth/stress/gc/callSequencesDuringGC/Test.java 8208255 generic-all
|
||||
vmTestbase/vm/mlvm/meth/stress/java/sequences/Test.java 8208255 generic-all
|
||||
vmTestbase/vm/mlvm/meth/stress/jdi/breakpointInCompiledCode/Test.java 8208255 generic-all
|
||||
vmTestbase/vm/mlvm/mixed/stress/java/findDeadlock/TestDescription.java 8208278 generic-all
|
||||
vmTestbase/vm/mlvm/mixed/stress/regression/b6969574/INDIFY_Test.java 8079650 generic-all
|
||||
vmTestbase/vm/mlvm/indy/func/jvmti/mergeCP_indy2none_a/TestDescription.java 8013267 generic-all
|
||||
vmTestbase/vm/mlvm/indy/func/jvmti/mergeCP_indy2manyDiff_b/TestDescription.java 8013267 generic-all
|
||||
vmTestbase/vm/mlvm/indy/func/jvmti/mergeCP_indy2manySame_b/TestDescription.java 8013267 generic-all
|
||||
vmTestbase/vm/mlvm/indy/func/jvmti/redefineClassInBootstrap/TestDescription.java 8013267 generic-all
|
||||
vmTestbase/vm/mlvm/indy/stress/java/relinkMutableCallSite/Test.java 8079664 generic-all
|
||||
vmTestbase/vm/mlvm/indy/stress/java/relinkVolatileCallSite/Test.java 8079664 generic-all
|
||||
vmTestbase/vm/mlvm/meth/func/java/throwException/Test.java 8208255 generic-all
|
||||
vmTestbase/vm/mlvm/meth/func/jdi/breakpointOtherStratum/Test.java 8208257,8208255 generic-all
|
||||
vmTestbase/vm/mlvm/meth/stress/compiler/deoptimize/Test.java 8079642,8208255 generic-all
|
||||
vmTestbase/vm/mlvm/meth/stress/compiler/i2c_c2i/Test.java 8208255 generic-all
|
||||
vmTestbase/vm/mlvm/meth/stress/compiler/sequences/Test.java 8208255 generic-all
|
||||
vmTestbase/vm/mlvm/meth/stress/gc/callSequencesDuringGC/Test.java 8208255 generic-all
|
||||
vmTestbase/vm/mlvm/meth/stress/java/sequences/Test.java 8208255 generic-all
|
||||
vmTestbase/vm/mlvm/meth/stress/jdi/breakpointInCompiledCode/Test.java 8208255 generic-all
|
||||
vmTestbase/vm/mlvm/mixed/stress/java/findDeadlock/TestDescription.java 8208278 generic-all
|
||||
vmTestbase/vm/mlvm/mixed/stress/regression/b6969574/INDIFY_Test.java 8079650 generic-all
|
||||
vmTestbase/vm/mlvm/indy/func/jvmti/mergeCP_indy2none_a/TestDescription.java 8013267 generic-all
|
||||
vmTestbase/vm/mlvm/indy/func/jvmti/mergeCP_indy2manyDiff_b/TestDescription.java 8013267 generic-all
|
||||
vmTestbase/vm/mlvm/indy/func/jvmti/mergeCP_indy2manySame_b/TestDescription.java 8013267 generic-all
|
||||
|
||||
vmTestbase/nsk/jdb/exclude/exclude001/exclude001.java 8197938 windows-all
|
||||
vmTestbase/nsk/jdb/unwatch/unwatch002/unwatch002.java.unwatch002 8208471 windows-all
|
||||
vmTestbase/nsk/jdb/exclude/exclude001/exclude001.java 8197938 windows-all
|
||||
|
||||
vmTestbase/nsk/jdwp/ThreadReference/ForceEarlyReturn/forceEarlyReturn001/forceEarlyReturn001.java 7199837 generic-all
|
||||
|
||||
|
||||
@@ -1,57 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8223558
|
||||
* @summary Verifies Dialog logical font falls back to "Myanmar Text"
|
||||
* @requires (os.family == "windows")
|
||||
*/
|
||||
|
||||
import java.awt.Font;
|
||||
import java.awt.GraphicsEnvironment;
|
||||
import java.util.Arrays;
|
||||
|
||||
public class MyanmarFallbackTest {
|
||||
|
||||
public static void main(String[] args) {
|
||||
if (!System.getProperty("os.name").toLowerCase().contains("windows")) {
|
||||
System.err.println("This test is for Windows only");
|
||||
return;
|
||||
}
|
||||
|
||||
String[] fontFamilyNames = GraphicsEnvironment
|
||||
.getLocalGraphicsEnvironment()
|
||||
.getAvailableFontFamilyNames();
|
||||
if (Arrays.stream(fontFamilyNames)
|
||||
.noneMatch("Myanmar Text"::equals)) {
|
||||
System.err.println("Myanmar Text font is not installed");
|
||||
return;
|
||||
}
|
||||
|
||||
Font dialog = new Font(Font.DIALOG, Font.PLAIN, 12);
|
||||
if (-1 != dialog.canDisplayUpTo("\u1000\u103C")) {
|
||||
throw new RuntimeException("Cannot display Myanmar characters");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,151 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8223558
|
||||
* @key headful
|
||||
* @summary Verifies that Myanmar script is rendered correctly:
|
||||
* two characters combined into one glyph
|
||||
* @run main MyanmarTextTest
|
||||
*/
|
||||
|
||||
import java.awt.Font;
|
||||
import java.awt.GraphicsEnvironment;
|
||||
import java.util.Arrays;
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.BoxLayout;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JTextField;
|
||||
import javax.swing.SwingConstants;
|
||||
import javax.swing.SwingUtilities;
|
||||
import javax.swing.WindowConstants;
|
||||
import javax.swing.plaf.TextUI;
|
||||
import javax.swing.text.BadLocationException;
|
||||
import javax.swing.text.Position;
|
||||
|
||||
public class MyanmarTextTest {
|
||||
private static final String TEXT = "\u1000\u103C";
|
||||
|
||||
private static final String FONT_WINDOWS = "Myanmar Text";
|
||||
private static final String FONT_LINUX = "Padauk";
|
||||
private static final String FONT_MACOS = "Myanmar MN";
|
||||
|
||||
private static final String FONT_NAME = selectFontName();
|
||||
|
||||
private final JFrame frame;
|
||||
private final JTextField myanmarTF;
|
||||
|
||||
private static volatile MyanmarTextTest mtt;
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
if (FONT_NAME == null) {
|
||||
System.err.println("Unsupported OS: exiting");
|
||||
return;
|
||||
}
|
||||
if (!fontExists()) {
|
||||
System.err.println("Required font is not installed: " + FONT_NAME);
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
SwingUtilities.invokeAndWait(MyanmarTextTest::createUI);
|
||||
SwingUtilities.invokeAndWait(mtt::checkPositions);
|
||||
} finally {
|
||||
SwingUtilities.invokeAndWait(mtt::dispose);
|
||||
}
|
||||
}
|
||||
|
||||
private static void createUI() {
|
||||
mtt = new MyanmarTextTest();
|
||||
mtt.show();
|
||||
}
|
||||
|
||||
private MyanmarTextTest() {
|
||||
frame = new JFrame("Myanmar Text");
|
||||
frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
|
||||
|
||||
myanmarTF = new JTextField(TEXT);
|
||||
myanmarTF.setFont(new Font(FONT_NAME, Font.PLAIN, 40));
|
||||
|
||||
JPanel main = new JPanel();
|
||||
main.setLayout(new BoxLayout(main, BoxLayout.Y_AXIS));
|
||||
main.add(myanmarTF);
|
||||
|
||||
main.setBorder(BorderFactory.createEmptyBorder(7, 7, 7, 7));
|
||||
|
||||
frame.getContentPane().add(main);
|
||||
}
|
||||
|
||||
private void show() {
|
||||
frame.pack();
|
||||
frame.setLocationByPlatform(true);
|
||||
frame.setVisible(true);
|
||||
}
|
||||
|
||||
private void dispose() {
|
||||
frame.dispose();
|
||||
}
|
||||
|
||||
private void checkPositions() {
|
||||
final TextUI ui = myanmarTF.getUI();
|
||||
final Position.Bias[] biasRet = new Position.Bias[1];
|
||||
try {
|
||||
if (2 != ui.getNextVisualPositionFrom(myanmarTF, 0,
|
||||
Position.Bias.Forward, SwingConstants.EAST, biasRet)) {
|
||||
throw new RuntimeException("For 0, next position should be 2");
|
||||
}
|
||||
if (2 != ui.getNextVisualPositionFrom(myanmarTF, 1,
|
||||
Position.Bias.Forward, SwingConstants.EAST, biasRet)) {
|
||||
throw new RuntimeException("For 1, next position should be 2");
|
||||
}
|
||||
if (0 != ui.getNextVisualPositionFrom(myanmarTF, 2,
|
||||
Position.Bias.Forward, SwingConstants.WEST, biasRet)) {
|
||||
throw new RuntimeException("For 2, prev position should be 0");
|
||||
}
|
||||
} catch (BadLocationException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
private static String selectFontName() {
|
||||
String osName = System.getProperty("os.name").toLowerCase();
|
||||
if (osName.contains("windows")) {
|
||||
return FONT_WINDOWS;
|
||||
} else if (osName.contains("linux")) {
|
||||
return FONT_LINUX;
|
||||
} else if (osName.contains("mac")) {
|
||||
return FONT_MACOS;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean fontExists() {
|
||||
String[] fontFamilyNames = GraphicsEnvironment
|
||||
.getLocalGraphicsEnvironment()
|
||||
.getAvailableFontFamilyNames();
|
||||
return Arrays.asList(fontFamilyNames).contains(FONT_NAME);
|
||||
}
|
||||
}
|
||||
@@ -1,62 +0,0 @@
|
||||
/*
|
||||
* Copyright 2000-2019 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.KeyEvent;
|
||||
|
||||
public class KeyboardLayoutSwitchTest implements Runnable {
|
||||
|
||||
private static Robot robot;
|
||||
private JFrame frame;
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
|
||||
System.out.println("VK_TAB = " + KeyEvent.VK_TAB);
|
||||
robot = new Robot();
|
||||
robot.setAutoDelay(50);
|
||||
|
||||
KeyboardLayoutSwitchTest test = new KeyboardLayoutSwitchTest();
|
||||
SwingUtilities.invokeAndWait(test);
|
||||
robot.delay(3000);
|
||||
|
||||
try {
|
||||
SwingUtilities.invokeAndWait(() ->
|
||||
pressCtrlKey(KeyEvent.VK_TAB));
|
||||
} finally {
|
||||
SwingUtilities.invokeAndWait(() -> test.frame.dispose());
|
||||
robot.delay(2000);
|
||||
}
|
||||
System.out.println("Test PASSED");
|
||||
}
|
||||
|
||||
private static void pressCtrlKey(int vk) {
|
||||
robot.keyPress(KeyEvent.VK_CONTROL);
|
||||
robot.keyPress(vk);
|
||||
robot.keyRelease(vk);
|
||||
robot.keyRelease(KeyEvent.VK_CONTROL);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
frame = new JFrame(getClass().getSimpleName());
|
||||
frame.pack();
|
||||
frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
|
||||
frame.setLocationRelativeTo(null);
|
||||
frame.setVisible(true);
|
||||
frame.toFront();
|
||||
}
|
||||
}
|
||||
@@ -1,71 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
#
|
||||
# Copyright 2000-2019 JetBrains s.r.o.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
# @test
|
||||
# @summary KeyboardLayoutSwitchTest.sh checks memory leaks
|
||||
# @run shell KeyboardLayoutSwitchTest.sh
|
||||
|
||||
OS=`uname -s`
|
||||
case "$OS" in
|
||||
Darwin)
|
||||
echo "Detected OS $OS"
|
||||
;;
|
||||
* )
|
||||
echo "PASSED: The test is valid for MacOSX"
|
||||
exit 0;
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ -z "${TESTSRC}" ]; then
|
||||
echo "TESTSRC undefined: set to ."
|
||||
TESTSRC=.
|
||||
fi
|
||||
|
||||
if [ -z "${TESTCLASSES}" ]; then
|
||||
echo "TESTCLASSES undefined: set to ."
|
||||
TESTCLASSES=.
|
||||
fi
|
||||
|
||||
if [ -z "${TESTJAVA}" ]; then
|
||||
echo "TESTJAVA undefined: testing cancelled"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cd ${TESTSRC}
|
||||
//${TESTJAVA}/bin/javac -d ${TESTCLASSES} AppleSymbolicHotKeysReader.java
|
||||
${TESTJAVA}/bin/javac -d ${TESTCLASSES} KeyboardLayoutSwitchTest.java
|
||||
|
||||
echo "reading current hot keys"
|
||||
oldKeyValue=$(defaults read "com.apple.symbolichotkeys" | grep -A10 " 60 =" | sed '$d' | sed '1d' | tr -d '\r\n' | tr -s ' ' | sed s/standard/\'standard\'/)
|
||||
|
||||
defaults write com.apple.symbolichotkeys AppleSymbolicHotKeys -dict-add 60 "{ enabled = 1; value = { parameters = ( 65535, 48, 262144 ); type = 'standard'; };}"
|
||||
${TESTJAVA}/bin/java -cp ${TESTCLASSES} KeyboardLayoutSwitchTest
|
||||
exit_code=$?
|
||||
defaults write com.apple.symbolichotkeys AppleSymbolicHotKeys -dict-add 60 "$oldKeyValue"
|
||||
|
||||
case $exit_code in
|
||||
0) echo "PASSED"
|
||||
;;
|
||||
*) echo "FAILED"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
exit 0
|
||||
|
||||
|
||||
|
||||
@@ -591,7 +591,7 @@ java/awt/Window/8159168/SetShapeTest.java
|
||||
java/awt/Window/BackgroundIsNotUpdated/BackgroundIsNotUpdated.java 8142536 generic-all
|
||||
java/awt/Window/Grab/GrabTest.java 8196019 macosx-all,windows-all,linux-all
|
||||
java/awt/Window/MultiWindowApp/ChildAlwaysOnTopTest.java 8215132,8194941 macosx-all,windows-all,linux-all
|
||||
java/awt/Window/MultiWindowApp/MultiWindowAppTest.java 8159904 macosx-all,windows-all,linux-all
|
||||
java/awt/Window/MultiWindowApp/MultiWindowAppTest.java 8159904 macosx-all,windows-all
|
||||
java/awt/Window/ShapedAndTranslucentWindows/FocusAWTTest.java 8061236 macosx-all,windows-all,linux-all
|
||||
java/awt/Window/ShapedAndTranslucentWindows/SetShape.java 8208509 macosx-all,windows-all,linux-all
|
||||
java/awt/Window/ShapedAndTranslucentWindows/SetShapeAndClick.java 8197936 macosx-all,windows-all,linux-4.18.16-200.fc28.x86_64,linux-all (linux-all timeout reproduced with Adopt)
|
||||
@@ -760,7 +760,6 @@ javax/management/remote/mandatory/notif/NotifReconnectDeadlockTest.java
|
||||
|
||||
# jdk_net
|
||||
|
||||
java/net/CookieHandler/B6791927.java 8234007 generic-all
|
||||
java/net/MulticastSocket/NoLoopbackPackets.java 7122846 macosx-all
|
||||
java/net/MulticastSocket/SetLoopbackMode.java 7122846 macosx-all
|
||||
java/net/MulticastSocket/Test.java 7145658,8207404 macosx-all,aix-all
|
||||
@@ -771,8 +770,6 @@ java/net/DatagramSocket/SendDatagramToBadAddress.java
|
||||
java/net/httpclient/ProxyAuthDisabledSchemesSSL.java 8212695 macosx-all
|
||||
java/net/httpclient/UnknownBodyLengthTest.java 8210130 macosx-all,windows-all
|
||||
|
||||
javax/net/ssl/SSLSocket/Tls13PacketSize.java 8224829 windows-all
|
||||
|
||||
com/sun/net/httpserver/bugs/B6361557.java 8196070 windows-all
|
||||
sun/net/www/protocol/jar/jarbug/TestDriver.java nobug windows-6.1 fails on Windows 7 only
|
||||
|
||||
@@ -949,7 +946,7 @@ javax/swing/JSplitPane/4201995/bug4201995.java
|
||||
javax/swing/JSplitPane/4885629/bug4885629.java 8019935,8194941 macosx-all,linux-all,windows-all (windows: commit testing)
|
||||
javax/swing/JTabbedPane/4361477/bug4361477.java 8170260 macosx-all,windows-all
|
||||
javax/swing/JTabbedPane/4624207/bug4624207.java 8197552,8064922 macosx-all,windows-all,linux-all
|
||||
javax/swing/JTabbedPane/7024235/Test7024235.java 8028281,JBR-1977 macosx-all,linux-aarch64
|
||||
javax/swing/JTabbedPane/7024235/Test7024235.java 8028281 macosx-all
|
||||
javax/swing/JTabbedPane/8007563/Test8007563.java 8051591 generic-all
|
||||
javax/swing/JTable/4235420/bug4235420.java 8079127 generic-all
|
||||
javax/swing/JTable/6263446/bug6263446.java 8169959 macosx-all,windows-all
|
||||
@@ -1171,26 +1168,3 @@ tools/jlink/plugins/IncludeLocalesPluginTest.java
|
||||
tools/jlink/plugins/SystemModuleDescriptors/CompiledVersionTest.java nobug windows-6.1 fails on Windows 7 only
|
||||
tools/jlink/plugins/SystemModuleDescriptors/UserModuleTest.java nobug windows-6.1 fails on Windows 7 only
|
||||
tools/launcher/modules/patch/systemmodules/PatchSystemModules.java nobug windows-6.1 fails on Windows 7 only
|
||||
|
||||
# aarch64: GTK look and feel - not supported
|
||||
java/awt/Component/DimensionEncapsulation/DimensionEncapsulation.java JBR-1977 linux-aarch64
|
||||
java/awt/Component/InsetsEncapsulation/InsetsEncapsulation.java JBR-1977 linux-aarch64
|
||||
javax/swing/JColorChooser/Test6707406.java JBR-1977 linux-aarch64
|
||||
javax/swing/JFileChooser/8013442/Test8013442.java JBR-1977 linux-aarch64
|
||||
javax/swing/JInternalFrame/4769772/TestJInternalFrameIconify.java JBR-1977 linux-aarch64
|
||||
javax/swing/JInternalFrame/8075314/bug8075314.java JBR-1977 linux-aarch64
|
||||
javax/swing/JInternalFrame/NormalBoundsTest.java JBR-1977 linux-aarch64
|
||||
javax/swing/JList/BasicListTest.java JBR-1977 linux-aarch64
|
||||
javax/swing/JList/ListSelectionModelTest.java JBR-1977 linux-aarch64
|
||||
javax/swing/JMenuBar/MisplacedBorder/MisplacedBorder.java JBR-1977 linux-aarch64
|
||||
javax/swing/JMenuItem/8158566/CloseOnMouseClickPropertyTest.java JBR-1977 linux-aarch64
|
||||
javax/swing/JRootPane/SilenceOfDeprecatedMenuBar/SilenceOfDeprecatedMenuBar.java JBR-1977 linux-aarch64
|
||||
javax/swing/JScrollBar/7163696/Test7163696.java JBR-1977 linux-aarch64
|
||||
javax/swing/JSlider/6794831/bug6794831.java JBR-1977 linux-aarch64
|
||||
javax/swing/JSpinner/WrongEditorTextFieldFont/FontByDefault.java JBR-1977 linux-aarch64
|
||||
javax/swing/JSpinner/WrongEditorTextFieldFont/FontSetByUser.java JBR-1977 linux-aarch64
|
||||
javax/swing/JSpinner/WrongEditorTextFieldFont/FontSetToNull.java JBR-1977 linux-aarch64
|
||||
javax/swing/JTextArea/4697612/bug4697612.java JBR-1977 linux-aarch64
|
||||
javax/swing/LookAndFeel/8145547/DemandGTK.java JBR-1977 linux-aarch64
|
||||
javax/swing/LookAndFeel/8146276/NimbusGlueTest.java JBR-1977 linux-aarch64
|
||||
sanity/client/SwingSet/src/GridBagLayoutDemoTest.java JBR-1977 linux-aarch64
|
||||
@@ -52,7 +52,7 @@ java/awt/KeyboardFocusmanager/TypeAhead/EnqueueWithDialogTest/EnqueueWithDialogT
|
||||
java/awt/KeyboardFocusmanager/TypeAhead/MenuItemActivatedTest/MenuItemActivatedTest.html nobug windows-all reproduced with Adopt
|
||||
java/awt/LightweightDispatcher/LWDispatcherMemoryLeakTest.java nobug windows-all
|
||||
java/awt/List/ActionAfterRemove/ActionAfterRemove.java nobug windows-all
|
||||
java/awt/List/ActionEventTest/ActionEventTest.java nobug generic-all timeout
|
||||
java/awt/List/ActionEventTest/ActionEventTest.java nobug linux-all
|
||||
java/awt/List/EmptyListEventTest/EmptyListEventTest.java nobug windows-all
|
||||
java/awt/List/ItemEventTest/ItemEventTest.java nobug macosx-all,windows-all
|
||||
java/awt/List/NofocusListDblClickTest/NofocusListDblClickTest.java nobug macosx-all,windows-all
|
||||
@@ -104,7 +104,6 @@ java/awt/Window/SetWindowLocationByPlatformTest/SetWindowLocationByPlatformTest.
|
||||
java/awt/Window/ShapedAndTranslucentWindows/Translucent.java nobug windows-all,macosx-all
|
||||
java/awt/Window/ShapedAndTranslucentWindows/WindowOpacity.java nobug windows-all
|
||||
java/awt/Window/TopLevelLocation/TopLevelLocation.java nobug linux-all,macosx-all
|
||||
java/awt/Window/WindowDeadlockTest/WindowDeadlockTest.java nobug macosx-all timeout
|
||||
java/awt/Window/WindowOwnedByEmbeddedFrameTest/WindowOwnedByEmbeddedFrameTest.java nobug macosx-all
|
||||
java/awt/Window/WindowResizing/DoubleClickTitleBarTest.java nobug macosx-all
|
||||
java/awt/datatransfer/Independence/IndependenceAWTTest.java nobug linux-all
|
||||
@@ -185,7 +184,7 @@ javax/swing/JPopupMenu/6827786/bug6827786.java
|
||||
javax/swing/JProgressBar/8015748/JProgressBarOrientationRobotTest.java nobug macosx-all,windows-all
|
||||
javax/swing/JRadioButton/8041561/bug8041561.java nobug windows-all
|
||||
javax/swing/JScrollBar/7163696/Test7163696.java nobug windows-all
|
||||
javax/swing/JScrollBar/bug4202954/bug4202954.java nobug generic-all timeout
|
||||
javax/swing/JScrollBar/bug4202954/bug4202954.java nobug windows-all
|
||||
javax/swing/JSlider/6401380/bug6401380.java nobug windows-all
|
||||
javax/swing/JTabbedPane/7161568/bug7161568.java nobug windows-all,linux-all
|
||||
javax/swing/JTabbedPane/7170310/bug7170310.java nobug macosx-all,linux-all
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
###Tips for compiling libraries and preparing env for test running
|
||||
|
||||
|
||||
## Linux
|
||||
|
||||
prepare env for work with uinput: [group permissions](https://github.com/tuomasjjrasanen/python-uinput/issues/6#issuecomment-538710069)
|
||||
|
||||
```shell script
|
||||
cd JetBrainsRuntime/test/jdk/jbu/native
|
||||
# complile lib
|
||||
gcc -shared -fPIC -I<path_to_jdk>/JetBrainsRuntime/build/linux-x86_64-normal-server-release/images/jdk/include/linux -I<path_to_jdk>/JetBrainsRuntime/build/linux-x86_64-normal-server-release/images/jdk/include touchscreen_device.c -o libtouchscreen_device.so
|
||||
```
|
||||
|
||||
In IDEA run configurations set envvar to find libtouchscreen_device.so
|
||||
```
|
||||
LD_LIBRARY_PATH=<path_to_jdk>\JetBrainsRuntime\test\jdk\jbu\native
|
||||
```
|
||||
|
||||
## Windows
|
||||
|
||||
prepare windows env: look for vcvarsall.bat [here](https://github.com/JetBrains/JetBrainsRuntime#windows)
|
||||
```
|
||||
cd JetBrainsRuntime\test\jdk\jbu\native
|
||||
cl -I<path_to_jdk>\JetBrainsRuntime\build\windows-x86_64-normal-server-release\jdk\include\win32 -I<path_to_jdk>\JetBrainsRuntime\build\windows-x86_64-normal-server-release\jdk\include -MD -LD windows_touch_robot.c "<path_to_user32lib>\user32.lib" -Fewindows_touch_robot.dll
|
||||
```
|
||||
|
||||
user32.lib is needed for WinUser.h (touch injection stuff)
|
||||
|
||||
In IDEA run configurations set envvar to find windows_touch_robot.dll
|
||||
```
|
||||
PATH="<path_to_jdk>\JetBrainsRuntime\test\jdk\jbu\native"
|
||||
```
|
||||
|
||||
my paths are
|
||||
```
|
||||
user32: "C:\Program Files (x86)\Windows Kits\10\Lib\10.0.18362.0\um\x64\user32.lib"
|
||||
path_to_jdk: "C:\Program_Files\cygwin64\home\Denis.Konoplev"
|
||||
```
|
||||
@@ -1,205 +0,0 @@
|
||||
#include <jni.h>
|
||||
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <linux/input.h>
|
||||
#include <linux/types.h>
|
||||
#include <linux/uinput.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
|
||||
// TODO sort includes
|
||||
// TODO add casts
|
||||
|
||||
typedef struct {
|
||||
__u16 type;
|
||||
__u16 code;
|
||||
__s32 value;
|
||||
} TEventData;
|
||||
|
||||
static int set_bit(int fd, unsigned long int request, unsigned long int bit) {
|
||||
return ioctl(fd, request, bit);
|
||||
}
|
||||
|
||||
static int touch_begin(int fd, int tracking_id, int x, int y) {
|
||||
struct input_event ev;
|
||||
|
||||
const int cnt = 7;
|
||||
TEventData eventData[7] = {{EV_ABS, ABS_MT_TRACKING_ID, tracking_id},
|
||||
{EV_ABS, ABS_MT_POSITION_X, x},
|
||||
{EV_ABS, ABS_MT_POSITION_Y, y},
|
||||
{EV_KEY, BTN_TOUCH, 1},
|
||||
{EV_ABS, ABS_X, x},
|
||||
{EV_ABS, ABS_Y, y},
|
||||
{EV_SYN, 0, 0}};
|
||||
|
||||
for (int i = 0; i < cnt; i++) {
|
||||
memset(&ev, 0, sizeof(struct input_event));
|
||||
ev.type = eventData[i].type;
|
||||
ev.code = eventData[i].code;
|
||||
ev.value = eventData[i].value;
|
||||
|
||||
if (write(fd, &ev, sizeof(struct input_event)) < 0) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int touch_update(int fd, int x, int y) {
|
||||
struct input_event ev;
|
||||
|
||||
const int cnt = 5;
|
||||
TEventData eventData[5] = {{EV_ABS, ABS_MT_POSITION_X, x},
|
||||
{EV_ABS, ABS_MT_POSITION_Y, y},
|
||||
{EV_ABS, ABS_X, x},
|
||||
{EV_ABS, ABS_Y, y},
|
||||
{EV_SYN, 0, 0}};
|
||||
|
||||
for (int i = 0; i < cnt; i++) {
|
||||
memset(&ev, 0, sizeof(struct input_event));
|
||||
ev.type = eventData[i].type;
|
||||
ev.code = eventData[i].code;
|
||||
ev.value = eventData[i].value;
|
||||
|
||||
if (write(fd, &ev, sizeof(struct input_event)) < 0) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// todo consider different name in case of multitouch
|
||||
static int touch_end(int fd) {
|
||||
struct input_event ev;
|
||||
|
||||
const int cnt = 3;
|
||||
TEventData eventData[3] = {
|
||||
{EV_ABS, ABS_MT_TRACKING_ID, -1}, {EV_KEY, BTN_TOUCH, 0}, {EV_SYN, 0, 0}};
|
||||
|
||||
for (int i = 0; i < cnt; i++) {
|
||||
memset(&ev, 0, sizeof(struct input_event));
|
||||
ev.type = eventData[i].type;
|
||||
ev.code = eventData[i].code;
|
||||
ev.value = eventData[i].value;
|
||||
|
||||
if (write(fd, &ev, sizeof(struct input_event)) < 0) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: quality_util_TouchScreenDevice
|
||||
* Method: create
|
||||
* Signature: ()I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_quality_util_UnixTouchScreenDevice_create(JNIEnv *env,
|
||||
jobject o,
|
||||
jint width,
|
||||
jint height) {
|
||||
int productId = 123;
|
||||
const int FAKE_VENDOR_ID = 0x453;
|
||||
const int MAX_FINGER_COUNT = 9;
|
||||
const int MAX_TRACKING_ID = 65535;
|
||||
|
||||
int fd = open("/dev/uinput", O_WRONLY | O_NONBLOCK);
|
||||
if (fd < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
int ret_code = 0;
|
||||
ret_code = set_bit(fd, UI_SET_EVBIT, EV_SYN);
|
||||
ret_code = set_bit(fd, UI_SET_EVBIT, EV_KEY);
|
||||
ret_code = set_bit(fd, UI_SET_KEYBIT, BTN_TOUCH);
|
||||
ret_code = set_bit(fd, UI_SET_EVBIT, EV_ABS);
|
||||
ret_code = set_bit(fd, UI_SET_ABSBIT, ABS_X);
|
||||
ret_code = set_bit(fd, UI_SET_ABSBIT, ABS_Y);
|
||||
ret_code = set_bit(fd, UI_SET_ABSBIT, ABS_MT_SLOT);
|
||||
ret_code = set_bit(fd, UI_SET_ABSBIT, ABS_MT_POSITION_X);
|
||||
ret_code = set_bit(fd, UI_SET_ABSBIT, ABS_MT_POSITION_Y);
|
||||
ret_code = set_bit(fd, UI_SET_ABSBIT, ABS_MT_TRACKING_ID);
|
||||
ret_code = set_bit(fd, UI_SET_PROPBIT, INPUT_PROP_DIRECT);
|
||||
|
||||
if (ret_code < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
struct uinput_user_dev virtual_touch_device;
|
||||
memset(&virtual_touch_device, 0, sizeof(virtual_touch_device));
|
||||
snprintf(virtual_touch_device.name, UINPUT_MAX_NAME_SIZE,
|
||||
"Virtual Touch Device - %#x", productId);
|
||||
virtual_touch_device.id.bustype = BUS_VIRTUAL;
|
||||
virtual_touch_device.id.vendor = FAKE_VENDOR_ID;
|
||||
virtual_touch_device.id.product = productId;
|
||||
virtual_touch_device.id.version = 1;
|
||||
|
||||
virtual_touch_device.absmin[ABS_X] = 0;
|
||||
virtual_touch_device.absmax[ABS_X] = width;
|
||||
virtual_touch_device.absmin[ABS_Y] = 0;
|
||||
virtual_touch_device.absmax[ABS_Y] = height;
|
||||
virtual_touch_device.absmin[ABS_MT_SLOT] = 0;
|
||||
virtual_touch_device.absmax[ABS_MT_SLOT] = MAX_FINGER_COUNT;
|
||||
virtual_touch_device.absmin[ABS_MT_POSITION_X] = 0;
|
||||
virtual_touch_device.absmax[ABS_MT_POSITION_X] = width;
|
||||
virtual_touch_device.absmin[ABS_MT_POSITION_Y] = 0;
|
||||
virtual_touch_device.absmax[ABS_MT_POSITION_Y] = height;
|
||||
virtual_touch_device.absmin[ABS_MT_TRACKING_ID] = 0;
|
||||
virtual_touch_device.absmax[ABS_MT_TRACKING_ID] = MAX_TRACKING_ID;
|
||||
|
||||
ret_code = write(fd, &virtual_touch_device, sizeof(virtual_touch_device));
|
||||
ret_code = ioctl(fd, UI_DEV_CREATE);
|
||||
if (ret_code < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
return fd;
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: quality_util_TouchScreenDevice
|
||||
* Method: destroy
|
||||
* Signature: (I)V
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_quality_util_UnixTouchScreenDevice_destroy(JNIEnv *env,
|
||||
jobject o,
|
||||
jint fd) {
|
||||
if (ioctl(fd, UI_DEV_DESTROY) < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
return close(fd);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: quality_util_TouchScreenDevice
|
||||
* Method: clickImpl
|
||||
* Signature: (IIII)V
|
||||
*/
|
||||
// todo return code with checked exception
|
||||
JNIEXPORT jint JNICALL Java_quality_util_UnixTouchScreenDevice_clickImpl(
|
||||
JNIEnv *env, jobject o, jint fd, jint trackingId, jint x, jint y) {
|
||||
touch_begin(fd, trackingId, x, y);
|
||||
touch_end(fd);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: quality_util_TouchScreenDevice
|
||||
* Method: moveImpl
|
||||
* Signature: (IIIIII)V
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_quality_util_UnixTouchScreenDevice_moveImpl(
|
||||
JNIEnv *env, jobject o, jint fd, jint trackingId, jint fromX, jint fromY,
|
||||
jint toX, jint toY) {
|
||||
touch_begin(fd, trackingId, fromX, fromY);
|
||||
touch_update(fd, toX, toY);
|
||||
touch_end(fd);
|
||||
return 0;
|
||||
}
|
||||
@@ -1,84 +0,0 @@
|
||||
#include <jni.h>
|
||||
|
||||
#include <windows.h>
|
||||
#include <WinUser.h>
|
||||
|
||||
POINTER_TOUCH_INFO create_touch_info()
|
||||
{
|
||||
POINTER_TOUCH_INFO contact;
|
||||
InitializeTouchInjection(1, TOUCH_FEEDBACK_DEFAULT); // Number of contact point
|
||||
memset(&contact, 0, sizeof(POINTER_TOUCH_INFO));
|
||||
|
||||
contact.touchFlags = TOUCH_FLAG_NONE;
|
||||
contact.touchMask = TOUCH_MASK_CONTACTAREA | TOUCH_MASK_ORIENTATION | TOUCH_MASK_PRESSURE;
|
||||
contact.orientation = 90; // Orientation of 90 means touching perpendicular to screen.
|
||||
contact.pressure = 32000;
|
||||
|
||||
return contact;
|
||||
}
|
||||
|
||||
void set_contact_area(POINTER_TOUCH_INFO *contact)
|
||||
{
|
||||
// 4 x 4 pixel contact area
|
||||
contact->rcContact.top = contact->pointerInfo.ptPixelLocation.y - 2;
|
||||
contact->rcContact.bottom = contact->pointerInfo.ptPixelLocation.y + 2;
|
||||
contact->rcContact.left = contact->pointerInfo.ptPixelLocation.x - 2;
|
||||
contact->rcContact.right = contact->pointerInfo.ptPixelLocation.x + 2;
|
||||
}
|
||||
|
||||
void touchBegin(POINTER_TOUCH_INFO* contact, LONG x, LONG y)
|
||||
{
|
||||
contact->pointerInfo.pointerType = PT_TOUCH;
|
||||
// primary finger pointerId == 0
|
||||
contact->pointerInfo.pointerId = 0;
|
||||
contact->pointerInfo.ptPixelLocation.x = x;
|
||||
contact->pointerInfo.ptPixelLocation.y = y;
|
||||
set_contact_area(contact);
|
||||
|
||||
contact->pointerInfo.pointerFlags = POINTER_FLAG_DOWN | POINTER_FLAG_INRANGE | POINTER_FLAG_INCONTACT;
|
||||
InjectTouchInput(1, contact);
|
||||
}
|
||||
|
||||
void touchUpdate(POINTER_TOUCH_INFO* contact, LONG x, LONG y)
|
||||
{
|
||||
contact->pointerInfo.pointerFlags = POINTER_FLAG_UPDATE | POINTER_FLAG_INRANGE | POINTER_FLAG_INCONTACT;
|
||||
contact->pointerInfo.ptPixelLocation.x = x;
|
||||
contact->pointerInfo.ptPixelLocation.y = y;
|
||||
InjectTouchInput(1, contact);
|
||||
}
|
||||
|
||||
void touchEnd(POINTER_TOUCH_INFO* contact)
|
||||
{
|
||||
contact->pointerInfo.pointerFlags = POINTER_FLAG_UP;
|
||||
InjectTouchInput(1, contact);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: quality_util_WindowsTouchRobot
|
||||
* Method: clickImpl
|
||||
* Signature: (II)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_quality_util_WindowsTouchRobot_clickImpl(JNIEnv* env, jobject o,
|
||||
jint x, jint y)
|
||||
{
|
||||
POINTER_TOUCH_INFO contact = create_touch_info();
|
||||
touchBegin(&contact, x, y);
|
||||
touchEnd(&contact);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: quality_util_WindowsTouchRobot
|
||||
* Method: moveImpl
|
||||
* Signature: (IIII)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_quality_util_WindowsTouchRobot_moveImpl(JNIEnv* env, jobject o,
|
||||
jint fromX, jint fromY,
|
||||
jint toX, jint toY)
|
||||
{
|
||||
POINTER_TOUCH_INFO contact = create_touch_info();
|
||||
touchBegin(&contact, fromX, fromY);
|
||||
touchUpdate(&contact, toX, toY);
|
||||
touchEnd(&contact);
|
||||
}
|
||||
@@ -1,338 +0,0 @@
|
||||
package quality.event;
|
||||
|
||||
import org.apache.commons.lang3.SystemUtils;
|
||||
import org.junit.Test;
|
||||
import quality.util.UnixTouchRobot;
|
||||
import quality.util.TouchRobot;
|
||||
import quality.util.WindowsTouchRobot;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
import java.io.IOException;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
public class TouchScreenEventsTest {
|
||||
static final int TIMEOUT = 2;
|
||||
// TODO make this constants accessible within jdk
|
||||
static final int TOUCH_BEGIN = 2;
|
||||
static final int TOUCH_UPDATE = 3;
|
||||
static final int TOUCH_END = 4;
|
||||
|
||||
@Test
|
||||
public void testTouchClick() throws Exception {
|
||||
runTest(new TouchClickSuite());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTouchMove() throws Exception {
|
||||
runTest(new TouchMoveSuite());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTouchTinyMove() throws Exception {
|
||||
runTest(new TouchTinyMoveSuite());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTouchHorizontalScroll() throws Exception {
|
||||
runTest(new TouchAxesScrollSuite(TouchAxesScrollSuite.AXIS.X));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTouchVerticalScroll() throws Exception {
|
||||
runTest(new TouchAxesScrollSuite(TouchAxesScrollSuite.AXIS.Y));
|
||||
}
|
||||
|
||||
private static void runTest(TouchTestSuite suite) throws Exception {
|
||||
GUI gui = new GUI();
|
||||
try {
|
||||
TouchRobot robot = getTouchRobot();
|
||||
SwingUtilities.invokeAndWait(gui::createAndShow);
|
||||
suite.addListener(gui.frame);
|
||||
robot.waitForIdle();
|
||||
|
||||
suite.perform(gui, robot);
|
||||
robot.waitForIdle();
|
||||
suite.passed();
|
||||
} finally {
|
||||
SwingUtilities.invokeLater(() -> {
|
||||
if (gui.frame != null) {
|
||||
gui.frame.dispose();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private static TouchRobot getTouchRobot() throws IOException, AWTException {
|
||||
if (SystemUtils.IS_OS_UNIX) {
|
||||
return new UnixTouchRobot();
|
||||
} else if (SystemUtils.IS_OS_WINDOWS) {
|
||||
return new WindowsTouchRobot();
|
||||
}
|
||||
throw new RuntimeException("Touch robot for this platform isn't implemented");
|
||||
}
|
||||
}
|
||||
|
||||
class GUI {
|
||||
JFrame frame;
|
||||
Rectangle frameBounds;
|
||||
|
||||
void createAndShow() {
|
||||
frame = new JFrame();
|
||||
frame.setSize(640, 480);
|
||||
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
frame.setVisible(true);
|
||||
frameBounds = frame.getBounds();
|
||||
}
|
||||
}
|
||||
|
||||
interface TouchTestSuite {
|
||||
void perform(GUI gui, TouchRobot robot) throws IOException;
|
||||
|
||||
void passed() throws InterruptedException;
|
||||
|
||||
void addListener(JFrame frame);
|
||||
}
|
||||
|
||||
class TouchClickSuite implements MouseListener, TouchTestSuite {
|
||||
private volatile boolean pressed;
|
||||
private volatile boolean released;
|
||||
private volatile boolean clicked;
|
||||
private final CountDownLatch latch = new CountDownLatch(3);
|
||||
|
||||
@Override
|
||||
public void mouseClicked(MouseEvent e) {
|
||||
if (!clicked) {
|
||||
clicked = true;
|
||||
latch.countDown();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mousePressed(MouseEvent e) {
|
||||
pressed = true;
|
||||
if (!pressed) {
|
||||
pressed = true;
|
||||
latch.countDown();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseReleased(MouseEvent e) {
|
||||
if (!released) {
|
||||
released = true;
|
||||
latch.countDown();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseEntered(MouseEvent e) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseExited(MouseEvent e) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void perform(GUI gui, TouchRobot robot) throws IOException {
|
||||
int x = gui.frameBounds.x + gui.frameBounds.width / 2;
|
||||
int y = gui.frameBounds.y + gui.frameBounds.height / 2;
|
||||
robot.touchClick(42, x, y);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void passed() throws InterruptedException {
|
||||
latch.await(TouchScreenEventsTest.TIMEOUT, TimeUnit.SECONDS);
|
||||
if (!pressed || !released || !clicked) {
|
||||
String error = (pressed ? "" : "pressed: " + pressed) +
|
||||
(released ? "" : ", released: " + released) +
|
||||
(clicked ? "" : ", clicked: " + clicked);
|
||||
throw new RuntimeException("Touch click failed: " + error);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addListener(JFrame frame) {
|
||||
frame.addMouseListener(this);
|
||||
}
|
||||
}
|
||||
|
||||
class TouchMoveSuite implements MouseWheelListener, TouchTestSuite {
|
||||
private volatile boolean begin;
|
||||
private volatile boolean update;
|
||||
private volatile boolean end;
|
||||
private final CountDownLatch latch = new CountDownLatch(3);
|
||||
|
||||
@Override
|
||||
public void mouseWheelMoved(MouseWheelEvent e) {
|
||||
if (e.getScrollType() == TouchScreenEventsTest.TOUCH_BEGIN) {
|
||||
if (!begin) {
|
||||
begin = true;
|
||||
latch.countDown();
|
||||
}
|
||||
} else if (e.getScrollType() == TouchScreenEventsTest.TOUCH_UPDATE) {
|
||||
if (!update) {
|
||||
update = true;
|
||||
latch.countDown();
|
||||
}
|
||||
} else if (e.getScrollType() == TouchScreenEventsTest.TOUCH_END) {
|
||||
if (!end) {
|
||||
end = true;
|
||||
latch.countDown();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void perform(GUI gui, TouchRobot robot) throws IOException {
|
||||
int x1 = gui.frameBounds.x + gui.frameBounds.width / 4;
|
||||
int y1 = gui.frameBounds.y + gui.frameBounds.height / 4;
|
||||
int x2 = gui.frameBounds.x + gui.frameBounds.width / 2;
|
||||
int y2 = gui.frameBounds.y + gui.frameBounds.height / 2;
|
||||
robot.touchMove(42, x1, y1, x2, y2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void passed() throws InterruptedException {
|
||||
latch.await(TouchScreenEventsTest.TIMEOUT, TimeUnit.SECONDS);
|
||||
if (!begin || !update || !end) {
|
||||
String error = (begin ? "" : "begin: " + begin) +
|
||||
(update ? "" : ", update: " + update) +
|
||||
(end ? "" : ", end: " + end);
|
||||
throw new RuntimeException("Touch move failed: " + error);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addListener(JFrame frame) {
|
||||
frame.addMouseWheelListener(this);
|
||||
}
|
||||
}
|
||||
|
||||
class TouchTinyMoveSuite implements MouseWheelListener, MouseListener, TouchTestSuite {
|
||||
private volatile boolean scroll;
|
||||
private volatile boolean click;
|
||||
private final CountDownLatch latch = new CountDownLatch(1);
|
||||
|
||||
@Override
|
||||
public void mouseWheelMoved(MouseWheelEvent e) {
|
||||
if (e.getScrollType() == TouchScreenEventsTest.TOUCH_UPDATE) {
|
||||
scroll = true;
|
||||
latch.countDown();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void perform(GUI gui, TouchRobot robot) throws IOException {
|
||||
int x1 = gui.frameBounds.x + gui.frameBounds.width / 4;
|
||||
int y1 = gui.frameBounds.y + gui.frameBounds.height / 4;
|
||||
// move inside tiny area
|
||||
int x2 = x1 + 1;
|
||||
int y2 = y1 + 1;
|
||||
robot.touchMove(42, x1, y1, x2, y2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void passed() throws InterruptedException {
|
||||
latch.await(TouchScreenEventsTest.TIMEOUT, TimeUnit.SECONDS);
|
||||
if (scroll || !click) {
|
||||
String error = (scroll ? "scroll " + scroll : "") +
|
||||
(click ? "" : ", click: " + click);
|
||||
throw new RuntimeException("Tiny touch move failed: " + error);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addListener(JFrame frame) {
|
||||
frame.addMouseWheelListener(this);
|
||||
frame.addMouseListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseClicked(MouseEvent e) {
|
||||
click = true;
|
||||
latch.countDown();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mousePressed(MouseEvent e) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseReleased(MouseEvent e) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseEntered(MouseEvent e) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseExited(MouseEvent e) {
|
||||
}
|
||||
}
|
||||
|
||||
class TouchAxesScrollSuite implements MouseWheelListener, TouchTestSuite {
|
||||
enum AXIS {X, Y}
|
||||
|
||||
private final AXIS axis;
|
||||
private volatile boolean vertical;
|
||||
private volatile boolean horizontal;
|
||||
private final CountDownLatch latch = new CountDownLatch(1);
|
||||
|
||||
TouchAxesScrollSuite(AXIS axis) {
|
||||
this.axis = axis;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseWheelMoved(MouseWheelEvent e) {
|
||||
if (e.getScrollType() == TouchScreenEventsTest.TOUCH_UPDATE) {
|
||||
if (e.isShiftDown()) {
|
||||
horizontal = true;
|
||||
} else {
|
||||
vertical = true;
|
||||
}
|
||||
latch.countDown();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void perform(GUI gui, TouchRobot robot) throws IOException {
|
||||
int x1 = gui.frameBounds.x + gui.frameBounds.width / 4;
|
||||
int y1 = gui.frameBounds.y + gui.frameBounds.height / 4;
|
||||
switch (axis) {
|
||||
case X:
|
||||
int x2 = gui.frameBounds.x + gui.frameBounds.width / 2;
|
||||
robot.touchMove(42, x1, y1, x2, y1);
|
||||
break;
|
||||
case Y:
|
||||
int y2 = gui.frameBounds.y + gui.frameBounds.height / 2;
|
||||
robot.touchMove(42, x1, y1, x1, y2);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void passed() throws InterruptedException {
|
||||
latch.await(TouchScreenEventsTest.TIMEOUT, TimeUnit.SECONDS);
|
||||
String error = "horizontal " + horizontal + ", vertical: " + vertical;
|
||||
switch (axis) {
|
||||
case X:
|
||||
if (!horizontal || vertical) {
|
||||
throw new RuntimeException("Touch axes failed: " + error);
|
||||
}
|
||||
break;
|
||||
case Y:
|
||||
if (horizontal || !vertical) {
|
||||
throw new RuntimeException("Touch axes failed: " + error);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addListener(JFrame frame) {
|
||||
frame.addMouseWheelListener(this);
|
||||
}
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
package quality.util;
|
||||
|
||||
import java.awt.*;
|
||||
import java.io.IOException;
|
||||
|
||||
public abstract class TouchRobot extends Robot {
|
||||
public TouchRobot() throws AWTException {
|
||||
}
|
||||
|
||||
public TouchRobot(GraphicsDevice screen) throws AWTException {
|
||||
super(screen);
|
||||
}
|
||||
|
||||
public abstract void touchClick(int fingerId, int x, int y) throws IOException;
|
||||
|
||||
public abstract void touchMove(int fingerId, int fromX, int fromY, int toX, int toY) throws IOException;
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
package quality.util;
|
||||
|
||||
import java.awt.*;
|
||||
import java.io.IOException;
|
||||
|
||||
public class UnixTouchRobot extends TouchRobot {
|
||||
private UnixTouchScreenDevice device;
|
||||
|
||||
public UnixTouchRobot() throws AWTException, IOException {
|
||||
super();
|
||||
device = new UnixTouchScreenDevice();
|
||||
}
|
||||
|
||||
public UnixTouchRobot(GraphicsDevice screen) throws AWTException, IOException {
|
||||
super(screen);
|
||||
device = new UnixTouchScreenDevice();
|
||||
}
|
||||
|
||||
public void touchClick(int fingerId, int x, int y) throws IOException {
|
||||
device.click(fingerId, x, y);
|
||||
}
|
||||
|
||||
public void touchMove(int fingerId, int fromX, int fromY, int toX, int toY) throws IOException {
|
||||
device.move(fingerId, fromX, fromY, toX, toY);
|
||||
}
|
||||
}
|
||||
@@ -1,68 +0,0 @@
|
||||
package quality.util;
|
||||
|
||||
import java.awt.*;
|
||||
import java.io.IOException;
|
||||
|
||||
public class UnixTouchScreenDevice implements AutoCloseable {
|
||||
// TODO add product id
|
||||
private int width;
|
||||
private int height;
|
||||
private int fileDescriptor;
|
||||
|
||||
static {
|
||||
System.loadLibrary("touchscreen_device");
|
||||
}
|
||||
|
||||
public UnixTouchScreenDevice() throws IOException {
|
||||
this(Toolkit.getDefaultToolkit().getScreenSize().width, Toolkit.getDefaultToolkit().getScreenSize().height);
|
||||
}
|
||||
|
||||
public UnixTouchScreenDevice(int width, int height) throws IOException {
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
fileDescriptor = create(getWidth(), getHeight());
|
||||
checkCompletion(fileDescriptor,
|
||||
"Failed to create virtual touchscreen device");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() throws Exception {
|
||||
checkCompletion(destroy(fileDescriptor),
|
||||
"Failed to close touchscreen device");
|
||||
}
|
||||
|
||||
public int getWidth() {
|
||||
return width;
|
||||
}
|
||||
|
||||
public int getHeight() {
|
||||
return height;
|
||||
}
|
||||
|
||||
public void click(int trackingId, int x, int y) throws IOException {
|
||||
checkCompletion(clickImpl(fileDescriptor, trackingId, x, y),
|
||||
"Failed to click on touchscreen device");
|
||||
|
||||
}
|
||||
|
||||
public void move(int trackingId, int fromX, int fromY, int toX, int toY) throws IOException {
|
||||
checkCompletion(moveImpl(fileDescriptor, trackingId, fromX, fromY, toX, toY),
|
||||
"Failed to move on virtual touchscreen device");
|
||||
}
|
||||
|
||||
private void checkCompletion(int code, String errorMessage) throws IOException {
|
||||
if (code < 0) {
|
||||
throw new IOException(errorMessage);
|
||||
}
|
||||
}
|
||||
|
||||
private native int create(int width, int height);
|
||||
|
||||
private native int destroy(int fd);
|
||||
|
||||
private native int clickImpl(int fd, int trackingId, int x, int y);
|
||||
|
||||
private native int moveImpl(int fd, int trackingId, int fromX, int fromY, int toX, int toY);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
package quality.util;
|
||||
|
||||
import java.awt.*;
|
||||
import java.io.IOException;
|
||||
|
||||
public class WindowsTouchRobot extends TouchRobot {
|
||||
static {
|
||||
System.loadLibrary("windows_touch_robot");
|
||||
}
|
||||
|
||||
public WindowsTouchRobot() throws AWTException, IOException {
|
||||
super();
|
||||
}
|
||||
|
||||
public WindowsTouchRobot(GraphicsDevice screen) throws AWTException, IOException {
|
||||
super(screen);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void touchClick(int fingerId, int x, int y) throws IOException {
|
||||
// TODO unused finger id cause windows use different finger id model
|
||||
clickImpl(x, y);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void touchMove(int fingerId, int fromX, int fromY, int toX, int toY) throws IOException {
|
||||
// TODO unused finger id cause windows use different finger id model
|
||||
moveImpl(fromX, fromY, toX, toY);
|
||||
}
|
||||
|
||||
private native void clickImpl(int x, int y);
|
||||
|
||||
private native void moveImpl(int fromX, int fromY, int toX, int toY);
|
||||
}
|
||||
Reference in New Issue
Block a user