Commit Graph

26325 Commits

Author SHA1 Message Date
Carlos Garnacho
abd858fb69 backends/native: Move MetaInputSettings ownership to MetaSeatImpl
Together with keymaps and devices, MetaInputSettings will live in the
ninth circle of hell with MetaSeatImpl, forever tied to it.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:40:10 +02:00
Carlos Garnacho
09e02a772e backends/native: Do not dispatch libinput during MetaSeatImpl construction
This saves us from some egg/chicken problems, since we mean to use the
MetaInputSettings while it (thus far) is created at a later stage.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:40:10 +02:00
Carlos Garnacho
c850aa9733 backends: Do not use clutter_seat_list_devices() in MetaInputSettings
Make it keep its own list of devices, it's not that far off.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:40:10 +02:00
Carlos Garnacho
5a1c7e4a54 backends: Make device tracking at MetaInputSettings ad-hoc API
Depending on the backend, we want to integrate this object at different
levels. It will sit close to the MetaBackendX11/MetaSeatX11 in X11, but
it will be put deep down with MetaSeatImpl in the native backend, in a
separate thread.

Since we can't depend on a single object type, nor are able to track
ClutterSeat signals neatly, make this API something to be called
explicitly by backends.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:40:10 +02:00
Carlos Garnacho
e324f0fad0 backends: Simplify function arguments
We just pass a device in order to check it with the seat pointer, we
can do without this.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:40:10 +02:00
Carlos Garnacho
5978531963 backends/native: Proxy modifier state changes via MetaSeatImpl
This changes within the MetaSeatImpl realm, so use a signal to forward
this to the MetaSeatNative/MetaKeymapNative one.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:40:10 +02:00
Carlos Garnacho
bc111bf958 backends/native: Proxy bell notifications from within the MetaSeatImpl
As with other changes from within the MetaSeatImpl realm, proxy that
through a MetaSeatImpl signal, instead of poking directly on the ClutterSeat.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:40:10 +02:00
Carlos Garnacho
074d78bd9b backends/native: Proxy touch-mode via MetaSeatImpl
Handle this via a MetaSeatImpl signal, as the heuristics that apply
here are based on libinput events. The MetaSeatNative just forwards
the touch-mode changes now.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:40:10 +02:00
Carlos Garnacho
2e604709df backends/native: Forward keyboard a11y changes via the MetaSeatImpl
These changes will happen in the input event management code, so let them
be emitted via the MetaSeatImpl, as that's what we'll have neat access to.
The ClutterSeat signals are now emitted from there.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:40:10 +02:00
Carlos Garnacho
6c265c131f clutter: Don't keep extra copy on device events
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:40:10 +02:00
Carlos Garnacho
06adde5c6b backends/native: Spin MetaSeatImpl off MetaSeatNative
Move most of the functional bits (those meant to run on a standalone
thread) to a MetaSeatImpl object. This object is managed by the MetaSeatImpl
and not exposed outside the friend MetaSeatNative/MetaInputDeviceNative/
MetaInputSettings classes.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:40:10 +02:00
Carlos Garnacho
a2616d83e8 clutter: Make ClutterSeat::handle_device_event vfunc more generic
Make it able to handle not just device added/removed events, but perform
any kind of post-processing that needed to be done on ClutterEvents at
the seat level.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:40:10 +02:00
Carlos Garnacho
92bc79fd51 backends/native: Remove unused function
This meta_seat_native_get_device() function has been unused for some time.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:13:38 +02:00
Carlos Garnacho
ef67fab737 backends: Move keyboard a11y into backends
And out of Clutter API. This is mainly set via settings, or the windowing
itself, so we don't need to leak these details up our own backend.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:13:34 +02:00
Carlos Garnacho
9acb7f0eed backends: Make MetaInputMapper take over MetaInputSettings public API
Banish MetaInputSettings from MetaBackend "public" API, it's now meant to
spend the rest of its days in the backend dungeons, maybe hanging
off a thread.

MetaInputMapper replaces all external uses.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:13:30 +02:00
Carlos Garnacho
c678cdab5a backends: Move all output management to MetaInputMapper
Delegate on the MetaInputMapper all matching of inputs and outputs,
including configuration. Other secondary aspects, like output
aspect ratio for tablet letterbox mode, or toggling attached devices
with power saving changes, are also moved here.

