1
0
Fork 0
Commit graph

1811 commits

Author SHA1 Message Date
Carlos Garnacho
a8e2935225 backends: Drop meta_cursor_renderer_get_position()
This is now unused.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403>
2020-11-27 15:14:33 +00:00
Carlos Garnacho
3ade57e4e9 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.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403>
2020-11-27 15:14:33 +00:00
Carlos Garnacho
247613d26d 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.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403>
2020-11-27 15:14:33 +00:00
Carlos Garnacho
cd02286b87 backends/native: 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.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403>
2020-11-27 15:14:33 +00:00
Carlos Garnacho
35abb8ab53 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).

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403>
2020-11-27 15:14:33 +00:00
Carlos Garnacho
e721fde259 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.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403>
2020-11-27 15:14:33 +00:00
Carlos Garnacho
7a2a2445c3 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.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403>
2020-11-27 15:14:33 +00:00
Carlos Garnacho
8a8d47725c backends: Delegate pointer confinements to an impl object
Split pointer confinements in 2 objects, one set from the upper layers
containing its definition, and another managed by the backend that
applies it.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403>
2020-11-27 15:14:33 +00:00
Carlos Garnacho
efd065259d backends: Drop GDK device querying code from MetaCursorTracker
Clutter behavior is now equivalent to GDK's on X11, avoid poking to
GDK here.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403>
2020-11-27 15:14:33 +00:00
Carlos Garnacho
932a5cab09 clutter: Drop clutter_input_device_set_state()
Nothing uses it anymore.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403>
2020-11-27 15:14:33 +00:00
Carlos Garnacho
7d78768809 backends/native: Move away from ClutterInputDevice coords
Use a new set in MetaInputDeviceNative, this coexists with
ClutterInputDevice coords for the time being. This API will
eventually be only accessed from the input thread.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403>
2020-11-27 15:14:33 +00:00
Carlos Garnacho
9d195b3fa4 backends/native: Implement ClutterSeat::query_state() vmethod
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403>
2020-11-27 15:14:33 +00:00
Carlos Garnacho
384b97792d backends/x11: Implement ClutterSeat::query_state() vmethod
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403>
2020-11-27 15:14:33 +00:00
Jonas Ådahl
f6db6cd203 monitor-config-manager: Handle multiple builtin panels gracefully
While multiple built-in panels isn't actually supported in any
meaningful manner, if we would ever end up with such a situation, e.g.
due to kernel bugs[0], we shouldn't crash when trying to set an
'external only' without any external monitors.

While we could handle this with more degraded functionality (e.g. don't
support the 'switch' method of monitor configuration at all), handle it
by simply not trying to switch to external-only when there are no,
according to the kernel, external monitors available. This would e.g.
still allow betwene 'mirror-all', and 'linear' switches.

The crash itself was disguised as an arbitrary X11 BadValue error, due
to mutter trying to resize the root window to 0x0, as the monitor
configuration that was applied consisted of zero logical monitors, thus
was effectively empty.

[0] https://bugzilla.redhat.com/show_bug.cgi?id=1896904

Related: https://bugzilla.redhat.com/show_bug.cgi?id=1899260
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1607>
2020-11-27 09:11:43 +01:00
Simon McVittie
60f647df8e backends/native: Don't crash if keymap is misconfigured
xkb recently gained support for user-specified keymaps, which means we
can no longer assume that the configuration data is necessarily fully
complete or correct; and the configuration language is quite a labyrinth,
so it's easy to get wrong. If setting the keymap fails, leave it in
whatever state it previously had, since that seems preferable to crashing
with a NULL pointer dereference.

