Menu

#1 Bug/Issue : org.jagatoo.input.events.EventQueue [+cleanup]

open
nobody
None
5
2010-04-26
2010-04-26
No

Class : org.jagatoo.input.events.EventQueue
Method: +cleanup(InputSourceWindow):void
Bug : The cleanup method marks "null" the elements of the "events" array, if they are of type KEYBOARD_EVENT, MOUSE_EVENT, CONTROLLER_EVENT.
The problem in the code is, it does\'t mark the "hasNullEvents" flag to \"true\", due to which the \"strip\" method sometimes doesn't work, as it checks the "hasNullEvents" flag, and it returns from the method without striping the "events" array.

Original code:

switch ( events[ i ].getType() )
{
case KEYBOARD_EVENT:
if ( ( (KeyboardEvent)events[ i ] ).getKeyboard().getSourceWindow() == sourceWindow ){
events[ i ] = null;
}
break;

case MOUSE_EVENT:
if ( ( (MouseEvent)events[ i ] ).getMouse().getSourceWindow() == sourceWindow ){
events[ i ] = null;
}
break;

case CONTROLLER_EVENT:
if ( ( (ControllerEvent)events[ i ] ).getController().getSourceWindow() == sourceWindow ){
events[ i ] = null;
}
break;
}

Modified code:

switch ( events[ i ].getType() )
{
case KEYBOARD_EVENT:
if ( ( (KeyboardEvent)events[ i ] ).getKeyboard().getSourceWindow() == sourceWindow ){
events[ i ] = null;
// To mark that their is null event present in the queue
hasNullEvents = true;
}
break;

case MOUSE_EVENT:
if ( ( (MouseEvent)events[ i ] ).getMouse().getSourceWindow() == sourceWindow ){
events[ i ] = null;
// To mark that their is null event present in the queue
hasNullEvents = true;
}
break;

case CONTROLLER_EVENT:
if ( ( (ControllerEvent)events[ i ] ).getController().getSourceWindow() == sourceWindow ){
events[ i ] = null;
// To mark that their is null event present in the queue
hasNullEvents = true;
}
break;
}

***********************************************************************
Posted by:
Mohit Gupta (mohit.gupta@daffodilsw.com)
Saundaray Gupta (saundaraya.gupta@daffodilsw.com)

Discussion


Log in to post a comment.

MongoDB Logo MongoDB