Commit Graph

2680 Commits

Author SHA1 Message Date
Campbell Barton
6e0037e54d Fix #115878: build error with LIBDECOR & WITH_GHOST_WAYLAND_DYNLOAD=OFF
There were two problems here:

- libdecor_frame_get_content_* is not available in LIBDECOR v0.1.0.
- These functions aren't exposed by <libdecor.h>,
  they're only exposed by `libdecor-plugin.h`
  (intended for plug-ins that implement window decorations).

Resolve by storing the last applied size from LIBDECOR for reuse.
2023-12-13 10:17:07 +11:00
Campbell Barton
46a9530a75 Cleanup: move internal Wayland cursor API's into their own doxy section
Also resolve building when USE_EVENT_BACKGROUND_THREAD is disabled.
2023-12-13 09:59:06 +11:00
Campbell Barton
ffc84da541 Cleanup: use const variables & arguments, remove unused assignments 2023-12-10 21:24:37 +11:00
Campbell Barton
f02ebe7e2b Cleanup: correct assert to avoid null pointer deference 2023-12-10 17:34:41 +11:00
Campbell Barton
cbf1eac789 Cleanup: avoid pass-by-value on vector argument for ContextVK
Also use const arguments & values.
2023-12-10 17:33:02 +11:00
Campbell Barton
64c4b3428f Cleanup: remove redundant "contains" checks before erasing items 2023-12-10 17:14:46 +11:00
Campbell Barton
52a7555a84 Cleanup: match header/source argument naming 2023-12-10 17:14:06 +11:00
Campbell Barton
ff47eb3e37 Cleanup: minor style tweaks, surround ELEM by parenthesis 2023-12-10 17:12:53 +11:00
Campbell Barton
ded36920d7 Cleanup: spelling in comments 2023-12-10 16:33:54 +11:00
Campbell Barton
3c7b753279 Cleanup: minor changes to read_file_as_buffer logic
Assign the `chunk_first` once instead of checking & assigning
each iteration.
2023-12-10 15:53:43 +11:00
Campbell Barton
af4160de3a Cleanup: avoid redundant read(..) call in read_file_as_buffer 2023-12-10 15:22:07 +11:00
Campbell Barton
5d5fd5d676 Cleanup: make read_file_as_buffer into a generic utility function
Also use a (void *) data argument, matching `read(..)`.
2023-12-10 15:21:45 +11:00
Campbell Barton
3069d59215 GHOST/Wayland: correct fix for #106040
The previous fix for #106040 worked with GNOME, it relied on
matching GNOME's internal limits - which isn't fool proof
and could fail in the future.

Resolve by adding a `read` wrapper that reads the requested number of
bytes (when available).
2023-12-10 14:54:31 +11:00
Campbell Barton
2c85561fc3 Fix invalid cursor move time-stamp on WIN32 2023-12-09 16:41:56 +11:00
Harley Acheson
0137e5494a Fix #40009: Win32 Use Message Time for Events not Current Time
When creating Blender events in Win32 message processing we are using
the current time as timestamp. This isn't set until we collect them, so
this might be inaccurate at times of high load. This PR changes to using
the time the message was delivered.

Pull Request: https://projects.blender.org/blender/blender/pulls/115872
2023-12-08 18:59:31 +01:00
Jeroen Bakker
65e58fe574 CMake: Fix Compiling Shader Builder on macOS
Due to changes in the build environment shader_builder wasn't able to
compile on macOs. This patch reverts several recent changes to CMake files.

* dbb2844ed98f91395856ac3def258f170d78a819
* 94817f64b9780287be94f9c7a46257709622497d
* 1b6cd937ffc8279aadeee2b262690452dea8c7d9

The idea is that in the near future shader_builder will run on the buildbot as
part of any regular build to ensure that changes to the CMake doesn't break
shader_builder and we only detect it after a few days.