Resolves: https://gitlab.gnome.org/GNOME/mutter/-/issues/1555
Signed-off-by: Simon McVittie <smcv@debian.org>
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1605>
2020-11-26 12:11:33 +00:00
Florian Zwoch
efb577efb0 screen-cast: Fix segfault when drawing cursor
Add a sanity check if the cursor is on screen and cursor texture data
is available. This prevents a potential segfault when trying to access
non-existing texture data.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/1446
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1604>
2020-11-26 09:59:44 +01:00
Carlos Garnacho
23ae8b4519 clutter: Drop clutter_input_device_get_device_id()
Move the GObject property to MetaInputDeviceX11, and throw away the
rest. This is no longer public API.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1569>
2020-11-18 19:10:48 +00:00
Carlos Garnacho
20e6464087 backends/native: Don't fake device IDs
Stop making them up, they go nowhere.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1569>
2020-11-18 19:10:48 +00:00
Carlos Garnacho
7738ce2a64 backends/x11: Move to backend-specific meta_input_device_x11_get_device_id()
Make this info part of the MetaInputDeviceX11, as it's actually just
relevant to that backend.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1569>
2020-11-18 19:10:48 +00:00
Jonas Ådahl
d622960429 renderer/native: Add udev rule to select primary GPU
Sometimes the automatically selected primary GPU isn't suitable with no
way to make an well educated guess to do it better. To make it possible
for the user to override the automatically calculated default, make it
possible to override it using a udev rule.

E.g. to select /dev/dri/card1 as the primary GPU, add a file e.g.
/usr/lib/udev/rules.d/61-mutter-primary-gpu.rules (path my vary
depending on distribution) containing the fellowing line:

ENV{DEVNAME}=="/dev/dri/card1", TAG+="mutter-device-preferred-primary"

Reboot or manual triggering of udev rules to make it take effect may be
required.

Related: https://gitlab.gnome.org/GNOME/mutter/merge_requests/1057

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1562

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1562>
2020-11-16 16:00:33 +00:00
Jonas Ådahl
83360a4aed cursor-sprite/xcursor: Fall back to gray square if missing theme
Instead of aborting with an error, display a half transparent gray
square instead of cursors and log a warning in the journal, allowing the
user to fix their system withotu having to rely on switching to a TTY.

It will be immediately obvious the cursor is silly looking, which will
be a better hint than just aborting.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/1428
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1563>
2020-11-16 13:49:05 +00:00
Carlos Garnacho
b6211bb684 backends/x11: Emit CLUTTER_DEVICE_ADDED events for initial devices
This is similar to commit b9e5a2d6e2, but for the X11 backend.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1553
2020-11-07 10:13:00 +01:00
Jonas Ådahl
4ecc80fd80 x11/output: Fix init tile info guard
Monitor tile info is possible to fetch when RANDR version 15 is exposed
by the X11 server. We had inverted the check meaning that only if older
versions were advertised would we attempt to init the tile information.
Fix this guard, thus fix monitor tiling on X11.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/1524
2020-11-05 08:49:29 +01:00
Olivier Fourdan
9b88172982 backend: Update cursor visibility on device added
Not calling libinput dispatch in the backend constructor defeats the
logic in post init as the device added events have not been processed
yet.

So instead of trying to guess the cursor initial visibility, simply
update it along when devices get added.

Additional benefit, we do not need to walk the all device list looking
for touchscreens anymore, we just need to check the device being added
since the current logic is to hide the cursor as soon as a touchscreen
is found.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1534
2020-10-30 15:50:23 +01:00
Olivier Fourdan
c618b8a0eb clutter/backend: Don't dispatch libinput events too early
At startup, libinput dispatch is called from the MetaSeatNative
constructed callback.

That means that we may get libinput events even before the default seat
is set.

In turn, processing those events may trigger the use the default seat
while it's still not set yet, and cause a crash of gnome-shell/mutter
at startup.

A simple reproducer for this is to start gnome-shell/mutter with a
tablet connected and the stylus in proximity, the proximity event will
cause gnome-shell/mutter to crash at startup.

To avoid that issue, avoid dispatching libinput events early from the
MetaSeatNative constructed callback, those events will eventually get
processed when the seat and the backend are all setup.

https://gitlab.gnome.org/GNOME/mutter/-/issues/1501
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1534
2020-10-30 15:50:23 +01:00
Daniel van Vugt
514b2ff424 cursor-tracker: Get the GDK (X11) pointer position in floats, not ints
This makes X11 consistent with Wayland which already uses floats.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1519
2020-10-28 15:40:56 +00:00
Daniel van Vugt
aff14eab86 cursor-tracker: Check for NULL coordinates before retrieving them
This makes Wayland consistent with X11 in not emitting warnings when
unwanted parameters are NULL.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1519
2020-10-28 15:40:56 +00:00
Daniel van Vugt
ebe8cd3704 cursor-tracker: Check if coordinates are NULL
To avoid a SEGV on X11. Passing NULL coordinates is perfectly valid if
you are only seeking to get the `mods`.

