From f9923d7b76d5c121f06f861273e6caf8a286b19e Mon Sep 17 00:00:00 2001 From: David Robillard Date: Thu, 29 Oct 2020 18:16:59 +0100 Subject: Remove logging API This was missing from the C++ bindings and barely used anyway, so just remove it for now in the interests of simplicity and finalizing a stable API. The information previously logged in the X11 GL backend is now available programatically, so applications can print the same information portably if they like. --- src/implementation.c | 42 ------------------------------------------ src/types.h | 2 -- src/x11.c | 14 +++++--------- src/x11_gl.c | 17 ----------------- 4 files changed, 5 insertions(+), 70 deletions(-) (limited to 'src') diff --git a/src/implementation.c b/src/implementation.c index 74c6aea..da714cb 100644 --- a/src/implementation.c +++ b/src/implementation.c @@ -29,30 +29,6 @@ #include #include -static const char* -puglLogLevelPrefix(const PuglLogLevel level) -{ - switch (level) { - case PUGL_LOG_LEVEL_ERR: - return "error: "; - case PUGL_LOG_LEVEL_WARNING: - return "warning: "; - case PUGL_LOG_LEVEL_INFO: - case PUGL_LOG_LEVEL_DEBUG: - return ""; - } - - return ""; -} - -static void -puglDefaultLogFunc(PuglWorld* PUGL_UNUSED(world), - PuglLogLevel level, - const char* msg) -{ - fprintf(stderr, "%s%s", puglLogLevelPrefix(level), msg); -} - const char* puglStrerror(const PuglStatus status) { @@ -131,8 +107,6 @@ puglNewWorld(PuglWorldType type, PuglWorldFlags flags) } world->startTime = puglGetTime(world); - world->logFunc = puglDefaultLogFunc; - world->logLevel = PUGL_LOG_LEVEL_INFO; puglSetString(&world->className, "Pugl"); @@ -160,22 +134,6 @@ puglGetWorldHandle(PuglWorld* world) return world->handle; } -PuglStatus -puglSetLogFunc(PuglWorld* world, PuglLogFunc logFunc) -{ - world->logFunc = logFunc; - - return PUGL_SUCCESS; -} - -PuglStatus -puglSetLogLevel(PuglWorld* world, PuglLogLevel level) -{ - world->logLevel = level; - - return PUGL_SUCCESS; -} - PuglStatus puglSetClassName(PuglWorld* const world, const char* const name) { diff --git a/src/types.h b/src/types.h index e18eb87..a7c029a 100644 --- a/src/types.h +++ b/src/types.h @@ -83,12 +83,10 @@ struct PuglViewImpl { struct PuglWorldImpl { PuglWorldInternals* impl; PuglWorldHandle handle; - PuglLogFunc logFunc; char* className; double startTime; size_t numViews; PuglView** views; - PuglLogLevel logLevel; }; /// Opaque surface used by graphics backend diff --git a/src/x11.c b/src/x11.c index 18f8521..b462dd0 100644 --- a/src/x11.c +++ b/src/x11.c @@ -360,15 +360,11 @@ puglRealize(PuglView* view) // Create input context const XIMStyle im_style = XIMPreeditNothing | XIMStatusNothing; - if (!(impl->xic = XCreateIC(world->impl->xim, - XNInputStyle, im_style, - XNClientWindow, win, - XNFocusWindow, win, - NULL))) { - view->world->logFunc(view->world, - PUGL_LOG_LEVEL_WARNING, - "XCreateID failed\n"); - } + impl->xic = XCreateIC(world->impl->xim, + XNInputStyle, im_style, + XNClientWindow, win, + XNFocusWindow, win, + NULL); #ifdef HAVE_XCURSOR puglDefineCursorShape(view, impl->cursorShape); diff --git a/src/x11_gl.c b/src/x11_gl.c index bab85c6..34ac7e8 100644 --- a/src/x11_gl.c +++ b/src/x11_gl.c @@ -109,23 +109,6 @@ puglX11GlConfigure(PuglView* view) view->hints[PUGL_DOUBLE_BUFFER] = puglX11GlGetAttrib( display, fbc[0], GLX_DOUBLEBUFFER); - char msg[256]; - - snprintf( - msg, - sizeof(msg), - "Using visual 0x%lX: R=%d G=%d B=%d A=%d D=%d DOUBLE=%d SAMPLES=%d\n", - impl->vi->visualid, - puglX11GlGetAttrib(display, fbc[0], GLX_RED_SIZE), - puglX11GlGetAttrib(display, fbc[0], GLX_GREEN_SIZE), - puglX11GlGetAttrib(display, fbc[0], GLX_BLUE_SIZE), - puglX11GlGetAttrib(display, fbc[0], GLX_ALPHA_SIZE), - puglX11GlGetAttrib(display, fbc[0], GLX_DEPTH_SIZE), - puglX11GlGetAttrib(display, fbc[0], GLX_DOUBLEBUFFER), - puglX11GlGetAttrib(display, fbc[0], GLX_SAMPLES)); - - view->world->logFunc(view->world, PUGL_LOG_LEVEL_INFO, msg); - XFree(fbc); return PUGL_SUCCESS; -- cgit v1.2.1