1
0
Fork 0
Commit graph

139 commits

Author SHA1 Message Date
Jonas Ådahl
428c687b5a wayland: Clean up wl_pointer_send_enter/leave code
Be consistent and always use a helper, and fix the naming so
broadcast means to actually broadcast.

https://bugzilla.gnome.org/show_bug.cgi?id=755503
2015-12-03 16:11:37 +08:00
Carlos Garnacho
7309b20c25 wayland: Fetch pointer button event codes from the ClutterEvent
When running as a native compositor, we can just do that. However, the
previous code must stay for whenever it's run as a X11 client.

Additionally, the fallback switch{} that transforms clutter 1-indexed
buttons into input.h event codes had to be adapted to the change introduced
in clutter commit 83b738c0e, where the 4-7 button range is kept clear for
compatibility with the X11 backend.

https://bugzilla.gnome.org/show_bug.cgi?id=758239
2015-11-25 17:56:51 +01:00
Jonas Ådahl
e84f694668 wayland: Don't scale XWayland pointer cursor sprites
We don't have any way of knowing what the intended size of a XWayland
cursor is supposed to be, so lets do what we do with regular XWayland
surfaces and don't scale them. The result is that cursor sprites of
HiDPI aware X11 clients will show correctly, but non-aware clients may
have tiny cursor sprites.

https://bugzilla.gnome.org/show_bug.cgi?id=755099
2015-10-04 14:17:14 +08:00
Florian Müllner
27b37407d0 Don't duplicate declarations from G_DEFINE_TYPE 2015-09-24 03:01:51 +02:00
Jonas Ådahl
5d837a5c85 wayland: Support sending wl_surface.enter/leave to cursor surfaces
Support notifying clients about what outputs their cursor surfaces are
on so that they can attach appropriately scaled buffers to them.

https://bugzilla.gnome.org/show_bug.cgi?id=744932
2015-09-13 21:26:22 +08:00
Jonas Ådahl
79c86ae890 Support scaling of cursor sprites given what output they are on
This commits refactors cursor handling code and plugs in logic so that
cursor sprites changes appearance as it moves across the screen.
Renderers are adapted to handle the necessary functionality.

The logic for changing the cursor sprite appearance is done outside of
MetaCursorSprite, and actually where depends on what type of cursor it
is. In mutter we now have two types of cursors that may have their
appearance changed:

 - Themed cursors (aka root cursors)
 - wl_surface cursors

Themed cursors are created by MetaScreen and when created, when
applicable(*), it will extend the cursor via connecting to a signal
which is emitted everytime the cursor is moved. The signal handler will
calculate the expected scale given the monitor it is on and reload the
theme in a correct size when needed.

wl_surface cursors are created when a wl_surface is assigned the
"cursor" role, i.e. when a client calls wl_pointer.set_cursor. A
cursor role object is created which is connected to the cursor object
by the position signal, and will set a correct texture scale given what
monitor the cursor is on and what scale the wl_surface's active buffer
is in. It will also push new buffers to the same to the cursor object
when new ones are committed to the surface.

This commit also makes texture loading lazy, since the renderer doesn't
calculate a rectangle when the cursor position changes.

The native backend is refactored to be triple-buffered; see the comment
in meta-cursor-renderer-native.c for further explanations.

* when we are running as a Wayland compositor

https://bugzilla.gnome.org/show_bug.cgi?id=744932
2015-09-13 21:26:22 +08:00
Jonas Ådahl
7c7cf91c32 wayland: Move cursor surface role to meta-wayland-pointer.c
The wl_pointer assigns a role to a wl_surface, so it makes sense to put
the related logic there.

https://bugzilla.gnome.org/show_bug.cgi?id=744932
2015-09-13 21:26:22 +08:00
Jonas Ådahl
83c17134f1 wayland: GObject:ify surface roles
Make a surface roles into objects with vfuncs for things where there
before was a big switch statement. The declaration and definition
boilerplate is hidden behind C macros.

https://bugzilla.gnome.org/show_bug.cgi?id=744932
2015-09-13 21:24:58 +08:00
Jonas Ådahl
94513726de wayland: Clean up surface role assignment
Use a better name, use GNOME conventions for error handling, open code the
client error reporting and send the error to the correct resource.
wl_subcompositor doesn't have a role error yet, so continue use some
other error. The only effect of this is error received in the client will
be a bit confusing, it will still be disconnected.

