From e83c2b421d140244a6b9edb051b3e0d4aacda332 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Mon, 22 Jul 2019 16:30:53 +0200 Subject: Add PuglWorld The old API was broken for programs that manage multiple views, since it was impossible to wait for events on any view. There are also several functions in the API which are not actually associated with views at all, so those can now be moved to the more appropriate PuglWorld to make this more clear. The old puglInit() and puglDestroy() functions are preserved for compatibility, but marked as deprecated. --- pugl/detail/types.h | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'pugl/detail/types.h') diff --git a/pugl/detail/types.h b/pugl/detail/types.h index b538091..fdfb0f6 100644 --- a/pugl/detail/types.h +++ b/pugl/detail/types.h @@ -24,6 +24,7 @@ #include "pugl/pugl.h" #include +#include #include // Unused parameter macro to suppresses warnings and make it impossible to use @@ -35,7 +36,10 @@ # define PUGL_UNUSED(name) #endif -/** Platform-specific internals. */ +/** Platform-specific world internals. */ +typedef struct PuglWorldInternalsImpl PuglWorldInternals; + +/** Platform-specific view internals. */ typedef struct PuglInternalsImpl PuglInternals; /** View hints. */ @@ -43,6 +47,7 @@ typedef int PuglHints[PUGL_NUM_WINDOW_HINTS]; /** Cross-platform view definition. */ struct PuglViewImpl { + PuglWorld* world; const PuglBackend* backend; PuglInternals* impl; PuglHandle handle; @@ -63,6 +68,13 @@ struct PuglViewImpl { bool visible; }; +/** Cross-platform world definition. */ +struct PuglWorldImpl { + PuglWorldInternals* impl; + size_t numViews; + PuglView** views; +}; + /** Opaque surface used by graphics backend. */ typedef void PuglSurface; -- cgit v1.2.1