Fixes: https://gitlab.gnome.org/GNOME/mutter/-/issues/1484

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1519
2020-10-28 15:40:56 +00:00
Georges Basile Stavracas Neto
a77e1f200b drm-buffer-gbm: Clear framebuffer with g_clear_object
Another fallout of eb14da3874

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1531
2020-10-27 14:32:45 +00:00
Olivier Fourdan
8711d8d591 backend: Keep a refcount on backend's current_device
Otherwise we might run into a use-after-free and crash on (virtual)
device removal:

 Invalid read of size 8
   at clutter_input_device_get_device_type (clutter-input-device.c:811)
   by update_last_device (meta-backend.c:1282)
   by g_main_dispatch (gmain.c:3325)
   by g_main_context_dispatch (gmain.c:4016)
   by g_main_context_iterate.constprop.0 (gmain.c:4092)
   by g_main_loop_run (gmain.c:4290)
   by meta_run_main_loop (main.c:708)
   by meta_run (main.c:723)
   by main (main.c:550)
 Address is 32 bytes inside a block of size 504 free'd
   at free (vg_replace_malloc.c:538)
   by g_type_free_instance (gtype.c:1939)
   by clutter_event_free (clutter-event.c:1420)
   by _clutter_stage_process_queued_events (clutter-stage.c:830)
   by handle_frame_clock_before_frame (clutter-stage-view.c:1064)
   by clutter_frame_clock_dispatch (clutter-frame-clock.c:405)
   by frame_clock_source_dispatch (clutter-frame-clock.c:456)
   by g_main_dispatch (gmain.c:3325)
   by g_main_context_dispatch (gmain.c:4016)
   by g_main_context_iterate.constprop.0 (gmain.c:4092)
   by g_main_loop_run (gmain.c:4290)
   by meta_run_main_loop (main.c:708)
   by meta_run (main.c:723)
 Block was alloc'd at
   at malloc (vg_replace_malloc.c:307)
   by g_malloc (gmem.c:106)
   by g_slice_alloc (gslice.c:1025)
   by g_slice_alloc0 (gslice.c:1051)
   by g_type_create_instance (gtype.c:1839)
   by g_object_new_internal (gobject.c:1939)
   by g_object_new_valist (gobject.c:2264)
   by g_object_new (gobject.c:1782)
   by meta_input_device_native_new_virtual (meta-input-device-native.c:1365)
   by meta_virtual_input_device_native_constructed (meta-virtual-input-device-native.c:705)
   by g_object_new_internal (gobject.c:1979)
   by g_object_new_valist (gobject.c:2264)

Suggested-by: Carlos Garnacho <carlosg@gnome.org>
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1529
2020-10-26 18:19:31 +00:00
Carlos Garnacho
6e49ad436d clutter: Drop clutter_input_device_set_stage()
Also drop the stage argument from clutter_input_device_set_coords()
in consequence. No one uses this already.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1486
2020-10-23 18:48:19 +00:00
Carlos Garnacho
ce2b3728a2 backends/x11: Drop users of clutter_input_device_set_stage()
There is no getter, so this information is useless.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1486
2020-10-23 18:48:19 +00:00
Carlos Garnacho
942b3c63df backends/native: Drop users of clutter_input_device_set_stage()
There is no getter, so doing this is now pointless.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1486
2020-10-23 18:48:19 +00:00
Carlos Garnacho
e3644acbbf backends/x11: Drop all users of clutter_input_device_get_stage()
And clutter_input_device_get_pointer_stage().

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1486
2020-10-23 18:48:19 +00:00
Carlos Garnacho
9598eedd04 backends/native: Drop all uses of clutter_input_device_get_stage()
Rely on the seat stage, or other ways to fetch it. Also rely that
there is actually a single stage, so that we assign the right stage
to all events going out of the seat, in a single place.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1486
2020-10-23 18:48:19 +00:00
Carlos Garnacho
3c8376ad91 backends/native: Move relative motion filter to MetaSeatNative altogether
And drop the relative motion filter API. The seat will handle relative motion
across outputs with different scales. This accesses the MetaMonitorManager
ATM.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1486
2020-10-23 18:48:18 +00:00
Carlos Garnacho
90df3c6fa3 backends/native: Make seat constrain pointer to monitors out of the box
It does access the MetaMonitorManager directly ATM.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1486
2020-10-23 18:48:18 +00:00
Carlos Garnacho
27ef073432 backend/native: Move barrier manager to MetaSeatNative
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1486
2020-10-23 18:48:18 +00:00
Carlos Garnacho
6cb1557d99 backends: Move absolute/relative device mapping to native backend
This is a bit scattered around, with the setter/getter in Clutter, and
it only being only directly honored in Wayland (it goes straight through
device properties in X11).