This makes MetaInputSettings independent of MetaMonitorManager,
all interaction with it happens indirectly via public API entrypoints.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:13:25 +02:00
Carlos Garnacho
91f6b3b5bc backends: Simplify MetaInputSettings vfunc
Rename the set_tablet_keep_aspect() vfunc into a set_tablet_aspect_ratio()
one that takes an aspect ratio double, instead of leaking monitor info
into subclasses to let them all figure out this number themselves.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:13:19 +02:00
Carlos Garnacho
696915a951 backends/native: Drop meta_seat_native_[gs]et_stage()
This is now unused.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:13:15 +02:00
Carlos Garnacho
2e07c55241 backends: Assign stage to events in MetaBackend
Don't do this in the MetaSeatNative, this should be detached from
the stage.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:13:11 +02:00
Carlos Garnacho
0f0848191e backends/native: Drop early processing of ClutterEvents
We have 2 sources (this one in MetaSeatNative, and the one in
MetaBackend) dispatching ClutterEvents to the stage. Make the
MetaSeatNative one exclusively about dispatching the libinput
queue, and leave ClutterEvents to the other.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:13:04 +02:00
Carlos Garnacho
4b0d3f44e1 backends/native: Use viewport info to find out stage extents
This information is equivalent to the stage extents, this just
leaves meta_seat_native_get_stage() used for setting event->any.stage,
which is a tiny lame excuse.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:12:59 +02:00
Carlos Garnacho
4f794d3acb backends: Add method to get extents from viewport info
This way we know the stage extents without poking the stage.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:12:55 +02:00
Carlos Garnacho
3252ef5dd7 backends: Use also a native cursor renderer for tablets
This will resort to SW rendering if this cursor renderer does not
own the MetaKmsCursorRenderer, so it's pretty much equivalent thus
far, except we may now implement logic to flip the kms cursor renderer
around.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:12:51 +02:00
Carlos Garnacho
0c9bbbe90e backends: Use MetaViewportInfo to keep MetaSeatNative informed of layout
Use this for the calculations to keep absolute motion properly constrained,
and relative motion properly scaled.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:12:44 +02:00
Carlos Garnacho
bb62d9e4b0 backends: Add simple object to delegate logical monitor layout queries
This object can be passed to random places, and be trusted to remain unchanged
till replaced. Makes it an ideal replacement for MetaMonitorManager across
threads.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:12:40 +02:00
Carlos Garnacho
579220a762 clutter: Drop ClutterInputDevice::enabled and setter/getter
This is unused now, and not something we generally allow.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:12:37 +02:00
Carlos Garnacho
575a4ca281 backends: Move away from clutter_input_device_set_enabled()
We actually have a set_send_events() vfunc that can enable or disable
devices at the libinput and X11 input driver level, so use that. A
positive side effect is that those layers will leave the device at
a consistent idle state (as opposed to going mute maybe amid user
input).

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:12:31 +02:00
Carlos Garnacho
4b7f2905d6 backends: Split pad action mapping to a separate object
This now lives in the core, and will get updated from events in the
UI thread.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:12:26 +02:00
Carlos Garnacho
c7758046eb backends: Drop unused function
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:12:22 +02:00
Carlos Garnacho
e64112de64 backends: Split kms cursor renderer from MetaCursorRendererNative
Move the KMS updating pieces to a distinct MetaKmsCursorRenderer whose
cursor sprite will get updated from the driving MetaCursorRenderer.
Since there could be multiple MetaCursorRenderers, also add the
necessary pieces to move the KMS cursor renderer between renderers.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:12:19 +02:00
Carlos Garnacho
05f385c8ee backends: Move HW cursor inhibitors to MetaBackend
We are aiming for a split of HW and SW cursor rendering management.
Given the HW plane is a limited resource and the amount of cursor
renderers may be >1 (due to tablets, even though we currently use an
always-software cursor renderer there), it would ideally be able to
switch between renderers.

