自由过剩键盘输入
我正在使用 GLUT (freeglut3)(通过 Haskell GLUT 绑定)。
import Graphics.UI.GLUT handleKBMouse :: KeyboardMouseCallback handleKBMouse key keyState mods mousePos = do print (key, keyState, mods, mousePos) main :: IO () main = do getArgsAndInitialize createWindow "testTitle" keyboardMouseCallback $= Just handleKBMouse mainLoop
看来各种重要的按键(例如:Shift+Tab)不会调用我的回调。另外,“mods”并不描述 win 键,仅描述 Ctrl、Shift 和 Alt。
对键盘输入的访问如此有限是实际应用程序开发的严重障碍。我在这里做错了什么吗?还是只是因为贪吃而已?总体而言,过剩是否已陷入瘫痪?
I'm using GLUT (freeglut3) (via the Haskell GLUT bindings).
import Graphics.UI.GLUT handleKBMouse :: KeyboardMouseCallback handleKBMouse key keyState mods mousePos = do print (key, keyState, mods, mousePos) main :: IO () main = do getArgsAndInitialize createWindow "testTitle" keyboardMouseCallback $= Just handleKBMouse mainLoop
It seems that various important keys (e.g: Shift+Tab) do not call my callback. Also, "mods" doesn't describe the win-key, only Ctrl, Shift and Alt.
Having such limited access to keyboard input is a serious impediment for real application development. Am I doing anything wrong here or is just freeglut just crippled? Is GLUT crippled in general?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
首先,Windows 会捕获 Shift-Tab 序列,因此即使您直接使用 Win32,通常也看不到它。其次,GLUT 旨在实现可移植,因此除非您能在 Linux、MacOS 等环境下看到相同的密钥,否则 GLUT 很可能不会尝试处理它。第三,GLUT 规范上次更新是在很久之前,所以即使 win 键(或者至少类似的东西)现在很常见,如果它不是 12 或 15 年前的话, GLUT可能不会知道这件事。
First, Windows traps the shift-tab sequence, so even if you work directly with Win32 you won't normally see it. Second, GLUT is intended to be portable, so unless you can expect to see the same key under Linux, MacOS, etc., chances are that GLUT won't even attempt to deal with it. Third, the GLUT spec was last updated a long time ago, so even if the win-key (or at least something similar) is pretty common now, if it wasn't 12 or 15 years ago, GLUT probably won't know about it.