You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

menukey.cxx 2.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. /* Copyright 2011 Martin Koegler <mkoegler@auto.tuwien.ac.at>
  2. * Copyright 2011 Pierre Ossman <ossman@cendio.se> for Cendio AB
  3. *
  4. * This is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation; either version 2 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This software is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this software; if not, write to the Free Software
  16. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
  17. * USA.
  18. */
  19. #include <string.h>
  20. #include <FL/Fl.H>
  21. // FLTK can pull in the X11 headers on some systems
  22. #ifndef XK_VoidSymbol
  23. #define XK_MISCELLANY
  24. #include <rfb/keysymdef.h>
  25. #endif
  26. #include "menukey.h"
  27. #include "parameters.h"
  28. static const MenuKeySymbol menuSymbols[] = {
  29. {"F1", FL_F + 1, XK_F1},
  30. {"F2", FL_F + 2, XK_F2},
  31. {"F3", FL_F + 3, XK_F3},
  32. {"F4", FL_F + 4, XK_F4},
  33. {"F5", FL_F + 5, XK_F5},
  34. {"F6", FL_F + 6, XK_F6},
  35. {"F7", FL_F + 7, XK_F7},
  36. {"F8", FL_F + 8, XK_F8},
  37. {"F9", FL_F + 9, XK_F9},
  38. {"F10", FL_F + 10, XK_F10},
  39. {"F11", FL_F + 11, XK_F11},
  40. {"F12", FL_F + 12, XK_F12},
  41. {"Pause", FL_Pause, XK_Pause},
  42. {"Print", FL_Print, XK_Print},
  43. {"Scroll_Lock", FL_Scroll_Lock, XK_Scroll_Lock},
  44. {"Escape", FL_Escape, XK_Escape},
  45. {"Insert", FL_Insert, XK_Insert},
  46. {"Delete", FL_Delete, XK_Delete},
  47. {"Home", FL_Home, XK_Home},
  48. {"Page_Up", FL_Page_Up, XK_Page_Up},
  49. {"Page_Down", FL_Page_Down, XK_Page_Down},
  50. };
  51. int getMenuKeySymbolCount()
  52. {
  53. return sizeof(menuSymbols)/sizeof(menuSymbols[0]);
  54. }
  55. const MenuKeySymbol* getMenuKeySymbols()
  56. {
  57. return menuSymbols;
  58. }
  59. void getMenuKey(int *keycode, rdr::U32 *keysym)
  60. {
  61. const char *menuKeyStr;
  62. menuKeyStr = menuKey;
  63. for(int i = 0; i < getMenuKeySymbolCount(); i++) {
  64. if (!strcmp(menuSymbols[i].name, menuKeyStr)) {
  65. *keycode = menuSymbols[i].keycode;
  66. *keysym = menuSymbols[i].keysym;
  67. return;
  68. }
  69. }
  70. *keycode = 0;
  71. *keysym = 0;
  72. }