Hot Door CORE Forum
Problem with addKeypressMonitor - Printable Version

+- Hot Door CORE Forum (http://hotdoorcore.com/forum)
+-- Forum: All forums (http://hotdoorcore.com/forum/forumdisplay.php?fid=1)
+--- Forum: Bugs (http://hotdoorcore.com/forum/forumdisplay.php?fid=5)
+--- Thread: Problem with addKeypressMonitor (/showthread.php?tid=196)



Problem with addKeypressMonitor - Victor - 12-23-2018

Good day!

I noticed a problem with plugins containing a keypress monitor.

I modified an Annotator sample to reproduce it.

Lines added to annoPlugin.h:

Code:
uint32_t __tildeKeyMonitorID;
void __tildeKeyCB();

Lines added to annoPlugin.cpp:
Code:
this->__tildeKeyMonitorID = this->__corePlug->dispatcher()->addKeypressMonitor(
hdi::core::Dispatcher::LD_GraveKey,
HDI_CORE_CALLBACK(anno::Plugin, this, __tildeKeyCB)
);
at the end of anno:Tonguelugin:Confusedtartup().

Code:
this->__corePlug->dispatcher()->removeKeypressMonitor(__tildeKeyMonitorID);
at the end of anno:Tonguelugin:Confusedhutdown()

Code:
void anno::Plugin::__tildeKeyCB(){}
at the end of file.

These are steps to reproduce problem:
Run Illustrator and open a file containing some artwork.
Choose the Selection Tool (not the Rect Tool created by plugin).
Press and hold the Shift button for 1 - 2 seconds, don't release it.
Click any object.
Release the Shift button.

System freezes for 2 - 3 seconds. Illustrator or any other program does not respond to mouse clicks or keypresses.

Problem appears when running Illustrator 2019, 2018, CS6 under Windows 7 64-bit.
Problem does not appear under Windows 10 or Mac OS.

Problem appears when Windows 7 is running on real hardware or under VMware.
Problem appears when using Hot Door CORE 0.7.1, 0.7.2, 0.7.3 (not tested with earlier versions).

There is no problem when running unchanged version of Annotator sample.

I tried to adjust the Windows keyboard settings.
I tried to change LowLevelHooksTimeout setting in the Registry.
I used the PCHunter software to check if any non-Illustrator keyboard hooks exist.
I signed the plugin to prevent problems with security permissions.

Nothing helps.


Does any workaround exist?

If You can confirm this bug, is it possible to fix it?
I'm presently at the end of a project of plugin. I putted a much time and effort in it.
I can't finish it because of the bug. I can release a plugin for Mac OS and Windows 10 only, but I know this will reduce the number of users.

Any help is appreciated.


RE: Problem with addKeypressMonitor - garrett - 01-02-2019

Thanks for reporting this and putting in some good work for a nice bug report.

Like you, this issue only happens for me in Windows 7. Given that it only affects this older OS in very specific situations and that our keypress handler code path is so simple, unfortunately I don't think we can fix it or attempt to find a workaround for it.

On Windows, to create a keypress handler, we simply call the SetWindowsHookEx() function to register a hook function. The hook function simply gets the KBDLLHOOKSTRUCT object, checks the flags to make sure they do not contain LLKHF_INJECTED, LLKHF_ALTDOWN, or LLKHF_UP, gets the registered hdi_core callback for the key code from a map lookup (very fast), then executes the callback. If any of the above actions fail, we call the CallNextHookEx() function.

In any event, that's all very standard and simple stuff for Windows keypress handling, so I'm not sure where the fault could be on our end of things.