Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
7194219: java/awt/Component/UpdatingBootTime/UpdatingBootTime.html fa…
…ils on Linux

Reviewed-by: aivanov
  • Loading branch information
mrserb committed Jan 12, 2021
1 parent 77f6290 commit 61c5b95b0d890771cf80b8b63862ede3a2f2cff3
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 45 deletions.
@@ -2041,40 +2041,6 @@ static boolean isRightMouseButton(MouseEvent me) {
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
*/
@@ -682,7 +682,7 @@ public void handleButtonPressRelease(XEvent xev) {
}
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 @@ public void handleMotionNotify(XEvent xev) {
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 @@ public void handleXCrossingEvent(XEvent xev) {
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 @@ final void handleKeyPress(XKeyEvent ev) {
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 @@ final void handleKeyPress(XKeyEvent ev) {
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 @@ private void handleKeyRelease(XKeyEvent ev) {
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 @@ static void setBData(KeyEvent e, byte[] data) {
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,
@@ -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
@@ -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
@@ -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

0 comments on commit 61c5b95

Please sign in to comment.