aboutsummaryrefslogtreecommitdiffstats
path: root/pugl/detail/x11.c
AgeCommit message (Collapse)AuthorFilesLines
2020-03-01Cleanup: Adjust some code to be more clang-format friendlyDavid Robillard1-7/+9
2020-03-01Cleanup: Fix includesDavid Robillard1-1/+2
2020-03-01Put PuglEventAny member of PuglEvent first for easy initializationDavid Robillard1-1/+1
2020-02-18Pass expose event to backend enter and leave functionsDavid Robillard1-8/+3
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.
2020-02-18Remove immediate dispatch of exposed rectsDavid Robillard1-30/+2
This was a hack to support only exposing the rects that were explicitly exposed with puglPostRedisplayRect(), but it caused flaky drawing issues because it circumvented the deferral of exposure until the end of the loop. Instead, simply expand the pending expose to be dispatched later as usual. This means that only the union will be exposed in the end, so more area might be drawn than necessary, but this is probably good enough. If not, we will have to maintain a set of rects and be more clever about combining them.
2020-02-18Fix recursive context entryDavid Robillard1-2/+0
2020-02-11X11: Fix XMoveResizeWindow error checkZoƫ Sparks1-3/+3
In Xlib, a return value of 0 indicates an error (see "Xlib - C Language X Interface", Ch. 1, "Errors"). XMoveResizeWindow accordingly returns 1 on success, but the error check in puglSetFrame used the usual C convention, and so was backwards.
2020-02-02Only resize backend when necessaryDavid Robillard1-8/+12
This avoids resizing the backend when the window is only moved, which fixes flicker with Cairo where resizing is expensive.
2020-02-02X11: Dispatch exposures from event callbacks in the same iterationDavid Robillard1-1/+13
2020-02-02X11: Avoid calculating expose rect if view is not visibleDavid Robillard1-10/+10
2020-02-02X11: Factor out adding a pending exposureDavid Robillard1-14/+22
2019-11-21Rename "backend" headersDavid Robillard1-1/+1
Working on Vulkan clarified what has always been slightly smelly about the design and organization here: not everything that is API specific is really in a "backend" (a PuglBackend). The concrete example is puglGetProcAddress(), which only makes sense for GL and is actually implemented in the "backend" files. Arguably puglGetContext() is also such a thing. So, rename the headers so they can be the place where API-specific things go in general, which happens to include a backend most of the time. The stub is a bit of an exception to this, but whatever. The includes look tidier this way. In place of the old headers are compatibility stubs that just emit a warning and include the new version, which will be maintained for a while.
2019-11-18Cleanup: Remove unnecessary includesDavid Robillard1-1/+0
2019-11-17X11: Don't select on server socket if events are already queuedosch1-1/+3
2019-11-17X11: Support pasting (almost) arbitrarily long textDavid Robillard1-1/+1
This is a bit ridiculous, but using a "probably big enough" value seems to be what everyone does. This particular value is the one used by Gtk.
2019-11-17X11: Don't send expose events to invisible windowsDavid Robillard1-1/+3
2019-11-17X11: Track visibility via system eventsDavid Robillard1-3/+8
This ensure that visibility is properly updated when a window is made visible or invisible by the user or window system. Unfortunately it does not seem to propagate automatically to child windows, but this is at least better than the previous situation, and good enough for most cases.
2019-11-09Fix various clang-tidy warningsDavid Robillard1-1/+1
2019-11-03Remove redisplay flag and add puglPostRedisplayRect()David Robillard1-19/+22
2019-11-03X11: Only merge expose events if they intersectDavid Robillard1-13/+45
Towards actual fine-grained exposure. This uses the previous behaviour if expose events intersect to reduce redundant drawing, but dispatches expose events immediately (after flushing and pending configure events) if they don't to support partial redraws.
2019-11-03Add puglGetNativeWorld()David Robillard1-0/+6
2019-11-03Expose functional stub backendDavid Robillard1-0/+15
2019-11-03Fix puglFreeView() crashes when window creation failedJordan Halase1-3/+7
2019-09-07Clean up error handlingDavid Robillard1-8/+12
2019-09-07Add clipboard supportDavid Robillard1-0/+103
2019-09-03Make almost everything return a statusDavid Robillard1-7/+15
Prepares the API for proper error handling, even though there isn't any for these functions yet.
2019-09-03Add puglSetWindowTitle()David Robillard1-4/+16
2019-09-03Add puglSetClassName()David Robillard1-0/+3
2019-09-03Replace puglInitTransientFor() with puglSetTransientFor()David Robillard1-0/+13
2019-09-03Replace size and aspect ratio init functions with dynamic onesDavid Robillard1-0/+38
2019-09-03X11: Factor out size hints calculationDavid Robillard1-21/+30
2019-09-03Use consistent naming conventionsDavid Robillard1-21/+21
2019-09-03X11: Improve puglPostRedisplay() performanceDavid Robillard1-7/+19
2019-09-03Add functions to get and set view size and positionDavid Robillard1-11/+35
2019-09-03Add puglDispatchEvents()David Robillard1-39/+67
2019-09-03Add puglPollEvents()David Robillard1-0/+26
This allows waiting for events for any view in the world. It also improves on puglWaitForEvent() by the addition of a time parameter that allows indefinite blocking, non-blocking polling, and blocking polling with a timeout.
2019-09-03Move puglGetTime() to PuglWorldDavid Robillard1-2/+2
2019-09-03X11: Move input method to worldDavid Robillard1-12/+14
2019-09-03X11: Move atoms to worldDavid Robillard1-19/+26
2019-09-03Add PuglWorldDavid Robillard1-6/+26
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-03Add puglHasFocus()David Robillard1-0/+9
2019-09-03Fix puglGrabFocus() to work between parent and childrenDavid Robillard1-1/+1
2019-09-03Simplify hints implementationDavid Robillard1-2/+2
2019-08-02Clean up includesDavid Robillard1-0/+1
2019-08-02Replace puglIgnoreKeyRepeat() with a hintDavid Robillard1-1/+1
2019-07-31X11: Support UTF8 in window titlesJP Cimalando1-0/+5
It's possible that this does bad things if a UTF8 string is used on a system that does not support it (because XStoreName is still called), but I have no idea how likely this scenario is. Leaving it this way because it means the ASCII case will still work everywhere, and it's easy enough to avoid if this is a problem.
2019-07-29Cleanup: Clean up includes and call IWYU in lint targetDavid Robillard1-1/+6
2019-07-29Fix various clang-tidy warningsDavid Robillard1-1/+1
2019-07-29Reorganize source to separate private implementation detailsDavid Robillard1-0/+577
Taking a page from C++ convention, where "detail" is for things that should not be included in user code.