1
0
Fork 0
Commit graph

199 commits

Author SHA1 Message Date
Carlos Garnacho
0d83fcc870 wayland: Look up cursor renderer for device on MetaWaylandPointer
Make it explicitly look up the pointer device, instead of implicitly
relying on it.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403>
2020-11-27 15:14:33 +00:00
Carlos Garnacho
a76a47fbde clutter: Pass timestamp to clutter_input_device_set_actor()
This function emits crossing events, so needs a (most times truthful)
timestamp. Make it explicit instead of fetching it from the device.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1486
2020-10-23 18:48:19 +00:00
Carlos Garnacho
6a6894a397 clutter: Specify stage on clutter_input_device_update() function
This is the function performing the picking, tell it explicitly the
stage it should happen on.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1486
2020-10-23 18:48:18 +00:00
Jonas Dreßler
7539de2320 clutter/input-device: Make clutter_input_device_get_actor() public
Make the clutter_input_device_get_actor() API public and remove
clutter_input_device_get_pointer_actor() in favour of the new function.

This allows also getting the "pointer" actor for a given touch sequence,
not only for real pointer input devices like mice.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1275
2020-06-16 10:09:26 +00:00
Jonas Dreßler
ad8ba69423 wayland/pointer: Use g_signal_connect_swapped for one signal
Remove the rather useless callback function that's currently used for
handling the "visibility-changed" signal and instead connect to the
signal using `g_signal_connect_swapped()`.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/1077
2020-02-24 09:52:06 +00:00
Jonas Dreßler
bf24b816c2 wayland/pointer: Add support for the new ClutterSeat inhibit-unfocus API
The last commit added a new API to ClutterSeat to inhibit setting the
focus-surface of the MetaWaylandPointer to NULL, let's do that.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/1077
2020-02-24 09:52:06 +00:00
Jonas Ådahl
c0c74484bc wayland: Don't access MetaWaylandSurface::window directly
It'll be moved to the role owning it, accessed via a helper function
implemented by the role. Currently it still just fetches the field in
MetaWaylandSurface.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/835
2020-02-19 22:34:28 +00:00
Daniel van Vugt
06dae3a8cc wayland-pointer: Bail unconditionally if without native backend
Using `-Dnative_backend=false` caused build failure due to a missing
(implicit) definition of `META_IS_BACKEND_X11`. But if we define it
properly then that just leaves some of the function's locals uninitialized
and it will never work anyway. Just return unconditionally if there's no
native backend to initialize the variables.

Closes: https://gitlab.gnome.org/GNOME/mutter/issues/1025
2020-02-05 18:09:34 +08:00
Carlos Garnacho
f1d4d687f3 backends: Drop get_relative_motion_deltas() vfunc
Just go ATM through backend checks, and looking up directly the
native event data, pretty much like the rest of the places do that...
Eventually would be nice to have this information in ClutterEvent,
but let's not have it clutter the MetaBackend class.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/852
2020-01-30 18:11:37 +01:00
Carlos Garnacho
6dfd2ffcef wayland: Replace ClutterDeviceManager usage in favor of ClutterSeat
https://gitlab.gnome.org/GNOME/mutter/merge_requests/852
2020-01-30 18:02:34 +01:00
Olivier Fourdan
a382698acc wayland: Update input device before repick
When a Wayland window is mapped or unmapped, the Wayland compositor is
expected to send the coorespoindign `wl_pointer` enter/leave events to
the affected clients.

To do so, mutter calls `meta_wayland_compositor_repick()` which
eventually calls `meta_wayland_pointer_repick()` and
`repick_for_event()`.

If pointer input device has not been updated yet, the old clutter actor
is picked and no enter/leave event is emitted.

Make sure we update the pointer input device prior to do the repick to
get the actual `ClutterActor` under the pointer.