Make this private native API, and out of public ClutterInputDevice API.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1486
2020-10-23 18:48:18 +00:00
Carlos Garnacho
82c6c3f303 backends: Move device mapping check into backend
Make the upper parts agnostic about the device being relative in
order to apply the display mapping. Just make the low level bits
resort to the identity matrix for those.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1486
2020-10-23 18:48:18 +00:00
Carlos Garnacho
c4d11f7550 backends: Fold device mapping check into backend
Make the upper part agnostic about the device being relative in order
to avoid applying keep-aspect. The X11 bits already are, so make it
sure it's also the case for the native backend.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1486
2020-10-23 18:48:18 +00:00
Carlos Garnacho
e28007edb9 backends: Drop extra layer of touch info handling
We have a hashtable in the device that does not add much on top
to the seat handling. Make all the places rely on the seat accounting
instead.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1486
2020-10-23 18:48:18 +00:00
Carlos Garnacho
c9a405ff9e backends/native: Use libinput seat slot API
Instead of creating a seat-wide touch slot ID ourselves, rely on libinput
API doing this for us.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1486
2020-10-23 18:48:18 +00:00
Carlos Garnacho
439e9a5567 backends/native: Assign unique ranges of slots to virtual devices
We are moving to seat-wide touch slot accounting, so move these virtual
devices to using their own range each. The theoretical case of
overflow/rollover is also handled.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1486
2020-10-23 18:48:18 +00:00
Carlos Garnacho
bd4062a196 clutter: Limit number of touch slots available to a virtual touch device
It's not worth letting these devices have an "unlimited" range of touch
slots. Limiting it to 32 is more than enough to map it with real touch
devices nowadays.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1486
2020-10-23 18:48:18 +00:00
Carlos Garnacho
7698fc4aaf backends: Drop the filter for libinput events
This is now unused, and it's arguably any useful to stay.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1486
2020-10-23 18:48:18 +00:00
Carlos Garnacho
dd60fa2bc6 backends: Use slot from cancel events
As it does seem from a read to libinput code, TOUCH_CANCEL events
actually do contain slot information, and are emitted per-slot.
This means we can avoid iterating over the slots ourselves, they
are still expected to be sent altogether.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1486
2020-10-23 18:48:18 +00:00
Christian Rauch
7e0d80be39 backend/dummy: Do not enforce minimum screen size
https://gitlab.gnome.org/GNOME/mutter/-/issues/1481
2020-10-23 12:12:15 +01:00
Christian Rauch
4862e4cb39 backend/dummy: Warn about missing dummy mode specs
When malformed modes are provided and no valid mode spec is found, mutter
will eventually try to access the last element of an empty list. Warn about
this and exit properly.

https://gitlab.gnome.org/GNOME/mutter/-/issues/1481
2020-10-23 12:12:08 +01:00
Uday Kiran Pichika
9d0bac0754 output: Move edid parse function to the right file
Move the edid parsing function from MetaMonitorManager to MetaOutput
to read the monitor manufacturer,serial,vendor,etc.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1516/
2020-10-21 17:04:44 +05:30
Hans de Goede
ec18a559c6 monitor-manager: Ignore tablet-mode-switch on initial config of native portrait mode panels
Many tablets have a native portrait mode panel, yet come with a keyboard dock,
where the device gets docked in landscape mode. To avoid the display being
on its side when mutter starts while the tablet is docked, we need to take
the accelerometer reported orientation into account even if there is a
tablet-mode-switch which indicates that the device is NOT in tablet-mode
(because it is docked).

