removed printf:s, made error printing more consistent
This commit is contained in:
parent
2383faf456
commit
44ba0468d9
2 changed files with 13 additions and 32 deletions
34
wayland.c
34
wayland.c
|
|
@ -89,28 +89,24 @@ static void egl_init(struct client_state *state) {
|
|||
state->egl_display = eglGetDisplay((EGLNativeDisplayType) state->wl_display);
|
||||
|
||||
if (state->egl_display == EGL_NO_DISPLAY) {
|
||||
fprintf(stderr, "Can't create egl display\n");
|
||||
fprintf(stderr, "can't create egl display\n");
|
||||
exit(1);
|
||||
} else {
|
||||
fprintf(stderr, "Created egl display\n");
|
||||
}
|
||||
|
||||
EGLint major, minor;
|
||||
if (eglInitialize(state->egl_display, &major, &minor) != EGL_TRUE) {
|
||||
fprintf(stderr, "Can't initialise egl display\n");
|
||||
fprintf(stderr, "can't initialise egl display\n");
|
||||
exit(1);
|
||||
}
|
||||
printf("EGL major: %d, minor %d\n", major, minor);
|
||||
|
||||
// Desktop GL?
|
||||
if (eglBindAPI(EGL_OPENGL_API) == EGL_FALSE) {
|
||||
printf("eglBindAPI failed\n");
|
||||
fprintf(stderr, "eglBindAPI failed\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
EGLint count;
|
||||
eglGetConfigs(state->egl_display, NULL, 0, &count);
|
||||
printf("EGL has %d configs\n", count);
|
||||
|
||||
EGLConfig *configs = calloc(count, sizeof *configs);
|
||||
|
||||
|
|
@ -122,10 +118,8 @@ static void egl_init(struct client_state *state) {
|
|||
EGLint size;
|
||||
eglGetConfigAttrib(state->egl_display,
|
||||
configs[i], EGL_BUFFER_SIZE, &size);
|
||||
printf("Buffer size for config %d is %d\n", i, size);
|
||||
eglGetConfigAttrib(state->egl_display,
|
||||
configs[i], EGL_RED_SIZE, &size);
|
||||
printf("Red size for config %d is %d\n", i, size);
|
||||
// just choose the first one
|
||||
state->egl_config = configs[i];
|
||||
break;
|
||||
|
|
@ -136,20 +130,17 @@ static void egl_init(struct client_state *state) {
|
|||
state->egl_config,
|
||||
EGL_NO_CONTEXT, context_attribs);
|
||||
if (state->egl_context == EGL_NO_CONTEXT) {
|
||||
printf("Failed to create EGL context\n");
|
||||
fprintf(stderr, "failed to create EGL context\n");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
void egl_init_surface(struct client_state *state, struct surface *surface) {
|
||||
printf("Creating egl window of size: %dx%d\n", surface->width, surface->height);
|
||||
surface->egl_window = wl_egl_window_create(surface->wl_surface,
|
||||
surface->width, surface->height);
|
||||
if (surface->egl_window == EGL_NO_SURFACE) {
|
||||
fprintf(stderr, "Can't create egl window\n");
|
||||
fprintf(stderr, "can't create egl window\n");
|
||||
exit(1);
|
||||
} else {
|
||||
fprintf(stderr, "Created egl window\n");
|
||||
}
|
||||
|
||||
surface->egl_surface =
|
||||
|
|
@ -159,9 +150,8 @@ void egl_init_surface(struct client_state *state, struct surface *surface) {
|
|||
|
||||
if (eglMakeCurrent(state->egl_display, surface->egl_surface,
|
||||
surface->egl_surface, state->egl_context)) {
|
||||
fprintf(stderr, "Made current\n");
|
||||
} else {
|
||||
fprintf(stderr, "Made current failed\n");
|
||||
fprintf(stderr, "made current failed\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -256,7 +246,6 @@ void layer_new(struct client_state *state, struct wl_output *wl_output) {
|
|||
|
||||
static void wl_output_name(void *data, struct wl_output *wl_output, const char *name) {
|
||||
struct client_state *state = data;
|
||||
printf("output name: %s\n", name);
|
||||
if (state->output_list != NULL) {
|
||||
for (int i = 0; i < state->output_list_len; i++) {
|
||||
if (strcmp(state->output_list[i], name) == 0) {
|
||||
|
|
@ -455,8 +444,8 @@ static void registry_handle_global(
|
|||
const char *interface,
|
||||
uint32_t version
|
||||
) {
|
||||
printf("interface: '%s', version: %d, name: %d\n",
|
||||
interface, version, name);
|
||||
//printf("interface: '%s', version: %d, name: %d\n",
|
||||
// interface, version, name);
|
||||
|
||||
struct client_state *state = data;
|
||||
|
||||
|
|
@ -519,11 +508,6 @@ static const struct wl_registry_listener wl_registry_listener = {
|
|||
|
||||
/// Initializes wayland and creates an opengl context
|
||||
struct client_state* wayland_init(int output_type, char *output_list[], int output_list_len) {
|
||||
if (output_list != NULL) {
|
||||
for (int i = 0; i < output_list_len; i++) {
|
||||
printf("output name selected: %s\n", output_list[i]);
|
||||
}
|
||||
}
|
||||
struct client_state *state = malloc(sizeof(struct client_state));
|
||||
state->output_list = output_list;
|
||||
state->output_list_len = output_list_len;
|
||||
|
|
@ -570,7 +554,7 @@ struct event wait_for_event(struct client_state *state) {
|
|||
if (eglMakeCurrent(state->egl_display, next->data.egl_surface,
|
||||
next->data.egl_surface, state->egl_context)) {
|
||||
} else {
|
||||
fprintf(stderr, "Made current failed\n");
|
||||
fprintf(stderr, "made current failed\n");
|
||||
}
|
||||
struct event event = {
|
||||
.type = EVENT_DRAW,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue