aboutsummaryrefslogtreecommitdiffstats
path: root/pugl/detail/x11.c
AgeCommit message (Collapse)AuthorFilesLines
2020-03-15X11: Simplify implementation slightlyDavid Robillard1-6/+2
These continue statements are not necessary since the events will not be translated anyway.
2020-03-15X11: Read from server if necessary in puglDispatchEvents()David Robillard1-3/+3
This reduces input lag. The previous approach was an over-optimization: what's important here is to keep the iteration bounded by not continually flushing, but we do want to read everything to be as up to date as possible.
2020-03-15X11: Only enter drawing context if an expose is pendingDavid Robillard1-2/+2
2020-03-15X11: Update frame immediately on ConfigureNotifyDavid Robillard1-0/+4
This fixes some jittery display issues since the frame can be used before the deferred configure actually gets dispatched.
2020-03-15X11: Factor out selection event handlingDavid Robillard1-40/+69
2020-03-15Move configure shortcut and frame update to common implementationDavid Robillard1-29/+1
2020-03-15Remove backend resize methodDavid Robillard1-5/+0
2020-03-14Add logging APIDavid Robillard1-5/+4
2020-03-13Strengthen warningsDavid Robillard1-4/+4
2020-03-09Add PuglEventClient and puglSendEvent()David Robillard1-1/+18
This event makes it possible to send an arbitrary event to a view, which is useful for many things. In particular, this method of communication with views will wake up the event loop, unlike hacks in applications that share data in some other way.
2020-03-09X11: Factor out converting PuglEventExpose to XExposeEventDavid Robillard1-16/+50
2020-03-09X11: Only send configure events if something has changedDavid Robillard1-13/+21
2020-03-09Add create, destroy, map, and unmap eventsDavid Robillard1-9/+6
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-08Cleanup: Fix some conversion warningsDavid Robillard1-6/+6
2020-03-02Strengthen ultra-strict warnings with clangDavid Robillard1-5/+5
2020-03-02Omit deprecated implementations with PUGL_DISABLE_DEPRECATEDDavid Robillard1-0/+4
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