<AWT Dev> DragSourceContext.updateCurrentCursor: override target action?

Keith Seitz keiths at redhat.com
Mon Jun 16 14:54:15 PDT 2008


Hi,

I've been doing some JCK 6b testing, and a DnD failure appears in the 
testsuite. I've debugged the problem down to something that I cannot 
rationalize, and I was hoping someone here could enlighten me.

The failing JCK test essentially calls 
"DragSourceContext.updateCurrentCursor(1, 1, 1)" and then calls 
DragSourceContext.getCursor, comparing this cursor to an expected cursor.

The problem is in updateCurrentCursor, which ignores the target action, 
and simply hard codes it to DnDConstants.ACTION_NONE:



     protected synchronized void updateCurrentCursor(int sourceAct, int 
targetAct, int status) {

         // if the cursor has been previously set then dont do any defaults
         // processing.

         if (useCustomCursor) {
             return;
         }

         // do defaults processing

         Cursor c = null;

-->    targetAct = DnDConstants.ACTION_NONE;
         switch (status) {
             case ENTER:
             case OVER:
             case CHANGED:
                 int    ra = sourceAct & targetAct;

[This is both openjdk 6 & 7.]

As a result of this override of targetAct, "ra" will _always_ evaluate 
to false, and the code will never return a droppable cursor.

Does this override serve a purpose that I am unable to guess?

FWIW, I have run the JCK 6b api/java_awt/dnd tests with the highlighted 
line deleted, and they all now pass.

Keith



More information about the awt-dev mailing list