https://bugzilla.gnome.org/show_bug.cgi?id=754215
2015-09-07 17:41:14 +08:00
Jonas Ådahl
68279e8a08 MetaWaylandPointer: Don't keep our own MetaCursorTracker pointer
There is no reason to, we can just retrieve it every time we need it.

https://bugzilla.gnome.org/show_bug.cgi?id=744932
2015-08-28 09:52:30 +08:00
Jonas Ådahl
b01f95cfdd Make MetaCursorSprite a GObject
To easier track lifetime and utilize other GObject features, make
MetaCursorSprite a GObject.

https://bugzilla.gnome.org/show_bug.cgi?id=744932
2015-08-28 09:52:30 +08:00
Jonas Ådahl
4b667d1e09 Rename MetaCursorReference to MetaCursorSprite
It isn't really a reference to a MetaCursor enum, but a reference
counted cursor sprite, and enum value.

https://bugzilla.gnome.org/show_bug.cgi?id=744932
2015-08-28 09:52:30 +08:00
Carlos Garnacho
b64b159109 wayland: Avoid warning when switching out into another vt
meta_wayland_pointer_get_client_pointer() may be called when the
MetaWaylandPointer as been already shut down, so the hash table will be
NULL at that moment.
2015-08-14 14:48:43 +02:00
Carlos Garnacho
804ab7894f wayland: Use wl_resource_for_each_safe() on pointer client destruction
We must use this by definition since we're removing all elements from the
resource lists.
2015-08-14 14:46:27 +02:00
Carlos Garnacho
2fafa24305 wayland: Implement the wl_pointer_gesture_pinch interface
The pinch gesture resources are part of the MetaWaylandPointerClient, which
will be used during the propagation of CLUTTER_TOUCHPAD_PINCH events.
2015-08-10 17:23:23 +02:00
Carlos Garnacho
51a2f28723 wayland: Implement the wl_pointer_gesture_swipe interface
The swipe gesture resources are part of the MetaWaylandPointerClient, which
will be used during the emission of CLUTTER_TOUCHPAD_SWIPE events.
2015-08-10 17:23:23 +02:00
Jonas Ådahl
1ee387bb31 MetaWaylandPointer: Put client resources in its own struct
Instead of moving around all the bound pointer resources for a client
when changing focus, keep all the resources bound by a client in a per
client struct, and track the focus by having a pointer to the current
active pointer client struct instance.

This will simplify having wl_pointer extensinos sharing the pointer
focus of the wl_pointer by only having to add them to the pointer
client.

https://bugzilla.gnome.org/show_bug.cgi?id=744104
2015-08-10 17:23:23 +02:00
Olivier Fourdan
d593a61b39 wayland: do not generate motion events
Mutter generates a motion event for every button and scroll events,
which confuses Xwayland apps that rely on XMotionEvents for various
purposes, e.g. it fools rxvt jumpy mouse detection code.

Remove the call to notify_motion() from the button and scroll event
handlers to avoid these spurious motion events.

https://bugzilla.gnome.org/show_bug.cgi?id=748705
2015-06-12 11:14:21 -04:00
Jonas Ådahl
9a99a80710 wayland: Fail clients who try to create or destroy a not-top-most popup
If a client creates an xdg_popup given a parent that is a xdg_popup that
is not the most top one in the grab chain, send the
not_the_topmost_popup error.

Also fail a client who destroys a popup that is not the top most one.

https://bugzilla.gnome.org/show_bug.cgi?id=744452
2015-02-17 22:14:47 +08:00
Jonas Ådahl
be77874ec9 wayland: Unmap popup windows when a popup chain is dismissed
When dismissing a popup grab, always unmap every popup window in the
chain, instead of relying on the surfaces and xdg_popups being
destroyed.

https://bugzilla.gnome.org/show_bug.cgi?id=744452
2015-02-17 22:14:47 +08:00
Jonas Ådahl
768286bffb wayland: Move out popup logic to its own file
We'll want to expose popup logic outside of meta-wayland-pointer.c and
one day we'll also probably want to add touch support for popups, so
lets move it to its own file. There are no significant semantical
changes, only refactoring.

https://bugzilla.gnome.org/show_bug.cgi?id=744452
2015-02-17 22:14:47 +08:00
Jonas Ådahl
f5c65d9ea1 wayland: Check the serial when creating popups
Send popup_done immediately if the serial is incorrect so the client can
destroy its resources.

