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.
These headers come from when GLFW only supported a single context
creation API at a time, chosen at compile-time.
Since EGL and OSMesa are now always enabled and the platform-specific
APIs are tied to their specific window system, there is no reason to
keep these declarations separate from the internal.h and *_platform.h
header files.
An incorrect value for _WIN32_WINNT_WINBLUE caused GLFW to think Windows
8 was 8.1 or greater. This led to a crash when attempting to call
SetProcessDpiAwareness.
Closes#1775.
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 adds the GLFW_SCALE_TO_MONITOR window hint for automatically
resizing the content area of a window to the requested size times the
monitor content scale each time it is placed on a new monitor. This
only applies to windowed mode windows and includes the initial placement
at window creation.
This hint only has an effect on platforms where screen coordinates and
pixels always map 1:1 such as Windows and X11. Platforms like macOS
instead change the resolution of the framebuffer independently of the
window size.
Related to #676.
Related to #1115.
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.
When mouse trails are enabled, the cursor becomes invisible when the
OpenGL ICD detects a full screen window and switches to page flipping.
Mouse trails are now disabled as long as any full screen windows are
visible.
Fixes#1263.
In 32e78aeb2 the definition of DWM_BLURBEHIND in win32_platform.h was
moved behind a WINVER < 0x0600 preprocessor check (< Vista). This broke
the build for WINVER >= 0x0600 since DWM_BLURBEHIND is not defined.
Starting with Vista DWM_BLURBEHIND is available in Dwmapi.h.
So we can just include the header directly on Vista and above.
Closes#1253.
Allow window creation despite video mode setting failure.
Video mode setting failure is ignored the rest of the time and the
desired video mode has never been a hard constraint anyway.
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.
Inclusion of internal headers is already both centralized and follows
strict rules. Inclusion guards are both an unneccessary maintenance
burden and may hide inclusion order bugs.