Thread: Meta Key

  1. #16
    Registered User
    Join Date
    Aug 2009
    Posts
    198
    Is it possible to detect a key combination such as Ctrl+; ?

  2. #17
    Registered User
    Join Date
    Aug 2009
    Posts
    198
    Isn't the point of ncurses to provide functionality independent of the terminal, not just VT100? Shouln't it have some universal way of telling whether the key had a Ctrl or Alt modifier?

  3. #18
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    Quote Originally Posted by MTK View Post
    Isn't the point of ncurses to provide functionality independent of the terminal, not just VT100? Shouln't it have some universal way of telling whether the key had a Ctrl or Alt modifier?
    The answer to the first question is no, since ncurses runs in the terminal, which is a VT100 emulator. This is why I said this is a hardware issue. Eg, if your display is only capable of 8 colors, neither ncurses nor anything else will give you 16, there is no point in looking fro such a possibility.

    As for the second question, I am a little confused, since the previous keycode experiments do demonstrate a difference -- for example, any combo involving the alt/meta key begins with the ESC character, ascii 27. That is not the case with ctrl.

    Ctrl appears to just modify the value of the primary character*, eg, b is 98, alt b is 27-98, ctrl-b is 2, alt-ctrl-b is 27-2.

    * because of that, I would go with alt combinations not ctrl, since these could create conflicts -- eg, the ctrl-j problem; I also notice ctrl-i is the same as tab (surprise surprise).
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  4. #19
    Registered User
    Join Date
    Aug 2009
    Posts
    198
    I kinda figured out a good layout that goes around those keys, I will see how that goes.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 16
    Last Post: 11-23-2007, 01:48 PM
  2. Virtual keys
    By Arkanos in forum Windows Programming
    Replies: 4
    Last Post: 12-12-2005, 10:00 AM
  3. Directional Keys - Useing in Console
    By RoD in forum C++ Programming
    Replies: 38
    Last Post: 10-06-2002, 04:42 PM
  4. FAQ: Directional Keys - Useing in Console
    By RoD in forum FAQ Board
    Replies: 38
    Last Post: 10-06-2002, 04:42 PM