1
0
Fork 0
Commit graph

31697 commits

Author SHA1 Message Date
Carlos Garnacho
9c5bd9f847 clutter: Add "revoked" property to ClutterGrab
Users of Clutter grabs may listen for notify::revoked changes in
order to know that their grab is no longer in charge of event
propagation, without the use of crossing events.

Since a ClutterGrab may stay in the stack and regain effects,
this notification also happens the other way around.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3420>
2024-02-13 12:36:26 +01:00
Carlos Garnacho
b154fddd0f clutter: Make ClutterGrab a GObject
We'll want to add notifications on it, make it a GObject
to allow that.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3420>
2024-02-13 12:36:26 +01:00
Carlos Garnacho
02bb9651e1 wayland: Unify pointer constraints event interfaces
Now that the backend handles 0-size regions naturally and MetaWaylandPointer
avoids sending wl_pointer.motion on unchanged coordinates, we can use the
default motion handler for the locked pointer constraint.

And since that is the only difference with the pointer constraint event
interface, we can unify them both into a single MetaWaylandEventInterface
handling focus for them both.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3420>
2024-02-13 12:36:26 +01:00
Carlos Garnacho
0e56ebb51a wayland: Avoid sending wl_pointer.motion on unchanged coordinates
This might happen for a variety of reasons, like monitor edges or
pointer constraints. Handle this naturally in MetaWaylandPointer for
all these cases.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3420>
2024-02-13 12:36:26 +01:00
Carlos Garnacho
07d24fe502 backends/native: Allow infinitely small pointer constraint regions
The small catch is that MtkRegion (and pixman regions) "optimize away"
0-size rectangles, so a 0-sized region will always be seen as having
a 0,0 origin. We don't want that, so transfer the origin separately from
the region.

While at it, make the Wayland pointer lock use one such 0-size region,
to avoid the 1x1px wiggle room that it currently has (accounting for subpixel
motion).

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3420>
2024-02-13 12:36:26 +01:00
Carlos Garnacho
c931ed0d81 wayland: Allow XDnD with other devices than the pointer
While every kind of input is seen as coming from the Virtual
Core Pointer in the X11 case, we can largely abstract away from
that fact, and lock XDnD pointer input to the most plausible
source (e.g. a device with a pressed button), instead of only
working with pointer input.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3420>
2024-02-13 12:36:26 +01:00
Carlos Garnacho
b09374735b wayland: Cleanup MetaWaylandPointer header
Drop some functions that are no longer used outside of MetaWaylandPointer,
after interactions between components were reduced.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3420>
2024-02-13 12:36:26 +01:00
Carlos Garnacho
ec435ea540 wayland: Drop pointer grab interface
This is now unused, with everything ported to MetaWaylandEventInterface.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3420>
2024-02-13 12:36:26 +01:00
Carlos Garnacho
bcfb7a4a33 wayland: Drop keyboard grab interface
This is now unused and may be dropped. All usage has been
replaced by MetaWaylandEventInterface.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3420>
2024-02-13 12:36:26 +01:00
Carlos Garnacho
5fa112c298 wayland: Port drag and drop to MetaWaylandEventInterface
This collection of event handlers is the most special of them all, as
they want to unset any pointer/touch/stylus/keyboard/pad/etc focus,
and handle events from a selected device/sequence combination through
the MetaWaylandDragDest interfaces.

The same interfaces also replace the MetaWaylandKeyboardGrabInterface
in effect that handled DnD action changes.

On the XDnD special grab side, we mainly need to let the current
client (i.e. the drag source) keep receiving input events, as they
drive the DnD operation from the X11 realm.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3420>
2024-02-13 12:36:26 +01:00
Carlos Garnacho
5ade2060a7 wayland: Port popup grabs to MetaWaylandEventInterface
This is again a grab interface that mostly wants to meddle with focus,
logically setting a NULL surface if the surface client does not match
the popup client.

Since popups are meant to naturally work with any input device, the
code has been refactored to not involve the MetaWaylandPointer directly
in MetaWaylandPopup creation or getting the top popup surface (memory
management was shuffled), or compressing multiple grabbing xdg_popups
together (the existing grab maintains a single MetaWaylandEventHandler
for all).

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3420>
2024-02-13 12:36:26 +01:00
Carlos Garnacho
125ba92169 wayland: Port pointer constraints to using MetaWaylandEventInterface
Besides the pointer locking/constraining mechanism, these grab interfaces
were more of a focus tracking mechanism, revoking the constraints when
the conditions didn't meet.

