1
0
Fork 0
Commit graph

28097 commits

Author SHA1 Message Date
Jason Gerecke
64ff1f20f8 input-mapper: Reverse sort order of display score comparator
The `guess_candidates()` function scores each display that an input
device could be mapped to and then uses the `sort_by_score()` comparator
to find the best option. The function expects the list to be sorted from
best to worst, but the comparator currently sorts them in the opposite
order. This causes the function to end up returning the _worst_ match
rather than the the best. This commit reverses the sort order of the
comparator so that the best display can be returned as intended.

Closes: #1889
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1934>
2021-11-02 17:17:21 +00:00
Carlos Garnacho
3d37602c54 clutter: Drop click count from button events
This does two things to frown upon:
- Modifies ClutterEvent structs, while the effort is to have those
  completely opaque, and readonly after creation from the input
  thread side.
- Stores state in the ClutterInputDevice struct, event though those
  are also considered static after creation, managed by the input
  thread, etc.

Stop doing that. This makes all events just forwarded as-is in
the ClutterStage/clutter-main.c code.

Handling of click count sounds like material for a ClutterGestureAction
(or perhaps ClutterClickAction), all of both callers now do it in place
at the moment, while gestures lack a better state tracking and management.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2024>
2021-10-29 00:27:18 +02:00
Carlos Garnacho
33ca5e3d80 tests: Drop dependency on click count
This call is being removed, in favor of in-place handling, or a
ClutterGestureAction eventually.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2024>
2021-10-29 00:27:18 +02:00
Carlos Garnacho
8c4c3f0308 clutter: Make ClutterClickAction independent of click count
This will trigger for every button press/release that is obtained,
regardless of the click count.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2024>
2021-10-29 00:27:18 +02:00
Carlos Garnacho
a084fc10f7 frames: Keep accounting of double clicks in place
Instead of relying on ClutterEvent information.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2024>
2021-10-29 00:27:18 +02:00
Carlos Garnacho
a235d03550 clutter: Carry accounting on double/triple clicks in ClutterText
Instead of using the ClutterEvent information.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2024>
2021-10-29 00:27:18 +02:00
Carlos Garnacho
6d0b7381da clutter: Move ClutterGestureAction to the handle_event vfunc
This will not try the captured-event shenanigans to emulate grab
behavior, instead relying on event delivery being influenced by
other grab mechanisms.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2024>
2021-10-29 00:27:18 +02:00
Carlos Garnacho
5133815cc1 clutter: Move ClutterClickAction to the handle_event vfunc
This will not try the captured-event shenanigans to emulate grab
behavior, instead relying on event delivery being influenced by
other grab mechanisms.

While at it, improve handling of additional touchpoints by
cancelling the click action right away, as the differences in
event handling make this unwanted behavior surface.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2024>
2021-10-29 00:27:18 +02:00
Carlos Garnacho
7885f6dbcc clutter: Add handle_event vfunc to ClutterAction
This will be the entry point for events into these actions.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2024>
2021-10-29 00:27:18 +02:00
Carlos Garnacho
0e57fd42e3 clutter: Add information about event phase in ClutterActions
These will stick to a single phase, instead of juggling capture and
bubble event handlers to do whatever they want.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2024>
2021-10-28 23:52:04 +02:00
Carlos Garnacho
2fc40da1cb clutter: Drop ClutterZoomGesture's zoom-axis property/methods
This can be done on the caller, seems rarely useful if at all.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2024>
2021-10-28 23:52:04 +02:00
Carlos Garnacho
85bcc48b53 clutter: Drop ClutterSwipeAction::swipe default vmethod
This is already empty, no need to do anything here.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2024>
2021-10-28 23:52:04 +02:00
Carlos Garnacho
94abaf247b clutter: Drop default "zoom" action in ClutterZoomAction
Separate mechanism and effect, and let any ClutterZoomAction
users apply any necessary transformations.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2024>
2021-10-28 23:52:04 +02:00
Carlos Garnacho
f4b26559d3 clutter: Drop default "rotate" action in ClutterRotateAction
Separate mechanism and effect, and let any ClutterRotateAction
users apply any necessary transformations.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2024>
2021-10-28 23:52:04 +02:00
Carlos Garnacho
0ed9c6e524 clutter: Drop default action of Pan action
By default, the pan action performs matrix translations on the
child widget. Nobody wants that (or, nobody wants *just* that).
It's cleaner not to mix mechanism and effect in ClutterGestureAction
subclasses, so drop this base implementation, and change the signal
accumulator so it's more similar to event signals (not that it's
used any longer, anyway).

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2024>
2021-10-28 23:52:04 +02:00
Quytelda Kahja
af6fb2a702 clutter: Fix event axes array indices in axis broadcasts
A clutter event's axes array is indexed by `ClutterInputAxis`.
However, a few lines accidentally use `ClutterInputAxisFlags` as
indices, reading incorrect values from elsewhere in memory. As a
result, broadcasted axis values for the tilt, rotation, and wheel
axes don't reflect actual event data.