Closes: https://gitlab.gnome.org/GNOME/mutter/issues/1016
https://gitlab.gnome.org/GNOME/mutter/merge_requests/1026
2020-01-30 09:37:58 +01:00
Jonas Ådahl
fcfe90aa9f wayland: Replace manual GNode subsurface iteration with macro
Similar to wl_list_foreach(), add
META_WAYLAND_SURFACE_FOREACH_SUBSURFACE() that iterates over all the
subsurfaces of a surface, without the caller needing to care about
implementation details, such as leaf nodes vs non-leaf nodes.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/961
2020-01-10 16:01:21 +00:00
Robert Mader
92375c75f8 cleanup: Use g_clear_signal_handler() where possible
This is inspired by 98892391d7 where the usage of
`g_signal_handler_disconnect()` without resetting the corresponding
handler id later resulted in a bug. Using `g_clear_signal_handler()`
makes sure we avoid similar bugs and is almost always the better
alternative. We use it for new code, let's clean up the old code to
also use it.

A further benefit is that it can get called even if the passed id is
0, allowing us to remove a lot of now unnessecary checks, and the fact
that `g_clear_signal_handler()` checks for the right type size, forcing us
to clean up all places where we used `guint` instead of `gulong`.

No functional changes intended here and all changes should be trivial,
thus bundled in one big commit.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/940
2019-11-21 15:02:27 +00:00
Georges Basile Stavracas Neto
160cc9182d Replace ClutterPoint by graphene_point_t
Remove the tests for ClutterPoint since it's
corresponding code moved to private ClutterStage
methods.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/458
2019-10-16 11:38:14 +00:00
Carlos Garnacho
7735a919d1 wayland: Check pointer visibility on post-grab focus changes
Just like sync_focus_surface() does, we shouldn't set a focus surface while
the pointer is hidden, so the illusion that there is none remains.

Closes: https://gitlab.gnome.org/GNOME/mutter/issues/779
2019-10-07 19:37:13 +02:00
Carlos Garnacho
9f617ae43d wayland: Warn if a surface is being set while the pointer is invisible
This is an unexpected condition, better not to fall in it without further
indications.

Closes: https://gitlab.gnome.org/GNOME/mutter/issues/779
2019-10-07 19:30:09 +02:00
Robert Mader
77229f99b8 wayland: Implement subsurface.place_below() for parents
Flatten the subsurface actor tree, making all surface actors children
of the window actor.
Save the subsurface state in a GNode tree in MetaWaylandSurface, where
each surface holds two nodes, one branch, which can be the tree root
or be attached to a parent surfaces branch, and a leaf, which is
used to save the position relative to child branch nodes.

Each time a surface is added or reordered in the tree, unparent all
surface actors from the window actor, traverse all leaves of the
tree and readd the corresponding surface actors back to the window
actor.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/664
2019-08-27 11:31:00 +03:00
Carlos Garnacho
8b03d9ecc3 clutter: Move evdev input to src/backends/native
The end goal is to have all clutter backend code in src/backends. Input
is the larger chunk of it, which is now part of our specific
MutterClutterBackendNative, this extends to device manager, input devices,
tools and keymap.

This was supposed to be nice and incremental, but there's no sane way
to cut this through. As a result of the refactor, a number of private
Clutter functions are now exported for external backends to be possible.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/672
2019-08-24 08:59:08 +00:00
Jonas Dreßler
4bc7425332 wayland/pointer: Remove duplicate include
https://gitlab.gnome.org/GNOME/mutter/merge_requests/448
2019-07-10 12:39:06 +00:00
Jonas Dreßler
a2a8f0cdaa wayland/pointer: Set focus to NULL when the cursor is hidden
This is important when using a touchscreen or stylus instead of a mouse
or touchpad. If the cursor only gets hidden and the focus stays the
same, the window will still send hover events to the UI element under
the cursor causing unexpected distractions while interacting with the
touchscreen.

Fix this by emitting a visibility-changed signal from the cursor tracker
which then triggers a focus surface sync and always set the focus
surface to NULL when it's synced while the cursor is hidden.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/448
2019-07-10 12:39:06 +00: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
Jonas Ådahl
2f4a68c8c3 Clean up include macros mess
The order and way include macros were structured was chaotic, with no
real common thread between files. Try to tidy up the mess with some
common scheme, to make things look less messy.
2018-11-06 17:17:36 +01:00
Jonas Ådahl
50ff9d4c71 wayland: Rename cursor role types
Rename the two cursor role types according to the convention used by the
other roles. This means that MetaWaylandSurfaceRoleCursor was renamed to
MetaWaylandCursorSurface, and MetaWaylandSurfaceRoleTabletCursor was
renamed to MetaWaylandTabletCursorSurface. The corresponding filenames
were renamed accordingly too.