This can be handled pretty similarly to keyboard grabs with the new
interface, with the added bonus that we can chain up to let the
parent/default handler handle the events themselves, without poking at
MetaWaylandPointer API.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3420>
2024-02-13 12:36:26 +01:00
Carlos Garnacho
9da40aa9fd wayland: Port xwayland key grabs to MetaWaylandEventInterface
This event interface simply enforces key focus to the grab window,
but stands out of the way for every other kind of input.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3420>
2024-02-13 12:36:26 +01:00
Carlos Garnacho
80ed79a0d3 wayland: Add default event interface handling seat events
This is implemented at the MetaWaylandSeat level, and it governs
focus and event delivery for all devices, falling through each
of the MetaWaylandPointer/MetaWaylandKeyboard/etc components.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3420>
2024-02-13 12:36:26 +01:00
Carlos Garnacho
a2c11f0e87 wayland: Introduce MetaWaylandInput/MetaWaylandEventInterface
MetaWaylandInput is an object that will become in charge of handling
input events on their way to the Wayland socket. It keeps a stack
of event handlers, and propagates events and changes across them in
order to have them emit Wayland events, or change focus.

Each of these event handlers has a MetaWaylandEventInterface, this
is a vtable meant to replace MetaWaylandPointerGrabInterface and
MetaWaylandKeyboardGrabInterface in an unified manner, with the
following methods:

- get_focus_surface: to return the focus surface for a device/sequence.
  Since several handlers will want to delegate logic on previous
  handlers, it is optional to chain up with
  meta_wayland_event_handler_chain_up_get_focus_surface().
- focus: To trigger a focus change for a device/sequence, since
  event handlers are daisy chained by default, it is mandatory to
  chain up with meta_wayland_event_handler_chain_up_focus(), either
  with the given surface, or passing NULL to let later handlers
  unset their state.
- press/motion/release: Unified handlers for pointer/touch/stylus
  input, they chain up like event handlers do.
- key: Key event handler, propagates like event handlers do.
- other: Fallthrough for other events (pad, scroll, ...), propagates
  like event handlers do.

Since there is a variety of expected behaviors, and the possibility
of stacking for some of the existing Wayland "grabs", this provides
the mechanism for that to happen.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3420>
2024-02-13 01:01:48 +01:00
Carlos Garnacho
77ec0d1e41 wayland: Add API to change a tool focus surface
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3420>
2024-02-13 01:01:48 +01:00
Carlos Garnacho
9c2514b75c wayland: Add MetaWaylandPointer method to focus surface
This method ATM hooks up with MetaWaylandPointer's grabbing
mechanism, triggering a focus on the existing grab interface.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3420>
2024-02-13 01:01:48 +01:00
Carlos Garnacho
a98f1b2764 wayland: Add getter for the implicitly grabbed surface of a touch sequence
This will be used to implement the default MetaWaylandEventInterface at
MetaWaylandSeat.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3420>
2024-02-13 01:01:48 +01:00
Carlos Garnacho
20f7a60e11 wayland: Add getter for the current surface of a tablet device
That would be the surface under the tool that is being currently used
on the device. This will be used by MetaWaylandSeat to implement the
default MetaWaylandEventInterface.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3420>
2024-02-13 01:01:48 +01:00
Carlos Garnacho
fe71588a2d wayland: Add getter for MetaWaylandPointer current surface
This is the surface currently under the pointer, and will be used
by MetaWaylandSeat to implement the default MetaWaylandEventInterface.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3420>
2024-02-13 01:01:48 +01:00
Carlos Garnacho
09101e36f8 wayland: Handle pointer focus inhibition at the Clutter level
The MetaWaylandPointer used to put this together through
MetaCursorTracker cursor visibility, and ClutterSeat-level
inhibition API, applying the pointer focus changes due to
visibility logically to Wayland clients.

In order to make this work over all Clutter widgetry
instead of just Wayland clients, make the ClutterSeat-level
inhibition API control this feature at the ClutterStage picking
level, and leave/enter the seat pointer as appropriate.

By default, the seat pointer has (un)focus inhibited. The
MetaCursorTracker has been made another player in unfocus
inhibition, simply asking for the pointer to get its focus
while the cursor is visible.

