mirror of
https://github.com/kovidgoyal/kitty
synced 2026-06-08 14:18:26 +02:00
Infrastructure for moving the run loop into GLFW
This is needed on Cocoa, where Apple expects to be in control of the run loop.
This commit is contained in:
25
glfw/x11_init.c
vendored
25
glfw/x11_init.c
vendored
@@ -675,6 +675,7 @@ int _glfwPlatformInit(void)
|
||||
|
||||
void _glfwPlatformTerminate(void)
|
||||
{
|
||||
removeAllTimers(&_glfw.x11.eventLoopData);
|
||||
if (_glfw.x11.helperWindowHandle)
|
||||
{
|
||||
if (XGetSelectionOwner(_glfw.x11.display, _glfw.x11.CLIPBOARD) ==
|
||||
@@ -768,3 +769,27 @@ const char* _glfwPlatformGetVersionString(void)
|
||||
#endif
|
||||
;
|
||||
}
|
||||
|
||||
static GLFWbool keep_going;
|
||||
|
||||
void _glfwPlatformStopMainLoop(void) {
|
||||
if (keep_going) {
|
||||
keep_going = GLFW_FALSE;
|
||||
_glfwPlatformPostEmptyEvent();
|
||||
}
|
||||
}
|
||||
|
||||
void _glfwPlatformRunMainLoop(void) {
|
||||
keep_going = GLFW_TRUE;
|
||||
while(keep_going) {
|
||||
_glfwPlatformWaitEvents();
|
||||
}
|
||||
}
|
||||
|
||||
unsigned long long _glfwPlatformAddTimer(double interval, bool repeats, GLFWuserdatafreefun callback, void *callback_data, GLFWuserdatafreefun free_callback) {
|
||||
return addTimer(&_glfw.x11.eventLoopData, "user timer", interval, 1, repeats, callback, callback_data, free_callback);
|
||||
}
|
||||
|
||||
void _glfwRemoveTimer(unsigned long long timer_id) {
|
||||
removeTimer(&_glfw.x11.eventLoopData, timer_id);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user