Operations that take an instance handle should be passed the handle of
whatever module we are inside instead of blindly passing the handle of
the executable.
This commit makes GLFW retrieve its own instance on initialization.
This makes the most difference for window classes, which are
per-instance. Using the executable instance led to name conflicts if
there were several copies of GLFW in a single process.
Note that having this is still a bad idea unless you know what things to
avoid, and those things are mostly platform-specific. This is partly
because the library wasn't designed for it and partly because it needs
to save, update and restore various per-process and per-session settings
like current context and video mode.
However, multiple simultaneous copies of GLFW in a single Win32 process
should now at least initialize, like is already the case on other
platforms.
Fixes#469Fixes#1296Fixes#1395
Related to #927
Related to #1885
This change broke key names for dead keys, because that depends on
the effect on the global state of simulating two key presses.
Issue found by CTest tests.
Reverts #2018
The normal way of maximizing a window also makes it visible. This
implements window maximization manually for when the window passed to
glfwMaximizeWindow is hidden.
This will very likely not be forward-compatible and should be replaced.
This adds compile-time support for multiple platforms and runtime
detection of them. Window system related platform functions are now
called from shared code via the function pointer struct _GLFWplatform.
The timer, thread and module loading platform functions are still called
directly by name and the implementation chosen at link-time. These
functions are the same for any backend on a given OS, including the Null
backend.
The platforms are now enabled via CMake dependent options following the
GLFW_BUILD_<platform> pattern instead of a mix of automagic and ad-hoc
option names. There is no longer any option for the Null backend as it
is now always enabled.
Much of the struct stitching work in platform.h was based on an earlier
experimental branch for runtime platform selection by @ronchaine.
Every platform function related to windows, contexts, monitors, input,
event processing and Vulkan have been renamed so that multiple sets of
them can exist without colliding. Calls to these are now routed through
the _glfw.platform struct member. These changes makes up most of this
commit.
For Wayland and X11 the client library loading and display creation is
used to detect a running compositor/server. The XDG_SESSION_TYPE
environment variable is ignored for now, as X11 is still by far the more
complete implementation.
Closes#1655Closes#1958
The performance counter API is guaranteed to succeed on Windows XP and
later so there is no need for a fallback.
This removes our last dependency on winmm.
This adds the glfwInitAllocator function for specifying a custom memory
allocator to use instead of the C runtime library.
The allocator is a struct of type GLFWallocator with fields
corresponding to malloc, realloc and free, while the internal API
corresponds to calloc, realloc and free.
Heap allocation calls are filtered before reaching the user-provided
functions, so deallocation of NULL and allocations of zero bytes are not
passed on, reallocating NULL is transformed into an allocation and
reallocating to size zero is transformed into deallocation.
The clearing of a new block to zero is performed by the internal
calloc-like function.
Closes#544.
Fixes#1628.
Closes#1947.
The GPU driver only looks in the executable for the symbol requesting
the high-performance GPU, so enabling them when buidling GLFW as a DLL
will have no effect.
On Windows 7, when GLFW framebuffer transparency and the DWM are enabled
but DWM transparency is disabled (i.e. when the Transparency setting is
disabled under Personalization > Color), the contents of the framebuffer
is combined with the last frame using additive blending instead of
replacing the previous contents.
This commit limits GLFW framebuffer transparency on Windows 7 to when
DWM transparency is enabled, removing the previous workaround of setting
a layered window color key that led to rendering artifacts.
Fixes#1512.
This makes joystick support initialize the first time a joystick
function is called, including those gamepad functions that are layered
on top of joystick functions.
Related to #1284.
Related to #1646.
This adds basic support for the Per-Monitor V2 level of DPI awareness
in Windows 10, which allows for automatic DPI scaling of window
decorations.
This commit does not include resizing the window content area to match
the new window content scale.
Related to #1115.
Fixes#1294.
This adds glfwGetWindowContentScale and glfwGetMonitorContentScale for
querying the recommended drawing scale factor for DPI-aware rendering.
Parts of this patch are based on code by @ferreiradaselva.
Fixes#235.
Fixes#439.
Fixes#677.
Fixes#845.
Fixes#898.
This completes support for window framebuffer transparency on Windows,
macOS and X11. Note that the hint/attribute may be renamed before
release to clarify its relationship to GLFW_OPACITY.
Fixes#197.
Closes#1079.
Related to #663.
Related to #715.
Related to #723.
Related to #1078.
PFN_FunctionName is more readable than SCREAMSOUP_T.
Context creation API function typedefs are kept as-is where the original
header provided them, for compatibility and familiarity reasons.