Commit graph

23 commits

Author SHA1 Message Date
Kristian Høgsberg 6848c25677 input: Move surface picking into the pointer grab focus callback
Currently the core input code does surface picking before calling into
the focus callback of the current grab.  Not all grabs need to pick a
surface however, so we're doing work we don't have to in those cases.

For example, the shell move and resize grabs don't need to pick and the
default grab in implicit grab mode doesn't either.

With this change, the pointer grab mechanism is now very simple:
the focus callback is called whenever the pointer may have a new focus,
the motion callback is called whenever the pointer moves and
the button callback whenever a button is pressed or released.
2013-05-08 22:03:45 -04:00
Kristian Høgsberg be6403ed5c input: Get rid of grab focus concept
This was another complication that we had to have to support the
split between libwayland-server and weston.  Different grabs want to send
events relative to different surfaces at different times.  The default
grab switches between sending coordinates relative to the 'current' surface,
that is the surface the pointer is currently above, or the 'clicked'
surface, in case of an implicit grab.

The grab focus was set by the grab implementation and the core input code
would transform the pointer position to surface relative coordinates for the
grab focus and store in grab->x/y.

Now we can just let the grab implementation transform the pointer
coordinates itself, leaving the implementation free to transform
according to whichever surface it wants.  Or not transform at all if
it doesn't need surface relative coordinates (like the shell move and resize
grabs).
2013-05-08 21:03:23 -04:00
Kristian Høgsberg dba25868bc data-device: Verify that the client has an implicit grab when starting a drag
Make sure that the implicit is valid and still in effect as we start
the drag.  Fixes a long standing FIXME.
2013-05-08 15:58:49 -04:00
Kristian Høgsberg 5a9fb35c89 data-device: Eliminate two small helper functions
device_setup_new_drag_surface() and device_release_drag_surface() are both
now fairly small and only called from data_device_start_drag() and
data_device_end_grab() respectively.  Folding the two functions in where
they're called from simplifies the code flow a bit.
2013-05-08 15:58:49 -04:00
Kristian Høgsberg c43aad1ab4 data-device: Rename generic weston_drag 'surface' field to 'icon' 2013-05-08 15:58:49 -04:00
Kristian Høgsberg 054c50a6de data-device: Move all drag-related fields out of weston_seat
We can now allocate a temporary weston_drag structure that we keep all
this drag-and-drop related state in.
2013-05-08 15:58:49 -04:00
Kristian Høgsberg 195b869f0e input: Move sprite fields into weston_pointer from weston_seat 2013-05-08 15:58:49 -04:00
Kristian Høgsberg fe7aa90ed4 compositor: Adapt to wl_surface going away
struct weston_surface is now the only surface type we have (in core, shell.c
has shell_surface, of course).  A lot of code gets simpler and we never
have to try to guess whether an API takes a wl_surface or a weston_surface.
2013-05-08 09:54:37 -04:00
Kristian Høgsberg aad8099c2f data-device: Update drag icon position from configure and motion handlers
We can now update the drag icon position directly from the configure
handler or the grab motion handler, and no longer need
weston_seat_update_drag_surface().
2013-05-07 22:57:15 -04:00
Kristian Høgsberg 415f30cc08 data-device: Map drag icon in configure handler
This how we usually do it, and we avoid 'polling' for mapping in
weston_seat_update_drag_surface().
2013-05-07 22:42:31 -04:00
Kristian Høgsberg 5f95557631 data-device: Setup and release drag surface and beginning and end of drag
Previously we just got the drag_icon signal and had to figure out what
changed.  Now we can directly setup or release the drag icon when the
drag starts and stops.
2013-05-07 21:06:38 -04:00
Kristian Høgsberg 40e44ab18d data-device: Fix dnd regression from weston_seat rewrite
We had a drag_surface in wl_seat and weston_seat which confused me during
the rewrite.
2013-05-07 20:50:26 -04:00
Kristian Høgsberg 624d8f2293 data-device: Don't emit a signal for drag icon changes
The signal used to be in libwayland-server and the listener in weston, but
now they're both in the same file, so lets stop using signal.
2013-05-07 20:46:04 -04:00
Kristian Høgsberg 7848bb687c input: Move drag handling to data-device.c 2013-05-07 11:18:46 -04:00
Kristian Høgsberg e314875d00 input: Merge wl_seat into weston_seat 2013-05-07 09:07:43 -04:00
Kristian Høgsberg 02bbabbd56 input: Rename wl_pointer to weston_pointer
This is now a weston object.
2013-05-06 22:15:05 -04:00
Kristian Høgsberg 2158a889a1 Import input structs and helper functions from wayland 2013-05-06 21:40:32 -04:00
Kristian Høgsberg dade64968c Move wl_data_device implementation to wayland-server 2012-01-06 11:28:53 -05:00
Kristian Høgsberg 9ddb826077 Use new grab api 2012-01-05 11:00:01 -05:00
Kristian Høgsberg a33d0c38d2 data-device: Use a listener list to decouple the x11 selection bridge 2012-01-03 23:01:47 -05:00
Kristian Høgsberg db9bf1e818 data-device: Fix a few bugs in the commit to drop ref-counting
Did not test that change.
2012-01-03 22:43:36 -05:00
Kristian Høgsberg 82d9ee929b data-device: Handle source going away instead of ref-counting it
We have to deal with the data source going away.  Even if we have a
reference to the server side data source, we can't do anything if the
client that provided the source went away.  So just NULL the offers
source pointer in the destroy callback for the source.
2012-01-03 14:11:18 -05:00
Kristian Høgsberg 8334bc1ef9 Rename wayland-compositor to weston
This rename addresses a few problems around the split between core
Wayland and the wayland-demos repository.

1) Initially, we had one big repository with protocol code, sample
compositor and sample clients.  We split that repository to make it
possible to implement the protocol without pulling in the sample/demo
code.  At this point, the compositor is more than just a "demo" and
wayland-demos doesn't send the right message.  The sample compositor
is a useful, self-contained project in it's own right, and we want to
move away from the "demos" label.

2) Another problem is that the wayland-demos compositor is often
called "the wayland compsitor", but it's really just one possible
compositor.  Existing X11 compositors are expected to add Wayland
support and then gradually phase out/modularize the X11 support, for
example.  Conversely, it's hard to talk about the wayland-demos
compositor specifically as opposed to, eg, the wayland protocol or a
wayland compositor in general.

We are also renaming the repo to weston, and the compositor
subdirectory to src/, to emphasize that the main "output" is the
compositor.
2012-01-03 11:04:04 -05:00
Renamed from compositor/data-device.c (Browse further)