Add special handling for the first time the "orientation-changed"
signal gets signalled by the orientation-manager, which happens after it
has successfully claimed the accelerometer with iio-sensor-proxy.

The added special handling of the initial "orientation-changed" signal
does a number of checks:

1. panel_orientation_managed is false because of the tablet-mode-switch and not
   because of other reasons.

2. The device has a native portrait mode panel (and thus likely needs rotation
   to display the image the right way up when docked).

If all these checks succeed then it continues with creating a new
monitors-config based on the orientation ignoring the panel_orientation_managed
value (for the initial/first "orientation-changed" signal only).

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1506
2020-10-18 21:35:10 +00:00
Hans de Goede
1b13f50582 monitor-manager: Update orientation based config when panel_orientation_managed changes
The orientation reported by the orientation_manager may have changed while
panel_orientation_managed was false. So when panel_orientation_managed
changes to true we should re-check the orientation.

This fixes the orientation not being correct when e.g. taking a 360 degree
hinges 2-in-1 in clamshell mode (so landscape orientation) and then folding
it into tablet mode while holding it in portrait orientation.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1506
2020-10-18 21:35:09 +00:00
Hans de Goede
4c12208363 monitor-manager: Add a handle_orientation_change helper function
Move the bulk of orientation_changed to a new handle_orientation_change
helper function. This is a preparation patch for further orientation
handling related changes.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1506
2020-10-18 21:35:09 +00:00
Hans de Goede
21c714a0f2 seat-native: Add support for tablet-mode-switch being hot-unplugged
Add support for the (mostly theoretical) case of an input-device
offering tablet-mode-switch functionality being unplugged.

This makes the has_tablet_switch handling identical to the has_touchscreen
handling, leading to more consistent code.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1506
2020-10-18 21:35:09 +00:00
Hans de Goede
88cabf8039 seat-native: Check for tablet-switch devices from meta_seat_native_constructed
Detect if a tablet-mode-switch device is already present when mutter
starts by checking for this from meta_seat_native_constructed. This
mirrors how we also set has_touchscreen from meta_seat_native_constructed.

This fixes tablet-mode-switches only being recognized when they are added
at runtime.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1506
2020-10-18 21:35:09 +00:00
Hans de Goede
6c240dc83b seat-native: Fix has_touchscreen becoming FALSE when a non touchscreen device gets added
Unconditionally setting has_touchscreen to check_touch_mode
when a new device gets added leads to has_touchscreen becoming
false when during runtime e.g. an USB keyboard gets plugged in.

Fix this by setting has_touchscreen to TRUE when check_touch_mode
is TRUE and leaving it alone otherwise.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1506
2020-10-18 21:35:09 +00:00
Hans de Goede
b5d21f00f8 backend: Use new clutter_seat_has_touchscreen helper
Replace the meta-backend.c private check_has_physical_touchscreen
function with a call to the new clutter_seat_has_touchscreen helper.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1506
2020-10-18 21:35:08 +00:00
Robert Mader
b2f2050b95 renderer-native: Fix GObjectify oversight
This was forgotten in eb14da3874, triggering crashes.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1510
2020-10-18 11:25:27 +02:00
Jonas Ådahl
eb14da3874 cogl: Turn CoglFramebuffer, CoglOffscreen and CoglOnscreen into GObjects
A first step towards abandoning the CoglObject type system: convert
CoglFramebuffer, CoglOffscreen and CoglOnscreen into GObjects.
CoglFramebuffer is turned into an abstract GObject, while the two others
are currently final. The "winsys" and "platform" are still sprinkled
'void *' in the the non-abstract type instances however.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1496
2020-10-16 16:17:38 +00:00
Jonas Ådahl
aa99e505ad cogl/framebuffer: Move public struct fields to private struct
This will limit accidental manipulation of the framebuffer struct
fields, while also paving the way to change to GObject type hierarchy.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1496
2020-10-16 16:17:38 +00:00
Daniel van Vugt
df76d3deec renderer-native: Get the GBM buffer format from EGL to match the framebuffer
This eliminates two locations where the format was hardcoded.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1491
2020-10-15 07:45:06 +00:00
Daniel van Vugt
df65f05e27 cogl: Remove unused swap-related COGL_FEATURE_ID_ flags
What we actually use is `COGL_WINSYS_FEATURE_SWAP_BUFFERS_EVENT`, which
is also set in the same locations.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1297
2020-10-14 16:27:23 +00:00
Peter Hutterer
e078a007d6 backends: add support for scroll button locking
Where enabled, the first click of the scroll button sets the button logically
down, the second click sets the button logically up.

