progress
This commit is contained in:
parent
3311810666
commit
0f1b028fca
3 changed files with 28 additions and 1 deletions
23
wayland.c
23
wayland.c
|
|
@ -50,6 +50,8 @@ static void xdg_toplevel_configure (
|
|||
next->data.height = height;
|
||||
printf("🧟🧟🧟\n");
|
||||
wl_egl_window_resize(next->data.egl_window, width, height, 0, 0);
|
||||
// draw new frame!
|
||||
next->data.dirty = true;
|
||||
}
|
||||
|
||||
static void xdg_toplevel_close(void *data, struct xdg_toplevel *xdg_toplevel) {
|
||||
|
|
@ -381,16 +383,24 @@ struct event wait_for_event(struct client_state *state) {
|
|||
// before dispatch: check that there is nothing elese to do
|
||||
// check for dirty surface
|
||||
struct surface_list *next = state->surface_list;
|
||||
printf("listtttt\n");
|
||||
printf("checking for events\n");
|
||||
while (next != NULL) {
|
||||
if (next->data.dirty) {
|
||||
printf("dirty\n");
|
||||
|
||||
if (eglMakeCurrent(state->egl_display, next->data.egl_surface,
|
||||
next->data.egl_surface, state->egl_context)) {
|
||||
fprintf(stderr, "Made current\n");
|
||||
} else {
|
||||
fprintf(stderr, "Made current failed\n");
|
||||
}
|
||||
struct event event = {
|
||||
.type = EVENT_DRAW,
|
||||
.data = {
|
||||
.draw = {
|
||||
.width = next->data.width,
|
||||
.height = next->data.height,
|
||||
.surface = &next->data,
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
@ -402,3 +412,14 @@ struct event wait_for_event(struct client_state *state) {
|
|||
}
|
||||
}
|
||||
|
||||
void swap_buffers(struct client_state *state, struct surface *surface) {
|
||||
struct surface_list *next = state->surface_list;
|
||||
while (next != NULL) {
|
||||
if (&next->data == surface) {
|
||||
eglSwapBuffers(state->egl_display, next->data.egl_surface);
|
||||
return;
|
||||
}
|
||||
}
|
||||
fprintf(stderr, "didn't find surface for buffer swap\n");
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue