54 lines
1.5 KiB
C
54 lines
1.5 KiB
C
#ifndef WAYMINI_H
|
|
#define WAYMINI_H
|
|
|
|
#include <stdint.h>
|
|
#include <stddef.h>
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
struct waymini;
|
|
|
|
typedef void (*waymini_key_cb)(void *user, uint32_t keycode, uint32_t state);
|
|
|
|
/* Create a Wayland surface of the requested dimensions.
|
|
* key_cb may be NULL if keyboard input is not needed.
|
|
*/
|
|
struct waymini *waymini_create(uint32_t width, uint32_t height,
|
|
waymini_key_cb key_cb, void *user);
|
|
|
|
/* Dimensions and pixel access. */
|
|
uint32_t waymini_get_width(const struct waymini *wm);
|
|
uint32_t waymini_get_height(const struct waymini *wm);
|
|
uint32_t waymini_get_stride(const struct waymini *wm);
|
|
void *waymini_get_pixels(const struct waymini *wm);
|
|
|
|
/* Mark the SHM buffer as changed and commit it to the compositor. */
|
|
void waymini_present(struct waymini *wm);
|
|
|
|
/* Dispatch one or more Wayland events. Returns 0 on success, -1 on error.
|
|
* Blocks until at least one event is processed.
|
|
*/
|
|
int waymini_dispatch(struct waymini *wm);
|
|
|
|
/* Non-blocking poll for events. Returns 1 if events were dispatched, 0 if no
|
|
* events were available, and -1 on error.
|
|
*/
|
|
int waymini_poll(struct waymini *wm);
|
|
|
|
/* Request a graceful close (e.g. from the toplevel close button). */
|
|
void waymini_request_close(struct waymini *wm);
|
|
|
|
/* Returns non-zero when the compositor asked us to close. */
|
|
int waymini_should_close(const struct waymini *wm);
|
|
|
|
/* Clean up. */
|
|
void waymini_destroy(struct waymini *wm);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif /* WAYMINI_H */
|