blob: 3e648ae6fcdda3eef2c593d5255e3e735ab5319e [file] [log] [blame]
U. Artie Eoff1ba9b382012-12-07 13:50:32 -08001/*
2 * Copyright © 2012 Intel Corporation
3 *
4 * Permission to use, copy, modify, distribute, and sell this software and
5 * its documentation for any purpose is hereby granted without fee, provided
6 * that the above copyright notice appear in all copies and that both that
7 * copyright notice and this permission notice appear in supporting
8 * documentation, and that the name of the copyright holders not be used in
9 * advertising or publicity pertaining to distribution of the software
10 * without specific, written prior permission. The copyright holders make
11 * no representations about the suitability of this software for any
12 * purpose. It is provided "as is" without express or implied warranty.
13 *
14 * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
15 * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
16 * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
17 * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
18 * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
19 * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
20 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
21 */
22
23#ifndef _WESTON_TEST_CLIENT_HELPER_H_
24#define _WESTON_TEST_CLIENT_HELPER_H_
25
26#include <assert.h>
27#include "weston-test-runner.h"
28#include "wayland-test-client-protocol.h"
29
30struct client {
31 struct wl_display *wl_display;
32 struct wl_registry *wl_registry;
33 struct wl_compositor *wl_compositor;
34 struct wl_shm *wl_shm;
35 struct test *test;
36 struct input *input;
37 struct output *output;
38 struct surface *surface;
39 int has_argb;
40};
41
42struct test {
43 struct wl_test *wl_test;
44 int pointer_x;
45 int pointer_y;
46};
47
48struct input {
49 struct wl_seat *wl_seat;
50 struct pointer *pointer;
51 struct keyboard *keyboard;
52};
53
54struct pointer {
55 struct wl_pointer *wl_pointer;
56 struct surface *focus;
57 int x;
58 int y;
59 uint32_t button;
60 uint32_t state;
61};
62
63struct keyboard {
64 struct wl_keyboard *wl_keyboard;
65 struct surface *focus;
66 uint32_t key;
67 uint32_t state;
68 uint32_t mods_depressed;
69 uint32_t mods_latched;
70 uint32_t mods_locked;
71 uint32_t group;
72};
73
74struct output {
75 struct wl_output *wl_output;
76 int x;
77 int y;
78 int width;
79 int height;
80};
81
82struct surface {
83 struct wl_surface *wl_surface;
84 struct wl_buffer *wl_buffer;
85 struct output *output;
86 int x;
87 int y;
88 int width;
89 int height;
90 void *data;
91};
92
93struct client *
94client_create(int x, int y, int width, int height);
95
96int
97surface_contains(struct surface *surface, int x, int y);
98
99void
U. Artie Eoff1ba9b382012-12-07 13:50:32 -0800100move_client(struct client *client, int x, int y);
101
102
103#endif