Age | Commit message (Collapse) | Author |
|
"override" should be used either for all methods or none, otherwise Clang gives
warnings. Adding it for all platforms is a bigger change.
|
|
It wasn't obvious when direct access or lookups should be used.
Add class methods for direct lookups as well as searching from known
windows when windows are accessed outside Wayland's handlers.
This avoids having to check if the window has been removed in some cases.
|
|
Using flush avoids handling new events which complicates logic here.
|
|
Closing a window could leave danging pointers which Wayland
callbacks are responsible for clearing.
However, any calls Blender makes that don't originate from Wayland's
handlers don't have that assurance (key-repeat in this case).
Resolve by using a window lookup on each key-repeat event.
|
|
GHOST_GetCursorPosition wasn't working properly under Wayland because
the last focused window didn't necessarily match the window used to call
wm_cursor_position_get(..).
Now the window passed into wm_cursor_position_get is passed to GHOST
so that window is used to access cursor coordinates.
|
|
Use client (window) relative coordinates for cursor position access,
this only moves the conversion from window-manager into GHOST,
(no functional changes).
This is needed for fix a bug in GHOST/Wayland which doesn't support
accessing absolute cursor coordinates & the window is needed to properly
access the cursor coordinates.
As it happens every caller to GHOST_GetCursorPosition was already making
the values window-relative, so there is little benefit in attempting to
workaround the problem on the Wayland side.
If needed the screen-space versions of functions can be exposed again.
|
|
Each off-screen buffer created a surface and EGL window which was
only freed when Blender exited.
Resolve by freeing the associated data when disposing the off-screen
context.
|
|
Needed when called by functions that are const too.
|
|
Set the title before showing the window.
|
|
Support zxdg_output_manager_v1 v2, as weston only supports this.
Even though it's a reference implementation it can be useful for testing.
|
|
|
|
|
|
Instead, create keyboard two states when the keyboard layout is set
(one with & one without num-lock pressed).
This avoids key-press lookups having to check if num-lock exists and
setting the keyboard state for key press & release events.
No functional changes.
|
|
Accessing the symbols for keys with no modifiers & num-lock enabled
has unintended consequences for some keyboard layouts that use this
to switch layers.
Resolve by restricting num-locked lookups to keys typically toggled
with num-lock (key-pad home, page up/down ... etc).
|
|
Also don't pass typedef'd ints as references.
|
|
Implement scan-code fallback when the scan-code used for AccentGrave
on US keyboards doesn't map to a key known to GHOST.
Without this, shortcuts that use AccentGrave are inaccessible and the
key does nothing.
This matches functionality from X11, see [0].
[0]: f3427cbc981e5ad530d1a73ab4ecbf6b64751774
|
|
Revert part of [0] so only assert behavior is changed.
[0]: 9b5dda3b07496bda28970dfd23e4951a76d0f8ed
|
|
|
|
Remove mask suffix from:
- GHOST_TButtonMask
- GHOST_TModifierKeyMask
.. neither are used as bit-masks.
Remove 'Grab' from:
- GHOST_kGrabAxisNone
- GHOST_kGrabAxisY
.. matching the existing GHOST_TAxisFlag & GHOST_kAxisX.
|
|
|
|
Add WITH_GHOST_WAYLAND_DBUS option, so Blender can be built without
DBUS support. Currently it's only used to access the cursor theme.
Without this the "default" cursors are used instead.
Disabling this since it adds an additional dependency for a minor gain
in functionality, with the benefit of removing a library requirement.
There is also a problem where Blender hangs on startup for ~5 seconds
when DBUS isn't running. Eventually it would be good to be able to avoid
this problem without a build option.
|
|
|
|
For Wayland the mouse & tablet are separate devices with their
own location, button-pressed state and focused window.
Split internal state storage so they're separate.
Also track mouse button press/release state without needing focused
windows.
|
|
This implements client-side window decorations for moving and resizing
windows and HiDPI support.
This functionality depends on the external project 'libdecor' that is
currently a build option: WITH_GHOST_WAYLAND_LIBDECOR.
Reviewed by: brecht, campbellbarton
Ref D7989
|
|
As grab already uses it's own virtual coordinates, cursor warping can
be used when grab is enabled.
Currently nothing depends on this however it could be useful in future.
|
|
|
|
|
|
|
|
GHOST_ASSERT now matches BLI_assert, which is only ignored for release
builds. Otherwise it prints or asserts when WITH_ASSERT_ABORT is enabled.
|
|
|
|
Accumulate tablet data before generating an event using the 'frame'
callback.
|
|
Also remove NULL checks in keyboard enter/leave handlers,
as they didn't serve any purpose.
|
|
- Respect modifier keys (Shift press/release didn't change the case).
- Changing modifiers resets the timer instead of canceling key-repeat.
- Releasing keys (besides the key being repeated) resets the timer
instead of canceling key repeat.
This makes key-repeat behave the same way as GTK & WIN32 text input.
|
|
Ensure wayland handlers run that clear the window immediately after
the window has been removed so dangling pointers to the window
aren't left set.
|
|
Instead of providing our own names for wayland headers, use the filename
component as the basis for the header names. This matches most reference
documentation for Wayland.
Also generate client protocols into a sub-directory `libwayland`,
instead of generating headers into the ghost directory. Making the
include path more specific & makes it easier to differentiate generated
headers from other build files.
|
|
|
|
Also use `const char *` for cursor names as there isn't an advantage
in using `std::string`.
|
|
Changing the cursor would intermittently close Blender's window
(without crashing).
This happened because the size of a cursor must be the a multiple of the
scale, for themed cursor this is always true but with custom cursors
it's not.
Separate theme scale from custom cursor scale to avoid this bug.
In the future we can support Hi-DPI custom cursors, for now they're
scale is always set to 1.
|
|
- Support showing & hiding the cursor without setting the buffer,
needed to switch between software and hardware cursor.
- Track the state of the software/hardware cursor.
This resolves glitches switching between cursors sometimes hiding the
cursor.
|
|
|
|
getMainDisplayDimensions return values were scaled by the UI-scale,
instead of returning pixel values.
Also correct an error accessing the rotated monitor size,
which happened to be harmless as the value isn't used at the moment.
|
|
Add a method to access the custom cursor from GHOST which is used
for drawing a software cursor. This means the knife tools cursor now
work as expected.
Although non-custom cursors are still not supported.
|
|
The focus_pointer only pointer was only cleared when the window existed,
which caused a dangling focus_pointer when closing a window.
|
|
The current gnome-shell (v42.2) has a bug where grabbing the cursor
doesn't scale the region when confining it to the window.
For Hi-DPI displays this means the cursor may be confined to a quarter
of the window, making grab unusable.
Even though this has been fixed up-stream the issue remains in the
latest release - so workaround the problem by implementing window
confined grab using a software cursor.
This is only used gnome-shell for displays that use Hi-DPI scaling.
|
|
Method for clamping a point inside a rectangle.
|
|
This provides a workaround for the VR session stopping due to an error
in locating controller poses. The problem was that for the actions sync
on the first frame, the session's XrFrameState/predicted display time
had not been initialized yet, which led to an error in xrLocateSpace()
(the error was only observed for some OpenXR runtimes since the first
frame pose state would be inactive for other runtimes, skipping the
call to xrLocateSpace()).
The timing of action updates relative to frame state updates could be
reworked in the future, but for now simply check for a valid display
time to avoid an error on the first frame.
|
|
Also set the buffer scale before setting the cursor (matching SDL).
|
|
Also use GHOST_ prefix for public functions.
|
|
|
|
|