no outputs can be specified
This commit is contained in:
parent
ba7b581b4d
commit
d4c078875b
2 changed files with 39 additions and 32 deletions
|
|
@ -54,7 +54,8 @@ int main(int argc, char *argv[]) {
|
|||
|
||||
struct client_state *state = wayland_init(output_type, output_list, output_count);
|
||||
|
||||
Renderer renderer = new_renderer();
|
||||
bool renderer_initialized = false;
|
||||
Renderer renderer;
|
||||
|
||||
bool running = true;
|
||||
while (running) {
|
||||
|
|
@ -63,6 +64,10 @@ int main(int argc, char *argv[]) {
|
|||
int width = event.data.draw.width;
|
||||
int height = event.data.draw.height;
|
||||
double time = event.data.draw.time / 1000.0;
|
||||
if (!renderer_initialized) {
|
||||
renderer = new_renderer();
|
||||
renderer_initialized = true;
|
||||
}
|
||||
render(&renderer, width, height, time, shader_path, 0);
|
||||
swap_buffers(state, event.data.draw.surface);
|
||||
}
|
||||
|
|
|
|||
64
wayland.c
64
wayland.c
|
|
@ -556,39 +556,41 @@ struct event wait_for_event(struct client_state *state) {
|
|||
struct event event = { .type = EVENT_EXIT };
|
||||
return event;
|
||||
}
|
||||
while (true) {
|
||||
if (next == NULL) {
|
||||
next = state->surface_list;
|
||||
}
|
||||
|
||||
// do here
|
||||
if (next->data.dirty) {
|
||||
next->data.dirty = false;
|
||||
state->surface_list_next = next->next;
|
||||
|
||||
if (eglMakeCurrent(state->egl_display, next->data.egl_surface,
|
||||
next->data.egl_surface, state->egl_context)) {
|
||||
} else {
|
||||
fprintf(stderr, "Made current failed\n");
|
||||
if (state->surface_list != NULL) {
|
||||
while (true) {
|
||||
if (next == NULL) {
|
||||
next = state->surface_list;
|
||||
}
|
||||
struct event event = {
|
||||
.type = EVENT_DRAW,
|
||||
.data = {
|
||||
.draw = {
|
||||
.width = next->data.width,
|
||||
.height = next->data.height,
|
||||
.time = next->data.time,
|
||||
.surface = &next->data,
|
||||
}
|
||||
|
||||
// do here
|
||||
if (next->data.dirty) {
|
||||
next->data.dirty = false;
|
||||
state->surface_list_next = next->next;
|
||||
|
||||
if (eglMakeCurrent(state->egl_display, next->data.egl_surface,
|
||||
next->data.egl_surface, state->egl_context)) {
|
||||
} else {
|
||||
fprintf(stderr, "Made current failed\n");
|
||||
}
|
||||
};
|
||||
return event;
|
||||
}
|
||||
|
||||
next = next->next;
|
||||
if (next == original) {
|
||||
state->surface_list_next = next;
|
||||
break;
|
||||
struct event event = {
|
||||
.type = EVENT_DRAW,
|
||||
.data = {
|
||||
.draw = {
|
||||
.width = next->data.width,
|
||||
.height = next->data.height,
|
||||
.time = next->data.time,
|
||||
.surface = &next->data,
|
||||
}
|
||||
}
|
||||
};
|
||||
return event;
|
||||
}
|
||||
|
||||
next = next->next;
|
||||
if (next == original) {
|
||||
state->surface_list_next = next;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
wl_display_dispatch(state->wl_display);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue