Generate mouse events from touch devices on Wayland.
The code tracks a single contact point and converts it to mouse moves,
LMB presses & releases. Multi-touch, pinch & swipe aren't yet supported.
Addresses #121449.
Ref !143416
Co-authored-by: Campbell Barton <campbell@blender.org>
This commit renames the GHOST Metal graphic context class and related
files / references from `GHOST_ContextCGL` to `GHOST_ContextMTL`. When
the Metal backend was first introduced, this context file contained
both the old OpenGL context (CGL, for macOS Core OpenGL API), and the
newer Metal context. Since #110185 all CGL related code was removed
from the class, making it Metal only, and thus rendering the old class
name outdated and potentially misleading. In addition to the rename,
unused OpenGL related forward declarations and old TODOs were also
removed.
Pull Request: https://projects.blender.org/blender/blender/pulls/142519
This PR allows blender to be compiled with OpenXR, but without
OpenGL support.
For investigating a bug we needed to compile Blender without
OpenGL (`WITH_OPENGL_BACKEND=OFF`) but it would fail to
compile OpenXR (`WITH_XR_OPENXR=ON`). This PR tweakes
the preprocess directives to compile the openxr graphics
binding without OpenGL.
Co-authored-by: Jonas Holzman <jonas@holzman.fr>
Pull Request: https://projects.blender.org/blender/blender/pulls/141668
- Cursors in wayland are expected to use pre-multiplied alpha.
Note that cursor generators create straight alpha,
pre multiplier in the wayland backend.
- Invert cursor colors on Wayland since dark cursors are often default,
this could use dark theme settings in the future.
Support showing vector cursors at the appropriate size based on each
monitors DPI.
This solves incorrectly sized cursors with Hi-DPI outputs as well as
supporting outputs with different DPI's.
Instead of passing pixel data, pass an object that can generate cursors,
GHOST/Wayland can then ensure the correct size is used based on the
display the cursor is shown on.
While may sound overly complicated it actually simplifies displaying
cursors on Wayland, especially for multiple monitors at different DPI's.
Showing cursors at higher or lower resolutions than the monitor's DPI
also behaves differently on GNOME & Plasma, resulting in situations
where the cursor would show larger/smaller than expected.
Details:
- Take advantage of the recently added SVG cursors & BLF time cursor
!140990 & !141367.
- Setting bitmap cursors via GHOST_SetCustomCursorShape is now a no-op
for Wayland since it's no longer used. This was supported in an
earlier version of this PR and could be restored if needed.
- While fractional scaling works it relies on the compositor downscaling
the cursors. Ideally they would be rendered at the target size but
this isn't a priority as the difference isn't noticeable.
Ref !141597
The Windows and Wayland platforms can both create antialiased mouse
cursors from SVG sources. Platforms with WM_CAPABILITY_CURSOR_RGBA
can therefore show a better version of "WM_cursor_time". Instead of
four blocky digits in two rows this displays beautiful digits in a
single row.
Pull Request: https://projects.blender.org/blender/blender/pulls/141367
Some Wintab drivers can randomly crash while loading. Guard against this
by catching such exceptions using SEH. Also save and restore the current
unhandled exception filter as some drivers replace it with their own for
some reason.
Pull Request: https://projects.blender.org/blender/blender/pulls/141685
The numeric levels have no obvious meaning. This removes the distinction
between severity and levels, instead there is a single list of named levels
with defined meaning.
Debug means information that's mainly useful for developers, and trace is for
very verbose code execution tracing.
Pull Request: https://projects.blender.org/blender/blender/pulls/140244
This PR solves running Wayland on compositors that don't support HDR/
color management. It also allows to let Blender window be drawn across
monitor boundaries and being transferred and clamped to the monitor
it is being displayed on.
From our point of view monitor configurations is a compositor/OS
responsibility. This PR provides the compositor that the provided
swapchain image will be using sRGB whitepoints and transfer
function. The compositor should then take care of performing the
final transfer to the monitor color volume.
The color management protocol doesn't provide guarantees that
every compositor does this. It is mentioned as a recommendation
and 'should do this'.
Pull Request: https://projects.blender.org/blender/blender/pulls/141598
When launching Blender via blender-launcher.exe, the window briefly
displays incorrectly on startup when using the Vulkan backend. This is
caused by not properly handling the GHOST_kWindowStateFullScreen case.
Previously, even if the window state was set to fullscreen, nCmdShow
would default to SW_SHOWNORMAL or SW_SHOWNOACTIVATE. With this fix,
nCmdShow is explicitly set to SW_SHOWMAXIMIZED when the window is in
fullscreen state, preventing the flicker.
Pull Request: https://projects.blender.org/blender/blender/pulls/141518
Detected an incorrect structure type. A property struct was used to
store feature data. This could lead to incorrect values for enabling
descriptorBufferPushDescriptor, what isn't used.
We are now able to make antialiased mouse cursors at any size directly
from SVG sources. Therefore there is no need for the platform-specific
"cur" versions of these cursors. This removes the work required in
duplicating the cursors in this format. Otherwise the results should be
identical.
Pull Request: https://projects.blender.org/blender/blender/pulls/141309
This commit brings multi-monitor window positioning support to the macOS
GHOST backend. This fixes a plethora of issues with macOS window
creation and positioning, such as:
* Windows not being properly restored when loading a file with Load UI
* Users default startup windows not being properly restored on multiple
screens
* Temporary windows (Settings, Render, Playblast, etc..) wrongly
appearing in unexpected places / other screens
* Duplicating an area into a new window (AKA popping out an editor) not
working on non-primary screens.
* etc..
Internally, this makes all macOS windows coordinates be relative to the
user primary monitor, instead of being local to the currently focused
one. I have tested this to properly work using all sorts of multiple
screen arrangements, and can also confirm that restoring windows from
screens that do not exist anymore / are now out of bounds (due to being
unplugged or re-arranged) also works properly, in which case they get
snapped back to the closest available screen similarly to other backends.
This fixes issue #126410 and implements behavior described in TODO task #69819.
Pull Request: https://projects.blender.org/blender/blender/pulls/141159
While the previous logic tended to work as it would use the serial
for the last active table event - follow the spec and and always pass
in the serial for the proximity_in event.
- Use the typed enum for wayland cursor ID's.
- Return an std::optional<...> for cursor access,
with std::nullopt when the cursor doesn't have an equivalent value
from ghost.
- Add "stub" calls to `update_cursor_scale` where removed as part of
!140366 but will be needed when custom cursors support updating
based on output scale.
This makes the the cursor drawing be handled by the Wayland compositor
unless the cursor shape is not in the standard cursor shape set.
For custom cursor shape, Blender still manually draws and handles these.
Removal of the X11 cursors was done because:
1. Greatly simplifies the code (and compositors not supporting the cursor
shape protocol will fallback to Blenders built in cursors).
2. On a lot of compositors the X11 cursor theme is not set per default,
this would lead to us falling back to a default theme. This would
in almost all cases not match the actual cursor theme of the user.
The fallback theme would also look quite ugly and the cursor size
would be inconsistent with the rest of the system.
Pull Request: https://projects.blender.org/blender/blender/pulls/140366
Move doc-strings to GHOST's "implementation" classes,
use `\copydoc` to reference them from classes in `intern`.
Doc-strings were copied between the classes, but had gotten out of sync
or only ever existed in one of the files.