github.com/rajveermalviya/gamen@v0.1.2-0.20220930195403-9be15877c1aa/internal/wayland/wayland-cursor.h (about) 1 //go:build linux && !android 2 /* 3 * Copyright © 2012 Intel Corporation 4 * 5 * Permission is hereby granted, free of charge, to any person obtaining 6 * a copy of this software and associated documentation files (the 7 * "Software"), to deal in the Software without restriction, including 8 * without limitation the rights to use, copy, modify, merge, publish, 9 * distribute, sublicense, and/or sell copies of the Software, and to 10 * permit persons to whom the Software is furnished to do so, subject to 11 * the following conditions: 12 * 13 * The above copyright notice and this permission notice (including the 14 * next paragraph) shall be included in all copies or substantial 15 * portions of the Software. 16 * 17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 21 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 22 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 23 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 24 * SOFTWARE. 25 */ 26 27 #ifndef WAYLAND_CURSOR_H 28 #define WAYLAND_CURSOR_H 29 30 #include <stdint.h> 31 32 #ifdef __cplusplus 33 extern "C" { 34 #endif 35 36 struct wl_cursor_theme; 37 struct wl_buffer; 38 struct wl_shm; 39 40 /** A still image part of a cursor 41 * 42 * Use `wl_cursor_image_get_buffer()` to get the corresponding `struct 43 * wl_buffer` to attach to your `struct wl_surface`. */ 44 struct wl_cursor_image { 45 /** Actual width */ 46 uint32_t width; 47 48 /** Actual height */ 49 uint32_t height; 50 51 /** Hot spot x (must be inside image) */ 52 uint32_t hotspot_x; 53 54 /** Hot spot y (must be inside image) */ 55 uint32_t hotspot_y; 56 57 /** Animation delay to next frame (ms) */ 58 uint32_t delay; 59 }; 60 61 /** A cursor, as returned by `wl_cursor_theme_get_cursor()` */ 62 struct wl_cursor { 63 /** How many images there are in this cursor’s animation */ 64 unsigned int image_count; 65 66 /** The array of still images composing this animation */ 67 struct wl_cursor_image **images; 68 69 /** The name of this cursor */ 70 char *name; 71 }; 72 73 struct wl_cursor_theme * 74 wl_cursor_theme_load(const char *name, int size, struct wl_shm *shm); 75 76 void 77 wl_cursor_theme_destroy(struct wl_cursor_theme *theme); 78 79 struct wl_cursor * 80 wl_cursor_theme_get_cursor(struct wl_cursor_theme *theme, 81 const char *name); 82 83 struct wl_buffer * 84 wl_cursor_image_get_buffer(struct wl_cursor_image *image); 85 86 int 87 wl_cursor_frame(struct wl_cursor *cursor, uint32_t time); 88 89 int 90 wl_cursor_frame_and_duration(struct wl_cursor *cursor, uint32_t time, 91 uint32_t *duration); 92 93 #ifdef __cplusplus 94 } 95 #endif 96 97 #endif