altKey down problem


#1

This code in the latest juce gets in an inifite loop if you scroll the mouseWheel and hold the altKey down. This does not happen with shiftKey down.

void CViewPort::mouseWheelMove( const MouseEvent &e, const MouseWheelDetails &details ) { Viewport::mouseWheelMove( e, details ); return; }


#2

No matter how many times you post this same message, it's still going to be impossible for anyone to help you unless you do a better job of explaining what's happening, or how someone else could replicate the problem.

Don't you realise that the code you posted would be entirely optimised-away by most compilers? How is a redundant code snippet from some class called "CViewPort" supposed to be helpful to anyone who's trying to figure out what you're doing?


#3

I took out to irrevelant code thinking that an experienced programmer would realize it. I guess I was wrong.

class CViewport : public Viewport
{
     mouseWheelMove( const MouseEvent &e, const MouseWheelDetails &details ) ;
};

//Implementation

void CViewPort::mouseWheelMove( const MouseEvent &e, const MouseWheelDetails &details )

{
    //Irrevelant code but here it is
    MouseWheelDetails    newDetails = details;
    if ( e.mods.isAltDown() && newDetails.deltaX == 0 )
    {
        newDetails.deltaX = newDetails.deltaY;
        newDetails.deltaY = 0;
     }

    Viewport::mouseWheelMove( e, details ); return;
}

This code works with isShiftKeyDown() instead of isAltDown()

And I posted it twice because the first reply did not show up on the forum software 15 minutes later when I checked. This has hapenned to me several times.


#4

I took out to irrevelant code thinking that an experienced programmer would realize it. I guess I was wrong.

ALL of the code you've posted is irrevelent. You've given absolutely NO relevant information that anyone could use to reproduce this problem! A snippet of random code from your own codebase is useless when taken out of context!

If you can't post some instructions that would let me reproduce the problem myself, then how do you expect me to debug it?

And you say there's an infinite loop, so you must have a stack trace that shows the call sequence. Why not post that??


#5

I don't know how to explain it any clearer.

1. Create a class which is a subclass of Viewport like above and override mouseWheelMove and do what ever you want inside the procedure. Call the parent class to execute mouseWheelMove.

2. Hold the alt key down and move the mouse wheel. Recurrsion occurs when alt key is down. It does not occur when other modifiers are down.

 

 


#6

And how would simply subclassing cause this? Doing "whatever you want" could induce recursion itself, right - a bug outside of juce?

To be honest, I bit and can't replicate the bug.


#7

Ways to explain it more clearly might include:

a) Post a snippet of the stack trace showing the recursion, like I suggested at least twice

b) Post a short code snippet that other people could actually paste into the demo app, with instructions about reproducing the problem.

c) Look at it yourself in the debugger and see what's happening, so that you can explain better what's going on