Fixes: https://gitlab.gnome.org/GNOME/mutter/-/issues/1982
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2065>
2021-10-28 16:20:20 +00:00
Carlos Garnacho
5125f66afa core: Use b/w unicode for tablet mode OSD
This unicode was initially meant to be b/w, but fonts and pango
eventually had another plan and we ended up with color glyphs
being used here, so we get strings like "". Change the
unicode used to ensure these are simpler b/w glyhps like
"● ○ ○ ○" that are easier to read on the OSD (and maybe even a
bit less ugly).

Fixes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/4733
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2064>
2021-10-28 10:56:26 +00:00
Carlos Garnacho
ab45ae18ff x11: Initialize struct early
Since we now use the common error paths, this could fallback at a point
where it was trying to free uninitialized memory.

CID: #1508193
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2063>
2021-10-27 14:12:35 +02:00
Rūdolfs Mazurs
774d7b46a8 Update Latvian translation
(cherry picked from commit 4ccdedfd99dc469507748fd2155fccda78ac1993)
2021-10-26 19:15:06 +00:00
Erico Nunes
577c4711e1 backends: Enable partial update on clipped redraws
Mutter already calculates and tracks the damage rectangles to redraw
only areas of the screen that change since the last time a buffer was
used.
This patch extends this by using the EGL_KHR_partial_update extension to
inform the GPU in advance that only those areas will be changed, which
may allow for further optimization.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2023>
2021-10-26 16:56:39 +00:00
Erico Nunes
87965b5ce2 cogl: Add support for partial update
Add support for a cogl function to set the damage_region on an onscreen
framebuffer.
The goal of this is to enable using the EGL_KHR_partial_update extension
which can potentially reduce memory bandwidth usage by some GPUs,
particularly on embedded GPUs that operate on a tiling rendering model.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2023>
2021-10-26 16:56:39 +00:00
Robert Mader
331f08fc40 gschema: Turn experimental features into flags
Defining valid values makes
1. changing settings less error prone
2. sure they are discoverable.

This does reset the values once on update, but fortunately does *not*
change the way to set the values. Thus e.g. enabling fractional scaling
via terminal command still works as before and internet guides stay valid.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1961>
2021-10-26 16:24:41 +00:00
Robert Mader
49aa801454 gschema: Add "kms-modifiers" experimental feature description
To make it more discoverable. While on it, fix a typo.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1961>
2021-10-26 16:24:41 +00:00
Jonas Ådahl
1f9af12e5a ci: Fix junit artifact file name
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1796>
2021-10-26 17:53:50 +02:00
Jonas Ådahl
c0bc821f62 wayland/output: Remove wl_output global when making it inert
This will make clients immediately aware of the output disappearing,
while still allowing for a grace period of 10 seconds for attempting to
bind to it before it turning into a protocol error. This API added as
part of wayland 1.18.

