aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/idle-inhibit.c10
-rw-r--r--examples/input-inhibitor.c10
-rw-r--r--examples/keyboard-shortcuts-inhibit.c10
-rw-r--r--examples/layer-shell.c20
-rw-r--r--examples/pointer-constraints.c10
-rw-r--r--examples/relative-pointer-unstable-v1.c5
-rw-r--r--examples/text-input.c10
-rw-r--r--examples/toplevel-decoration.c10
8 files changed, 42 insertions, 43 deletions
diff --git a/examples/idle-inhibit.c b/examples/idle-inhibit.c
index 44a7f5b5..7037681f 100644
--- a/examples/idle-inhibit.c
+++ b/examples/idle-inhibit.c
@@ -27,12 +27,12 @@ static struct xdg_wm_base *wm_base = NULL;
static struct zwp_idle_inhibit_manager_v1 *idle_inhibit_manager = NULL;
static struct zwp_idle_inhibitor_v1 *idle_inhibitor = NULL;
-struct wlr_egl egl;
+struct wlr_egl *egl;
struct wl_egl_window *egl_window;
struct wlr_egl_surface *egl_surface;
static void draw(void) {
- eglMakeCurrent(egl.display, egl_surface, egl_surface, egl.context);
+ eglMakeCurrent(egl->display, egl_surface, egl_surface, egl->context);
float color[] = {1.0, 1.0, 0.0, 1.0};
if (idle_inhibitor) {
@@ -43,7 +43,7 @@ static void draw(void) {
glClearColor(color[0], color[1], color[2], 1.0);
glClear(GL_COLOR_BUFFER_BIT);
- eglSwapBuffers(egl.display, egl_surface);
+ eglSwapBuffers(egl->display, egl_surface);
}
static void pointer_handle_button(void *data, struct wl_pointer *pointer, uint32_t serial,
@@ -193,7 +193,7 @@ int main(int argc, char **argv) {
}
EGLint attribs[] = { EGL_NONE };
- wlr_egl_init(&egl, EGL_PLATFORM_WAYLAND_EXT, display, attribs);
+ egl = wlr_egl_create(EGL_PLATFORM_WAYLAND_EXT, display, attribs);
struct wl_surface *surface = wl_compositor_create_surface(compositor);
struct xdg_surface *xdg_surface =
@@ -214,7 +214,7 @@ int main(int argc, char **argv) {
wl_surface_commit(surface);
egl_window = wl_egl_window_create(surface, width, height);
- egl_surface = wlr_egl_create_surface(&egl, egl_window);
+ egl_surface = wlr_egl_create_surface(egl, egl_window);
wl_display_roundtrip(display);
diff --git a/examples/input-inhibitor.c b/examples/input-inhibitor.c
index 80be3916..a0acebd0 100644
--- a/examples/input-inhibitor.c
+++ b/examples/input-inhibitor.c
@@ -18,12 +18,12 @@ static struct xdg_wm_base *wm_base = NULL;
static struct zwlr_input_inhibit_manager_v1 *input_inhibit_manager = NULL;
static struct zwlr_input_inhibitor_v1 *input_inhibitor = NULL;
-struct wlr_egl egl;
+struct wlr_egl *egl;
struct wl_egl_window *egl_window;
struct wlr_egl_surface *egl_surface;
static void render_frame(void) {
- eglMakeCurrent(egl.display, egl_surface, egl_surface, egl.context);
+ eglMakeCurrent(egl->display, egl_surface, egl_surface, egl->context);
glViewport(0, 0, width, height);
if (keys) {
@@ -33,7 +33,7 @@ static void render_frame(void) {
}
glClear(GL_COLOR_BUFFER_BIT);
- eglSwapBuffers(egl.display, egl_surface);
+ eglSwapBuffers(egl->display, egl_surface);
}
static void xdg_surface_handle_configure(void *data,
@@ -158,7 +158,7 @@ int main(int argc, char **argv) {
assert(input_inhibitor);
EGLint attribs[] = { EGL_NONE };
- wlr_egl_init(&egl, EGL_PLATFORM_WAYLAND_EXT, display, attribs);
+ egl = wlr_egl_create(EGL_PLATFORM_WAYLAND_EXT, display, attribs);
struct wl_surface *surface = wl_compositor_create_surface(compositor);
assert(surface);
@@ -174,7 +174,7 @@ int main(int argc, char **argv) {
wl_surface_commit(surface);
egl_window = wl_egl_window_create(surface, width, height);
- egl_surface = wlr_egl_create_surface(&egl, egl_window);
+ egl_surface = wlr_egl_create_surface(egl, egl_window);
wl_display_roundtrip(display);
diff --git a/examples/keyboard-shortcuts-inhibit.c b/examples/keyboard-shortcuts-inhibit.c
index 1b2d7aab..58684683 100644
--- a/examples/keyboard-shortcuts-inhibit.c
+++ b/examples/keyboard-shortcuts-inhibit.c
@@ -33,12 +33,12 @@ static struct zwp_keyboard_shortcuts_inhibitor_v1 *
keyboard_shortcuts_inhibitor = NULL;
static bool active = false;
-struct wlr_egl egl;
+struct wlr_egl *egl;
struct wl_egl_window *egl_window;
struct wlr_egl_surface *egl_surface;
static void draw(void) {
- eglMakeCurrent(egl.display, egl_surface, egl_surface, egl.context);
+ eglMakeCurrent(egl->display, egl_surface, egl_surface, egl->context);
float color[] = {1.0, 1.0, 0.0, 1.0};
if (keyboard_shortcuts_inhibitor) {
@@ -49,7 +49,7 @@ static void draw(void) {
glClearColor(color[0], color[1], color[2], 1.0);
glClear(GL_COLOR_BUFFER_BIT);
- eglSwapBuffers(egl.display, egl_surface);
+ eglSwapBuffers(egl->display, egl_surface);
}
static void keyboard_shortcuts_inhibit_handle_active(void *data,
@@ -225,7 +225,7 @@ int main(int argc, char **argv) {
}
EGLint attribs[] = { EGL_NONE };
- wlr_egl_init(&egl, EGL_PLATFORM_WAYLAND_EXT, display, attribs);
+ egl = wlr_egl_create(EGL_PLATFORM_WAYLAND_EXT, display, attribs);
struct wl_surface *surface = wl_compositor_create_surface(compositor);
struct xdg_surface *xdg_surface =
@@ -241,7 +241,7 @@ int main(int argc, char **argv) {
wl_surface_commit(surface);
egl_window = wl_egl_window_create(surface, width, height);
- egl_surface = wlr_egl_create_surface(&egl, egl_window);
+ egl_surface = wlr_egl_create_surface(egl, egl_window);
wl_display_roundtrip(display);
diff --git a/examples/layer-shell.c b/examples/layer-shell.c
index 6d1cb78c..1779855a 100644
--- a/examples/layer-shell.c
+++ b/examples/layer-shell.c
@@ -29,7 +29,7 @@ struct zwlr_layer_surface_v1 *layer_surface;
static struct wl_output *wl_output;
struct wl_surface *wl_surface;
-struct wlr_egl egl;
+struct wlr_egl *egl;
struct wl_egl_window *egl_window;
struct wlr_egl_surface *egl_surface;
struct wl_callback *frame_callback;
@@ -93,7 +93,7 @@ static struct wl_callback_listener popup_frame_listener = {
};
static void draw(void) {
- eglMakeCurrent(egl.display, egl_surface, egl_surface, egl.context);
+ eglMakeCurrent(egl->display, egl_surface, egl_surface, egl->context);
struct timespec ts;
clock_gettime(CLOCK_MONOTONIC, &ts);
@@ -142,7 +142,7 @@ static void draw(void) {
frame_callback = wl_surface_frame(wl_surface);
wl_callback_add_listener(frame_callback, &frame_listener, NULL);
- eglSwapBuffers(egl.display, egl_surface);
+ eglSwapBuffers(egl->display, egl_surface);
demo.last_frame = ts;
}
@@ -150,7 +150,7 @@ static void draw(void) {
static void draw_popup(void) {
static float alpha_mod = -0.01;
- eglMakeCurrent(egl.display, popup_egl_surface, popup_egl_surface, egl.context);
+ eglMakeCurrent(egl->display, popup_egl_surface, popup_egl_surface, egl->context);
glViewport(0, 0, popup_width, popup_height);
glClearColor(popup_red, 0.5f, 0.5f, popup_alpha);
popup_alpha += alpha_mod;
@@ -162,7 +162,7 @@ static void draw_popup(void) {
popup_frame_callback = wl_surface_frame(popup_wl_surface);
assert(popup_frame_callback);
wl_callback_add_listener(popup_frame_callback, &popup_frame_listener, NULL);
- eglSwapBuffers(egl.display, popup_egl_surface);
+ eglSwapBuffers(egl->display, popup_egl_surface);
wl_surface_commit(popup_wl_surface);
}
@@ -187,7 +187,7 @@ static void xdg_popup_configure(void *data, struct xdg_popup *xdg_popup,
}
static void popup_destroy(void) {
- wlr_egl_destroy_surface(&egl, popup_egl_surface);
+ wlr_egl_destroy_surface(egl, popup_egl_surface);
wl_egl_window_destroy(popup_egl_window);
xdg_popup_destroy(popup);
wl_surface_destroy(popup_wl_surface);
@@ -241,7 +241,7 @@ static void create_popup(uint32_t serial) {
popup_wl_surface = surface;
popup_egl_window = wl_egl_window_create(surface, popup_width, popup_height);
assert(popup_egl_window);
- popup_egl_surface = wlr_egl_create_surface(&egl, popup_egl_window);
+ popup_egl_surface = wlr_egl_create_surface(egl, popup_egl_window);
assert(popup_egl_surface);
draw_popup();
}
@@ -259,7 +259,7 @@ static void layer_surface_configure(void *data,
static void layer_surface_closed(void *data,
struct zwlr_layer_surface_v1 *surface) {
- wlr_egl_destroy_surface(&egl, egl_surface);
+ wlr_egl_destroy_surface(egl, egl_surface);
wl_egl_window_destroy(egl_window);
zwlr_layer_surface_v1_destroy(surface);
wl_surface_destroy(wl_surface);
@@ -611,7 +611,7 @@ int main(int argc, char **argv) {
assert(cursor_surface);
EGLint attribs[] = { EGL_ALPHA_SIZE, 8, EGL_NONE };
- wlr_egl_init(&egl, EGL_PLATFORM_WAYLAND_EXT, display, attribs);
+ egl = wlr_egl_create(EGL_PLATFORM_WAYLAND_EXT, display, attribs);
wl_surface = wl_compositor_create_surface(compositor);
assert(wl_surface);
@@ -633,7 +633,7 @@ int main(int argc, char **argv) {
egl_window = wl_egl_window_create(wl_surface, width, height);
assert(egl_window);
- egl_surface = wlr_egl_create_surface(&egl, egl_window);
+ egl_surface = wlr_egl_create_surface(egl, egl_window);
assert(egl_surface);
wl_display_roundtrip(display);
diff --git a/examples/pointer-constraints.c b/examples/pointer-constraints.c
index e020c5e7..ddd91bf1 100644
--- a/examples/pointer-constraints.c
+++ b/examples/pointer-constraints.c
@@ -16,7 +16,7 @@ static struct wl_seat *seat = NULL;
static struct xdg_wm_base *wm_base = NULL;
static struct zwp_pointer_constraints_v1 *pointer_constraints = NULL;
-struct wlr_egl egl;
+struct wlr_egl *egl;
struct wl_egl_window *egl_window;
struct wlr_egl_surface *egl_surface;
struct zwp_locked_pointer_v1* locked_pointer;
@@ -32,7 +32,7 @@ enum {
struct wl_region *regions[3];
static void draw(void) {
- eglMakeCurrent(egl.display, egl_surface, egl_surface, egl.context);
+ eglMakeCurrent(egl->display, egl_surface, egl_surface, egl->context);
float color[] = {1.0, 1.0, 0.0, 1.0};
@@ -40,7 +40,7 @@ static void draw(void) {
glClearColor(color[0], color[1], color[2], 1.0);
glClear(GL_COLOR_BUFFER_BIT);
- eglSwapBuffers(egl.display, egl_surface);
+ eglSwapBuffers(egl->display, egl_surface);
}
static void pointer_handle_button(void *data, struct wl_pointer *pointer,
@@ -212,7 +212,7 @@ int main(int argc, char **argv) {
regions[REGION_TYPE_JOINT] = joint_region;
EGLint attribs[] = { EGL_NONE };
- wlr_egl_init(&egl, EGL_PLATFORM_WAYLAND_EXT, display, attribs);
+ egl = wlr_egl_create(EGL_PLATFORM_WAYLAND_EXT, display, attribs);
struct wl_surface *surface = wl_compositor_create_surface(compositor);
struct xdg_surface *xdg_surface =
@@ -241,7 +241,7 @@ int main(int argc, char **argv) {
wl_surface_commit(surface);
egl_window = wl_egl_window_create(surface, width, height);
- egl_surface = wlr_egl_create_surface(&egl, egl_window);
+ egl_surface = wlr_egl_create_surface(egl, egl_window);
wl_display_roundtrip(display);
diff --git a/examples/relative-pointer-unstable-v1.c b/examples/relative-pointer-unstable-v1.c
index de7919bd..f6b6c923 100644
--- a/examples/relative-pointer-unstable-v1.c
+++ b/examples/relative-pointer-unstable-v1.c
@@ -171,7 +171,7 @@ static void xdg_toplevel_handle_configure(void *data,
static void xdg_toplevel_handle_close(void *data,
struct xdg_toplevel *xdg_toplevel) {
struct egl_info *e = data;
- wlr_egl_finish(e->egl);
+ wlr_egl_destroy(e->egl);
exit(EXIT_SUCCESS);
}
@@ -440,11 +440,10 @@ int main(int argc, char **argv) {
/* Initialize EGL context */
struct egl_info *e = calloc(1, sizeof(struct egl_info));
- e->egl = calloc(1, sizeof(struct wlr_egl));
e->width = e->height = 512;
EGLint attribs[] = { EGL_NONE };
- wlr_egl_init(e->egl, EGL_PLATFORM_WAYLAND_EXT, display, attribs);
+ e->egl = wlr_egl_create(EGL_PLATFORM_WAYLAND_EXT, display, attribs);
/* Create the surface and xdg_toplevels, and set listeners */
diff --git a/examples/text-input.c b/examples/text-input.c
index 8559810f..b8d75fee 100644
--- a/examples/text-input.c
+++ b/examples/text-input.c
@@ -63,12 +63,12 @@ static struct xdg_wm_base *wm_base = NULL;
static struct zwp_text_input_manager_v3 *text_input_manager = NULL;
static struct zwp_text_input_v3 *text_input = NULL;
-struct wlr_egl egl;
+struct wlr_egl *egl;
struct wl_egl_window *egl_window;
struct wlr_egl_surface *egl_surface;
static void draw(void) {
- eglMakeCurrent(egl.display, egl_surface, egl_surface, egl.context);
+ eglMakeCurrent(egl->display, egl_surface, egl_surface, egl->context);
float color[] = {1.0, 1.0, 0.0, 1.0};
color[0] = enabled * 1.0;
@@ -78,7 +78,7 @@ static void draw(void) {
glClearColor(color[0], color[1], color[2], 1.0);
glClear(GL_COLOR_BUFFER_BIT);
- eglSwapBuffers(egl.display, egl_surface);
+ eglSwapBuffers(egl->display, egl_surface);
}
static size_t utf8_strlen(char *str) {
@@ -364,7 +364,7 @@ int main(int argc, char **argv) {
zwp_text_input_v3_add_listener(text_input, &text_input_listener, NULL);
EGLint attribs[] = { EGL_NONE };
- wlr_egl_init(&egl, EGL_PLATFORM_WAYLAND_EXT, display, attribs);
+ egl = wlr_egl_create(EGL_PLATFORM_WAYLAND_EXT, display, attribs);
struct wl_surface *surface = wl_compositor_create_surface(compositor);
struct xdg_surface *xdg_surface =
@@ -377,7 +377,7 @@ int main(int argc, char **argv) {
wl_surface_commit(surface);
egl_window = wl_egl_window_create(surface, width, height);
- egl_surface = wlr_egl_create_surface(&egl, egl_window);
+ egl_surface = wlr_egl_create_surface(egl, egl_window);
wl_display_roundtrip(display);
diff --git a/examples/toplevel-decoration.c b/examples/toplevel-decoration.c
index f10ac742..0369116a 100644
--- a/examples/toplevel-decoration.c
+++ b/examples/toplevel-decoration.c
@@ -20,7 +20,7 @@ static struct wl_compositor *compositor = NULL;
static struct xdg_wm_base *wm_base = NULL;
static struct zxdg_decoration_manager_v1 *decoration_manager = NULL;
-struct wlr_egl egl;
+struct wlr_egl *egl;
struct wl_egl_window *egl_window;
struct wlr_egl_surface *egl_surface;
@@ -53,7 +53,7 @@ static void request_preferred_mode(void) {
}
static void draw(void) {
- eglMakeCurrent(egl.display, egl_surface, egl_surface, egl.context);
+ eglMakeCurrent(egl->display, egl_surface, egl_surface, egl->context);
float color[] = {1.0, 1.0, 0.0, 1.0};
if (current_mode == ZXDG_TOPLEVEL_DECORATION_V1_MODE_CLIENT_SIDE) {
@@ -64,7 +64,7 @@ static void draw(void) {
glClearColor(color[0], color[1], color[2], 1.0);
glClear(GL_COLOR_BUFFER_BIT);
- eglSwapBuffers(egl.display, egl_surface);
+ eglSwapBuffers(egl->display, egl_surface);
}
static void xdg_surface_handle_configure(void *data,
@@ -219,7 +219,7 @@ int main(int argc, char **argv) {
}
EGLint attribs[] = { EGL_NONE };
- wlr_egl_init(&egl, EGL_PLATFORM_WAYLAND_EXT, display, attribs);
+ egl = wlr_egl_create(EGL_PLATFORM_WAYLAND_EXT, display, attribs);
struct wl_surface *surface = wl_compositor_create_surface(compositor);
struct xdg_surface *xdg_surface =
@@ -238,7 +238,7 @@ int main(int argc, char **argv) {
wl_surface_commit(surface);
egl_window = wl_egl_window_create(surface, width, height);
- egl_surface = wlr_egl_create_surface(&egl, egl_window);
+ egl_surface = wlr_egl_create_surface(egl, egl_window);
wl_display_roundtrip(display);