|
|
|
@ -47,7 +47,7 @@ |
|
|
|
|
#include "shared/helpers.h" |
|
|
|
|
#include "shared/platform.h" |
|
|
|
|
#include <libweston/zalloc.h> |
|
|
|
|
#include "xdg-shell-unstable-v6-client-protocol.h" |
|
|
|
|
#include "xdg-shell-client-protocol.h" |
|
|
|
|
#include "fullscreen-shell-unstable-v1-client-protocol.h" |
|
|
|
|
#include "linux-dmabuf-unstable-v1-client-protocol.h" |
|
|
|
|
#include "linux-explicit-synchronization-unstable-v1-client-protocol.h" |
|
|
|
@ -75,7 +75,7 @@ struct display { |
|
|
|
|
struct wl_display *display; |
|
|
|
|
struct wl_registry *registry; |
|
|
|
|
struct wl_compositor *compositor; |
|
|
|
|
struct zxdg_shell_v6 *shell; |
|
|
|
|
struct xdg_wm_base *wm_base; |
|
|
|
|
struct zwp_fullscreen_shell_v1 *fshell; |
|
|
|
|
struct zwp_linux_dmabuf_v1 *dmabuf; |
|
|
|
|
struct zwp_linux_explicit_synchronization_v1 *explicit_sync; |
|
|
|
@ -135,8 +135,8 @@ struct window { |
|
|
|
|
struct display *display; |
|
|
|
|
int width, height; |
|
|
|
|
struct wl_surface *surface; |
|
|
|
|
struct zxdg_surface_v6 *xdg_surface; |
|
|
|
|
struct zxdg_toplevel_v6 *xdg_toplevel; |
|
|
|
|
struct xdg_surface *xdg_surface; |
|
|
|
|
struct xdg_toplevel *xdg_toplevel; |
|
|
|
|
struct zwp_linux_surface_synchronization_v1 *surface_sync; |
|
|
|
|
struct buffer buffers[NUM_BUFFERS]; |
|
|
|
|
struct wl_callback *callback; |
|
|
|
@ -444,36 +444,36 @@ error: |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static void |
|
|
|
|
xdg_surface_handle_configure(void *data, struct zxdg_surface_v6 *surface, |
|
|
|
|
xdg_surface_handle_configure(void *data, struct xdg_surface *surface, |
|
|
|
|
uint32_t serial) |
|
|
|
|
{ |
|
|
|
|
struct window *window = data; |
|
|
|
|
|
|
|
|
|
zxdg_surface_v6_ack_configure(surface, serial); |
|
|
|
|
xdg_surface_ack_configure(surface, serial); |
|
|
|
|
|
|
|
|
|
if (window->initialized && window->wait_for_configure) |
|
|
|
|
redraw(window, NULL, 0); |
|
|
|
|
window->wait_for_configure = false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static const struct zxdg_surface_v6_listener xdg_surface_listener = { |
|
|
|
|
static const struct xdg_surface_listener xdg_surface_listener = { |
|
|
|
|
xdg_surface_handle_configure, |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
static void |
|
|
|
|
xdg_toplevel_handle_configure(void *data, struct zxdg_toplevel_v6 *toplevel, |
|
|
|
|
xdg_toplevel_handle_configure(void *data, struct xdg_toplevel *toplevel, |
|
|
|
|
int32_t width, int32_t height, |
|
|
|
|
struct wl_array *states) |
|
|
|
|
{ |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static void |
|
|
|
|
xdg_toplevel_handle_close(void *data, struct zxdg_toplevel_v6 *xdg_toplevel) |
|
|
|
|
xdg_toplevel_handle_close(void *data, struct xdg_toplevel *xdg_toplevel) |
|
|
|
|
{ |
|
|
|
|
running = 0; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static const struct zxdg_toplevel_v6_listener xdg_toplevel_listener = { |
|
|
|
|
static const struct xdg_toplevel_listener xdg_toplevel_listener = { |
|
|
|
|
xdg_toplevel_handle_configure, |
|
|
|
|
xdg_toplevel_handle_close, |
|
|
|
|
}; |
|
|
|
@ -622,9 +622,9 @@ destroy_window(struct window *window) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (window->xdg_toplevel) |
|
|
|
|
zxdg_toplevel_v6_destroy(window->xdg_toplevel); |
|
|
|
|
xdg_toplevel_destroy(window->xdg_toplevel); |
|
|
|
|
if (window->xdg_surface) |
|
|
|
|
zxdg_surface_v6_destroy(window->xdg_surface); |
|
|
|
|
xdg_surface_destroy(window->xdg_surface); |
|
|
|
|
if (window->surface_sync) |
|
|
|
|
zwp_linux_surface_synchronization_v1_destroy(window->surface_sync); |
|
|
|
|
wl_surface_destroy(window->surface); |
|
|
|
@ -648,25 +648,25 @@ create_window(struct display *display, int width, int height, int opts) |
|
|
|
|
window->height = height; |
|
|
|
|
window->surface = wl_compositor_create_surface(display->compositor); |
|
|
|
|
|
|
|
|
|
if (display->shell) { |
|
|
|
|
if (display->wm_base) { |
|
|
|
|
window->xdg_surface = |
|
|
|
|
zxdg_shell_v6_get_xdg_surface(display->shell, |
|
|
|
|
window->surface); |
|
|
|
|
xdg_wm_base_get_xdg_surface(display->wm_base, |
|
|
|
|
window->surface); |
|
|
|
|
|
|
|
|
|
assert(window->xdg_surface); |
|
|
|
|
|
|
|
|
|
zxdg_surface_v6_add_listener(window->xdg_surface, |
|
|
|
|
&xdg_surface_listener, window); |
|
|
|
|
xdg_surface_add_listener(window->xdg_surface, |
|
|
|
|
&xdg_surface_listener, window); |
|
|
|
|
|
|
|
|
|
window->xdg_toplevel = |
|
|
|
|
zxdg_surface_v6_get_toplevel(window->xdg_surface); |
|
|
|
|
xdg_surface_get_toplevel(window->xdg_surface); |
|
|
|
|
|
|
|
|
|
assert(window->xdg_toplevel); |
|
|
|
|
|
|
|
|
|
zxdg_toplevel_v6_add_listener(window->xdg_toplevel, |
|
|
|
|
&xdg_toplevel_listener, window); |
|
|
|
|
xdg_toplevel_add_listener(window->xdg_toplevel, |
|
|
|
|
&xdg_toplevel_listener, window); |
|
|
|
|
|
|
|
|
|
zxdg_toplevel_v6_set_title(window->xdg_toplevel, "simple-dmabuf-egl"); |
|
|
|
|
xdg_toplevel_set_title(window->xdg_toplevel, "simple-dmabuf-egl"); |
|
|
|
|
|
|
|
|
|
window->wait_for_configure = true; |
|
|
|
|
wl_surface_commit(window->surface); |
|
|
|
@ -1011,13 +1011,13 @@ static const struct zwp_linux_dmabuf_v1_listener dmabuf_listener = { |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
static void |
|
|
|
|
xdg_shell_ping(void *data, struct zxdg_shell_v6 *shell, uint32_t serial) |
|
|
|
|
xdg_wm_base_ping(void *data, struct xdg_wm_base *wm_base, uint32_t serial) |
|
|
|
|
{ |
|
|
|
|
zxdg_shell_v6_pong(shell, serial); |
|
|
|
|
xdg_wm_base_pong(wm_base, serial); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static const struct zxdg_shell_v6_listener xdg_shell_listener = { |
|
|
|
|
xdg_shell_ping, |
|
|
|
|
static const struct xdg_wm_base_listener xdg_wm_base_listener = { |
|
|
|
|
xdg_wm_base_ping, |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
static void |
|
|
|
@ -1030,10 +1030,10 @@ registry_handle_global(void *data, struct wl_registry *registry, |
|
|
|
|
d->compositor = |
|
|
|
|
wl_registry_bind(registry, |
|
|
|
|
id, &wl_compositor_interface, 1); |
|
|
|
|
} else if (strcmp(interface, "zxdg_shell_v6") == 0) { |
|
|
|
|
d->shell = wl_registry_bind(registry, |
|
|
|
|
id, &zxdg_shell_v6_interface, 1); |
|
|
|
|
zxdg_shell_v6_add_listener(d->shell, &xdg_shell_listener, d); |
|
|
|
|
} else if (strcmp(interface, "xdg_wm_base") == 0) { |
|
|
|
|
d->wm_base = wl_registry_bind(registry, |
|
|
|
|
id, &xdg_wm_base_interface, 1); |
|
|
|
|
xdg_wm_base_add_listener(d->wm_base, &xdg_wm_base_listener, d); |
|
|
|
|
} else if (strcmp(interface, "zwp_fullscreen_shell_v1") == 0) { |
|
|
|
|
d->fshell = wl_registry_bind(registry, |
|
|
|
|
id, &zwp_fullscreen_shell_v1_interface, 1); |
|
|
|
@ -1081,8 +1081,8 @@ destroy_display(struct display *display) |
|
|
|
|
if (display->dmabuf) |
|
|
|
|
zwp_linux_dmabuf_v1_destroy(display->dmabuf); |
|
|
|
|
|
|
|
|
|
if (display->shell) |
|
|
|
|
zxdg_shell_v6_destroy(display->shell); |
|
|
|
|
if (display->wm_base) |
|
|
|
|
xdg_wm_base_destroy(display->wm_base); |
|
|
|
|
|
|
|
|
|
if (display->fshell) |
|
|
|
|
zwp_fullscreen_shell_v1_release(display->fshell); |
|
|
|
|