aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2020-10-03 19:38:50 +0200
committerDavid Robillard <d@drobilla.net>2020-10-03 19:38:50 +0200
commit630f0a381e051209c5e6df716522cafe97a804f2 (patch)
tree2382aa3a4906a620f0bb9ee0487c6245e2967418
parent3da720328256b727de4f9fe5e56cd38007f98e7c (diff)
Refuse to set hints to PUGL_DONT_CARE when it doesn't make sense
-rw-r--r--pugl/detail/implementation.c13
1 files changed, 13 insertions, 0 deletions
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;