Navigation Menu

Skip to content

Commit

Permalink
7194219: java/awt/Component/UpdatingBootTime/UpdatingBootTime.html fa…
Browse files Browse the repository at this point in the history
…ils on Linux

Reviewed-by: aivanov
  • Loading branch information
mrserb committed Jan 12, 2021
1 parent 77f6290 commit 61c5b95
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 45 deletions.
34 changes: 0 additions & 34 deletions src/java.desktop/unix/classes/sun/awt/X11/XToolkit.java
Expand Up @@ -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
*/
Expand Down
13 changes: 5 additions & 8 deletions src/java.desktop/unix/classes/sun/awt/X11/XWindow.java
Expand Up @@ -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());
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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(),
Expand All @@ -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,
Expand Down Expand Up @@ -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(),
Expand Down Expand Up @@ -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,
Expand Down
1 change: 0 additions & 1 deletion test/jdk/ProblemList.txt
Expand Up @@ -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
Expand Down
Expand Up @@ -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
Expand Down
Expand Up @@ -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
Expand Down

1 comment on commit 61c5b95

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.