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.

XInputTouchHandler.h 1.9KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /* Copyright 2019 Aaron Sowry for Cendio AB
  2. * Copyright 2019-2020 Pierre Ossman 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. #ifndef __XINPUTTOUCHHANDLER_H__
  20. #define __XINPUTTOUCHHANDLER_H__
  21. #include "BaseTouchHandler.h"
  22. #include "GestureHandler.h"
  23. class XInputTouchHandler: public BaseTouchHandler, GestureHandler {
  24. public:
  25. XInputTouchHandler(Window wnd);
  26. bool grabPointer();
  27. void ungrabPointer();
  28. void processEvent(const XIDeviceEvent* devev);
  29. protected:
  30. void preparePointerEvent(XEvent* dst, const XIDeviceEvent* src);
  31. void fakeMotionEvent(const XIDeviceEvent* origEvent);
  32. void fakeButtonEvent(bool press, int button,
  33. const XIDeviceEvent* origEvent);
  34. void preparePointerEvent(XEvent* dst, const GestureEvent src);
  35. virtual void fakeMotionEvent(const GestureEvent origEvent);
  36. virtual void fakeButtonEvent(bool press, int button,
  37. const GestureEvent origEvent);
  38. virtual void fakeKeyEvent(bool press, int keycode,
  39. const GestureEvent origEvent);
  40. virtual void handleGestureEvent(const GestureEvent& event);
  41. private:
  42. void pushFakeEvent(XEvent* event);
  43. private:
  44. Window wnd;
  45. int fakeStateMask;
  46. };
  47. #endif