    protected final void collectOrFireEvents( InputSystem is, EventQueue eventQueue, long nanoTime, boolean acceptEvents ) throws InputSystemException
    {
        final boolean isQueued = ( eventQueue != null );
        if ( !org.lwjgl.opengl.Display.isCreated() )
            throw( new InputSystemException( "Display is not created." ) );
        if ( !org.lwjgl.input.Mouse.isCreated() )
            throw( new InputSystemException( "Mouse is not created." ) );
        try
        {
            LWJGLInputDeviceFactory.processMessages( nanoTime );
            org.lwjgl.input.Mouse.poll();
            while ( org.lwjgl.input.Mouse.next() )
            {
                if ( !acceptEvents )
                    continue;
                final int x = org.lwjgl.input.Mouse.getEventX();
                final int y = getSourceWindow().getHeight() - org.lwjgl.input.Mouse.getEventY();
                final int dx = org.lwjgl.input.Mouse.getEventDX();
                final int dy = -org.lwjgl.input.Mouse.getEventDY();
                final int buttonIdx = org.lwjgl.input.Mouse.getEventButton();
                final boolean buttonState = org.lwjgl.input.Mouse.getEventButtonState();
                final int wheelDelta = org.lwjgl.input.Mouse.getEventDWheel() / 120;
                if ( isAbsolute() )
                    this.storePosition( x, y );
                if ( ( dx != 0 ) || ( dy != 0 ) )
                {
                    final MouseMovedEvent movEv = prepareMouseMovedEvent( getCurrentX(), getCurrentY(), dx, dy, nanoTime );
                    if ( dx != 0 )
                        is.notifyInputStatesManagers( this, getXAxis(), x, dx, nanoTime );
                    if ( dy != 0 )
                        is.notifyInputStatesManagers( this, getYAxis(), y, dy, nanoTime );
                    if ( movEv == null )
                        continue;
                    if ( isQueued )
                        eventQueue.enqueue( movEv );
                    else
                        fireOnMouseMoved( movEv, true );
                }
                if ( buttonIdx != -1 )
                {
                    final MouseButton button = convertButton( buttonIdx );
                    if ( buttonState )
                    {
                        final MouseButtonPressedEvent pressedEv = prepareMouseButtonPressedEvent( button, nanoTime );
                        is.notifyInputStatesManagers( this, button, 1, +1, nanoTime );
                        if ( pressedEv == null )
                            continue;
                        if ( isQueued )
                            eventQueue.enqueue( pressedEv );
                        else
                            fireOnMouseButtonPressed( pressedEv, true );
                    }
                    else
                    {
                        final MouseButtonReleasedEvent releasedEv = prepareMouseButtonReleasedEvent( button, nanoTime );
                        is.notifyInputStatesManagers( this, button, 0, -1, nanoTime );
                        if ( releasedEv == null )
                            continue;
                        if ( isQueued )
                            eventQueue.enqueue( releasedEv );
                        else
                            fireOnMouseButtonReleased( releasedEv, true );
                    }
                }
                if ( wheelDelta != 0 )
                {
                    final MouseWheelEvent wheelEv = prepareMouseWheelMovedEvent( wheelDelta, false, nanoTime );
                    is.notifyInputStatesManagers( this, getWheel(), getWheel().getIntValue(), wheelDelta, nanoTime );
                    if ( wheelEv == null )
                        continue;
                    if ( isQueued )
                        eventQueue.enqueue( wheelEv );
                    else
                        fireOnMouseWheelMoved( wheelEv, true );
                }
            }
        }
        catch ( Throwable t )
        {
            if ( t instanceof InputSystemException )
                throw( (InputSystemException)t );
            if ( t instanceof Error )
                throw( (Error)t );
            if ( t instanceof RuntimeException )
                throw( (RuntimeException)t );
            throw( new InputSystemException( t ) );
        }
    }

    protected final void collectOrFireEvents( InputSystem is, EventQueue eventQueue, long nanoTime, boolean acceptEvents ) throws InputSystemException
    {
        final boolean isQueued = ( eventQueue != null );
        if ( !org.lwjgl.opengl.Display.isCreated() )
            throw( new InputSystemException( "Display is not created." ) );
        if ( !org.lwjgl.input.Mouse.isCreated() )
            throw( new InputSystemException( "Mouse is not created." ) );
        try
        {
            LWJGLInputDeviceFactory.processMessages( nanoTime );
            org.lwjgl.input.Mouse.poll();
            while ( org.lwjgl.input.Mouse.next() )
            {
                if ( !acceptEvents )
                    continue;
                final int x = org.lwjgl.input.Mouse.getEventX();
                final int y = getSourceWindow().getHeight() - org.lwjgl.input.Mouse.getEventY();
                final int dx = org.lwjgl.input.Mouse.getEventDX();
                final int dy = org.lwjgl.input.Mouse.getEventDY();
                final int buttonIdx = org.lwjgl.input.Mouse.getEventButton();
                final boolean buttonState = org.lwjgl.input.Mouse.getEventButtonState();
                final int wheelDelta = org.lwjgl.input.Mouse.getEventDWheel() / 120;
                if ( isAbsolute() )
                    this.storePosition( x, y );
                if ( ( dx != 0 ) || ( dy != 0 ) )
                {
                    final MouseMovedEvent movEv = prepareMouseMovedEvent( getCurrentX(), getCurrentY(), dx, dy, nanoTime );
                    if ( dx != 0 )
                        is.notifyInputStatesManagers( this, getXAxis(), x, dx, nanoTime );
                    if ( dy != 0 )
                        is.notifyInputStatesManagers( this, getYAxis(), y, dy, nanoTime );
                    if ( movEv == null )
                        continue;
                    if ( isQueued )
                        eventQueue.enqueue( movEv );
                    else
                        fireOnMouseMoved( movEv, true );
                }
                if ( buttonIdx != -1 )
                {
                    final MouseButton button = convertButton( buttonIdx );
                    if ( buttonState )
                    {
                        final MouseButtonPressedEvent pressedEv = prepareMouseButtonPressedEvent( button, nanoTime );
                        is.notifyInputStatesManagers( this, button, 1, +1, nanoTime );
                        if ( pressedEv == null )
                            continue;
                        if ( isQueued )
                            eventQueue.enqueue( pressedEv );
                        else
                            fireOnMouseButtonPressed( pressedEv, true );
                    }
                    else
                    {
                        final MouseButtonReleasedEvent releasedEv = prepareMouseButtonReleasedEvent( button, nanoTime );
                        is.notifyInputStatesManagers( this, button, 0, -1, nanoTime );
                        if ( releasedEv == null )
                            continue;
                        if ( isQueued )
                            eventQueue.enqueue( releasedEv );
                        else
                            fireOnMouseButtonReleased( releasedEv, true );
                    }
                }
                if ( wheelDelta != 0 )
                {
                    final MouseWheelEvent wheelEv = prepareMouseWheelMovedEvent( wheelDelta, false, nanoTime );
                    is.notifyInputStatesManagers( this, getWheel(), getWheel().getIntValue(), wheelDelta, nanoTime );
                    if ( wheelEv == null )
                        continue;
                    if ( isQueued )
                        eventQueue.enqueue( wheelEv );
                    else
                        fireOnMouseWheelMoved( wheelEv, true );
                }
            }
        }
        catch ( Throwable t )
        {
            if ( t instanceof InputSystemException )
                throw( (InputSystemException)t );
            if ( t instanceof Error )
                throw( (Error)t );
            if ( t instanceof RuntimeException )
                throw( (RuntimeException)t );
            throw( new InputSystemException( t ) );
        }
    }