Pull Request: https://projects.blender.org/blender/blender/pulls/115929
2023-12-08 15:47:14 +01:00
Campbell Barton
eb7d5d0972 Fix #115933: Assert with invalid time-stamp on X11 with XIM input
Regression in [0] caused XIM generated key events to assert.

[0]: efef709ec73ce95817a82e4e26cf7ec0bad8eca0
2023-12-09 01:18:52 +11:00
Campbell Barton
55c5692364 Cleanup: remove unused variable, invalid comment & typo 2023-12-08 23:03:22 +11:00
Campbell Barton
77695da84b Cleanup: minor formatting tweaks 2023-12-08 16:22:14 +11:00
Campbell Barton
e8f60d4de2 Cleanup: replace unordered_map for cursor lookups with an array 2023-12-07 17:50:43 +11:00
Campbell Barton
488ba5cd9a Fix #115811: Wayland picker cursor isn't displayed
Themes that didn't define "color-picker" showed the default cursor.

Resolve by checking if the theme contains a cursor,
not just that the name is known.
2023-12-07 17:08:06 +11:00
Campbell Barton
96e41bfd19 GHOST/Wayland: update cursor names
Update names to better support Adwaita & Breeze cursor themes.
2023-12-07 17:08:03 +11:00
Campbell Barton
b570efb0a9 Cleanup: reference a const wl_cursor from Wayland 2023-12-07 17:08:01 +11:00
Campbell Barton
ae8f971491 Cleanup: remove GHOST_System::getMilliSeconds
Each GHOST implementation defines it's own getMilliSeconds()
so there is no need to define this in GHOST_System.
2023-12-07 17:07:59 +11:00
Campbell Barton
c0964dcd8d GHOST/Wayland: skip more involved timestamp conversion where possible
When the result of getMilliSeconds & wayland time-stamps match,
bypass more involved logic which attempts to maintain a delta and
return the time-stamp with an offset (to account for 32bit rollover).
2023-12-07 15:25:25 +11:00
Campbell Barton
57a1e9207f GHOST/Wayland: use monotonic timer for getMilliSeconds
This is closer to Wayland's own time-stamps, using this also allows for
optimizations calculating time-stamps from events.
2023-12-07 15:24:55 +11:00
Campbell Barton
edc503356a Cleanup: tweak error checks for time access for GHOST/X11
Prefer checking the known success value instead of an exact error
since badly behaving systems could use different error values.
2023-12-07 15:24:54 +11:00
Campbell Barton
497600e49e Cleanup: spelling in comments, strings 2023-12-07 12:45:27 +11:00
Brecht Van Lommel
e06561a27a Build: replace Blender specific DEBUG by standard NDEBUG
NDEBUG is part of the C standard and disables asserts. Only this will
now be used to decide if asserts are enabled.

DEBUG was a Blender specific define, that has now been removed.

_DEBUG is a Visual Studio define for builds in Debug configuration.
Blender defines this for all platforms. This is still used in a few
places in the draw code, and in external libraries Bullet and Mantaflow.

Pull Request: https://projects.blender.org/blender/blender/pulls/115774
2023-12-06 16:05:14 +01:00
Campbell Barton
86146c79f8 Cleanup: update comment, reference issue number
The bug referenced from [0] wasn't correct (should have been #40009).
Updated code-comment.

