utility for getting the exact keycodes as according to ncurses.
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

41 lignes
818B

  1. /* nckey.c - displays the current key according to ncurses
  2. * @BAKE cc -Wall -Wextra -Wpedantic -pipe -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=600 $@ -o $* -lncurses -ltinfo
  3. */
  4. #include <signal.h>
  5. #include <stdio.h>
  6. #include <stdlib.h>
  7. #include <unistd.h>
  8. #include <ncurses.h>
  9. int
  10. main (void)
  11. {
  12. int c, c2, run = 1;
  13. initscr();
  14. raw();
  15. noecho();
  16. notimeout(stdscr, TRUE);
  17. keypad(stdscr, TRUE);
  18. notimeout(stdscr, FALSE);
  19. ESCDELAY = 0;
  20. mvprintw(0, 0, "type q (113) to exit. everything is in decimal.");
  21. while (run)
  22. {
  23. c = getch();
  24. mvprintw(1, 0, " ");
  25. if (c == 'q')
  26. { run = 0; }
  27. if (c == 27)
  28. {
  29. mvprintw(1, 0, "ESC");
  30. c2 = getch();
  31. mvprintw(1, 4, "%.3d %c", c2, c2);
  32. }
  33. else
  34. { mvprintw(1, 0, "%.3d %c", c, c); }
  35. refresh();
  36. }
  37. endwin();
  38. }