xcursor-xcb.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. /*
  2. Copyright (C) 2014 by Leonhard Oelke <[email protected]>
  3. This program is free software: you can redistribute it and/or modify
  4. it under the terms of the GNU General Public License as published by
  5. the Free Software Foundation, either version 2 of the License, or
  6. (at your option) any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program. If not, see <http://www.gnu.org/licenses/>.
  13. */
  14. #pragma once
  15. #include <obs.h>
  16. #include <xcb/xfixes.h>
  17. #ifdef __cplusplus
  18. extern "C" {
  19. #endif
  20. typedef struct {
  21. unsigned int last_serial;
  22. unsigned int last_width;
  23. unsigned int last_height;
  24. gs_texture_t *tex;
  25. int x;
  26. int y;
  27. int x_org;
  28. int y_org;
  29. float x_render;
  30. float y_render;
  31. } xcb_xcursor_t;
  32. /**
  33. * Initializes the xcursor object
  34. *
  35. * @return NULL on error
  36. */
  37. xcb_xcursor_t *xcb_xcursor_init(xcb_connection_t *xcb);
  38. /**
  39. * Destroys the xcursor object
  40. * @param data xcursor object
  41. */
  42. void xcb_xcursor_destroy(xcb_xcursor_t *data);
  43. /**
  44. * Update the cursor data
  45. * @param data xcursor object
  46. * @param xc xcb cursor image reply
  47. *
  48. * @note This needs to be executed within a valid render context
  49. *
  50. */
  51. void xcb_xcursor_update(xcb_xcursor_t *data,
  52. xcb_xfixes_get_cursor_image_reply_t *xc);
  53. /**
  54. * Draw the cursor
  55. *
  56. * This needs to be executed within a valid render context
  57. */
  58. void xcb_xcursor_render(xcb_xcursor_t *data);
  59. /**
  60. * Specify offset for the cursor
  61. */
  62. void xcb_xcursor_offset(xcb_xcursor_t *data, const int x_org, const int y_org);
  63. #ifdef __cplusplus
  64. }
  65. #endif