[0]: efef709ec73ce95817a82e4e26cf7ec0bad8eca0
2023-12-06 19:49:19 +11:00
Campbell Barton
efef709ec7 GHOST/X11: Support X11 time-stamps
Resolves #114835 on X11.
2023-12-06 19:33:50 +11:00
Campbell Barton
8580718168 GHOST/SDL: use SDL timestamps for events
Resolves #114835 on Haiku.
2023-12-06 17:46:23 +11:00
Campbell Barton
be2d940203 Fix error in recent GHOST/Wayland thread priority function
Invalid type for testing was left in making the priority change a noop.
2023-12-04 12:47:15 +11:00
Campbell Barton
ad07654ed8 GHOST/Wayland: use minimum priority for helper threads
Wayland threads for event handling & cursor animation shouldn't take
priority over application logic. Set them to minimum priority.
2023-12-04 12:28:43 +11:00
Campbell Barton
3a7c618b87 GHOST/Wayland: animated cursor support
Previously only the first frame of an animated sequence was shown,
now animated cursors are played back as expected
(typically the wait cursor).
2023-12-04 12:28:41 +11:00
Campbell Barton
d7492d3b58 Cleanup: minor simplification to internal Wayland cursor API
Avoid passing the 'seat' when the `image` to display can be passed
instead.
2023-12-04 12:28:40 +11:00
Campbell Barton
04cbe2880b Fix error updating the tablets cursor scale on Wayland 2023-12-04 12:28:38 +11:00
Campbell Barton
8bb6d0ffe0 Unbreak building with Vulkan & WITH_GHOST_X11=OFF
Missing from 5b7175c982271bf2a933da4daa3d89f55f7a5c7f.
2023-12-02 15:37:10 +11:00
Campbell Barton
5b7175c982 GHOST: remove X11 include when WITH_GHOST_X11=11 2023-12-02 15:27:51 +11:00
Campbell Barton
95f620fd3d Unbreak build with Vulkan+Wayland+X11
GHOST_ContextVK includes `X.h` which defines "None",
rename to "Unset" to avoid naming conflict.
2023-12-02 15:27:22 +11:00
Campbell Barton
4a735b1d05 GHOST/Wayland: use time-stamps from Wayland input
Resolve double-click events not being registered when there was
a delay between event handling.

Address #40009.
2023-12-02 14:58:49 +11:00
Campbell Barton
35295829e4 GHOST/Wayland: improve tablet event handling
Defer creating events until the "frame" callback runs to ensure
the tablet state has been fully updated before the events are created.

This also avoids redundant motion events which are now only sent
when the motion/pressure or tilt callbacks run.
2023-12-02 14:58:49 +11:00
Campbell Barton
36351f3796 Fix missing NULL check from fix for #113059 on Wayland/LIBDECOR
Add missing null check from [0].

[0]: e6c200e94ccc16839bcccee39be84dde9dce3993
2023-12-01 22:07:38 +11:00
Campbell Barton
e6c200e94c Fix #113059: file selector shrinks on each display under KDE
Postpone binding the buffer to the surface ensures the XDG window
is created at the correct size.
2023-12-01 14:08:01 +11:00
Campbell Barton
aba3fad33c Revert "Fix #113059: file selector shrinks on each display under KDE"
This reverts commit 85e2dd66a0d07f72ac0843c317fb78383f206dbe.

Remove the hack in favor of a different fix.
2023-12-01 14:08:00 +11:00
Campbell Barton
a226b14984 Fix #114609: compose key sequences includes continuation keys on Wayland
Suppress characters typed while composing.
2023-11-30 16:42:42 +11:00
Campbell Barton
dfbda79cbd Cleanup: declare pointers const where possible 2023-11-30 16:42:40 +11:00
Campbell Barton
3b5031f1cb Cleanup: use 'r_' prefix for output arguments, order last
Also clarify some naming.
2023-11-30 10:42:18 +11:00
Campbell Barton
278e37f8ce Cleanup: use default initializers for members of GWL_Seat 2023-11-29 16:05:30 +11:00
Campbell Barton
258a083066 Fix #115160: Keyboard layout sometimes ignored on Wayland
When using multiple keyboard layouts, the first layout would always
be used for internal keyboard layout queries.

This meant for e.g. with English layouts QWERTY & DVORAK both active
Control-C always used the QWERTY location for C even when DVORAK was
active.

Resolve by detecting layout changes & run xkb_state_update_mask
on all xkb_state's so internal queries always use the active layout.

Based on !115161, extended to detect layout changes & account for all
internal states.

Co-authored-by: Eugene Kuznetsov <eugene.kuznetsov@amd.com>
2023-11-29 15:18:42 +11:00