Commit Graph

3150 Commits

Author SHA1 Message Date
Campbell Barton
008ed81d26 Fix #141777: Crash closing an unfocused window on Wayland 2025-07-20 16:31:57 +10:00
Campbell Barton
1762a66b82 Cleanup: use const cast 2025-07-20 15:27:07 +10:00
Jeroen Bakker
4de5da1ea2 OpenXR: Compile without OpenGL backend
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
2025-07-19 21:40:49 +02:00
Sebastian Parborg
17b9759942 CMake: Sync up minimum version to 3.10
Besides being more consistent with the minimum version we use, this also
fixes warnings when using CMake 4.0.

Pull Request: https://projects.blender.org/blender/blender/pulls/142497
2025-07-19 20:37:10 +02:00
Campbell Barton
751cfe4a74 GHOST/Wayland: invert cursor color, pre-multiply alpha
- 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.
2025-07-18 14:13:38 +10:00
Campbell Barton
4e3b58423c Cleanup: use snake case for GHOST's can_invert_color argument 2025-07-18 12:53:32 +10:00
Campbell Barton
c52c8874e9 GHOST/Wayland: scalable vector cursor support via cursor-generators
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
2025-07-18 12:38:52 +10:00
Campbell Barton
e8e188cb7d Cleanup: various non-functional changes for C++ 2025-07-17 12:32:30 +10:00
Campbell Barton
4d227dd593 GHOST: show assertion failures even when WITH_ASERT_ABORT=OFF
This makes GHOST_ASSERT behave like BLI_assert, where any non release
build shows an error even when assert doesn't abort.
2025-07-17 11:43:43 +10:00
Campbell Barton
ec8751f826 Cleanup: white-space around C-style comment blocks
Also use C++ style comments for disabling code.
2025-07-13 21:58:53 +10:00
Campbell Barton
6eec7e3bb1 Merge branch 'blender-v4.5-release' 2025-07-13 16:25:52 +10:00
Campbell Barton
2983ea4616 Cleanup: format 2025-07-13 16:25:25 +10:00
Campbell Barton
d4b2f719c3 Merge branch 'blender-v4.5-release' 2025-07-13 15:48:34 +10:00
Campbell Barton
601b5f49f0 Disable fix for #141846
While this works in 4.5x it could lock the UI in some cases in main.
Avoid possible regressions & disable for now.
2025-07-13 15:43:22 +10:00
Campbell Barton
98a949f997 Fix #141846: Successive calls to change the cursor exits on Wayland
Calling wm.progress_update() from Python in a loop would exit
under Wayland.

Resolve by calling wl_display_dispatch after changing the cursor.
2025-07-13 04:56:39 +00:00
Harley Acheson
bea1dbfab0 UI: Cursor Time for RGBA Platforms
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
2025-07-12 05:22:41 +02:00
Jorn Visser
035bc3e7ca Fix #115940, #111152: Handle access violations while loading Wintab
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
2025-07-10 19:59:34 +02:00
Hans Goudey
e573d9dd24 Revert "Wayland: Set surface color management"
This reverts commit 965b4dce6d.

This commit caused #141688.
2025-07-09 15:11:58 -04:00
Brecht Van Lommel
bc507861f2 Logging: Some tweaks to capitalization and log levels
For NDOF, Vulkan context, operators and events.

Pull Request: https://projects.blender.org/blender/blender/pulls/140244
2025-07-09 20:59:27 +02:00
Brecht Van Lommel
d7cc940825 Logging: Log GHOST backend, GPU backend and GPU device
Important information that could not be found directly in the logs yet.

Pull Request: https://projects.blender.org/blender/blender/pulls/140244
2025-07-09 20:59:27 +02:00
Brecht Van Lommel
4653b65f7c Logging: Add DEBUG, TRACE severity, replace numeric levels
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
2025-07-09 20:59:26 +02:00
Jeroen Bakker
965b4dce6d Wayland: Set surface color management
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
2025-07-09 10:50:20 +02:00
Jeroen Bakker
3fca75d0d7 Vulkan: Only select HDR swapchain on Wayland
Half float swapchains were selected even on platforms that are not able
to use HDR. This PR will limit the creation of HDR swapchains only to
Wayland.

Pull Request: https://projects.blender.org/blender/blender/pulls/141650
2025-07-09 09:00:34 +02:00
Campbell Barton
f528e3d61c GHOST/Wayland: support "resize" cursors from the shape protocol
Also add comments for the different crosshair cursors.
2025-07-09 13:54:47 +10:00
Campbell Barton
542503ddf2 Cleanup: format 2025-07-08 18:01:57 +10:00
Campbell Barton
c0e9edd70c Refactor: minor changes to prepare for Hi-DPI custom cursors on Wayland 2025-07-08 17:22:26 +10:00
Campbell Barton
439253eab5 Cleanup: use consistent terms in capability flags
Consistently use terms "cursor" & "clipboard" as a prefix
so they auto-complete more usefully.