This in practice means that picking code may return a NULL
actor, some asserts and preconditions had to be changed to
handle this, plus some test code slightly.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3420>
2024-02-13 01:01:48 +01:00
Carlos Garnacho
7a2411ce50 wayland: Refactor grab checks for tablets
Do not jump at MetaWaylandSeat across the MetaWaylandTabletSeat to
poke at the tablet tools, and chain up the checks through a
MetaWaylandTabletSeat method instead.

While at it, use g_autoptr to manage the tool list, and fix a leak.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3420>
2024-02-13 01:01:48 +01:00
Carlos Garnacho
a37fd34bbb wayland: Make MetaWaylandSeat in charge of its own tablet seat
The relation between seats and tablet seats is always 1:1, Make
the MetaWaylandSeat hold its own MetaWaylandTabletSeat, and
manipulate it directly.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3420>
2024-02-13 01:01:48 +01:00
Aurimas Černius
5768caea81 Update Lithuanian translation 2024-02-12 21:25:31 +00:00
columbarius
692a4cec09 screen-cast-stream-src: Cleanup includes and defines
Removes unused includes and fix indentation of macros to make CI happy
:).

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2557>
2024-02-12 21:46:14 +01:00
columbarius
9d328001d1 screen-cast-stream-src: Renegotiate when DMABUF allocation fails
After negotiation of DMABUF transport mutter will silently allocate SHM
buffers if the allocation in the add_buffer callback fails. It's cleaner
to renegotiate the supported formats without announcing DMABUF
capabilities in this case.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2557>
2024-02-12 21:45:27 +01:00
columbarius
1462eb69a8 screen-cast-stream-src: Move FormatParam building code into function
To fixate the format or renegotiate after a DMABUF allocation failed we
need to rebuild the EnumFormat params.

The function meta_screen_cast_query_modifiers will return false if no
modifiers are supported, thouse we can drop the check and remove the
macro guard.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2557>
2024-02-12 21:45:27 +01:00
columbarius
265a17e01c screen-cast: Implement query_modifiers
This function contains a stub, which returns support for implicit
modifiers, if modifiers are supported preserving the current
capabilities. The stub has to be replaced with a query to the cogl
renderer to support explicit modifiers.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2557>
2024-02-12 21:45:27 +01:00
Danial Behzadi
cd84b478b4 Update Persian translation 2024-02-12 16:53:14 +00:00
Ekaterine Papava
b020a7b9f0 Update Georgian translation 2024-02-12 13:11:41 +00:00
Florian Müllner
f8a257e104 Bump version to 46.beta
Update NEWS.
2024-02-11 15:51:16 +01:00
Florian Müllner
6762626747 ci: Install gi-docgen builddeps
Don't assume the dependencies are covered by the other modules.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3575>
2024-02-10 21:01:33 +01:00
Florian Müllner
b968daf35c ci: Don't build wayland-protocols
Fedora 39 already includes 1.33, no need to build it ourselves.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3575>
2024-02-10 19:55:24 +01:00
Florian Müllner
a8629cfbc7 ci: Stop building glib
Bleeding edge glib was required at some point last cycle, but
right now the last stable release is good enough.

Relying on the packaged version also avoids the need for an
updated gjs, as glib now provides a newer API version of
GIRepository.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3575>
2024-02-10 19:40:56 +01:00
Robert Mader
f26939255e compositor-view/native: Remove leftover check
This check was originally added because `window` was actually used.
While technically correct, there's no reason to keep it around.

Fixes: 4736f873f2 ("compositor/native: Add support for direct scanout per view")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3177>
2024-02-10 17:41:12 +00:00
Robert Mader
bd6196f4ca wayland: Implement direct scanout for cropped and scaled surfaces
Until now we only supported direct scanout to the primary plane if the
buffer size perfectly matched the display size.
Since display controllers usually support scaling and cropping buffers
highly efficiently, try to let them do the job. This is usually helpful
if wp_viewporter is used by the client or Mutter uses fractional
scaling.

This has several advantages:
 - Games (e.g. SDL2 based ones) can almost always hit direct scanout
   paths in fullscreen mode. Notably when fractional scaling is used or
   the game renders in a non-native resolution (or both).
 - Video players using YUV buffer formats and wp_viewporter can easily
   hit direct scanout paths, making displaying video very power
   efficient as the 3D engine is not used at all.

