Page MenuHome

Blender uses global keyboard message hook which hurts system responsiveness on Windows
Closed, ResolvedPublic

Description

With Blender 2.56, and probably earlier, when doing a batch render in the background, I've found that my entire system frequently becomes unresponsive to keyboard input (nothing else is affected) for several seconds at a time. It makes it hard to stay productive during long renders.

I believe the cause to be the use of a global message hook (SetWindowsHookEx in /intern/ghost/intern/GHOST_SystemWin32.cpp). Every keyboard message in every application running has to pass through Blender's message hook, and so whenever Blender is busy, the system is unresponsive to the keyboard. Microsoft recommends that SetWindowsHookEx be used for debugging-only because of its severe impact on system responsiveness.

It looks like the hook is only used to update an array of which keys are currently pressed down. Windows has a GetAsyncKeyState function to provide this information, so the global message hook is completely unnecessary.

Event Timeline

Nathan Letwory, I commented out/deleted hooks and other stuff in new patch because we don't need them any more [26364]

I'll leave this one open until your patch has been fully approved and committed.

Alexander's patch, committed in r35437 fixes this nicely by completely removing the hooks :)

Nathan Letwory (jesterking) changed the task status from Unknown Status to Resolved.Mar 9 2011, 11:14 PM