Blame uwac/include/uwac/uwac.h

Packit 1fb8d4
/*
Packit 1fb8d4
 * Copyright © 2014-2015 David FORT <contact@hardening-consulting.com>
Packit 1fb8d4
 *
Packit 1fb8d4
 * Permission to use, copy, modify, distribute, and sell this software and its
Packit 1fb8d4
 * documentation for any purpose is hereby granted without fee, provided that
Packit 1fb8d4
 * the above copyright notice appear in all copies and that both that copyright
Packit 1fb8d4
 * notice and this permission notice appear in supporting documentation, and
Packit 1fb8d4
 * that the name of the copyright holders not be used in advertising or
Packit 1fb8d4
 * publicity pertaining to distribution of the software without specific,
Packit 1fb8d4
 * written prior permission.  The copyright holders make no representations
Packit 1fb8d4
 * about the suitability of this software for any purpose.  It is provided "as
Packit 1fb8d4
 * is" without express or implied warranty.
Packit 1fb8d4
 *
Packit 1fb8d4
 * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
Packit 1fb8d4
 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
Packit 1fb8d4
 * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
Packit 1fb8d4
 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
Packit 1fb8d4
 * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
Packit 1fb8d4
 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
Packit 1fb8d4
 * OF THIS SOFTWARE.
Packit 1fb8d4
 */
