closing window works again
This commit is contained in:
parent
57e78e8bde
commit
9912c8ce58
3 changed files with 11 additions and 33 deletions
33
wayland.c
33
wayland.c
|
|
@ -56,7 +56,7 @@ static void xdg_toplevel_configure (
|
|||
|
||||
static void xdg_toplevel_close(void *data, struct xdg_toplevel *xdg_toplevel) {
|
||||
struct client_state *state = data;
|
||||
state->running = 0;
|
||||
state->running = false;
|
||||
}
|
||||
|
||||
void xdg_toplevel_configure_bounds(void *data, struct xdg_toplevel *xdg_toplevel, int32_t w, int32_t h) {
|
||||
|
|
@ -108,9 +108,6 @@ wl_surface_frame_done(void *data, struct wl_callback *cb, uint32_t time) {
|
|||
wl_callback_destroy(cb);
|
||||
|
||||
surface->dirty = true;
|
||||
|
||||
// Don't make it stuck.
|
||||
//wl_display_dispatch(state->wl_display);
|
||||
}
|
||||
|
||||
static const struct wl_callback_listener wl_surface_frame_listener = {
|
||||
|
|
@ -426,32 +423,16 @@ void wayland_init(struct client_state *state, int output_type) {
|
|||
egl_init(state);
|
||||
}
|
||||
|
||||
/// Swaps front/backbuffers and dispatches pending wayland commands.
|
||||
// TODO move logic to wait_for_event
|
||||
void commit(struct client_state *state) {
|
||||
struct surface_list *next = state->surface_list;
|
||||
while (next != NULL) {
|
||||
wl_display_dispatch(state->wl_display);
|
||||
|
||||
// TESTING maybe need to set current egl window or whatever
|
||||
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");
|
||||
}
|
||||
|
||||
eglSwapBuffers(state->egl_display, next->data.egl_surface);
|
||||
next = next->next;
|
||||
}
|
||||
}
|
||||
|
||||
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_next;
|
||||
// keep track of one loop.
|
||||
struct surface_list *original = next;
|
||||
// exit app
|
||||
if (!state->running) {
|
||||
struct event event = { .type = EVENT_EXIT };
|
||||
return event;
|
||||
}
|
||||
while (true) {
|
||||
if (next == NULL) {
|
||||
next = state->surface_list;
|
||||
|
|
@ -516,8 +497,6 @@ void swap_buffers(struct client_state *state, struct surface *surface) {
|
|||
// Set time after eglSwapBuffers.
|
||||
eglSwapInterval(state->egl_display, 0);
|
||||
eglSwapBuffers(state->egl_display, next->data.egl_surface);
|
||||
// maybe unecessary TODO maybe really bad?
|
||||
//wl_display_dispatch(state->wl_display);
|
||||
|
||||
/* Request another frame */
|
||||
struct wl_callback *cb = wl_surface_frame(surface->wl_surface);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue