{"id":20340721,"url":"https://github.com/glfw/gleq","last_synced_at":"2025-04-11T23:24:34.549Z","repository":{"id":18129883,"uuid":"21209904","full_name":"glfw/gleq","owner":"glfw","description":"Simple event queue for GLFW 3","archived":false,"fork":false,"pushed_at":"2018-05-11T12:50:29.000Z","size":21,"stargazers_count":74,"open_issues_count":0,"forks_count":7,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-03-25T19:16:17.909Z","etag":null,"topics":["c","glfw","header-only"],"latest_commit_sha":null,"homepage":null,"language":"Objective-C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/glfw.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-06-25T16:14:34.000Z","updated_at":"2024-11-03T13:25:03.000Z","dependencies_parsed_at":"2022-08-30T17:21:54.067Z","dependency_job_id":null,"html_url":"https://github.com/glfw/gleq","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/glfw%2Fgleq","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/glfw%2Fgleq/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/glfw%2Fgleq/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/glfw%2Fgleq/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/glfw","download_url":"https://codeload.github.com/glfw/gleq/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248493751,"owners_count":21113311,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["c","glfw","header-only"],"created_at":"2024-11-14T21:23:17.202Z","updated_at":"2025-04-11T23:24:34.521Z","avatar_url":"https://github.com/glfw.png","language":"Objective-C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GLEQ — GLFW Event Queue\n\n**GLEQ** is a basic, header-only event queue library for GLFW 3.  It adds GLFW\nevents for monitors, joysticks and windows to a single global queue.  Nothing\nmore.\n\nGLEQ is inspired by [SDL](http://www.libsdl.org/) and\n[GLWT](https://github.com/rikusalminen/glwt), and is written _as an example_ for\npeople requesting that GLFW provide an event queue API, to show how easy it is\nto implement on top of GLFW callbacks.\n\nGLEQ is written in C and depends only on GLFW 3.0 or later.\n\nGLEQ is a work in progress and the interface may change but it works as intended\nand covers nearly all events up to and including GLFW 3.3.  Just drop it into\nyour project and include it after the GLFW header.\n\nGLEQ is licensed under the [zlib/libpng\nlicense](https://opensource.org/licenses/Zlib).\n\n\n## Using GLEQ\n\nTo use GLEQ, include `gleq.h` after the GLFW header.  To add the implementation\nof GLEQ, define `GLEQ_IMPLEMENTATION` before including the GLEQ header in\n*exactly one* source file.\n\n```c\n#include \u003cGLFW/glfw3.h\u003e\n\n#define GLEQ_IMPLEMENTATION\n#include \"gleq.h\"\n```\n\nIf you will only be using GLEQ in a single source file, you can make _all_ its\nfunctions static by defining `GLEQ_STATIC` as well.\n\n```c\n#include \u003cGLFW/glfw3.h\u003e\n\n#define GLEQ_IMPLEMENTATION\n#define GLEQ_STATIC\n#include \"gleq.h\"\n```\n\nAfter GLFW has been successfully initialized, call `gleqInit`.  This will\nreplace the monitor and joystick callbacks.\n\n```c\nif (!glfwInit())\n    return false;\n\ngleqInit();\n```\n\nOnce a GLFW window is created, you can track it with `gleqTrackWindow`.  This\nreplaces all callbacks on that window.\n\n```c\ngleqTrackWindow(window);\n```\n\nEvent processing is done as usual with `glfwPollEvents`, `glfwWaitEvents` or\n`glfwWaitEventsTimeout`.  Events for monitors, joysticks and tracked windows are\nadded to the queue as GLFW reports them.\n\nEvent retrieval is done with `gleqNextEvent` and each event is then freed with\n`gleqFreeEvent`.\n\n```c\nGLEQevent event;\n\nwhile (gleqNextEvent(\u0026event))\n{\n    switch (event.type)\n    {\n        case GLEQ_WINDOW_RESIZED:\n            printf(\"Window resized to %ix%i\\n\",\n                   event.size.width, event.size.height);\n            break;\n    }\n\n    gleqFreeEvent(\u0026event);\n}\n```\n\nThe call to `gleqFreeEvent` frees any memory allocated for the event and clears\nthe event struct.  Currently only the file drop event allocates memory, but it's\nrecommended to call it for every event once it has been processed.\n\n\n## FAQ\n\n### Does GLEQ use the GLFW window user pointer?\n\nNo, only GLFW callbacks.\n\n\n### Does GLEQ allocate memory?\n\nOnly to save a deep copy of the path list provided to the file drop callback.\nThe event queue itself is a global static array.\n\n\n### Aren't static arrays bad?\n\nIt depends.  Also, the size of the queue can be controlled with `GLEQ_CAPACITY`.\n\n\n### Isn't global data bad?\n\nIt depends.  The native event queue wrapped by GLFW is global, too.\n\n\n### Why doesn't GLEQ provide one queue per window?\n\nGLEQ is intended to be a simple example event queue.  Having a queue per window\nwould make it more complicated than it needs to be.\n\n\n### Why isn't GLEQ thread safe?\n\nGLEQ is intended to be a simple example event queue.  Making it thread safe\nwould make it more complicated than it needs to be.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fglfw%2Fgleq","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fglfw%2Fgleq","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fglfw%2Fgleq/lists"}