Platform: OSX
Scenario:
I'm writing an interface that allows panning (with grab and drag) and zooming (with the mouse wheel) of an image larger than the window.
Initially, I found that the click-drag aspect would be unresponsive for a noticeable delay after zooming had completed. Checking the code in GetMouseWheel, I surmised that the while loop was at fault. So I cobbled together a new function for mouse queries that lumped together the buttons, coordinates, and wheel-delta data, and replaced the while loop with a single iteration of the low-level HID report.
Having done this, the click-drag was now appropriately responsive no matter how recently a zoom had completed, but - predictably - the zooming was now sporadically laggy / jumpy. This was particularly the case when attempting to zoom immediately following a click-drag event. Presumably the mouse buffer is loaded up with garbage that needs to clear out of the queue before the wheel events can be processed.
Question:
My ideal solution would be to be able to clear the mouse event buffer (for instance, at the end of each mouse query), but I can't find a way to do that. Any thoughts?
Alternatively, and also desirable, can anyone point me to documentation that clarifies the PsychHID('GetReport', ...) functionality in particular what to expect as output and how to interpret it?
Finally, the existing documentation for PsychHID suggests that there is a significant overhead cost from a diagnostic printf. If anyone knows of a way to suppress that, I would be happy to hear it (I can't readily butcher the existing code since it's MEX not .m).
Thanks in advance,
-Grayden
Scenario:
I'm writing an interface that allows panning (with grab and drag) and zooming (with the mouse wheel) of an image larger than the window.
Initially, I found that the click-drag aspect would be unresponsive for a noticeable delay after zooming had completed. Checking the code in GetMouseWheel, I surmised that the while loop was at fault. So I cobbled together a new function for mouse queries that lumped together the buttons, coordinates, and wheel-delta data, and replaced the while loop with a single iteration of the low-level HID report.
Having done this, the click-drag was now appropriately responsive no matter how recently a zoom had completed, but - predictably - the zooming was now sporadically laggy / jumpy. This was particularly the case when attempting to zoom immediately following a click-drag event. Presumably the mouse buffer is loaded up with garbage that needs to clear out of the queue before the wheel events can be processed.
Question:
My ideal solution would be to be able to clear the mouse event buffer (for instance, at the end of each mouse query), but I can't find a way to do that. Any thoughts?
Alternatively, and also desirable, can anyone point me to documentation that clarifies the PsychHID('GetReport', ...) functionality in particular what to expect as output and how to interpret it?
Finally, the existing documentation for PsychHID suggests that there is a significant overhead cost from a diagnostic printf. If anyone knows of a way to suppress that, I would be happy to hear it (I can't readily butcher the existing code since it's MEX not .m).
Thanks in advance,
-Grayden