aboutsummaryrefslogtreecommitdiffstats
path: root/pugl/detail/implementation.c
AgeCommit message (Collapse)AuthorFilesLines
2020-04-02Make puglSetString() safe to call with equal source and destinationDavid Robillard1-3/+5
This is sometimes used by puglSetWindowTitle() using the existing title.
2020-04-01Consistently use "view" terminology in APIDavid Robillard1-4/+4
The sloppy use of "window" caused quite a bit of confusion, since views only correspond to top-level windows in some cases, and on MacOS, a non-top-level view is not a "window" at all.
2020-04-01Add PUGL_BAD_PARAMETER statusDavid Robillard1-1/+3
2020-03-16Separate cached configuration from frameDavid Robillard1-5/+2
This was a bad idea and a never-ending source of problems. The frame represents what the "current" frame is from a Pugl perspective, but with the asynchronicity of X11 and other issues this cant be used to filter configure events. Instead, simply cache the last configure event that was sent and compare with that.
2020-03-16Factor out dispatching configure events in the drawing contextDavid Robillard1-6/+19
The updates here need to happen whenever a configure is dispatched, even outside puglDispatchEvent(). This removes the last remaining direct calls to the event callback so the common implementation can always do the right thing.
2020-03-15Unify event loop functions as puglUpdate()David Robillard1-1/+13
The previous separation between polling and dispatching was a lie, especially on MacOS where it is impossible to only poll for events without dispatching anything. Providing such an API is misleading, and problematic in various other ways. So, merge them into a single puglUpdate() function which can do the right thing on all platforms. This also adds the behaviour of actually processing all events in the given time interval, which is almost always what clients actually want to do when using a positive timeout (naively doing this before caused terrible input lag).
2020-03-15Add type and flags to worldDavid Robillard1-2/+2
Unfortunately this is an API break, but there's no reasonable way to deprecate the old function and this is required for things to work correctly. The type will be used in following commits to tick the main loop and dispatch events correctly for either case.
2020-03-15Cleanup: Add puglDispatchSimpleEvent() internal utilityDavid Robillard1-2/+12
2020-03-15Move configure shortcut and frame update to common implementationDavid Robillard1-5/+20
2020-03-14Add logging APIDavid Robillard1-0/+44
2020-03-13Strengthen warningsDavid Robillard1-6/+8
2020-03-09Deprecate puglEnterContext() and puglLeaveContext()David Robillard1-0/+4
These are prone to abuse, and have caused confusion with people who try to use them like in other libraries that support explicit drawing in the main loop. The drawing parameter was also wrong, and these were already just compatibility veneers since the internal context API needs to be more expressive. So, now that PUGL_CREATE and PUGL_DESTROY exist, they can be deprecated to force clients to draw only at the correct time.
2020-03-09X11: Only send configure events if something has changedDavid Robillard1-0/+5
2020-03-09Add create, destroy, map, and unmap eventsDavid Robillard1-0/+5
These can be used to do things when a view is created or destroyed, in particular set up the GL context in a more controlled way. Map and unmap events are also added for when views are shown and hidden so application can react to this as well. Towards the deprecation of puglEnterContext() and puglLeaveContext(), which are prone to abuse. squash! Remove client event stuff
2020-03-08Enable double buffering by defaultDavid Robillard1-1/+1
2020-03-08Make PUGL_DONT_CARE the default for PUGL_SWAP_INTERVALDavid Robillard1-1/+1
2020-03-08Add a user data handle to the worldDavid Robillard1-0/+12
2020-03-01Cleanup: Adjust some code to be more clang-format friendlyDavid Robillard1-4/+7
2020-02-18Pass expose event to backend enter and leave functionsDavid Robillard1-9/+15
This is needed for clipping. Unfortunately, the puglEnterContext() and puglLeaveContext() API was not suitable for this, but this shouldn't matter in user code because it is only used for setup, and is slated for removal anyway. Instead, just call the backend functions directly in the implementation.
2019-11-09Fix various clang-tidy warningsDavid Robillard1-11/+11
2019-11-09Add puglStrerror() and improve test program error reportingDavid Robillard1-0/+19
2019-09-16Fix memory leakDavid Robillard1-0/+1
2019-09-07Clean up error handlingDavid Robillard1-1/+1
2019-09-07Add clipboard supportDavid Robillard1-0/+46
2019-09-03Make almost everything return a statusDavid Robillard1-3/+6
Prepares the API for proper error handling, even though there isn't any for these functions yet.
2019-09-03Add puglSetWindowTitle()David Robillard1-1/+1
2019-09-03Rename remaining init functionsDavid Robillard1-7/+10
This finishes the removal of the init/set split. While these ones are superficial, the general idea here is to provide general functions that work before or after window creation where possible. This prevents the situation where ever more dynamic counterparts to existing init functions get added over time.
2019-09-03Add puglSetClassName()David Robillard1-11/+18
2019-09-03Replace puglInitTransientFor() with puglSetTransientFor()David Robillard1-6/+0
2019-09-03Replace size and aspect ratio init functions with dynamic onesDavid Robillard1-20/+0
2019-09-03Move trivial deprecated implementations to headerDavid Robillard1-41/+0
Again just makes non-deprecated things easier to read and review, and also cleans up the symbol table.
2019-09-03Add puglGetWorld()David Robillard1-0/+6
2019-09-03Use consistent naming conventionsDavid Robillard1-11/+11
2019-09-03Add swap interval hintDavid Robillard1-0/+1
2019-09-03Add functions to get and set view size and positionDavid Robillard1-9/+13
2019-09-03Move puglGetTime() to PuglWorldDavid Robillard1-1/+2
2019-09-03Add PuglWorldDavid Robillard1-5/+65
The old API was broken for programs that manage multiple views, since it was impossible to wait for events on any view. There are also several functions in the API which are not actually associated with views at all, so those can now be moved to the more appropriate PuglWorld to make this more clear. The old puglInit() and puglDestroy() functions are preserved for compatibility, but marked as deprecated.
2019-09-03Simplify hints implementationDavid Robillard1-49/+20
2019-08-02Replace puglIgnoreKeyRepeat() with a hintDavid Robillard1-2/+5
2019-07-29Cleanup: Clean up includes and call IWYU in lint targetDavid Robillard1-0/+1
2019-07-29Fix potential memory leak on errorDavid Robillard1-0/+1
2019-07-29Reorganize source to separate private implementation detailsDavid Robillard1-0/+275
Taking a page from C++ convention, where "detail" is for things that should not be included in user code.