This is an accessibility feature, it doesn't require users to keep holding the
button down while scrolling which is hard or impossible for some users.

gsettings-desktop-schemas merge request:
https://gitlab.gnome.org/GNOME/gsettings-desktop-schemas/-/merge_requests/39

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1432
2020-10-14 16:02:29 +00:00
Jonas Ådahl
2c95e08998 Remove misplaced line break in g_* logging functions
They resulted in empty lines in the log.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1466
2020-10-08 16:38:41 +02:00
Jonas Ådahl
313e3e771c Make meta_* logging utilities not require line break
Unlike g_* logging utilities, the meta_* counterparts behave like odd
printf() functions. Lets change that so they fit better into how logging
is done everywhere else.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1466
2020-10-08 16:38:41 +02:00
Carlos Garnacho
bbc4116f10 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/1475
2020-10-06 21:33:10 +02:00
Carlos Garnacho
e0944b6097 backend: Don't pull generated headers (indirectly)
Use a typedef for MetaRemoteDesktop, so tests poking MetaBackend don't
indirectly depend upon generated headers. This is arguably a code fix
for a build system bug.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1470

Fixes: https://gitlab.gnome.org/GNOME/mutter/-/issues/1449
(or something...)
2020-10-06 16:16:21 +00:00
Olivier Fourdan
6db7d8f830 backend: Add a backend release function
Mutter still relies heavily on singletons such as its MetaBackend.

For that, the backend implementation has a meta_init_backend() function
which is called at startup from meta_init(), which creates the desired
backend and sets the singleton which is returned by meta_get_backend().

Unfortunately, that means that the backend is never actually freed, and
all the code from the backend finalize function never actually get
called.

Add a meta_release_backend() to free the backend singleton.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1438
2020-10-06 15:45:42 +00:00
Olivier Fourdan
c956193d09 input-settings: Disconnect device signals on dispose
The input settings constructor installs callback functions on device
added/remove and tool-changed.

However, on dispose, those signals are not disconnected, meaning that on
teardown, once the devices get removed eventually, the callback will
still fire and call the callback with freed data, causing a crash.

Make sure we clear the signals on devices on dispose, to avoid the crash
on teardown.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1438
2020-10-06 15:45:42 +00:00
Georges Basile Stavracas Neto
f6998f87c2 src: Use graphene APIs
This commit encompasses the trivial ones.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1439
2020-10-06 15:34:48 +00:00
Georges Basile Stavracas Neto
f676861054 renderer-view: Use graphene APIs
Yet another case of swapping operations order upside down.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1439
2020-10-06 15:34:48 +00:00
Georges Basile Stavracas Neto
3e0c961b76 Replace the CoglMatrix type by graphene_matrix_t
CoglMatrix already is a typedef to graphene_matrix_t. This commit
simply drops the CoglMatrix type, and align parameters. There is
no functional change here, it's simply a find-and-replace commit.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1439
2020-10-06 15:34:47 +00:00
Carlos Garnacho
b9e5a2d6e2 backends/native: Wait to have an stage before emitting CLUTTER_DEVICE_ADDED
During seat initialization, we process early libinput events (adding all known
devices) before the seat gets a stage assigned. This causes warnings when trying
to handle the corresponding CLUTTER_DEVICE_ADDED events, as they are sent
stageless.

