aboutsummaryrefslogtreecommitdiffstats
path: root/src/x11.c
AgeCommit message (Collapse)AuthorFilesLines
2025-02-06Remove deprecated APIDavid Robillard1-18/+0
As far as I can tell, nobody actually cares about this in practice now, and it's slated for removal anyway.
2025-02-06Fully parenthesize mathematical expressionsDavid Robillard1-2/+2
2025-02-06X11: Gracefully handle failure of clock_gettime()David Robillard1-1/+4
As gracefully as possible given the API anyway. I don't think this is an error case that happens enough to really need transparent error handling, if the clock doesn't work all is lost anyway. Appeases cert-err33-c, which started caring about clock_gettime() in clang-tidy 19.
2025-02-06Update whitespaceDavid Robillard1-1/+2
Apparently clang-format 19 decided to get even worse in this case. The C and C++ committes really, really should have sorted out this nonsense a decade ago.
2025-02-01Consistently use unsigned literals for event flagsDavid Robillard1-9/+9
2025-01-23Replace puglPostRedisplayRect() with puglObscureRegion()David Robillard1-8/+17
2025-01-23Rename puglPostRedisplay() to puglObscureView()David Robillard1-2/+2
For consistency with event types (since "obscure" is opposite "expose") and the upcoming puglObscureRegion().
2025-01-23Simplify some conditionalsDavid Robillard1-3/+4
2025-01-22Simplify initial position code and place children at the originDavid Robillard1-54/+30
The code to find the initial size and position for a view had a lot of duplication, and was inconsistent between platforms. Flaky positioning and attempting to center embedded children has historically caused a bunch of problems in general, particularly since windows can be resized. So, factor out all the initial size and position code so that the logic is in one centralized place used by all platforms, and always position embedded children within their parent at the top/left origin. For top-level windows, the view is centered on its transient parent or the screen (as before). A new platform function puglGetAncestorCenter() is used to do this in general code. Also towards a total separation of position and size, towards support for Wayland, where applications don't dictate their own positions.
2025-01-22Factor out puglIsValidSize()David Robillard1-1/+1
2025-01-22Factor out puglIsValidPosition()David Robillard1-2/+2
2025-01-22Rename PuglViewSize to PuglAreaDavid Robillard1-11/+11
2025-01-22Make puglSetSizeHint() consistent with puglSetSize()David Robillard1-8/+4
In general, it's more convenient to have full-width integers as parameters, since C will promote any arithmetic on smaller types to them anyway. Using narrow types here, then, doesn't really make anything stricter, just forces an annoying cast when lots of warnings are enabled, which is likely unchecked. Better to handle it here, since it's more convenient, and the integer range checks the compiler can do aren't correct anyway (the max width/height is intentionally smaller than the max PuglSpan, so it can fit in a signed 16-bit integer).
2025-01-21X11: Generate text events for keypad symbolsMartin Preinfalk1-1/+2
2025-01-21Add missing const qualifierDavid Robillard1-1/+1
2025-01-21Add PUGL_KEY_NONEDavid Robillard1-3/+3
This isn't a strict enumeration anyway, so a sentinel value does no harm, and using it avoids warnings about testing an enum with no zero value.
2025-01-21Fix whitespaceDavid Robillard1-4/+1
2024-07-13X11: Avoid setting PBaseSize hints for top-level windowsDavid Robillard1-1/+2
By my reading of the spec, pugl's use of this hint was correct. However, many window managers break when it's set and use that size as the minimum (even when an actual minimum is set). This seems to be a bug based on a misreading of the spec which has been copy-pasted across many small window manager projects over the years. Not exposing the default size is unfortunate, but apparently nobody misses features based on it and there's nothing we can do about it here, so just deny the window manager the information entirely. The hint is still set for embedded views because (for example) plugin hosts need this information.
2024-06-10Fix build and tests with optional X11 features disabledDavid Robillard1-1/+1
2023-11-11Add support for Num, Scroll, and Caps LockDavid Robillard1-1/+4
2023-10-22X11: Only call XSetTransientForHint for valid windowsfalkTX1-1/+1
Signed-off-by: falkTX <falktx@falktx.com>
2023-10-21Fix potential memory leaks due to realloc() failureDavid Robillard1-26/+42
2023-10-21Fix whitespaceDavid Robillard1-1/+2
2023-10-21X11: Use PUGL_INIT_STRUCT to initialize char arraysfalkTX1-3/+3
2023-10-21X11: Fix key press event key when control is pressedfalkTX1-2/+2
2023-10-21Filter out corresponding modifiers from key eventsDavid Robillard1-4/+6
Platforms differ here, but it's meaningless to ask about the state of a modifier that's currently being pressed or released, so simply mask this out in general so it's easy for platform implementations to clean events up before dispatching them.
2023-05-29Add support for numeric keypad and simplify keyboard handlingDavid Robillard1-35/+38
2023-05-27X11: Fix cursors on systems where XcursorGetTheme() doesn't workDavid Robillard1-2/+3
2023-05-22X11: Fix puglStopTimer() with multiple timersThomas Brand1-5/+3
2023-05-12Factor out return code to status conversionDavid Robillard1-30/+35
2023-05-12Make puglSetSizeHint() tolerate unknown hints on all platformsDavid Robillard1-0/+4
2023-05-12Factor out puglIsValidSize() and use consistent rules everywhereDavid Robillard1-6/+5
2023-05-12X11: Use the root provided by XGetWindowAttributes()David Robillard1-5/+4
2023-05-12X11: Avoid deferring empty exposuresDavid Robillard1-10/+13
2023-05-12X11: Use available X extensions by defaultDavid Robillard1-12/+36
2023-05-03Fix mismatched types in ternary expressionsDavid Robillard1-5/+6
2023-05-03Fix implicit sign conversionsDavid Robillard1-3/+3
2023-02-18Use XSetWMNormalHints instead of XSetNormalHintssjaehn1-1/+1
2023-02-15Fix crash on views with no title setDavid Robillard1-9/+11
2023-02-10Factor out macrosDavid Robillard1-8/+1
2023-01-14Add general string hint interfaceDavid Robillard1-10/+20
This replaces the window title and class name APIs with a more general one that can be easily extended to other things, like icon names, more detailed application hints, and so on.
2023-01-11Guard against required hints explicitly being set to PUGL_DONT_CAREDavid Robillard1-0/+5
2023-01-11Clean up puglRealize() implementationsDavid Robillard1-10/+4
2023-01-11X11: Fix puglPostRedisplay() outside of event handlersDavid Robillard1-2/+4
2023-01-11X11: Make puglSendEvent() gracefully handle unrealized viewsDavid Robillard1-0/+3
2023-01-11Reduce duplicated codeDavid Robillard1-11/+1
2023-01-11X11: Fix positioning of top-level windows with decorationsDavid Robillard1-8/+65
2023-01-11Remove cached frame from viewDavid Robillard1-41/+89
This was just a source of ambiguity and bugs, since it represented different things at different times and could become stale. Redundant data is always trouble, so eliminate it, leaving just two positions/sizes: the defaults (used when the view is not yet realized), and the last configuration.
2023-01-11Fix checks for invalid view positionsDavid Robillard1-1/+1
2023-01-10Add PUGL_CURSOR_ALL_SCROLLDavid Robillard1-0/+1