Fiddling with multitouch

拜拜、爱过 提交于 2019-12-11 07:27:47

问题


I have a wacom bamboo pad and want to do some crazy stuff with it which involves grabbing the touchpad. The touchpad can be grabbed in two modes: Observer and Consumer. While Observer mode passes the touch data to the os also, consumer 'eats' the data alone. But: Consumer mode needs the target window to be the active one.

And here comes the problem. I need another application to receive keyboard messages simultaneously AND prevent the mouse from being influenced by the touchpad.

There are some options I've already tried out:

  • Observer mode with 'mouse jail'. Meh. I might need the mouse, so no.
  • Disabling touch in the tablet prefs, but this does disable touch (as it suggests) and not only the mouse movement by the pad.
  • Consumer mode and trying to pass keyboard wndproc messages down to the next application. The results were... well none.

I've tried to grab wndproc on the window, but since I have child controls which have keyboard focus, this didn't work. I ended up using a custom text box, which also overrides wndproc and grabs all messages between WP_KEYFIRST and WP_KEYLAST and giving them down to what I think is the next window (using GetForegroundWindow and GetWindow(GW_NEXTWINDOW)). I've tried both SendMessage and PostMessage, but a quick test with notepad failed everytime.

So my question is: How can I either pass down the wndproc keyboard messages or disable the mouse movement done by the touchpad?

PS: At some point I had the desired result (Observer but no mouse manipulation), but that was a coincidence and replugging the tablet fixed it. I couldn't reproduce it though.

EDIT:

After fiddling further around with the winapi and keyboard passtrough this approach seems to be impossible (or very very hard...) There is a method to get all windows here[1] and you can also get the z-order from this snippet. But: Not every window handles the keyboard input for this window. Sounds stupid, is stupid (in my eyes). Windows seems not to pass keyboard events down trough the window to the target controls, but directly to the control. But only in some cases. So I gave up on this specific approach. An alternative would be to make it work explicitly for the programs I need (which is possible in my case) or go the other way mentioned above. As would like not to use such a hack, I'm further open for Ideas on how to disable the mouse movement.

[1]: Enumerate windows like alt-tab does

来源:https://stackoverflow.com/questions/28288372/fiddling-with-multitouch

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!