1
0
Fork 0
Commit graph

11 commits

Author SHA1 Message Date
Carlos Garnacho
ba937ffbb3 backends/input-mapper: Implement score mechanism to assign the most relevant output
We used to pick the "best" output for each builtin/size/edid categories,
and then pick the "best" (in that order) of those for each input device.
This is most often enough, but is prone to wrong results in some corner
cases (eg. 2 outputs with the exact same dimensions).

Change this to a score mechanism that doesn't leave outputs out. The
weights are the same, but the score is accumulated if an output matches
multiple categories. All outputs are evaluated and sorted by score, and
input devices with the best matches are applied first (as they already
did).

This should break the tie if eg. there's 2 outputs with similar dimensions,
but one of them has some EDID match in addition. The output with multiple
matches will score higher up, while it might have been entirely discarded
with the previous implementation.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/1175

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1202
2020-09-04 22:12:02 +00:00
Carlos Garnacho
8699482475 backends: Check both input settings and mapper for tablet monitors
The upper layers (OSDs basically) want to know the monitor that a
tablet is currently assigned to, not the monitor just as configured
through settings.

This broke proper OSD positioning for display-attached tablets since
commit 87858a4e01, as the MetaInputMapper kicks in precisely when
there is no configured monitor for the given device.

Consulting both about the assigned output will make OSDs pop up
again in the right place.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/971
2020-03-25 19:09:32 +00:00
Carlos Garnacho
4413b86a30 backends: Replace ClutterDeviceManager usage in favor of ClutterSeat
https://gitlab.gnome.org/GNOME/mutter/merge_requests/852
2020-01-30 18:11:23 +01:00
Florian Müllner
033ce2d956 input-mapper: Remove unnecessary return value
Since commit ae6d9e35bd, there is a fallback to META_MATCH_IS_BUILTIN,
so the condition for returning FALSE is never met.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/598
2019-05-28 14:34:32 +00:00
Carlos Garnacho
ae6d9e35bd backends: Fallback to builtin panel for devices where all heuristics fail
This is 1) relatively likely as not all touchscreens are nice enough to
report a device size that will help us here and 2) Better than nothing if
everything fails anyway, as it will break on multi-monitor and non-default
monitor rotations.

Closes: https://gitlab.gnome.org/GNOME/mutter/issues/581
2019-05-03 15:01:47 +00:00
Carlos Garnacho
9843e21fff backends: Use udev to determine absolute input devices' size
Use the ID_INPUT_WIDTH_MM/ID_INPUT_HEIGHT_MM udev properties to figure out
absolute input devices' physical size. This works across both backends, and
requires less moving pieces to have it get the right results.

Concretely, fixes size detection on X11/libinput, which makes touchscreen
mapping go wrong.

https://gitlab.gnome.org/GNOME/mutter/issues/514
2019-03-25 14:08:40 +01:00
Niels De Graef
1c6ea5d1db Use a consistent style for enum braces
https://gitlab.gnome.org/GNOME/mutter/merge_requests/361
2019-02-28 09:31:01 +01:00
Marco Trevisan (Treviño)
54fdd633fe input-mapper: Use g_auto to free a string array
https://gitlab.gnome.org/GNOME/mutter/merge_requests/435
2019-02-11 15:42:16 +01:00
Marco Trevisan (Treviño)
29ed84e921 input-mapper: Don't loop infinitely in EDID matching
Iterate over all the monitor product words to check for a partial matching on
EDID, otherwise we would hang inside an infinite while loop.

Fixes https://gitlab.gnome.org/GNOME/mutter/issues/459
2019-02-11 15:42:16 +01:00
Carlos Garnacho
faf89ff35f backends: Add MetaInputMapper method to lookup devices from outputs
So we may know the device of a certain ClutterInputDeviceType that is
mapped to the given output.
2018-12-06 14:44:46 +00:00
Carlos Garnacho
08a5e660d3 backends: Add MetaInputMapper
This object takes care of mapping absolute devices to monitors,
to do so it uses 3 heuristics, in this order of preference:
- If a device is known to be builtin, it's assigned to the
  builtin monitor.
- If input device and monitor match sizes (with an error margin
  of 5%)
- If input device name and monitor vendor/product in EDID match
  somehow (from "full", through "partial", to just "vendor")

The most favorable outputs are then assigned to each device, making
sure not to assign two devices of the same kind to the same output.

This object replaces (and is mostly 1:1 with) GsdDeviceMapper in
g-s-d. That object would perform these same heuristics, and let
mutter indirectly know through settings changes. This object allows
doing the same in-process.
2018-12-06 14:44:46 +00:00