7194219: java/awt/Component/UpdatingBootTime/UpdatingBootTime.html fails on Linux

Reviewed-by: aivanov
This commit is contained in:
Sergey Bylokhov 2021-01-12 06:53:17 +00:00
parent 77f6290995
commit 61c5b95b0d
5 changed files with 7 additions and 45 deletions

View File

@ -2041,40 +2041,6 @@ public final class XToolkit extends UNIXToolkit implements Runnable {
return false;
}
static long reset_time_utc;
static final long WRAP_TIME_MILLIS = 0x00000000FFFFFFFFL;
/*
* This function converts between the X server time (number of milliseconds
* since the last server reset) and the UTC time for the 'when' field of an
* InputEvent (or another event type with a timestamp).
*/
static long nowMillisUTC_offset(long server_offset) {
// ported from awt_util.c
/*
* Because Time is of type 'unsigned long', it is possible that Time will
* never wrap when using 64-bit Xlib. However, if a 64-bit client
* connects to a 32-bit server, I suspect the values will still wrap. So
* we should not attempt to remove the wrap checking even if _LP64 is
* true.
*/
long current_time_utc = System.currentTimeMillis();
if (log.isLoggable(PlatformLogger.Level.FINER)) {
log.finer("reset_time=" + reset_time_utc + ", current_time=" + current_time_utc
+ ", server_offset=" + server_offset + ", wrap_time=" + WRAP_TIME_MILLIS);
}
if ((current_time_utc - reset_time_utc) > WRAP_TIME_MILLIS) {
reset_time_utc = System.currentTimeMillis() - getCurrentServerTime();
}
if (log.isLoggable(PlatformLogger.Level.FINER)) {
log.finer("result = " + (reset_time_utc + server_offset));
}
return reset_time_utc + server_offset;
}
/**
* @see sun.awt.SunToolkit#needsXEmbedImpl
*/

View File

@ -682,7 +682,7 @@ class XWindow extends XBaseWindow implements X11ComponentPeer {
}
int type = xev.get_type();
when = xbe.get_time();
long jWhen = XToolkit.nowMillisUTC_offset(when);
long jWhen = System.currentTimeMillis();
int x = scaleDown(xbe.get_x());
int y = scaleDown(xbe.get_y());
@ -830,7 +830,7 @@ class XWindow extends XBaseWindow implements X11ComponentPeer {
lastY = 0;
}
long jWhen = XToolkit.nowMillisUTC_offset(xme.get_time());
long jWhen = System.currentTimeMillis();
int modifiers = getModifiers(xme.get_state(), 0, 0);
boolean popupTrigger = false;
@ -957,7 +957,7 @@ class XWindow extends XBaseWindow implements X11ComponentPeer {
return;
}
long jWhen = XToolkit.nowMillisUTC_offset(xce.get_time());
long jWhen = System.currentTimeMillis();
int modifiers = getModifiers(xce.get_state(),0,0);
int clickCount = 0;
boolean popupTrigger = false;
@ -1172,7 +1172,6 @@ class XWindow extends XBaseWindow implements X11ComponentPeer {
primaryUnicode2JavaKeycode( unicodeFromPrimaryKeysym ) :
jkc.getJavaKeycode();
postKeyEvent( java.awt.event.KeyEvent.KEY_PRESSED,
ev.get_time(),
isDeadKey ? jkeyExtended : jkeyToReturn,
(unicodeKey == 0 ? java.awt.event.KeyEvent.CHAR_UNDEFINED : unicodeKey),
jkc.getKeyLocation(),
@ -1186,7 +1185,6 @@ class XWindow extends XBaseWindow implements X11ComponentPeer {
keyEventLog.fine("fire _TYPED on "+unicodeKey);
}
postKeyEvent( java.awt.event.KeyEvent.KEY_TYPED,
ev.get_time(),
java.awt.event.KeyEvent.VK_UNDEFINED,
unicodeKey,
java.awt.event.KeyEvent.KEY_LOCATION_UNKNOWN,
@ -1256,7 +1254,6 @@ class XWindow extends XBaseWindow implements X11ComponentPeer {
primaryUnicode2JavaKeycode( unicodeFromPrimaryKeysym ) :
jkc.getJavaKeycode();
postKeyEvent( java.awt.event.KeyEvent.KEY_RELEASED,
ev.get_time(),
isDeadKey ? jkeyExtended : jkeyToReturn,
(unicodeKey == 0 ? java.awt.event.KeyEvent.CHAR_UNDEFINED : unicodeKey),
jkc.getKeyLocation(),
@ -1470,12 +1467,12 @@ class XWindow extends XBaseWindow implements X11ComponentPeer {
AWTAccessor.getAWTEventAccessor().setBData(e, data);
}
public void postKeyEvent(int id, long when, int keyCode, int keyChar,
public void postKeyEvent(int id, int keyCode, int keyChar,
int keyLocation, int state, long event, int eventSize, long rawCode,
int unicodeFromPrimaryKeysym, int extendedKeyCode)
{
long jWhen = XToolkit.nowMillisUTC_offset(when);
long jWhen = System.currentTimeMillis();
int modifiers = getModifiers(state, 0, keyCode);
KeyEvent ke = new KeyEvent(getEventSource(), id, jWhen,

View File

@ -853,7 +853,6 @@ tools/jpackage/share/jdk/jpackage/tests/ModulePathTest3.java#id0 8248418 gene
java/awt/event/MouseEvent/SpuriousExitEnter/SpuriousExitEnter_1.java 7131438,8022539 generic-all
java/awt/event/MouseEvent/SpuriousExitEnter/SpuriousExitEnter_2.java 7131438,8022539 generic-all
java/awt/Modal/WsDisabledStyle/CloseBlocker/CloseBlocker.java 7187741 linux-all,macosx-all
java/awt/Component/UpdatingBootTime/UpdatingBootTime.html 7194219 linux-all
java/awt/xembed/server/TestXEmbedServerJava.java 8001150,8004031 generic-all
javax/swing/JFileChooser/6698013/bug6698013.java 8024419 macosx-all
javax/swing/JColorChooser/8065098/bug8065098.java 8065647 macosx-all

View File

@ -24,7 +24,7 @@
<html>
<!--
@test
@bug 6461933
@bug 6461933 7194219
@summary adjust system boot time in nowMillisUTC() frequently
@author Andrei Dmitriev : area=awt.component
@run applet/manual=yesno UpdatingBootTime.html

View File

@ -23,7 +23,7 @@
/*
test
@bug 6461933
@bug 6461933 7194219
@summary adjust system boot time in nowMillisUTC() frequently
@author Andrei Dmitriev : area=awt.component
@run applet/manual=yesno UpdatingBootTime.html