linux-console.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: 郭晓峰 <lamuguo@gmail.com>
To: linux-console@vger.kernel.org
Subject: Different scan code behavior in X and console
Date: Sat, 14 Jan 2012 16:52:58 -0800	[thread overview]
Message-ID: <CANupJ5S5C1Wp-LnzF4LCVQaSb_ye5sBbENFS0Ut_UqfMwhFTFg@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1561 bytes --]

Hi there,

Sorry to bother. Not sure whether it is correct to post this question
to the mail list, but can't find a suitable linux console user mail
list for discussing this. If you have good mail list to suggest,
please help me to forward. Thanks!

The question is: I tried to make my emacs have the same key response
on both X and console (ssh pts). However, I can't find scan code for
"Ctrl-PageDown" in console mode. I attached the code for testing the
scan code, and below is different behavior in X and console:

============= X ===========
Press a Key 338   // Just type <PageDown>
Press a Key 27
Press a Key 91
Press a Key 54
Press a Key 59
Press a Key 53
Press a Key 126  // 6-chars for <Ctrl-PageDown>
============ Console =========
Press a Key 338  // Same for <PageDown>
Press a Key         // No response for <Ctrl-PageDown>

Any idea on this? Greatly appreciate your replies, your suggested
readings, and so on!

Best Regards,
Lamu Guo

=============Below is text of the code, for easily reading to skip
attachment=================

#include <stdlib.h>
#include <ctype.h>
#include <curses.h>

int main(void)
{
  WINDOW *_window = initscr();
  int _rows;
  int _cols;

  cbreak();

  /* Accept all keys */
  keypad(_window, true);

  /* Don't echo things that are typed */
  noecho();

  /* Get the screen dimensions */
  getmaxyx(_window, _rows, _cols);

  /* Don't display cursor */
  curs_set(0);

  for (;;)
  {
    printw("Press a Key ");
    refresh();
    int key = wgetch(_window);
    printw("%d \n", key);
  }

  endwin();

  return 0;
}

[-- Attachment #2: curin2.c --]
[-- Type: text/x-csrc, Size: 514 bytes --]

#include <stdlib.h>
#include <ctype.h>
#include <curses.h>

int main(void)
{
  WINDOW *_window = initscr();
  int _rows;
  int _cols;

  cbreak();

  /* Accept all keys */
  keypad(_window, true);

  /* Don't echo things that are typed */
  noecho();

  /* Get the screen dimensions */
  getmaxyx(_window, _rows, _cols);

  /* Don't display cursor */
  curs_set(0);

  for (;;)
  {
    printw("Press a Key ");
    refresh();
    int key = wgetch(_window);
    printw("%d \n", key);
  }

  endwin();

  return 0;
}

             reply	other threads:[~2012-01-15  0:52 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-15  0:52 郭晓峰 [this message]
2012-01-15  7:49 ` Different scan code behavior in X and console 郭晓峰

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CANupJ5S5C1Wp-LnzF4LCVQaSb_ye5sBbENFS0Ut_UqfMwhFTFg@mail.gmail.com \
    --to=lamuguo@gmail.com \
    --cc=linux-console@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).