2012-12-08 01:50:32 +04:00
|
|
|
/*
|
|
|
|
* Copyright © 2012 Intel Corporation
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _WESTON_TEST_CLIENT_HELPER_H_
|
|
|
|
#define _WESTON_TEST_CLIENT_HELPER_H_
|
|
|
|
|
2014-04-07 15:40:35 +04:00
|
|
|
#include "config.h"
|
|
|
|
|
2012-12-08 01:50:32 +04:00
|
|
|
#include <assert.h>
|
2015-01-23 21:12:36 +03:00
|
|
|
#include <stdbool.h>
|
2012-12-08 01:50:32 +04:00
|
|
|
#include "weston-test-runner.h"
|
2015-02-24 18:32:14 +03:00
|
|
|
#include "weston-test-client-protocol.h"
|
2012-12-08 01:50:32 +04:00
|
|
|
|
|
|
|
struct client {
|
|
|
|
struct wl_display *wl_display;
|
|
|
|
struct wl_registry *wl_registry;
|
|
|
|
struct wl_compositor *wl_compositor;
|
|
|
|
struct wl_shm *wl_shm;
|
|
|
|
struct test *test;
|
|
|
|
struct input *input;
|
|
|
|
struct output *output;
|
|
|
|
struct surface *surface;
|
|
|
|
int has_argb;
|
2012-12-12 08:03:56 +04:00
|
|
|
struct wl_list global_list;
|
2015-01-23 21:12:36 +03:00
|
|
|
bool has_wl_drm;
|
2012-12-12 08:03:56 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
struct global {
|
|
|
|
uint32_t name;
|
|
|
|
char *interface;
|
|
|
|
uint32_t version;
|
|
|
|
struct wl_list link;
|
2012-12-08 01:50:32 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
struct test {
|
2015-02-24 18:32:14 +03:00
|
|
|
struct weston_test *weston_test;
|
2012-12-08 01:50:32 +04:00
|
|
|
int pointer_x;
|
|
|
|
int pointer_y;
|
2013-10-30 00:13:45 +04:00
|
|
|
uint32_t n_egl_buffers;
|
2012-12-08 01:50:32 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
struct input {
|
|
|
|
struct wl_seat *wl_seat;
|
|
|
|
struct pointer *pointer;
|
|
|
|
struct keyboard *keyboard;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct pointer {
|
|
|
|
struct wl_pointer *wl_pointer;
|
|
|
|
struct surface *focus;
|
|
|
|
int x;
|
|
|
|
int y;
|
|
|
|
uint32_t button;
|
|
|
|
uint32_t state;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct keyboard {
|
|
|
|
struct wl_keyboard *wl_keyboard;
|
|
|
|
struct surface *focus;
|
|
|
|
uint32_t key;
|
|
|
|
uint32_t state;
|
|
|
|
uint32_t mods_depressed;
|
|
|
|
uint32_t mods_latched;
|
|
|
|
uint32_t mods_locked;
|
|
|
|
uint32_t group;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct output {
|
|
|
|
struct wl_output *wl_output;
|
|
|
|
int x;
|
|
|
|
int y;
|
|
|
|
int width;
|
|
|
|
int height;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct surface {
|
|
|
|
struct wl_surface *wl_surface;
|
|
|
|
struct wl_buffer *wl_buffer;
|
|
|
|
struct output *output;
|
|
|
|
int x;
|
|
|
|
int y;
|
|
|
|
int width;
|
|
|
|
int height;
|
|
|
|
void *data;
|
|
|
|
};
|
|
|
|
|
2014-11-20 04:18:36 +03:00
|
|
|
static inline void *
|
|
|
|
xzalloc(size_t size)
|
|
|
|
{
|
|
|
|
void *p;
|
|
|
|
|
|
|
|
p = calloc(1, size);
|
|
|
|
assert(p);
|
|
|
|
|
|
|
|
return p;
|
|
|
|
}
|
|
|
|
|
2012-12-08 01:50:32 +04:00
|
|
|
struct client *
|
|
|
|
client_create(int x, int y, int width, int height);
|
|
|
|
|
2013-02-08 19:01:26 +04:00
|
|
|
struct wl_buffer *
|
|
|
|
create_shm_buffer(struct client *client, int width, int height, void **pixels);
|
|
|
|
|
2012-12-08 01:50:32 +04:00
|
|
|
int
|
|
|
|
surface_contains(struct surface *surface, int x, int y);
|
|
|
|
|
|
|
|
void
|
|
|
|
move_client(struct client *client, int x, int y);
|
|
|
|
|
2012-12-12 16:26:41 +04:00
|
|
|
#define client_roundtrip(c) do { \
|
|
|
|
assert(wl_display_roundtrip((c)->wl_display) >= 0); \
|
|
|
|
} while (0)
|
2012-12-08 01:50:32 +04:00
|
|
|
|
2013-02-08 19:01:25 +04:00
|
|
|
struct wl_callback *
|
|
|
|
frame_callback_set(struct wl_surface *surface, int *done);
|
|
|
|
|
2014-07-16 13:32:50 +04:00
|
|
|
int
|
|
|
|
frame_callback_wait_nofail(struct client *client, int *done);
|
|
|
|
|
|
|
|
#define frame_callback_wait(c, d) assert(frame_callback_wait_nofail((c), (d)))
|
2013-02-08 19:01:25 +04:00
|
|
|
|
2013-10-30 00:13:45 +04:00
|
|
|
int
|
|
|
|
get_n_egl_buffers(struct client *client);
|
|
|
|
|
2014-01-02 05:38:04 +04:00
|
|
|
void
|
|
|
|
skip(const char *fmt, ...);
|
|
|
|
|
2014-07-16 13:27:06 +04:00
|
|
|
void
|
|
|
|
expect_protocol_error(struct client *client,
|
|
|
|
const struct wl_interface *intf, uint32_t code);
|
|
|
|
|
2012-12-08 01:50:32 +04:00
|
|
|
#endif
|