diff options
author | Miguel A. Vico <[email protected]> | 2017-07-19 17:27:12 -0700 |
---|---|---|
committer | Emil Velikov <[email protected]> | 2017-07-24 10:27:52 +0100 |
commit | 2d5d61bc491b6cef08ced8f1ad57b154d4fa5f66 (patch) | |
tree | e03926206e5097cbda26e5d7007004ff47fa0eca /src/egl/wayland/wayland-egl | |
parent | 63c251e38f9b4ac3606094a72c8c5b658402f3d0 (diff) |
wayland-egl: Make wl_egl_window a versioned struct
We need wl_egl_window to be a versioned struct in order to keep track of
ABI changes.
This change makes the first member of wl_egl_window the version number.
An heuristic in the wayland driver is added so that we don't break
backwards compatibility:
- If the first field (version) is an actual pointer, it is an old
implementation of wl_egl_window, and version points to the wl_surface
proxy.
- Else, the first field is the version number, and we have
wl_egl_window::surface pointing to the wl_surface proxy.
Signed-off-by: Miguel A. Vico <[email protected]>
Reviewed-by: James Jones <[email protected]>
Acked-by: Daniel Stone <[email protected]>
Reviewed-by: Emil Velikov <[email protected]>
Diffstat (limited to 'src/egl/wayland/wayland-egl')
-rw-r--r-- | src/egl/wayland/wayland-egl/wayland-egl-priv.h | 6 | ||||
-rw-r--r-- | src/egl/wayland/wayland-egl/wayland-egl.c | 4 |
2 files changed, 9 insertions, 1 deletions
diff --git a/src/egl/wayland/wayland-egl/wayland-egl-priv.h b/src/egl/wayland/wayland-egl/wayland-egl-priv.h index 92c31d94543..3b59908cc16 100644 --- a/src/egl/wayland/wayland-egl/wayland-egl-priv.h +++ b/src/egl/wayland/wayland-egl/wayland-egl-priv.h @@ -41,8 +41,10 @@ extern "C" { #endif +#define WL_EGL_WINDOW_VERSION 3 + struct wl_egl_window { - struct wl_surface *surface; + const intptr_t version; int width; int height; @@ -55,6 +57,8 @@ struct wl_egl_window { void *private; void (*resize_callback)(struct wl_egl_window *, void *); void (*destroy_window_callback)(void *); + + struct wl_surface *surface; }; #ifdef __cplusplus diff --git a/src/egl/wayland/wayland-egl/wayland-egl.c b/src/egl/wayland/wayland-egl/wayland-egl.c index 4a4701a2de7..f16324c9f61 100644 --- a/src/egl/wayland/wayland-egl/wayland-egl.c +++ b/src/egl/wayland/wayland-egl/wayland-egl.c @@ -28,6 +28,7 @@ */ #include <stdlib.h> +#include <string.h> #include <wayland-client.h> #include "wayland-egl.h" @@ -54,6 +55,7 @@ WL_EGL_EXPORT struct wl_egl_window * wl_egl_window_create(struct wl_surface *surface, int width, int height) { + struct wl_egl_window _INIT_ = { .version = WL_EGL_WINDOW_VERSION }; struct wl_egl_window *egl_window; if (width <= 0 || height <= 0) @@ -63,6 +65,8 @@ wl_egl_window_create(struct wl_surface *surface, if (!egl_window) return NULL; + memcpy(egl_window, &_INIT_, sizeof *egl_window); + egl_window->surface = surface; egl_window->private = NULL; egl_window->resize_callback = NULL; |