https://gitlab.gnome.org/GNOME/mutter/issues/77
2018-06-15 19:09:49 +00:00
Carlos Garnacho
5db48faca4 wayland: Update button state on motion/button events
More specifically, avoid crossing events, since clutter does not set
modifier/button state on those. Fixes implicit grabs being broken when
the pointer moves past the surface boundaries.

https://bugzilla.gnome.org/show_bug.cgi?id=785347
2017-07-24 17:57:31 +02:00
mitchmindtree
8457e2bad6 wayland/pointer: Check for subsurfaces when grabbing
Previously, the function only returned `TRUE` if the given surface was
equal to the given pointer's focused surface. This changes the behaviour
to also return `TRUE` if any of the given surface's subsurfaces are
equal to the pointer's focused surface.

https://bugzilla.gnome.org/show_bug.cgi?id=781811.
2017-06-07 09:47:29 +08:00
Jonas Ådahl
b4120a75e0 wayland/pointer: Track lifetime of current surface
Clear the pointer->current when the surface is destroyed.

https://bugzilla.gnome.org/show_bug.cgi?id=783113
2017-06-01 12:46:32 +08:00
Jonas Ådahl
b19e4592df wayland/pointer: Use glib signals tracking focus surface
Use the "destroy" MetaWaylandSurface signal instead of the wl_resource
destroy signal for tracking the lifetime of the surface with pointer
focus.

As unsetting the focus may have side effects due to handlers of the
"focus-surface-changed" signal, connect the signal after the default
handler to make sure other clean up facilities have the chance deal with
the surface destruction before we try to unset the focus.

https://bugzilla.gnome.org/show_bug.cgi?id=783113
2017-06-01 12:46:32 +08:00
Jonas Ådahl
317b734dcc Move cursor tracker ownership to the backend
Let the backend initialize the cursor tracker, and change all call
sites to get the cursor tracker from the backend instead of from the
screen. It wasn't associated with the screen anyway, so the API was
missleading.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:51 +08:00
Jonas Ådahl
8a7876ded5 wayland: Don't cancel the pointer grab on compositor grabs
We shouldn't cancel the pointer grab when there is a compositor grab,
since that'd break things like drag-n-drop via the overview and
alt-tabs.

The original reason for cancelling the pointer grab on compositor grabs
was to avoid a re-entry when a compositor grab was activated while
there was an active pointer constraint grab. The re-entry would happen
when the compositor grab cleared the pointer focus. Clearing the focus
would trigger the pointer constraint to be deactivated, which would end
its grab. Ending the grab would reset the grab to the default one, which
could focus the same surface again, triggering the constraint to
re-enable before it finished disabling.

This is now avoided because the default grab handler is now aware of
compositor grabs, and won't override the cleared pointer focus until
the compositor grab ends.

https://bugzilla.gnome.org/show_bug.cgi?id=772914
2016-10-19 15:45:33 +08:00
Jonas Ådahl
b50da46f43 wayland/pointer: Don't set focus while during compositor grab
Teach the default grab about compositor grabs (i.e.
display->event_route) so that it can avoid setting a pointer focus when
after the compositor grab actively unset the pointer focus.

https://bugzilla.gnome.org/show_bug.cgi?id=772914
2016-10-19 15:45:33 +08:00
Jonas Ådahl
6e7057426e wayland/pointer: Add way to cancel current grab
Previously a grab could suddenly end without the grabber knowing
anything about it. Some grabs assume they won't suddenly end without
notice, and can use then new 'cancel' vfunc to be notified.

Currently a grab is cancelled when a new one is started (i.e. in
meta_wayland_pointer_grab_start()), when a non-popup compositor wide
event route is initiated, and when the seat looses the pointer
capability.

