Extended keyborad event.

Posted by 每特17劃 on 2005-03-18

Extended keyborad event.

ASCII只有定義128個鍵, 而一個"char"有一個byte=8 bit的定義空間. 還有128個鍵可以由程式設計師自定義. 比如說, 你需要在程式裡補捉"Ctrl-Space", “Ctrl-Shift”…等. 你可以適當地擴充鍵盤對映(keymaps)使鍵盤的事件可以收在一個"char"可以定義的範圍, 而不用處理低階的"keycode". 相關的資訊可以參照"man keymaps", 也是常用的表頭檔. 在iterm, zhcon,…等一類的程式也都有很棒的範例在裡頭.

我之前對這些不是很熟悉, 所以花了很多時間在上面. 結果到最後才發現, 我想要改的程式裡, 已經作好了相關的部份. 所以, 在作任何事之前, 一定要先完全了解整個相關的程式碼. 才不致於繞了一圈又回到原點.

ASCII defines only 128 elements, and a “char” has 1 byte= 8 bit. There are another 128 entry that can be defined by programmers. If your programs need to catch some keyevent such as “Ctrl-Space” , “Ctrl-Shift”,…etc,you can properly extend the keymap, and avoid these lowlevel keycodes handling. Relative information can be obtained by “man keymaps”. are often included. Some programs like iterm, zhcon,…etc, also have excellent codes about it.

I am not familiar to this before, so I spent lot of time on it. But I finally find the program which I want to improve has implemented it~~ So, always be sure to completely understand what you are going to do first, and start to do it.