aboutsummaryrefslogtreecommitdiffstats
path: root/src/win.c
AgeCommit message (Collapse)AuthorFilesLines
2022-06-08Use consistent terminology for native viewsDavid Robillard1-1/+1
On MacOS in particular, views and windows are entirely different concepts, so confusing them... confuses things. This was the last holdover in the API that used the old "native window".
2022-06-08Separate platform.h from internal.hDavid Robillard1-0/+1
This makes the internal header structure match the "kinds" of definition inside Pugl: common implementations of public API, things available internally to platform implementations, and things the platform must define.
2022-06-08Separate private and public function implementationsDavid Robillard1-1/+1
2022-06-07Use a consistent scheme for enum sizesDavid Robillard1-1/+1
2022-05-23Add rich clipboard supportDavid Robillard1-11/+70
This implements a more powerful protocol for working with clipboards, which supports datatype negotiation, and fixes various issues by mapping more directly to how things work on X11.
2022-05-21Add puglGetScaleFactor()David Robillard1-1/+42
2022-05-21Windows: Send configure events when frame moves or resizesDavid Robillard1-0/+3
2022-05-21Add puglSetPosition() and puglSetSize()David Robillard1-8/+74
These are redundant with puglSetFrame in a sense, but allow setting the size of a view without the position, or vice-versa. This API also maps more nicely to Wayland, where applications can not position themselves (but can resize).
2022-05-21Use consistent integer types for view positions and sizesDavid Robillard1-12/+13
Actual window sizes and positions fit easily in a 16-bit integer. So, we use that in "representation contexts" like events. This makes structures smaller, and allows the values to be converted to float, double, or integer without casting (since any int16_t or uint16_t value can fit in them without loss). Setter APIs use native integers for convenience, to avoid casting hassles when doing arithmetic. Ranges are checked at runtime.
2022-05-21Add a uniform API for setting size hintsDavid Robillard1-45/+27
This collapses many functions into one, which makes the API more easily extensible and reduces code size.
2022-05-21Rename PUGL_UNSUPPORTED_TYPE to be more genericDavid Robillard1-1/+1
2022-05-20Windows: Set window class on local moduleDavid Robillard1-2/+10
This avoids potential clashes between multiple copies of Pugl statically compiled into several modules.
2022-04-23Windows: Remove redundant view size assignmentDavid Robillard1-5/+0
2022-04-23Windows: Avoid initialization warningDavid Robillard1-1/+2
2022-04-23Windows: Avoid else after returnDavid Robillard1-3/+9
2022-04-23Strengthen MSVC warningsDavid Robillard1-2/+2
2021-12-17Adopt REUSE machine-readable licensing standardDavid Robillard1-15/+2
See https://reuse.software/ for details.
2021-12-17Windows: Support extended mouse buttonsDavid Robillard1-0/+14
2021-12-17Make button numbers consistent across platformsDavid Robillard1-4/+4
There's no universal consensus on how buttons are numbered. Left, right, middle as 0, 1, 2 seems to be the most common convention on modern vaguely similar libraries, so I've gone with that. The switch to zero-based indices will obviously break all current client code. Particularly since now is the time to finish any breaking changes before a stable release, I think that is better than only changing the middle and right numbers, which would likely go unnoticed.
2021-12-16Rename puglSetTransientFor to puglSetTransientParentDavid Robillard1-1/+1
2021-10-09Only call SetProcessDPIAware in programsfalkTX1-10/+11
This prevents plugins from changing global host state, which causes serious problems in hosts that are not DPI aware.
2021-05-28Fix questionable float equality comparisonDavid Robillard1-2/+2
This avoids a warning, and makes more sense in this situation anyway because negatives are also a bad configuration.
2021-05-25Rename event structs in a more readable styleDavid Robillard1-4/+4
Aside from reading more naturally, this avoids clashes with types that are not events, like PuglEventFlags. This is also more consistent with the C++ bindings, where "EventExpose" would be quite strange, for example. Apologies for the noise. Aliases to the old names will be preserved in the deprecated API like other things for a short while.
2021-05-25Fix some conversion warningsDavid Robillard1-6/+6
Avoids narrowing warnings when building as C++, and uses unsigned operands with bitwise operators in various places.
2021-05-25Windows: Make puglSetFrame() consistent with X11falkTX1-2/+1
2021-05-24Separate stub backends from other backendsDavid Robillard1-3/+153
Stub backends were a dependency of other backends to allow some code reuse. However, that can cause conflicting symbols if multiple backends are linked into the same binary, which should be possible. To avoid this, move the shared code into the platform implementation, and export those symbols so that backends can use them. This adds some semi-public platform-specific API that can only be used by backends included with pugl. They are undocumented, subject to change at any time without a corresponding version change, and may not be used by third parties (for example by custom backends in an application).
2021-05-08Send unmap/map events when the view is minimized/restoredDavid Robillard1-6/+9
X11 Window managers set WM_STATE to notify about minimization, often without sending core X visibility events (which seems odd to me, but that's what Gnome does anyway). So, implement this protocol and send map/unmap events to the view, and adjust the Windows implementation to do the same for consistency across all platforms.
2021-05-03Fix questionable event castsDavid Robillard1-1/+3
I don't think there is any UB actually happening here, but some of these were casting to a pointer of a larger type, which is problematic. Unfortunately, it makes for quite a bit of tedious verbosity, but I don't see a decent way around that in C99.
2021-01-02Simplify clang-format configuration and format all codeDavid Robillard1-798/+793
2020-12-11Fix a conversion warning with MinGWDavid Robillard1-1/+2
2020-12-01Make puglShow() realize automatically on Windows and MacOSDavid Robillard1-0/+7
2020-11-26Remove file documentationDavid Robillard1-5/+0
These will not be used in the Sphinx documentation, and most were self-explanatory and only there to make the Doxygen index look nice anyway. Where there was actually useful information, it has been preserved as regular comments.
2020-11-25Rename puglShowWindow and puglHideWindow to puglShow an puglHideDavid Robillard1-2/+2
These names were confusing because a view is not necessarily a window. Since there's no room for ambiguity here, simply drop the superfluous word.
2020-10-30Simplify header namesDavid Robillard1-1/+1
2020-10-30Move implementation source files to a conventional src directoryDavid Robillard1-0/+1140
I think this attempt to be optionally header-only was misguided, particularly installing source code to the system include path. Typically anyone vendoring code just includes the repository and builds from there anyway. This commit moves all the implementation code to a typical src directory (Don't Be Weird). I still think there is some value in simple "inline" deployment, but that would be better achieved another way, like producing a single-file amalgamation that builds anywhere, ala sqlite.