Switch to new subscribe protocol and wayland-egl

dev
Kristian Høgsberg 14 years ago
parent e649fac2d8
commit 91342c6081
  1. 2
      clients/dnd.c
  2. 2
      clients/screenshot.c
  3. 11
      clients/simple-client.c
  4. 29
      clients/window.c
  5. 15
      compositor/compositor-wayland.c
  6. 3
      compositor/compositor.c

@ -495,7 +495,7 @@ global_handler(struct display *display,
if (strcmp(interface, "drag_offer") != 0) if (strcmp(interface, "drag_offer") != 0)
return; return;
offer = wl_drag_offer_create(display_get_display(display), id); offer = wl_drag_offer_create(display_get_display(display), id, 1);
dnd_offer = malloc(sizeof *dnd_offer); dnd_offer = malloc(sizeof *dnd_offer);
if (dnd_offer == NULL) if (dnd_offer == NULL)

@ -42,7 +42,7 @@ handle_global(struct wl_display *display, uint32_t id,
struct wl_screenshooter **screenshooter = data; struct wl_screenshooter **screenshooter = data;
if (strcmp(interface, "screenshooter") == 0) if (strcmp(interface, "screenshooter") == 0)
*screenshooter = wl_screenshooter_create(display, id); *screenshooter = wl_screenshooter_create(display, id, 1);
} }
int main(int argc, char *argv[]) int main(int argc, char *argv[])