Note that this still only uses the primary plane, no overlay or underlay
planes, making this change comparatively low risk.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3177>
2024-02-10 17:41:12 +00:00
Robert Mader
ed50cbbfe4 window-actor/wayland: Update scanout candidate check
In a following commit we will start supporting scaled and croped
surfaces, thus, in preparation, update the logic to three common cases:
1. only one surface, fullscreen (most apps)
2. a content surface and a black background surface which the client
   does not want to unmap, fullscreen
3. top-level subsurface covers the whole window and is opaque (Firefox)

The remaining currently supported cases should be fairly uncommen and
and harder to compute.

Note that we already check that the window cover the stage view in
MetaCompositorView.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3177>
2024-02-10 17:41:12 +00:00
Robert Mader
50f8f1e8b3 wayland/single-pixel: Add API to check if buffer is opaque black
Which is the typical background color we also use for fullscreen
padding. This will allow us to apply optimizations.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3177>
2024-02-10 17:41:12 +00:00
Robert Mader
adc776d0d7 crtc/kms: Pass on src and dst rects to primary plane assignments
This allows us to pass on the related data from CoglScanouts.

If dst_rect does not match the mode, we assume that not covered areas
are opaque black - usually black bars around a centered surface.

While such driver behaviour does not appear to be documented (well) yet,
it seems to be followed by all known existing drivers and is used in a
similar way in ChromeOS.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3177>
2024-02-10 17:41:12 +00:00
Robert Mader
26ce5cd6be kms/update: Add meta_fixed_16_from_double helper
It will be used in the next commit.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3177>
2024-02-10 17:41:12 +00:00
Robert Mader
d5fe58f355 kms/update: Use bitshifts for fixed_16 helpers
For easier understanding.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3177>
2024-02-10 17:41:12 +00:00
Robert Mader
912cd80f10 cogl/scanout: Add API for source/destination rectangles
These will get passed on to KMS later.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3177>
2024-02-10 17:41:12 +00:00
Robert Mader
52c4b85161 cogl: Turn CoglScanout into an object
We need an object to hold additional scanout related information, such
as scaling and positioning data. Turn CoglScanout into such an object,
moving the interface into CoglScanoutBuffer.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3177>
2024-02-10 17:41:12 +00:00
Dor Askayo
82cdf90a71 clutter/frame-clock: Add a state for when scheduled "now"
The new CLUTTER_FRAME_CLOCK_STATE_SCHEDULED_NOW state is almost
identical to CLUTTER_FRAME_CLOCK_STATE_SCHEDULED, with one important
difference being that it avoids updates from being repeatedly
rescheduled "now" when multiple calls to
clutter_frame_clock_schedule_update_now() are done before the source
is actually dispatched.

Such repeated calls to schedule an update "now" may actually postpone
the dispatch if the CPU is very busy and the source dispatch is
delayed, defeating the purpose of scheduling a frame "now".

It also allows rescheduling "now" when the frame clock is uninhibited
after being inhibited while an update was scheduled "now". This may
be important in cases where the frame clock is inhibited for very
short periods in which it would otherwise lose the state of being
scheduled "now".

Scenarios such as this would become more common with the introduction
of variable refresh rate since it makes scheduling "now" a commonplace
occurrence.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3561>
2024-02-10 16:16:19 +00:00
Bilal Elmoussaoui
f72dbc8046 barrier: Drop deprecated display property
It was deprecated 23 months ago in 0debb24e12

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3573>
2024-02-09 18:03:09 +01:00
Bilal Elmoussaoui
fa59796afd meta: Drop deprecated methods
Both functions were deprecated 20months ago, so should be safe
to remove now

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3573>
2024-02-09 18:03:09 +01:00
Bilal Elmoussaoui
cc1957a4ba clutter/flow-layout: Use Orientation enum
Instead of having a custom FlowOrientation one

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3573>
2024-02-09 18:03:09 +01:00
Bilal Elmoussaoui
9bf55cd054 cleanup: Drop unused MetaVirtualModifier
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3573>
2024-02-09 18:03:09 +01:00
Bilal Elmoussaoui
40ba60b52b clutter/main: Move struct where it is used
The struct & functions are no longer used elsewhere, so move them from
the header file

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3573>
2024-02-09 18:03:05 +01:00
Bilal Elmoussaoui
263423d38e ci: Install gi-docgen from main
In order to use the latest features it has

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3538>
2024-02-09 12:29:50 +00:00