tests: Update tests to new APIs
This commit is contained in:
+18
-12
@@ -31,6 +31,7 @@
|
|||||||
|
|
||||||
struct display {
|
struct display {
|
||||||
struct wl_display *display;
|
struct wl_display *display;
|
||||||
|
struct wl_registry *registry;
|
||||||
struct wl_compositor *compositor;
|
struct wl_compositor *compositor;
|
||||||
struct input *input;
|
struct input *input;
|
||||||
struct output *output;
|
struct output *output;
|
||||||
@@ -262,8 +263,8 @@ static const struct wl_output_listener output_listener = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static void
|
static void
|
||||||
handle_global(struct wl_display *_display, uint32_t id,
|
handle_global(void *data, struct wl_registry *registry, uint32_t id,
|
||||||
const char *interface, uint32_t version, void *data)
|
const char *interface, uint32_t version)
|
||||||
{
|
{
|
||||||
struct display *display = data;
|
struct display *display = data;
|
||||||
struct input *input;
|
struct input *input;
|
||||||
@@ -271,12 +272,12 @@ handle_global(struct wl_display *_display, uint32_t id,
|
|||||||
|
|
||||||
if (strcmp(interface, "wl_compositor") == 0) {
|
if (strcmp(interface, "wl_compositor") == 0) {
|
||||||
display->compositor =
|
display->compositor =
|
||||||
wl_display_bind(display->display,
|
wl_registry_bind(display->registry,
|
||||||
id, &wl_compositor_interface);
|
id, &wl_compositor_interface, 1);
|
||||||
} else if (strcmp(interface, "wl_seat") == 0) {
|
} else if (strcmp(interface, "wl_seat") == 0) {
|
||||||
input = calloc(1, sizeof *input);
|
input = calloc(1, sizeof *input);
|
||||||
input->seat = wl_display_bind(display->display, id,
|
input->seat = wl_registry_bind(display->registry, id,
|
||||||
&wl_seat_interface);
|
&wl_seat_interface, 1);
|
||||||
input->pointer_focus = NULL;
|
input->pointer_focus = NULL;
|
||||||
input->keyboard_focus = NULL;
|
input->keyboard_focus = NULL;
|
||||||
|
|
||||||
@@ -284,8 +285,8 @@ handle_global(struct wl_display *_display, uint32_t id,
|
|||||||
display->input = input;
|
display->input = input;
|
||||||
} else if (strcmp(interface, "wl_output") == 0) {
|
} else if (strcmp(interface, "wl_output") == 0) {
|
||||||
output = malloc(sizeof *output);
|
output = malloc(sizeof *output);
|
||||||
output->output = wl_display_bind(display->display,
|
output->output = wl_registry_bind(display->registry,
|
||||||
id, &wl_output_interface);
|
id, &wl_output_interface, 1);
|
||||||
wl_output_add_listener(output->output,
|
wl_output_add_listener(output->output,
|
||||||
&output_listener, output);
|
&output_listener, output);
|
||||||
display->output = output;
|
display->output = output;
|
||||||
@@ -295,6 +296,10 @@ handle_global(struct wl_display *_display, uint32_t id,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const struct wl_registry_listener registry_listener = {
|
||||||
|
handle_global
|
||||||
|
};
|
||||||
|
|
||||||
static void
|
static void
|
||||||
surface_enter(void *data,
|
surface_enter(void *data,
|
||||||
struct wl_surface *wl_surface, struct wl_output *output)
|
struct wl_surface *wl_surface, struct wl_output *output)
|
||||||
@@ -422,10 +427,11 @@ int main(int argc, char *argv[])
|
|||||||
display->display = wl_display_connect(NULL);
|
display->display = wl_display_connect(NULL);
|
||||||
assert(display->display);
|
assert(display->display);
|
||||||
|
|
||||||
wl_display_add_global_listener(display->display,
|
display->registry = wl_display_get_registry(display->display);
|
||||||
handle_global, display);
|
wl_registry_add_listener(display->registry,
|
||||||
wl_display_iterate(display->display, WL_DISPLAY_READABLE);
|
®istry_listener, display);
|
||||||
wl_display_roundtrip(display->display);
|
wl_display_dispatch(display->display);
|
||||||
|
wl_display_dispatch(display->display);
|
||||||
|
|
||||||
fd = 0;
|
fd = 0;
|
||||||
p = getenv("TEST_SOCKET");
|
p = getenv("TEST_SOCKET");
|
||||||
|
|||||||
+26
-17
@@ -31,6 +31,7 @@
|
|||||||
|
|
||||||
struct display {
|
struct display {
|
||||||
struct wl_display *display;
|
struct wl_display *display;
|
||||||
|
struct wl_registry *registry;
|
||||||
struct wl_compositor *compositor;
|
struct wl_compositor *compositor;
|
||||||
|
|
||||||
struct wl_surface *surface;
|
struct wl_surface *surface;
|
||||||
@@ -100,8 +101,10 @@ text_model_locale(void *data,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
text_model_activated(void *data,
|
text_model_enter(void *data,
|
||||||
struct text_model *text_model)
|
struct text_model *text_model,
|
||||||
|
struct wl_surface *surface)
|
||||||
|
|
||||||
{
|
{
|
||||||
struct display *display = data;
|
struct display *display = data;
|
||||||
|
|
||||||
@@ -111,7 +114,7 @@ text_model_activated(void *data,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
text_model_deactivated(void *data,
|
text_model_leave(void *data,
|
||||||
struct text_model *text_model)
|
struct text_model *text_model)
|
||||||
{
|
{
|
||||||
struct display *display = data;
|
struct display *display = data;
|
||||||
@@ -128,29 +131,34 @@ static const struct text_model_listener text_model_listener = {
|
|||||||
text_model_selection_replacement,
|
text_model_selection_replacement,
|
||||||
text_model_direction,
|
text_model_direction,
|
||||||
text_model_locale,
|
text_model_locale,
|
||||||
text_model_activated,
|
text_model_enter,
|
||||||
text_model_deactivated
|
text_model_leave
|
||||||
};
|
};
|
||||||
|
|
||||||
static void
|
static void
|
||||||
handle_global(struct wl_display *_display, uint32_t id,
|
handle_global(void *data,
|
||||||
const char *interface, uint32_t version, void *data)
|
struct wl_registry *registry, uint32_t id,
|
||||||
|
const char *interface, uint32_t version)
|
||||||
{
|
{
|
||||||
struct display *display = data;
|
struct display *display = data;
|
||||||
|
|
||||||
if (strcmp(interface, "wl_compositor") == 0) {
|
if (strcmp(interface, "wl_compositor") == 0) {
|
||||||
display->compositor =
|
display->compositor =
|
||||||
wl_display_bind(display->display,
|
wl_registry_bind(display->registry,
|
||||||
id, &wl_compositor_interface);
|
id, &wl_compositor_interface, 1);
|
||||||
} else if (strcmp(interface, "wl_seat") == 0) {
|
} else if (strcmp(interface, "wl_seat") == 0) {
|
||||||
display->seat = wl_display_bind(display->display, id,
|
display->seat = wl_registry_bind(display->registry, id,
|
||||||
&wl_seat_interface);
|
&wl_seat_interface, 1);
|
||||||
} else if (strcmp(interface, "text_model_factory") == 0) {
|
} else if (strcmp(interface, "text_model_factory") == 0) {
|
||||||
display->factory = wl_display_bind(display->display, id,
|
display->factory = wl_registry_bind(display->registry, id,
|
||||||
&text_model_factory_interface);
|
&text_model_factory_interface, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const struct wl_registry_listener registry_listener = {
|
||||||
|
handle_global
|
||||||
|
};
|
||||||
|
|
||||||
static void
|
static void
|
||||||
create_surface(int fd, struct display *display)
|
create_surface(int fd, struct display *display)
|
||||||
{
|
{
|
||||||
@@ -230,10 +238,11 @@ int main(int argc, char *argv[])
|
|||||||
display->activated = 0;
|
display->activated = 0;
|
||||||
display->deactivated = 0;
|
display->deactivated = 0;
|
||||||
|
|
||||||
wl_display_add_global_listener(display->display,
|
display->registry = wl_display_get_registry(display->display);
|
||||||
handle_global, display);
|
wl_registry_add_listener(display->registry,
|
||||||
wl_display_iterate(display->display, WL_DISPLAY_READABLE);
|
®istry_listener, display);
|
||||||
wl_display_roundtrip(display->display);
|
wl_display_dispatch(display->display);
|
||||||
|
wl_display_dispatch(display->display);
|
||||||
|
|
||||||
fd = 0;
|
fd = 0;
|
||||||
p = getenv("TEST_SOCKET");
|
p = getenv("TEST_SOCKET");
|
||||||
|
|||||||
Reference in New Issue
Block a user