aboutsummaryrefslogtreecommitdiffstats
path: root/pugl/detail
diff options
context:
space:
mode:
Diffstat (limited to 'pugl/detail')
-rw-r--r--pugl/detail/implementation.c4
-rw-r--r--pugl/detail/implementation.h3
-rw-r--r--pugl/detail/mac.m3
-rw-r--r--pugl/detail/win.c3
-rw-r--r--pugl/detail/x11.c6
5 files changed, 13 insertions, 6 deletions
diff --git a/pugl/detail/implementation.c b/pugl/detail/implementation.c
index 17cc6fd..b2306c6 100644
--- a/pugl/detail/implementation.c
+++ b/pugl/detail/implementation.c
@@ -115,10 +115,10 @@ puglSetDefaultHints(PuglHints hints)
}
PuglWorld*
-puglNewWorld(void)
+puglNewWorld(PuglWorldType type, PuglWorldFlags flags)
{
PuglWorld* world = (PuglWorld*)calloc(1, sizeof(PuglWorld));
- if (!world || !(world->impl = puglInitWorldInternals())) {
+ if (!world || !(world->impl = puglInitWorldInternals(type, flags))) {
free(world);
return NULL;
}
diff --git a/pugl/detail/implementation.h b/pugl/detail/implementation.h
index f363a30..2ad3f65 100644
--- a/pugl/detail/implementation.h
+++ b/pugl/detail/implementation.h
@@ -36,7 +36,8 @@ void puglSetBlob(PuglBlob* dest, const void* data, size_t len);
void puglSetString(char** dest, const char* string);
/** Allocate and initialise world internals (implemented once per platform) */
-PuglWorldInternals* puglInitWorldInternals(void);
+PuglWorldInternals*
+puglInitWorldInternals(PuglWorldType type, PuglWorldFlags flags);
/** Destroy and free world internals (implemented once per platform) */
void puglFreeWorldInternals(PuglWorld* world);
diff --git a/pugl/detail/mac.m b/pugl/detail/mac.m
index 2920675..ab59b99 100644
--- a/pugl/detail/mac.m
+++ b/pugl/detail/mac.m
@@ -695,7 +695,8 @@ handleCrossing(PuglWrapperView* view, NSEvent* event, const PuglEventType type)
@end
PuglWorldInternals*
-puglInitWorldInternals(void)
+puglInitWorldInternals(PuglWorldType PUGL_UNUSED(type),
+ PuglWorldFlags PUGL_UNUSED(flags))
{
PuglWorldInternals* impl = (PuglWorldInternals*)calloc(
1, sizeof(PuglWorldInternals));
diff --git a/pugl/detail/win.c b/pugl/detail/win.c
index 290a658..bbaa872 100644
--- a/pugl/detail/win.c
+++ b/pugl/detail/win.c
@@ -105,7 +105,8 @@ puglRegisterWindowClass(const char* name)
}
PuglWorldInternals*
-puglInitWorldInternals(void)
+puglInitWorldInternals(PuglWorldType PUGL_UNUSED(type),
+ PuglWorldFlags PUGL_UNUSED(flags))
{
PuglWorldInternals* impl = (PuglWorldInternals*)calloc(
1, sizeof(PuglWorldInternals));
diff --git a/pugl/detail/x11.c b/pugl/detail/x11.c
index 10ae0bb..7edc1ed 100644
--- a/pugl/detail/x11.c
+++ b/pugl/detail/x11.c
@@ -66,8 +66,12 @@ static const long eventMask =
ButtonPressMask | ButtonReleaseMask | KeyPressMask | KeyReleaseMask);
PuglWorldInternals*
-puglInitWorldInternals(void)
+puglInitWorldInternals(PuglWorldType type, PuglWorldFlags flags)
{
+ if (type == PUGL_PROGRAM && (flags & PUGL_WORLD_THREADS)) {
+ XInitThreads();
+ }
+
Display* display = XOpenDisplay(NULL);
if (!display) {
return NULL;