@ -35,7 +35,6 @@
struct display { struct display {
struct wl_display *display; struct wl_display *display;
struct wl_egl_display *native;
struct wl_compositor *compositor; struct wl_compositor *compositor;
struct { struct {
EGLDisplay dpy; EGLDisplay dpy;
@ -105,8 +104,7 @@ init_egl(struct display *display)
EGLint major, minor, n; EGLint major, minor, n;
EGLBoolean ret; EGLBoolean ret;
display->egl.dpy = display->egl.dpy = eglGetDisplay(display->display);
eglGetDisplay(display->native);
assert(display->egl.dpy); assert(display->egl.dpy);
ret = eglInitialize(display->egl.dpy, &major, &minor); ret = eglInitialize(display->egl.dpy, &major, &minor);
@ -198,8 +196,7 @@ create_surface(struct window *window)
window->surface = wl_compositor_create_surface(display->compositor); window->surface = wl_compositor_create_surface(display->compositor);
visual = wl_display_get_premultiplied_argb_visual(display->display); visual = wl_display_get_premultiplied_argb_visual(display->display);
window->native = window->native =
wl_egl_window_create(display->native, wl_egl_window_create(window->surface,
window->surface,
window->geometry.width, window->geometry.width,
window->geometry.height, window->geometry.height,
visual); visual);
@ -280,7 +277,7 @@ display_handle_global(struct wl_display *display, uint32_t id,
struct display *d = data; struct display *d = data;
if (strcmp(interface, "compositor") == 0) if (strcmp(interface, "compositor") == 0)
d->compositor = wl_compositor_create(display, id); d->compositor = wl_compositor_create(display, id, 1);
} }
static int static int
@ -312,8 +309,6 @@ main(int argc, char **argv)
wl_display_add_global_listener(display.display, wl_display_add_global_listener(display.display,
display_handle_global, &display); display_handle_global, &display);
display.native = wl_egl_display_create(display.display);
init_egl(&display); init_egl(&display);
create_surface(&window); create_surface(&window);
init_gl(&window); init_gl(&window);

@ -58,7 +58,6 @@
struct display { struct display {
struct wl_display *display; struct wl_display *display;
struct wl_egl_display *native_dpy;
struct wl_compositor *compositor; struct wl_compositor *compositor;
struct wl_shell *shell; struct wl_shell *shell;
struct wl_shm *shm; struct wl_shm *shm;
@ -227,8 +226,7 @@ display_create_egl_window_surface(struct display *display,
visual = wl_display_get_premultiplied_argb_visual(display->display); visual = wl_display_get_premultiplied_argb_visual(display->display);
data->window = wl_egl_window_create(display->native_dpy, data->window = wl_egl_window_create(surface,
surface,
rectangle->width, rectangle->width,
rectangle->height, rectangle->height,
visual); visual);
@ -298,10 +296,9 @@ display_create_egl_image_surface(struct display *display,
data->display = display; data->display = display;
visual = wl_display_get_premultiplied_argb_visual(display->display); visual = wl_display_get_premultiplied_argb_visual(display->display);
data->pixmap =wl_egl_pixmap_create(display->native_dpy, data->pixmap = wl_egl_pixmap_create(rectangle->width,
rectangle->width, rectangle->height,
rectangle->height, visual, 0);
visual, 0);
if (data->pixmap == NULL) { if (data->pixmap == NULL) {
free(data); free(data);
return NULL; return NULL;
@ -318,7 +315,7 @@ display_create_egl_image_surface(struct display *display,
} }
data->data.buffer = data->data.buffer =
wl_egl_pixmap_create_buffer(display->native_dpy, data->pixmap); wl_egl_pixmap_create_buffer(data->pixmap);
cairo_device_acquire(display->device); cairo_device_acquire(display->device);
glGenTextures(1, &data->texture); glGenTextures(1, &data->texture);
@ -1527,7 +1524,7 @@ display_add_input(struct display *d, uint32_t id)
memset(input, 0, sizeof *input); memset(input, 0, sizeof *input);
input->display = d; input->display = d;
input->input_device = wl_input_device_create(d->display, id); input->input_device = wl_input_device_create(d->display, id, 1);
input->pointer_focus = NULL; input->pointer_focus = NULL;
input->keyboard_focus = NULL; input->keyboard_focus = NULL;
wl_list_insert(d->input_list.prev, &input->link); wl_list_insert(d->input_list.prev, &input->link);
@ -1634,7 +1631,7 @@ add_selection_offer(struct display *d, uint32_t id)
if (offer == NULL) if (offer == NULL)
return; return;
offer->offer = wl_selection_offer_create(d->display, id); offer->offer = wl_selection_offer_create(d->display, id, 1);
offer->display = d; offer->display = d;
wl_array_init(&offer->types); wl_array_init(&offer->types);
offer->input = NULL; offer->input = NULL;
@ -1650,17 +1647,17 @@ display_handle_global(struct wl_display *display, uint32_t id,
struct display *d = data; struct display *d = data;
if (strcmp(interface, "compositor") == 0) { if (strcmp(interface, "compositor") == 0) {
d->compositor = wl_compositor_create(display, id); d->compositor = wl_compositor_create(display, id, 1);
} else if (strcmp(interface, "output") == 0) { } else if (strcmp(interface, "output") == 0) {
d->output = wl_output_create(display, id); d->output = wl_output_create(display, id, 1);
wl_output_add_listener(d->output, &output_listener, d); wl_output_add_listener(d->output, &output_listener, d);
} else if (strcmp(interface, "input_device") == 0) { } else if (strcmp(interface, "input_device") == 0) {
display_add_input(d, id); display_add_input(d, id);
} else if (strcmp(interface, "shell") == 0) { } else if (strcmp(interface, "shell") == 0) {
d->shell = wl_shell_create(display, id); d->shell = wl_shell_create(display, id, 1);
wl_shell_add_listener(d->shell, &shell_listener, d); wl_shell_add_listener(d->shell, &shell_listener, d);
} else if (strcmp(interface, "shm") == 0) { } else if (strcmp(interface, "shm") == 0) {
d->shm = wl_shm_create(display, id); d->shm = wl_shm_create(display, id, 1);
} else if (strcmp(interface, "selection_offer") == 0) { } else if (strcmp(interface, "selection_offer") == 0) {
add_selection_offer(d, id); add_selection_offer(d, id);
} else if (d->global_handler) { } else if (d->global_handler) {
@ -1736,7 +1733,7 @@ init_egl(struct display *d)
EGL_NONE EGL_NONE
}; };
d->dpy = eglGetDisplay(d->native_dpy); d->dpy = eglGetDisplay(d->display);
if (!eglInitialize(d->dpy, &major, &minor)) { if (!eglInitialize(d->dpy, &major, &minor)) {
fprintf(stderr, "failed to initialize display\n"); fprintf(stderr, "failed to initialize display\n");
return -1; return -1;
@ -1823,8 +1820,6 @@ display_create(int *argc, char **argv[], const GOptionEntry *option_entries,
wl_display_add_global_listener(d->display, wl_display_add_global_listener(d->display,
display_handle_global, d); display_handle_global, d);
d->native_dpy = wl_egl_display_create(d->display);
/* Process connection events. */ /* Process connection events. */
wl_display_iterate(d->display, WL_DISPLAY_READABLE); wl_display_iterate(d->display, WL_DISPLAY_READABLE);

@ -43,7 +43,6 @@ struct wayland_compositor {
struct { struct {
struct wl_display *display; struct wl_display *display;
struct wl_egl_display *egl_display;
struct wl_compositor *compositor; struct wl_compositor *compositor;
struct wl_shell *shell; struct wl_shell *shell;
struct wl_output *output; struct wl_output *output;
@ -112,7 +111,7 @@ wayland_compositor_init_egl(struct wayland_compositor *c)
EGL_NONE EGL_NONE
}; };
c->base.display = eglGetDisplay(c->parent.egl_display); c->base.display = eglGetDisplay(c->parent.display);
if (c->base.display == NULL) { if (c->base.display == NULL) {
fprintf(stderr, "failed to create display\n"); fprintf(stderr, "failed to create display\n");
return -1; return -1;
@ -231,8 +230,7 @@ wayland_compositor_create_output(struct wayland_compositor *c,
visual = wl_display_get_premultiplied_argb_visual(c->parent.display); visual = wl_display_get_premultiplied_argb_visual(c->parent.display);
output->parent.egl_window = output->parent.egl_window =
wl_egl_window_create(c->parent.egl_display, wl_egl_window_create(output->parent.surface,
output->parent.surface,
width, height, visual); width, height, visual);
if (!output->parent.egl_window) { if (!output->parent.egl_window) {
fprintf(stderr, "failure to create wl_egl_window\n"); fprintf(stderr, "failure to create wl_egl_window\n");
@ -409,7 +407,7 @@ display_add_input(struct wayland_compositor *c, uint32_t id)
memset(input, 0, sizeof *input); memset(input, 0, sizeof *input);
input->compositor = c; input->compositor = c;
input->input_device = wl_input_device_create(c->parent.display, id); input->input_device = wl_input_device_create(c->parent.display, id, 1);
wl_list_insert(c->input_list.prev, &input->link); wl_list_insert(c->input_list.prev, &input->link);
wl_input_device_add_listener(input->input_device, wl_input_device_add_listener(input->input_device,
@ -424,14 +422,14 @@ display_handle_global(struct wl_display *display, uint32_t id,
struct wayland_compositor *c = data; struct wayland_compositor *c = data;
if (strcmp(interface, "compositor") == 0) { if (strcmp(interface, "compositor") == 0) {
c->parent.compositor = wl_compositor_create(display, id); c->parent.compositor = wl_compositor_create(display, id, 1);
} else if (strcmp(interface, "output") == 0) { } else if (strcmp(interface, "output") == 0) {
c->parent.output = wl_output_create(display, id); c->parent.output = wl_output_create(display, id, 1);
wl_output_add_listener(c->parent.output, &output_listener, c); wl_output_add_listener(c->parent.output, &output_listener, c);
} else if (strcmp(interface, "input_device") == 0) { } else if (strcmp(interface, "input_device") == 0) {
display_add_input(c, id); display_add_input(c, id);
} else if (strcmp(interface, "shell") == 0) { } else if (strcmp(interface, "shell") == 0) {
c->parent.shell = wl_shell_create(display, id); c->parent.shell = wl_shell_create(display, id, 1);
wl_shell_add_listener(c->parent.shell, &shell_listener, c); wl_shell_add_listener(c->parent.shell, &shell_listener, c);
} }
} }
@ -486,7 +484,6 @@ wayland_compositor_create(struct wl_display *display, int width, int height)
} }
wl_list_init(&c->input_list); wl_list_init(&c->input_list);
c->parent.egl_display = wl_egl_display_create(c->parent.display);
wl_display_add_global_listener(c->parent.display, wl_display_add_global_listener(c->parent.display,
display_handle_global, c); display_handle_global, c);

@ -1371,7 +1371,8 @@ wlsc_input_device_init(struct wlsc_input_device *device,
} }
static void static void
wlsc_output_post_geometry(struct wl_client *client, struct wl_object *global) wlsc_output_post_geometry(struct wl_client *client,
struct wl_object *global, uint32_t version)
{ {
struct wlsc_output *output = struct wlsc_output *output =
container_of(global, struct wlsc_output, object); container_of(global, struct wlsc_output, object);

Loading…
Cancel
Save