Why is XKeysymToKeycode() making all of my keys lowercase?
来源:互联网 发布:第三方软件检测 编辑:程序博客网 时间:2024/05/19 17:08
原文地址::https://stackoverflow.com/questions/28258528/why-is-xkeysymtokeycode-making-all-of-my-keys-lowercase
相关文章
1、XKeysymToKeycode, XTestFakeKeyEvent and mapping----https://stackoverflow.com/questions/15856775/xkeysymtokeycode-xtestfakekeyevent-and-mapping
2、python之模拟鼠标键盘动作具体实现----http://www.codeweblog.com/python%E4%B9%8B%E6%A8%A1%E6%8B%9F%E9%BC%A0%E6%A0%87%E9%94%AE%E7%9B%98%E5%8A%A8%E4%BD%9C%E5%85%B7%E4%BD%93%E5%AE%9E%E7%8E%B0/
I'm currently having a problem with Xlib where whenever I call XKeysymToKeycode()
and pass in an uppercase KeySym
, it returns a lowercase KeyCode
. Google doesn't really seem to have an answer to this question, or too much documentation at all on the functions I'm using, for that matter.
Here's the code I am using:
#include <ctype.h>#include <stdio.h>#include <stdlib.h>#include <X11/Xlib.h>#include <X11/Xutil.h>#include <X11/keysym.h>#include <X11/extensions/XTest.h>int main(void) { Display *display; char *ptr; char c[2] = {0, 0}; KeySym ksym; KeyCode kcode; display = XOpenDisplay(0); ptr = "Test"; while (*ptr) { c[0] = *ptr; ksym = XStringToKeysym(c); printf("Before XKeysymToKeycode(): %s\n", XKeysymToString(ksym)); kcode = XKeysymToKeycode(display, ksym); printf("Key code after XKeysymToKeycode(): %s\n", XKeysymToString(XKeycodeToKeysym(display, kcode, 0))); ptr++; } XCloseDisplay(display); return 0;}
It can be compiled with gcc -o sendkeys sendkeys_min.c -lX11 -lXtst -g -Wall -Wextra -pedantic -ansi
(Assuming it has been saved as sendkeys_min.c
.)
The current output is the following:
Before XKeysymToKeycode(): TKey code after XKeysymToKeycode(): tBefore XKeysymToKeycode(): eKey code after XKeysymToKeycode(): eBefore XKeysymToKeycode(): sKey code after XKeysymToKeycode(): sBefore XKeysymToKeycode(): tKey code after XKeysymToKeycode(): t
The expected output, is, of course, that the first T in "Test" is still uppercase after being ran through XKeysymToKeycode()
. (Note that this is not my actual program, but a simplified version for posting here. In the actual program, I am sending key events with the resulting keycode, and the keys sent still have the problem exhibited here (They all become lowercase))
I'm currently having a problem with Xlib where whenever I call XKeysymToKeycode()
and pass in an uppercase KeySym
, it returns a lowercase KeyCode
. Google doesn't really seem to have an answer to this question, or too much documentation at all on the functions I'm using, for that matter.
Here's the code I am using:
#include <ctype.h>#include <stdio.h>#include <stdlib.h>#include <X11/Xlib.h>#include <X11/Xutil.h>#include <X11/keysym.h>#include <X11/extensions/XTest.h>int main(void) { Display *display; char *ptr; char c[2] = {0, 0}; KeySym ksym; KeyCode kcode; display = XOpenDisplay(0); ptr = "Test"; while (*ptr) { c[0] = *ptr; ksym = XStringToKeysym(c); printf("Before XKeysymToKeycode(): %s\n", XKeysymToString(ksym)); kcode = XKeysymToKeycode(display, ksym); printf("Key code after XKeysymToKeycode(): %s\n", XKeysymToString(XKeycodeToKeysym(display, kcode, 0))); ptr++; } XCloseDisplay(display); return 0;}
It can be compiled with gcc -o sendkeys sendkeys_min.c -lX11 -lXtst -g -Wall -Wextra -pedantic -ansi
(Assuming it has been saved as sendkeys_min.c
.)
The current output is the following:
Before XKeysymToKeycode(): TKey code after XKeysymToKeycode(): tBefore XKeysymToKeycode(): eKey code after XKeysymToKeycode(): eBefore XKeysymToKeycode(): sKey code after XKeysymToKeycode(): sBefore XKeysymToKeycode(): tKey code after XKeysymToKeycode(): t
The expected output, is, of course, that the first T in "Test" is still uppercase after being ran through XKeysymToKeycode()
. (Note that this is not my actual program, but a simplified version for posting here. In the actual program, I am sending key events with the resulting keycode, and the keys sent still have the problem exhibited here (They all become lowercase))
- Why is XKeysymToKeycode() making all of my keys lowercase?
- Why Tomcat7 is replicating all my logs in /var/log/messages
- Why is there extra padding at the top of my UITableView with style UITableViewStyleGrouped in iOS7
- 297. My son is my son till he has got him a wife, but my daughter is my daughter all the days of her
- Why FreeBSD Is My Favorite *nix OS
- Why is my div's height zero
- Why Go is my favorite programming language
- Why all of the passengers ran away?
- My Happiness is All 分锅记录
- Making Sense of all these Crazy Web Service Standards
- Looking for all keys of an multi dimensional array
- ypcat - print values of all keys in a NIS database
- Performance of Using Keys in SELECT with FOR ALL ENTRIES
- all of these is operation
- Why Pascal is Not My Favourite Programming Language
- Why C Is Not My Favourite Programming Language
- Why is php not in my /bin directory??
- Why is SPD adding content to my file?
- Git
- Android Studio使用ndk'遇到的错误
- Spark Streaming + Flume整合官网文档阅读及运行示例
- Spring线程池ThreadPoolTaskExecutor配置及详情
- 全选或反选
- Why is XKeysymToKeycode() making all of my keys lowercase?
- 微信公众号开发系列-获取微信OpenID
- java 使用 WebUploader
- 关于在window环境下使用git命令时git指令不能识别的原因
- 加上输入框的UIAlertController
- 使用ArrayList集合存储数据
- redhat 6.5 离线安装docker (rpm包安装)
- JAVA中的时间大小比较
- AndroidStudio 报错:Failed to open zip file