monotonic_start_time needs to be a global symbol, not local to each translation unit

This commit is contained in:
Kovid Goyal
2019-09-28 08:17:54 +05:30
parent 3378175450
commit 97fe38fbbc
7 changed files with 20 additions and 10 deletions

View File

@@ -194,6 +194,7 @@ const char *action_text, int32_t timeout, GLFWDBusnotificationcreatedfun callbac
#pragma once
#include <stddef.h>
#include <stdint.h>
#include "monotonic.h"
{}

2
glfw/glfw3.h vendored
View File

@@ -1704,7 +1704,7 @@ typedef struct GLFWgamepadstate
*
* @ingroup init
*/
GLFWAPI int glfwInit(void);
GLFWAPI int glfwInit(monotonic_t start_time);
GLFWAPI void glfwRunMainLoop(GLFWtickcallback callback, void *callback_data);
GLFWAPI void glfwStopMainLoop(void);
GLFWAPI unsigned long long glfwAddTimer(monotonic_t interval, bool repeats, GLFWuserdatafun callback, void * callback_data, GLFWuserdatafun free_callback);

4
glfw/init.c vendored
View File

@@ -27,6 +27,7 @@
// Please use C89 style variable declarations in this file because VS 2010
//========================================================================
#define MONOTONIC_START_MODULE
#include "internal.h"
#include "mappings.h"
@@ -214,10 +215,11 @@ _glfwDebug(const char *format, ...) {
////// GLFW public API //////
//////////////////////////////////////////////////////////////////////////
GLFWAPI int glfwInit(void)
GLFWAPI int glfwInit(monotonic_t start_time)
{
if (_glfw.initialized)
return true;
monotonic_start_time = start_time;
memset(&_glfw, 0, sizeof(_glfw));
_glfw.hints.init = _glfwInitHints;