This requires us to not add the output resource to the output resource
list, if the output was made inert. This effectively makes the resource
useless, but that is harmless, since shortly after, the client will
clean it up anyway.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1796>
2021-10-26 17:31:46 +02:00
Jonas Ådahl
257ccf5e80 xwayland: Unset shutdown idle id when source removed by callback
We failed to do this when the experimental "auto-close Xwayland" setting
was not enabled.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1796>
2021-10-26 16:55:12 +02:00
Jonas Ådahl
1dd79c52ad xwayland: Trap errors when setting primary RANDR output
This will be crucial when we start to remove the global directly when an
output is removed, as that means Xwayland might have removed the output
before we managed to get our queries in.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1796>
2021-10-26 16:55:12 +02:00
Jonas Ådahl
39f80885c1 xwayland: Setup RANDR integration with MetaX11Display
This doesn't gain us anything right away, but will allow us to trap
errors, which will soon be necessary.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1796>
2021-10-26 16:55:12 +02:00
Jonas Ådahl
fb78ac4016 xwayland: Init/shutdown DND using MetaX11Display
Before it was passed an Display pointer, and had to e.g. fetch the root
window from GDK instead of the MetaX11Display.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1796>
2021-10-26 16:55:12 +02:00
Jonas Ådahl
b4fe1fdd95 xwayland: Make setup/teardown a bit more symmetrical
We setup Xwayland in an early phase of the X11 display, before we had a
MetaX11Display, and teared down in a couple of places happening when
tearing down the Xwayland integration if the X server died or
terminated. It was a bit hard to follow what happened and when it
happened. Attempt to clean this up a bit, with things being structured
as follows:

 * Early during X11 display connection setup, only setup the rudimentary
   X11 hooks, being the libX11 error callbacks, and adding the local
   user to XHost.

 * Move "initialize Xwayland component" code to a new
   'x11-display-setup' signal handler. Things setup here are cleaned up
   in the 'x11-display-closing' handler.

 * Connect to 'x11-display-setup' and 'x11-display-closing' up front,
   and stay connected to these two.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1796>
2021-10-26 16:54:58 +02:00
Jonas Ådahl
69f9b36643 xwayland: Pass the manager object to XSetIOErrorExitHandler
This means we can avoid going through global singletons in the handler.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1796>
2021-10-26 16:32:27 +02:00
Carlos Garnacho
90ad8b88d4 clutter: Plug leak on error condition
The ClutterContext is leaked if not properly initialized.

CID: #1508079
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2061>
2021-10-25 15:45:35 +02:00
Carlos Garnacho
c869b92d5d cogl: Plug leak in error path
If the renderer fails to connect, we were leaking the renderer.

CID: #1505882
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2061>
2021-10-25 15:45:35 +02:00
Carlos Garnacho
ccaa4c049b wayland: Plug leak in error condition
If we fail to bind the X11 socket, free the lock file string.

CID: #1505865
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2061>
2021-10-25 15:45:35 +02:00
Carlos Garnacho
f6726c61ca cogl: Plug leak on error path
If we don't pass the gles version check, the gl_extensions string
is leaked.

CID: #1505846
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2061>
2021-10-25 15:45:35 +02:00
Carlos Garnacho
ed9650ff42 cogl: Plug possible GString leaks
These strings are leaked if there are no changes to log. This is
perhaps never true, but this anyway good for clarity.

CIDs: #1505840, #1505884
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2061>
2021-10-25 15:45:35 +02:00
Carlos Garnacho
025dbbbc94 x11: Drop fallback on ~/.mutter paths
This old handling of session files looked on ~/.mutter, which has
been unused and unsupported for a long time. It also had paths were
the GError was leaked. Fix both by dropping the legacy code, and
falling back to the common error paths.

CID: #1502682
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2061>
2021-10-25 15:45:35 +02:00
Carlos Garnacho
4dc07999c6 cogl: Plug GString leak
In some error paths, this string was being leaked. Make it g_autoptr
so it's done for us.

CID: #1505903
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2061>
2021-10-25 15:45:35 +02:00
Carlos Garnacho
b3046cca2d backends/x11: Fix off by one in debug output
We are looking the atom name based on the wrong index, as the
axis is incremented to cater for the extra CLUTTER_INPUT_AXIS_IGNORE
value.

CID: #1418330
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2061>
2021-10-25 15:45:35 +02:00
Carlos Garnacho
e50460e396 clutter: Turn warning into assert
This warning is actually dead code, since should_be_mapped and
must_be_realized are always set to the same value, so it does not
make sense to check for "a && !b".

