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);
|
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;
|
bool running = true;
|
||||||
while (running) {
|
while (running) {
|
||||||
|
|
@ -63,6 +64,10 @@ int main(int argc, char *argv[]) {
|
||||||
int width = event.data.draw.width;
|
int width = event.data.draw.width;
|
||||||
int height = event.data.draw.height;
|
int height = event.data.draw.height;
|
||||||
double time = event.data.draw.time / 1000.0;
|
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);
|
render(&renderer, width, height, time, shader_path, 0);
|
||||||
swap_buffers(state, event.data.draw.surface);
|
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 };
|
struct event event = { .type = EVENT_EXIT };
|
||||||
return event;
|
return event;
|
||||||
}
|
}
|
||||||
while (true) {
|
if (state->surface_list != NULL) {
|
||||||
if (next == NULL) {
|
while (true) {
|
||||||
next = state->surface_list;
|
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");
|
|
||||||
}
|
}
|
||||||
struct event event = {
|
|
||||||
.type = EVENT_DRAW,
|
// do here
|
||||||
.data = {
|
if (next->data.dirty) {
|
||||||
.draw = {
|
next->data.dirty = false;
|
||||||
.width = next->data.width,
|
state->surface_list_next = next->next;
|
||||||
.height = next->data.height,
|
|
||||||
.time = next->data.time,
|
if (eglMakeCurrent(state->egl_display, next->data.egl_surface,
|
||||||
.surface = &next->data,
|
next->data.egl_surface, state->egl_context)) {
|
||||||
}
|
} else {
|
||||||
|
fprintf(stderr, "Made current failed\n");
|
||||||
}
|
}
|
||||||
};
|
struct event event = {
|
||||||
return event;
|
.type = EVENT_DRAW,
|
||||||
}
|
.data = {
|
||||||
|
.draw = {
|
||||||
next = next->next;
|
.width = next->data.width,
|
||||||
if (next == original) {
|
.height = next->data.height,
|
||||||
state->surface_list_next = next;
|
.time = next->data.time,
|
||||||
break;
|
.surface = &next->data,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
return event;
|
||||||
|
}
|
||||||
|
|
||||||
|
next = next->next;
|
||||||
|
if (next == original) {
|
||||||
|
state->surface_list_next = next;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
wl_display_dispatch(state->wl_display);
|
wl_display_dispatch(state->wl_display);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue