2023-07-21 13:37:20 +00:00
|
|
|
#pragma once
|
2019-12-06 18:05:32 +00:00
|
|
|
|
2022-05-11 21:41:32 +00:00
|
|
|
#include <glib-object.h>
|
2019-12-06 18:05:32 +00:00
|
|
|
#include <stdio.h>
|
2022-05-11 19:47:35 +00:00
|
|
|
#include <wayland-client.h>
|
|
|
|
|
2023-03-01 22:36:42 +00:00
|
|
|
#include "fractional-scale-v1-client-protocol.h"
|
2022-07-29 11:22:38 +00:00
|
|
|
#include "single-pixel-buffer-v1-client-protocol.h"
|
2022-05-11 19:47:35 +00:00
|
|
|
#include "test-driver-client-protocol.h"
|
2022-07-29 11:22:38 +00:00
|
|
|
#include "viewporter-client-protocol.h"
|
2022-05-11 19:47:35 +00:00
|
|
|
#include "xdg-shell-client-protocol.h"
|
|
|
|
|
|
|
|
typedef enum _WaylandDisplayCapabilities
|
|
|
|
{
|
2022-05-11 20:50:58 +00:00
|
|
|
WAYLAND_DISPLAY_CAPABILITY_NONE = 0,
|
2022-05-11 19:47:35 +00:00
|
|
|
WAYLAND_DISPLAY_CAPABILITY_TEST_DRIVER = 1 << 0,
|
2022-05-11 21:59:11 +00:00
|
|
|
WAYLAND_DISPLAY_CAPABILITY_XDG_SHELL_V4 = 1 << 1,
|
2022-05-11 19:47:35 +00:00
|
|
|
} WaylandDisplayCapabilities;
|
|
|
|
|
|
|
|
typedef struct _WaylandDisplay
|
|
|
|
{
|
2022-05-11 21:41:32 +00:00
|
|
|
GObject parent;
|
|
|
|
|
2022-05-11 19:47:35 +00:00
|
|
|
WaylandDisplayCapabilities capabilities;
|
|
|
|
|
|
|
|
struct wl_display *display;
|
|
|
|
struct wl_registry *registry;
|
|
|
|
struct wl_compositor *compositor;
|
|
|
|
struct wl_subcompositor *subcompositor;
|
|
|
|
struct wl_shm *shm;
|
2023-03-01 22:36:42 +00:00
|
|
|
struct wp_fractional_scale_manager_v1 *fractional_scale_mgr;
|
2022-07-29 11:22:38 +00:00
|
|
|
struct wp_single_pixel_buffer_manager_v1 *single_pixel_mgr;
|
|
|
|
struct wp_viewporter *viewporter;
|
|
|
|
struct xdg_wm_base *xdg_wm_base;
|
2022-05-11 19:47:35 +00:00
|
|
|
struct test_driver *test_driver;
|
2022-05-13 19:56:50 +00:00
|
|
|
|
2023-10-30 14:50:40 +00:00
|
|
|
uint32_t sync_event_serial_next;
|
|
|
|
|
2022-05-13 19:56:50 +00:00
|
|
|
GHashTable *properties;
|
2022-05-11 19:47:35 +00:00
|
|
|
} WaylandDisplay;
|
2019-12-06 18:05:32 +00:00
|
|
|
|
2022-11-15 09:48:57 +00:00
|
|
|
typedef struct _WaylandSurface
|
|
|
|
{
|
|
|
|
WaylandDisplay *display;
|
|
|
|
|
|
|
|
struct wl_surface *wl_surface;
|
|
|
|
struct xdg_surface *xdg_surface;
|
|
|
|
struct xdg_toplevel *xdg_toplevel;
|
|
|
|
|
|
|
|
int default_width;
|
|
|
|
int default_height;
|
|
|
|
int width;
|
|
|
|
int height;
|
|
|
|
|
|
|
|
uint32_t color;
|
|
|
|
} WaylandSurface;
|
|
|
|
|
2022-05-11 21:41:32 +00:00
|
|
|
G_DECLARE_FINAL_TYPE (WaylandDisplay, wayland_display,
|
|
|
|
WAYLAND, DISPLAY,
|
|
|
|
GObject)
|
|
|
|
|
2019-12-06 18:05:32 +00:00
|
|
|
int create_anonymous_file (off_t size);
|
|
|
|
|
2022-05-11 19:47:35 +00:00
|
|
|
WaylandDisplay * wayland_display_new (WaylandDisplayCapabilities capabilities);
|
|
|
|
|
2023-01-27 19:50:50 +00:00
|
|
|
WaylandDisplay * wayland_display_new_full (WaylandDisplayCapabilities capabilities,
|
|
|
|
struct wl_display *wayland_display);
|
|
|
|
|
2022-11-15 09:48:57 +00:00
|
|
|
WaylandSurface * wayland_surface_new (WaylandDisplay *display,
|
|
|
|
const char *title,
|
|
|
|
int default_width,
|
|
|
|
int default_height,
|
|
|
|
uint32_t color);
|
|
|
|
|
|
|
|
void wayland_surface_free (WaylandSurface *surface);
|
|
|
|
|
2022-05-23 09:05:10 +00:00
|
|
|
gboolean create_shm_buffer (WaylandDisplay *display,
|
|
|
|
int width,
|
|
|
|
int height,
|
|
|
|
struct wl_buffer **out_buffer,
|
|
|
|
void **out_data,
|
|
|
|
int *out_size);
|
|
|
|
|
2022-05-11 22:11:14 +00:00
|
|
|
void draw_surface (WaylandDisplay *display,
|
|
|
|
struct wl_surface *surface,
|
|
|
|
int width,
|
|
|
|
int height,
|
|
|
|
uint32_t color);
|
|
|
|
|
2022-05-13 19:56:50 +00:00
|
|
|
const char * lookup_property_value (WaylandDisplay *display,
|
|
|
|
const char *name);
|
|
|
|
|
2022-05-21 16:17:31 +00:00
|
|
|
void wait_for_effects_completed (WaylandDisplay *display,
|
|
|
|
struct wl_surface *surface);
|
|
|
|
|
|
|
|
void wait_for_view_verified (WaylandDisplay *display,
|
|
|
|
int sequence);
|
|
|
|
|
2022-11-15 09:47:50 +00:00
|
|
|
void wait_for_sync_event (WaylandDisplay *display,
|
|
|
|
uint32_t serial);
|