1
0

xcursor-xcb.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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 xcb xcb connection
  46. * @param data xcursor object
  47. *
  48. * @note This needs to be executed within a valid render context
  49. *
  50. */
  51. void xcb_xcursor_update(xcb_connection_t *xcb, xcb_xcursor_t *data);
  52. /**
  53. * Draw the cursor
  54. *
  55. * This needs to be executed within a valid render context
  56. */
  57. void xcb_xcursor_render(xcb_xcursor_t *data);
  58. /**
  59. * Specify a manual offset for the cursor.
  60. */
  61. void xcb_xcursor_offset(xcb_xcursor_t *data, const int x_org, const int y_org);
  62. /**
  63. * Update the offset to match the window's origin.
  64. */
  65. void xcb_xcursor_offset_win(xcb_connection_t *xcb, xcb_xcursor_t *data, xcb_window_t win);
  66. #ifdef __cplusplus
  67. }
  68. #endif