Being MetaCursorRenderer not really a singleton, having cursor
inhibitor accounting here doesn't pan out. Make it MetaBackend API
so all cursor renderers get the same picture.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:12:14 +02:00
Carlos Garnacho
8a2b529ca3 backends: Make MetaHwCursorInhibitor less about sprites
Remove the sprite argument from the vfunc, it's used in no implementations
and conceptually gets a bit in the middle.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:12:11 +02:00
Carlos Garnacho
0c92417178 core: Centralize cursor renderer and tracker updates
These use now more of a "pull" model, where they receive update
notifications and the relevant input position is queried, instead
of the coordinates being passed along.

This allows to treat cursor renderers all the same independently
of the device they track. This notifying of position changes should
ideally be more backend-y than core-y, a better location will be
figured out in future commits.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:11:48 +02:00
Carlos Garnacho
543d232b51 backends: Drop meta_cursor_renderer_get_position()
This is now unused.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:11:45 +02:00
Carlos Garnacho
4398d63566 wayland: Move away from meta_cursor_renderer_get_position()
Fetch the cursor renderer device, and query its position instead.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:11:42 +02:00
Carlos Garnacho
dc022a67b0 backends: Add ::device property to MetaCursorRenderer
A cursor renderer is made to invariably follow a pointer device, make
it a construct-time property, and update all creators of cursor renderers
to specify it.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:11:38 +02:00
Carlos Garnacho
60fa895ae3 backends: Move away from meta_cursor_renderer_get_position()
We are moving onto relying fully on the seat cursor position. As
this focuses (thus far?) on mouse pointers only, use the cursor
tracker as a convenient shortcut.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:11:35 +02:00
Carlos Garnacho
7bb3fe25aa backends: Use graphene_point_t on meta_cursor_tracker_get_pointer()
It's nicer to propagate along.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:11:31 +02:00
Carlos Garnacho
6c5bba94fd backends: Manage tablet cursors in backend
Instead of letting the wayland bits maintain an always-software
cursor renderer, let the cursor renderer be managed by the backend,
and only hook to it (as we do for pointer cursor) in the wayland
bits.

ATM, make the cursor renderer still always-software, although
ideally we should allow moving the HW cursor management between
renderers.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:11:18 +02:00
Carlos Garnacho
667b2726f5 wayland: Look up cursor renderer for device on MetaWaylandPointer
Make it explicitly look up the pointer device, instead of implicitly
relying on it.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:11:15 +02:00
Carlos Garnacho
1d3588ba48 backends: Add meta_backend_get_cursor_renderer_for_device()
Different devices may get standalone cursor renderers, add this API
to adapt slowly to this. The meta_backend_get_cursor_renderer() call
still exists, but shortcuts to the mouse pointer's renderer (as it
actually did before).

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:11:11 +02:00
Carlos Garnacho
16317cec12 wayland: Replace cursor renderer usage with cursor tracker
We just want to know the pointer position, let's use something else
here.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:11:08 +02:00
Carlos Garnacho
f3991c0164 backends: Add argument for best scale on MetaCursorSprite::prepare-at
Instead of letting implementations poke backend internals from various
places, give that information right away.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:11:05 +02:00
Carlos Garnacho
b07d9c5f92 core: Do not force cursor renderer update here
This is already taken care of in meta_backend_monitors_changed(), called
from the same code paths that emit ::monitors-changed-internal. It is
better to leave this up to backend internals.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:11:02 +02:00
Carlos Garnacho
be51a8c18c backends: Remove x/y arguments from MetaCursorTracker::cursor-moved
Make this signal a hint, the actual coordinates should be queried to the
cursor tracker, the device, the seat... There's enough options.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:10:58 +02:00
Carlos Garnacho
11c86f9cb3 core: Remove unused struct field
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:10:55 +02:00
Carlos Garnacho
87c0821a30 backends: Drop unused function
meta_cursor_tracker_get_displayed_cursor() is used nowhere.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:10:52 +02:00
Carlos Garnacho
03f2bade19 backends: Delegate pointer confinements to an impl object
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:10:49 +02:00
Carlos Garnacho
a3825f2085 backends: Fix typo in comment
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:10:46 +02:00
Carlos Garnacho
8b2a89041a backends: Drop GDK device querying code from MetaCursorTracker
Clutter behavior is now equivalent to GDK's on X11, avoid poking to
GDK here.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:10:42 +02:00