diff options
author | David Robillard <d@drobilla.net> | 2020-10-29 18:16:59 +0100 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2020-10-30 10:58:32 +0100 |
commit | f9923d7b76d5c121f06f861273e6caf8a286b19e (patch) | |
tree | b77bfe22b07e269912da6658e75c9eed8f8ca12c /src | |
parent | caf17373026a9de07ccd72edc282d46486257fb5 (diff) | |
download | pugl-f9923d7b76d5c121f06f861273e6caf8a286b19e.tar.gz pugl-f9923d7b76d5c121f06f861273e6caf8a286b19e.tar.bz2 pugl-f9923d7b76d5c121f06f861273e6caf8a286b19e.zip |
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.
Diffstat (limited to 'src')
-rw-r--r-- | src/implementation.c | 42 | ||||
-rw-r--r-- | src/types.h | 2 | ||||
-rw-r--r-- | src/x11.c | 14 | ||||
-rw-r--r-- | src/x11_gl.c | 17 |
4 files changed, 5 insertions, 70 deletions
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 <stdlib.h> #include <string.h> -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"); @@ -161,22 +135,6 @@ puglGetWorldHandle(PuglWorld* world) } 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) { puglSetString(&world->className, 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 @@ -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; |