Previously both ordering was used.
2025-07-08 16:35:42 +10:00
Campbell Barton
3ae7ba1255 GHOST/Wayland: use wl_surface_damage_buffer when available
Also damage the entire buffer, there is no reason to clamp this
to the buffer bounds.
2025-07-08 16:35:42 +10:00
Campbell Barton
f2b01dbcb8 Cleanup: order capability flags as defined
When setting GHOST capability flags, use the order they are defined
to make the code easier to follow when manually updating.
2025-07-08 11:04:39 +10:00
Campbell Barton
0ec2878cb6 Fix crash freeing cursors in Wayland
Regression in [0] missed clearing the mask when setting RGBA cursors.

[0]: 7b02b813f8
2025-07-08 08:09:04 +10:00
Harley Acheson
4fe0e788a9 Merge of blender-v4.5-release 2025-07-07 10:17:56 -07:00
Pratik Hadawale ~ sake :)
f090572ca8 Fix #141158: Fullscreen startup file causes white flicker with Vulkan backend
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
2025-07-07 19:12:59 +02:00
Jeroen Bakker
b617c6d825 Merge branch 'blender-v4.5-release' 2025-07-07 11:20:46 +02:00
Jeroen Bakker
f40e6e8a60 Fix: Vulkan: Use feature struct
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.
2025-07-07 11:14:09 +02:00
Harley Acheson
7580da6bd2 UI: Removal of Win32 Platform-Specific Cursor Files
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
2025-07-05 00:39:50 +02:00
Jonas Holzman
95abfc00a5 Merge branch 'blender-v4.5-release' 2025-07-03 00:07:52 +02:00
Jonas Holzman
b0ffd4cb07 Fix: macOS: Support multi-monitor window positioning
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
2025-07-03 00:05:52 +02:00
Campbell Barton
3d15acee1f GHOST/Wayland: correct tablet serial argument for setting cursors
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.
2025-07-02 23:13:29 +10:00
Campbell Barton
53a5eef579 Cleanup: minor tweaks to ghost cursor internals
- 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.
2025-07-02 21:34:27 +10:00
Sebastian Parborg
232b106e64 GHOST: Implement the cursor shape protocol and remove X11 cursors from the wayland backend
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
2025-07-01 15:16:44 +02:00
Campbell Barton
bfd3ff7e3d Cleanup: use const custom cursor arguments to GHOST
Also use int[2] for size & hot-spot arguments to avoid passing
around so many arguments.
2025-07-01 15:22:38 +10:00
Campbell Barton
5bdc6df9d1 Cleanup: de-duplicate doc-strings in GHOST
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.
2025-07-01 13:33:54 +10:00
Campbell Barton
7b02b813f8 GHOST/Wayland: support RGBA custom-cursors 2025-07-01 03:01:25 +00:00
Harley Acheson
ac457b9836 UI: SVG Icons as Internal Custom Mouse Cursors
This PR replaces our current custom mouse cursors (defined in
wm_cursors.cc using bitmaps and masks that we edit with a python
program) with SVG sources that are rasterized at the exact size when
needed. For Windows this would also replace the 29 platform-specific
"cur" files, although this PR does not actually remove those. For Linux
this creates the same kind of cursor as now (1bpp XBitMap) but at a
better size.

Pull Request: https://projects.blender.org/blender/blender/pulls/140990
2025-07-01 04:59:49 +02:00
Campbell Barton
5e927eae1b Docs: corrections, clarifications to code-comments 2025-06-28 10:46:57 +10:00
Julian Eisel
4b2d60a2c3 Ghost: Make special user directory query thread safe
Similar to e0ff7731e0.

Noticed a data race when working on blender/blender!130543, which calls
this function from a thread. Make this thread safe by avoiding returning
of static memory, instead use an optional `std::string`.

Pull Request: https://projects.blender.org/blender/blender/pulls/141083
2025-06-27 15:16:35 +02:00
Jeroen Bakker
e058e4f8ca Merge branch 'blender-v4.5-release' 2025-06-27 11:28:54 +02:00
Jeroen Bakker
a74b663bf9 Cleanup: Vulkan: Enable extensions (2)
Missing part of the cleanup done by 225449b96d
2025-06-27 11:26:24 +02:00
Jeroen Bakker
f957d132e7 Merge branch 'blender-v4.5-release' 2025-06-27 10:51:30 +02:00
Jeroen Bakker
225449b96d Cleanup: Vulkan: Enable extensions
When the list of extensions is constructed for `vkCreateDevice` it
uses a function that retrieves all extensions just to iterate to
check a specific extension is supported. However there is already a
list cached that is that is the subset of the desired extensions that
are supported by the device.

This cleanup will use that list instead of requiring all supported
extensions.

Pull Request: https://projects.blender.org/blender/blender/pulls/141074
2025-06-27 10:50:58 +02:00