From 630f0a381e051209c5e6df716522cafe97a804f2 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sat, 3 Oct 2020 19:38:50 +0200 Subject: Refuse to set hints to PUGL_DONT_CARE when it doesn't make sense --- pugl/detail/implementation.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'pugl') diff --git a/pugl/detail/implementation.c b/pugl/detail/implementation.c index 055e917..dbb0c5f 100644 --- a/pugl/detail/implementation.c +++ b/pugl/detail/implementation.c @@ -241,6 +241,19 @@ puglGetWorld(PuglView* view) PuglStatus puglSetViewHint(PuglView* view, PuglViewHint hint, int value) { + if (value == PUGL_DONT_CARE) { + switch (hint) { + case PUGL_USE_COMPAT_PROFILE: + case PUGL_USE_DEBUG_CONTEXT: + case PUGL_CONTEXT_VERSION_MAJOR: + case PUGL_CONTEXT_VERSION_MINOR: + case PUGL_SWAP_INTERVAL: + return PUGL_BAD_PARAMETER; + default: + break; + } + } + if (hint < PUGL_NUM_VIEW_HINTS) { view->hints[hint] = value; return PUGL_SUCCESS; -- cgit v1.2.1