Turn this into an assert so we avoid the dead branch, but do not
remove the variable duplication so the more aptly named variable
is used where it belongs, for clarity.

CID: #1506254
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2061>
2021-10-25 15:45:35 +02:00
Carlos Garnacho
774f120ac4 cogl: Fix broken check for COGL_DISABLE_GL_EXTENSION envvar
This check was always true since the variable is already set in the
if() condition above. Presumably this was meant to check for empty
strings, so do that.

CID: #1491518
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2061>
2021-10-25 15:45:35 +02:00
Carlos Garnacho
8ede36b2ef compositor: Remove dead code
When grabbing the devices, there's no error paths that would quit
late enough that both pointer and keyboard would need ungrabbing,
so the keyboard checks were dead code.

Fix this by dropping the boolean variable checks, and adding goto
labels to unroll the operation properly at every stage.

CID: #1418254
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2061>
2021-10-25 15:45:35 +02:00
Carlos Garnacho
0a7547a195 core: Drop code to do edge resistance on timeouts
This has been long indirectly disabled (these timeouts were defined
as 0ms long, thus not set), so edge resistance timeouts can be safely
deemed dead code.

CID: #1418253
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2061>
2021-10-25 15:45:35 +02:00
Carlos Garnacho
70a5f29ef1 core: Drop repeated early return condition in function
We are already checking for prev_state == META_SEQUENCE_PENDING_END,
no need to do it twice.

CID: #1418251
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2061>
2021-10-24 19:16:42 +02:00
Carlos Garnacho
820aa18126 backends/native: Use rtkit to get realtime priority
Instead of using sched_setscheduler directly (and relying that we
somehow got CAP_SYS_NICE), use rtkit to do this for us.

Fixes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/2284
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2060>
2021-10-22 08:35:15 +00:00
Simon McVittie
7c6fe21daf tests: Add additional debug in wait_for_orientation()
Signed-off-by: Simon McVittie <smcv@debian.org>
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2049>
2021-10-22 07:43:19 +00:00
Simon McVittie
838d5656c3 tests: Make it easier to keep track of where we are
The monitor orientation tests do a lot of things in sequence. Replace
some of the comments with g_test_message() so that the log from a failed
test gives us a better idea of how far we got.

Signed-off-by: Simon McVittie <smcv@debian.org>
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2049>
2021-10-22 07:43:19 +00:00
Simon McVittie
27ce84962a tests: Change how we wait for an orientation change
Previously, we were waiting up to 300ms for the signal, then proceeding
anyway. However, 300ms is not necessarily long enough to wait on an
autobuilder that might be heavily loaded, particularly if it's a non-x86
with different performance characteristics.

Conversely, if mutter responds to the D-Bus signal from the mock sensor
before we have connected to the signal, then we cannot expect to receive
the signal - it was already emitted, but we missed it. In this case, we
need to avoid waiting.

One remaining use of wait_for_orientation_changes() that would previously
always have timed out was in
meta_test_orientation_manager_has_accelerometer(), which does not
actually expect to see an orientation-changed signal. Make this wait
for the accelerometer to be detected instead.

Resolves: https://gitlab.gnome.org/GNOME/mutter/-/issues/1967
Bug-Debian: https://bugs.debian.org/995929
Signed-off-by: Simon McVittie <smcv@debian.org>
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2049>
2021-10-22 07:43:19 +00:00
Jonas Ådahl
ac907119ae wayland: Only init EGLStream controller if we didn't end up with gbm
When we use gbm together with the NVIDIA driver, we want the EGL/Vulkan
clients to do the same, instead of using the EGLStream paths. To achieve
that, make sure to only initialize the EGLStream controller when we
didn't end up using gbm as the renderer backend.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2052>
2021-10-20 13:08:06 +00:00
Carlos Garnacho
3b6f9111c7 clutter: Only reset preedit text if set
On ClutterInputFocus::reset, avoid to unset the preedit text if
none was set earlier. This seems to trick GTK clients into focusing
the cursor position again, even when we are moving away from it.

Fixes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/4647
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2059>
2021-10-19 17:52:54 +00:00