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.

XDesktop.h 2.6KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. /* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved.
  2. * Copyright (C) 2004-2008 Constantin Kaplinsky. All Rights Reserved.
  3. * Copyright 2017 Peter Astrand <astrand@cendio.se> for Cendio AB
  4. *
  5. * This is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation; either version 2 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * This software is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this software; if not, write to the Free Software
  17. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
  18. * USA.
  19. */
  20. #ifndef __XDESKTOP_H__
  21. #define __XDESKTOP_H__
  22. #include <rfb/VNCServerST.h>
  23. #include <tx/TXWindow.h>
  24. #include <unixcommon.h>
  25. #include <X11/XKBlib.h>
  26. #ifdef HAVE_XDAMAGE
  27. #include <X11/extensions/Xdamage.h>
  28. #endif
  29. class Geometry;
  30. class XPixelBuffer;
  31. // number of XKb indicator leds to handle
  32. #define XDESKTOP_N_LEDS 3
  33. class XDesktop : public rfb::SDesktop, public TXGlobalEventHandler
  34. {
  35. public:
  36. XDesktop(Display* dpy_, Geometry *geometry);
  37. virtual ~XDesktop();
  38. void poll();
  39. // -=- SDesktop interface
  40. virtual void start(rfb::VNCServer* vs);
  41. virtual void stop();
  42. bool isRunning();
  43. virtual void pointerEvent(const rfb::Point& pos, int buttonMask);
  44. KeyCode XkbKeysymToKeycode(Display* dpy, KeySym keysym);
  45. virtual void keyEvent(rdr::U32 keysym, rdr::U32 xtcode, bool down);
  46. virtual void clientCutText(const char* str, int len);
  47. virtual unsigned int setScreenLayout(int fb_width, int fb_height,
  48. const rfb::ScreenSet& layout);
  49. // -=- TXGlobalEventHandler interface
  50. virtual bool handleGlobalEvent(XEvent* ev);
  51. protected:
  52. Display* dpy;
  53. Geometry* geometry;
  54. XPixelBuffer* pb;
  55. rfb::VNCServerST* server;
  56. int oldButtonMask;
  57. bool haveXtest;
  58. bool haveDamage;
  59. int maxButtons;
  60. std::map<KeySym, KeyCode> pressedKeys;
  61. bool running;
  62. #ifdef HAVE_XDAMAGE
  63. Damage damage;
  64. int xdamageEventBase;
  65. #endif
  66. int xkbEventBase;
  67. #ifdef HAVE_XFIXES
  68. int xfixesEventBase;
  69. #endif
  70. #ifdef HAVE_XRANDR
  71. int xrandrEventBase;
  72. OutputIdMap outputIdMap;
  73. unsigned long randrSyncSerial;
  74. #endif
  75. int ledMasks[XDESKTOP_N_LEDS];
  76. unsigned ledState;
  77. const unsigned short *codeMap;
  78. unsigned codeMapLen;
  79. bool setCursor();
  80. rfb::ScreenSet computeScreenLayout();
  81. };
  82. #endif // __XDESKTOP_H__