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.

62 lines
1.6 KiB

7 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. /* X11 keyboard handler routines header.
  2. Copyright (c) 2001-2003 by Salvador E. Tropea (SET)
  3. Covered by the GPL license. */
  4. #if (defined(TVOS_UNIX) || defined(TVCompf_Cygwin)) && defined(HAVE_X11) && !defined(X11KEY_HEADER_INCLUDED)
  5. #define X11KEY_HEADER_INCLUDED
  6. struct TEvent;
  7. const unsigned MaxKbLen=7;
  8. typedef struct
  9. {
  10. unsigned symbol;
  11. unsigned key;
  12. } keyEquiv;
  13. // A class to encapsulate the globals, all is static!
  14. class TGKeyX11 : public TGKey
  15. {
  16. public:
  17. TGKeyX11() {};
  18. // Function replacements
  19. //static void Suspend();
  20. //static void Resume();
  21. static int KbHit();
  22. //static void Clear();
  23. static ushort GKey();
  24. static unsigned GetShiftState();
  25. static void FillTEvent(TEvent &e);
  26. //static void SetKbdMapping(int version);
  27. //static int SetCodePage(int id);
  28. static void FillCharCode(TEvent &);
  29. // Setup the pointers to point our members
  30. static void Init();
  31. protected:
  32. // Specific for this driver
  33. static int getKeyEvent(int block);
  34. // Search the unicode in the current input CP
  35. static unsigned Unicode2CP(uint16 unicode);
  36. static int lenKb,kbWaiting;
  37. static char bufferKb[MaxKbLen+1];
  38. static KeySym Key;
  39. static unsigned kbFlags;
  40. static uchar KeyCodeByKeySym[256];
  41. static keyEquiv XEquiv[];
  42. static uchar KeyCodeByASCII[96];
  43. // Values used to fill the event
  44. static unsigned Symbol;
  45. static unsigned Unicode;
  46. static unsigned Flags;
  47. static uchar Scan;
  48. // This is used to translate the WM close to a cmQuit event
  49. static uchar sendQuit;
  50. friend class TScreenX11;
  51. };
  52. #endif // X11KEY_HEADER_INCLUDED