https://bugzilla.gnome.org/show_bug.cgi?id=771858
2016-10-12 10:08:59 +08:00
Jonas Ådahl
7990182f56 wayland/pointer: Use grab helper that doesn't focus when disabling
Instead of using meta_wayland_pointer_end_grab() which focuses the new
grab, add a new helper mean to be used to reset the grab state without
changing the pointer focus. When using this function, the call site is
supposed to explicitly manage focus.

https://bugzilla.gnome.org/show_bug.cgi?id=771646
2016-10-11 22:51:54 +08:00
Jonas Ådahl
93a6be08a5 wayland/pointer: Naming and coding style fixes
Some very long lines that stood out were shortened, and an old naming
convention from weston was removed.

https://bugzilla.gnome.org/show_bug.cgi?id=771646
2016-10-11 22:51:54 +08:00
Jonas Ådahl
d5d5084151 wayland/pointer: Check pointer presence at set focus call site
Make the caller of focus setting check whether there is a pointer to
update the focus state of. It makes it more obvious what to expect, as
the call would be a no-op in when no pointer is present.

Grabbing is still allowed without the presence of a pointer because it
is used by popups even on touch-only systems.

https://bugzilla.gnome.org/show_bug.cgi?id=771646
2016-10-11 22:51:54 +08:00
Jonas Ådahl
d3cff9a962 wayland/pointer: Use helper for getting the next event serial
Use the MetaWaylandInputDevice helper for serial retrieval.

https://bugzilla.gnome.org/show_bug.cgi?id=771646
2016-10-11 22:51:54 +08:00
Jonas Ådahl
f89162ee73 wayland/pointer: Unset pointer focus when disabled
Previously the focus was reset implicitly by a memset() on the whole
MetaWaylandPointer struct. When MetaWaylandPointer was turned into a
GObject, this was not possible any more, and the focus was not updated
properly.

https://bugzilla.gnome.org/show_bug.cgi?id=771646
2016-10-10 23:35:01 +02:00
Jonas Ådahl
98f0578f9d MetaWaylandPointer: Initialize default grab on init
Instead of initializing the default grab when the device class is
enabled, initialize it on object initialization. This way other device
classes can still grab the pointer, as if there was one. This may be
useful for example if a touch grab is active and a mouse is connected.

This also makes it possible for popup grabs, which currently use a
pointer grab for controlling, to be triggered by touch devices, while
still holding an active pointer grab.

https://bugzilla.gnome.org/show_bug.cgi?id=771305
2016-09-15 09:55:34 +08:00
Jonas Ådahl
87f82d9fc0 wayland: Move device seat association to MetaWaylandInputDevice
Make the device <-> seat association permanent, and move it into
MetaWaylandInputDevice. A device will never be disassociated with a
seat, so there is no point in unsetting it.

https://bugzilla.gnome.org/show_bug.cgi?id=771305
2016-09-15 09:55:34 +08:00
Jonas Ådahl
a6646b32d0 wayland: Add common object for device classes
Add a new object class, MetaWaylandInputDevice, and make all device
classes (pointer, keyboard, touch) inherit it. In the future common
functionality may be placed there.

https://bugzilla.gnome.org/show_bug.cgi?id=771305
2016-09-15 09:54:55 +08:00
Jonas Ådahl
e6a20a025d MetaWaylandPointer: Add 'focus-surface-changed' signal
Add a signal that is emitted when the pointer focus surface of the
pointer device changes. This will later be used by the pointer
constraints to maybe enable pointer constraints when a surface receives
pointer focus.

https://bugzilla.gnome.org/show_bug.cgi?id=771050
2016-09-09 10:09:46 +08:00
Jonas Ådahl
e5a359a032 wayland: Make seat devices GObjects
This will make it possible to add signals and other GObject features.

https://bugzilla.gnome.org/show_bug.cgi?id=771050
2016-09-09 10:09:46 +08:00
Jonas Ådahl
0c53677992 wayland/pointer-constraints: Send wl_pointer.frame when locked
We were not sending wl_pointer.frame after
wp_relative_pointer.relative_motion. Fix that.