https://bugzilla.gnome.org/show_bug.cgi?id=744452
2015-02-17 22:14:47 +08:00
Jonas Ådahl
945bf626c6 wayland: Introduce MetaWaylandSurfaceRole
Introduce surface roles and use it to ensure a surface never changes
role.

https://bugzilla.gnome.org/show_bug.cgi?id=744452
2015-02-17 22:14:47 +08:00
Jasper St. Pierre
1f0ed5483a Revert "Revert "wayland-pointer: Just use the pointer actor instead of doing a full repick""
The Clutter bug has now been fixed.

This reverts commit ead79f834c.
2015-02-06 09:45:34 -08:00
Jasper St. Pierre
d561b3b18f frames: Clutterify frame event handling
This lets us remove our horrible X11-based, GDK-based hacky frame event
handling in favor of a more sane one in Clutter.
2015-01-19 21:56:08 -08:00
Jasper St. Pierre
9fdf487da1 pointer: Actually do change the focus during window ops
Whenever the compositor takes a grab, we're supposed send leave/enter
events to the current surface, which makes sense, as the compositor
has stolen the pointer from the client.

I forget why I added the special case in the first place, but it's
likely a bug that's since been fixed.

This actually fixes a bug: it prevents the need to double-click on
X11 application titlebars when grabbing them.
2014-11-26 15:32:18 -08:00
Jasper St. Pierre
c5033616e9 pointer: Sync the focus surface instead of calling set_focus directly
set_focus is really meant to be an internal function, and
sync_focus_surface should be able to be called at any time and get
things right.
2014-11-26 15:29:42 -08:00
Jasper St. Pierre
a0e038f34b pointer: Forcibly steal pointer focus when the compositor has a grab 2014-11-26 15:29:25 -08:00
Jasper St. Pierre
0015963457 pointer: Make sure to always update the focus surface after repicking
Our current and focus surfaces might get out of sync during destruction,
which is odd, but just always do this to satisfy it.
2014-11-22 17:06:42 -08:00
Carlos Garnacho
7c5989c978 wayland: Avoid MetaWindow call on non window-backed surfaces
Crossing events may also be gotten on subsurfaces.

https://bugzilla.gnome.org/show_bug.cgi?id=738890
2014-10-23 16:53:44 +02:00
Jasper St. Pierre
ead79f834c Revert "wayland-pointer: Just use the pointer actor instead of doing a full repick"
This reverts commit 33acb5fea0.

The issue here is that the pointer actor does not actually get reset
when the actor's reactivity changes, so we end up with stale picks after
actors are destroyed.

I have a local patch to Clutter for this, but I don't have time to
submit it upstream, so let's just use the ugly code for now.
2014-10-08 13:43:57 -07:00
Jasper St. Pierre
7e431bd6bc Revert "pointer: Repick after the focused surface is destroyed"
This reverts commit e496ed50d6.

This was incorrect. wl_surface_destructor actually does the full repick
-- doing it here is dangerous, because the destroy listeners actually
run *before* the destructor, not after, so the surface is still alive.
2014-10-08 12:38:56 -07:00
Jasper St. Pierre
33acb5fea0 wayland-pointer: Just use the pointer actor instead of doing a full repick
The full repick is unnecessary -- Clutter already does it for us.
2014-10-07 21:30:15 -07:00
Jasper St. Pierre
c1613a16c0 wayland: Put the MetaWaylandBuffer implementation in a new file 2014-10-07 20:42:27 -07:00
Jasper St. Pierre
acd928044f wayland-surface: Remove MetaWaylandSurfaceExtension
It only contained a pointer to a wl_resource, which isn't much of
value. Just replace it with the wl_resource instead. Any future private
data should be handled by our future role system.
2014-10-07 11:23:45 -07:00
Jasper St. Pierre
e496ed50d6 pointer: Repick after the focused surface is destroyed
Having a null focus is incorrect -- we want to pick the surface that's
under the new pointer position.
2014-10-06 16:30:09 -07:00
Jasper St. Pierre
a127d05790 pointer: Make sure to update the focus after ending a grab
Otherwise, we might not reset it after the grab has ended.
2014-10-06 16:19:30 -07:00
Jasper St. Pierre
607730e96c pointer: Fix the behavior of the pointer under DND
When grabbing with DND, we need to leave the pointer alone and
under the client's control. The code here was a bit messy before about
when it unset the window cursor -- it did it whenever there was no
current surface after repicking, which is a bit wrong, since it will
fire during a drag grab.

