EVALUATION
This evaluation is for regression 7013024, 7013644
Here is my further understanding ...
When using the mouse the marker queue has the marker time incorrect for the components.
As you had asked me to watch the marker queue , here is the analysis based on that:
Scenario 1: using keyboard
==========================
When I use the keyboard, where the component with focus is javax.swing.JCheckBox , the marker queue looks as follows:
FINEST: >>> Markers dump, time: 1,299,702,715,093
FINEST: >>> Marker after 1299702714921 on com.sun.deploy.panel.CacheSettingsDialog[dialog0,273,127,476x364,layout=java.awt.BorderLayout,APPLICATION_MODAL,
title=Temporary Files Settings,defaultCloseOperation=HIDE_ON_CLOSE,rootPane=javax.swing.JRootPane[,3,29,470x332,layout=javax.swing.JRootPane$RootLayout,
alignmentX=0.0,alignmentY=0.0,border=,flags=16777673,maximumSize=,minimumSize=,preferredSize=],rootPaneCheckingEnabled=true]
FINEST: >>> Marker after 1299702714921 on javax.swing.JCheckBox[,12,12,209x23,alignmentX=0.0,alignmentY=0.5,border=javax.swing.plaf.BorderUIResource$
CompoundBorderUIResource@2e323,flags=424,maximumSize=,minimumSize=,preferredSize=,defaultIcon=,disabledIcon=,disabledSelectedIcon=,
margin=javax.swing.plaf.InsetsUIResource[top=2,left=2,bottom=2,right=2],paintBorder=false,paintFocus=true,pressedIcon=,rolloverEnabled=true,
rolloverIcon=,rolloverSelectedIcon=,selectedIcon=,text=Keep temporary files on my computer.]
When javax.swing.JCheckBox receives focus (FOCUS_GAINED) all markers in the queue are deleted up to the current match i.e javax.swing.JCheckBox itself.
So the marker queue is empty. And when the keyevent occurs it is correctly processed by javax.swing.JCheckBox the current item in focus.
Scenario 2: using mouse
========================
Here is where the problem is seen, when I use the mouse, the expected Focus on javax.swing.JCheckBox , the marker queue looks as follows:
The marker queue has typeAheadMarker 1) for the javax.swing.JCheckBox. first and 2) then for the com.sun.deploy.panel.CacheSettingsDialog,
where it should be 2 & 1.
This is due to incorrect time which is from Comonent.java#requestFocusHelper(), EventQueue.getMostRecentEventTime()
which is called to get the time and then used as 'after' in marker (also that time is passed to requestFocus() )
As this queue is created incorrectly due to the 'after' time, we see all the issues.
FINEST: >>> Markers dump, time: 1,299,546,458,093
FINEST: >>> Marker after 1299546455875 on javax.swing.JCheckBox[,12,12,209x23,alignmentX=0.0,alignmentY=0.5,border=javax.swing.plaf.
BorderUIResource$CompoundBorderUIResource@70610a,flags=424,maximumSize=,minimumSize=,preferredSize=,defaultIcon=,disabledIcon=,disabledSelectedIcon=,
margin=javax.swing.plaf.InsetsUIResource[top=2,left=2,bottom=2,right=2],paintBorder=false,paintFocus=true,pressedIcon=,rolloverEnabled=true,
rolloverIcon=,rolloverSelectedIcon=,selectedIcon=,text=Keep temporary files on my computer.]
FINEST: >>> Marker after 1299546457890 on com.sun.deploy.panel.CacheSettingsDialog[dialog0,273,130,476x364,layout=java.awt.BorderLayout,
APPLICATION_MODAL,title=Temporary Files Settings,defaultCloseOperation=HIDE_ON_CLOSE,rootPane=javax.swing.JRootPane[,3,29,470x332,
layout=javax.swing.JRootPane$RootLayout,alignmentX=0.0,alignmentY=0.0,border=,flags=16777673,maximumSize=,minimumSize=,preferredSize=],
rootPaneCheckingEnabled=true]
Now when FOCUS_GAINED is received by component javax.swing.JCheckBox, it deletes the markers in queue until it reaches its current matched component. So the
new queue looks as
FINEST: >>> Marker after 1299546457890 on com.sun.deploy.panel.CacheSettingsDialog[dialog0,273,130,476x364,layout=java.awt.BorderLayout,
APPLICATION_MODAL,title=Temporary Files Settings,defaultCloseOperation=HIDE_ON_CLOSE,rootPane=javax.swing.JRootPane[,3,29,470x332,
layout=javax.swing.JRootPane$RootLayout,alignmentX=0.0,alignmentY=0.0,border=,flags=16777673,maximumSize=,minimumSize=,preferredSize=],
rootPaneCheckingEnabled=true]
The current focussed component is javax.swing.JCheckBox, so when key is pressed and KeyEvent time is checked (see below), the
KeyEvent time (ke.time=1299546458843) is higher than the marker time(maker.after=1299546457890), so the KeyEvent is stored and not dispatched.
Mar 7, 2011 5:07:39 PM java.awt.DefaultKeyboardFocusManager pumpApprovedKeyEvents
FINER: DKFM: RP: ke.time=1299546458843 maker.after1299546457890
Mar 7, 2011 5:07:39 PM java.awt.DefaultKeyboardFocusManager typeAheadAssertions
FINER: Storing event java.awt.event.KeyEvent[KEY_RELEASED,keyCode=32,keyText=Space,keyChar=' ',keyLocation=KEY_LOCATION_STANDARD,rawCode=32,
primaryLevelUnicode=32,scancode=57] on dialog0 because of marker >>> Marker after 1299546457890 on com.sun.deploy.panel.CacheSettingsDialog[dialog0,
273,130,476x364,layout=java.awt.BorderLayout,APPLICATION_MODAL,title=Temporary Files Settings,defaultCloseOperation=HIDE_ON_CLOSE,rootPane=
javax.swing.JRootPane[,3,29,470x332,layout=javax.swing.JRootPane$RootLayout,alignmentX=0.0,alignmentY=0.0,border=,flags=16777673,maximumSize=,
minimumSize=,preferredSize=],rootPaneCheckingEnabled=true]
Scenario3 : using mouse: without fix for 6981400
===================================================
With backing out the fix of 6981400, when I use the mouse the queue has the entries as 1) CacheSettingsDialog and 2) JCheckBox next in the queue.
FINEST: >>> Marker after 1299798790250 on com.sun.deploy.panel.CacheSettingsDialog[dialog0,273,127,476x364,layout=java.awt.BorderLayout,
APPLICATION_MODAL,title=Temporary Files Settings,defaultCloseOperation=HIDE_ON_CLOSE,rootPane=javax.swing.JRootPane[,3,29,470x332,layout=
javax.swing.JRootPane$RootLayout,alignmentX=0.0,alignmentY=0.0,border=,flags=16777673,maximumSize=,minimumSize=,preferredSize=],rootPaneCheckingEnabled=true]
FINEST: >>> Marker after 1299798790375 on javax.swing.JCheckBox[,12,12,209x23,alignmentX=0.0,alignmentY=0.5,border=
javax.swing.plaf.BorderUIResource$CompoundBorderUIResource@e8a021,flags=424,maximumSize=,minimumSize=,preferredSize=,defaultIcon=,disabledIcon=,
disabledSelectedIcon=,margin=javax.swing.plaf.InsetsUIResource[top=2,left=2,bottom=2,right=2],paintBorder=false,paintFocus=true,pressedIcon=,
rolloverEnabled=true,rolloverIcon=,rolloverSelectedIcon=,selectedIcon=,text=Keep temporary files on my computer.]
To Fix:
======
So whether mouse or keyboard is used, adding an additional check in EventQueue:setCurrentEventAndMostRecentTimeImpl for MouseEvent, sets the time in the Marker queue correctly in
DKFM:enqueueKeyEvents.
if ((e instanceof KeyEvent) || (e instanceof MouseEvent)){
mostRecentKeyEventTime = ie.getWhen();
}
The initial fix (of 6981400) was to check for "if ((e instanceof KeyEvent) " modifying it to above to set the current time for KeyEvent or MouseEvent,
which is then passed in
Component.java, in requestFocusHelper(), to getMostRecentKeyEventTime() to get the time to pass it on to requestFocus(), helps resolve the issue.
|