How does the X server emit a character when the keyboard is pressed? [duplicate]

Clash Royale CLAN TAG#URR8PPP
up vote
1
down vote
favorite
This question already has an answer here:
How do keyboard input and text output work?
2 answers
This is actually a coding question.
I know that the X server checks the active keyboard layout to figure out which character (supporting unicode) to emit. But I don't actually know how this is done, could someone point me to the source code where I can see this in action?
What I want to actually do is to create a "unicode keyboard driver" which can do the same thing (ignoring the active layout), but then I need to know how X is emitting the unicode character to the GUI.
Even if I need to add new functionality to the X server and recompile it that's okay. I just want to be pointed to the right source code for emitting those characters into the GUI.
EDIT:
The comments pushed me in good directions on where to find answers. I think I've now figured out how I can programmatically output unicode text into GUI's on Linux.
Hints: xdotool / libxdo, XTestFakeKeyEvent, xmodmap -e "keycode 107 = U2196"
I will see if I can eventually answer this question with my own C++ library to do this.
x11 unicode source-code
marked as duplicate by Isaac, Shadur, Rui F Ribeiro, G-Man, Kusalananda Feb 11 at 8:55
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
add a comment |Â
up vote
1
down vote
favorite
This question already has an answer here:
How do keyboard input and text output work?
2 answers
This is actually a coding question.
I know that the X server checks the active keyboard layout to figure out which character (supporting unicode) to emit. But I don't actually know how this is done, could someone point me to the source code where I can see this in action?
What I want to actually do is to create a "unicode keyboard driver" which can do the same thing (ignoring the active layout), but then I need to know how X is emitting the unicode character to the GUI.
Even if I need to add new functionality to the X server and recompile it that's okay. I just want to be pointed to the right source code for emitting those characters into the GUI.
EDIT:
The comments pushed me in good directions on where to find answers. I think I've now figured out how I can programmatically output unicode text into GUI's on Linux.
Hints: xdotool / libxdo, XTestFakeKeyEvent, xmodmap -e "keycode 107 = U2196"
I will see if I can eventually answer this question with my own C++ library to do this.
x11 unicode source-code
marked as duplicate by Isaac, Shadur, Rui F Ribeiro, G-Man, Kusalananda Feb 11 at 8:55
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
1
Linking in: unix.stackexchange.com/q/116629/117549
â Jeff Schaller
Feb 9 at 19:54
@JeffSchaller Thanks. And I guess this is a similar question as well: unix.stackexchange.com/questions/248243/â¦
â Joakim L. Christiansen
Feb 9 at 19:56
Perhaps you should examine how IBus does it.
â Ignacio Vazquez-Abrams
Feb 9 at 19:57
This is interesting when it comes to inputting a character: Sending Keystrokes to a X Window
â Joakim L. Christiansen
Feb 9 at 20:36
add a comment |Â
up vote
1
down vote
favorite
up vote
1
down vote
favorite
This question already has an answer here:
How do keyboard input and text output work?
2 answers
This is actually a coding question.
I know that the X server checks the active keyboard layout to figure out which character (supporting unicode) to emit. But I don't actually know how this is done, could someone point me to the source code where I can see this in action?
What I want to actually do is to create a "unicode keyboard driver" which can do the same thing (ignoring the active layout), but then I need to know how X is emitting the unicode character to the GUI.
Even if I need to add new functionality to the X server and recompile it that's okay. I just want to be pointed to the right source code for emitting those characters into the GUI.
EDIT:
The comments pushed me in good directions on where to find answers. I think I've now figured out how I can programmatically output unicode text into GUI's on Linux.
Hints: xdotool / libxdo, XTestFakeKeyEvent, xmodmap -e "keycode 107 = U2196"
I will see if I can eventually answer this question with my own C++ library to do this.
x11 unicode source-code
This question already has an answer here:
How do keyboard input and text output work?
2 answers
This is actually a coding question.
I know that the X server checks the active keyboard layout to figure out which character (supporting unicode) to emit. But I don't actually know how this is done, could someone point me to the source code where I can see this in action?
What I want to actually do is to create a "unicode keyboard driver" which can do the same thing (ignoring the active layout), but then I need to know how X is emitting the unicode character to the GUI.
Even if I need to add new functionality to the X server and recompile it that's okay. I just want to be pointed to the right source code for emitting those characters into the GUI.
EDIT:
The comments pushed me in good directions on where to find answers. I think I've now figured out how I can programmatically output unicode text into GUI's on Linux.
Hints: xdotool / libxdo, XTestFakeKeyEvent, xmodmap -e "keycode 107 = U2196"
I will see if I can eventually answer this question with my own C++ library to do this.
This question already has an answer here:
How do keyboard input and text output work?
2 answers
x11 unicode source-code
edited Feb 9 at 22:19
asked Feb 9 at 19:50
Joakim L. Christiansen
63
63
marked as duplicate by Isaac, Shadur, Rui F Ribeiro, G-Man, Kusalananda Feb 11 at 8:55
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
marked as duplicate by Isaac, Shadur, Rui F Ribeiro, G-Man, Kusalananda Feb 11 at 8:55
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
1
Linking in: unix.stackexchange.com/q/116629/117549
â Jeff Schaller
Feb 9 at 19:54
@JeffSchaller Thanks. And I guess this is a similar question as well: unix.stackexchange.com/questions/248243/â¦
â Joakim L. Christiansen
Feb 9 at 19:56
Perhaps you should examine how IBus does it.
â Ignacio Vazquez-Abrams
Feb 9 at 19:57
This is interesting when it comes to inputting a character: Sending Keystrokes to a X Window
â Joakim L. Christiansen
Feb 9 at 20:36
add a comment |Â
1
Linking in: unix.stackexchange.com/q/116629/117549
â Jeff Schaller
Feb 9 at 19:54
@JeffSchaller Thanks. And I guess this is a similar question as well: unix.stackexchange.com/questions/248243/â¦
â Joakim L. Christiansen
Feb 9 at 19:56
Perhaps you should examine how IBus does it.
â Ignacio Vazquez-Abrams
Feb 9 at 19:57
This is interesting when it comes to inputting a character: Sending Keystrokes to a X Window
â Joakim L. Christiansen
Feb 9 at 20:36
1
1
Linking in: unix.stackexchange.com/q/116629/117549
â Jeff Schaller
Feb 9 at 19:54
Linking in: unix.stackexchange.com/q/116629/117549
â Jeff Schaller
Feb 9 at 19:54
@JeffSchaller Thanks. And I guess this is a similar question as well: unix.stackexchange.com/questions/248243/â¦
â Joakim L. Christiansen
Feb 9 at 19:56
@JeffSchaller Thanks. And I guess this is a similar question as well: unix.stackexchange.com/questions/248243/â¦
â Joakim L. Christiansen
Feb 9 at 19:56
Perhaps you should examine how IBus does it.
â Ignacio Vazquez-Abrams
Feb 9 at 19:57
Perhaps you should examine how IBus does it.
â Ignacio Vazquez-Abrams
Feb 9 at 19:57
This is interesting when it comes to inputting a character: Sending Keystrokes to a X Window
â Joakim L. Christiansen
Feb 9 at 20:36
This is interesting when it comes to inputting a character: Sending Keystrokes to a X Window
â Joakim L. Christiansen
Feb 9 at 20:36
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
0
down vote
I figured out the two commands needed to do this programmatically:
XChangeKeyboardMapping (to map an unused keycode to char/unicode)
XTestFakeKeyEvent (to send it to the X server)
Hence any char can be sent and the keyboard layout can stay the same.
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
I figured out the two commands needed to do this programmatically:
XChangeKeyboardMapping (to map an unused keycode to char/unicode)
XTestFakeKeyEvent (to send it to the X server)
Hence any char can be sent and the keyboard layout can stay the same.
add a comment |Â
up vote
0
down vote
I figured out the two commands needed to do this programmatically:
XChangeKeyboardMapping (to map an unused keycode to char/unicode)
XTestFakeKeyEvent (to send it to the X server)
Hence any char can be sent and the keyboard layout can stay the same.
add a comment |Â
up vote
0
down vote
up vote
0
down vote
I figured out the two commands needed to do this programmatically:
XChangeKeyboardMapping (to map an unused keycode to char/unicode)
XTestFakeKeyEvent (to send it to the X server)
Hence any char can be sent and the keyboard layout can stay the same.
I figured out the two commands needed to do this programmatically:
XChangeKeyboardMapping (to map an unused keycode to char/unicode)
XTestFakeKeyEvent (to send it to the X server)
Hence any char can be sent and the keyboard layout can stay the same.
answered Feb 9 at 23:13
Joakim L. Christiansen
63
63
add a comment |Â
add a comment |Â
1
Linking in: unix.stackexchange.com/q/116629/117549
â Jeff Schaller
Feb 9 at 19:54
@JeffSchaller Thanks. And I guess this is a similar question as well: unix.stackexchange.com/questions/248243/â¦
â Joakim L. Christiansen
Feb 9 at 19:56
Perhaps you should examine how IBus does it.
â Ignacio Vazquez-Abrams
Feb 9 at 19:57
This is interesting when it comes to inputting a character: Sending Keystrokes to a X Window
â Joakim L. Christiansen
Feb 9 at 20:36