Move the check for this to update_cursor_surface, which is our standard
"sync" API for this, and then call update_cursor_surface after we set
the focus.
2014-10-06 15:48:42 -07:00
Jasper St. Pierre
9203db0655 pointer: Don't fizzle out surface changes too soon
During a DND grab, pointer->focus_surface is NULL, since the wl_pointer
doesn't have any focused surface (it's in drag mode). In this case, the
drag interface has control of the focus, and when dragging into a NULL
surface, drag_grab_focus won't get called, properly detaching it from
the previous surface.

Let the interface->focus implementation do the fizzling out.

In the future, we should split out wl_pointer's implementation
(pointer->focus_surface) from the Wayland side of the generic pointer
wrapper (pointer->current) and use our event routing system to determine
or similar whether it should go to wl_pointer or wl_data_device.
2014-10-06 14:31:16 -07:00
Jasper St. Pierre
48dfde2073 keyboard/pointer: Calculate the serial once per event
Some applications, like totem, create keyboard/pointer objects from the
same client, and expect it to work. We made this work a while ago, but
due to an oversight in the code, we increment the serial on button press
for every resource that we need to send events to.

Since operations like move/resize use the grab serial of the devices to
determine whether the operation is exact, we need to make sure the same
serial goes to all devices.

Restructure the code so that all that's in the resource loop is the
sending of the event -- all the calculation that's needed happens
outside.

This fixes moving / resizing the Totem window not working sometimes.

https://bugzilla.gnome.org/show_bug.cgi?id=736840
2014-09-18 09:15:13 -06:00
Jasper St. Pierre
276df8f18d keyboard/pointer: Make sure to move focused resources into the list
We only broadcast input to the focus_resource_list, so we need to make
sure it's put in the proper list on startup.

This fixes input not working for windows when they first appear.

Argh. There's always more stuff to fix with keyboard/pointer. Every
single time I think I've fixed it, more stuff pops up.
2014-09-16 21:25:26 -06:00
Jasper St. Pierre
ac6ec168da pointer: Make coding style similar to keyboard 2014-09-16 18:55:49 -06:00
Jasper St. Pierre
4d75de006c wayland: Don't set_focus when the device has been released
It's possible for a released pointer to have repick / set_focus on it as
part of sync_input_focus. When the pointer is actually re-init'd, it
will memset 0, which can cause corruption as our destroy listener has
already been added.

Released devices should be idempotent, so just make sure method calls on
them don't have any effect.
2014-09-05 18:05:44 -07:00
Jasper St. Pierre
e19516ec5a wayland: Don't set_focus for new resources
Otherwise, we can re-add the destroy listener, which can cause
corruption.

Instead, split out the broadcast function, and use that.
2014-09-05 17:58:15 -07:00
Jasper St. Pierre
9feb9d6bca events: Update the pointer position here
Rather than in the Wayland front-end, since it's really a core operation.
2014-08-21 17:00:55 -04:00
Jasper St. Pierre
53876d2b62 wayland-pointer: Squash warning
This should never happen.
2014-08-16 15:38:25 -04:00
Jasper St. Pierre
2b63b17327 wayland-pointer: Insert missing break;s 2014-08-16 15:38:15 -04:00
Jasper St. Pierre
0e758a9e65 display: Establish a separate state variable for routing events
We've long used a switch statement on the grab operation to determine
where events should go. The issue with MetaGrabOp is that it's a mixture
of a few different things, including event routing, state management,
and the behavior to choose during operations.

This leads to poorly defined event routing and hard-to-follow logic,
since it's sometimes unclear what should point where, and our utility
methods for determining grab operations apart can be poorly named.

To fix this, establish the concept of a "event route", which describes
where events should be routed to.
2014-08-15 16:08:49 -04:00
Jasper St. Pierre
71a4fe746e pointer: Update an old function reference
We renamed this and I forgot to rename it here.
2014-08-15 13:49:40 -04:00
Jasper St. Pierre
ab53c0e943 wayland: Simplify slave version management
Slave objects should always be the same version as their parent
constructor, except for the generic wl_registry.bind.
2014-08-04 10:25:20 -04:00