https://bugzilla.gnome.org/show_bug.cgi?id=770994
2016-09-09 10:03:16 +08:00
Jonas Ådahl
3b3f40a1aa MetaWaylandSurface: Allow passing parameters when assigning role
Allow passing parameters (only GObject parameters supported for now) so
that role assignment can affect the paremeters set during construction.

If a role was already assigned when assigning, the passed parameters
are set using g_object_set_valist().

https://bugzilla.gnome.org/show_bug.cgi?id=769936
2016-08-25 12:19:40 +08:00
Carlos Garnacho
5849275b76 wayland: Refactor MetaWaylandSurfaceRoleCursor
Move into a standalone meta-wayland-surface-role-cursor.[ch], and
make generic enough to work for pointe and additional (eg. tablet)
cursors.

Most notably, the sprite is now kept completely internal to the
cursor role, and updates are routed through the given
MetaCursorRenderer (which may be the default one for the pointer,
or something else).

The way cursor updates after cursor surface destruction has also
been reworked, the pointer will just keep track of the last cursor
surface, so older surfaces being destroyed don't trigger pointer
rechecks/updates.
2016-05-03 13:05:06 +02:00
Jonas Ådahl
229a143eac wayland: Add 'MetaWaylandPopupSurface' bridge between popup and surface
Add a bridge between the MetaWaylandPopup object and the corresponding
popup surface role. This bridge replaces communicating dismissed and
unmapped popup events.

https://bugzilla.gnome.org/show_bug.cgi?id=763431
2016-05-01 21:11:27 +08:00
Jonas Ådahl
e68b5f6655 wayland: Simplify popup grabbing API
meta_wayland_popup_grab_create() creates and begins the grab and
meta_wayland_popup_grab_destroy() both ends and destroys the grab.

https://bugzilla.gnome.org/show_bug.cgi?id=763431
2016-05-01 21:11:27 +08:00
Carlos Garnacho
a6cc35e595 wayland: remove pressed button checks from meta_wayland_pointer_can_grab_surface()
Leave these checks up to the callers, the only uses of this function
(indirect, through meta_wayland_seat_get_grab_info) are
[wl_shell|xdg]_surface.move/resize/show_window_menu.

In move/resize it makes sense to check for a button being pressed, because
we must expect a button release event. However for xdg_surface.show_window_menu
we 1) don't strictly need further events and 2) we must account for press+release
event pairs being processed at once in the compositor before the client sees
the former.

That is eg. the case of touchpad 2nd/3rd button tap emulation, multifinger
taps will emit the event pair at once, so when the client manages to request
xdg_surface.show_window_menu, it'll be too late in the compositor side, so the
request is ignored.

https://bugzilla.gnome.org/show_bug.cgi?id=764519
2016-04-25 14:23:01 +02:00
Jonas Ådahl
7173937a7d wayland/cursor: Keep a private use count and reference to active buffer
In order for the native cursor renderer to be able to create a hw
cursor in response to wl_pointer.set_cursor(), keep a private use-count
and reference to the active buffer, stopping it from being released
until it is consumed, replaced, or the surface is destroyed.

https://bugzilla.gnome.org/show_bug.cgi?id=762828
2016-03-29 18:26:10 +08:00
Jonas Ådahl
10a0114856 wayland: Move buffer use count to MetaWaylandSurface
Each wl_surface.commit with a newly attached buffer should result in
one wl_buffer.release for the attached buffer. For example attaching
the same buffer to two different surfaces must always result in two
wl_buffer.release events being emitted by the server. The client is
responsible for counting the wl_buffer.release events and be sure to
have received as many release events as it has attached and committed
the buffer, before reusing it.

https://bugzilla.gnome.org/show_bug.cgi?id=762828
2016-03-29 18:26:10 +08:00
Carlos Garnacho
82153ff23f wayland: Always send focus() when starting a pointer grab
Even if the focus is NULL, we may want the current grab focus code
to be run.

https://bugzilla.gnome.org/show_bug.cgi?id=762104
2016-03-11 14:47:01 +01:00