aboutsummaryrefslogtreecommitdiffstats
path: root/pugl/detail
diff options
context:
space:
mode:
Diffstat (limited to 'pugl/detail')
-rw-r--r--pugl/detail/implementation.c3
-rw-r--r--pugl/detail/mac.m4
-rw-r--r--pugl/detail/types.h2
-rw-r--r--pugl/detail/win.c6
-rw-r--r--pugl/detail/x11.c4
5 files changed, 10 insertions, 9 deletions
diff --git a/pugl/detail/implementation.c b/pugl/detail/implementation.c
index 29daf15..6ec19c2 100644
--- a/pugl/detail/implementation.c
+++ b/pugl/detail/implementation.c
@@ -67,6 +67,8 @@ puglNewWorld(void)
return NULL;
}
+ world->startTime = puglGetTime(world);
+
return world;
}
@@ -90,7 +92,6 @@ puglNewView(PuglWorld* const world)
view->world = world;
view->width = 640;
view->height = 480;
- view->start_time = puglGetTime(view);
puglSetDefaultHints(view->hints);
diff --git a/pugl/detail/mac.m b/pugl/detail/mac.m
index 23344ed..527724d 100644
--- a/pugl/detail/mac.m
+++ b/pugl/detail/mac.m
@@ -868,9 +868,9 @@ puglGetProcAddress(const char *name)
}
double
-puglGetTime(PuglView* view)
+puglGetTime(const PuglWorld* world)
{
- return (mach_absolute_time() / 1e9) - view->start_time;
+ return (mach_absolute_time() / 1e9) - world->startTime;
}
void
diff --git a/pugl/detail/types.h b/pugl/detail/types.h
index fdfb0f6..e279833 100644
--- a/pugl/detail/types.h
+++ b/pugl/detail/types.h
@@ -54,7 +54,6 @@ struct PuglViewImpl {
PuglEventFunc eventFunc;
char* windowClass;
PuglNativeWindow parent;
- double start_time;
uintptr_t transient_parent;
PuglHints hints;
int width;
@@ -71,6 +70,7 @@ struct PuglViewImpl {
/** Cross-platform world definition. */
struct PuglWorldImpl {
PuglWorldInternals* impl;
+ double startTime;
size_t numViews;
PuglView** views;
};
diff --git a/pugl/detail/win.c b/pugl/detail/win.c
index 804c883..6a0825a 100644
--- a/pugl/detail/win.c
+++ b/pugl/detail/win.c
@@ -704,12 +704,12 @@ wndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
}
double
-puglGetTime(PuglView* view)
+puglGetTime(const PuglWorld* world)
{
LARGE_INTEGER count;
QueryPerformanceCounter(&count);
- return ((double)count.QuadPart / view->world->impl->timerFrequency -
- view->start_time);
+ return ((double)count.QuadPart / world->impl->timerFrequency -
+ world->startTime);
}
void
diff --git a/pugl/detail/x11.c b/pugl/detail/x11.c
index e0b3dea..d54f1bf 100644
--- a/pugl/detail/x11.c
+++ b/pugl/detail/x11.c
@@ -600,11 +600,11 @@ puglProcessEvents(PuglView* view)
}
double
-puglGetTime(PuglView* view)
+puglGetTime(const PuglWorld* world)
{
struct timespec ts;
clock_gettime(CLOCK_MONOTONIC, &ts);
- return ((double)ts.tv_sec + ts.tv_nsec / 1000000000.0) - view->start_time;
+ return ((double)ts.tv_sec + ts.tv_nsec / 1000000000.0) - world->startTime;
}
void