As it is definitely too soon to have those events sent meaningfully, filter
those events out and instead handle the CLUTTER_DEVICE_ADDED emission for all
known devices after the seat receives an stage. This makes the events guaranteed
to be emitted early in initialization, but not so soon that they can't be
handled yet.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1472
2020-10-06 13:29:59 +00:00
Carlos Garnacho
089be8b71d backends: Ensure to clear the last updated device on device removal
If the last updated device is removed, ensure that it does result in
a ::last-device-changed with a NULL device.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1460
2020-09-30 18:26:20 +00:00
Carlos Garnacho
16139efa5c backends: Do not use stack-allocated ClutterEvents
Use ClutterEvent* and clutter_event_new() to always allocate events.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1460
2020-09-30 18:26:20 +00:00
Jonas Ådahl
df228e8945 screen-cast/area-src: Clear framebuffer before painting stage
We'll be painting to a framebuffer that may not be completely covered by
the painted areas, meaning the not painted areas would end up undefined,
thus potentially contain garbage or old content.

Avoid this by clearing the framebuffer before painting the stage.

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

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1459
2020-09-30 15:56:07 +00:00
Carlos Garnacho
3a273028ae backends/x11: Set stage on logical keyboard device
Like it's done for the pointer in other places. Without a stage assigned,
some bits (like IM handling) may end up with events ignored, and misbehave.

Fixes: https://gitlab.gnome.org/GNOME/mutter/-/issues/1413
2020-09-29 21:26:26 +00:00
Karol Herbst
9b9b912765 backends: force enable modifiers on tagged devices
Some devices can't scanout to linear buffers directly as the hw is not
capable of eg rendering into a linear depth buffer.

Add code to force kms-modifiers on udev taged devices.

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

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1443
2020-09-28 14:00:44 +02:00
Ray Strode
1e78d90a37 barriers: Free backend implementation at dispose time
When a MetaBarrier is first created it allocates a backend
impl object which does the actual heavy lifting.

Unfortunately, that backend object is never freed.

This commit ensures the implementation gets freed when
the barrier object is freed.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1451
2020-09-27 00:38:58 -04:00
Ray Strode
97f10a0d21 barriers: Fix leak in meta_barrier_destroy
meta_barrier_destroy is responsible for removing the extra
reference added in meta_barrier_constructed.

Unfortunately, it fails to do this because of a misplaced early
return statement.

This commit removes the spurious return.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1449
2020-09-26 22:55:37 -04:00
Carlos Garnacho
41042b18d6 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/1448
2020-09-23 16:32:18 +02:00
Carlos Garnacho
f7d0f2ce20 backends: Drop unused function
This meta_input_settings_get_tablet_mapping() was never necessary outside
MetaInputSettings, nor used. It can simply go away.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1448
2020-09-23 16:32:13 +02:00
Carlos Garnacho
df89c30241 backends: Drop unused function
meta_cursor_tracker_get_displayed_cursor() is used nowhere.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1448
2020-09-23 16:32:02 +02:00
Peter Hutterer
aa638f4d48 backends/native: fix the scroll button lock right/middle mismatch
In X, buttons 1, 2, 3 are left, middle, right. In evdev, the order is
BTN_LEFT, BTN_RIGHT, BTN_MIDDLE. So setting a scroll button to 2 gave us a
middle button in the X session and a right button in a wayland session.

Fix that by hard-coding the LMR buttons handling.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1433
2020-09-17 12:30:49 +00:00
Jonas Ådahl
6e3ecadb79 backends/native: Fall back to compositing if direct scanout failed
Even when a direct client buffer has a compatible format, stride and
modifier for direct scanout, drmModePageFlip() may still fail sometimes.

From testing, it has been observed that it may seemingly randomly fail
with ENOSPC, where all subsequent attempts later on the same CRTC
failing with EBUSY.

