Receiving key press and key release events in Linux terminal applications?

前端 未结 3 1828
粉色の甜心
粉色の甜心 2020-12-05 14:23

I would like to write a simple C program that will perform different actions based on both \"key down\" and \"key up\" events. This program will be run from inside rxvt.

3条回答
  •  天涯浪人
    2020-12-05 14:43

    The following links may be of some assistance in using the keyboard raw mode which will give you access to the keyboard events rather than just key releases.

    1. This Linux Journal article
    2. This article on SourceForge
    3. And this HOWTO for when it all goes bad

    Raw mode does have the disadvantage that you have to do your own conversion from scan codes to characters though.

提交回复
热议问题