1
0
Fork 0
Commit graph

130 commits

Author SHA1 Message Date
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
Carlos Garnacho
1677a068ce wayland: Unset keyboard/pointer focus when releasing the data for these devices
Otherwise the focus_surface_listener list element becomes stale, and then
mangled if the devices' data is initialized again, and the memory memset().

https://bugzilla.gnome.org/show_bug.cgi?id=733563
2014-07-22 18:01:29 +02:00
Jasper St. Pierre
e49bbe2ed8 cursor-tracker: Don't require a screen
This allows us to do initialization earlier and not have to poke into
Wayland internals from the cursor tracker.
2014-07-22 11:10:14 -04:00
Marek Chalupa
b2183dfda7 wayland-pointer: fix condition for grabbing
It returns FALSE when button_count is not 0. But grabbing for
move/resize is activated by clicking the button, so this condition
disallows the wayland clients to be moved/resized.

https://bugzilla.gnome.org/show_bug.cgi?id=731237
2014-06-26 10:50:29 -04:00
Jasper St. Pierre
21d7c1a850 wayland-pointer: Remove useless initialization
There is no way this value will ever be read, because we set the
cursor_surface to NULL, this is set at the same time as cursor_surface,
and it's only read if cursor_surface is non-NULL.
2014-06-11 15:15:58 -04:00
Jonas Ådahl
048f035d30 wayland: Scale smooth scroll events to pointer motion coordinate space
Smooth scroll event vectors from clutter have the same dimensions as the
ones from from Xi2, i.e. where 1.0 is 1 discrete scroll step. To scale
these to the coordinate space used by wl_pointer.axis
vertical/horizontal scroll events, multiply the vector by 10.

https://bugzilla.gnome.org/show_bug.cgi?id=729601
2014-05-31 14:22:10 +02:00
Jasper St. Pierre
6408e59c7c wayland: Move checks for grabbing into a central location
This means that we won't have as much work to do to introduce similar
checks for touch.
2014-05-22 10:58:07 -04:00
Jasper St. Pierre
8d9653dece pointer: Update the button count after repicking
The default focus interface uses the button count to determine
whether we should update the pointer focused surface. When releasing
an implicit grab, we need to send the button release events to the
implicitly grabbed surface, so we can't reset the focus surface too
soon. We already explicitly set the focus at the end of implicit
grabs, so counting the buttons after is perfectly fine.
2014-05-15 13:59:28 -04:00
Adel Gadllah
f9bffae9fd wayland: Scale native surfaces for hidpi
Scale surfaces based on output scale and the buffer scale set by them.
We pick the scale factor of the monitor there are mostly on.

We only handle native i.e non xwayland / legacy clients yet.

https://bugzilla.gnome.org/show_bug.cgi?id=728902
2014-05-03 10:11:55 +02:00
Adel Gadllah
31c925c602 wayland: Add basic hidpi support
Advertise the scale factor on the output and transform pointer and damage
events as well as input and opaque regions for clients
that scale up by themselves i.e use set_buffer_scale.

We do not scale any 'legacy' apps yet.

https://bugzilla.gnome.org/show_bug.cgi?id=728902
2014-05-03 10:11:51 +02:00