Handle this by falling back to flipping after having composited a full
frame again.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/1410
2020-09-17 12:17:35 +00:00
Peter Hutterer
48243bfcbc backends/x11: if the scroll button is nonzero, enable button scrolling
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1431
2020-09-16 15:03:09 +00:00
Peter Hutterer
e04e003fd5 backends/x11: factor out the scroll method property changes
Let's not duplicate this given how complicated it is.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1431
2020-09-16 15:03:09 +00:00
Peter Hutterer
453e02b779 backends/x11: fix the property type for the scroll button
For reasons beyond my memory, this is an XA_CARDINAL, not an XA_INTEGER.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1431
2020-09-16 15:03:09 +00:00
Benjamin Berg
d586d06b39 kms/crtc: Always consider gamma state valid
The gamma curve remains valid even if the CRTC is turned off. As such,
there is no need to clear it and doing so breaks reading the gamma curve
while the screens are turned off using DPMS.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1420

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/1392
2020-09-15 11:31:57 +00:00
Jonas Ådahl
827f545c27 kms/crtc: Read initial gamma state
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1420
2020-09-15 11:31:57 +00:00
Simon McVittie
e74b065fb5 input-mapper: Don't match touchscreens to the absence of a monitor
If there is no laptop panel (for example on a desktop PC or a virtual
machine), attempting to put a NULL monitor in the list of matches
will just make mapping_helper_apply() crash.

Mitigates: https://gitlab.gnome.org/GNOME/mutter/-/issues/1414
Signed-off-by: Simon McVittie <smcv@debian.org>
2020-09-14 17:31:32 +00:00
Jonas Ådahl
af9df1e5b6 screen-cast: Add 'dma-buf-screen-sharing' experimental feature
It's enabled by default when using the i915 driver, but disabled
everywhere else until it can be made reliably an improvement. Until
then, for anyone want to force-enable it, add the string
'dma-buf-screen-sharing' to the experimental features list in GSettings.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1442
2020-09-14 16:33:16 +00:00
Jonas Ådahl
6c0440697d screen-cast: Enable DMA buffers only for i915
Seems DMA buffer based interprocess buffer sharing is more broken than
not, so for now only enable it when using the i915 driver.

For example vmwgfx, qxl and radeon, it results in mmap() failing to mmap the
memory region. Other drivers, e.g. amdgpu will function, but may hit
very slow memory download paths, resulting in worse performance.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1442
2020-09-14 16:33:16 +00:00
Carlos Garnacho
bbcd65ce38 backends: Hook ClutterSeat::touch-mode to PanelOrientationManaged
We only want the panel autorotation to happen if the laptop has an
accelerometer, and is in tablet mode. Regular laptop mode should
lock the orientation, and let it be configured manually.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1311
2020-09-05 07:25:02 +00:00
Carlos Garnacho
bb0712077a backends: Check panel autorotation state before applying autorotation
So far, we've expected this signal to not happen whenever autorotation
shouldn't apply (no accelerometer is a strong reason). In future commits
we'll add further checks to this policy, so prevent autorotation to
change the display configuration if the MetaOrientationManager signal
happens but it should be ignored.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1311
2020-09-05 07:25:02 +00:00
Carlos Garnacho
1acf744473 backends: Centralize panel autorotation in a DisplayConfig property
Instead of having everyone check net.hadess.SensorProxy themselves, have
this all controlled by the MetaOrientationManager, and proxied everywhere
else via a readonly property in org.gnome.Mutter.DisplayConfig.

We want to attach more complex policies here, and it seems better to
centralize the handling of the autorotation feature rather than
implementing policy changes all over the place.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1311
2020-09-05 07:25:02 +00:00
Carlos Garnacho
7f9949a5e3 backends: Add method/property to get accelerometer availability
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1311
2020-09-05 07:25:02 +00:00
Carlos Garnacho
cba82d19b3 backends/input-mapper: Add some g_debug() traces to MetaInputMapper
Add some debug statements to mapping_helper_apply(), enough to work out
the heuristic decisions that were taken.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1202
2020-09-04 22:12:02 +00:00
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
766d5299d3 backends: Allow integrated tablet devices to cycle outputs
The work at https://gitlab.gnome.org/GNOME/gnome-control-center/issues/239
intended to make integrated devices optionally mappable to other outputs
(in order to allow fix mishandling from our heuristics, or to quickly reach
things in other monitor without changing devices).

This was missed in that plan, we do allow cycling outputs, but we still did
prevent it from doing anything for integrated devices. Fix that, and change
output cycling so we don't allow a "NULL" EDID for integrated devices, this
makes those go through the MetaInputMapper (resulting in one output listed
twice), instead of mapping to the full stage.

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

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1201
2020-09-04 21:57:43 +00:00