2016-01-18 17:55:33 +03:00
|
|
|
/*
|
|
|
|
* Copyright © 2014 David FORT <contact@hardening-consulting.com>
|
|
|
|
*
|
|
|
|
* Permission to use, copy, modify, distribute, and sell this software and its
|
|
|
|
* documentation for any purpose is hereby granted without fee, provided that
|
|
|
|
* the above copyright notice appear in all copies and that both that copyright
|
|
|
|
* notice and this permission notice appear in supporting documentation, and
|
|
|
|
* that the name of the copyright holders not be used in advertising or
|
|
|
|
* publicity pertaining to distribution of the software without specific,
|
|
|
|
* written prior permission. The copyright holders make no representations
|
|
|
|
* about the suitability of this software for any purpose. It is provided "as
|
|
|
|
* is" without express or implied warranty.
|
|
|
|
*
|
|
|
|
* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
|
|
|
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
|
|
|
* EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
|
|
|
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
|
|
|
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
|
|
|
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
|
|
|
* OF THIS SOFTWARE.
|
|
|
|
*/
|
|
|
|
|
2017-06-06 15:01:41 +03:00
|
|
|
#ifndef UWAC_PRIV_H_
|
|
|
|
#define UWAC_PRIV_H_
|
2016-01-18 17:55:33 +03:00
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
|
|
|
#include <stdbool.h>
|
|
|
|
#include <wayland-client.h>
|
|
|
|
#include "xdg-shell-client-protocol.h"
|
2019-01-22 15:46:46 +03:00
|
|
|
#include "keyboard-shortcuts-inhibit-unstable-v1-client-protocol.h"
|
2019-01-22 17:45:15 +03:00
|
|
|
#include "xdg-decoration-unstable-v1-client-protocol.h"
|
2019-01-22 18:13:08 +03:00
|
|
|
#include "server-decoration-client-protocol.h"
|
2019-01-22 15:46:46 +03:00
|
|
|
|
2016-01-18 17:55:33 +03:00
|
|
|
#ifdef BUILD_IVI
|
|
|
|
#include "ivi-application-client-protocol.h"
|
|
|
|
#endif
|
|
|
|
#ifdef BUILD_FULLSCREEN_SHELL
|
2019-01-22 15:09:59 +03:00
|
|
|
#include "fullscreen-shell-unstable-v1-client-protocol.h"
|
2016-01-18 17:55:33 +03:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef HAVE_PIXMAN_REGION
|
|
|
|
#include <pixman-1/pixman.h>
|
|
|
|
#else
|
|
|
|
#include <freerdp/codec/region.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <xkbcommon/xkbcommon.h>
|
|
|
|
|
|
|
|
#include <uwac/uwac.h>
|
|
|
|
|
|
|
|
extern UwacErrorHandler uwacErrorHandler;
|
|
|
|
|
|
|
|
typedef struct uwac_task UwacTask;
|
|
|
|
|
|
|
|
/** @brief */
|
2019-11-06 17:24:51 +03:00
|
|
|
struct uwac_task
|
|
|
|
{
|
|
|
|
void (*run)(UwacTask* task, uint32_t events);
|
2016-01-18 17:55:33 +03:00
|
|
|
struct wl_list link;
|
|
|
|
};
|
|
|
|
|
|
|
|
/** @brief a global registry object */
|
2019-11-06 17:24:51 +03:00
|
|
|
struct uwac_global
|
|
|
|
{
|
2016-01-18 17:55:33 +03:00
|
|
|
uint32_t name;
|
2019-11-06 17:24:51 +03:00
|
|
|
char* interface;
|
2016-01-18 17:55:33 +03:00
|
|
|
uint32_t version;
|
|
|
|
struct wl_list link;
|
|
|
|
};
|
|
|
|
typedef struct uwac_global UwacGlobal;
|
|
|
|
|
|
|
|
struct uwac_event_list_item;
|
|
|
|
typedef struct uwac_event_list_item UwacEventListItem;
|
|
|
|
|
|
|
|
/** @brief */
|
2019-11-06 17:24:51 +03:00
|
|
|
struct uwac_event_list_item
|
|
|
|
{
|
2016-01-18 17:55:33 +03:00
|
|
|
UwacEvent event;
|
|
|
|
UwacEventListItem *tail, *head;
|
|
|
|
};
|
|
|
|
|
|
|
|
/** @brief main connection object to a wayland display */
|
2019-11-06 17:24:51 +03:00
|
|
|
struct uwac_display
|
|
|
|
{
|
2016-01-18 17:55:33 +03:00
|
|
|
struct wl_list globals;
|
|
|
|
|
2019-11-06 17:24:51 +03:00
|
|
|
struct wl_display* display;
|
|
|
|
struct wl_registry* registry;
|
|
|
|
struct wl_compositor* compositor;
|
|
|
|
struct wl_subcompositor* subcompositor;
|
|
|
|
struct wl_shell* shell;
|
|
|
|
struct xdg_toplevel* xdg_toplevel;
|
|
|
|
struct xdg_wm_base* xdg_base;
|
2018-12-19 18:17:59 +03:00
|
|
|
struct wl_data_device_manager* devicemanager;
|
2019-11-06 17:24:51 +03:00
|
|
|
struct zwp_keyboard_shortcuts_inhibit_manager_v1* keyboard_inhibit_manager;
|
|
|
|
struct zxdg_decoration_manager_v1* deco_manager;
|
|
|
|
struct org_kde_kwin_server_decoration_manager* kde_deco_manager;
|
2016-01-18 17:55:33 +03:00
|
|
|
#ifdef BUILD_IVI
|
2019-11-06 17:24:51 +03:00
|
|
|
struct ivi_application* ivi_application;
|
2016-01-18 17:55:33 +03:00
|
|
|
#endif
|
|
|
|
#ifdef BUILD_FULLSCREEN_SHELL
|
2019-11-06 17:24:51 +03:00
|
|
|
struct zwp_fullscreen_shell_v1* fullscreen_shell;
|
2016-01-18 17:55:33 +03:00
|
|
|
#endif
|
|
|
|
|
2019-11-06 17:24:51 +03:00
|
|
|
struct wl_shm* shm;
|
|
|
|
enum wl_shm_format* shm_formats;
|
2016-01-18 17:55:33 +03:00
|
|
|
uint32_t shm_formats_nb;
|
|
|
|
bool has_rgb565;
|
|
|
|
|
2019-11-06 17:24:51 +03:00
|
|
|
struct wl_data_device_manager* data_device_manager;
|
|
|
|
struct text_cursor_position* text_cursor_position;
|
|
|
|
struct workspace_manager* workspace_manager;
|
2016-01-18 17:55:33 +03:00
|
|
|
|
|
|
|
struct wl_list seats;
|
|
|
|
|
|
|
|
int display_fd;
|
|
|
|
UwacReturnCode last_error;
|
|
|
|
uint32_t display_fd_events;
|
|
|
|
int epoll_fd;
|
|
|
|
bool running;
|
|
|
|
UwacTask dispatch_fd_task;
|
|
|
|
uint32_t serial;
|
|
|
|
|
|
|
|
struct wl_list windows;
|
|
|
|
|
|
|
|
struct wl_list outputs;
|
|
|
|
|
|
|
|
UwacEventListItem *push_queue, *pop_queue;
|
|
|
|
};
|
|
|
|
|
|
|
|
/** @brief an output on a wayland display */
|
2019-11-06 17:24:51 +03:00
|
|
|
struct uwac_output
|
|
|
|
{
|
|
|
|
UwacDisplay* display;
|
2016-01-18 17:55:33 +03:00
|
|
|
|
|
|
|
bool doneNeeded;
|
|
|
|
bool doneReceived;
|
|
|
|
|
|
|
|
UwacSize resolution;
|
|
|
|
int transform;
|
|
|
|
int scale;
|
2019-11-06 17:24:51 +03:00
|
|
|
char* make;
|
|
|
|
char* model;
|
2016-01-18 17:55:33 +03:00
|
|
|
uint32_t server_output_id;
|
2019-11-06 17:24:51 +03:00
|
|
|
struct wl_output* output;
|
2016-01-18 17:55:33 +03:00
|
|
|
|
|
|
|
struct wl_list link;
|
|
|
|
};
|
|
|
|
|
|
|
|
/** @brief a seat attached to a wayland display */
|
2019-11-06 17:24:51 +03:00
|
|
|
struct uwac_seat
|
|
|
|
{
|
|
|
|
UwacDisplay* display;
|
|
|
|
char* name;
|
|
|
|
struct wl_seat* seat;
|
2016-01-18 17:55:33 +03:00
|
|
|
uint32_t seat_id;
|
|
|
|
uint32_t seat_version;
|
2018-12-19 18:17:59 +03:00
|
|
|
struct wl_data_device* data_device;
|
|
|
|
struct wl_data_source* data_source;
|
2019-11-06 17:24:51 +03:00
|
|
|
struct wl_pointer* pointer;
|
|
|
|
struct wl_surface* pointer_surface;
|
|
|
|
struct wl_cursor_image* pointer_image;
|
|
|
|
struct wl_cursor_theme* cursor_theme;
|
|
|
|
struct wl_cursor* default_cursor;
|
|
|
|
void* pointer_data;
|
2019-01-28 17:29:30 +03:00
|
|
|
size_t pointer_size;
|
2019-01-25 15:05:51 +03:00
|
|
|
int pointer_type;
|
2019-11-06 17:24:51 +03:00
|
|
|
struct wl_keyboard* keyboard;
|
|
|
|
struct wl_touch* touch;
|
2018-12-19 18:17:59 +03:00
|
|
|
struct wl_data_offer* offer;
|
2019-11-06 17:24:51 +03:00
|
|
|
struct xkb_context* xkb_context;
|
|
|
|
struct zwp_keyboard_shortcuts_inhibitor_v1* keyboard_inhibitor;
|
2016-01-18 17:55:33 +03:00
|
|
|
|
2019-11-06 17:24:51 +03:00
|
|
|
struct
|
|
|
|
{
|
|
|
|
struct xkb_keymap* keymap;
|
|
|
|
struct xkb_state* state;
|
2016-01-18 17:55:33 +03:00
|
|
|
xkb_mod_mask_t control_mask;
|
|
|
|
xkb_mod_mask_t alt_mask;
|
|
|
|
xkb_mod_mask_t shift_mask;
|
|
|
|
} xkb;
|
|
|
|
uint32_t modifiers;
|
|
|
|
int32_t repeat_rate_sec, repeat_rate_nsec;
|
|
|
|
int32_t repeat_delay_sec, repeat_delay_nsec;
|
|
|
|
uint32_t repeat_sym, repeat_key, repeat_time;
|
|
|
|
|
|
|
|
struct wl_array pressed_keys;
|
|
|
|
|
2019-11-06 17:24:51 +03:00
|
|
|
UwacWindow* pointer_focus;
|
2016-01-18 17:55:33 +03:00
|
|
|
|
2019-11-06 17:24:51 +03:00
|
|
|
UwacWindow* keyboard_focus;
|
2016-01-18 17:55:33 +03:00
|
|
|
|
2019-11-06 17:24:51 +03:00
|
|
|
UwacWindow* touch_focus;
|
2016-01-18 17:55:33 +03:00
|
|
|
bool touch_frame_started;
|
|
|
|
|
|
|
|
int repeat_timer_fd;
|
|
|
|
UwacTask repeat_task;
|
|
|
|
float sx, sy;
|
|
|
|
struct wl_list link;
|
2018-12-19 18:17:59 +03:00
|
|
|
|
|
|
|
void* data_context;
|
|
|
|
UwacDataTransferHandler transfer_data;
|
|
|
|
UwacCancelDataTransferHandler cancel_data;
|
|
|
|
bool ignore_announcement;
|
2016-01-18 17:55:33 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
/** @brief a buffer used for drawing a surface frame */
|
2019-11-06 17:24:51 +03:00
|
|
|
struct uwac_buffer
|
|
|
|
{
|
2016-01-18 17:55:33 +03:00
|
|
|
bool used;
|
2019-07-25 19:44:25 +03:00
|
|
|
bool dirty;
|
2016-01-18 17:55:33 +03:00
|
|
|
#ifdef HAVE_PIXMAN_REGION
|
|
|
|
pixman_region32_t damage;
|
|
|
|
#else
|
|
|
|
REGION16 damage;
|
|
|
|
#endif
|
2019-11-06 17:24:51 +03:00
|
|
|
struct wl_buffer* wayland_buffer;
|
|
|
|
void* data;
|
2016-01-18 17:55:33 +03:00
|
|
|
};
|
|
|
|
typedef struct uwac_buffer UwacBuffer;
|
|
|
|
|
|
|
|
/** @brief a window */
|
2019-11-06 17:24:51 +03:00
|
|
|
struct uwac_window
|
|
|
|
{
|
|
|
|
UwacDisplay* display;
|
2016-01-18 17:55:33 +03:00
|
|
|
int width, height, stride;
|
|
|
|
int surfaceStates;
|
|
|
|
enum wl_shm_format format;
|
|
|
|
|
|
|
|
int nbuffers;
|
2019-11-06 17:24:51 +03:00
|
|
|
UwacBuffer* buffers;
|
2016-01-18 17:55:33 +03:00
|
|
|
|
2019-11-06 17:24:51 +03:00
|
|
|
struct wl_region* opaque_region;
|
|
|
|
struct wl_region* input_region;
|
2016-01-18 17:55:33 +03:00
|
|
|
UwacBuffer *drawingBuffer, *pendingBuffer;
|
2019-11-06 17:24:51 +03:00
|
|
|
struct wl_surface* surface;
|
|
|
|
struct wl_shell_surface* shell_surface;
|
|
|
|
struct xdg_surface* xdg_surface;
|
|
|
|
struct xdg_toplevel* xdg_toplevel;
|
|
|
|
struct zxdg_toplevel_decoration_v1* deco;
|
|
|
|
struct org_kde_kwin_server_decoration* kde_deco;
|
2016-01-18 17:55:33 +03:00
|
|
|
#ifdef BUILD_IVI
|
2019-11-06 17:24:51 +03:00
|
|
|
struct ivi_surface* ivi_surface;
|
2016-01-18 17:55:33 +03:00
|
|
|
#endif
|
|
|
|
struct wl_list link;
|
|
|
|
|
|
|
|
uint32_t pointer_enter_serial;
|
|
|
|
uint32_t pointer_cursor_serial;
|
|
|
|
int pointer_current_cursor;
|
|
|
|
};
|
|
|
|
|
|
|
|
/* in uwa-display.c */
|
2019-11-06 17:24:51 +03:00
|
|
|
UwacEvent* UwacDisplayNewEvent(UwacDisplay* d, int type);
|
|
|
|
int UwacDisplayWatchFd(UwacDisplay* display, int fd, uint32_t events, UwacTask* task);
|
2016-01-18 17:55:33 +03:00
|
|
|
|
|
|
|
/* in uwac-input.c */
|
2019-11-06 17:24:51 +03:00
|
|
|
UwacSeat* UwacSeatNew(UwacDisplay* d, uint32_t id, uint32_t version);
|
|
|
|
void UwacSeatDestroy(UwacSeat* s);
|
2016-01-18 17:55:33 +03:00
|
|
|
|
|
|
|
/* in uwac-output.c */
|
2019-11-06 17:24:51 +03:00
|
|
|
UwacOutput* UwacCreateOutput(UwacDisplay* d, uint32_t id, uint32_t version);
|
|
|
|
int UwacDestroyOutput(UwacOutput* output);
|
2016-01-18 17:55:33 +03:00
|
|
|
|
2018-12-19 18:17:59 +03:00
|
|
|
UwacReturnCode UwacSeatRegisterClipboard(UwacSeat* s);
|
|
|
|
|
2017-06-06 15:01:41 +03:00
|
|
|
#endif /* UWAC_PRIV_H_ */
|