onMouseRepeat
by Nathan Bowhay - ESAL · in Torque 3D Professional · 07/23/2009 (2:59 pm) · 0 replies
So I am trying to get the mouse repeat code working and it seems like there are bits all over the place, but nothing finished. I need some help figuring out how to get a onMouseRepeat up and running in engine so I can write code for certain guis to use it.
So here is what I started to do:
In GuiCanvas::processMouseEvent there is a check for SI_MOVE (inputEvent.objInst == SI_MOVE, a check for SI_MAKE (down) and an else under the right and left mouse button checks for if SI_MAKE is false so I put a break point and action seems to always be SI_BREAK (never SI_REPEAT). So I looked for where it is set which is in WindowInputGenerator::handleMouseButton and sure enough event.action is only set to SI_MAKE or SI_BREAK so I stole some code from WindowInputGenerator::handleKeyboard which sets the keyboard to SI_REPEAT (and works). And I still had an issue so I figured it is probably because action which is passed in is probably never equal to IA_REPEAT sure enough I was correct so I went to what calls it (winDispatch.cpp - _dispatch). Again I looked at the keyboard example since it is working, in the giant switch statement it gets to WM_SYSKEYDOWN and calls _keyboardEvent(window,message,wParam,lParam); and inside there bool previous = lParam & (1 << 30); which checks if the key was previously down, bool make = (message == WM_KEYDOWN || message == WM_SYSKEYDOWN); which checks if the the key is currently down, and U32 action = make ? (previous ? IA_REPEAT : IA_MAKE ) : IA_BREAK; where it all comes together and calls window->keyEvent.trigger(window->getWindowId(),_ModifierKeys,action,newVirtKey); passing it action (which could be IA_REPEAT). I then looked at the mouse checks and there are several, but the two that call handleMouseButton are WM_RBUTTONUP && WM_RBUTTONDOWN and they hard code pass IA_MAKE or IA_BREAK. So I tried sever things, it tried finding another flag for when it isn't pressed or released (tried WM_NCRBUTTONDOWN among others) and nothing seemed to hit the break point. I then tried commenting out everything (with WM_ and BUTTON in it) and just having WM_RBUTTONDOWN and giving it this code:
and put a break point and it didn't seem to get hit anyplace, so I am a bit lost on how to get it to just set the appropriate flag (IA_MAKE, IA_REPEAT, IA_BREAK, IA_MOVE). I know i have to be close, but need some help, also it would have been nice to just have the flag set to begin with to use it if need be.
Thank you for any help in advance and let me know if you need me to clarify something.
So here is what I started to do:
In GuiCanvas::processMouseEvent there is a check for SI_MOVE (inputEvent.objInst == SI_MOVE, a check for SI_MAKE (down) and an else under the right and left mouse button checks for if SI_MAKE is false so I put a break point and action seems to always be SI_BREAK (never SI_REPEAT). So I looked for where it is set which is in WindowInputGenerator::handleMouseButton and sure enough event.action is only set to SI_MAKE or SI_BREAK so I stole some code from WindowInputGenerator::handleKeyboard which sets the keyboard to SI_REPEAT (and works). And I still had an issue so I figured it is probably because action which is passed in is probably never equal to IA_REPEAT sure enough I was correct so I went to what calls it (winDispatch.cpp - _dispatch). Again I looked at the keyboard example since it is working, in the giant switch statement it gets to WM_SYSKEYDOWN and calls _keyboardEvent(window,message,wParam,lParam); and inside there bool previous = lParam & (1 << 30); which checks if the key was previously down, bool make = (message == WM_KEYDOWN || message == WM_SYSKEYDOWN); which checks if the the key is currently down, and U32 action = make ? (previous ? IA_REPEAT : IA_MAKE ) : IA_BREAK; where it all comes together and calls window->keyEvent.trigger(window->getWindowId(),_ModifierKeys,action,newVirtKey); passing it action (which could be IA_REPEAT). I then looked at the mouse checks and there are several, but the two that call handleMouseButton are WM_RBUTTONUP && WM_RBUTTONDOWN and they hard code pass IA_MAKE or IA_BREAK. So I tried sever things, it tried finding another flag for when it isn't pressed or released (tried WM_NCRBUTTONDOWN among others) and nothing seemed to hit the break point. I then tried commenting out everything (with WM_ and BUTTON in it) and just having WM_RBUTTONDOWN and giving it this code:
{
bool previous = lParam & (1 << 30);
bool make = (message == WM_RBUTTONDOWN || message == WM_MBUTTONDOWN);
U32 action = make ? (previous ? IA_REPEAT : IA_MAKE ) : IA_BREAK;
if(action == IA_REPEAT)
break;
break;
}and put a break point and it didn't seem to get hit anyplace, so I am a bit lost on how to get it to just set the appropriate flag (IA_MAKE, IA_REPEAT, IA_BREAK, IA_MOVE). I know i have to be close, but need some help, also it would have been nice to just have the flag set to begin with to use it if need be.
Thank you for any help in advance and let me know if you need me to clarify something.