Packit 1fb8d4
Packit 1fb8d4
#ifndef UWAC_H_
Packit 1fb8d4
#define UWAC_H_
Packit 1fb8d4
Packit 1fb8d4
#include <wayland-client.h>
Packit 1fb8d4
#include <stdbool.h>
Packit 1fb8d4
Packit 1fb8d4
#if __GNUC__ >= 4
Packit Service 5a9772
#define UWAC_API __attribute__((visibility("default")))
Packit 1fb8d4
#else
Packit Service 5a9772
#define UWAC_API
Packit 1fb8d4
#endif
Packit 1fb8d4
Packit Service 5a9772
typedef struct uwac_position UwacPosition;
Packit 1fb8d4
typedef struct uwac_size UwacSize;
Packit 1fb8d4
typedef struct uwac_display UwacDisplay;
Packit 1fb8d4
typedef struct uwac_output UwacOutput;
Packit 1fb8d4
typedef struct uwac_window UwacWindow;
Packit 1fb8d4
typedef struct uwac_seat UwacSeat;
Packit 1fb8d4
typedef uint32_t UwacSeatId;
Packit 1fb8d4
Packit 1fb8d4
/** @brief error codes */
Packit Service 5a9772
typedef enum
Packit Service 5a9772
{
Packit 1fb8d4
	UWAC_SUCCESS = 0,
Packit 1fb8d4
	UWAC_ERROR_NOMEMORY,
Packit 1fb8d4
	UWAC_ERROR_UNABLE_TO_CONNECT,
Packit 1fb8d4
	UWAC_ERROR_INVALID_DISPLAY,
Packit 1fb8d4
	UWAC_NOT_ENOUGH_RESOURCES,
Packit 1fb8d4
	UWAC_TIMEDOUT,
Packit 1fb8d4
	UWAC_NOT_FOUND,
Packit 1fb8d4
	UWAC_ERROR_CLOSED,
Packit 1fb8d4
	UWAC_ERROR_INTERNAL,
Packit 1fb8d4
Packit 1fb8d4
	UWAC_ERROR_LAST,
Packit 1fb8d4
} UwacReturnCode;
Packit 1fb8d4
Packit 1fb8d4
/** @brief input modifiers */
Packit Service 5a9772
enum
Packit Service 5a9772
{
Packit Service 5a9772
	UWAC_MOD_SHIFT_MASK = 0x01,
Packit 1fb8d4
	UWAC_MOD_ALT_MASK = 0x02,
Packit 1fb8d4
	UWAC_MOD_CONTROL_MASK = 0x04,
Packit 1fb8d4
};
Packit 1fb8d4
Packit Service 5a9772
/** @brief a position */
Packit Service 5a9772
struct uwac_position
Packit Service 5a9772
{
Packit Service 5a9772
	int x;
Packit Service 5a9772
	int y;
Packit Service 5a9772
};
Packit Service 5a9772
Packit 1fb8d4
/** @brief a rectangle size measure */
Packit Service 5a9772
struct uwac_size
Packit Service 5a9772
{
Packit 1fb8d4
	int width;
Packit 1fb8d4
	int height;
Packit 1fb8d4
};
Packit 1fb8d4
Packit 1fb8d4
/** @brief event types */
Packit Service 5a9772
enum
Packit Service 5a9772
{
Packit 1fb8d4
	UWAC_EVENT_NEW_SEAT = 0,
Packit 1fb8d4
	UWAC_EVENT_REMOVED_SEAT,
Packit 1fb8d4
	UWAC_EVENT_NEW_OUTPUT,
Packit 1fb8d4
	UWAC_EVENT_CONFIGURE,
Packit 1fb8d4
	UWAC_EVENT_POINTER_ENTER,
Packit 1fb8d4
	UWAC_EVENT_POINTER_LEAVE,
Packit 1fb8d4
	UWAC_EVENT_POINTER_MOTION,
Packit 1fb8d4
	UWAC_EVENT_POINTER_BUTTONS,
Packit 1fb8d4
	UWAC_EVENT_POINTER_AXIS,
Packit 1fb8d4
	UWAC_EVENT_KEYBOARD_ENTER,
Packit 1fb8d4
	UWAC_EVENT_KEY,
Packit 1fb8d4
	UWAC_EVENT_TOUCH_FRAME_BEGIN,
Packit 1fb8d4
	UWAC_EVENT_TOUCH_UP,
Packit 1fb8d4
	UWAC_EVENT_TOUCH_DOWN,
Packit 1fb8d4
	UWAC_EVENT_TOUCH_MOTION,
Packit 1fb8d4
	UWAC_EVENT_TOUCH_CANCEL,
Packit 1fb8d4
	UWAC_EVENT_TOUCH_FRAME_END,
Packit 1fb8d4
	UWAC_EVENT_FRAME_DONE,
Packit 1fb8d4
	UWAC_EVENT_CLOSE,
Packit Service 5a9772
	UWAC_EVENT_CLIPBOARD_AVAILABLE,
Packit Service 5a9772
	UWAC_EVENT_CLIPBOARD_SELECT,
Packit Service 5a9772
	UWAC_EVENT_CLIPBOARD_OFFER,
Packit Service 5a9772
	UWAC_EVENT_OUTPUT_GEOMETRY,
Packit 1fb8d4
};
Packit 1fb8d4
Packit 1fb8d4
/** @brief window states */
Packit Service 5a9772
enum
Packit Service 5a9772
{
Packit Service 5a9772
	UWAC_WINDOW_MAXIMIZED = 0x1,
Packit Service 5a9772
	UWAC_WINDOW_RESIZING = 0x2,
Packit Service 5a9772
	UWAC_WINDOW_FULLSCREEN = 0x4,
Packit Service 5a9772
	UWAC_WINDOW_ACTIVATED = 0x8,
Packit 1fb8d4
};
Packit 1fb8d4
Packit Service 5a9772
struct uwac_new_output_event
Packit Service 5a9772
{
Packit 1fb8d4
	int type;
Packit Service 5a9772
	UwacOutput* output;
Packit 1fb8d4
};
Packit 1fb8d4
typedef struct uwac_new_output_event UwacOutputNewEvent;
Packit 1fb8d4
Packit Service 5a9772
struct uwac_new_seat_event
Packit Service 5a9772
{
Packit 1fb8d4
	int type;
Packit Service 5a9772
	UwacSeat* seat;
Packit 1fb8d4
};
Packit 1fb8d4
typedef struct uwac_new_seat_event UwacSeatNewEvent;
Packit 1fb8d4
Packit Service 5a9772
struct uwac_removed_seat_event
Packit Service 5a9772
{
Packit 1fb8d4
	int type;
Packit 1fb8d4
	UwacSeatId id;
Packit 1fb8d4
};
Packit 1fb8d4
typedef struct uwac_removed_seat_event UwacSeatRemovedEvent;
Packit 1fb8d4
Packit Service 5a9772
struct uwac_keyboard_enter_event
Packit Service 5a9772
{
Packit 1fb8d4
	int type;
Packit Service 5a9772
	UwacWindow* window;
Packit Service 5a9772
	UwacSeat* seat;
Packit 1fb8d4
};
Packit 1fb8d4
typedef struct uwac_keyboard_enter_event UwacKeyboardEnterLeaveEvent;
Packit 1fb8d4
Packit Service 5a9772
struct uwac_pointer_enter_event
Packit Service 5a9772
{
Packit 1fb8d4
	int type;
Packit Service 5a9772
	UwacWindow* window;
Packit Service 5a9772
	UwacSeat* seat;
Packit 1fb8d4
	uint32_t x, y;
Packit 1fb8d4
};
Packit 1fb8d4
typedef struct uwac_pointer_enter_event UwacPointerEnterLeaveEvent;
Packit 1fb8d4
Packit Service 5a9772
struct uwac_pointer_motion_event
Packit Service 5a9772
{
Packit 1fb8d4
	int type;
Packit Service 5a9772
	UwacWindow* window;
Packit Service 5a9772
	UwacSeat* seat;
Packit 1fb8d4
	uint32_t x, y;
Packit 1fb8d4
};
Packit 1fb8d4
typedef struct uwac_pointer_motion_event UwacPointerMotionEvent;
Packit 1fb8d4
Packit Service 5a9772
struct uwac_pointer_button_event
Packit Service 5a9772
{
Packit 1fb8d4
	int type;
Packit Service 5a9772
	UwacWindow* window;
Packit Service 5a9772
	UwacSeat* seat;
Packit 1fb8d4
	uint32_t x, y;
Packit 1fb8d4
	uint32_t button;
Packit 1fb8d4
	enum wl_pointer_button_state state;
Packit 1fb8d4
};
Packit 1fb8d4
typedef struct uwac_pointer_button_event UwacPointerButtonEvent;
Packit 1fb8d4
Packit Service 5a9772
struct uwac_pointer_axis_event
Packit Service 5a9772
{
Packit 1fb8d4
	int type;
Packit Service 5a9772
	UwacWindow* window;
Packit Service 5a9772
	UwacSeat* seat;
Packit 1fb8d4
	uint32_t x, y;
Packit 1fb8d4
	uint32_t axis;
Packit 1fb8d4
	wl_fixed_t value;
Packit 1fb8d4
};
Packit 1fb8d4
typedef struct uwac_pointer_axis_event UwacPointerAxisEvent;
Packit 1fb8d4
Packit Service 5a9772
struct uwac_touch_frame_event
Packit Service 5a9772
{
Packit 1fb8d4
	int type;
Packit Service 5a9772
	UwacWindow* window;
Packit Service 5a9772
	UwacSeat* seat;
Packit 1fb8d4
};
Packit 1fb8d4
typedef struct uwac_touch_frame_event UwacTouchFrameBegin;
Packit 1fb8d4
typedef struct uwac_touch_frame_event UwacTouchFrameEnd;
Packit 1fb8d4
typedef struct uwac_touch_frame_event UwacTouchCancel;
Packit 1fb8d4
Packit Service 5a9772
struct uwac_touch_data
Packit Service 5a9772
{
Packit 1fb8d4
	int type;
Packit Service 5a9772
	UwacWindow* window;
Packit Service 5a9772
	UwacSeat* seat;
Packit 1fb8d4
	int32_t id;
Packit 1fb8d4
	wl_fixed_t x;
Packit 1fb8d4
	wl_fixed_t y;
Packit 1fb8d4
};
Packit 1fb8d4
typedef struct uwac_touch_data UwacTouchUp;
Packit 1fb8d4
typedef struct uwac_touch_data UwacTouchDown;
Packit 1fb8d4
typedef struct uwac_touch_data UwacTouchMotion;
Packit 1fb8d4
Packit Service 5a9772
struct uwac_frame_done_event
Packit Service 5a9772
{
Packit 1fb8d4
	int type;
Packit Service 5a9772
	UwacWindow* window;
Packit 1fb8d4
};
Packit 1fb8d4
typedef struct uwac_frame_done_event UwacFrameDoneEvent;
Packit 1fb8d4
Packit Service 5a9772
struct uwac_configure_event
Packit Service 5a9772
{
Packit 1fb8d4
	int type;
Packit Service 5a9772
	UwacWindow* window;
Packit 1fb8d4
	int32_t width;
Packit 1fb8d4
	int32_t height;
Packit 1fb8d4
	int states;
Packit 1fb8d4
};
Packit 1fb8d4
typedef struct uwac_configure_event UwacConfigureEvent;
Packit 1fb8d4
Packit Service 5a9772
struct uwac_key_event
Packit Service 5a9772
{
Packit 1fb8d4
	int type;
Packit Service 5a9772
	UwacWindow* window;
Packit 1fb8d4
	uint32_t raw_key;
Packit 1fb8d4
	uint32_t sym;
Packit 1fb8d4
	bool pressed;
Packit 1fb8d4
};
Packit 1fb8d4
typedef struct uwac_key_event UwacKeyEvent;
Packit 1fb8d4
Packit Service 5a9772
struct uwac_close_event
Packit Service 5a9772
{
Packit 1fb8d4
	int type;
Packit Service 5a9772
	UwacWindow* window;
Packit 1fb8d4
};
Packit 1fb8d4
typedef struct uwac_close_event UwacCloseEvent;
Packit 1fb8d4
Packit Service 5a9772
struct uwac_clipboard_event
Packit Service 5a9772
{
Packit Service 5a9772
	int type;
Packit Service 5a9772
	UwacSeat* seat;
Packit Service 5a9772
	char mime[64];
Packit Service 5a9772
};
Packit Service 5a9772
typedef struct uwac_clipboard_event UwacClipboardEvent;
Packit Service 5a9772
Packit Service 5a9772
struct uwac_output_geometry_event
Packit Service 5a9772
{
Packit Service 5a9772
	int type;
Packit Service 5a9772
	UwacOutput* output;
Packit Service 5a9772
	int x;
Packit Service 5a9772
	int y;
Packit Service 5a9772
	int physical_width;
Packit Service 5a9772
	int physical_height;
Packit Service 5a9772
	int subpixel;
Packit Service 5a9772
	const char* make;
Packit Service 5a9772
	const char* model;
Packit Service 5a9772
	int transform;
Packit Service 5a9772
};
Packit Service 5a9772
typedef struct uwac_output_geometry_event UwacOutputGeometryEvent;
Packit 1fb8d4
Packit 1fb8d4
/** @brief */
Packit 1fb8d4
union uwac_event {
Packit 1fb8d4
	int type;
Packit 1fb8d4
	UwacOutputNewEvent output_new;
Packit Service 5a9772
	UwacOutputGeometryEvent output_geometry;
Packit 1fb8d4
	UwacSeatNewEvent seat_new;
Packit 1fb8d4
	UwacSeatRemovedEvent seat_removed;
Packit 1fb8d4
	UwacPointerEnterLeaveEvent mouse_enter_leave;
Packit 1fb8d4
	UwacPointerMotionEvent mouse_motion;
Packit 1fb8d4
	UwacPointerButtonEvent mouse_button;
Packit 1fb8d4
	UwacPointerAxisEvent mouse_axis;
Packit 1fb8d4
	UwacKeyboardEnterLeaveEvent keyboard_enter_leave;
Packit Service 5a9772
	UwacClipboardEvent clipboard;
Packit 1fb8d4
	UwacKeyEvent key;
Packit 1fb8d4
	UwacTouchFrameBegin touchFrameBegin;
Packit 1fb8d4
	UwacTouchUp touchUp;
Packit 1fb8d4
	UwacTouchDown touchDown;
Packit 1fb8d4
	UwacTouchMotion touchMotion;
Packit 1fb8d4
	UwacTouchFrameEnd touchFrameEnd;
Packit 1fb8d4
	UwacTouchCancel touchCancel;
Packit 1fb8d4
	UwacFrameDoneEvent frame_done;
Packit 1fb8d4
	UwacConfigureEvent configure;
Packit 1fb8d4
	UwacCloseEvent close;
Packit 1fb8d4
};
Packit 1fb8d4
typedef union uwac_event UwacEvent;
Packit 1fb8d4
Packit Service 5a9772
typedef bool (*UwacErrorHandler)(UwacDisplay* d, UwacReturnCode code, const char* msg, ...);
Packit Service 5a9772
typedef void (*UwacDataTransferHandler)(UwacSeat* seat, void* context, const char* mime, int fd);
Packit Service 5a9772
typedef void (*UwacCancelDataTransferHandler)(UwacSeat* seat, void* context);
Packit 1fb8d4
Packit 1fb8d4
#ifdef __cplusplus
Packit Service 5a9772
extern "C"
Packit Service 5a9772
{
Packit 1fb8d4
#endif
Packit 1fb8d4
Packit Service 5a9772
	/**
Packit Service 5a9772
	 *	install a handler that will be called when UWAC encounter internal errors. The
Packit Service 5a9772
	 *	handler is supposed to answer if the execution can continue. I can also be used
Packit Service 5a9772
	 *	to log things.
Packit Service 5a9772
	 *
Packit Service 5a9772
	 * @param handler
Packit Service 5a9772
	 */
Packit Service 5a9772
	UWAC_API void UwacInstallErrorHandler(UwacErrorHandler handler);
Packit Service 5a9772
Packit Service 5a9772
	/**
Packit Service 5a9772
	 *	Opens the corresponding wayland display, using NULL you will open the default
Packit Service 5a9772
	 *	display.
Packit Service 5a9772
	 *
Packit Service 5a9772
	 * @param name the name of the display to open
Packit Service 5a9772
	 * @return the created UwacDisplay object
Packit Service 5a9772
	 */
Packit Service 5a9772
	UWAC_API UwacDisplay* UwacOpenDisplay(const char* name, UwacReturnCode* err);
Packit Service 5a9772
Packit Service 5a9772
	/**
Packit Service 5a9772
	 *	closes the corresponding UwacDisplay
Packit Service 5a9772
	 *
Packit Service 5a9772
	 * @param pdisplay a pointer on the display to close
Packit Service 5a9772
	 * @return UWAC_SUCCESS if the operation was successful, the corresponding error otherwise
Packit Service 5a9772
	 */
Packit Service 5a9772
	UWAC_API UwacReturnCode UwacCloseDisplay(UwacDisplay** pdisplay);
Packit Service 5a9772
Packit Service 5a9772
	/**
Packit Service 5a9772
	 * Returns the file descriptor associated with the UwacDisplay, this is useful when
Packit Service 5a9772
	 * you want to poll that file descriptor for activity.
Packit Service 5a9772
	 *
Packit Service 5a9772
	 * @param display an opened UwacDisplay
Packit Service 5a9772
	 * @return the corresponding descriptor
Packit Service 5a9772
	 */
Packit Service 5a9772
	UWAC_API int UwacDisplayGetFd(UwacDisplay* display);
Packit Service 5a9772
Packit Service 5a9772
	/**
Packit Service 5a9772
	 *	Returns a human readable form of a Uwac error code
Packit Service 5a9772
	 *
Packit Service 5a9772
	 * @param error the error number
Packit Service 5a9772
	 * @return the associated string
Packit Service 5a9772
	 */
Packit Service 5a9772
	UWAC_API const char* UwacErrorString(UwacReturnCode error);
Packit Service 5a9772
Packit Service 5a9772
	/**
Packit Service 5a9772
	 * returns the last error that occurred on a display
Packit Service 5a9772
	 *
Packit Service 5a9772
	 * @param display the display
Packit Service 5a9772
	 * @return the last error that have been set for this display
Packit Service 5a9772
	 */
Packit Service 5a9772
	UWAC_API UwacReturnCode UwacDisplayGetLastError(const UwacDisplay* display);
Packit Service 5a9772
Packit Service 5a9772
	/**
Packit Service 5a9772
	 * retrieves the version of a given interface
Packit Service 5a9772
	 *
Packit Service 5a9772
	 * @param display the display connection
Packit Service 5a9772
	 * @param name the name of the interface
Packit Service 5a9772
	 * @param version the output variable for the version
Packit Service 5a9772
	 * @return UWAC_SUCCESS if the interface was found, UWAC_NOT_FOUND otherwise
Packit Service 5a9772
	 */
Packit Service 5a9772
	UWAC_API UwacReturnCode UwacDisplayQueryInterfaceVersion(const UwacDisplay* display,
Packit Service 5a9772
	                                                         const char* name, uint32_t* version);
Packit Service 5a9772
Packit Service 5a9772
	/**
Packit Service 5a9772
	 *	returns the number SHM formats that have been reported by the compositor
Packit Service 5a9772
	 *
Packit Service 5a9772
	 * @param display a connected UwacDisplay
Packit Service 5a9772
	 * @return the number of SHM formats supported
Packit Service 5a9772
	 */
Packit Service 5a9772
	UWAC_API uint32_t UwacDisplayQueryGetNbShmFormats(UwacDisplay* display);
Packit Service 5a9772
Packit Service 5a9772
	/**
Packit Service 5a9772
	 *	returns the supported ShmFormats
Packit Service 5a9772
	 *
Packit Service 5a9772
	 * @param display a connected UwacDisplay
Packit Service 5a9772
	 * @param formats a pointer on an array of wl_shm_format with enough place for formats_size
Packit Service 5a9772
	 *items
Packit Service 5a9772
	 * @param formats_size the size of the formats array
Packit Service 5a9772
	 * @param filled the number of filled entries in the formats array
Packit Service 5a9772
	 * @return UWAC_SUCCESS on success, an error otherwise
Packit Service 5a9772
	 */
Packit Service 5a9772
	UWAC_API UwacReturnCode UwacDisplayQueryShmFormats(const UwacDisplay* display,
Packit Service 5a9772
	                                                   enum wl_shm_format* formats,
Packit Service 5a9772
	                                                   int formats_size, int* filled);
Packit Service 5a9772
Packit Service 5a9772
	/**
Packit Service 5a9772
	 *	returns the number of registered outputs
Packit Service 5a9772
	 *
Packit Service 5a9772
	 * @param display the display to query
Packit Service 5a9772
	 * @return the number of outputs
Packit Service 5a9772
	 */
Packit Service 5a9772
	UWAC_API uint32_t UwacDisplayGetNbOutputs(const UwacDisplay* display);
Packit Service 5a9772
Packit Service 5a9772
	/**
Packit Service 5a9772
	 *	retrieve a particular UwacOutput object
Packit Service 5a9772
	 *
Packit Service 5a9772
	 * @param display the display to query
Packit Service 5a9772
	 * @param index index of the output
Packit Service 5a9772
	 * @return the given UwacOutput, NULL if something failed (so you should query
Packit Service 5a9772
	 *UwacDisplayGetLastError() to have the reason)
Packit Service 5a9772
	 */
Packit Service 5a9772
	UWAC_API const UwacOutput* UwacDisplayGetOutput(UwacDisplay* display, int index);
Packit Service 5a9772
Packit Service 5a9772
	/**
Packit Service 5a9772
	 * retrieve the resolution of a given UwacOutput
Packit Service 5a9772
	 *
Packit Service 5a9772
	 * @param output the UwacOutput
Packit Service 5a9772
	 * @param resolution a pointer on the
Packit Service 5a9772
	 * @return UWAC_SUCCESS on success
Packit Service 5a9772
	 */
Packit Service 5a9772
	UWAC_API UwacReturnCode UwacOutputGetResolution(const UwacOutput* output, UwacSize* resolution);
Packit Service 5a9772
Packit Service 5a9772
	/**
Packit Service 5a9772
	 * retrieve the position of a given UwacOutput
Packit Service 5a9772
	 *
Packit Service 5a9772
	 * @param output the UwacOutput
Packit Service 5a9772
	 * @param pos a pointer on the target position
Packit Service 5a9772
	 * @return UWAC_SUCCESS on success
Packit Service 5a9772
	 */
Packit Service 5a9772
	UWAC_API UwacReturnCode UwacOutputGetPosition(const UwacOutput* output, UwacPosition* pos);
Packit Service 5a9772
Packit Service 5a9772
	/**
Packit Service 5a9772
	 *	creates a window using a SHM surface
Packit Service 5a9772
	 *
Packit Service 5a9772
	 * @param display the display to attach the window to
Packit Service 5a9772
	 * @param width the width of the window
Packit Service 5a9772
	 * @param height the heigh of the window
Packit Service 5a9772
	 * @param format format to use for the SHM surface
Packit Service 5a9772
	 * @return the created UwacWindow, NULL if something failed (use UwacDisplayGetLastError() to
Packit Service 5a9772
	 *know more about this)
Packit Service 5a9772
	 */
Packit Service 5a9772
	UWAC_API UwacWindow* UwacCreateWindowShm(UwacDisplay* display, uint32_t width, uint32_t height,
Packit Service 5a9772
	                                         enum wl_shm_format format);
Packit Service 5a9772
Packit Service 5a9772
	/**
Packit Service 5a9772
	 *	destroys the corresponding UwacWindow
Packit Service 5a9772
	 *
Packit Service 5a9772
	 * @param window a pointer on the UwacWindow to destroy
Packit Service 5a9772
	 * @return if the operation completed successfully
Packit Service 5a9772
	 */
Packit Service 5a9772
	UWAC_API UwacReturnCode UwacDestroyWindow(UwacWindow** window);
Packit Service 5a9772
Packit Service 5a9772
	/**
Packit Service 5a9772
	 *	Sets the region that should be considered opaque to the compositor.
Packit Service 5a9772
	 *
Packit Service 5a9772
	 * @param window the UwacWindow
Packit Service 5a9772
	 * @param x
Packit Service 5a9772
	 * @param y
Packit Service 5a9772
	 * @param width
Packit Service 5a9772
	 * @param height
Packit Service 5a9772
	 * @return UWAC_SUCCESS on success, an error otherwise
Packit Service 5a9772
	 */
Packit Service 5a9772
	UWAC_API UwacReturnCode UwacWindowSetOpaqueRegion(UwacWindow* window, uint32_t x, uint32_t y,
Packit Service 5a9772
	                                                  uint32_t width, uint32_t height);
Packit Service 5a9772
Packit Service 5a9772
	/**
Packit Service 5a9772
	 *	Sets the region of the window that can trigger input events
Packit Service 5a9772
	 *
Packit Service 5a9772
	 * @param window the UwacWindow
Packit Service 5a9772
	 * @param x
Packit Service 5a9772
	 * @param y
Packit Service 5a9772
	 * @param width
Packit Service 5a9772
	 * @param height
Packit Service 5a9772
	 * @return
Packit Service 5a9772
	 */
Packit Service 5a9772
	UWAC_API UwacReturnCode UwacWindowSetInputRegion(UwacWindow* window, uint32_t x, uint32_t y,
Packit Service 5a9772
	                                                 uint32_t width, uint32_t height);
Packit Service 5a9772
Packit Service 5a9772
	/**
Packit Service 5a9772
	 *	retrieves a pointer on the current window content to draw a frame
Packit Service 5a9772
	 * @param window the UwacWindow
Packit Service 5a9772
	 * @return a pointer on the current window content
Packit Service 5a9772
	 */
Packit Service 5a9772
	UWAC_API void* UwacWindowGetDrawingBuffer(UwacWindow* window);
Packit Service 5a9772
Packit Service 5a9772
	/**
Packit Service 5a9772
	 *	sets a rectangle as dirty for the next frame of a window
Packit Service 5a9772
	 *
Packit Service 5a9772
	 * @param window the UwacWindow
Packit Service 5a9772
	 * @param x left coordinate
Packit Service 5a9772
	 * @param y top coordinate
Packit Service 5a9772
	 * @param width the width of the dirty rectangle
Packit Service 5a9772
	 * @param height the height of the dirty rectangle
Packit Service 5a9772
	 * @return UWAC_SUCCESS on success, an Uwac error otherwise
Packit Service 5a9772
	 */
Packit Service 5a9772
	UWAC_API UwacReturnCode UwacWindowAddDamage(UwacWindow* window, uint32_t x, uint32_t y,
Packit Service 5a9772
	                                            uint32_t width, uint32_t height);
Packit Service 5a9772
Packit Service 5a9772
	/**
Packit Service 5a9772
	 *	returns the geometry of the given UwacWindow buffer
Packit Service 5a9772
	 *
Packit Service 5a9772
	 * @param window   the UwacWindow
Packit Service 5a9772
	 * @param geometry the geometry to fill
Packit Service 5a9772
	 * @param stride   the length of a buffer line in bytes
Packit Service 5a9772
	 * @return UWAC_SUCCESS on success, an Uwac error otherwise
Packit Service 5a9772
	 */
Packit Service 5a9772
	UWAC_API UwacReturnCode UwacWindowGetDrawingBufferGeometry(UwacWindow* window,
Packit Service 5a9772
	                                                           UwacSize* geometry, size_t* stride);
Packit Service 5a9772
Packit Service 5a9772
	/**
Packit Service 5a9772
	 *	Sends a frame to the compositor with the content of the drawing buffer
Packit Service 5a9772
	 *
Packit Service 5a9772
	 * @param window the UwacWindow to refresh
Packit Service 5a9772
	 * @param copyContentForNextFrame if true the content to display is copied in the next drawing
Packit Service 5a9772
	 *buffer
Packit Service 5a9772
	 * @return UWAC_SUCCESS if the operation was successful
Packit Service 5a9772
	 */
Packit Service 5a9772
	UWAC_API UwacReturnCode UwacWindowSubmitBuffer(UwacWindow* window,
Packit Service 5a9772
	                                               bool copyContentForNextFrame);
Packit Service 5a9772
Packit Service 5a9772
	/**
Packit Service 5a9772
	 *	returns the geometry of the given UwacWindows
Packit Service 5a9772
	 *
Packit Service 5a9772
	 * @param window the UwacWindow
Packit Service 5a9772
	 * @param geometry the geometry to fill
Packit Service 5a9772
	 * @return UWAC_SUCCESS on success, an Uwac error otherwise
Packit Service 5a9772
	 */
Packit Service 5a9772
	UWAC_API UwacReturnCode UwacWindowGetGeometry(UwacWindow* window, UwacSize* geometry);
Packit Service 5a9772
Packit Service 5a9772
	/**
Packit Service 5a9772
	 *	Sets or unset the fact that the window is set fullscreen. After this call the
Packit Service 5a9772
	 *	application should get prepared to receive a configure event. The output is used
Packit Service 5a9772
	 *	only when going fullscreen, it is optional and not used when exiting fullscreen.
Packit Service 5a9772
	 *
Packit Service 5a9772
	 * @param window the UwacWindow
Packit Service 5a9772
	 * @param output an optional UwacOutput to put the window fullscreen on
Packit Service 5a9772
	 * @param isFullscreen set or unset fullscreen
Packit Service 5a9772
	 * @return UWAC_SUCCESS if the operation was a success
Packit Service 5a9772
	 */
Packit Service 5a9772
	UWAC_API UwacReturnCode UwacWindowSetFullscreenState(UwacWindow* window, UwacOutput* output,
Packit Service 5a9772
	                                                     bool isFullscreen);
Packit Service 5a9772
Packit Service 5a9772
	/**
Packit Service 5a9772
	 *	When possible (depending on the shell) sets the title of the UwacWindow
Packit Service 5a9772
	 *
Packit Service 5a9772
	 * @param window the UwacWindow
Packit Service 5a9772
	 * @param name title
Packit Service 5a9772
	 */
Packit Service 5a9772
	UWAC_API void UwacWindowSetTitle(UwacWindow* window, const char* name);
Packit Service 5a9772
Packit Service 5a9772
	/**
Packit Service 5a9772
	 *
Packit Service 5a9772
	 * @param display
Packit Service 5a9772
	 * @param timeout
Packit Service 5a9772
	 * @return
Packit Service 5a9772
	 */
Packit Service 5a9772
	UWAC_API int UwacDisplayDispatch(UwacDisplay* display, int timeout);
Packit Service 5a9772
Packit Service 5a9772
	/**
Packit Service 5a9772
	 *	Returns if you have some pending events, and you can UwacNextEvent() without blocking
Packit Service 5a9772
	 *
Packit Service 5a9772
	 * @param display the UwacDisplay
Packit Service 5a9772
	 * @return if there's some pending events
Packit Service 5a9772
	 */
Packit Service 5a9772
	UWAC_API bool UwacHasEvent(UwacDisplay* display);
Packit Service 5a9772
Packit Service 5a9772
	/** Waits until an event occurs, and when it's there copy the event from the queue to
Packit Service 5a9772
	 * event.
Packit Service 5a9772
	 *
Packit Service 5a9772
	 * @param display the Uwac display
Packit Service 5a9772
	 * @param event the event to fill
Packit Service 5a9772
	 * @return if the operation completed successfully
Packit Service 5a9772
	 */
Packit Service 5a9772
	UWAC_API UwacReturnCode UwacNextEvent(UwacDisplay* display, UwacEvent* event);
Packit Service 5a9772
Packit Service 5a9772
	/**
Packit Service 5a9772
	 * returns the name of the given UwacSeat
Packit Service 5a9772
	 *
Packit Service 5a9772
	 * @param seat the UwacSeat
Packit Service 5a9772
	 * @return the name of the seat
Packit Service 5a9772
	 */
Packit Service 5a9772
	UWAC_API const char* UwacSeatGetName(const UwacSeat* seat);
Packit Service 5a9772
Packit Service 5a9772
	/**
Packit Service 5a9772
	 * returns the id of the given UwacSeat
Packit Service 5a9772
	 *
Packit Service 5a9772
	 * @param seat the UwacSeat
Packit Service 5a9772
	 * @return the id of the seat
Packit Service 5a9772
	 */
Packit Service 5a9772
	UWAC_API UwacSeatId UwacSeatGetId(const UwacSeat* seat);
Packit Service 5a9772
Packit Service 5a9772
	/**
Packit Service 5a9772
	 *
Packit Service 5a9772
	 */
Packit Service 5a9772
	UWAC_API UwacReturnCode UwacClipboardOfferDestroy(UwacSeat* seat);
Packit Service 5a9772
	UWAC_API UwacReturnCode UwacClipboardOfferCreate(UwacSeat* seat, const char* mime);
Packit Service 5a9772
	UWAC_API UwacReturnCode UwacClipboardOfferAnnounce(UwacSeat* seat, void* context,
Packit Service 5a9772
	                                                   UwacDataTransferHandler transfer,
Packit Service 5a9772
	                                                   UwacCancelDataTransferHandler cancel);
Packit Service 5a9772
	UWAC_API void* UwacClipboardDataGet(UwacSeat* seat, const char* mime, size_t* size);
Packit Service 5a9772
Packit Service 5a9772
	/**
Packit Service 5a9772
	 * Inhibits or restores keyboard shortcuts.
Packit Service 5a9772
	 *
Packit Service 5a9772
	 * @param seat    The UwacSeat to inhibit the shortcuts for
Packit Service 5a9772
	 * @param inhibit Inhibit or restore keyboard shortcuts
Packit Service 5a9772
	 *
Packit Service 5a9772
	 * @return UWAC_SUCCESS or an appropriate error code.
Packit Service 5a9772
	 */
Packit Service 5a9772
	UWAC_API UwacReturnCode UwacSeatInhibitShortcuts(UwacSeat* seat, bool inhibit);
Packit Service 5a9772
Packit Service 5a9772
	/**
Packit Service 5a9772
	 * @brief UwacSeatSetMouseCursor Sets the specified image as the new mouse cursor.
Packit Service 5a9772
	 *                               Special values: If data == NULL && lenght == 0
Packit Service 5a9772
	 *                               the cursor is hidden, if data == NULL && length != 0
Packit Service 5a9772
	 *                               the default system cursor is used.
Packit Service 5a9772
	 *
Packit Service 5a9772
	 * @param seat   The UwacSeat to apply the cursor image to
Packit Service 5a9772
	 * @param data   A pointer to the image data
Packit Service 5a9772
	 * @param length The size of the image data
Packit Service 5a9772
	 * @param width  The image width in pixel
Packit Service 5a9772
	 * @param height The image height in pixel
Packit Service 5a9772
	 * @param hot_x  The hotspot horizontal offset in pixel
Packit Service 5a9772
	 * @param hot_y  The hotspot vertical offset in pixel
Packit Service 5a9772
	 *
Packit Service 5a9772
	 * @return UWAC_SUCCESS if successful, an appropriate error otherwise.
Packit Service 5a9772
	 */
Packit Service 5a9772
	UWAC_API UwacReturnCode UwacSeatSetMouseCursor(UwacSeat* seat, const void* data, size_t length,
Packit Service 5a9772
	                                               size_t width, size_t height, size_t hot_x,
Packit Service 5a9772
	                                               size_t hot_y);
Packit 1fb8d4
Packit 1fb8d4
#ifdef __cplusplus
Packit 1fb8d4
}
Packit 1fb8d4
#endif
Packit 1fb8d4
Packit 1fb8d4
#endif /* UWAC_H_ */